@tinkerlandai/longplay-sdk 0.10.35 → 0.10.37

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 (108) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +42 -3
  3. package/README.zh-CN.md +14 -0
  4. package/dist/{ai-usage-T62xehqa.d.ts → ai-usage-DXwAGTxT.d.ts} +1 -1
  5. package/dist/{api-Do-6AyWa.d.ts → api-r6FfVQpg.d.ts} +6 -1
  6. package/dist/check-response-N22NNTIT.js +1 -0
  7. package/dist/chunk-2HBIBIOF.js +1 -0
  8. package/dist/{chunk-73NP72FV.js → chunk-2KJLN65C.js} +1 -1
  9. package/dist/{chunk-RML52BOR.js → chunk-2VMEDQHT.js} +1 -1
  10. package/dist/{chunk-CIP5SQ5Y.js → chunk-4KLXQKNO.js} +1 -1
  11. package/dist/{chunk-FMDC6N4W.js → chunk-6F4JS3RK.js} +1 -1
  12. package/dist/{chunk-56BYGPQ6.js → chunk-7XDQKZYA.js} +1 -1
  13. package/dist/{chunk-VEX2FOFZ.js → chunk-AB7GEGZ2.js} +1 -1
  14. package/dist/{chunk-EM3MGDPG.js → chunk-AHUYZ6IW.js} +1 -1
  15. package/dist/chunk-AOGDCT4T.js +1 -0
  16. package/dist/{chunk-EUTWY7A2.js → chunk-CY7OKV7E.js} +1 -1
  17. package/dist/{chunk-7MNJH5GB.js → chunk-D3OYXTMC.js} +1 -1
  18. package/dist/chunk-DDLSQSWO.js +10 -0
  19. package/dist/{chunk-5HJYR6Z4.js → chunk-E7CCHUSO.js} +1 -1
  20. package/dist/{chunk-BOVN2BE3.js → chunk-ECKVJGXQ.js} +1 -1
  21. package/dist/chunk-GH6FM44P.js +1 -0
  22. package/dist/{chunk-TJGIT5CU.js → chunk-HEHLFHW7.js} +1 -1
  23. package/dist/chunk-HKXFCRVT.js +1 -0
  24. package/dist/chunk-KFIL73QY.js +1 -0
  25. package/dist/{chunk-44U3FOBB.js → chunk-LC6UCDWE.js} +1 -1
  26. package/dist/{chunk-KE26KWIU.js → chunk-LOLMUXHW.js} +1 -1
  27. package/dist/{chunk-7QL4GF4C.js → chunk-O4KXODTJ.js} +1 -1
  28. package/dist/{chunk-TLZP7BW6.js → chunk-OCWSWXCW.js} +1 -1
  29. package/dist/chunk-OQRMAU2B.js +1 -0
  30. package/dist/{chunk-SXBM3DWK.js → chunk-OX2A3UD2.js} +1 -1
  31. package/dist/{chunk-LF2UIJYD.js → chunk-PW5PIBSO.js} +1 -1
  32. package/dist/chunk-Q676H74B.js +1 -0
  33. package/dist/chunk-RE4OLOOT.js +1 -0
  34. package/dist/{chunk-CKKIB2HC.js → chunk-S43TYW3V.js} +1 -1
  35. package/dist/{chunk-U4RSRFZY.js → chunk-T2KWLYCW.js} +1 -1
  36. package/dist/chunk-TASEZY5T.js +1 -0
  37. package/dist/{chunk-OX7PA64E.js → chunk-U7NX5ET2.js} +1 -1
  38. package/dist/{chunk-WZR2XCSJ.js → chunk-UV4H6VCS.js} +1 -1
  39. package/dist/{chunk-MSK3VZ3A.js → chunk-VIBJNB5B.js} +1 -1
  40. package/dist/chunk-VLSP3LRH.js +1 -0
  41. package/dist/{chunk-W6OQTXLL.js → chunk-W74JLL2O.js} +1 -1
  42. package/dist/chunk-WQ3O5RXN.js +1 -0
  43. package/dist/chunk-WZMZMJCK.js +1 -0
  44. package/dist/chunk-XGNXZWZL.js +1 -0
  45. package/dist/{chunk-VYFSRHXM.js → chunk-XJRDO3NI.js} +1 -1
  46. package/dist/chunk-YV6UFESO.js +1 -0
  47. package/dist/{chunk-KPDHY76A.js → chunk-ZYOZSUZS.js} +1 -1
  48. package/dist/chunk-ZZIBLQCJ.js +1 -0
  49. package/dist/{configuration-sync-DdTRUv7A.d.ts → configuration-sync-BHrAf-ql.d.ts} +10 -1
  50. package/dist/content-QNBATPA2.js +1 -0
  51. package/dist/{funnel-host-purchase-Z7FCJ5CX.js → funnel-host-purchase-FVYPBPET.js} +1 -1
  52. package/dist/{funnel-local-client-Dz1dTgES.d.ts → funnel-local-client-DR8OpKGU.d.ts} +145 -3
  53. package/dist/funnel-paywall-prerender-Z7RA4YDY.js +1 -0
  54. package/dist/{funnel-process-client-D6qjStm2.d.ts → funnel-process-client-C87U4r_G.d.ts} +17 -3
  55. package/dist/funnel-runtime-host-TJPF3FJS.js +1 -0
  56. package/dist/index.d.ts +49 -12
  57. package/dist/index.js +1 -1
  58. package/dist/merchant-bridge-contracts-67AYXZFI.js +1 -0
  59. package/dist/native-shell.js +1 -1
  60. package/dist/openrouter.d.ts +3 -3
  61. package/dist/openrouter.js +1 -1
  62. package/dist/operation-contracts-EK4RCUWJ.js +1 -0
  63. package/dist/page.d.ts +2 -2
  64. package/dist/page.js +1 -1
  65. package/dist/paywall-OAVC654P.js +1 -0
  66. package/dist/paywall-content-75XEM7K3.js +1 -0
  67. package/dist/paywall-session-U6SPRJRS.js +1 -0
  68. package/dist/popup.d.ts +4 -4
  69. package/dist/popup.js +1 -1
  70. package/dist/{presentation-loading-CFSiS0VX.d.ts → presentation-loading-B_v5XZtM.d.ts} +11 -1
  71. package/dist/react-native.d.ts +7 -7
  72. package/dist/react-native.js +1 -1
  73. package/dist/{screen-CGCJ46b1.d.ts → screen-qUBRsUi9.d.ts} +26 -21
  74. package/dist/screen-renderer-YIIT742O.js +1 -0
  75. package/dist/server.d.ts +37 -7
  76. package/dist/server.js +1 -1
  77. package/dist/{visual-dom-6DCUZGPB.js → visual-dom-5LUN4AHO.js} +1 -1
  78. package/dist/visual.js +1 -1
  79. package/package.json +10 -9
  80. package/dist/check-response-GZZRWBEA.js +0 -1
  81. package/dist/chunk-2FE4FTPH.js +0 -1
  82. package/dist/chunk-BLVBUN2R.js +0 -1
  83. package/dist/chunk-BQRS7Y4K.js +0 -1
  84. package/dist/chunk-ETK6GC5P.js +0 -1
  85. package/dist/chunk-GZRRVHYK.js +0 -1
  86. package/dist/chunk-PUR5CYWX.js +0 -1
  87. package/dist/chunk-RNEF4MZW.js +0 -1
  88. package/dist/chunk-SFHIFCXG.js +0 -1
  89. package/dist/chunk-TAFALMQN.js +0 -1
  90. package/dist/chunk-TOTRALYQ.js +0 -10
  91. package/dist/chunk-UVRT4MY6.js +0 -1
  92. package/dist/chunk-V7MMTILA.js +0 -1
  93. package/dist/chunk-V7PFLFHE.js +0 -1
  94. package/dist/chunk-XUGEOELU.js +0 -1
  95. package/dist/chunk-YVXLCQGM.js +0 -1
  96. package/dist/chunk-ZGCKQWQ5.js +0 -1
  97. package/dist/content-AJDTSI7A.js +0 -1
  98. package/dist/funnel-paywall-prerender-QHCUZZY3.js +0 -1
  99. package/dist/funnel-runtime-host-UKSOOA4H.js +0 -1
  100. package/dist/merchant-bridge-contracts-EAE4HQE4.js +0 -1
  101. package/dist/operation-contracts-HS4M2UXN.js +0 -1
  102. package/dist/paywall-VYUBYBUI.js +0 -1
  103. package/dist/paywall-content-YQAVSO2T.js +0 -1
  104. package/dist/paywall-session-E5V42XUT.js +0 -1
  105. package/dist/screen-renderer-R5GH7XLV.js +0 -1
  106. /package/dist/{chunk-BID4UGWB.js → chunk-CILM5XMH.js} +0 -0
  107. /package/dist/{chunk-VF6QMMEA.js → chunk-CR2XJ2CX.js} +0 -0
  108. /package/dist/{chunk-UKMEW5I7.js → chunk-OJM6ORHE.js} +0 -0
