@tinkerlandai/longplay-sdk 0.10.40 → 0.10.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +56 -1
  3. package/README.zh-CN.md +5 -1
  4. package/dist/{ai-usage-DXwAGTxT.d.ts → ai-usage-B-qsCn-k.d.ts} +1 -1
  5. package/dist/{api-r6FfVQpg.d.ts → api-DpRb_Pd3.d.ts} +52 -0
  6. package/dist/check-response-SR3PDVGE.js +1 -0
  7. package/dist/chunk-24Z3THUR.js +1 -0
  8. package/dist/{chunk-FCDWCQYC.js → chunk-26UXCYBP.js} +1 -1
  9. package/dist/{chunk-7QDT6DO7.js → chunk-2LERKK7O.js} +1 -1
  10. package/dist/{chunk-RV6UAUK2.js → chunk-2LUVO7GM.js} +1 -1
  11. package/dist/{chunk-C2KT5ZFU.js → chunk-2P2YSNYU.js} +1 -1
  12. package/dist/{chunk-X6ONZGRY.js → chunk-2RUJXZCO.js} +1 -1
  13. package/dist/chunk-2XF34Q6D.js +1 -0
  14. package/dist/chunk-4B4RB36N.js +1 -0
  15. package/dist/chunk-5PNH2FPI.js +1 -0
  16. package/dist/{chunk-EREQZWGI.js → chunk-6EBS6MLW.js} +1 -1
  17. package/dist/chunk-6OVMC5BT.js +1 -0
  18. package/dist/{chunk-ASDJTOGM.js → chunk-6STWY5GX.js} +1 -1
  19. package/dist/chunk-756SIMZF.js +1 -0
  20. package/dist/chunk-7IVLNV5H.js +1 -0
  21. package/dist/chunk-ANXK3B5B.js +1 -0
  22. package/dist/{chunk-P6C3PNMQ.js → chunk-AQQJPP3P.js} +1 -1
  23. package/dist/chunk-BWRRZ2NW.js +1 -0
  24. package/dist/{chunk-O4KXODTJ.js → chunk-CQRSMCCG.js} +1 -1
  25. package/dist/{chunk-YLPQLD2A.js → chunk-DPEMW2FO.js} +1 -1
  26. package/dist/chunk-EECTJHI6.js +1 -0
  27. package/dist/{chunk-CZ4TQCUV.js → chunk-EJSDOSP5.js} +1 -1
  28. package/dist/{chunk-POCDWUD3.js → chunk-EON4IKWR.js} +1 -1
  29. package/dist/chunk-EOPKOAR5.js +1 -0
  30. package/dist/{chunk-QZTTKH2H.js → chunk-FTVNGN6Z.js} +1 -1
  31. package/dist/{chunk-WLGLQJ6M.js → chunk-G6CWZBT5.js} +1 -1
  32. package/dist/chunk-GXADA7OV.js +1 -0
  33. package/dist/{chunk-ORMQJAQE.js → chunk-H26F3IOI.js} +1 -1
  34. package/dist/{chunk-BYP4KVB3.js → chunk-H7AHDGVU.js} +2 -2
  35. package/dist/chunk-HGH2X6QM.js +1 -0
  36. package/dist/chunk-KINNES62.js +1 -0
  37. package/dist/{chunk-LSPHUA7V.js → chunk-MYDMOAKX.js} +1 -1
  38. package/dist/chunk-NFY7DKVJ.js +1 -0
  39. package/dist/{chunk-YY445FBU.js → chunk-O3HLNU6T.js} +1 -1
  40. package/dist/chunk-OAAS5LJY.js +1 -0
  41. package/dist/{chunk-2DPNSTCN.js → chunk-OEONV3JY.js} +1 -1
  42. package/dist/chunk-P6XQC7GG.js +1 -0
  43. package/dist/chunk-PYLX3WF6.js +1 -0
  44. package/dist/{chunk-5DZJCFNQ.js → chunk-QJMM37CB.js} +1 -1
  45. package/dist/{chunk-33ZVZOSC.js → chunk-RQTYIUWP.js} +1 -1
  46. package/dist/chunk-S4P4UUUF.js +1 -0
  47. package/dist/{chunk-57GPGWSK.js → chunk-SYHMHKFQ.js} +1 -1
  48. package/dist/{chunk-67AY54E2.js → chunk-TGPZJ5A7.js} +1 -1
  49. package/dist/chunk-VILB5M4X.js +1 -0
  50. package/dist/chunk-VJHURKRY.js +1 -0
  51. package/dist/{chunk-VC2HPREX.js → chunk-VWRQBQZD.js} +1 -1
  52. package/dist/chunk-W35FZWGG.js +1 -0
  53. package/dist/chunk-W3J2SIPY.js +1 -0
  54. package/dist/chunk-Y2HXKANG.js +1 -0
  55. package/dist/{configuration-sync-BHrAf-ql.d.ts → configuration-sync-7ruSsSrL.d.ts} +150 -1
  56. package/dist/content-XYUJFGY2.js +1 -0
  57. package/dist/funnel-host-purchase-BNS3242X.js +1 -0
  58. package/dist/{funnel-local-client-DR8OpKGU.d.ts → funnel-local-client-BMxDQWE6.d.ts} +51987 -22983
  59. package/dist/{funnel-node-evaluation-COxXtZEQ.d.ts → funnel-node-evaluation-COIh1hKs.d.ts} +3 -0
  60. package/dist/funnel-paywall-prerender-DDQI3GAZ.js +1 -0
  61. package/dist/{funnel-process-client-C87U4r_G.d.ts → funnel-process-client-DNR9nHs8.d.ts} +7338 -3163
  62. package/dist/funnel-route-prediction-BT5ZWU54.js +1 -0
  63. package/dist/funnel-route-source-7ZJMZRID.js +1 -0
  64. package/dist/funnel-runtime-host-3SSDNG24.js +1 -0
  65. package/dist/index.d.ts +273 -22
  66. package/dist/index.js +1 -1
  67. package/dist/merchant-bridge-contracts-YU53UKUN.js +1 -0
  68. package/dist/native-shell.js +1 -1
  69. package/dist/openrouter.d.ts +2 -2
  70. package/dist/openrouter.js +1 -1
  71. package/dist/operation-contracts-GEIGP23I.js +1 -0
  72. package/dist/page.d.ts +1 -1
  73. package/dist/page.js +1 -1
  74. package/dist/paywall-YZAEI7TF.js +1 -0
  75. package/dist/paywall-content-QBSB5NA7.js +1 -0
  76. package/dist/paywall-session-MHBAZLS7.js +1 -0
  77. package/dist/popup.d.ts +2 -2
  78. package/dist/popup.js +1 -1
  79. package/dist/{presentation-loading-B_v5XZtM.d.ts → presentation-loading-B2OeFzRN.d.ts} +1 -0
  80. package/dist/react-native.d.ts +6 -6
  81. package/dist/react-native.js +1 -1
  82. package/dist/screen-renderer-SEJG7A2C.js +1 -0
  83. package/dist/server.d.ts +34204 -17797
  84. package/dist/server.js +1 -1
  85. package/dist/{visual-dom-5LUN4AHO.js → visual-dom-7YYJQ2ZI.js} +1 -1
  86. package/dist/visual.js +1 -1
  87. package/package.json +1 -1
  88. package/dist/check-response-DRQCUWDW.js +0 -1
  89. package/dist/chunk-3NCMYTNG.js +0 -1
  90. package/dist/chunk-4TEZZZYK.js +0 -1
  91. package/dist/chunk-6PG3AS3G.js +0 -1
  92. package/dist/chunk-AZFWG352.js +0 -1
  93. package/dist/chunk-C3GYAKIU.js +0 -1
  94. package/dist/chunk-ESAHTG3Y.js +0 -1
  95. package/dist/chunk-GC6JBIRQ.js +0 -1
  96. package/dist/chunk-IJKAQNK6.js +0 -1
  97. package/dist/chunk-IOJVF52Q.js +0 -1
  98. package/dist/chunk-OOD2VDDP.js +0 -1
  99. package/dist/chunk-P23JOPR5.js +0 -1
  100. package/dist/chunk-PJS7M6X3.js +0 -1
  101. package/dist/chunk-PZOQV6MU.js +0 -1
  102. package/dist/chunk-RFNIGJOL.js +0 -1
  103. package/dist/chunk-RULQQ7WI.js +0 -1
  104. package/dist/chunk-U7GH4VME.js +0 -1
  105. package/dist/chunk-VOKEZHAH.js +0 -1
  106. package/dist/chunk-XDOKFAE6.js +0 -1
  107. package/dist/chunk-Y6HL2IY2.js +0 -1
  108. package/dist/content-QUEVNSXD.js +0 -1
  109. package/dist/funnel-host-purchase-LMVMJNUO.js +0 -1
  110. package/dist/funnel-paywall-prerender-LGUSHEP3.js +0 -1
  111. package/dist/funnel-runtime-host-H5FM67UC.js +0 -1
  112. package/dist/merchant-bridge-contracts-LZSQYE3O.js +0 -1
  113. package/dist/operation-contracts-O7TCDGV4.js +0 -1
  114. package/dist/paywall-UANWOKKC.js +0 -1
  115. package/dist/paywall-content-CHPX2P77.js +0 -1
  116. package/dist/paywall-session-3BNUC5ZE.js +0 -1
  117. package/dist/screen-renderer-FFVZ64MR.js +0 -1
  118. /package/dist/{chunk-RGEBK6UF.js → chunk-2ULWP26K.js} +0 -0
  119. /package/dist/{chunk-OJM6ORHE.js → chunk-4PGYQ2TI.js} +0 -0
  120. /package/dist/{chunk-CILM5XMH.js → chunk-PBBREFS5.js} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { OpenRouter } from '@openrouter/sdk';
2
2
  import { ChatUsage } from '@openrouter/sdk/models';
3
- import { F as FoundationApi } from './api-r6FfVQpg.js';
4
- import { c as createAiPricing, A as AiUsageContext, a as AiTokenUsage, b as AiTokenQuote } from './ai-usage-DXwAGTxT.js';
3
+ import { F as FoundationApi } from './api-DpRb_Pd3.js';
4
+ import { c as createAiPricing, A as AiUsageContext, a as AiTokenUsage, b as AiTokenQuote } from './ai-usage-B-qsCn-k.js';
5
5
  import './screen-qUBRsUi9.js';
6
6
  import 'zod';
7
7
  import 'zod/v4';
@@ -1 +1 @@
1
- import"./chunk-YY445FBU.js";import"./chunk-57GPGWSK.js";import"./chunk-PZOQV6MU.js";import"./chunk-FCDWCQYC.js";import"./chunk-OOD2VDDP.js";import{a as i}from"./chunk-WLGLQJ6M.js";import"./chunk-RULQQ7WI.js";import"./chunk-RV6UAUK2.js";import{b as A}from"./chunk-RGEBK6UF.js";import"./chunk-WOT6VMZA.js";var c=A.number().int().min(0).max(1e9);function R(e,o){let a=c.parse(e.promptTokens),p=c.parse(e.completionTokens),s=c.parse(e.promptTokensDetails?.cachedTokens??0),t=c.parse(e.promptTokensDetails?.cacheWriteTokens??0),r=c.parse(e.promptTokensDetails?.audioTokens??0),l=c.parse(e.completionTokensDetails?.audioTokens??0),n=c.parse(e.completionTokensDetails?.reasoningTokens??0);if(c.parse(e.totalTokens)!==a+p||s+t+r>a||n+l>p||(e.promptTokensDetails?.videoTokens??0)>0)throw new i("AI_USAGE_UNAVAILABLE","Token pools must conserve usage; video needs an explicit token mapper");return{input:a-s-t-r,output:p-l-(o==="separate"?n:0),cache_read:s,cache_write:t,input_audio:r,output_audio:l,reasoning:o==="separate"?n:0}}function I(e){if(!Number.isFinite(e)||e<0)throw new i("AI_USAGE_UNAVAILABLE","Provider cost must be a nonnegative USD amount");let o=String(e),a=o.includes("e")?e.toFixed(18).replace(/0+$/,"").replace(/\.$/,""):o;if(!/^(0|[1-9]\d{0,11})(\.\d{1,18})?$/.test(a)||Number(a)!==e)throw new i("AI_USAGE_UNAVAILABLE","Provider cost exceeds the supported precision");return a}async function f(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning)||!e.modelId||!e.generationId)throw new i("INVALID_REQUEST","Actual model, generation ID and reasoning pricing are required");let o={context:e.context,generationId:e.generationId,modelId:`openrouter/${e.modelId}`,usage:e.usage,tokens:null,quote:null,receipt:null,phase:"captured"};await e.persist(o);let a=e.mapTokens?e.mapTokens(e.usage):R(e.usage,e.reasoning),p=e.usage.cost==null?void 0:I(e.usage.cost),s=e.quote??await e.pricing.quoteTokens({modelId:o.modelId,tokens:a});if(s.pricing.modelId!==o.modelId||Object.keys(a).some(l=>a[l]!==s.tokens[l]))throw new i("INVALID_REQUEST","Saved quote must match the provider model and token pools");await e.persist({...o,tokens:a,quote:s,phase:"quoted"});let t=await e.pricing.trackTokens(e.client,{...e.context,quote:s,providerCostUsd:p,generationId:e.generationId});if(!t.receipt.accepted)throw new i("AI_BALANCE_REJECTED","OpenRouter usage was saved but the balance request was rejected");let r={...o,tokens:a,quote:s,receipt:t,phase:"settled"};return await e.persist(r),r}function T(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning))throw new i("INVALID_REQUEST","Reasoning pricing is required");let o=e.openRouter.chat;async function a(t){if(!t.usage||!t.modelId||!t.generationId)throw new i("AI_USAGE_UNAVAILABLE","OpenRouter did not return final usage and the actual model");await f({...e,context:t.context,generationId:t.generationId,modelId:t.modelId.slice(11),usage:t.usage})}let p=async(t,r)=>{let n={context:await e.context(),generationId:null,modelId:null,usage:null,tokens:null,quote:null,receipt:null,phase:"incomplete"},d;try{d=await o.send(t,r)}catch(g){throw await e.persist(n),g}if(!(d instanceof ReadableStream)){if(n={...n,generationId:d.id,modelId:d.model?`openrouter/${d.model}`:null,usage:d.usage??null},!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter omitted final accounting");return await a(n),d}let w=d.getReader(),m=!1;return new ReadableStream({async pull(g){try{let{value:u,done:k}=await w.read();if(k){if(m=!0,!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter stream ended without final accounting");await a(n),g.close();return}if(u.error)throw new i("AI_PROVIDER_ERROR",u.error.message);u.usage&&(n={...n,generationId:u.id,modelId:u.model?`openrouter/${u.model}`:null,usage:u.usage}),g.enqueue(u)}catch(u){m||(m=!0,await e.persist(n)),await w.cancel(u),g.error(u)}},async cancel(g){m||(m=!0,await e.persist(n)),await w.cancel(g)}})},s=new Proxy(o,{get(t,r){return r==="send"?p:Reflect.get(t,r,t)}});return new Proxy(e.openRouter,{get(t,r){return r==="chat"?s:Reflect.get(t,r,t)}})}export{T as createOpenRouterUsageClient,f as trackOpenRouterUsage};
1
+ import"./chunk-O3HLNU6T.js";import"./chunk-SYHMHKFQ.js";import"./chunk-2XF34Q6D.js";import"./chunk-26UXCYBP.js";import{a as i}from"./chunk-G6CWZBT5.js";import"./chunk-S4P4UUUF.js";import"./chunk-2LUVO7GM.js";import{b as A}from"./chunk-2ULWP26K.js";import"./chunk-WOT6VMZA.js";var c=A.number().int().min(0).max(1e9);function R(e,o){let a=c.parse(e.promptTokens),p=c.parse(e.completionTokens),s=c.parse(e.promptTokensDetails?.cachedTokens??0),t=c.parse(e.promptTokensDetails?.cacheWriteTokens??0),r=c.parse(e.promptTokensDetails?.audioTokens??0),l=c.parse(e.completionTokensDetails?.audioTokens??0),n=c.parse(e.completionTokensDetails?.reasoningTokens??0);if(c.parse(e.totalTokens)!==a+p||s+t+r>a||n+l>p||(e.promptTokensDetails?.videoTokens??0)>0)throw new i("AI_USAGE_UNAVAILABLE","Token pools must conserve usage; video needs an explicit token mapper");return{input:a-s-t-r,output:p-l-(o==="separate"?n:0),cache_read:s,cache_write:t,input_audio:r,output_audio:l,reasoning:o==="separate"?n:0}}function I(e){if(!Number.isFinite(e)||e<0)throw new i("AI_USAGE_UNAVAILABLE","Provider cost must be a nonnegative USD amount");let o=String(e),a=o.includes("e")?e.toFixed(18).replace(/0+$/,"").replace(/\.$/,""):o;if(!/^(0|[1-9]\d{0,11})(\.\d{1,18})?$/.test(a)||Number(a)!==e)throw new i("AI_USAGE_UNAVAILABLE","Provider cost exceeds the supported precision");return a}async function f(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning)||!e.modelId||!e.generationId)throw new i("INVALID_REQUEST","Actual model, generation ID and reasoning pricing are required");let o={context:e.context,generationId:e.generationId,modelId:`openrouter/${e.modelId}`,usage:e.usage,tokens:null,quote:null,receipt:null,phase:"captured"};await e.persist(o);let a=e.mapTokens?e.mapTokens(e.usage):R(e.usage,e.reasoning),p=e.usage.cost==null?void 0:I(e.usage.cost),s=e.quote??await e.pricing.quoteTokens({modelId:o.modelId,tokens:a});if(s.pricing.modelId!==o.modelId||Object.keys(a).some(l=>a[l]!==s.tokens[l]))throw new i("INVALID_REQUEST","Saved quote must match the provider model and token pools");await e.persist({...o,tokens:a,quote:s,phase:"quoted"});let t=await e.pricing.trackTokens(e.client,{...e.context,quote:s,providerCostUsd:p,generationId:e.generationId});if(!t.receipt.accepted)throw new i("AI_BALANCE_REJECTED","OpenRouter usage was saved but the balance request was rejected");let r={...o,tokens:a,quote:s,receipt:t,phase:"settled"};return await e.persist(r),r}function T(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning))throw new i("INVALID_REQUEST","Reasoning pricing is required");let o=e.openRouter.chat;async function a(t){if(!t.usage||!t.modelId||!t.generationId)throw new i("AI_USAGE_UNAVAILABLE","OpenRouter did not return final usage and the actual model");await f({...e,context:t.context,generationId:t.generationId,modelId:t.modelId.slice(11),usage:t.usage})}let p=async(t,r)=>{let n={context:await e.context(),generationId:null,modelId:null,usage:null,tokens:null,quote:null,receipt:null,phase:"incomplete"},d;try{d=await o.send(t,r)}catch(g){throw await e.persist(n),g}if(!(d instanceof ReadableStream)){if(n={...n,generationId:d.id,modelId:d.model?`openrouter/${d.model}`:null,usage:d.usage??null},!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter omitted final accounting");return await a(n),d}let w=d.getReader(),m=!1;return new ReadableStream({async pull(g){try{let{value:u,done:k}=await w.read();if(k){if(m=!0,!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter stream ended without final accounting");await a(n),g.close();return}if(u.error)throw new i("AI_PROVIDER_ERROR",u.error.message);u.usage&&(n={...n,generationId:u.id,modelId:u.model?`openrouter/${u.model}`:null,usage:u.usage}),g.enqueue(u)}catch(u){m||(m=!0,await e.persist(n)),await w.cancel(u),g.error(u)}},async cancel(g){m||(m=!0,await e.persist(n)),await w.cancel(g)}})},s=new Proxy(o,{get(t,r){return r==="send"?p:Reflect.get(t,r,t)}});return new Proxy(e.openRouter,{get(t,r){return r==="chat"?s:Reflect.get(t,r,t)}})}export{T as createOpenRouterUsageClient,f as trackOpenRouterUsage};
@@ -0,0 +1 @@
1
+ import{e as o}from"./chunk-QJMM37CB.js";import"./chunk-DPEMW2FO.js";import"./chunk-H26F3IOI.js";import"./chunk-6EBS6MLW.js";import"./chunk-EOPKOAR5.js";import"./chunk-OAAS5LJY.js";import"./chunk-5PNH2FPI.js";import"./chunk-RQTYIUWP.js";import"./chunk-7IVLNV5H.js";import"./chunk-VJHURKRY.js";import"./chunk-VILB5M4X.js";import"./chunk-SYHMHKFQ.js";import"./chunk-26UXCYBP.js";import"./chunk-KINNES62.js";import"./chunk-Y2HXKANG.js";import"./chunk-HGH2X6QM.js";import"./chunk-MYDMOAKX.js";import"./chunk-EECTJHI6.js";import"./chunk-S4P4UUUF.js";import"./chunk-2ULWP26K.js";import"./chunk-CQRSMCCG.js";import"./chunk-PBBREFS5.js";import"./chunk-WOT6VMZA.js";export{o as apiOperations};
package/dist/page.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ConfigurationSync } from './configuration-sync-BHrAf-ql.js';
1
+ import { C as ConfigurationSync } from './configuration-sync-7ruSsSrL.js';
2
2
  import { J as JsonValue, R as Result } from './growth-rules-B4YYy64R.js';