@@ -1,8 +1,8 @@
1
1
  import { OpenRouter } from '@openrouter/sdk';
2
2
  import { ChatUsage } from '@openrouter/sdk/models';
3
- import { F as FoundationApi } from './api-Do-6AyWa.js';
4
- import { c as createAiPricing, A as AiUsageContext, a as AiTokenUsage, b as AiTokenQuote } from './ai-usage-T62xehqa.js';
5
- import './screen-CGCJ46b1.js';
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';
5
+ import './screen-qUBRsUi9.js';
6
6
  import 'zod';
7
7
  import 'zod/v4';
8
8
  import '@ai-sdk/provider';
@@ -1 +1 @@
1
- import"./chunk-SXBM3DWK.js";import"./chunk-5HJYR6Z4.js";import"./chunk-56BYGPQ6.js";import"./chunk-VYFSRHXM.js";import"./chunk-TJGIT5CU.js";import{a as i}from"./chunk-OX7PA64E.js";import"./chunk-V7MMTILA.js";import"./chunk-EM3MGDPG.js";import{b as A}from"./chunk-VF6QMMEA.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-OX2A3UD2.js";import"./chunk-E7CCHUSO.js";import"./chunk-7XDQKZYA.js";import"./chunk-XJRDO3NI.js";import"./chunk-HEHLFHW7.js";import{a as i}from"./chunk-U7NX5ET2.js";import"./chunk-VLSP3LRH.js";import"./chunk-AHUYZ6IW.js";import{b as A}from"./chunk-CR2XJ2CX.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-LC6UCDWE.js";import"./chunk-UV4H6VCS.js";import"./chunk-D3OYXTMC.js";import"./chunk-4KLXQKNO.js";import"./chunk-S43TYW3V.js";import"./chunk-ECKVJGXQ.js";import"./chunk-GH6FM44P.js";import"./chunk-YV6UFESO.js";import"./chunk-WQ3O5RXN.js";import"./chunk-AB7GEGZ2.js";import"./chunk-E7CCHUSO.js";import"./chunk-XJRDO3NI.js";import"./chunk-WZMZMJCK.js";import"./chunk-T2KWLYCW.js";import"./chunk-LOLMUXHW.js";import"./chunk-HEHLFHW7.js";import"./chunk-VLSP3LRH.js";import"./chunk-CR2XJ2CX.js";import"./chunk-O4KXODTJ.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{o as apiOperations};
package/dist/page.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as ConfigurationSync } from './configuration-sync-DdTRUv7A.js';
1
+ import { a as ConfigurationSync } from './configuration-sync-BHrAf-ql.js';
2
2
  import { J as JsonValue, R as Result } from './growth-rules-B4YYy64R.js';
3
3
  import { z } from 'zod';
4
- import './screen-CGCJ46b1.js';
4
+ import './screen-qUBRsUi9.js';
5
5
 
6
6
  /** GET /api/v1/page-experiments/{environmentId}: page experiments and the saved groups they reference only. */