3
3
  import { z } from 'zod';
4
4
  import './screen-qUBRsUi9.js';
package/dist/page.js CHANGED
@@ -1 +1 @@
1
- import{d as o,e as r,f as e,g as f}from"./chunk-2DPNSTCN.js";import"./chunk-C2KT5ZFU.js";import"./chunk-3VUPVXAV.js";import"./chunk-RV6UAUK2.js";import"./chunk-O4KXODTJ.js";import"./chunk-CILM5XMH.js";import"./chunk-DSPLGTQI.js";import"./chunk-WOT6VMZA.js";export{f as createPageExperiments,o as mergeQueryStrings,r as pageAttributes,e as readPayload};
1
+ import{d as o,e as r,f as e,g as f}from"./chunk-OEONV3JY.js";import"./chunk-2P2YSNYU.js";import"./chunk-3VUPVXAV.js";import"./chunk-2LUVO7GM.js";import"./chunk-DSPLGTQI.js";import"./chunk-CQRSMCCG.js";import"./chunk-PBBREFS5.js";import"./chunk-WOT6VMZA.js";export{f as createPageExperiments,o as mergeQueryStrings,r as pageAttributes,e as readPayload};
@@ -0,0 +1 @@
1
+ import{a as Ht,c as Qt,d as pt,f as mt,g as jt,k as Bt}from"./chunk-EJSDOSP5.js";import{b as dt}from"./chunk-W32FI2A2.js";import{d as Lt,e as _t,f as Mt,h as ft,i as qe,j as Ut,k as $t,l as Vt}from"./chunk-AQQJPP3P.js";import{a as Ot,c as ct,d as Tt,e as St}from"./chunk-PYLX3WF6.js";import{a as Fe,b as me,d as ut,f as Dt,j as Nt}from"./chunk-W35FZWGG.js";import{b as ce}from"./chunk-RQTYIUWP.js";import{B as I,C as Be,D as Ie,E as Ae,y as Rt}from"./chunk-7IVLNV5H.js";import"./chunk-VJHURKRY.js";import"./chunk-VILB5M4X.js";import"./chunk-2XF34Q6D.js";import"./chunk-26UXCYBP.js";import{r as be,t as pe}from"./chunk-KINNES62.js";import{i as At}from"./chunk-Y2HXKANG.js";import{c as le,j as xe}from"./chunk-HGH2X6QM.js";import{c as lt}from"./chunk-MYDMOAKX.js";import"./chunk-EECTJHI6.js";import{a as P}from"./chunk-G6CWZBT5.js";import"./chunk-S4P4UUUF.js";import"./chunk-2LUVO7GM.js";import"./chunk-2ULWP26K.js";import{a as G}from"./chunk-DSPLGTQI.js";import"./chunk-CQRSMCCG.js";import"./chunk-PBBREFS5.js";import"./chunk-WOT6VMZA.js";async function Ft(L,i,S){if(!Ie(i))throw new P("INVALID_RESPONSE","A verified completed purchase is required");let k=L?xe.parse(L):null;if(await S.onComplete?.(i),!k||!S.check)return;let M=xe.parse(await S.check());if(M.internal_feature_id!==k.internal_feature_id||M.quantity!==k.quantity||k.observation!==void 0&&(M.observation===void 0||M.observation.requirementDigest!==k.observation.requirementDigest||M.observation.authority!==k.observation.authority||lt(M.observation.subject)!==lt(k.observation.subject)))throw new P("INVALID_RESPONSE","The access requirement changed");M.allowed&&await S.onAccessGranted?.(M)}function ht(L){return Object.entries(L.document.buttons).filter(([,i])=>i.type==="checkout"&&i.product.type==="fixed"&&!ce(i.product,{},L.capabilities)).map(([i])=>i)}function qt(L,i){let S=I(i)?void 0:i.lines[0];if(!I(i)&&(i.lines.length!==1||!S))return;let k=I(i)?i.productVersionId:S.productVersionId,{screen:M,buttons:X}=L.document,A=new Map(I(i)?Object.entries(i.featureQuantities??{}):(S?.prepaid??[]).map(h=>[h.internal_feature_id,h.quantity]));function Z(h,m){if(h.hidden)return!1;if(h.type==="plan_picker"&&L.capabilities.pickers[h.id]?.options.includes(k))return m[h.id]=k,!0;if(h.type==="quantity_picker"){let Y=A.get(h.internalFeatureId);return Y!==void 0&&(!h.bind?.plan||h.bind.plan===k)&&(m[h.id]=Y),!1}if(h.type==="button"&&h.action){let Y=X[h.action];return Y?.type==="checkout"&&Y.product.type==="fixed"&&Y.product.productVersionId===k}if(h.type!=="stack")return!1;let z=h.interaction,r=h.bind?.plan===k;for(let[Y,d]of h.children.entries()){let re={},D=Z(d,re);if(z?.type==="toggle"||z?.type==="tabs"){if(!D)continue;return m[h.id]=z.type==="toggle"?Y===0:d.id,Object.assign(m,re),!0}Object.assign(m,re),D&&(r=!0,z?.type==="select"&&z.purpose==="product"&&z.pickerId&&d.type==="stack"&&d.bind?.plan===k&&(m[h.id]=d.id,m[z.pickerId]=k))}return r}for(let h of M.pages){let m={__page:h.id};if(Z(h.root,m))return m}}async function Ln(L,i,S){let k=i.focusAtReveal?()=>{}:ft(L.ownerDocument),M=()=>{A.finish("dismissed"),k()},X=()=>M(),A=Ut(L,i,"paywall",()=>{M(),G(i.onDismiss)},Ht);i.signal?.throwIfAborted(),i.signal?.addEventListener("abort",X,{once:!0});let Z=null,h,m,z;try{if(A.start(!0,i.loadingDocument?.screen.strings.defaultLocale,i.loadingDocument??null),A.cancelled)throw new DOMException("Presentation cancelled","AbortError");if(Z=i.check?xe.parse(await A.wait(i.check(),qe)):null,Z?.allowed)return A.finish("skipped"),i.signal?.removeEventListener("abort",X),k(),await i.onAccessGranted?.(Z),{check:Z,host:null};let[e,t]=await Promise.allSettled([A.wait(import("./screen-renderer-SEJG7A2C.js")),A.wait(i.start().then(a=>(A.cancelled&&a.destroy(),a)),qe)]);if(e.status==="rejected")throw t.status==="fulfilled"&&t.value.destroy(),e.reason;if(t.status==="rejected")throw t.reason;z=e.value,h=t.value,i.signal?.throwIfAborted(),h.signal?.throwIfAborted(),h.signal?.addEventListener("abort",X,{once:!0});let n=h.view??await A.wait(h.refresh(),qe);if(!n)throw new P("INVALID_RESPONSE","Paywall presentation is missing");h.signal?.throwIfAborted(),m=n}catch(e){throw A.finish("error",e),i.signal?.removeEventListener("abort",X),h?.signal?.removeEventListener("abort",X),h?.destroy(),k(),e}let r=h,{mountScreenPreview:Y}=z,d=L.ownerDocument,re=new AbortController,D=d.createElement("section"),he=d.createElement("div"),J=d.createElement("div"),Ge=i.mountControls,W=Ge?d.createElement("div"):void 0,f=d.createElement("p"),C=d.createElement("button"),E=d.createElement("button"),R=d.createElement("dialog"),We=r.locale||m.document.screen.strings.defaultLocale,o=We.toLowerCase().startsWith("zh"),Gt=o?"\u6B63\u5728\u5904\u7406\u2026":"Processing\u2026",Wt=o?"\u6B63\u5728\u51C6\u5907\u62A5\u4EF7\u2026":"Preparing your price\u2026",_=Qt(m.document.screen.theme);D.dataset.indianaPaywall="",D.setAttribute("aria-label",m.document.name),D.style.cssText=_.root,J.style.cssText=_.controls,f.style.cssText=_.message,f.setAttribute("role","status"),E.style.cssText=_.link,E.textContent=o?"\u5173\u95ED":"Close",C.style.cssText=_.secondary,C.textContent=o?"\u91CD\u8BD5":"Retry",C.hidden=!0,J.append(f,C,E),W&&(W.style.cssText="flex:1 0 100%;min-width:0",W.hidden=!0,J.prepend(W)),D.append(he,J);let ze=()=>{if(W){let a=!W.childElementCount&&!W.textContent?.trim();W.hidden!==a&&(W.hidden=a)}let e=ie??J,t=[...e.children].every(a=>a===f?!f.textContent:a.hidden),n=[...e.children].some(a=>a===E?!1:a===f?!!f.textContent:!a.hidden);e.style.cssText=t?_.controls.replace(/padding:[^;]+/,"padding:0"):n?`${_.controls};${_.pinned}`:_.controls,Xe()},yt=typeof MutationObserver>"u"?void 0:new MutationObserver(ze);yt?.observe(D,{attributes:!0,attributeFilter:["hidden"],characterData:!0,childList:!0,subtree:!0});let Re=m.document.presentation,zt=Object.entries(m.document.buttons).filter(([,e])=>e.type==="close").map(([e])=>e),B,wt,Ye=!1,gt=JSON.stringify(m.capabilities),Je=e=>ue&&!Ce?Object.entries(e.document.buttons).filter(([,t])=>t.type==="checkout").map(([t])=>t):ht(e);function Oe(e){if(w)return;m=e;let t=JSON.stringify(e.capabilities);if(t!==gt){let n=!b&&!r.quote&&!r.operation?Fe(e,q,Ct):q;JSON.stringify(n)!==JSON.stringify(q)?(q=n,B?.update(e.document.screen,We,{capabilities:me(e),unavailableActions:Je(e),serverInput:{bindings:[],answers:{}},selection:q})):B?.updateCapabilities(me(e),Je(e)),gt=t}Kt(e),ve()}let x,Ke=0;function Xe(){let e=d.defaultView;if(!x?.responsive||!e)return;let t=ie??J,n=e.innerHeight-(x.type==="modal"?32:0);t.style.maxHeight=`${Math.max(1,n)}px`,t.style.overflowY="auto",t.style.flexShrink="0",Ke=Math.max(1,n-t.getBoundingClientRect().height),B?.resizeViewport?.(Ke,e.innerWidth)}let w=!1,ue=!1,b=null,Ze,Te=!1,bt=!1,de=!1,et,tt=!1,ee,ie;function Yt(){return ue||w||ee||tt?{type:"recover",operationId:r.operation?.operationId??r.quote?.operationId??null,requestId:null}:ct(r)}let O=()=>!w&&!Te&&!ee&&i.canInteract?.()!==!1,F,ye=!1,we=!1,p=null,te=null,nt="",fe=()=>i.checkoutNavigation==="after_confirmation"&&!!(i.terminateCheckout||i.resumeCheckout),q={},Ct=new Set,Ce,K=null;function ve(){if(!fe()||!B?.updateCheckoutControls)return;let e=r.quote,t=!K&&!!e&&!!r.operation&&U(r.operation).type==="checkout",n=Object.entries(m.document.buttons).flatMap(([a,l])=>l.type==="checkout"?[{actionId:a,policy:l}]:[]);B.updateCheckoutControls({actions:n.map(({actionId:a})=>a),resume:t?n.filter(({actionId:a,policy:l})=>Le(e,m,a,l.product,q)).map(({actionId:a})=>a):[],resumeLabel:o?"\u7EE7\u7EED\u4ED8\u6B3E":"Continue checkout",busy:Ce})}function vt(){te?.remove(),te=null}async function rt(){if(K)return;if(i.resumeCheckout&&r.operation){await i.resumeCheckout(r.operation.operationId);return}let e=await r.read();if(U(e).type!=="checkout")return $(e,!1);O()&&(De.delete(e.operationId),await _e(e))}function Pt(){f.textContent=o?"\u6682\u65F6\u65E0\u6CD5\u6253\u5F00\u4ED8\u6B3E\u9875\u9762\u3002\u8BF7\u91CD\u8BD5\u3002":"Couldn\u2019t open checkout. Try again.",C.hidden=!0}async function kt(e=!1){let t=K;if(!t)return;C.hidden=!0;let n=Date.now()+2e4;for(;O();){let a=await r.read();if(a.operationId!==t.operationId)throw new P("PURCHASE_PENDING","The original Checkout changed");if(!O())break;let l=U(a);if(l.type==="native"){K=null,vt(),b=t.selection,F=t.coupon,ye=!1,we=!1,await ke();return}if(l.type==="complete"||l.type==="fulfillment"||l.type==="recording"){K=null,await $(a,!1);return}if(e&&l.type==="checkout"){e=!1;try{await i.terminateCheckout(t.operationId)}catch(g){G(i.onError,g)}}if(Date.now()>=n)break;await dt(1e3,d,re.signal)}w||Pt()}async function Jt(e,t,n){K={operationId:e,selection:t,coupon:n};let a=!1;try{await i.terminateCheckout(e)}catch(l){if(l instanceof P&&["CAPABILITY_UNAVAILABLE","NOT_CONFIGURED"].includes(l.code)){K=null,f.textContent=o?"\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.",G(i.onError,l);return}a=l instanceof P&&(l.status??0)>=500,G(i.onError,l)}O()&&await kt(a)}function Se(e,t,n,a,l){let g=me(e).checkoutCoupons?.[t],c=g?g.products[n]:i.claimCoupon&&l?At(e.capabilities,l,a):void 0;return c?.couponId&&c.planVersionId===n?{id:c.couponId,offerId:c.offerId}:void 0}function Kt(e){ue||b||r.quote||r.operation||nt&&f.textContent===nt||(f.textContent=Object.values(e.capabilities.plans).some(t=>t.available)?"":o?"\u5F53\u524D\u8D26\u53F7\u6682\u65E0\u53EF\u8D2D\u4E70\u7684\u65B9\u6848\u3002":"No plans are currently available for this account.")}let De=new Map,Ne=!1;function Le(e,t,n,a,l,g){if(I(e)){let H=ce(a,l,t.capabilities),se=H&&Se(t,n,H,l,g),Ee=e.merchantTerms?.discount??(e.execution.provider==="merchant"?e.execution.discount:void 0),Ve=pe(t.document.screen,e.productVersionId,l,t.capabilities);return H===e.productVersionId&&Object.keys(Ve).length===Object.keys(e.featureQuantities??{}).length&&Object.entries(Ve).every(([He,Qe])=>e.featureQuantities?.[He]===Qe)&&(!se||Ee?.couponId===se.id&&(!se.offerId||Ee.grantId===se.offerId))}let c=e.lines.length===1?e.lines[0]:void 0,s=ce(a,l,t.capabilities);if(!c||!s||c.productVersionId!==s)return!1;let N=Se(t,n,s,l,g);if((N||me(t).checkoutCoupons?.[n])&&(N?.id??null)!==(e.discount?.couponId??null))return!1;let V;try{V=pe(t.document.screen,s,l,t.capabilities)}catch{return!1}let oe=Object.fromEntries((c.prepaid??[]).map(H=>[H.internal_feature_id,H.quantity]));return[...new Set([...Object.keys(V),...Object.keys(oe)])].every(H=>(V[H]??0)===(oe[H]??0))}let U=e=>Ot({quote:r.quote,operation:e,requestId:null,pending:!1,destroyed:w,canReselect:r.canReselect});async function _e(e){let t=e.merchantExecution;if(!(!O()||!e.checkoutUrl||Be(e)&&U(e).type!=="checkout"||i.checkoutNavigation==="after_confirmation"&&U(e).type!=="checkout"||t?.type==="purchase"&&!["not_started","pending"].includes(t.paymentStatus)||De.get(e.operationId)===e.checkoutUrl)){De.set(e.operationId,e.checkoutUrl);try{i.onCheckoutUrl?await i.onCheckoutUrl(e.checkoutUrl):d.defaultView?.location.assign(e.checkoutUrl)}catch(n){throw De.delete(e.operationId),n}}}let ae=(e,t=!1)=>{if(e instanceof ut)p=null,f.textContent=e.customerMessage(o);else if(jt(e))p=null,f.textContent=t?o?"\u5F53\u524D\u65E0\u6CD5\u5728\u6B64\u8D2D\u4E70\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002\u8BF7\u8054\u7CFB\u5546\u6237\u3002":"Purchases aren\u2019t available here right now. Payment hasn\u2019t started. Contact the merchant for help.":mt(e,o);else if(t){let n=e instanceof P?e.code:void 0;n==="CAPABILITY_UNAVAILABLE"||n==="NOT_CONFIGURED"?(p=null,f.textContent=o?"\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&&!b?f.textContent=o?"\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"?f.textContent=o?"\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.":f.textContent=o?"\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 f.textContent=e instanceof P&&(e.code==="NETWORK_ERROR"||e.code==="TIMEOUT")?mt(e,o):e instanceof P?e.message:o?"\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002":"This action couldn\u2019t be completed. Try again.";C.hidden=p===null,nt=f.textContent,t&&!x?.responsive&&f.scrollIntoView?.({block:"nearest"}),G(t&&S?.quoteError?S.quoteError:i.onError,e)},Me=new WeakMap;function Ue(e){ue=e,C.disabled=e,B?.updateCapabilities?.(me(m),Je(m));for(let t of te?.querySelectorAll("button")??[])e?(Me.set(t,t.disabled),t.disabled=!0):Me.has(t)&&(t.disabled=Me.get(t),Me.delete(t)),pt(t)}function it(){f.textContent=o?"\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 Xt(e){if(i.beforeAction)try{await i.beforeAction()}catch(t){throw t instanceof ut?(b=null,ye=!1,we=!1,p=null):p=e,t}}async function j(e,t){if(ue||w)return;if(!O()){it();return}let n=e===ke,a=n?Wt:Gt,l=fe()&&t!==void 0;Ce=l?t:void 0,Ue(!0),ve(),C.hidden=!0,f.textContent=l?"":a;try{if((e!==rt||!i.resumeCheckout)&&await Xt(e),w)return;if(!O()){p=e,C.hidden=!1,it();return}await e()}catch(g){w||ae(g,n&&!l)}finally{Ce=void 0,Ue(!1),ve(),f.textContent===a&&(f.textContent="")}}async function Zt(e){await Ft(Z,e,i)}function Et(e){return ct(r).type==="recording"||U(e).type==="recording"}function xt(e){let t=e.merchantTerms,n=t?.subscriptionTerms?.items??[],a=t?t.totalMinor:I(e)?e.totalMinor:e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),l=t?n.length===1&&n[0]?.amountMinor===a&&n[0]:!I(e)&&e.lines.length===1&&e.lines[0]?.catalogAmountMinor===a&&e.lines[0],g=a===null?le(t.subtotalMinor-t.discountMinor,e.currency)+(o?" + \u5F85\u786E\u8BA4\u7A0E\u8D39":" + tax confirmed at checkout"):le(a,e.currency)+(l?be(l.interval,o?"zh-CN":"en",l.intervalCount??1):""),c=I(e)?r.view?.capabilities.plans[e.productVersionId]?.name??"":e.lines.map(s=>s.productName).join(", ");return{label:c?`${c} \xB7 ${g}`:g,recurring:l}}async function $(e,t=i.checkoutNavigation!=="after_confirmation"){if(w)return;if(!O()){p=async()=>$(await r.read()),C.hidden=!1;return}if(f.textContent=Bt(e.status,o),Et(e)){let s=e.merchantExecution?.recordingStatus==="failed";f.textContent=s?o?"\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.":o?"\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.",C.textContent=o?"\u67E5\u8BE2\u8BB0\u5F55":"Check recording",p=async()=>$(await r.read()),C.hidden=!1;return}if(e.problem){let s=e.problem;p=Pe,C.textContent=o?"\u68C0\u67E5\u5E76\u6062\u590D\u539F\u64CD\u4F5C":"Check and recover original purchase",ae(new P(s.code,s.reason==="RESULT_UNKNOWN"?o?"\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.":s.phase==="fulfillment"?o?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u5546\u6237\u6743\u76CA\u5904\u7406\u9700\u8981\u6838\u5BF9\u3002":"Payment was recorded. Access fulfillment needs attention.":s.code==="CAPABILITY_UNAVAILABLE"?o?"\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.":s.code==="NOT_CONFIGURED"?o?"\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.":o?"\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,s));return}if((e.merchantExecution?.type==="purchase"&&e.merchantExecution.paymentStatus==="succeeded"||e.merchantExecution?.type==="subscription_change"&&e.merchantExecution.status==="applied")&&!["applied","not_applicable"].includes(e.merchantExecution.fulfillmentStatus)&&(f.textContent=o?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u6B63\u5728\u7B49\u5F85\u5546\u6237\u5B8C\u6210\u5904\u7406\u3002":"Payment was recorded. Waiting for merchant fulfillment."),Ie(e)&&U(e).type==="complete"){p=null,await Zt(e);return}if(!Ae(e)&&U(e).type!=="fulfillment"){if(r.canReselect===!1){f.textContent=o?"\u6B63\u5728\u6838\u5BF9\u539F\u8D2D\u4E70\u7ED3\u679C":"Checking the original purchase result",C.textContent=o?"\u67E5\u8BE2\u7ED3\u679C":"Check result",p=async()=>$(await r.read()),C.hidden=!1;return}e.status==="cancelled"?f.textContent=o?"\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"&&(f.textContent=o?"\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."),C.textContent=o?"\u91CD\u8BD5":"Retry",p=null,b=null;return}if(!t&&U(e).type==="checkout"){if(K){Pt();return}if(fe()){f.textContent="",Ne=!1,p=null,ve();return}let s=r.quote,N=s?.operationId===e.operationId?xt(s).label:"";f.textContent=Ne?N?o?`${N} \u5C1A\u672A\u4ED8\u6B3E\u3002\u518D\u6B21\u9009\u62E9\u8BE5\u65B9\u6848\u5373\u53EF\u7EE7\u7EED\u4ED8\u6B3E\u3002`:`${N} is still unpaid. Choose it again to continue paying.`:o?"\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.":"",Ne=!1,p=null;return}await _e(e);let n=Date.now(),a=n+6e5,l=2e3,g=!e.checkoutUrl,c=()=>g&&Date.now()-n<15e3;Ye=!0,G(i.onObservationChange,!0);try{for(;!w&&Date.now()<a;){if(await dt(c()?700:l,d,re.signal),w)return;if(!O()){p=async()=>$(await r.read()),C.hidden=!1;return}let s=await r.read();if(s.checkoutUrl&&(g=!1),!t&&U(s).type==="checkout"){await $(s,!1);return}if(!s.problem&&Ae(s)&&await _e(s),!Ae(s)||s.problem||Et(s)){await $(s);return}c()||(l=Math.min(l*1.5,3e4))}}finally{Ye=!1,G(i.onObservationChange,!1)}p=async()=>$(await r.read()),C.hidden=!1}async function at(e=!1){let t=await r.read();if(w)return;if(!O()){p=()=>at(e),C.hidden=!1;return}let n=r.quote;if(n&&Dt(t,{operationId:n.operationId,currency:n.currency},"The original purchase operation changed"),n&&(Be(t)?["prepared","quoted"].includes(t.status):t.status==="pending")&&(Be(t)||t.quoteFinalized===!1)&&!t.confirmedAt&&!t.checkoutUrl&&!("nativePurchase"in t&&t.nativePurchase)&&!t.merchantExecution&&!t.problem&&!r.pendingCancellation){It(n);return}await $(t,e||void 0)}async function Pe(){vt(),p=Pe;let e=await r.confirm();if(!O()){p=Pe,C.hidden=!1;return}if(e.problem){await $(e);return}if(Ae(e)){if(e.checkoutUrl)await _e(e);else if(e.execution&&e.execution.provider!=="merchant"||"nativePurchase"in e&&e.nativePurchase){if(!i.onPurchase)throw new P("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await i.onPurchase({operation:e,signal:re.signal})}}p=async()=>$(await r.read()),await $(e,!0)}function It(e){te?.remove();let t=!(Date.parse(e.expiresAt)>Date.now());f.textContent=t?o?"\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=d.createElement("div"),a=d.createElement("button"),l=d.createElement("button"),g=d.createElement("div"),c=d.createElement("p"),s=e.merchantTerms,N=o?"zh-CN":"en",V=s?.subscriptionTerms?.items??[],oe=s?s.subscriptionTerms?.trial?.days:I(e)?void 0:e.lines.find(u=>u.trial)?.trial?.days,ne=I(e)?s?s.totalMinor:e.totalMinor:oe===void 0?null:s?s.totalMinor:e.charge?e.charge.totalMinor:e.lines.every(u=>u.trial)?0:null,H=(u,y)=>o?`${y} \u5929\u8BD5\u7528\u7ED3\u675F\u540E ${u}`:`Then ${u} after the ${y}-day trial`,{label:se,recurring:Ee}=xt(e),Ve=I(e)?r.view?.capabilities.plans[e.productVersionId]?.name??"":e.lines.map(u=>u.productName).join(", "),He=ne===null?"":`${o?"\u4ECA\u5929\u5E94\u4ED8":"Due today"} ${le(ne,e.currency)}`;c.textContent=He?[Ve,He].filter(Boolean).join(" \xB7 "):se,a.textContent=I(e)?o?"\u786E\u8BA4\u53D8\u66F4":"Confirm change":o?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",a.disabled=t,l.textContent=o?"\u53D6\u6D88":"Cancel",n.style.cssText=_.panel,c.style.cssText=_.summary,g.style.cssText=_.actions,a.style.cssText=_.primary,l.style.cssText=_.secondary,pt(a),a.onclick=()=>{j(Pe)};let Qe=async()=>{let u=await r.cancel();w||(n.remove(),te=null,await $(u))};l.onclick=()=>{p=Qe,j(Qe)};let Q=d.createElement("div");if(Q.style.cssText=_.terms,I(e)){for(let[y,v]of Object.entries(e.featureQuantities??{})){let T=r.view?.capabilities.plans[e.productVersionId]?.prepaid?.find(en=>en.internalFeatureId===y),je=d.createElement("p");je.textContent=`${T?.name??y} \xB7 ${v} ${o?"\u4EFD":"packs"}${T?` \xD7 ${T.terms.units}`:""}`,Q.append(je)}for(let[y,v]of[[o?"\u539F\u8BA2\u9605\u62B5\u6263":"Unused subscription credit",e.creditMinor],[o?"\u65B0\u5957\u9910\u8D39\u7528":"New plan charge",e.debitMinor],[o?"\u4F18\u60E0\u51CF\u514D":"Offer savings",s?.discountMinor??e.discountMinor],[o?"\u7A0E\u8D39":"Tax",s?s.taxMinor:e.taxMinor]]){let T=d.createElement("p");T.textContent=`${y}: ${v===null?o?"\u7ED3\u8D26\u65F6\u786E\u8BA4":"Confirmed at checkout":le(v,e.currency)}`,Q.append(T)}let u=d.createElement("p");u.textContent=`${o?"\u751F\u6548\u65F6\u95F4":"Effective"}: ${e.effectiveAt}`,Q.append(u)}if(s){for(let y of V){if(ne===null&&y===Ee)continue;let v=d.createElement("p"),T=le(y.amountMinor,e.currency)+be(y.interval,N,y.intervalCount);v.textContent=ne!==null&&oe!==void 0?H(T,oe):T,y.amountAfterOfferMinor!==void 0&&(v.textContent+=` \xB7 ${o?"\u4F18\u60E0\u7ED3\u675F\u540E":"After the offer"} ${le(y.amountAfterOfferMinor,e.currency)}${be(y.interval,N,y.intervalCount)}`),Q.append(v)}let u=s.subscriptionTerms?.trial;if(u){let y=d.createElement("p");y.textContent=o?`\u8BD5\u7528 ${u.days} \u5929\uFF1B${u.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${u.days}; ${u.cardRequired?"a payment method is required":"no payment method is required"}`,Q.append(y)}for(let y of[...s.expectedEffects.map(v=>v.description),...s.requiredConsents.map(v=>v.summary)]){let v=d.createElement("p");v.textContent=y,Q.append(v)}}else if(!I(e)){for(let u of e.lines){if(ne!==null||u!==Ee){let y=d.createElement("p"),v=`${le(u.catalogAmountMinor,e.currency)}${be(u.interval,N,u.intervalCount??1)}`;y.textContent=ne!==null&&u.trial?(e.lines.length>1?`${u.productName} \xB7 `:"")+H(v,u.trial.days):`${u.productName} \xB7 ${v}`,Q.append(y)}for(let y of u.prepaid??[]){let v=d.createElement("p"),T=r.view?.capabilities.plans[u.productVersionId]?.prepaid?.find(je=>je.internalFeatureId===y.internal_feature_id);v.textContent=`${T?.name??y.internal_feature_id} \xB7 ${y.quantity} ${o?"\u4EFD":"packs"} \xD7 ${y.terms.units}`,T&&(v.textContent+=be(T.reset==="week"||T.reset==="month"||T.reset==="year"?T.reset:"one_time",N,T.resetCount)),Q.append(v)}if(u.trial){let y=d.createElement("p");y.textContent=o?`\u8BD5\u7528 ${u.trial.days} \u5929\uFF1B${u.trial.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${u.trial.days}; ${u.trial.cardRequired?"a payment method is required":"no payment method is required"}`,Q.append(y)}}if(!e.charge){let u=d.createElement("p");u.textContent=o?"\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(u)}}for(let u of Q.children)u.style.margin="0";g.append(a,l),n.append(c,...Q.childElementCount?[Q]:[],g),J.prepend(n),x?.responsive||n.scrollIntoView?.({block:"nearest"}),a.focus({preventScroll:!0}),te=n,p=null}async function ke(){if(!b)return;if(p=ke,!ye){let n=r.view,a=n?.document.buttons[b.actionId],l=n&&a?.type==="checkout"?ce(a.product,b.selection,n.capabilities):null;if(!n||!l)throw new P("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");if(!we){let c=await i.resolveSubscriptionChange?.({actionId:b.actionId,productVersionId:l,featureQuantities:pe(n.document.screen,l,b.selection,n.capabilities)});if(w)return;c!==void 0&&(b.subscriptionChange=Rt.parse(c)),we=!0}let g=F?.offerId;if(F&&!g){if(!i.claimCoupon)throw new P("CAPABILITY_UNAVAILABLE","Coupon claiming is unavailable");let{offer:c}=await i.claimCoupon(F.id,b.requestId);if(w)return;if(!c||c.couponId!==F.id||c.status!=="issued"||!(Date.parse(c.expiresAt)>Date.now()))throw b=null,F=void 0,p=async()=>{Oe(await r.refresh()),p=null},new P("COUPON_UNAVAILABLE","This Coupon is no longer available for this purchase");g=c.id}if(!F&&!n.document.screen.actions.some(c=>c.id===b?.actionId&&typeof c.properties.couponBinding=="string")&&(g=await i.resolveOfferId?.({actionId:b.actionId,productVersionId:l,featureQuantities:pe(n.document.screen,l,b.selection,n.capabilities)})),w)return;g!==void 0&&(b.offerId=g),ye=!0}if(!O()){C.hidden=!1;return}let e;try{e=await r.preview(b)}catch(n){throw r.canReselect===!0&&(b=null,ye=!1,we=!1,F=void 0,p=null),n}if(F&&(I(e)?(()=>{let n=e.merchantTerms?.discount??(e.execution.provider==="merchant"?e.execution.discount:void 0);return n?.couponId!==F.id||n.grantId!==b.offerId})():e.discount?.couponId!==F.id||e.discount.offerId!==b.offerId))throw new P("INVALID_RESPONSE","The quote did not apply the Coupon selected on this Paywall");if(w)return;let t=e.merchantTerms;if(i.confirmOnHostedCheckout&&O()&&!I(e)&&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=Ce?"":o?"\u6B63\u5728\u6253\u5F00\u6536\u94F6\u53F0\u2026":"Opening checkout\u2026";f.textContent=n;try{await Pe()}catch(a){w||ae(a)}finally{f.textContent===n&&(f.textContent="")}return}It(e)}function ge(e="destroy"){if(w)return;w=!0;let t=Ze;Ze=void 0,G(t),i.signal?.removeEventListener("abort",X),r.signal?.removeEventListener("abort",X),A.finish("dismissed"),wt?.(),re.abort(),yt?.disconnect(),x?.destroy(),B?.destroy(),r.destroy(),R.open&&R.close(),R.remove(),D.remove(),k(),e==="dismiss"&&G(i.onDismiss)}M=ge;async function $e(){if(!de||w||Te||ee==="closing"||!ee&&!O())return;if(!S){ge("dismiss");return}let e=d.createElement("p");e.setAttribute("role","status"),e.textContent=o?"\u6B63\u5728\u5173\u95ED\u2026":"Closing\u2026",ie||(ie=d.createElement("div"),ie.style.cssText=J.style.cssText,J.replaceWith(ie),he.inert=!0),E.hidden=!1,ie.replaceChildren(e,E),ee="closing",E.setAttribute("aria-disabled","true"),E.focus({preventScroll:!0});try{await S.dismiss()}catch(t){w||G(i.onError,t)}w||(ee="retry",e.textContent=o?"\u672A\u80FD\u786E\u8BA4\u5173\u95ED\uFF0C\u8BF7\u91CD\u8BD5\u3002":"Could not confirm closure. Try again.",E.textContent=o?"\u91CD\u8BD5\u5173\u95ED":"Retry closing",E.removeAttribute("aria-label"),E.removeAttribute("aria-disabled"))}E.onclick=()=>{$e()},R.addEventListener("cancel",e=>{e.preventDefault(),$e()}),C.onclick=()=>{p&&j(p)};function ot(e){A.finish("error",e),ge()}function st(){if(!(!bt||de||w||Te||x&&!O()))try{let e=t=>{i.focusAtReveal&&(k=ft(d)),B?.setHidden?.(!1),et?.(),x&&(R.showModal(),x.responsive&&R.focus({preventScroll:!0}),!t&&i.loading!=="host"&&_t(R,x.type,x.responsive)),de=!0};S?S.present(()=>A.present(()=>e(!0))):A.present(e)}catch(e){ot(e),ae(e)}}try{if(Re.type==="inline"?(ze(),et=Vt(D,L),L.append(D)):(R.setAttribute("aria-label",m.document.name),E.textContent="\xD7",E.setAttribute("aria-label",o?"\u5173\u95ED":"Close"),Mt(E,m.document.screen.theme),E.hidden=Nt(m.document),R.append(E,D),L.append(R),x=Lt(R,{...m.document.screen,presentation:Re},Xe),x.latch(),x.responsive&&(D.style.display="flex",D.style.flexDirection="column",D.style.maxHeight="100%",he.style.overflow="clip",he.style.minHeight="0"),et=$t(R)),Ge&&W){let n=Ge(W);if(typeof n=="function"&&(w?G(n):Ze=n),w)throw new DOMException("Presentation cancelled","AbortError");ze()}B=Y(he,{mode:"live",rendererUrl:r.webViewUrl,title:m.document.name,closeActions:zt,onAuthoredClose(n){ee||w||(E.hidden=n)},hostPresentation:()=>x?.type??Re.type,reportContentHeight:x?.responsive,onResize:n=>{if(!x?.responsive)return;let a=Math.min(n,Ke);he.style.height=`${a}px`,x.setContentHeight(a+(ie??J).getBoundingClientRect().height)},onSelection(n){for(let[a,l]of Object.entries(n))typeof l=="number"&&typeof q[a]=="number"&&q[a]!==l&&Ct.add(a);q=n,ve()},onAction(n,a={},l,g){if(!de||w||ee)return;let c=r.view,s=c?.document.buttons[n];if(!s)return;if(s.type==="close"&&S&&i.resumeCheckout&&r.operation&&Tt(U(r.operation))){$e();return}if(ue)return;if(!O()){it();return}if(s.type==="close"){j(async()=>{await i.onAction?.(n),ge(i.onAction?"action":"dismiss")});return}if(s.type==="action"){p=async()=>{if(s.action.type==="event"){if(!i.onEvent)throw new P("EVENT_HANDLER_REQUIRED","Provide the event handler");await i.onEvent(s.action.event)}else i.onOpenUrl?await i.onOpenUrl(s.action.url):d.defaultView?.location.assign(s.action.url);await i.onAction?.(n),p=null},j(p);return}if(i.allowNewPurchase===!1){fe()&&c&&r.quote&&r.operation&&U(r.operation).type==="checkout"&&Le(r.quote,c,n,s.product,a,g)?j(rt,n):f.textContent=o?"\u5F53\u524D\u53EA\u80FD\u7EE7\u7EED\u539F\u8BA2\u5355\u3002":"Only your original checkout is available.";return}if(te&&r.canReselect===!1){f.textContent=o?"\u8BF7\u5148\u786E\u8BA4\u6216\u53D6\u6D88\u5F53\u524D\u8D2D\u4E70\u3002":"Confirm or cancel the current purchase first.",x?.responsive||te.scrollIntoView?.({block:"nearest"}),te.querySelector("button")?.focus({preventScroll:!0});return}if(fe()&&K){K.selection.actionId===n&&j(()=>kt(!0),n);return}if(fe()&&i.terminateCheckout&&c&&r.quote&&r.operation&&r.canReselect===!1&&U(r.operation).type==="checkout"){if(Le(r.quote,c,n,s.product,a,g)){j(rt,n);return}let V=ce(s.product,a,c.capabilities);try{if(!V)throw new P("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");pe(c.document.screen,V,a,c.capabilities)}catch(se){ae(se);return}let oe=r.operation.operationId,ne={actionId:n,requestId:crypto.randomUUID(),selection:structuredClone(a)},H=Se(c,n,V,a,g);j(()=>Jt(oe,ne,H),n);return}if((r.quote||b)&&r.canReselect===!1){let V=!!c&&!!r.quote&&Le(r.quote,c,n,s.product,a,g);Ne=!!r.quote&&!V,p=r.quote?()=>at(V):ke,j(p);return}let N=c&&ce(s.product,a,c.capabilities);if(!c||!N){ae(new P("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(i.onPurchaseIntent){p=null,j(async()=>{let V={actionId:n,productVersionId:N,selection:structuredClone(a),featureQuantities:pe(c.document.screen,N,a,c.capabilities)};tt=!0,await i.onPurchaseIntent(V)});return}if(b&&b.actionId!==n){ae(new P("COMMAND_PENDING","Finish the current purchase"));return}b||(F=Se(c,n,N,a,g),b={requestId:crypto.randomUUID(),actionId:n,selection:structuredClone(a)},ye=!1,we=!1),j(ke,n)},onEscape:()=>{$e()},onError:n=>{let a=new Error(n);!de&&!w&&ot(a),ae(a)},onRendered:n=>{n&&R.setAttribute("aria-label",n),bt=!0,st()}}),B.setHidden?.(!0),Xe();let e=fe()&&!!r.quote&&!!r.operation&&U(r.operation).type==="checkout";q=r.quote?qt(m,r.quote)??Fe(m,{}):Fe(m,{}),B.update(m.document.screen,We,{capabilities:me(m),unavailableActions:ht(m),serverInput:{bindings:[],answers:{}},...Object.keys(q).length?{selection:q}:{}}),wt=r.subscribe?.(Oe),Oe(r.view??m),await A.wait(B.ready);let t=r.operation;!e&&(r.quote||t&&(t.confirmedAt||t.checkoutUrl||Ie(t)))&&(p=()=>at(),j(p))}catch(e){throw ot(e),e}return{check:Z,host:{get observing(){return Ye},get recovery(){return Yt()},async prepareFallback(){if(ue||w||ee||tt)return{type:"recover",operationId:r.operation?.operationId??r.quote?.operationId??null,requestId:null};Ue(!0);try{let e=await St(r);return e.type==="native"&&ge(),e}finally{Ue(!1)}},setSuspended(e){Te=e,D.hidden=e,e&&R.open?R.close():!e&&!de?st():!e&&!w&&de&&Re.type!=="inline"&&!R.open&&R.showModal()},destroy:ge,refresh:async()=>{if(!O()){if(r.view)return r.view;throw new P("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await r.refresh();return Oe(e),st(),e}}}}export{Ln as showPaywall};
@@ -0,0 +1 @@
1
+ import{b as a}from"./chunk-2RUJXZCO.js";import"./chunk-6EBS6MLW.js";import"./chunk-EOPKOAR5.js";import"./chunk-OAAS5LJY.js";import"./chunk-5PNH2FPI.js";import"./chunk-RQTYIUWP.js";import"./chunk-7IVLNV5H.js";import"./chunk-VJHURKRY.js";import"./chunk-VILB5M4X.js";import"./chunk-2XF34Q6D.js";import"./chunk-26UXCYBP.js";import"./chunk-KINNES62.js";import"./chunk-Y2HXKANG.js";import"./chunk-HGH2X6QM.js";import"./chunk-MYDMOAKX.js";import"./chunk-EECTJHI6.js";import"./chunk-G6CWZBT5.js";import"./chunk-S4P4UUUF.js";import"./chunk-3VUPVXAV.js";import"./chunk-2LUVO7GM.js";import"./chunk-2ULWP26K.js";import"./chunk-CQRSMCCG.js";import"./chunk-PBBREFS5.js";import"./chunk-WOT6VMZA.js";export{a as readPaywallContent};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-756SIMZF.js";import"./chunk-QJMM37CB.js";import"./chunk-DPEMW2FO.js";import"./chunk-EON4IKWR.js";import"./chunk-H26F3IOI.js";import"./chunk-2LERKK7O.js";import"./chunk-2RUJXZCO.js";import"./chunk-6EBS6MLW.js";import"./chunk-EOPKOAR5.js";import"./chunk-OAAS5LJY.js";import"./chunk-5PNH2FPI.js";import"./chunk-PYLX3WF6.js";import"./chunk-W35FZWGG.js";import"./chunk-RQTYIUWP.js";import"./chunk-7IVLNV5H.js";import"./chunk-VJHURKRY.js";import"./chunk-VILB5M4X.js";import"./chunk-SYHMHKFQ.js";import"./chunk-2XF34Q6D.js";import"./chunk-26UXCYBP.js";import"./chunk-KINNES62.js";import"./chunk-Y2HXKANG.js";import"./chunk-HGH2X6QM.js";import"./chunk-MYDMOAKX.js";import"./chunk-EECTJHI6.js";import"./chunk-G6CWZBT5.js";import"./chunk-S4P4UUUF.js";import"./chunk-3VUPVXAV.js";import"./chunk-2LUVO7GM.js";import"./chunk-2ULWP26K.js";import"./chunk-DSPLGTQI.js";import"./chunk-CQRSMCCG.js";import"./chunk-PBBREFS5.js";import"./chunk-WOT6VMZA.js";export{a as createPaywallSession};
package/dist/popup.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { b as ScreenAction, c as ScreenNode, d as ScreenInteractivity, e as ScreenDocument } from './screen-qUBRsUi9.js';
2
2
  import { O as Offer, a as OfferUnavailableReason } from './coupon-kfkIVf9n.js';
3
- import { e as CustomerPageData, a as SurfaceData, P as PresentationLoadingOptions, f as ScreenParameters, g as ScreenRendererInput, S as ScreenAnswers, C as CustomerDataIntent } from './presentation-loading-B_v5XZtM.js';
4
- export { d as PresentationState } from './presentation-loading-B_v5XZtM.js';
3
+ import { e as CustomerPageData, a as SurfaceData, P as PresentationLoadingOptions, f as ScreenParameters, g as ScreenRendererInput, S as ScreenAnswers, C as CustomerDataIntent } from './presentation-loading-B2OeFzRN.js';
4
+ export { d as PresentationState } from './presentation-loading-B2OeFzRN.js';
5
5
  import { WindowLike } from 'dompurify';
6
6
  import 'zod';
7
7
 
package/dist/popup.js CHANGED
@@ -1 +1 @@
1
- import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a}from"./chunk-BYP4KVB3.js";import"./chunk-P6C3PNMQ.js";import"./chunk-XDOKFAE6.js";import"./chunk-Y6HL2IY2.js";import"./chunk-LSPHUA7V.js";import"./chunk-OOD2VDDP.js";import"./chunk-WLGLQJ6M.js";import"./chunk-RULQQ7WI.js";import"./chunk-RGEBK6UF.js";import"./chunk-O4KXODTJ.js";import"./chunk-CILM5XMH.js";import"./chunk-DSPLGTQI.js";import"./chunk-WOT6VMZA.js";export{p as formatCustomerDecimal,r as hostedRendererScript,o as hostedRendererShell,f as inspectCustomHtml,a as mountScreenPreview,x as preparePopup,m as prepareScreen,e as sanitizeCustomHtml,t as showPopup};
1
+ import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a}from"./chunk-H7AHDGVU.js";import"./chunk-AQQJPP3P.js";import"./chunk-KINNES62.js";import"./chunk-Y2HXKANG.js";import"./chunk-HGH2X6QM.js";import"./chunk-MYDMOAKX.js";import"./chunk-EECTJHI6.js";import"./chunk-G6CWZBT5.js";import"./chunk-S4P4UUUF.js";import"./chunk-2ULWP26K.js";import"./chunk-DSPLGTQI.js";import"./chunk-CQRSMCCG.js";import"./chunk-PBBREFS5.js";import"./chunk-WOT6VMZA.js";export{p as formatCustomerDecimal,r as hostedRendererScript,o as hostedRendererShell,f as inspectCustomHtml,a as mountScreenPreview,x as preparePopup,m as prepareScreen,e as sanitizeCustomHtml,t as showPopup};
@@ -60,6 +60,7 @@ declare const surfaceDataSchema: z.ZodObject<{
60
60
  topup: "topup";
61
61
  }>;
62
62
  membershipId: z.ZodNullable<z.ZodString>;
63
+ featureQuantities: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodNumber>>;
63
64
  currency: z.ZodEnum<{
64
65
  USD: "USD";
65
66
  EUR: "EUR";
@@ -1,11 +1,11 @@
1
- import { f as createCustomerClient, d as createFunnelClient } from './funnel-process-client-C87U4r_G.js';
2
- export { F as FunnelProcessAdapter, a as FunnelProcessOptions, c as createFunnelProcess } from './funnel-process-client-C87U4r_G.js';
3
- import { I as IndianaOptions, b as SessionCredentials, G as Scope, A as createFunnelRunController, w as PaywallStartInput, k as createPaywallSession } from './funnel-local-client-DR8OpKGU.js';
4
- export { F as FunnelCommandStorage, f as FunnelRunController, t as LocalFunnelClientOptions, u as LongplayError, v as PaywallPurchaseInput, P as PaywallSession, x as PushHost, y as PushJournal, z as createFeatureClient, B as createLocalFunnelClient } from './funnel-local-client-DR8OpKGU.js';
1
+ import { f as createCustomerClient, d as createFunnelClient } from './funnel-process-client-DNR9nHs8.js';
2
+ export { F as FunnelProcessAdapter, a as FunnelProcessOptions, c as createFunnelProcess } from './funnel-process-client-DNR9nHs8.js';
3
+ import { I as IndianaOptions, S as SessionCredentials, N as Scope, B as createFunnelRunController, x as PaywallStartInput, l as createPaywallSession } from './funnel-local-client-BMxDQWE6.js';
4
+ export { F as FunnelCommandStorage, g as FunnelRunController, u as LocalFunnelClientOptions, v as LongplayError, w as PaywallPurchaseInput, P as PaywallSession, y as PushHost, z as PushJournal, A as createFeatureClient, D as createLocalFunnelClient } from './funnel-local-client-BMxDQWE6.js';
5
5
  import { z } from 'zod';
6
6
  import { J as JsonValue } from './growth-rules-B4YYy64R.js';
7
- export { C as ConfigurationStorage, b as ConfigurationSyncOptions, c as createConfigurationSync } from './configuration-sync-BHrAf-ql.js';
8
- import './api-r6FfVQpg.js';
7
+ export { a as ConfigurationStorage, b as ConfigurationSyncOptions, c as createConfigurationSync } from './configuration-sync-7ruSsSrL.js';
8
+ import './api-DpRb_Pd3.js';
9
9
  import './screen-qUBRsUi9.js';
10
10
  import 'zod/v4';
11
11
  import './coupon-kfkIVf9n.js';
@@ -1 +1 @@
1
- import{b as S,c as E,d as T}from"./chunk-QZTTKH2H.js";import"./chunk-ASDJTOGM.js";import{a as A}from"./chunk-C3GYAKIU.js";import{e as P}from"./chunk-5DZJCFNQ.js";import"./chunk-YLPQLD2A.js";import{h as b,i as x,k as L}from"./chunk-AZFWG352.js";import{F as C}from"./chunk-4TEZZZYK.js";import"./chunk-POCDWUD3.js";import"./chunk-ORMQJAQE.js";import"./chunk-RFNIGJOL.js";import"./chunk-7QDT6DO7.js";import"./chunk-6PG3AS3G.js";import"./chunk-X6ONZGRY.js";import"./chunk-EREQZWGI.js";import"./chunk-P23JOPR5.js";import"./chunk-IOJVF52Q.js";import"./chunk-U7GH4VME.js";import"./chunk-3NCMYTNG.js";import"./chunk-33ZVZOSC.js";import"./chunk-VOKEZHAH.js";import"./chunk-57GPGWSK.js";import"./chunk-PZOQV6MU.js";import"./chunk-FCDWCQYC.js";import"./chunk-XDOKFAE6.js";import"./chunk-Y6HL2IY2.js";import"./chunk-LSPHUA7V.js";import{b as R}from"./chunk-OOD2VDDP.js";import{a as r}from"./chunk-WLGLQJ6M.js";import"./chunk-RULQQ7WI.js";import"./chunk-3VUPVXAV.js";import"./chunk-RV6UAUK2.js";import"./chunk-RGEBK6UF.js";import"./chunk-O4KXODTJ.js";import"./chunk-CILM5XMH.js";import"./chunk-DSPLGTQI.js";import"./chunk-WOT6VMZA.js";function k(t,d){let n,a=0,m=-1,l,i=!1,y=()=>{if(i)throw new r("CLOSED","Native host was destroyed");if(!t.nativeModule)throw new r("CAPABILITY_UNAVAILABLE","Link IndianaBridge and supply nativeModule");return t.nativeModule},o=()=>new r("IDENTITY_CHANGED","Customer identity changed during the native operation"),h=d.subscribeIdentity(()=>{a++,m=-1;let e=a;n&&t.nativeModule&&n.then(c=>t.nativeModule.reset(c,e)).catch(()=>{})}),I=t.nativeEvents?.(e=>{!n||!t.nativeModule||typeof e?.requestId!="string"||(async()=>{let c=await n;if(e.instanceId!==c)return;if(e.kind==="credential"){let w=a,f=null;try{if(!i&&e.revision===w){let N=await d.access();!i&&a===w&&(f=N)}}finally{await t.nativeModule.provideCredential(c,e.requestId,f)}return}let s=!1,u=a;try{if(i||e.revision!==u||!t.onNativeAction)throw o();await t.onNativeAction(e.action),s=!i&&a===u}finally{await t.nativeModule.acknowledge(c,e.requestId,s)}})().catch(()=>{})});async function p(e,c={}){let s=y();if(d.snapshot()&&!t.nativeEvents)throw new r("CAPABILITY_UNAVAILABLE","Supply nativeEvents to share credential refresh with the native host");let u=a,w=await d.access();if(i||a!==u)throw o();if(!n){let v=s.create(JSON.stringify({baseUrl:t.baseUrl??"https://api.longplayai.com",scope:t.scope,timeout:(t.timeoutMs??15e3)/1e3,credentialEvents:!!t.nativeEvents}));n=v,v.catch(()=>{n===v&&(n=void 0)})}let f=await n;if(i||a!==u)throw o();if(m!==u){if(!l||l.epoch!==u){let O=(async()=>{if(await s.identify(f,JSON.stringify({revision:u,credentials:w})),i||a!==u)throw await s.reset(f,u),o();m=u})();l={epoch:u,task:O}}let v=l;try{await v.task}finally{l===v&&(l=void 0)}}let N=await s.invoke(f,e,JSON.stringify(c));if(i||a!==u)throw o();try{return JSON.parse(N)}catch{throw new r("INVALID_RESPONSE","Native host returned invalid JSON")}}async function g(e,c){let s=await p(e,c);if(!s||typeof s!="object"||Array.isArray(s)||s.status!=="complete"&&s.status!=="dismissed")throw new r("INVALID_RESPONSE","Native presentation returned an invalid result");return s}return{showFunnel(e){return g("showFunnel",{runToken:e})},showPaywall(e){return g("showPaywall",e)},showContent(e){return g("showContent",e)},purchaseSubscription(e,c){return p("purchaseSubscription",{operationId:e,accepted:c})},switchSubscription(e,c){return p("switchSubscription",{operationId:e,accepted:c})},restorePurchases(){return p("restorePurchases")},manageSubscriptions(e){return p("manageSubscriptions",e?{productId:e}:{})},async dismiss(){a++,m=-1,n&&await y().reset(await n,a)},async destroy(){i||(i=!0,a++,h(),I?.(),n&&t.nativeModule&&await t.nativeModule.destroy(await n))}}}var M=P.trackUsage.request.shape.command,U=P.trackUsage.response;function F(t){let d=R.parse(t.scope),n=S({...t,scope:d}),a={...t,scope:d,session:n.session},m=k(t,n.session),l=0,i=!1;n.subscribeIdentity(()=>{l++});let y=()=>{if(i)throw new r("CLOSED","SDK client was destroyed");let o=n.session.peek();if(!o)throw new r("UNAUTHENTICATED","Identify the Customer first");return o};return{...n,native:m,async destroy(){i||(i=!0,l++,n.destroy(),await m.destroy())},funnel(){return E({...a,customerToken:y()})},resumeFunnel(o){return y(),C({...a,runToken:o})},paywall(o){return A(a,{...o,customerToken:y()})},async trackUsage(o){if(y(),!t.usageReporter)throw new r("INVALID_REQUEST","Configure your authenticated backend usageReporter");let h=M.parse(o),I=l,p;try{p=await t.usageReporter(h)}catch(e){throw I!==l?new r("IDENTITY_CHANGED","Customer identity changed during usage reporting"):e}if(I!==l)throw new r("IDENTITY_CHANGED","Customer identity changed during usage reporting");let g=U.parse(p);if(g.scope.projectId!==d.projectId||g.scope.environment!==d.environment)throw new r("INVALID_RESPONSE","Usage response scope differs");return g}}}export{r as LongplayError,x as createConfigurationSync,b as createFeatureClient,T as createFunnelProcess,L as createLocalFunnelClient,F as createLongplayReactNative};
1
+ import{b as S,c as E,d as T}from"./chunk-FTVNGN6Z.js";import"./chunk-6STWY5GX.js";import{a as A}from"./chunk-756SIMZF.js";import{e as P}from"./chunk-QJMM37CB.js";import"./chunk-DPEMW2FO.js";import{h as b,i as x,k as L}from"./chunk-P6XQC7GG.js";import{E as C}from"./chunk-4B4RB36N.js";import"./chunk-EON4IKWR.js";import"./chunk-H26F3IOI.js";import"./chunk-2LERKK7O.js";import"./chunk-2RUJXZCO.js";import"./chunk-6EBS6MLW.js";import"./chunk-EOPKOAR5.js";import"./chunk-OAAS5LJY.js";import"./chunk-NFY7DKVJ.js";import"./chunk-5PNH2FPI.js";import"./chunk-PYLX3WF6.js";import"./chunk-W35FZWGG.js";import"./chunk-RQTYIUWP.js";import"./chunk-7IVLNV5H.js";import"./chunk-VJHURKRY.js";import"./chunk-VILB5M4X.js";import"./chunk-SYHMHKFQ.js";import"./chunk-2XF34Q6D.js";import"./chunk-26UXCYBP.js";import"./chunk-KINNES62.js";import"./chunk-Y2HXKANG.js";import"./chunk-HGH2X6QM.js";import"./chunk-MYDMOAKX.js";import"./chunk-EECTJHI6.js";import{a as r}from"./chunk-G6CWZBT5.js";import{h as R}from"./chunk-S4P4UUUF.js";import"./chunk-3VUPVXAV.js";import"./chunk-2LUVO7GM.js";import"./chunk-2ULWP26K.js";import"./chunk-DSPLGTQI.js";import"./chunk-CQRSMCCG.js";import"./chunk-PBBREFS5.js";import"./chunk-WOT6VMZA.js";function k(t,d){let n,a=0,m=-1,l,i=!1,y=()=>{if(i)throw new r("CLOSED","Native host was destroyed");if(!t.nativeModule)throw new r("CAPABILITY_UNAVAILABLE","Link IndianaBridge and supply nativeModule");return t.nativeModule},o=()=>new r("IDENTITY_CHANGED","Customer identity changed during the native operation"),h=d.subscribeIdentity(()=>{a++,m=-1;let e=a;n&&t.nativeModule&&n.then(c=>t.nativeModule.reset(c,e)).catch(()=>{})}),I=t.nativeEvents?.(e=>{!n||!t.nativeModule||typeof e?.requestId!="string"||(async()=>{let c=await n;if(e.instanceId!==c)return;if(e.kind==="credential"){let w=a,f=null;try{if(!i&&e.revision===w){let N=await d.access();!i&&a===w&&(f=N)}}finally{await t.nativeModule.provideCredential(c,e.requestId,f)}return}let s=!1,u=a;try{if(i||e.revision!==u||!t.onNativeAction)throw o();await t.onNativeAction(e.action),s=!i&&a===u}finally{await t.nativeModule.acknowledge(c,e.requestId,s)}})().catch(()=>{})});async function p(e,c={}){let s=y();if(d.snapshot()&&!t.nativeEvents)throw new r("CAPABILITY_UNAVAILABLE","Supply nativeEvents to share credential refresh with the native host");let u=a,w=await d.access();if(i||a!==u)throw o();if(!n){let v=s.create(JSON.stringify({baseUrl:t.baseUrl??"https://api.longplayai.com",scope:t.scope,timeout:(t.timeoutMs??15e3)/1e3,credentialEvents:!!t.nativeEvents}));n=v,v.catch(()=>{n===v&&(n=void 0)})}let f=await n;if(i||a!==u)throw o();if(m!==u){if(!l||l.epoch!==u){let O=(async()=>{if(await s.identify(f,JSON.stringify({revision:u,credentials:w})),i||a!==u)throw await s.reset(f,u),o();m=u})();l={epoch:u,task:O}}let v=l;try{await v.task}finally{l===v&&(l=void 0)}}let N=await s.invoke(f,e,JSON.stringify(c));if(i||a!==u)throw o();try{return JSON.parse(N)}catch{throw new r("INVALID_RESPONSE","Native host returned invalid JSON")}}async function g(e,c){let s=await p(e,c);if(!s||typeof s!="object"||Array.isArray(s)||s.status!=="complete"&&s.status!=="dismissed")throw new r("INVALID_RESPONSE","Native presentation returned an invalid result");return s}return{showFunnel(e){return g("showFunnel",{runToken:e})},showPaywall(e){return g("showPaywall",e)},showContent(e){return g("showContent",e)},purchaseSubscription(e,c){return p("purchaseSubscription",{operationId:e,accepted:c})},switchSubscription(e,c){return p("switchSubscription",{operationId:e,accepted:c})},restorePurchases(){return p("restorePurchases")},manageSubscriptions(e){return p("manageSubscriptions",e?{productId:e}:{})},async dismiss(){a++,m=-1,n&&await y().reset(await n,a)},async destroy(){i||(i=!0,a++,h(),I?.(),n&&t.nativeModule&&await t.nativeModule.destroy(await n))}}}var M=P.trackUsage.request.shape.command,U=P.trackUsage.response;function F(t){let d=R.parse(t.scope),n=S({...t,scope:d}),a={...t,scope:d,session:n.session},m=k(t,n.session),l=0,i=!1;n.subscribeIdentity(()=>{l++});let y=()=>{if(i)throw new r("CLOSED","SDK client was destroyed");let o=n.session.peek();if(!o)throw new r("UNAUTHENTICATED","Identify the Customer first");return o};return{...n,native:m,async destroy(){i||(i=!0,l++,n.destroy(),await m.destroy())},funnel(){return E({...a,customerToken:y()})},resumeFunnel(o){return y(),C({...a,runToken:o})},paywall(o){return A(a,{...o,customerToken:y()})},async trackUsage(o){if(y(),!t.usageReporter)throw new r("INVALID_REQUEST","Configure your authenticated backend usageReporter");let h=M.parse(o),I=l,p;try{p=await t.usageReporter(h)}catch(e){throw I!==l?new r("IDENTITY_CHANGED","Customer identity changed during usage reporting"):e}if(I!==l)throw new r("IDENTITY_CHANGED","Customer identity changed during usage reporting");let g=U.parse(p);if(g.scope.projectId!==d.projectId||g.scope.environment!==d.environment)throw new r("INVALID_RESPONSE","Usage response scope differs");return g}}}export{r as LongplayError,x as createConfigurationSync,b as createFeatureClient,T as createFunnelProcess,L as createLocalFunnelClient,F as createLongplayReactNative};
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-H7AHDGVU.js";import"./chunk-AQQJPP3P.js";import"./chunk-KINNES62.js";import"./chunk-Y2HXKANG.js";import"./chunk-HGH2X6QM.js";import"./chunk-MYDMOAKX.js";import"./chunk-EECTJHI6.js";import"./chunk-G6CWZBT5.js";import"./chunk-S4P4UUUF.js";import"./chunk-2ULWP26K.js";import"./chunk-DSPLGTQI.js";import"./chunk-CQRSMCCG.js";import"./chunk-PBBREFS5.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};