7
7
  declare const pageExperimentPayloadSchema: z.ZodObject<{
package/dist/page.js CHANGED
@@ -1 +1 @@
1
- import{d as o,e as r,f as e,g as f}from"./chunk-FMDC6N4W.js";import"./chunk-TLZP7BW6.js";import"./chunk-3VUPVXAV.js";import"./chunk-EM3MGDPG.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.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-6F4JS3RK.js";import"./chunk-OCWSWXCW.js";import"./chunk-3VUPVXAV.js";import"./chunk-AHUYZ6IW.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};
@@ -0,0 +1 @@
1
+ import{a as Tt,c as Ot,d as et,f as tt,g as Dt,k as Lt}from"./chunk-XGNXZWZL.js";import{b as Xe}from"./chunk-W32FI2A2.js";import{d as Et,e as xt,f as It,h as Ze,i as De,j as At,k as Rt,l as St}from"./chunk-AOGDCT4T.js";import{a as bt,c as Je,d as Ct,e as vt}from"./chunk-3NCMYTNG.js";import{b as ce}from"./chunk-AB7GEGZ2.js";import{a as pe,c as Ke,e as Pt,h as kt}from"./chunk-Q676H74B.js";import"./chunk-7XDQKZYA.js";import"./chunk-XJRDO3NI.js";import{ca as Ce,ea as ve,i as gt}from"./chunk-WZMZMJCK.js";import{c as fe,j as be}from"./chunk-T2KWLYCW.js";import{c as Ye}from"./chunk-LOLMUXHW.js";import"./chunk-HEHLFHW7.js";import{a as v}from"./chunk-U7NX5ET2.js";import"./chunk-VLSP3LRH.js";import"./chunk-AHUYZ6IW.js";import"./chunk-CR2XJ2CX.js";import"./chunk-O4KXODTJ.js";import"./chunk-CILM5XMH.js";import{a as M}from"./chunk-DSPLGTQI.js";import"./chunk-WOT6VMZA.js";async function Nt(O,o,R){if(o.status!=="complete")throw new v("INVALID_RESPONSE","A verified completed purchase is required");let P=O?be.parse(O):null;if(await R.onComplete?.(o),!P||!R.check)return;let L=be.parse(await R.check());if(L.internal_feature_id!==P.internal_feature_id||L.quantity!==P.quantity||P.observation!==void 0&&(L.observation===void 0||L.observation.requirementDigest!==P.observation.requirementDigest||L.observation.authority!==P.observation.authority||Ye(L.observation.subject)!==Ye(P.observation.subject)))throw new v("INVALID_RESPONSE","The access requirement changed");L.allowed&&await R.onAccessGranted?.(L)}function nt(O){return Object.entries(O.document.buttons).filter(([,o])=>o.type==="checkout"&&o.product.type==="fixed"&&!ce(o.product,{},O.capabilities)).map(([o])=>o)}function _t(O,o){let R=o.lines[0];if(o.lines.length!==1||!R)return;let P=R.productVersionId,{screen:L,buttons:J}=O.document,x=new Map((R.prepaid??[]).map(p=>[p.internal_feature_id,p.quantity]));function K(p,m){if(p.hidden)return!1;if(p.type==="plan_picker"&&O.capabilities.pickers[p.id]?.options.includes(P))return m[p.id]=P,!0;if(p.type==="quantity_picker"){let Q=x.get(p.internalFeatureId);return Q!==void 0&&(!p.bind?.plan||p.bind.plan===P)&&(m[p.id]=Q),!1}if(p.type==="button"&&p.action){let Q=J[p.action];return Q?.type==="checkout"&&Q.product.type==="fixed"&&Q.product.productVersionId===P}if(p.type!=="stack")return!1;let j=p.interaction,r=p.bind?.plan===P;for(let[Q,f]of p.children.entries()){let te={},S=K(f,te);if(j?.type==="toggle"||j?.type==="tabs"){if(!S)continue;return m[p.id]=j.type==="toggle"?Q===0:f.id,Object.assign(m,te),!0}Object.assign(m,te),S&&(r=!0,j?.type==="select"&&j.purpose==="product"&&j.pickerId&&f.type==="stack"&&f.bind?.plan===P&&(m[p.id]=f.id,m[j.pickerId]=P))}return r}for(let p of L.pages){let m={__page:p.id};if(K(p.root,m))return m}}async function Pn(O,o,R){let P=o.focusAtReveal?()=>{}:Ze(O.ownerDocument),L=()=>{x.finish("dismissed"),P()},J=()=>L(),x=At(O,o,"paywall",()=>{L(),M(o.onDismiss)},Tt);o.signal?.throwIfAborted(),o.signal?.addEventListener("abort",J,{once:!0});let K=null,p,m,j;try{if(x.start(!0,o.loadingDocument?.screen.strings.defaultLocale,o.loadingDocument??null),x.cancelled)throw new DOMException("Presentation cancelled","AbortError");if(K=o.check?be.parse(await x.wait(o.check(),De)):null,K?.allowed)return x.finish("skipped"),o.signal?.removeEventListener("abort",J),P(),await o.onAccessGranted?.(K),{check:K,host:null};let[e,t]=await Promise.allSettled([x.wait(import("./screen-renderer-YIIT742O.js")),x.wait(o.start().then(i=>(x.cancelled&&i.destroy(),i)),De)]);if(e.status==="rejected")throw t.status==="fulfilled"&&t.value.destroy(),e.reason;if(t.status==="rejected")throw t.reason;j=e.value,p=t.value,o.signal?.throwIfAborted(),p.signal?.throwIfAborted(),p.signal?.addEventListener("abort",J,{once:!0});let n=p.view??await x.wait(p.refresh(),De);if(!n)throw new v("INVALID_RESPONSE","Paywall presentation is missing");p.signal?.throwIfAborted(),m=n}catch(e){throw x.finish("error",e),o.signal?.removeEventListener("abort",J),p?.signal?.removeEventListener("abort",J),p?.destroy(),P(),e}let r=p,{mountScreenPreview:Q}=j,f=O.ownerDocument,te=new AbortController,S=f.createElement("section"),le=f.createElement("div"),G=f.createElement("div"),Le=o.mountControls,q=Le?f.createElement("div"):void 0,l=f.createElement("p"),g=f.createElement("button"),k=f.createElement("button"),I=f.createElement("dialog"),rt=r.locale||m.document.screen.strings.defaultLocale,s=rt.toLowerCase().startsWith("zh"),Ut=s?"\u6B63\u5728\u5904\u7406\u2026":"Processing\u2026",Mt=s?"\u6B63\u5728\u51C6\u5907\u62A5\u4EF7\u2026":"Preparing your price\u2026",D=Ot(m.document.screen.theme);S.dataset.indianaPaywall="",S.setAttribute("aria-label",m.document.name),S.style.cssText=D.root,G.style.cssText=D.controls,l.style.cssText=D.message,l.setAttribute("role","status"),k.style.cssText=D.link,k.textContent=s?"\u5173\u95ED":"Close",g.style.cssText=D.secondary,g.textContent=s?"\u91CD\u8BD5":"Retry",g.hidden=!0,G.append(l,g,k),q&&(q.style.cssText="flex:1 0 100%;min-width:0",q.hidden=!0,G.prepend(q)),S.append(le,G);let Ne=()=>{if(q){let i=!q.childElementCount&&!q.textContent?.trim();q.hidden!==i&&(q.hidden=i)}let e=ne??G,t=[...e.children].every(i=>i===l?!l.textContent:i.hidden),n=[...e.children].some(i=>i===k?!1:i===l?!!l.textContent:!i.hidden);e.style.cssText=t?D.controls.replace(/padding:[^;]+/,"padding:0"):n?`${D.controls};${D.pinned}`:D.controls,Me()},it=typeof MutationObserver>"u"?void 0:new MutationObserver(Ne);it?.observe(S,{attributes:!0,attributeFilter:["hidden"],characterData:!0,childList:!0,subtree:!0});let Pe=m.document.presentation,qt=Object.entries(m.document.buttons).filter(([,e])=>e.type==="close").map(([e])=>e),V,ot,_e=!1,at=JSON.stringify(m.capabilities),st=e=>oe&&!he?Object.entries(e.document.buttons).filter(([,t])=>t.type==="checkout").map(([t])=>t):nt(e);function ke(e){if(y)return;m=e;let t=JSON.stringify(e.capabilities);t!==at&&(V?.updateCapabilities(pe(e),st(e)),at=t),Ht(e),ye()}let E,Ue=0;function Me(){let e=f.defaultView;if(!E?.responsive||!e)return;let t=ne??G,n=e.innerHeight-(E.type==="modal"?32:0);t.style.maxHeight=`${Math.max(1,n)}px`,t.style.overflowY="auto",t.style.flexShrink="0",Ue=Math.max(1,n-t.getBoundingClientRect().height),V?.resizeViewport?.(Ue,e.innerWidth)}let y=!1,oe=!1,C=null,qe,Ee=!1,ct=!1,ae=!1,Ve,$e=!1,X,ne;function Vt(){return oe||y||X||$e?{type:"recover",operationId:r.operation?.operationId??r.quote?.operationId??null,requestId:null}:Je(r)}let A=()=>!y&&!Ee&&!X&&o.canInteract?.()!==!1,$,ue=!1,u=null,Z=null,He="",se=()=>o.checkoutNavigation==="after_confirmation"&&!!(o.terminateCheckout||o.resumeCheckout),me={},he,W=null;function ye(){if(!se()||!V?.updateCheckoutControls)return;let e=r.quote,t=!W&&!!e&&!!r.operation&&H(r.operation).type==="checkout",n=Object.entries(m.document.buttons).flatMap(([i,a])=>a.type==="checkout"?[{actionId:i,policy:a}]:[]);V.updateCheckoutControls({actions:n.map(({actionId:i})=>i),resume:t?n.filter(({actionId:i,policy:a})=>Ae(e,m,i,a.product,me)).map(({actionId:i})=>i):[],resumeLabel:s?"\u7EE7\u7EED\u4ED8\u6B3E":"Continue checkout",busy:he})}function lt(){Z?.remove(),Z=null}async function Be(){if(W)return;if(o.resumeCheckout&&r.operation){await o.resumeCheckout(r.operation.operationId);return}let e=await r.read();if(H(e).type!=="checkout")return N(e,!1);A()&&(xe.delete(e.operationId),await Re(e))}function ut(){l.textContent=s?"\u6682\u65F6\u65E0\u6CD5\u6253\u5F00\u4ED8\u6B3E\u9875\u9762\u3002\u8BF7\u91CD\u8BD5\u3002":"Couldn\u2019t open checkout. Try again.",g.hidden=!0}async function dt(e=!1){let t=W;if(!t)return;g.hidden=!0;let n=Date.now()+2e4;for(;A();){let i=await r.read();if(i.operationId!==t.operationId)throw new v("PURCHASE_PENDING","The original Checkout changed");if(!A())break;let a=H(i);if(a.type==="native"){W=null,lt(),C=t.selection,$=t.coupon,ue=!1,await ge();return}if(a.type==="complete"||a.type==="fulfillment"||a.type==="recording"){W=null,await N(i,!1);return}if(e&&a.type==="checkout"){e=!1;try{await o.terminateCheckout(t.operationId)}catch(h){M(o.onError,h)}}if(Date.now()>=n)break;await Xe(1e3,f,te.signal)}y||ut()}async function $t(e,t,n){W={operationId:e,selection:t,coupon:n};let i=!1;try{await o.terminateCheckout(e)}catch(a){if(a instanceof v&&["CAPABILITY_UNAVAILABLE","NOT_CONFIGURED"].includes(a.code)){W=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.",M(o.onError,a);return}i=a instanceof v&&(a.status??0)>=500,M(o.onError,a)}A()&&await dt(i)}function Fe(e,t,n,i,a){let h=pe(e).checkoutCoupons?.[t],c=h?h.products[n]:o.claimCoupon&&a?gt(e.capabilities,a,i):void 0;return c?.couponId&&c.planVersionId===n?{id:c.couponId,offerId:c.offerId}:void 0}function Ht(e){oe||C||r.quote||r.operation||He&&l.textContent===He||(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 xe=new Map,Ie=!1;function Ae(e,t,n,i,a,h){let c=e.lines.length===1?e.lines[0]:void 0,w=ce(i,a,t.capabilities);if(!c||!w||c.productVersionId!==w)return!1;let B=Fe(t,n,w,a,h);if((B||pe(t).checkoutCoupons?.[n])&&(B?.id??null)!==(e.discount?.couponId??null))return!1;let _;try{_=ve(t.document.screen,w,a,t.capabilities)}catch{return!1}let ie=Object.fromEntries((c.prepaid??[]).map(z=>[z.internal_feature_id,z.quantity]));return[...new Set([...Object.keys(_),...Object.keys(ie)])].every(z=>(_[z]??0)===(ie[z]??0))}let H=e=>bt({quote:r.quote,operation:e,requestId:null,pending:!1,destroyed:y,canReselect:r.canReselect});async function Re(e){let t=e.merchantExecution;if(!(!A()||!e.checkoutUrl||o.checkoutNavigation==="after_confirmation"&&H(e).type!=="checkout"||t?.type==="purchase"&&!["not_started","pending"].includes(t.paymentStatus)||xe.get(e.operationId)===e.checkoutUrl)){xe.set(e.operationId,e.checkoutUrl);try{o.onCheckoutUrl?await o.onCheckoutUrl(e.checkoutUrl):f.defaultView?.location.assign(e.checkoutUrl)}catch(n){throw xe.delete(e.operationId),n}}}let re=(e,t=!1)=>{if(e instanceof Ke)u=null,l.textContent=e.customerMessage(s);else if(Dt(e))u=null,l.textContent=t?s?"\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.":tt(e,s);else if(t){let n=e instanceof v?e.code:void 0;n==="CAPABILITY_UNAVAILABLE"||n==="NOT_CONFIGURED"?(u=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&&!C?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")?tt(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.";g.hidden=u===null,He=l.textContent,t&&!E?.responsive&&l.scrollIntoView?.({block:"nearest"}),M(t&&R?.quoteError?R.quoteError:o.onError,e)},Se=new WeakMap;function Te(e){oe=e,g.disabled=e,V?.updateCapabilities?.(pe(m),st(m));for(let t of Z?.querySelectorAll("button")??[])e?(Se.set(t,t.disabled),t.disabled=!0):Se.has(t)&&(t.disabled=Se.get(t),Se.delete(t)),et(t)}function je(){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 Bt(e){if(o.beforeAction)try{await o.beforeAction()}catch(t){throw t instanceof Ke?(C=null,ue=!1,u=null):u=e,t}}async function U(e,t){if(oe||y)return;if(!A()){je();return}let n=e===ge,i=n?Mt:Ut,a=se()&&t!==void 0;he=a?t:void 0,Te(!0),ye(),g.hidden=!0,l.textContent=a?"":i;try{if((e!==Be||!o.resumeCheckout)&&await Bt(e),y)return;if(!A()){u=e,g.hidden=!1,je();return}await e()}catch(h){y||re(h,n&&!a)}finally{he=void 0,Te(!1),ye(),l.textContent===i&&(l.textContent="")}}async function Ft(e){await Nt(K,e,o)}function ft(e){return Je(r).type==="recording"||H(e).type==="recording"}function pt(e){let t=e.merchantTerms,n=t?.subscriptionTerms?.items??[],i=t?t.totalMinor:e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),a=t?n.length===1&&n[0]?.amountMinor===i&&n[0]:e.lines.length===1&&e.lines[0]?.catalogAmountMinor===i&&e.lines[0],h=i===null?fe(t.subtotalMinor-t.discountMinor,e.currency)+(s?" + \u5F85\u786E\u8BA4\u7A0E\u8D39":" + tax confirmed at checkout"):fe(i,e.currency)+(a?Ce(a.interval,s?"zh-CN":"en",a.intervalCount??1):""),c=e.lines.map(w=>w.productName).join(", ");return{label:c?`${c} \xB7 ${h}`:h,recurring:a}}async function N(e,t=o.checkoutNavigation!=="after_confirmation"){if(y)return;if(!A()){u=async()=>N(await r.read()),g.hidden=!1;return}if(l.textContent=Lt(e.status,s),ft(e)){let a=e.merchantExecution?.type==="purchase"&&e.merchantExecution.recordingStatus==="failed";l.textContent=a?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.",g.textContent=s?"\u67E5\u8BE2\u8BB0\u5F55":"Check recording",u=async()=>N(await r.read()),g.hidden=!1;return}if(e.problem){let a=e.problem;u=we,g.textContent=s?"\u68C0\u67E5\u5E76\u6062\u590D\u539F\u64CD\u4F5C":"Check and recover original purchase",re(new v(a.code,a.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.":a.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.":a.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.":a.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,a));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"){u=null,await Ft(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",g.textContent=s?"\u67E5\u8BE2\u7ED3\u679C":"Check result",u=async()=>N(await r.read()),g.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."),g.textContent=s?"\u91CD\u8BD5":"Retry",u=null,C=null;return}if(!t&&H(e).type==="checkout"){if(W){ut();return}if(se()){l.textContent="",Ie=!1,u=null,ye();return}let a=r.quote,h=a?.operationId===e.operationId?pt(a).label:"";l.textContent=Ie?h?s?`${h} \u5C1A\u672A\u4ED8\u6B3E\u3002\u518D\u6B21\u9009\u62E9\u8BE5\u65B9\u6848\u5373\u53EF\u7EE7\u7EED\u4ED8\u6B3E\u3002`:`${h} 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.":"",Ie=!1,u=null;return}await Re(e);let n=Date.now()+6e5,i=2e3;_e=!0,M(o.onObservationChange,!0);try{for(;!y&&Date.now()<n;){if(await Xe(i,f,te.signal),y)return;if(!A()){u=async()=>N(await r.read()),g.hidden=!1;return}let a=await r.read();if(!t&&H(a).type==="checkout"){await N(a,!1);return}if(!a.problem&&a.status==="pending"&&await Re(a),a.status!=="pending"||a.problem||ft(a)){await N(a);return}i=Math.min(i*1.5,3e4)}}finally{_e=!1,M(o.onObservationChange,!1)}u=async()=>N(await r.read()),g.hidden=!1}async function Qe(e=!1){let t=await r.read();if(y)return;if(!A()){u=()=>Qe(e),g.hidden=!1;return}let n=r.quote;if(n&&Pt(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){mt(n);return}await N(t,e||void 0)}async function we(){lt(),u=we;let e=await r.confirm();if(!A()){u=we,g.hidden=!1;return}if(e.problem){await N(e);return}if(e.status==="pending"){if(e.checkoutUrl)await Re(e);else if(e.execution&&e.execution.provider!=="merchant"||e.nativePurchase){if(!o.onPurchase)throw new v("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await o.onPurchase({operation:e,signal:te.signal})}}u=async()=>N(await r.read()),await N(e,!0)}function mt(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=f.createElement("div"),i=f.createElement("button"),a=f.createElement("button"),h=f.createElement("div"),c=f.createElement("p"),w=e.merchantTerms,B=s?"zh-CN":"en",_=w?.subscriptionTerms?.items??[],ie=w?w.subscriptionTerms?.trial?.days:e.lines.find(d=>d.trial)?.trial?.days,ee=ie===void 0?null:w?w.totalMinor:e.charge?e.charge.totalMinor:e.lines.every(d=>d.trial)?0:null,z=(d,b)=>s?`${b} \u5929\u8BD5\u7528\u7ED3\u675F\u540E ${d}`:`Then ${d} after the ${b}-day trial`,{label:ze,recurring:ht}=pt(e),jt=e.lines.map(d=>d.productName).join(", "),yt=ee===null?"":`${s?"\u4ECA\u5929\u5E94\u4ED8":"Due today"} ${fe(ee,e.currency)}`;c.textContent=yt?[jt,yt].filter(Boolean).join(" \xB7 "):ze,i.textContent=s?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",i.disabled=t,a.textContent=s?"\u53D6\u6D88":"Cancel",n.style.cssText=D.panel,c.style.cssText=D.summary,h.style.cssText=D.actions,i.style.cssText=D.primary,a.style.cssText=D.secondary,et(i),i.onclick=()=>{U(we)};let wt=async()=>{let d=await r.cancel();y||(n.remove(),Z=null,await N(d))};a.onclick=()=>{u=wt,U(wt)};let F=f.createElement("div");if(F.style.cssText=D.terms,w){for(let b of _){if(ee===null&&b===ht)continue;let T=f.createElement("p"),Y=fe(b.amountMinor,e.currency)+Ce(b.interval,B,b.intervalCount);T.textContent=ee!==null&&ie!==void 0?z(Y,ie):Y,F.append(T)}let d=w.subscriptionTerms?.trial;if(d){let b=f.createElement("p");b.textContent=s?`\u8BD5\u7528 ${d.days} \u5929\uFF1B${d.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${d.days}; ${d.cardRequired?"a payment method is required":"no payment method is required"}`,F.append(b)}for(let b of[...w.expectedEffects.map(T=>T.description),...w.requiredConsents.map(T=>T.summary)]){let T=f.createElement("p");T.textContent=b,F.append(T)}}else{for(let d of e.lines){if(ee!==null||d!==ht){let b=f.createElement("p"),T=`${fe(d.catalogAmountMinor,e.currency)}${Ce(d.interval,B,d.intervalCount??1)}`;b.textContent=ee!==null&&d.trial?(e.lines.length>1?`${d.productName} \xB7 `:"")+z(T,d.trial.days):`${d.productName} \xB7 ${T}`,F.append(b)}for(let b of d.prepaid??[]){let T=f.createElement("p"),Y=r.view?.capabilities.plans[d.productVersionId]?.prepaid?.find(Qt=>Qt.internalFeatureId===b.internal_feature_id);T.textContent=`${Y?.name??b.internal_feature_id} \xB7 ${b.quantity} ${s?"\u4EFD":"packs"} \xD7 ${b.terms.units}`,Y&&(T.textContent+=Ce(Y.reset==="week"||Y.reset==="month"||Y.reset==="year"?Y.reset:"one_time",B,Y.resetCount)),F.append(T)}if(d.trial){let b=f.createElement("p");b.textContent=s?`\u8BD5\u7528 ${d.trial.days} \u5929\uFF1B${d.trial.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${d.trial.days}; ${d.trial.cardRequired?"a payment method is required":"no payment method is required"}`,F.append(b)}}if(!e.charge){let d=f.createElement("p");d.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.",F.append(d)}}for(let d of F.children)d.style.margin="0";h.append(i,a),n.append(c,...F.childElementCount?[F]:[],h),G.prepend(n),E?.responsive||n.scrollIntoView?.({block:"nearest"}),i.focus({preventScroll:!0}),Z=n,u=null}async function ge(){if(!C)return;if(u=ge,!ue){let n=r.view,i=n?.document.buttons[C.actionId],a=n&&i?.type==="checkout"?ce(i.product,C.selection,n.capabilities):null;if(!n||!a)throw new v("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");let h=$?.offerId;if($&&!h){if(!o.claimCoupon)throw new v("CAPABILITY_UNAVAILABLE","Coupon claiming is unavailable");let{offer:c}=await o.claimCoupon($.id,C.requestId);if(y)return;if(!c||c.couponId!==$.id||c.status!=="issued"||!(Date.parse(c.expiresAt)>Date.now()))throw C=null,$=void 0,u=async()=>{ke(await r.refresh()),u=null},new v("COUPON_UNAVAILABLE","This Coupon is no longer available for this purchase");h=c.id}if(!$&&!n.document.screen.actions.some(c=>c.id===C?.actionId&&typeof c.properties.couponBinding=="string")&&(h=await o.resolveOfferId?.({actionId:C.actionId,productVersionId:a,featureQuantities:ve(n.document.screen,a,C.selection,n.capabilities)})),y)return;h!==void 0&&(C.offerId=h),ue=!0}if(!A()){g.hidden=!1;return}let e;try{e=await r.preview(C)}catch(n){throw r.canReselect===!0&&(C=null,ue=!1,$=void 0,u=null),n}if($&&(e.discount?.couponId!==$.id||e.discount.offerId!==C.offerId))throw new v("INVALID_RESPONSE","The quote did not apply the Coupon selected on this Paywall");if(y)return;let t=e.merchantTerms;if(o.confirmOnHostedCheckout&&A()&&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=he?"":s?"\u6B63\u5728\u6253\u5F00\u6536\u94F6\u53F0\u2026":"Opening checkout\u2026";l.textContent=n;try{await we()}catch(i){y||re(i)}finally{l.textContent===n&&(l.textContent="")}return}mt(e)}function de(e="destroy"){if(y)return;y=!0;let t=qe;qe=void 0,M(t),o.signal?.removeEventListener("abort",J),r.signal?.removeEventListener("abort",J),x.finish("dismissed"),ot?.(),te.abort(),it?.disconnect(),E?.destroy(),V?.destroy(),r.destroy(),I.open&&I.close(),I.remove(),S.remove(),P(),e==="dismiss"&&M(o.onDismiss)}L=de;async function Oe(){if(!ae||y||Ee||X==="closing"||!X&&!A())return;if(!R){de("dismiss");return}let e=f.createElement("p");e.setAttribute("role","status"),e.textContent=s?"\u6B63\u5728\u5173\u95ED\u2026":"Closing\u2026",ne||(ne=f.createElement("div"),ne.style.cssText=G.style.cssText,G.replaceWith(ne),le.inert=!0),k.hidden=!1,ne.replaceChildren(e,k),X="closing",k.setAttribute("aria-disabled","true"),k.focus({preventScroll:!0});try{await R.dismiss()}catch(t){y||M(o.onError,t)}y||(X="retry",e.textContent=s?"\u672A\u80FD\u786E\u8BA4\u5173\u95ED\uFF0C\u8BF7\u91CD\u8BD5\u3002":"Could not confirm closure. Try again.",k.textContent=s?"\u91CD\u8BD5\u5173\u95ED":"Retry closing",k.removeAttribute("aria-label"),k.removeAttribute("aria-disabled"))}k.onclick=()=>{Oe()},I.addEventListener("cancel",e=>{e.preventDefault(),Oe()}),g.onclick=()=>{u&&U(u)};function Ge(e){x.finish("error",e),de()}function We(){if(!(!ct||ae||y||Ee||E&&!A()))try{let e=t=>{o.focusAtReveal&&(P=Ze(f)),V?.setHidden?.(!1),Ve?.(),E&&(I.showModal(),E.responsive&&I.focus({preventScroll:!0}),!t&&o.loading!=="host"&&xt(I,E.type,E.responsive)),ae=!0};R?R.present(()=>x.present(()=>e(!0))):x.present(e)}catch(e){Ge(e),re(e)}}try{if(Pe.type==="inline"?(Ne(),Ve=St(S,O),O.append(S)):(I.setAttribute("aria-label",m.document.name),k.textContent="\xD7",k.setAttribute("aria-label",s?"\u5173\u95ED":"Close"),It(k,m.document.screen.theme),k.hidden=kt(m.document),I.append(k,S),O.append(I),E=Et(I,{...m.document.screen,presentation:Pe},Me),E.latch(),E.responsive&&(S.style.display="flex",S.style.flexDirection="column",S.style.maxHeight="100%",le.style.overflow="clip",le.style.minHeight="0"),Ve=Rt(I)),Le&&q){let n=Le(q);if(typeof n=="function"&&(y?M(n):qe=n),y)throw new DOMException("Presentation cancelled","AbortError");Ne()}V=Q(le,{mode:"live",rendererUrl:r.webViewUrl,title:m.document.name,closeActions:qt,onAuthoredClose(n){X||y||(k.hidden=n)},hostPresentation:()=>E?.type??Pe.type,reportContentHeight:E?.responsive,onResize:n=>{if(!E?.responsive)return;let i=Math.min(n,Ue);le.style.height=`${i}px`,E.setContentHeight(i+(ne??G).getBoundingClientRect().height)},onSelection(n){me=n,ye()},onAction(n,i={},a,h){if(!ae||y||X)return;let c=r.view,w=c?.document.buttons[n];if(!w)return;if(w.type==="close"&&R&&o.resumeCheckout&&r.operation&&Ct(H(r.operation))){Oe();return}if(oe)return;if(!A()){je();return}if(w.type==="close"){U(async()=>{await o.onAction?.(n),de(o.onAction?"action":"dismiss")});return}if(w.type==="action"){u=async()=>{if(w.action.type==="event"){if(!o.onEvent)throw new v("EVENT_HANDLER_REQUIRED","Provide the event handler");await o.onEvent(w.action.event)}else o.onOpenUrl?await o.onOpenUrl(w.action.url):f.defaultView?.location.assign(w.action.url);await o.onAction?.(n),u=null},U(u);return}if(o.allowNewPurchase===!1){se()&&c&&r.quote&&r.operation&&H(r.operation).type==="checkout"&&Ae(r.quote,c,n,w.product,i,h)?U(Be,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.",E?.responsive||Z.scrollIntoView?.({block:"nearest"}),Z.querySelector("button")?.focus({preventScroll:!0});return}if(se()&&W){W.selection.actionId===n&&U(()=>dt(!0),n);return}if(se()&&o.terminateCheckout&&c&&r.quote&&r.operation&&r.canReselect===!1&&H(r.operation).type==="checkout"){if(Ae(r.quote,c,n,w.product,i,h)){U(Be,n);return}let _=ce(w.product,i,c.capabilities);try{if(!_)throw new v("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");ve(c.document.screen,_,i,c.capabilities)}catch(ze){re(ze);return}let ie=r.operation.operationId,ee={actionId:n,requestId:crypto.randomUUID(),selection:structuredClone(i)},z=Fe(c,n,_,i,h);U(()=>$t(ie,ee,z),n);return}if((r.quote||C)&&r.canReselect===!1){let _=!!c&&!!r.quote&&Ae(r.quote,c,n,w.product,i,h);Ie=!!r.quote&&!_,u=r.quote?()=>Qe(_):ge,U(u);return}let B=c&&ce(w.product,i,c.capabilities);if(!c||!B){re(new v("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(o.onPurchaseIntent){u=null,U(async()=>{let _={actionId:n,productVersionId:B,selection:structuredClone(i),featureQuantities:ve(c.document.screen,B,i,c.capabilities)};$e=!0,await o.onPurchaseIntent(_)});return}if(C&&C.actionId!==n){re(new v("COMMAND_PENDING","Finish the current purchase"));return}C||($=Fe(c,n,B,i,h),C={requestId:crypto.randomUUID(),actionId:n,selection:structuredClone(i)},ue=!1),U(ge,n)},onEscape:()=>{Oe()},onError:n=>{let i=new Error(n);!ae&&!y&&Ge(i),re(i)},onRendered:n=>{n&&I.setAttribute("aria-label",n),ct=!0,We()}}),V.setHidden?.(!0),Me();let e=se()&&!!r.quote&&!!r.operation&&H(r.operation).type==="checkout";me=e?_t(m,r.quote)??{}:{},V.update(m.document.screen,rt,{capabilities:pe(m),unavailableActions:nt(m),serverInput:{bindings:[],answers:{}},...Object.keys(me).length?{selection:me}:{}}),ot=r.subscribe?.(ke),ke(r.view??m),await x.wait(V.ready);let t=r.operation;!e&&(r.quote||t&&(t.confirmedAt||t.checkoutUrl||t.status==="complete"))&&(u=()=>Qe(),U(u))}catch(e){throw Ge(e),e}return{check:K,host:{get observing(){return _e},get recovery(){return Vt()},async prepareFallback(){if(oe||y||X||$e)return{type:"recover",operationId:r.operation?.operationId??r.quote?.operationId??null,requestId:null};Te(!0);try{let e=await vt(r);return e.type==="native"&&de(),e}finally{Te(!1)}},setSuspended(e){Ee=e,S.hidden=e,e&&I.open?I.close():!e&&!ae?We():!e&&!y&&ae&&Pe.type!=="inline"&&!I.open&&I.showModal()},destroy:de,refresh:async()=>{if(!A()){if(r.view)return r.view;throw new v("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await r.refresh();return ke(e),We(),e}}}}export{Pn as showPaywall};
@@ -0,0 +1 @@
1
+ import{b as a}from"./chunk-W74JLL2O.js";import"./chunk-ECKVJGXQ.js";import"./chunk-GH6FM44P.js";import"./chunk-YV6UFESO.js";import"./chunk-WQ3O5RXN.js";import"./chunk-AB7GEGZ2.js";import"./chunk-7XDQKZYA.js";import"./chunk-XJRDO3NI.js";import"./chunk-WZMZMJCK.js";import"./chunk-T2KWLYCW.js";import"./chunk-LOLMUXHW.js";import"./chunk-HEHLFHW7.js";import"./chunk-U7NX5ET2.js";import"./chunk-VLSP3LRH.js";import"./chunk-3VUPVXAV.js";import"./chunk-AHUYZ6IW.js";import"./chunk-CR2XJ2CX.js";import"./chunk-O4KXODTJ.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as readPaywallContent};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-RE4OLOOT.js";import"./chunk-LC6UCDWE.js";import"./chunk-UV4H6VCS.js";import"./chunk-CY7OKV7E.js";import"./chunk-D3OYXTMC.js";import"./chunk-4KLXQKNO.js";import"./chunk-PW5PIBSO.js";import"./chunk-S43TYW3V.js";import"./chunk-W74JLL2O.js";import"./chunk-ECKVJGXQ.js";import"./chunk-GH6FM44P.js";import"./chunk-YV6UFESO.js";import"./chunk-WQ3O5RXN.js";import"./chunk-3NCMYTNG.js";import"./chunk-AB7GEGZ2.js";import"./chunk-Q676H74B.js";import"./chunk-E7CCHUSO.js";import"./chunk-7XDQKZYA.js";import"./chunk-XJRDO3NI.js";import"./chunk-WZMZMJCK.js";import"./chunk-T2KWLYCW.js";import"./chunk-LOLMUXHW.js";import"./chunk-HEHLFHW7.js";import"./chunk-U7NX5ET2.js";import"./chunk-VLSP3LRH.js";import"./chunk-3VUPVXAV.js";import"./chunk-AHUYZ6IW.js";import"./chunk-CR2XJ2CX.js";import"./chunk-O4KXODTJ.js";import"./chunk-CILM5XMH.js";import"./chunk-DSPLGTQI.js";import"./chunk-WOT6VMZA.js";export{a as createPaywallSession};
package/dist/popup.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { b as ScreenAction, c as ScreenNode, d as ScreenInteractivity, e as ScreenDocument } from './screen-CGCJ46b1.js';
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-CFSiS0VX.js';
4
- export { d as PresentationState } from './presentation-loading-CFSiS0VX.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';
5
5
  import { WindowLike } from 'dompurify';
6
6
  import 'zod';
7
7
 
@@ -191,7 +191,7 @@ declare function mountScreenPreview(container: HTMLElement, options?: {
191
191
  onHover?: (id: string | null) => void;
192
192
  onSelect?: (id: string | null) => void;
193
193
  onEdit?: (id: string) => void;
194
- onAction?: (actionId: string, selection?: Record<string, string | boolean | number>, answers?: ScreenAnswers) => void;
194
+ onAction?: (actionId: string, selection?: Record<string, string | boolean | number>, answers?: ScreenAnswers, sourceNodeId?: string) => void;
195
195
  onSelection?: (selection: Record<string, string | boolean | number>) => void;
196
196
  onAnswers?: (answers: ScreenAnswers) => void;
197
197
  /** Receives the screen's first visible heading, its accessible name. */
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-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{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-DDLSQSWO.js";import"./chunk-AOGDCT4T.js";import"./chunk-WZMZMJCK.js";import"./chunk-T2KWLYCW.js";import"./chunk-LOLMUXHW.js";import"./chunk-HEHLFHW7.js";import"./chunk-U7NX5ET2.js";import"./chunk-VLSP3LRH.js";import"./chunk-CR2XJ2CX.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,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { S as StackNode, e as ScreenDocument } from './screen-CGCJ46b1.js';
2
+ import { S as StackNode, e as ScreenDocument } from './screen-qUBRsUi9.js';
3
3
 
4
4
  declare const surfaceDataSchema: z.ZodObject<{
5
5
  paywall: z.ZodOptional<z.ZodObject<{
@@ -521,6 +521,11 @@ declare const publicPaywallSchema: z.ZodObject<{
521
521
  blur: "blur";
522
522
  }>>;
523
523
  type: z.ZodLiteral<"modal">;
524
+ position: z.ZodOptional<z.ZodEnum<{
525
+ center: "center";
526
+ top: "top";
527
+ bottom: "bottom";
528
+ }>>;
524
529
  size: z.ZodEnum<{
525
530
  sm: "sm";
526
531
  md: "md";
@@ -584,6 +589,11 @@ declare const publicPaywallSchema: z.ZodObject<{
584
589
  blur: "blur";
585
590
  }>>;
586
591
  type: z.ZodLiteral<"modal">;
592
+ position: z.ZodOptional<z.ZodEnum<{
593
+ center: "center";
594
+ top: "top";
595
+ bottom: "bottom";
596
+ }>>;
587
597
  size: z.ZodEnum<{
588
598
  sm: "sm";
589
599
  md: "md";
@@ -1,12 +1,12 @@
1
- import { f as createCustomerClient, d as createFunnelClient } from './funnel-process-client-D6qjStm2.js';
2
- export { F as FunnelProcessAdapter, a as FunnelProcessOptions, c as createFunnelProcess } from './funnel-process-client-D6qjStm2.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-Dz1dTgES.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-Dz1dTgES.js';
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';
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-DdTRUv7A.js';
8
- import './api-Do-6AyWa.js';
9
- import './screen-CGCJ46b1.js';
7
+ export { C as ConfigurationStorage, b as ConfigurationSyncOptions, c as createConfigurationSync } from './configuration-sync-BHrAf-ql.js';
8
+ import './api-r6FfVQpg.js';
9
+ import './screen-qUBRsUi9.js';
10
10
  import 'zod/v4';
11
11
  import './coupon-kfkIVf9n.js';
12
12
 
@@ -1 +1 @@
1
- import{b as S,c as E,d as T}from"./chunk-RML52BOR.js";import"./chunk-KPDHY76A.js";import{a as A}from"./chunk-GZRRVHYK.js";import{e as P}from"./chunk-44U3FOBB.js";import"./chunk-WZR2XCSJ.js";import{h as b,i as x,k as L}from"./chunk-BLVBUN2R.js";import{F as C}from"./chunk-2FE4FTPH.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{b as R}from"./chunk-TJGIT5CU.js";import{a as r}from"./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";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-2VMEDQHT.js";import"./chunk-ZYOZSUZS.js";import{a as A}from"./chunk-RE4OLOOT.js";import{e as P}from"./chunk-LC6UCDWE.js";import"./chunk-UV4H6VCS.js";import{h as b,i as x,k as L}from"./chunk-ZZIBLQCJ.js";import{F as C}from"./chunk-KFIL73QY.js";import"./chunk-CY7OKV7E.js";import"./chunk-D3OYXTMC.js";import"./chunk-4KLXQKNO.js";import"./chunk-PW5PIBSO.js";import"./chunk-S43TYW3V.js";import"./chunk-W74JLL2O.js";import"./chunk-ECKVJGXQ.js";import"./chunk-GH6FM44P.js";import"./chunk-YV6UFESO.js";import"./chunk-WQ3O5RXN.js";import"./chunk-3NCMYTNG.js";import"./chunk-AB7GEGZ2.js";import"./chunk-Q676H74B.js";import"./chunk-E7CCHUSO.js";import"./chunk-7XDQKZYA.js";import"./chunk-XJRDO3NI.js";import"./chunk-WZMZMJCK.js";import"./chunk-T2KWLYCW.js";import"./chunk-LOLMUXHW.js";import{b as R}from"./chunk-HEHLFHW7.js";import{a as r}from"./chunk-U7NX5ET2.js";import"./chunk-VLSP3LRH.js";import"./chunk-3VUPVXAV.js";import"./chunk-AHUYZ6IW.js";import"./chunk-CR2XJ2CX.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};
@@ -251,8 +251,8 @@ declare const textNodeSchema: z.ZodObject<{
251
251
  muted: "muted";
252
252
  }>, z.ZodString]>>;
253
253
  align: z.ZodOptional<z.ZodEnum<{
254
- start: "start";
255
254
  center: "center";
255
+ start: "start";
256
256
  end: "end";
257
257
  }>>;
258
258
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -408,8 +408,8 @@ declare const imageNodeSchema: z.ZodObject<{
408
408
  muted: "muted";
409
409
  }>, z.ZodString]>>;
410
410
  align: z.ZodOptional<z.ZodEnum<{
411
- start: "start";
412
411
  center: "center";
412
+ start: "start";
413
413
  end: "end";
414
414
  }>>;
415
415
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -565,8 +565,8 @@ declare const buttonNodeSchema: z.ZodObject<{
565
565
  muted: "muted";
566
566
  }>, z.ZodString]>>;
567
567
  align: z.ZodOptional<z.ZodEnum<{
568
- start: "start";
569
568
  center: "center";
569
+ start: "start";
570
570
  end: "end";
571
571
  }>>;
572
572
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -704,8 +704,8 @@ declare const dividerNodeSchema: z.ZodObject<{
704
704
  muted: "muted";
705
705
  }>, z.ZodString]>>;
706
706
  align: z.ZodOptional<z.ZodEnum<{
707
- start: "start";
708
707
  center: "center";
708
+ start: "start";
709
709
  end: "end";
710
710
  }>>;
711
711
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -873,8 +873,8 @@ declare const customerDataNodeSchema: z.ZodObject<{
873
873
  muted: "muted";
874
874
  }>, z.ZodString]>>;
875
875
  align: z.ZodOptional<z.ZodEnum<{
876
- start: "start";
877
876
  center: "center";
877
+ start: "start";
878
878
  end: "end";
879
879
  }>>;
880
880
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -1021,8 +1021,8 @@ declare const spacerNodeSchema: z.ZodObject<{
1021
1021
  muted: "muted";
1022
1022
  }>, z.ZodString]>>;
1023
1023
  align: z.ZodOptional<z.ZodEnum<{
1024
- start: "start";
1025
1024
  center: "center";
1025
+ start: "start";
1026
1026
  end: "end";
1027
1027
  }>>;
1028
1028
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -1261,8 +1261,8 @@ declare const customHtmlNodeSchema: z.ZodObject<{
1261
1261
  muted: "muted";
1262
1262
  }>, z.ZodString]>>;
1263
1263
  align: z.ZodOptional<z.ZodEnum<{
1264
- start: "start";
1265
1264
  center: "center";
1265
+ start: "start";
1266
1266
  end: "end";
1267
1267
  }>>;
1268
1268
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -1399,8 +1399,8 @@ declare const priceNodeSchema: z.ZodObject<{
1399
1399
  muted: "muted";
1400
1400
  }>, z.ZodString]>>;
1401
1401
  align: z.ZodOptional<z.ZodEnum<{
1402
- start: "start";
1403
1402
  center: "center";
1403
+ start: "start";
1404
1404
  end: "end";
1405
1405
  }>>;
1406
1406
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -1531,8 +1531,8 @@ declare const priceNodeSchema: z.ZodObject<{
1531
1531
  muted: "muted";
1532
1532
  }>, z.ZodString]>>;
1533
1533
  align: z.ZodOptional<z.ZodEnum<{
1534
- start: "start";
1535
1534
  center: "center";
1535
+ start: "start";
1536
1536
  end: "end";
1537
1537
  }>>;
1538
1538
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -1663,8 +1663,8 @@ declare const priceNodeSchema: z.ZodObject<{
1663
1663
  muted: "muted";
1664
1664
  }>, z.ZodString]>>;
1665
1665
  align: z.ZodOptional<z.ZodEnum<{
1666
- start: "start";
1667
1666
  center: "center";
1667
+ start: "start";
1668
1668
  end: "end";
1669
1669
  }>>;
1670
1670
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -1799,8 +1799,8 @@ declare const priceNodeSchema: z.ZodObject<{
1799
1799
  muted: "muted";
1800
1800
  }>, z.ZodString]>>;
1801
1801
  align: z.ZodOptional<z.ZodEnum<{
1802
- start: "start";
1803
1802
  center: "center";
1803
+ start: "start";
1804
1804
  end: "end";
1805
1805
  }>>;
1806
1806
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -1939,8 +1939,8 @@ declare const couponCodeNodeSchema: z.ZodObject<{
1939
1939
  muted: "muted";
1940
1940
  }>, z.ZodString]>>;
1941
1941
  align: z.ZodOptional<z.ZodEnum<{
1942
- start: "start";
1943
1942
  center: "center";
1943
+ start: "start";
1944
1944
  end: "end";
1945
1945
  }>>;
1946
1946
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -2091,8 +2091,8 @@ declare const countdownNodeSchema: z.ZodObject<{
2091
2091
  muted: "muted";
2092
2092
  }>, z.ZodString]>>;
2093
2093
  align: z.ZodOptional<z.ZodEnum<{
2094
- start: "start";
2095
2094
  center: "center";
2095
+ start: "start";
2096
2096
  end: "end";
2097
2097
  }>>;
2098
2098
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -2248,8 +2248,8 @@ declare const planPickerNodeSchema: z.ZodObject<{
2248
2248
  muted: "muted";
2249
2249
  }>, z.ZodString]>>;
2250
2250
  align: z.ZodOptional<z.ZodEnum<{
2251
- start: "start";
2252
2251
  center: "center";
2252
+ start: "start";
2253
2253
  end: "end";
2254
2254
  }>>;
2255
2255
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -2384,8 +2384,8 @@ declare const planPickerNodeSchema: z.ZodObject<{
2384
2384
  muted: "muted";
2385
2385
  }>, z.ZodString]>>;
2386
2386
  align: z.ZodOptional<z.ZodEnum<{
2387
- start: "start";
2388
2387
  center: "center";
2388
+ start: "start";
2389
2389
  end: "end";
2390
2390
  }>>;
2391
2391
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -2536,8 +2536,8 @@ declare const quantityPickerNodeSchema: z.ZodObject<{
2536
2536
  muted: "muted";
2537
2537
  }>, z.ZodString]>>;
2538
2538
  align: z.ZodOptional<z.ZodEnum<{
2539
- start: "start";
2540
2539
  center: "center";
2540
+ start: "start";
2541
2541
  end: "end";
2542
2542
  }>>;
2543
2543
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -2574,14 +2574,14 @@ declare const stackNodeFields: {
2574
2574
  overlay: "overlay";
2575
2575
  }>;
2576
2576
  align: z.ZodEnum<{
2577
- start: "start";
2578
2577
  center: "center";
2578
+ start: "start";
2579
2579
  end: "end";
2580
2580
  stretch: "stretch";
2581
2581
  }>;
2582
2582
  justify: z.ZodEnum<{
2583
- start: "start";
2584
2583
  center: "center";
2584
+ start: "start";
2585
2585
  end: "end";
2586
2586
  between: "between";
2587
2587
  }>;
@@ -2734,8 +2734,8 @@ declare const stackNodeFields: {
2734
2734
  muted: "muted";
2735
2735
  }>, z.ZodString]>>;
2736
2736
  align: z.ZodOptional<z.ZodEnum<{
2737
- start: "start";
2738
2737
  center: "center";
2738
+ start: "start";
2739
2739
  end: "end";
2740
2740
  }>>;
2741
2741
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -2880,8 +2880,8 @@ declare const stackNodeFields: {
2880
2880
  muted: "muted";
2881
2881
  }>, z.ZodString]>>;
2882
2882
  align: z.ZodOptional<z.ZodEnum<{
2883
- start: "start";
2884
2883
  center: "center";
2884
+ start: "start";
2885
2885
  end: "end";
2886
2886
  }>>;
2887
2887
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -3031,8 +3031,8 @@ declare const stackNodeFields: {
3031
3031
  muted: "muted";
3032
3032
  }>, z.ZodString]>>;
3033
3033
  align: z.ZodOptional<z.ZodEnum<{
3034
- start: "start";
3035
3034
  center: "center";
3035
+ start: "start";
3036
3036
  end: "end";
3037
3037
  }>>;
3038
3038
  italic: z.ZodOptional<z.ZodBoolean>;
@@ -3118,6 +3118,11 @@ declare const screenDocumentShape: z.ZodObject<{
3118
3118
  blur: "blur";
3119
3119
  }>>;
3120
3120
  type: z.ZodLiteral<"modal">;
3121
+ position: z.ZodOptional<z.ZodEnum<{
3122
+ center: "center";
3123
+ top: "top";
3124
+ bottom: "bottom";
3125
+ }>>;
3121
3126
  size: z.ZodEnum<{
3122
3127
  sm: "sm";
3123
3128
  md: "md";
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-DDLSQSWO.js";import"./chunk-AOGDCT4T.js";import"./chunk-WZMZMJCK.js";import"./chunk-T2KWLYCW.js";import"./chunk-LOLMUXHW.js";import"./chunk-HEHLFHW7.js";import"./chunk-U7NX5ET2.js";import"./chunk-VLSP3LRH.js";import"./chunk-CR2XJ2CX.js";import"./chunk-O4KXODTJ.js";import"./chunk-CILM5XMH.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};