@tinkerlandai/longplay-sdk 0.10.46 → 0.10.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +7 -2
- package/README.zh-CN.md +1 -1
- package/dist/check-response-MCT5RGOM.js +1 -0
- package/dist/{chunk-XQN7MLP5.js → chunk-2I2S5ZIH.js} +1 -1
- package/dist/{chunk-W55G3VGB.js → chunk-2LEDTNKQ.js} +1 -1
- package/dist/chunk-2LKDEPKP.js +1 -0
- package/dist/{chunk-HIUSHWDK.js → chunk-2UXX62Y4.js} +1 -1
- package/dist/{chunk-R2OJIXYE.js → chunk-3ITNAFAH.js} +1 -1
- package/dist/{chunk-ZNTV6TU7.js → chunk-5RGKWO6R.js} +1 -1
- package/dist/{chunk-XWD4N2QI.js → chunk-A5KU4MMN.js} +2 -17
- package/dist/chunk-A5KU4MMN.js.LEGAL.txt +17 -0
- package/dist/chunk-CB2VWRNI.js +1 -0
- package/dist/{chunk-ANTKNFC6.js → chunk-DCLEIAC6.js} +1 -1
- package/dist/chunk-DEJKZZTA.js +318 -0
- package/dist/chunk-EGFVGCDG.js +1 -0
- package/dist/chunk-EKN4CJLC.js +1 -0
- package/dist/{chunk-MMJBC6PW.js → chunk-F3WLQZXI.js} +1 -1
- package/dist/{chunk-AKBF7TGD.js → chunk-FGQ376NB.js} +1 -1
- package/dist/{chunk-UIKMEVXM.js → chunk-FRRKTQNZ.js} +1 -1
- package/dist/{chunk-XB24ATBA.js → chunk-FYD7CMS7.js} +1 -1
- package/dist/{chunk-7MTQQIGR.js → chunk-HP6OV6WF.js} +1 -1
- package/dist/{chunk-UBUFXGS7.js → chunk-HYCLLEFU.js} +1 -1
- package/dist/{chunk-ZQAAZ7Q4.js → chunk-HYX3EDZS.js} +1 -1
- package/dist/{chunk-JZ73DRHT.js → chunk-IDDPWGQE.js} +1 -1
- package/dist/{chunk-AAILPAL5.js → chunk-ILNOJRRY.js} +1 -1
- package/dist/{chunk-SWULFBRF.js → chunk-IVXYLNAF.js} +1 -1
- package/dist/chunk-JDIFYMSA.js +1 -0
- package/dist/{chunk-DTOYPMAW.js → chunk-KCN6OGYG.js} +1 -1
- package/dist/{chunk-MBWUIYCH.js → chunk-KSME3N3A.js} +1 -1
- package/dist/{chunk-N3C57R2I.js → chunk-L7C5TKKV.js} +1 -1
- package/dist/chunk-LE32WTZ7.js +1 -0
- package/dist/{chunk-CRCAYVV5.js → chunk-LSHIR6QM.js} +1 -1
- package/dist/{chunk-GFSAWDV2.js → chunk-MQ5LJEWV.js} +1 -1
- package/dist/{chunk-HMPIUYZ2.js → chunk-N3PZMMOO.js} +1 -1
- package/dist/chunk-NCKOKX7G.js +1 -0
- package/dist/{chunk-ASCVMPXG.js → chunk-NL26SIDD.js} +1 -1
- package/dist/chunk-OPUIFAQS.js +1 -0
- package/dist/{chunk-KAMYLHAT.js → chunk-PF6PRPRO.js} +1 -1
- package/dist/{chunk-UHT5DGAJ.js → chunk-PJAZ2UP4.js} +1 -1
- package/dist/{chunk-YHC5WAVP.js → chunk-RCSDBE5K.js} +1 -1
- package/dist/{chunk-A37ZU2AP.js → chunk-RFWVXTZ7.js} +1 -1
- package/dist/{chunk-X2ON6QRA.js → chunk-SZZIYCXK.js} +1 -1
- package/dist/{chunk-CI7UPAWD.js → chunk-TIOPNTMP.js} +1 -1
- package/dist/chunk-TLY2TLJB.js +1 -0
- package/dist/{chunk-4LIM2ZQR.js → chunk-TNPBYYAX.js} +1 -1
- package/dist/{chunk-EIVFBGI5.js → chunk-VBWVE3FU.js} +1 -1
- package/dist/{chunk-L42A5KVA.js → chunk-VKFLQEW4.js} +1 -1
- package/dist/{chunk-POOXIM6Q.js → chunk-W3B4GT74.js} +1 -1
- package/dist/{chunk-6RGARS6I.js → chunk-XVCSRZX4.js} +1 -1
- package/dist/{chunk-PPOPJTHA.js → chunk-Y2ASROJH.js} +1 -1
- package/dist/chunk-YFLVGOCJ.js +1 -0
- package/dist/chunk-YQRUQD5R.js +2 -0
- package/dist/chunk-YQRUQD5R.js.LEGAL.txt +4 -0
- package/dist/{chunk-MFAEHTOH.js → chunk-ZDIWOE4Q.js} +1 -1
- package/dist/content-7CR4XSVY.js +1 -0
- package/dist/funnel-host-purchase-QSRHTOIK.js +1 -0
- package/dist/funnel-paywall-prerender-6CG72RL5.js +1 -0
- package/dist/funnel-route-prediction-XNIKDJIM.js +1 -0
- package/dist/funnel-route-source-EUIA4M3Y.js +1 -0
- package/dist/funnel-runtime-host-YLIG45EU.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/dist/merchant-bridge-contracts-7EHDNPJJ.js +1 -0
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.js +1 -1
- package/dist/operation-contracts-C6CMAO6S.js +1 -0
- package/dist/page.js +1 -1
- package/dist/paywall-C5TM2TXD.js +1 -0
- package/dist/paywall-content-DYDVZNOK.js +1 -0
- package/dist/paywall-session-QMYOF2PZ.js +1 -0
- package/dist/popup.js +1 -1
- package/dist/react-native.js +1 -1
- package/dist/screen-renderer-HOIWGE5V.js +1 -0
- package/dist/server.js +1 -1
- package/dist/{visual-dom-KUABNJV6.js → visual-dom-IN6DRNX3.js} +1 -1
- package/dist/visual.js +1 -1
- package/native-funnel-host.NOTICES.txt +22 -0
- package/package.json +3 -2
- package/dist/check-response-5ZLFYMPK.js +0 -1
- package/dist/chunk-6RNLPMMJ.js +0 -1
- package/dist/chunk-D3WC3T4U.js +0 -1
- package/dist/chunk-EQKTKITL.js +0 -1
- package/dist/chunk-GJLCTQJN.js +0 -1
- package/dist/chunk-JDUB4T4P.js +0 -1
- package/dist/chunk-L7OMFH4O.js +0 -1
- package/dist/chunk-N3TAZ7HB.js +0 -1
- package/dist/chunk-PE5Y524X.js +0 -1
- package/dist/chunk-SIJY35EE.js +0 -4
- package/dist/chunk-TWQB35B7.js +0 -318
- package/dist/chunk-WQN2D5FZ.js +0 -1
- package/dist/chunk-YPN2ZL2V.js +0 -1
- package/dist/content-4Y57QHWP.js +0 -1
- package/dist/funnel-host-purchase-UWTK3C7Q.js +0 -1
- package/dist/funnel-paywall-prerender-MQWJONN5.js +0 -1
- package/dist/funnel-route-prediction-O7XGFYHS.js +0 -1
- package/dist/funnel-route-source-MYKZJIXG.js +0 -1
- package/dist/funnel-runtime-host-66OPNY4C.js +0 -1
- package/dist/merchant-bridge-contracts-Z5PJ2P6H.js +0 -1
- package/dist/operation-contracts-OSBKHIVO.js +0 -1
- package/dist/paywall-QMYTDELU.js +0 -1
- package/dist/paywall-content-LLRPWEZD.js +0 -1
- package/dist/paywall-session-P6NIFMKG.js +0 -1
- package/dist/screen-renderer-AQXCFML3.js +0 -1
- /package/dist/{chunk-KV5MZ4NI.js → chunk-RA7GZ67U.js} +0 -0
- /package/dist/{chunk-FRK6322O.js → chunk-WPFTSHP2.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.48
|
|
4
|
+
|
|
5
|
+
- Classify quote failures consistently for both in-button and footer progress. First attempts and retries share the quote error message and Funnel quote-error callback, while in-button failures do not scroll the Paywall.
|
|
6
|
+
- Preserve purchase-button confirmation by default, original-operation retries and 409 recovery. Wire protocol remains `0.10`.
|
|
7
|
+
|
|
8
|
+
## 0.10.47
|
|
9
|
+
|
|
10
|
+
- Confirm a purchase from the published Paywall button by default, without an additional SDK confirmation panel. Apply the same behavior to subscription changes, trials and prerendered Funnel Paywalls. Merchants can explicitly select `purchaseConfirmation: "paywall"` for a quote review.
|
|
11
|
+
- Opening or refreshing an unconfirmed restored quote never confirms it automatically. A click on the original plan resumes the same operation; retries never create a second quote.
|
|
12
|
+
|
|
13
|
+
- Show a restored confirmation after the current action releases its controls, and avoid creating confirmation UI after teardown.
|
|
14
|
+
- Reduce bundles by sharing equivalent checkout validators and retaining dependency notices alongside the generated code. Preserve all validation bounds and HTTPS requirements.
|
|
15
|
+
- Keep the compact loading shell and existing purchase recovery behavior. Wire protocol remains `0.10`.
|
|
16
|
+
|
|
3
17
|
## 0.10.46
|
|
4
18
|
|
|
5
19
|
- Stop polling an original Funnel Run after `409 / STATE_CHANGED / recover_operation`; recover the original Run and purchase without starting another attempt.
|
package/README.md
CHANGED
|
@@ -283,8 +283,13 @@ capabilities. Untouched controls start at those values rather than an authored z
|
|
|
283
283
|
changes and original quoted selections survive refreshes. Missing native source quantities
|
|
284
284
|
remain unavailable instead of being inferred from the displayed price. They retain the selected Coupon and use
|
|
285
285
|
`previewUpdate`, `update` and `readSubscriptionUpdate`, not `previewAttach`. The Paywall
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
uses the published Paywall purchase button as confirmation by default, including upgrades and
|
|
287
|
+
trials, without an additional SDK confirmation panel. Display purchase and renewal terms in the
|
|
288
|
+
published Paywall or provider checkout. Set `purchaseConfirmation: "paywall"` explicitly when
|
|
289
|
+
an SDK quote review is wanted; it displays the merchant's frozen credit, charge, amount due,
|
|
290
|
+
renewal terms and required consents. The option is shared by standalone, Funnel and prerendered
|
|
291
|
+
Paywalls. Opening or refreshing a restored quote never confirms it: only a click on its original
|
|
292
|
+
plan continues that same operation.
|
|
288
293
|
The accepted change stays in the same Funnel Run, receipt and operation through cancellation,
|
|
289
294
|
lost responses and reopening. Public `PaywallQuote` and `PaywallOperation` are attach/update
|
|
290
295
|
unions; use `isPaywallUpdateQuote` / `isPaywallUpdateOperation` to distinguish them.
|
package/README.zh-CN.md
CHANGED
|
@@ -214,7 +214,7 @@ SDK 在首次派发前保存原 Start 请求 ID 和完整输入;同一未决
|
|
|
214
214
|
|
|
215
215
|
已订阅用户的 Web 套餐变更通过 `showPaywall`、`showFunnelRun` 或 `showFunnelPurchase` 的 `resolveSubscriptionChange` 选择原 membership。回调收到同样的 action、Product Version 和 `featureQuantities`,返回 `{ membershipId, timing: "immediate" | "renewal" }`。membership 必须来自当前已认证 Customer 的真实订阅;只有明确新订阅的场景才返回 `undefined`,订阅缺失或有歧义时应拒绝。完整示例见[英文说明](README.md#managed-funnel-purchase-recovery)。
|
|
216
216
|
|
|
217
|
-
可在 parameters.commerce.intent(独立 Paywall 则为 commerce.intent)传入 subscription_change,使 Offering 按 Customer 唯一已持有 membership 判断升级可用性;省略时保留新购语义。显式变更意图缺少 membership 会被拒绝,不回退新购。该路径保留选中 Coupon,使用 `previewUpdate/update/readSubscriptionUpdate`,不创建新的 attachment;预付 featureQuantities 在命令、报价、operation 和恢复选项中保持不变(最多 100 个 Feature UUID,每项整数 0–10000);服务端仍拒绝不支持的执行方式/时机,Web 变更不能混用原生商店 offer
|
|
217
|
+
可在 parameters.commerce.intent(独立 Paywall 则为 commerce.intent)传入 subscription_change,使 Offering 按 Customer 唯一已持有 membership 判断升级可用性;省略时保留新购语义。显式变更意图缺少 membership 会被拒绝,不回退新购。该路径保留选中 Coupon,使用 `previewUpdate/update/readSubscriptionUpdate`,不创建新的 attachment;预付 featureQuantities 在命令、报价、operation 和恢复选项中保持不变(最多 100 个 Feature UUID,每项整数 0–10000);服务端仍拒绝不支持的执行方式/时机,Web 变更不能混用原生商店 offer。升级首屏数量使用服务端核实的原订阅档位初始化;之后保留用户调整和原报价,原订数量缺失则不可用,不根据显示价格猜测。默认以已发布 Paywall 的购买按钮作为确认,新购、升级和试用都不再追加 SDK 二次确认区;购买和续费条款应显示在 Paywall 或支付方收银台。确需 SDK 报价审阅时显式设置 `purchaseConfirmation: "paywall"`,展示商户固定的抵扣、实付、续费和 consent;此选项适用于独立、Funnel 和预渲染 Paywall。重开或刷新原报价不会自动确认,只有用户点击原套餐才继续同一个 operation。取消、丢响应和重开保留同一 Run、receipt 和 operation。公开 `PaywallQuote/PaywallOperation` 为 attach/update 联合类型,可用 `isPaywallUpdateQuote/isPaywallUpdateOperation` 区分;update 保留真实 `effective/scheduled` 状态,并等待商户权益处理和交易记录确认。未完成的变更付款跳转只恢复原来经核对的 URL。
|
|
218
218
|
|
|
219
219
|
购买按钮可以绑定 Paywall 上展示的 Coupon。传入 `claimCoupon` 后,SDK 在点击时为 Customer 领取该 Coupon,并用领到的 offer 报价。这类按钮不再调用 `resolveOfferId`;报价没有应用该 Coupon 时不会进入确认。
|
|
220
220
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-RFWVXTZ7.js";import"./chunk-TNPBYYAX.js";import"./chunk-KCN6OGYG.js";import"./chunk-ZDIWOE4Q.js";import"./chunk-FYD7CMS7.js";import"./chunk-XVCSRZX4.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";export{a as validateEntitlementCheck,b as validateResourceCheck};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-ZDIWOE4Q.js";function o(r,e){try{return r.parse(e)}catch{throw new n("INVALID_RESPONSE","Invalid gateway response")}}export{o as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h}from"./chunk-
|
|
1
|
+
import{a as h}from"./chunk-SZZIYCXK.js";import{a as b,c as w,l as x,m as O}from"./chunk-IDDPWGQE.js";import{a as I}from"./chunk-VILB5M4X.js";import{b as y,f as g,g as v}from"./chunk-PF6PRPRO.js";import{b as t}from"./chunk-XVCSRZX4.js";var d=O,R=t.string().regex(/^[a-zA-Z0-9_.-]{1,128}$/),j=t.tuple([t.number().min(0).max(1),t.number().min(0).max(1)]).refine(([e,r])=>e<=r),F=t.strictObject({seed:t.string().min(1).max(255),variations:t.array(R).min(2).max(20),weights:t.array(t.number().min(0).max(1)).max(20).optional(),coverage:t.number().min(0).max(1).optional(),ranges:t.array(j).max(20).optional(),filters:t.array(t.strictObject({seed:t.string().min(1).max(255),ranges:t.array(j).max(100)})).max(100).optional(),passthrough:t.array(t.number().int().min(0).max(19)).max(20).optional(),condition:g.optional(),active:t.literal(!1).optional(),force:t.number().int().min(-1).max(19).optional()}),_=t.discriminatedUnion("type",[t.strictObject({type:t.literal("pass"),next:d}),t.strictObject({type:t.literal("condition"),cases:t.array(t.strictObject({condition:g,target:d})).min(1).max(50),default:d}),t.strictObject({type:t.literal("split"),experimentId:t.uuid(),bucketing:F,routes:t.record(R,d).refine(e=>Object.keys(e).length>=2&&Object.keys(e).length<=20),notParticipating:d}),t.strictObject({type:t.literal("paywall"),paywallId:t.uuid(),paywallVersionId:t.uuid(),presentation:y}),t.strictObject({type:t.literal("screen"),surface:t.enum(["page","popup","onboarding"]),presentation:y}),t.strictObject({type:t.literal("external_page")}),t.strictObject({type:t.literal("end"),outcome:t.enum(["completed","closed","ineligible","failed"])}),t.strictObject({type:t.literal("server"),reason:t.enum(["action","wait","feature","condition","experiment","resource"])})]),P={nodes:500,maxBytes:262144},S=t.strictObject({kind:t.literal("funnel_route"),formatVersion:t.literal(1),funnelId:t.uuid(),versionId:t.uuid(),entry:d,maxTransitions:t.number().int().min(1).max(1e4),variables:t.record(b,w),nodes:t.record(d,_)}).superRefine((e,r)=>{let s=a=>r.addIssue({code:"custom",message:a});Object.keys(e.nodes).length>P.nodes&&s("Too many route nodes"),Object.hasOwn(e.nodes,e.entry)||s("Route entry is missing");for(let a of Object.values(e.variables))["parameter","input"].includes(a.source.type)||s("Only start parameters and inputs can be public");for(let a of Object.values(e.nodes)){for(let c of V(a))Object.hasOwn(e.nodes,c)||s("Route target is missing");a.type==="split"&&a.bucketing.variations.some(c=>!Object.hasOwn(a.routes,c))&&s("Every Variation needs a route")}});function V(e){switch(e.type){case"pass":return[e.next];case"condition":return[...e.cases.map(r=>r.target),e.default];case"split":return[...Object.values(e.routes),e.notParticipating];default:return[]}}function E(e,r,s=[]){if(e==="id")return!0;if(!e.startsWith("variables."))return!1;let a=e.slice(10),c=i=>a===i||a.startsWith(`${i}.`)||i.startsWith(`${a}.`);return r.some(i=>a===i||a.startsWith(`${i}.`))&&!s.some(c)}function m(e,r,s=[]){return v(e).length===0&&I(e).every(a=>E(a,r,s))}function W(e){let{document:r}=e,s={},a=[];for(let[n,o]of Object.entries(r.variables))["parameter","input"].includes(o.source.type)?s[n]=o:a.push(n);let c=Object.keys(s),i=new Map(r.graph.nodes.map(n=>[n.id,n])),l={},u=[r.graph.entry],f=n=>{switch(n.type){case"entry":case"offering":case"coupon":case"coupons":return{type:"pass",next:n.next};case"condition":return n.cases.every(o=>m(o.condition,c,a))?{type:"condition",cases:n.cases.map(o=>({condition:o.condition,target:o.target})),default:n.default}:{type:"server",reason:"condition"};case"split":{let o=N(Object.hasOwn(e.experiments,n.experimentId)?e.experiments[n.experimentId]:void 0,n.routes,c,a);return o?{type:"split",experimentId:n.experimentId,bucketing:o,routes:{...n.routes},notParticipating:n.notParticipating}:{type:"server",reason:"experiment"}}case"screen":{let o=r.screens.find(p=>p.id===n.screenId);if(o?.type==="paywall"){let p=e.paywallOf(o.paywallVersionId);return p?{type:"paywall",paywallId:p,paywallVersionId:o.paywallVersionId,presentation:n.presentation}:{type:"server",reason:"resource"}}return o?.type==="owned"?{type:"screen",surface:o.document.surface,presentation:n.presentation}:{type:"server",reason:"resource"}}case"external_page":return{type:"external_page"};case"end":return{type:"end",outcome:n.outcome};case"output":return{type:"end",outcome:"completed"};case"feature":return{type:"server",reason:"feature"};case"action":return{type:"server",reason:"action"};case"wait":return{type:"server",reason:"wait"}}};for(;u.length;){let n=u.shift();if(Object.hasOwn(l,n))continue;let o=i.get(n);if(!o)throw new Error("Funnel route target is missing");let p=f(o);l[n]=p,u.push(...V(p))}return S.parse({kind:"funnel_route",formatVersion:1,funnelId:e.funnelId,versionId:e.versionId,entry:r.graph.entry,maxTransitions:r.execution.maxTransitions,variables:s,nodes:l})}function N(e,r,s,a){if(!e||(e.hashAttribute??"id")!=="id"||e.fallbackAttribute||e.parentConditions?.length||e.urlPatterns?.length||(e.hashVersion??2)!==2||(e.filters??[]).some(i=>(i.attribute??"id")!=="id")||e.condition&&!m(e.condition,s,a)||e.variations.some(i=>typeof i!="string"||!Object.hasOwn(r,i)))return;let c=(e.meta??[]).flatMap((i,l)=>i.passthrough?[l]:[]);return F.parse({seed:e.seed??e.key,variations:e.variations,...e.weights?{weights:e.weights}:{},...e.coverage!==void 0?{coverage:e.coverage}:{},...e.ranges?{ranges:e.ranges}:{},...e.filters?.length?{filters:e.filters.map(i=>({seed:i.seed,ranges:i.ranges}))}:{},...c.length?{passthrough:c}:{},...e.condition?{condition:e.condition}:{},...e.active===!1?{active:!1}:{},...e.force!==void 0?{force:e.force}:{}})}function G(e,r){return{key:e,seed:r.seed,hashAttribute:"id",hashVersion:2,variations:r.variations,...r.weights?{weights:r.weights}:{},...r.coverage!==void 0?{coverage:r.coverage}:{},...r.ranges?{ranges:r.ranges}:{},...r.filters?{filters:r.filters.map(s=>({attribute:"id",seed:s.seed,hashVersion:2,ranges:s.ranges}))}:{},...r.passthrough?{meta:r.variations.map((s,a)=>({passthrough:r.passthrough.includes(a)}))}:{},...r.condition?{condition:r.condition}:{},...r.active===!1?{active:!1}:{},...r.force!==void 0?{force:r.force}:{}}}function $(e,r){let s=[],a={versionId:e.versionId,path:s},c=f=>({...a,type:"unknown",reason:f}),i;try{i=x({declarations:e.variables,answers:{},parameters:r.parameters,attributes:{id:r.customerId},savedGroups:{},results:{}})}catch{return c("invalid_parameters")}let l=Object.keys(e.variables),u=e.entry;for(let f=0;;f++){let n=e.nodes[u];switch(s.push(u),n.type){case"paywall":return{...a,type:"paywall",paywallId:n.paywallId,paywallVersionId:n.paywallVersionId,presentation:n.presentation};case"screen":return{...a,type:"screen",surface:n.surface,presentation:n.presentation};case"external_page":return{...a,type:"external_page"};case"end":return{...a,type:"end",outcome:n.outcome};case"server":return c("server_step")}if(f>=e.maxTransitions)return c("transition_limit");if(n.type==="pass"){u=n.next;continue}if(n.type==="condition"){if(!n.cases.every(o=>m(o.condition,l)))return c("server_attribute");u=h({id:u,name:u,type:"condition",cases:n.cases,default:n.default},{attributes:i,savedGroups:{}},{}).target;continue}if(n.bucketing.condition&&!m(n.bucketing.condition,l))return c("server_attribute");u=h({id:u,name:u,type:"split",experimentId:n.experimentId,routes:n.routes,notParticipating:n.notParticipating},{attributes:i,savedGroups:{}},{[n.experimentId]:G(n.experimentId,n.bucketing)}).target}}export{P as a,S as b,W as c,$ as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as Kn}from"./chunk-CB2VWRNI.js";import{a as Jn,b as jn,c as mn,d as wn,e as $e,f as Bn,h as Wn,i as Yn,j as Xn,k as Zn}from"./chunk-L7C5TKKV.js";import{b as Sn,c as et}from"./chunk-F3WLQZXI.js";import{a as Mn}from"./chunk-W32FI2A2.js";import{c as $n,e as xn,f as Gn,h as Qn,i as _e,j as tn,k as zn,l as rn}from"./chunk-2UXX62Y4.js";import{b as Fn}from"./chunk-W3B4GT74.js";import{K as nn}from"./chunk-LE32WTZ7.js";import{a as Me,d as Nn}from"./chunk-LSHIR6QM.js";import{c as On,e as _n,f as Ln,g as Hn,h as Vn,i as Un}from"./chunk-OPUIFAQS.js";import{b as kn}from"./chunk-HYX3EDZS.js";import{B as fn}from"./chunk-EGFVGCDG.js";import{x as Dn}from"./chunk-YFLVGOCJ.js";import{t as An}from"./chunk-MQ5LJEWV.js";import{C as Tn}from"./chunk-JDIFYMSA.js";import{a as m}from"./chunk-ZDIWOE4Q.js";import{a as Ee}from"./chunk-DSPLGTQI.js";async function yn(t){let{session:b,load:P}=ut(t);try{return await P(),b}catch(n){throw b.destroy(),n}}function ut(t){let b=t.view;if(!b?.paywall)throw new m("INVALID_REQUEST","The current node is not a Paywall");let P=b.paywall.receiptId,n=b.nodeId,g=b.visit,A=b.paywall.resolution,o=b.paywall,O="document"in A?{document:A.document,offering:A.offering,capabilities:A.capabilities}:null;function u(){let i=o.resolution;return"document"in i?i:O&&{...i,document:O.document,offering:O.offering,capabilities:On(i.capabilities,O.capabilities)}}function C(i){if(!_n(i,A))throw new m("INVALID_RESPONSE","The pinned Paywall binding changed")}let R=!1,x=new Set,ie=null;function w(){let i=u();if(i&&!R)for(let a of x)Ee(a,structuredClone(i))}async function _(){I();let i=u();if(i)return structuredClone(i);if(!ie){let a=(async()=>{if("document"in o.resolution||!t.resolvePaywall)throw new m("INVALID_RESPONSE","Public Paywall reader is unavailable");let q=await Sn(t,o.resolution);return I(),C(q),O={document:q.document,offering:q.offering,capabilities:q.capabilities},w(),u()})();ie=a;let s=()=>{ie===a&&(ie=null)};a.then(s,s)}return ie.then(a=>structuredClone(a))}let l=new AbortController,E=(t.pendingCommands??(t.pendingCommand?[t.pendingCommand]:[])).find(i=>i.operation==="submit"&&i.nodeId===n&&i.visit===g&&i.input.type==="paywall_quote")?.requestId??b.paywall.purchaseRequestId,S=0,re=null,U=new Set,M=null,z=new Map;function Q(i){if(i.purchase&&i.purchase.receiptId!==P)throw new m("INVALID_RESPONSE","Purchase receipt changed");let a=i.run.paywall;return i.purchase??(a?.receiptId===P?a:null)}function I(){if(R)throw new m("IDENTITY_CHANGED","Paywall presentation has closed")}function Z(i,a,s){if(I(),a!==S||s!==void 0&&o.quote?.operationId!==s)return!1;let q=o.selectionGeneration??0,f=i.run.paywall;if(f?.receiptId===P){if((f.selectionGeneration??0)<(o.selectionGeneration??0))return!1;C(f.resolution)}let p=Q(i),F=f?.receiptId===P&&(f.selectionGeneration??0)>q,y=F?p?.quote??null:p?.quote??o.quote,Y=p?.operation??(y?.operationId===o.quote?.operationId?o.operation:null);return o.quote&&y&&Vn(o.quote,y),y&&Y&&Ln(Y,{operationId:y.operationId,membershipId:fn(y)?y.membershipId:null,...fn(y)?{featureQuantities:y.featureQuantities??{}}:{}},"Purchase operation changed"),(F||y?.operationId!==o.quote?.operationId)&&(S++,f?.receiptId===P&&(E=f.purchaseRequestId)),f?.canReselect===!0&&f.purchaseRequestId===M&&!(t.pendingCommands??[t.pendingCommand]).some(X=>X?.requestId===M)&&(M=null),o={...o,...f?.receiptId===P?f:{},...s!==void 0&&!F&&p?.canReselect!==void 0?{canReselect:p.canReselect}:{},quote:y,operation:Un(o.operation,Y,!0)},w(),!0}function N(i,a,s){return new Promise((q,f)=>{let p=!1,F=()=>{clearTimeout(j),l.signal.removeEventListener("abort",X)},y=ge=>{p||(p=!0,F(),q(ge))},Y=ge=>{p||(p=!0,F(),f(ge))},X=()=>Y(new m("IDENTITY_CHANGED","Paywall presentation has closed")),j=setTimeout(()=>Y(new m("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,s)),Math.max(0,a-Date.now()));l.signal.addEventListener("abort",X,{once:!0}),l.signal.aborted&&X(),i.then(y,Y)})}function qe(i){return new Promise(a=>{let s=()=>{clearTimeout(q),l.signal.removeEventListener("abort",s),a()},q=setTimeout(s,i);l.signal.addEventListener("abort",s,{once:!0}),l.signal.aborted&&s()})}function he(i,a){I();let s=z.get(i)??t.pendingCommands?.find(p=>p.requestId===i)??t.pendingCommand;if(s?.operation==="submit"&&s.requestId===i&&s.nodeId===n&&s.visit===g){a.type==="paywall_quote"&&s.input.type==="paywall_quote"&&s.input.predecessor&&!a.predecessor&&(a={...a,predecessor:s.input.predecessor});let p=nn.parse(s),F=nn.parse({...s,input:a});if(p.operation!=="submit"||F.operation!=="submit"||JSON.stringify(p.input)!==JSON.stringify(F.input))throw new m("CONFLICT","A purchase request cannot change its input");return z.set(i,p),p}let q=t.view;if(!q||q.nodeId!==n||q.visit!==g||q.paywall?.receiptId!==P)throw new m("PRECONDITION_FAILED","The Paywall visit has changed");let f=nn.parse({operation:"submit",requestId:i,nodeId:n,visit:g,revision:q.revision,input:structuredClone(a)});if(f.operation!=="submit")throw new m("INVALID_REQUEST","A purchase submission is required");return z.set(i,f),f}async function we(i,a){I();let{requestId:s,input:q}=i,f=Date.now()+3e4;U.add(s);try{let p=await N(t.submit(i),f,s);for(;p.run.pendingRequest?.requestId===s&&Date.now()<f&&!R&&(await qe(Math.min(1e3,f-Date.now())),!(R||Date.now()>=f));)p=await N(t.resume(s),f,s);if(R)throw new m("IDENTITY_CHANGED","Paywall presentation has closed");if(p.run.pendingRequest?.requestId===s)throw new m("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,s);if(!Z(p,a,q.type==="paywall_confirm"||q.type==="paywall_cancel"?q.operationId:void 0))throw new m("PRECONDITION_FAILED","The purchase selection has changed");M===s&&(M=null)}catch(p){if(M=s,q.type==="paywall_quote"&&t.settle&&!R&&p instanceof m&&p.status!==void 0&&![401,425].includes(p.status)&&!p.retryable&&p.recovery!=="recover_operation")try{if((await N(t.settle(s),f,s)).settlement?.state==="settled"){let y=await N(t.get(),f,s);Z(y,a)&&y.run.paywall?.purchaseRequestId===s&&o.canReselect===!0&&z.delete(s)}}catch{}throw p instanceof m&&p.code==="COMMAND_PENDING"&&p.status===void 0&&z.delete(s),p}finally{U.delete(s)}}async function W(i){if(!o.quote)throw new m("INVALID_REQUEST","A quoted purchase is required");let a=i==="confirm"?"paywall_confirm":"paywall_cancel",s=[...z.values(),...t.pendingCommands??(t.pendingCommand?[t.pendingCommand]:[])].find(f=>f.operation==="submit"&&f.input.type===a&&"operationId"in f.input&&f.input.operationId===o.quote.operationId),q=s?.operation==="submit"&&s.input.type===a&&"operationId"in s.input&&s.input.operationId===o.quote.operationId?s.requestId:crypto.randomUUID();if(await we(he(q,{type:i==="confirm"?"paywall_confirm":"paywall_cancel",operationId:o.quote.operationId,...i==="confirm"&&o.quote.merchantTerms?{merchantConfirmation:Dn(o.quote.merchantTerms)}:{}}),S),!o.operation)throw new m("INVALID_RESPONSE","The accepted purchase result is missing");return structuredClone(o.operation)}let le={get view(){return structuredClone(u())},get quote(){return o.quote?structuredClone(o.quote):null},get operation(){return o.operation?structuredClone(o.operation):null},get webViewUrl(){return t.webViewUrl},get locale(){return t.view?.locale??b.locale},get canReselect(){return o.canReselect===!0&&M===null},get recovery(){let i=t.pendingCommands??(t.pendingCommand?[t.pendingCommand]:[]),a=t.pendingPurchase;if(a&&(a.receiptId!==P||a.operationId!==o.quote?.operationId))return{type:"recover",operationId:a.operationId,requestId:i[0]?.requestId??null};let s=Me({quote:o.quote,operation:o.operation,requestId:i[0]?.requestId??M??E,pending:U.size>0||i.length>0||M!==null,destroyed:R,canReselect:o.canReselect});return s.type==="recover"&&s.requestId===null&&!R&&t.hasDurableJournal===!0&&!o.quote&&!o.operation&&(o.selectionGeneration??0)===0&&!a&&!i.length&&!U.size&&!E?{type:"native",operationId:null}:s},get pendingCancellation(){return!R&&(t.pendingCommands??(t.pendingCommand?[t.pendingCommand]:[])).some(i=>i.operation==="submit"&&i.nodeId===n&&i.visit===g&&i.input.type==="paywall_cancel"&&i.input.operationId===o.quote?.operationId)},subscribe(i){return R?()=>{}:(x.add(i),()=>x.delete(i))},async refresh(){I();let i=S,a=await t.get();if(Z(a,i),a.run.paywall?.receiptId!==P)throw new m("PRECONDITION_FAILED","Paywall presentation has changed");return _()},preview(i){let a=u();if(!a)return Promise.reject(new m("PRECONDITION_FAILED","Load the Paywall presentation first"));if(E&&E!==i.requestId&&(re||o.canReselect!==!0))return Promise.reject(new m("COMMAND_PENDING","Retry the original purchase before starting another"));let s=a.document.buttons[i.actionId],q=s?.type==="checkout"?kn(s.product,i.selection,a.capabilities):null;if(!q)return Promise.reject(new m("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));let f=An(a.document.screen,q,i.selection,a.capabilities),p=E!==i.requestId&&(o.selectionGeneration??0)>0?{operationId:o.quote?.operationId??null,generation:o.selectionGeneration??0}:void 0,F=t.view?.parameters.commerce;if(F&&typeof F=="object"&&!Array.isArray(F)&&F.intent==="subscription_change"&&!i.subscriptionChange)return Promise.reject(new m("INVALID_REQUEST","Choose the existing membership for this subscription change"));if(i.subscriptionChange&&i.nativeOffer)return Promise.reject(new m("INVALID_REQUEST","A web membership change cannot include a store offer"));if(p&&o.canReselect!==!0)return Promise.reject(new m("COMMAND_PENDING","Original purchase requires authoritative termination"));let y;try{y=he(i.requestId,{type:"paywall_quote",actionId:i.actionId,productVersionId:q,...Object.keys(f).length?{featureQuantities:f}:{},...p?{predecessor:p}:{},...i.offerId?{offerId:i.offerId}:{},...i.nativeOffer?{nativeOffer:i.nativeOffer}:{},...i.subscriptionChange?{subscriptionChange:i.subscriptionChange}:{}})}catch(j){return Promise.reject(j)}if(E===i.requestId&&re)return re;E!==i.requestId&&S++;let Y=S;E=i.requestId;let X=(async()=>{if(await we(y,Y),!o.quote)throw new m("INVALID_RESPONSE","The accepted quote is missing");return Hn(o.quote,{productVersionId:q,featureQuantities:f,subscriptionChange:i.subscriptionChange},"The selected purchase changed"),structuredClone(o.quote)})();return re=X,X.then(()=>{re===X&&(re=null)},j=>{re===X&&(re=null),E===i.requestId&&t.pendingCommand?.requestId!==i.requestId&&j instanceof m&&j.status!==void 0&&j.status<500&&![401,425].includes(j.status)&&(E=null)}),X},confirm:()=>W("confirm"),cancel:()=>W("cancel"),async read(){if(I(),!o.quote)throw new m("INVALID_REQUEST","A quoted purchase is required");let i=o.quote.operationId,a=S,s=t.pendingCommands?.find(y=>y.operation==="submit"&&(y.input.type==="paywall_confirm"||y.input.type==="paywall_cancel")&&y.input.operationId===i)??t.pendingCommand;s?.operation==="submit"&&(s.input.type==="paywall_confirm"||s.input.type==="paywall_cancel")&&s.input.operationId===i&&await t.settle?.(s.requestId);let q=await t.get(void 0,{receiptId:P,operationId:i});I();let f=Q(q);if(f?.quote&&f.quote.operationId!==i||f?.operation&&f.operation.operationId!==i)throw new m("INVALID_RESPONSE","Purchase operation changed");let p=Z(q,a,i),F=p?o.operation:f?.operation;if(!F)throw new m("INVALID_RESPONSE","The current purchase result is missing");return p&&U.size===0&&!(t.pendingCommands?.length??(t.pendingCommand?1:0))&&(M=null),structuredClone(F)},destroy(){R=!0,L(),x.clear(),l.abort(),z.clear()}},L=t.subscribe(i=>{R||i.nodeId!==n||i.visit!==g||i.paywall?.receiptId!==P||(i.paywall.selectionGeneration??0)<(o.selectionGeneration??0)||(C(i.paywall.resolution),o={...o,resolution:i.paywall.resolution},w())});return{session:le,load:_}}function nt(t){let b=new Set,P=new Set,n=null;async function g(u,C){let R=!1;for(;!t.stopped&&t.key===u&&t.client.pendingCommand?.requestId===C;){if(!t.client.settle)throw new m("COMMAND_PENDING","The original display acknowledgement is still pending");await t.client.settle(C),R=!0,t.client.pendingCommand?.requestId===C&&await new Promise(x=>setTimeout(x,1500))}t.stopped||t.key!==u||(R&&await t.client.get(),!(t.stopped||t.key!==u)&&b.add(u))}function A(u,C){n=C;let R=()=>{n===C&&(n=null),P.delete(u)};return C.then(R,x=>{R(),t.busy||t.fail(x)}),C}function o(u){if(t.reviewing||b.has(u)||P.has(u)||t.stopped)return;P.add(u);let C=async()=>{if(t.reviewing||t.stopped||t.key!==u||b.has(u)){P.delete(u);return}if(t.busy||t.client.pendingCommand){setTimeout(()=>{C()},250);return}let R=(async()=>{if(t.staleRead){if(await t.staleRead,t.stopped||t.key!==u)return;if(t.client.pendingCommand){setTimeout(()=>{C()},250);return}}let x=t.client.view,ie=t.expected(),w=ie.requestId;try{await t.client.submit({operation:"shown",...ie})}catch(_){if(!(_ instanceof m)||_.code!=="CONFLICT"||_.status!==409||t.client.pendingCommand)throw _;await t.client.get();let l=t.client.view;if(t.stopped||t.reviewing||t.key!==u||!l||!x||l.id!==x.id||l.source.versionId!==x.source.versionId||l.nodeId!==ie.nodeId||l.visit!==ie.visit||l.revision<=ie.revision||l.stopped||!l.screen&&(!l.paywall||l.paywall.receiptId!==x.paywall?.receiptId)||!["running","waiting"].includes(l.status)||t.client.pendingCommand)throw _;let c=t.expected();w=c.requestId,await t.client.submit({operation:"shown",...c})}await g(u,w)})();A(u,R)};C()}function O(){if(n)return n;let u=t.client.pendingCommand;if(u?.operation!=="shown")return null;let C=t.key;return P.add(C),A(C,(async()=>{await t.client.retry(),await g(C,u.requestId)})())}return{report:o,settled:O,get inFlight(){return n}}}function tt(t){let b={},P=new Map;async function n(g){let A=t.client.view,o=A?.screen,O=o?.customerData.nodes[g.nodeId];if(t.stopped||t.busy||!A||!o||!O)return;if(!["refresh","next","previous","filter","sources_next","sources_previous"].includes(g.action)){let _=t.document,l=_?Tn(_,g.nodeId):null,c=l?.type==="customer_data"?l.data.outputs?.[g.action]:void 0;c&&o.outputs.includes(c)?await t.perform(()=>t.client.submit({operation:"submit",...t.expected(),input:{type:"screen",output:c,answers:t.answers,selection:g.value?{[g.nodeId]:g.value}:{}}})):await t.onIntent?.(g,A);return}let C=g.action.startsWith("sources_")?O.resources.find(_=>_.key===g.value):null;if(g.action.startsWith("sources_")&&!C)throw new m("INVALID_REQUEST","Choose a current resource");let R=`${A.visit}:${g.nodeId}:${C?.key??""}`,x=P.get(R)??[null],w=b[g.nodeId]??{page:1,after:null,filter:"all",...C?{resourceKey:C.key}:{}};if(g.action==="filter"){let _=g.value;if(!_||!(O.source==="offer_history"?["all","issued","reserved","redeemed","expired","revoked"]:["all","purchase","refund","source","usage","debt","settlement"]).includes(_))throw new m("INVALID_REQUEST","Unknown data filter");w={page:1,after:null,filter:_},x.splice(0,x.length,null)}else if(g.action==="next"||g.action==="sources_next"){let _=C?.sources.at(-1),l=C?_?{kind:"ledger",cursor:{at:_.detail[0],id:_.id,type:"source"}}:null:o.dataCursors[g.nodeId];if(!l||!C&&!O.hasNext)return;x[w.page]=l,w={...w,page:w.page+1,after:l}}else if(g.action==="previous"||g.action==="sources_previous"){if(w.page<=1)return;w={...w,page:w.page-1,after:x[w.page-2]??null}}P.set(R,x),b={...b,[g.nodeId]:w},await t.perform(()=>t.client.get({nodeId:A.nodeId,visit:A.visit,revision:A.revision,components:b}))}return{get queries(){return b},intent:n,reset(){b={},P.clear()}}}function it(t){let{doc:b,holder:P,reviewHolder:n,mountScreenPreview:g}=t,A=!1,o,O=0,u=null,C="",R,x=new Map,ie=l=>l?`${l.id}:${l.nodeId}:${l.visit}:${l.revision}:${l.paywall?.quote?.operationId??""}`:"";async function w(l){if(t.stopped||!t.client.review||A&&l===o&&R?.active)return;let c=!A||l!==o;A||(C=ie(t.client.view),x.set(C,structuredClone(t.answers))),A=!0,o=l,P.hidden=!0,t.suspend(!0),n.hidden=!1;let E=++O;c&&(R?.finish("dismissed"),u?.destroy(),u=null,n.replaceChildren(),R=tn(n,t.loadingOptions,"funnel",()=>{_()}));let S=c?R:void 0;try{if(S?.start(!1,t.client.view?.locale),E!==O||t.stopped)return;let re=t.client.review(l),U=await(S?.wait(re,_e)??re);if(t.stopped||E!==O||!A)return;if(!U.review)throw new m("INVALID_RESPONSE","Historical projection is missing");u?.destroy(),u=null,S||n.replaceChildren();let M=b.createElement("div"),z=S?rn(M,n):()=>{};n.append(M);let Q=U.run.locale.startsWith("zh"),I=t.chrome;M.style.cssText=I.history;let Z=b.createElement("p");Z.textContent=Q?"只读回看":"Read-only history",Z.style.cssText=I.historyTitle,M.append(Z);let N=b.createElement("p");N.style.cssText=I.historyNote,N.textContent=U.review.pages.length?Q?"选择一页查看当时的内容,回看不会改动任何信息。":"Choose a page to see it as it was. Nothing here can be changed.":Q?"还没有可回看的页面。":"There are no earlier pages yet.",M.append(N);let qe=U.review.page?.receiptId,he=b.createElement("div");he.style.cssText=I.historyPages;for(let[le,L]of U.review.pages.entries()){let i=b.createElement("button");i.type="button",i.textContent=Q?`第 ${le+1} 页`:`Page ${le+1}`;let a=qe!==void 0&&L.receiptId===qe;i.style.cssText=a?I.primary:I.secondary,a&&i.setAttribute("aria-current","page"),$e(i,()=>t.chrome.focus),i.onclick=()=>{w(L.receiptId)},he.append(i)}if(he.childElementCount&&M.append(he),U.review.page){let le=U.review.page,L=b.createElement("div");L.inert=!0,L.style.cssText=I.historyPage,M.append(L),u=g(L,{mode:"live",rendererUrl:t.client.webViewUrl,title:le.document.name,onAction:()=>{},onAnswers:()=>{},onCustomerDataIntent:()=>{},onRendered:()=>{E===O&&!t.stopped&&S?.present(z)},onError:a=>{if(E!==O||t.stopped)return;let s=new Error(a);S?.finish("error",s),u?.destroy(),u=null,M.remove(),t.fail(s)},onEscape:()=>{_()}});let i=u;if(i.update(le.document,U.run.locale,{serverInput:{bindings:le.inputs,answers:le.answers,values:le.values}}),await i.ready,t.stopped||E!==O||!A)return}let we=Q?{issued:"已领取",reserved:"已预留",redeemed:"已使用",expired:"已过期",revoked:"已撤销",unknown:"状态待确认"}:{issued:"Issued",reserved:"Reserved",redeemed:"Used",expired:"Expired",revoked:"Revoked",unknown:"Status unconfirmed"},W=b.createElement("div");W.style.cssText=I.historyRecords;for(let le of[...U.review.coupons.map((L,i)=>`${Q?"优惠券":"Coupon"} ${i+1}: ${we[L.status]}`),...U.review.purchases.map((L,i)=>`${Q?"购买":"Purchase"} ${i+1}: ${Zn(L.status,Q)}`)]){let L=b.createElement("p");L.textContent=le,L.style.margin="0",W.append(L)}W.childElementCount&&M.append(W),U.review.page||S?.present(z),t.client.view&&await t.enqueue(t.client.view)}catch(re){if(E!==O||t.stopped)return;S?.finish("error",re),u?.destroy(),u=null,n.replaceChildren(),t.fail(re)}}async function _(){if(!A||t.stopped||!t.client.review)return;let l=++O;R?.finish("dismissed");try{if(await t.client.review(),t.stopped||l!==O)return;A=!1,O++,R?.finish("dismissed"),u?.destroy(),u=null,n.replaceChildren(),n.hidden=!0,P.hidden=!1;let c=t.client.view;ie(c)!==C?(x.set(C,structuredClone(t.answers)),t.resetScreen()):(x.delete(C),t.suspend(!1)),c&&await t.enqueue(c)}catch(c){if(l!==O||t.stopped)return;u?.destroy(),u=null,n.replaceChildren(),t.fail(c)}}return{get active(){return A},get receipt(){return o},open:w,exit:_,get drafts(){return new Map([...x].map(([l,c])=>[l,structuredClone(c)]))},stop(){A=!1,O++,R?.finish("dismissed"),u?.destroy(),u=null,n.replaceChildren(),n.hidden=!0,P.hidden=!1}}}var hn=5e3;async function dt(t,b,P){let n=b,g=n.prepared&&Kn(n.prepared),A=()=>{};function o(){n.prepared&&n.prepared.state!=="adopted"&&g?.release()}let O=()=>n.prepared?.state==="shown"&&!!g?.modal,u=n.client.identitySignal,C;try{C=await Promise.all([import("./screen-renderer-HOIWGE5V.js"),import("./paywall-C5TM2TXD.js")]),n.signal?.throwIfAborted(),u?.throwIfAborted()}catch(e){throw o(),e}let[{mountScreenPreview:R},{showPaywall:x}]=C,ie=(typeof INDIANA_NATIVE_SHELL_BUILD>"u"||!INDIANA_NATIVE_SHELL_BUILD)&&n.appManifestRelease?et({client:n.client,appManifestRelease:n.appManifestRelease,onError:n.onError}):void 0;ie?.start();let w=t.ownerDocument,_=Qn(w),l=!1,c=w.createElement("section"),E=w.createElement("div"),S=w.createElement("div"),re=w.createElement("div"),U=w.createElement("button");re.hidden=!0,U.type="button";let M=w.createElement("p"),z=w.createElement("p"),Q=w.createElement("button"),I=w.createElement("button"),Z=w.createElement("button"),N=w.createElement("dialog"),qe,he=!1;c.dataset.indianaFunnel="",c.dataset.longplayCloseOwner="sdk",c.setAttribute("aria-busy","false"),M.setAttribute("role","status"),z.setAttribute("role","alert"),z.hidden=!0,Q.type=I.type=Z.type="button",S.append(Q,U,M,z,Z,I),c.append(E,re,S),t.append(c);let we=jn,W=mn(we),le="",L=(w.documentElement.lang||"").startsWith("zh"),i,a="",s;for(let e of[Q,U,Z,I])$e(e,()=>W.focus);function q(){let e=L?"关闭":"Close";I.parentElement===N?(I.textContent="×",I.setAttribute("aria-label",e),Gn(I,we)):(I.textContent=e,I.removeAttribute("aria-label"),I.style.cssText=W.link+";margin-inline-start:auto")}function f(e){let r=e?.screen?.content.document.theme??we,d=JSON.stringify([r.primary,r.background,r.text,r.radius,r.font,I.parentElement===N]);if(d===le)return;le=d,we=r;let H=I.parentElement===N;W=mn(we,H),c.style.cssText=W.root+";min-width:0"+(H?";display:flex;flex-direction:column;min-height:100%":""),S.style.cssText=W.bar+(H?";margin-top:auto":""),S.hidden&&(S.style.display="none"),Q.style.cssText=U.style.cssText=W.secondary,Z.style.cssText=W.primary,M.style.cssText=W.status,z.style.cssText=W.alert,q(),wn(Q)}function p(){S.hidden=Q.hidden&&U.hidden&&Z.hidden&&z.hidden&&!M.textContent&&(I.hidden||I.parentElement!==S),S.style.display=S.hidden?"none":"flex",i?.responsive&&s!==void 0&&i.setContentHeight(s+S.getBoundingClientRect().height)}f();let F=null,y=null,Y=null,X="",j="",ge=!1,xe="",on="",Ge="",h=!1,ue=0,Qe=!1,gn="",sn=null,an=Promise.resolve(),vn=!n.client.view,J=P,Ae,Le,ze="",Je,pe=!1,De=null,ve=!1,je=()=>n.client.pendingCommand?.operation==="close",fe=null,K=null,ln=Mn({document:w,run:async()=>{(!y?.observing||n.client.pendingCommand)&&await dn()},delay:()=>{if(!me.pending&&!(h||!Y||!["running","waiting"].includes(Y.status)&&!n.client.pendingCommand)&&!(y?.observing&&!n.client.pendingCommand))return Y.pendingRequest||n.client.pendingCommand?1500:hn},hiddenDelay:()=>!h&&!me.pending&&n.client.pendingCommand?15e3:void 0}),ne=null;function un(){return K&&n.client.hasDurableJournal===!0&&ne?.acknowledged===!0&&ne.operationId===K.operationId&&n.client.view?.id===ne.runId&&n.client.view?.status==="closed"&&n.client.view.revision===ne.revision+1&&!(n.client.pendingCommands?.length??(n.client.pendingCommand?1:0))&&!n.client.pendingPurchase?K:null}function In(e){let r=e.run.paywall;if(ne&&e.settlement?.requestId===ne.requestId&&e.settlement.state==="settled"&&e.settlement.operationId===null&&e.run.id===ne.runId&&e.run.status==="closed"&&!e.run.pendingRequest&&e.run.revision===ne.revision+1&&e.run.nodeId===ne.nodeId&&e.run.visit===ne.visit&&r?.receiptId===ne.receiptId&&r.selectionGeneration===ne.selectionGeneration&&(r.quote?.operationId??null)===ne.operationId&&(r.operation?.operationId??r.quote?.operationId??null)===ne.operationId){let d=ne.operationId===null&&r.selectionGeneration===0&&!r.quote&&!r.operation&&!r.purchaseRequestId,H=Me({quote:r.quote,operation:r.operation,requestId:r.purchaseRequestId,pending:!1,destroyed:!1,canReselect:r.canReselect});(d||r.canReselect===!0&&H.type==="native")&&(ne.acknowledged=!0)}}let Te=null,Be=new Set,Ie={},Se=!1,de=(e,r=null)=>{h||(e instanceof m&&e.status===409&&e.reason==="STATE_CHANGED"&&e.recovery==="recover_operation"&&ln.destroy(),Te=r,Se=!1,z.textContent=Bn(e,L),z.hidden=!1,Z.hidden=n.client.pendingCommand===null,p(),Ee(n.onError,e))},me=Fn({client:n.client,document:w,conceal(){h||(be(),J?.finish("dismissed"),c.hidden=!0,l||(l=!0,_()))},async receive(e){h||await ye(n.client.view??e.run)},failed(e){if(!h){if(!me.pending){ve=!1;let r=n.client.view;r&&ye(r).then(()=>de(e),de);return}Ze(),c.parentElement!==t&&t.append(c),c.hidden=!1,Q.hidden=U.hidden=I.hidden=!0,M.textContent="",f(),de(e,n.client.pendingCommand?.requestId??null)}}}),bn=()=>{h||(Te=null,z.textContent=Yn(L),z.hidden=!1,Z.hidden=!0,p())};function ke(){let e=n.client.view;if(!e)throw new m("INVALID_REQUEST","No current Run is available");return{requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:e.revision}}let k=it({client:n.client,doc:w,holder:E,reviewHolder:re,mountScreenPreview:R,loadingOptions:n,get chrome(){return W},get stopped(){return h},get answers(){return Ie},suspend(e){y?.setSuspended(e)},resetScreen(){X="",j="",xe=""},enqueue:ye,fail:de}),He=nt({client:n.client,expected:ke,fail:de,get stopped(){return h},get reviewing(){return k.active},get key(){return X},get busy(){return ue},get staleRead(){return sn}}),We=tt({client:n.client,expected:ke,perform:Ne,onIntent:n.onCustomerDataIntent,get stopped(){return h},get busy(){return ue},get document(){return F?.document},get answers(){return Ie}}),Ye=e=>`${e.id}:${e.nodeId}:${e.visit}`,Fe=e=>e&&(e.screen||e.paywall)?Ye(e):"";function Pe(){let e=n.client.view;Q.disabled=!k.active&&(ue>0||!!n.client.pendingCommand||!e?.canBack||e.stopped||!["running","waiting"].includes(e.status)||!Fe(e)||j!==Fe(e)),Q.hidden=!k.active&&!e?.canBack,wn(Q);let r=!!y&&!k.active;I.hidden=r&&!J?.active||he&&!k.active,U.hidden=!n.client.review||!k.active&&!e?.canBack;let d=e?.locale.startsWith("zh");M.textContent=r?"":ue>0||e?.pendingRequest?d?"正在处理":"Processing":e?.instruction?.type==="wait"?d?"等待中":"Waiting":"",p()}async function Cn(e){if(!e)return;let r=n.client.view;await e;let d=n.client.view;if(!r||!d||d.id!==r.id||d.nodeId!==r.nodeId||d.visit!==r.visit||d.stopped||!["running","waiting"].includes(d.status))throw new m("PRECONDITION_FAILED","The screen changed while its display was acknowledged")}async function Ne(e,r=!1,d){if(!((ue||ve||fe||K)&&!r||h||k.active&&!r)){ue++,c.setAttribute("aria-busy","true"),z.hidden=!0,Te=null,Se=!1,Pe();try{if(r||await Cn(He.inFlight),h)return;let H=await e();h||await ye(n.client.view??H.run)}catch(H){d?.(H)&&n.client.pendingCommand===null?bn():me.pending||de(H,n.client.pendingCommand?.requestId??null)}finally{ue=Math.max(0,ue-1),c.setAttribute("aria-busy",String(ue>0)),h||(Z.hidden=n.client.pendingCommand===null,Pe())}}}function Ve(){ln.schedule()}async function dn(){if(!(h||Qe||ue)&&!me.pending){if(k.active){await k.open(k.receipt);return}Qe=!0;try{let e=n.client.pendingCommand;e&&n.client.settle&&await n.client.settle(e.requestId);let r=n.client.view,d=We.queries,H=await n.client.get(r?.screen&&Object.keys(d).length?{nodeId:r.nodeId,visit:r.visit,revision:r.revision,components:d}:void 0);Se&&!h&&(Se=!1,z.hidden=!0,p()),!h&&d===We.queries&&await ye(n.client.view??H.run)}catch(e){de(e),Se=!h}finally{Qe=!1}}}function Xe(e,r,d){if(J?.active){let ce=J;return ce.setDismissHandler(()=>Pn(ce)),ce}let H=tn(t,n,"funnel",()=>Pn(H),Jn);return J=H,H.start(e,r,d),H}function Pn(e){h||pe||(pe=!0,e.finish("dismissed"),be(),c.hidden=!0,n.client.view?Re().finally(oe):oe())}function cn(){clearTimeout(Je?.timeout),Je=void 0}function be(){he=!1,cn(),Ae?.abort(),Ae=void 0,F?.destroy(),F=null,y?.destroy(),y=null,Le?.(),Le=void 0,N.open&&N.close(),E.replaceChildren(),E.style.cssText="",s=void 0,X="",j="",ge=!1,xe="",Ge=""}function Rn(){let e=w.defaultView;i?.responsive&&e&&F?.resizeViewport?.(e.innerHeight,e.innerWidth)}function Ze(){i?.destroy(),i=void 0,a=""}function Ke(e){let r=e.screen?.presentation;if(!r||r.type==="inline"){N.open&&N.close(),Ze(),I.parentElement!==S&&S.append(I),c.parentElement!==t&&t.append(c);for(let ce of["flex","display","flex-direction","justify-content"])E.style.removeProperty(ce);f(e),p();return}c.parentElement!==N&&(N.append(I,c),t.append(N)),E.style.flex="1 0 auto",E.style.display="flex",E.style.flexDirection="column",E.style.justifyContent="center",f(e);let d=e.screen.content.document,H=JSON.stringify([r,le]);if(H!==a){Ze(),a=H;let ce={sm:420,md:640,lg:900},Ce="size"in r&&!r.backdrop?",0 0 0 100vmax #16142566":"";N.style.cssText=`box-sizing:border-box;padding:0;border:0;overflow:auto;background:${we.background};color:${we.text};`+(r.type==="fullscreen"?"width:100vw;height:100dvh;max-width:100vw;max-height:100dvh;margin:0;border-radius:0":`width:${ce[r.size]}px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);box-shadow:0 24px 80px #0003${Ce};`+(r.type==="sheet"?"margin:auto auto 0;border-radius:14px 14px 0 0":"border-radius:14px")),i=$n(N,{presentation:r,theme:d.theme,pages:d.pages},Rn),i.latch()}p(),N.setAttribute("aria-label",(qe?.screen===e.screen?.content.document.name?qe?.label:void 0)??F?.document?.name??e.screen?.content.document.name??"Funnel")}async function rt(e){if(h||pe)return;if(me.observe(),me.pending){Y=e;return}if(ve&&(je()||["running","waiting"].includes(e.status))||(Y=e,Te&&n.client.pendingCommand?.requestId!==Te&&(z.hidden=!0,Te=null),L=e.locale.startsWith("zh"),U.textContent=L?"回看":"History",Q.textContent=k.active?L?"返回当前":"Return to current":L?"返回":"Back",q(),Z.textContent=L?"重试":"Retry",Z.hidden=n.client.pendingCommand===null,Pe(),gn!==`${e.revision}:${e.visit}:${e.status}:${e.stopped}`&&(gn=`${e.revision}:${e.visit}:${e.status}:${e.stopped}`,Ee(n.onState,structuredClone(e))),h||pe))return;if((!e.pendingRequest||ve&&e.status==="closed")&&["closed","ineligible","failed"].includes(e.status)){oe();return}if(e.stopped&&O()){oe();return}if(e.stopped||n.client.configurationReady===!1){k.stop(),o(),be(),J?.finish("skipped"),c.hidden=!0,Ve();return}if(c.hidden=!1,k.active){Ve();return}let r=Fe(e),d=n.client.view;if(d&&d.revision>e.revision&&Fe(d)!==r)return;let H=!e.instruction&&!e.pendingRequest&&e.nodeType==="screen"&&["running","waiting"].includes(e.status);r!==X&&(X&&J?.finish("dismissed"),be(),X=r,Ie={...e.answers},We.reset());let ce=Ye(e);if(ze===ce){c.hidden=!0;return}if(H&&!r){c.hidden=!0;let $=n.prepared?.state==="shown"?null:Xe(!0,e.locale);!h&&!pe&&Je?.key!==ce&&(cn(),Je={key:ce,timeout:setTimeout(()=>{let v=n.client.view;if(h||!$?.active&&n.prepared?.state!=="shown"||!v||Ye(v)!==ce)return;ze=ce;let B=new Error("Funnel screen preparation timed out");$?.finish("error",B),o(),be(),de(B)},_e)}),Ve();return}cn();let ee=$=>{let v=n.client.view;return!h&&!pe&&!De&&!$.aborted&&n.client.configurationReady!==!1&&!!v&&!v.stopped&&!["closed","ineligible","failed"].includes(v.status)&&Fe(v)===r},Ce=($,v)=>{ee(v)&&(ze=r,J?.finish("error",$),be(),c.hidden=!0,de($))};if(r||((e.instruction&&e.instruction.type!=="evaluate_segment"||!["running","waiting"].includes(e.status))&&o(),Ke(e),e.instruction?.type!=="event"&&e.instruction?.type!=="open_url"&&J?.finish("skipped")),e.screen){o();let $=e.screen.content;if(!F){let ae=e.screen.presentation.type!=="inline",G=Xe(ae,e.locale);if(h||pe)return;let te=(Ae=new AbortController).signal;Ke(e),Le=ae?zn(N):rn(c,t),F=R(E,{mode:"live",closeActions:Array.from(new Set([...n.closeActions??[],...$.document.actions.filter(V=>V.type==="event"&&V.close).map(V=>V.id)])),onAuthoredClose(V){ee(te)&&(he=V,Pe())},rendererUrl:n.client.webViewUrl,title:$.document.name,...ae?{hostPresentation:()=>i?.type??e.screen.presentation.type}:{},onResize:V=>{s=V,i?.responsive&&i.setContentHeight(V+S.getBoundingClientRect().height)},onAction(V,T={},Ue={}){if(k.active||!ee(te)||j!==r)return;Ie={...Ie,...Ue};let pn=e.screen?.inputs??[],qn=Object.fromEntries(pn.filter(({variable:Oe})=>Object.hasOwn(Ie,Oe)).map(({variable:Oe})=>[Oe,Ie[Oe]]));if(Xn(pn,qn).length){bn();return}Ne(()=>n.client.submit({operation:"submit",...ke(),input:{type:"screen",output:V,answers:qn,selection:T}}),!1,Oe=>Wn(Oe,pn))},onAnswers:V=>{k.active||!ee(te)||j!==r||(Ie={...Ie,...V})},onCustomerDataIntent:V=>{k.active||!ee(te)||j!==r||We.intent(V).catch(de)},onEscape:()=>{!ee(te)||j!==r||k.active||fe||K||Re()},onError:V=>{let T=new Error(V);j===r?de(T):Ce(T,te)},onRendered:V=>{if(!(!ee(te)||j===r))try{G.present(T=>{Le?.(),Le=void 0,V&&(qe={screen:$.document.name,label:V},N.setAttribute("aria-label",V)),ae&&(N.showModal(),l=!1,i?.responsive&&N.focus({preventScroll:!0}),!T&&n.loading!=="host"&&xn(N,i?.type??e.screen.presentation.type,i?.responsive)),j=r,ge=ae,Pe()}),ee(te)&&He.report(r)}catch(T){Ce(T,te)}}}),Rn()}let v={capabilities:e.screen.capabilities,customerData:e.screen.customerData,parameters:e.parameters,serverInput:{bindings:e.screen.inputs,answers:Ie,values:e.screen.values}},B=JSON.stringify([$,e.locale,v.parameters,e.screen.inputs,e.screen.values]);if(B!==xe)F.update($.document,e.locale,v),xe=B,on=JSON.stringify(v.capabilities),Ge=JSON.stringify(v.customerData);else{let ae=JSON.stringify(v.capabilities);ae!==on&&(F.updateCapabilities(v.capabilities),on=ae),JSON.stringify(v.customerData)!==Ge&&(F.updateCustomerData(v.customerData),Ge=JSON.stringify(v.customerData))}let se=F;if(se)try{await(J?.wait(se.ready)??se.ready)}catch(ae){Ae&&Ce(ae,Ae.signal)}}else if(e.paywall&&!y){let $=e.paywall.resolution,v="document"in $?$.document:null,B=g,se=n.mountPaywallControls,ae=null,G=(Ae=new AbortController).signal,te={loading:"host",signal:G,...se&&{mountControls:T=>se(T,e)},canInteract:()=>ee(G)&&!k.active&&!fe&&!K,beforeAction:async()=>{ue++;try{await Cn(He.settled()),z.hidden=!0,Te=null,Se=!1,p()}finally{ue=Math.max(0,ue-1)}},start:()=>yn(n.client),onObservationChange:Ve,onPurchase:n.onPurchase,onCheckoutUrl:n.onCheckoutUrl,resumeCheckout:n.resumeCheckout,allowNewPurchase:n.allowNewPurchase,checkoutNavigation:n.checkoutNavigation,terminateCheckout:n.terminateCheckout,purchaseConfirmation:n.purchaseConfirmation,confirmOnHostedCheckout:n.confirmOnHostedCheckout,resolveOfferId:n.resolveOfferId,resolveSubscriptionChange:n.resolveSubscriptionChange,claimCoupon:n.claimCoupon,onEvent:n.onEvent,onOpenUrl:T=>n.onOpenUrl?n.onOpenUrl({receiptId:e.paywall.receiptId,url:T,openIn:"same_window"}):w.defaultView?.location.assign(T),onAction:async T=>{if(k.active)return;let Ue=await n.client.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:n.client.view?.revision??e.revision,input:{type:"screen",output:T,answers:{}}});await ye(n.client.view??Ue.run)},onError:T=>{j===r?de(T):Ce(T,G)}},V={quoteError:T=>Ee(n.onError,T),present(T){ee(G)&&(ae?.present(()=>{T(),j=r,ge=!!E.querySelector("dialog[open]"),ge&&(l=!1),Pe()}),ee(G)&&He.report(r))},async closeAction(T){h||k.active||await me.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:n.client.view?.revision??e.revision,input:{type:"screen",output:T,answers:{}}})},async dismiss(){if(!(h||G.aborted||k.active||fe||K||!ve&&!ee(G))){if(ve=!0,(n.resumeCheckout||n.terminateCheckout)&<()){Y=n.client.view,oe();return}await Re()}}};if(B&&se)o();else if(B){let T=await B.adopt(e,{options:te,handoff:V,start:()=>yn(n.client)});T&&ee(G)&&!h?(Ke(e),y=T,J?.active&&J.present(()=>{}),j=r,ge=B.modal,ge&&(l=!1),Pe(),He.report(r),k.active&&y.setSuspended(!0)):(T?.destroy(),o())}if(h||pe)return;if(!y){if(ae=Xe(!0,e.locale,v),h||pe)return;Ke(e);let T=await x(E,te,V).catch(Ue=>(Ce(Ue,G),null));!ee(G)&&!(ve&&!h&&!G.aborted)?T?.host?.destroy():T&&(y=T.host,y?.setSuspended(k.active))}}if(h||pe)return;Pe();let D=e.instruction;if(D&&(D.type==="open_url"||D.type==="event")&&!Be.has(D.receiptId)){let $=w.createElement("button");$.type="button",$.style.cssText=W.primary,$e($,()=>W.focus),E.style.cssText=W.stage,$.textContent=D.type==="open_url"?`${L?"前往":"Continue to"} ${new URL(D.url).host}`:L?"继续":"Continue",$.onclick=()=>{let v=ke(),B=D.type==="open_url"&&!n.onOpenUrl&&D.openIn==="new_window"?ot(D.url):null;Ne(async()=>{let se="success";if(D.type==="open_url")if(n.onOpenUrl)try{se=await n.onOpenUrl({receiptId:D.receiptId,url:D.url,openIn:D.openIn})===!1?"failed":"opened"}catch(G){Ee(n.onError,G),se="failed"}else se=D.openIn==="new_window"&&!B?"failed":"opened";if(D.type==="event"){if(!n.onEvent)throw new m("EVENT_HANDLER_REQUIRED","Provide the event handler");await n.onEvent(D.event)}if(h||n.client.view?.nodeId!==v.nodeId||n.client.view.visit!==v.visit)throw new m("PRECONDITION_FAILED","The client action visit changed");let ae=await n.client.submit({operation:"submit",...v,input:{type:"client_action",receiptId:D.receiptId,outcome:se}});return Be.add(D.receiptId),D.type==="open_url"&&!n.onOpenUrl&&D.openIn==="same_window"&&w.defaultView?.location.assign(D.url),ae})},J?.active?J.present(()=>E.replaceChildren($)):E.replaceChildren($)}!e.pendingRequest&&e.status==="completed"&&!Be.has(`complete:${e.id}`)&&(Be.add(`complete:${e.id}`),Ee(n.onComplete,structuredClone(e))),Ve()}function ot(e){let r=w.defaultView?.open(e,"_blank")??null;return r&&(r.opener=null),r}function ye(e){return Pe(),an=an.catch(()=>{}).then(async()=>{try{await rt(e)}catch(r){throw J?.active&&(ze=Ye(e),J.finish("error",r),be(),c.hidden=!0),r}}),an}let st=n.client.subscribe(e=>{if(!vn){if(e.stopped&&(ge||O())&&!ve){Y=e,oe();return}!ve&&(e.stopped||n.client.configurationReady===!1||X&&j!==X&&(Fe(e)!==X||["closed","ineligible","failed"].includes(e.status)))&&(be(),J?.finish("dismissed"),c.hidden=!0),ye(e).catch(de)}}),at=n.client.subscribeError?.(e=>{me.pending||de(e)});function lt(){let e=n.client.view,r=e?.paywall;return!!r?.operation&&!!e&&["running","waiting"].includes(e.status)&&Nn(Me({quote:r.quote,operation:r.operation,requestId:r.purchaseRequestId,pending:!1,destroyed:!1,canReselect:r.canReselect}))}function Re(e){if(De)return De;if(h||!e&&(fe||K))return Promise.resolve();let r=!e&&je();return!r&&n.client.view&&!["running","waiting"].includes(n.client.view.status)?(Y=n.client.view,oe(),Promise.resolve()):(De=Ne(async()=>{let d=r?await n.client.retry():await(e?n.client.submit.bind(n.client):me.submit)({operation:"close",...e??ke()});return e&&In(d),d},!0).then(()=>{let d=n.client.view;d?.status==="closed"&&!je()&&(Y=d,oe())}).finally(()=>{De=null}),De)}function oe(){ie?.destroy(),!h&&(h=!0,me.destroy(),A(),o(),n.signal?.removeEventListener("abort",oe),u?.removeEventListener("abort",oe),J?.finish("dismissed"),ln.destroy(),st(),at?.(),be(),Ze(),k.stop(),N.remove(),c.remove(),l||_(),Ee(n.onDismiss,Y?structuredClone(Y):null))}Q.onclick=()=>{if(!Q.disabled){if(k.active){k.exit();return}Ne(()=>n.client.submit({operation:"back",...ke()}))}},U.onclick=()=>{k.open()},I.onclick=()=>{J?.active?J.dismiss():fe||Re()},Z.onclick=()=>{me.pending?me.retry().catch(()=>{}):je()?Re():Ne(()=>n.client.retry())},N.addEventListener("cancel",e=>{e.preventDefault(),J?.active?J.dismiss():fe||Re()}),n.signal?.addEventListener("abort",oe,{once:!0}),u?.addEventListener("abort",oe,{once:!0});let en=!1;g&&(A=g.onClose(()=>{h||pe||(pe=!0,J?.finish("dismissed"),be(),c.hidden=!0,n.client.view?Re().finally(oe):en=!0)}));let En={destroy:oe,refresh:dn,get recovery(){let e=un();if(e)return e;if(!h&&!ue&&!ve&&!fe&&y){let r=y.recovery;if(r.type!=="native")return r}return{type:"recover",operationId:n.client.pendingPurchase?.operationId??n.client.view?.paywall?.quote?.operationId??K?.operationId??null,requestId:n.client.pendingCommand?.requestId??null}},prepareFallback(){if(fe)return fe;let e=un();if(e)return Promise.resolve(e);let r=n.client.pendingPurchase?.operationId??n.client.view?.paywall?.quote?.operationId??K?.operationId??null,d=()=>({type:"recover",operationId:r,requestId:n.client.pendingCommand?.requestId??null});if(n.client.hasDurableJournal!==!0){let D=y?.recovery;return Promise.resolve(D&&D.type!=="native"&&D.type!=="cancel"?D:d())}let H=(n.client.pendingCommands??(n.client.pendingCommand?[n.client.pendingCommand]:[])).some(D=>D.operation==="close");if(h&&!(H||K&&n.client.view?.status==="closed")||ue||Qe||De||k.active||!y&&!K&&!H)return Promise.resolve(d());let ce=y,ee=(async()=>{try{if(!K&&H){let v=await n.client.retry();return await ye(n.client.view??v.run),d()}if(!K){let v=await ce.prepareFallback();if(v.type!=="native")return v;if(n.client.hasDurableJournal!==!0)return d();K=v}let D=n.client.pendingCommands??(n.client.pendingCommand?[n.client.pendingCommand]:[]);if(D.length){let v=D.find(se=>se.operation==="close");if(!v||!ne||v.requestId!==ne.requestId)return d();let B=await n.client.retry();In(B),await ye(n.client.view??B.run)}else{let v=n.client.view,B=v?.paywall;if(!v||!B||B.selectionGeneration===void 0||(B.quote?.operationId??null)!==K.operationId||K.operationId!==null&&B.canReselect!==!0)return d();let se=B.selectionGeneration,ae=await n.client.get();await ye(n.client.view??ae.run);let G=n.client.view,te=G?.paywall;if(!G||!te||!["running","waiting"].includes(G.status)||G.stopped||G.id!==v.id||G.nodeId!==v.nodeId||G.visit!==v.visit||te.receiptId!==B.receiptId||te.selectionGeneration!==se||(te.quote?.operationId??null)!==K.operationId||K.operationId!==null&&te.canReselect!==!0||n.client.pendingPurchase||(n.client.pendingCommands?.length??(n.client.pendingCommand?1:0)))return d();let V=ke();ne={runId:G.id,operationId:K.operationId,revision:V.revision,requestId:V.requestId,nodeId:G.nodeId,visit:G.visit,receiptId:te.receiptId,selectionGeneration:se,acknowledged:!1},await Re(V)}let $=un();return $?(oe(),$):d()}catch(D){return de(D),d()}})();fe=ee;let Ce=()=>{fe===ee&&(fe=null)};return ee.then(Ce,Ce),ee},review:k.open,exitReview:k.exit,get unappliedDrafts(){return k.drafts}};try{let e=n.client.view;if(e)((n.client.viewAgeMs??hn)>=hn||e.instruction?.type==="evaluate_segment")&&(sn=dn().finally(()=>{sn=null})),await ye(e);else{if(c.hidden=!0,h)throw new DOMException("Presentation cancelled","AbortError");let r=en||n.prepared?.state==="shown"?null:Xe(n.client.view?.screen?.presentation.type!=="inline",n.client.view?.locale);if(h||pe&&!en)throw new DOMException("Presentation cancelled","AbortError");let d=n.client.get(),H=await(r?r.wait(d,_e):ct(d,_e));if(vn=!1,en)return h||await Re().finally(oe),En;await ye(n.client.view??H.run)}}catch(e){throw J?.finish("error",e),oe(),e}return En}function ct(t,b){let P;return Promise.race([t,new Promise((n,g)=>{P=setTimeout(()=>g(new Error("Presentation data timed out")),b)})]).finally(()=>clearTimeout(P))}function Zt(t,b,P){return dt(t,b,P)}export{dt as a,Zt as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as T}from"./chunk-KAMYLHAT.js";import{a as M}from"./chunk-DSPLGTQI.js";var z={sm:420,md:640,lg:900},A=767;function ue(e,r,o=()=>!0,s="Close"){let n=e.ownerDocument.defaultView,i=e.ownerDocument.createElement("button");i.type="button",i.setAttribute("aria-label",s),i.style.cssText="position:absolute;inset:0 48px auto;z-index:2;height:24px;border:0;padding:0;background:transparent;touch-action:none;cursor:grab";let c=e.ownerDocument.createElement("span");c.style.cssText="display:block;width:36px;height:4px;border-radius:4px;margin:8px auto 12px;background:currentColor;opacity:.22;pointer-events:none",i.append(c),e.prepend(i);let l,d=0,a=!1,f=()=>{i.hidden=e.dataset.presentation!=="sheet",i.setAttribute("aria-disabled",String(!o()))},g=t=>{f(),!(i.hidden||!o()||t.button!==0)&&(l={y:t.clientY,time:Date.now(),id:t.pointerId},d=0,a=!1,i.setPointerCapture?.(t.pointerId))},y=t=>{!l||t.pointerId!==l.id||(d=Math.max(0,t.clientY-l.y),e.style.transform=`translateY(${d}px)`)},w=t=>{if(!l||t.pointerId!==l.id)return;let p=Math.max(1,Date.now()-l.time),h=t.type!=="pointercancel"&&o()&&(d>120||d>40&&d/p>.5);a=d>6,l=void 0,i.releasePointerCapture?.(t.pointerId),e.style.transform="",h?r():d&&typeof e.animate=="function"&&!n?.matchMedia?.("(prefers-reduced-motion: reduce)").matches&&e.animate([{transform:`translateY(${d}px)`},{transform:"none"}],{duration:200,easing:"cubic-bezier(.2,.8,.2,1)"}),d=0},m=()=>{if(a){a=!1;return}!l&&d===0&&o()&&r()};i.addEventListener("pointerdown",g),i.addEventListener("pointermove",y),i.addEventListener("pointerup",w),i.addEventListener("pointercancel",w),i.addEventListener("click",m);let u=typeof MutationObserver=="function"?new MutationObserver(f):void 0;return u?.observe(e,{attributes:!0,attributeFilter:["data-presentation"]}),n?.addEventListener("resize",f),f(),()=>{u?.disconnect(),n?.removeEventListener("resize",f),i.remove(),e.style.transform=""}}function O(e,r,o=!1){return(e.type==="modal"||e.type==="sheet")&&e.mobile&&o&&r<=A?e.mobile:e.type}function W(e,r,o){let s=e.ownerDocument.defaultView,n=r.presentation,i;if((n.type==="modal"||n.type==="sheet")&&n.backdrop){let t=`lp-backdrop-${crypto.randomUUID()}`,p={none:"transparent",scrim:"#f2f2f2cc",dim:"#0006","strong-dim":"#000000bf",blur:"#0006"};e.dataset.indianaBackdrop=t,i=e.ownerDocument.createElement("style"),i.textContent=`dialog[data-indiana-backdrop="${t}"]::backdrop{background:${p[n.backdrop]};backdrop-filter:${n.backdrop==="blur"?"blur(16px)":"none"}}`,e.append(i)}let c=r.pages?.[0]?.root.style?.shape,l=c?.type==="pill"?"9999px":c?.type==="rect"?typeof c.radius=="number"?`${c.radius}px`:[c.radius.topLeft,c.radius.topRight,c.radius.bottomRight,c.radius.bottomLeft].map(t=>`${t}px`).join(" "):void 0,d=(n.type==="modal"||n.type==="sheet")&&(n.desktopWidth!==void 0||n.mobile!==void 0||n.type==="modal"&&n.position!==void 0),a=n.type,f,g,y=!1,w=t=>{y||!Number.isFinite(t)||t<0||(g=t,a!=="fullscreen"&&a!=="inline"&&(e.style.height=`min(${Math.max(t,40)}px, calc(100dvh - ${a==="sheet"?0:32}px))`))},m=()=>{if(!y&&(a=f??O(n,s?.innerWidth??1024,s?.matchMedia?.("(pointer: coarse)").matches===!0),e.dataset.presentation=a,!(!d||n.type!=="modal"&&n.type!=="sheet"))){if(e.style.boxSizing="border-box",e.style.padding="0",e.style.border="0",e.style.overflow="hidden",e.style.outline="none",e.tabIndex=-1,e.style.background=r.theme.background,e.style.color=r.theme.text,a==="fullscreen")e.style.width="100vw",e.style.height="100dvh",e.style.maxWidth="100vw",e.style.maxHeight="100dvh",e.style.margin="0",e.style.borderRadius="0";else{let t=n.mobile==="sheet"&&a==="sheet",p=n.desktopWidth,h=s?.innerWidth??1024;e.style.width=t?`${h}px`:p?`${Math.min(p.max,Math.max(h*p.viewport/100,p.min))}px`:`${T[n.size]}px`,e.style.maxWidth=`${Math.max(0,h-(a==="sheet"?0:32))}px`,e.style.maxHeight=a==="sheet"?"100dvh":"calc(100dvh - 32px)",e.style.margin=a==="sheet"?"auto auto 0":n.type==="modal"&&n.position==="top"?"16px auto auto":n.type==="modal"&&n.position==="bottom"?"auto auto 16px":"auto",e.style.borderRadius=l??(a==="sheet"?"16px 16px 0 0":"24px"),e.style.height="",g!==void 0&&w(g)}o?.(a)}},u=d?[s?.matchMedia?.(`(max-width: ${A}px)`),s?.matchMedia?.("(pointer: coarse)")].filter(t=>t!==void 0):[];if(d){s?.addEventListener("resize",m);for(let t of u)t.addEventListener?t.addEventListener("change",m):t.addListener?.(m)}return m(),{responsive:d,get type(){return a},latch(){y||f!==void 0||(m(),f=a)},setContentHeight:w,destroy(){if(!y){y=!0,i?.remove(),delete e.dataset.indianaBackdrop,s?.removeEventListener("resize",m);for(let t of u)t.removeEventListener?t.removeEventListener("change",m):t.removeListener?.(m)}}}}function me(e,r,o){let{presentation:s}=r,n="size"in s?`${z[s.size]}px`:"100vw";return e.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${n}`,W(e,r,o)}function fe(e,r,o=!1){let s=e.ownerDocument.defaultView;if(typeof e.animate!="function"||s?.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let n=o?{duration:300,easing:"cubic-bezier(0.23, 1, 0.32, 1)"}:{duration:240,easing:"cubic-bezier(0.2, 0.8, 0.2, 1)"};e.animate(r==="sheet"?[{transform:"translateY(100%)"},{transform:"none"}]:r==="modal"?[{opacity:0,transform:o?"translateY(12px) scale(0.96)":"translateY(8px) scale(0.98)"},{opacity:1,transform:"none"}]:[{opacity:0},{opacity:1}],n);try{e.animate([{opacity:0},{opacity:1}],{...n,pseudoElement:"::backdrop"})}catch{}}function $(e,r){e.style.cssText=["position:absolute","z-index:1","top:calc(4px + env(safe-area-inset-top, 0px))","inset-inline-end:calc(4px + env(safe-area-inset-right, 0px))","width:44px","height:44px","padding:0","border:0","border-radius:50%","font:400 20px/1 system-ui,sans-serif","cursor:pointer","touch-action:manipulation"].join(";"),e.style.background=`radial-gradient(circle, ${r.background} 0 15px, color-mix(in srgb, ${r.text} 22%, ${r.background}) 15px 16px, transparent 16.5px)`,e.style.color=r.text}var C=new WeakMap;function he(e,r){return C.set(e,r),()=>C.delete(e)}function ye(e){let r=e.defaultView?.HTMLElement,o=e.activeElement;for(let n=0;n<16&&o?.shadowRoot?.activeElement;n++)o=o.shadowRoot.activeElement;let s=o?C.get(o)?.():void 0;return()=>{!o?.isConnected||!r||!(o instanceof r)||(o.focus({preventScroll:!0}),s?.())}}var we=15e3;function Ee(e,r,o,s,n){let i=e.ownerDocument,c=new AbortController,l=!1,d=!1,a,f;function g(){f?.(),f=void 0,a?.tagName==="DIALOG"&&a.close?.(),a?.remove(),a=void 0}function y(u,t){d||(d=!0,g(),(u==="dismissed"||u==="error")&&c.abort(t??new DOMException("Presentation cancelled","AbortError")),!(!l&&u!=="ready")&&M(r.onPresentationState,u==="error"?{surface:o,state:u,error:t}:{surface:o,state:u}))}let w=s,m=()=>{d||w()};return{setDismissHandler(u){w=u},get active(){return l&&!d},get cancelled(){return c.signal.aborted},start(u,t,p){if(!(l||d)){if(l=!0,r.loading!=="host"){let h=(t??i.documentElement.lang)||"en",v=u&&p?.presentation?.type!=="inline",E=p!==void 0,x=i.createElement(v?"dialog":"div");a=x,x.dataset.longplayLoading=o;let S=h.startsWith("zh"),I=E?S?"\u6B63\u5728\u52A0\u8F7D\u5957\u9910":"Loading plans":S?"\u6B63\u5728\u52A0\u8F7D":"Loading",R=p?.screen.theme??{background:"Canvas",text:"CanvasText"};x.setAttribute("aria-label",I);let P=i.createElement("div");P.setAttribute("role","status");let D=i.createElement("div");D.setAttribute("aria-hidden","true"),E?(P.style.cssText="padding:calc(24px + env(safe-area-inset-top, 0px)) 24px 16px;padding-inline-end:68px;font:650 20px/1.3 system-ui,sans-serif;letter-spacing:-.015em",p||(P.style.paddingBlockEnd="24px")):P.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)",P.textContent=I;let b=i.createElement("button");b.type="button",b.textContent="\xD7",b.setAttribute("aria-label",S?"\u53D6\u6D88\u52A0\u8F7D":"Cancel loading"),$(b,R),E&&(b.style.borderRadius="50%",b.style.top="calc(15px + env(safe-area-inset-top, 0px))",b.style.insetInlineEnd="calc(15px + env(safe-area-inset-right, 0px))"),b.addEventListener("click",m),x.addEventListener("cancel",L=>{L.preventDefault(),m()});let H=i.createElement("style");H.textContent="[data-longplay-loading] > button:focus-visible{outline:2px solid currentColor;outline-offset:-2px}",x.append(P,D,b,H),e.append(x);let k=()=>{if(!d&&v){let L=x;L.showModal?L.showModal():L.open=!0,b.focus({preventScroll:!0})}};p&&n?(f=n(x,D,p,h),k()):E?(x.style.cssText=v?"padding:0;border:0;border-radius:24px;background:Canvas;color:CanvasText;width:min(420px,calc(100vw - 32px))":"position:relative;background:Canvas;color:CanvasText;width:100%",k()):(_(x,D,v,o),k())}M(r.onPresentationState,{surface:o,state:"loading",dismiss:m})}},present(u){if(d)return;let t=!!a;g(),u(t),y("ready")},dismiss:m,finish:y,async wait(u,t){let p=c.signal,h,v,E=new Promise((x,S)=>{v=()=>S(p.reason),p.aborted?v():p.addEventListener("abort",v,{once:!0}),t!==void 0&&(h=setTimeout(()=>S(new Error("Presentation data timed out")),t))});try{let x=await Promise.race([E,u]);return p.throwIfAborted(),x}finally{p.removeEventListener("abort",v),clearTimeout(h)}}}}function _(e,r,o,s){e.style.cssText="position:relative;box-sizing:border-box;background:Canvas;color:CanvasText;padding:24px 48px 24px 24px;"+(o?"position:fixed;width:min(480px,calc(100% - 32px));border:0;border-radius:16px;max-height:calc(100dvh - 32px)":"width:100%"),r.style.cssText="display:grid;gap:12px";let n=s==="banner"?[["72%",12],["44%",10]]:[["46%",20],["84%",12],["65%",12],["100%",64]];for(let[i,c]of n){let l=e.ownerDocument.createElement("div");l.style.cssText=`width:${i};height:${c}px;background:currentColor;opacity:.11;border-radius:6px`,r.append(l)}}function F(e){let r={display:"block",position:"fixed",top:"0",left:"0",opacity:"0",pointerEvents:"none",zIndex:"-1"},o=Object.keys(r).map(i=>{let c=i,l=e.style[c];return e.style[c]=r[c],[c,l]}),s=e.inert??!1,n=e.getAttribute("aria-hidden");return e.inert=!0,e.setAttribute("aria-hidden","true"),()=>{for(let[i,c]of o)e.style[i]=c;e.inert=s,n===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n)}}function Pe(e,r){let o=e.style.width;e.style.width=`${r.getBoundingClientRect().width||r.ownerDocument.defaultView?.innerWidth||800}px`;let s=F(e);return()=>{s(),e.style.width=o}}export{ue as a,O as b,W as c,me as d,fe as e,$ as f,he as g,ye as h,we as i,Ee as j,F as k,Pe as l};
|
|
1
|
+
import{c as T}from"./chunk-PF6PRPRO.js";import{a as M}from"./chunk-DSPLGTQI.js";var z={sm:420,md:640,lg:900},A=767;function ue(e,r,o=()=>!0,s="Close"){let n=e.ownerDocument.defaultView,i=e.ownerDocument.createElement("button");i.type="button",i.setAttribute("aria-label",s),i.style.cssText="position:absolute;inset:0 48px auto;z-index:2;height:24px;border:0;padding:0;background:transparent;touch-action:none;cursor:grab";let c=e.ownerDocument.createElement("span");c.style.cssText="display:block;width:36px;height:4px;border-radius:4px;margin:8px auto 12px;background:currentColor;opacity:.22;pointer-events:none",i.append(c),e.prepend(i);let l,d=0,a=!1,f=()=>{i.hidden=e.dataset.presentation!=="sheet",i.setAttribute("aria-disabled",String(!o()))},g=t=>{f(),!(i.hidden||!o()||t.button!==0)&&(l={y:t.clientY,time:Date.now(),id:t.pointerId},d=0,a=!1,i.setPointerCapture?.(t.pointerId))},y=t=>{!l||t.pointerId!==l.id||(d=Math.max(0,t.clientY-l.y),e.style.transform=`translateY(${d}px)`)},w=t=>{if(!l||t.pointerId!==l.id)return;let p=Math.max(1,Date.now()-l.time),h=t.type!=="pointercancel"&&o()&&(d>120||d>40&&d/p>.5);a=d>6,l=void 0,i.releasePointerCapture?.(t.pointerId),e.style.transform="",h?r():d&&typeof e.animate=="function"&&!n?.matchMedia?.("(prefers-reduced-motion: reduce)").matches&&e.animate([{transform:`translateY(${d}px)`},{transform:"none"}],{duration:200,easing:"cubic-bezier(.2,.8,.2,1)"}),d=0},m=()=>{if(a){a=!1;return}!l&&d===0&&o()&&r()};i.addEventListener("pointerdown",g),i.addEventListener("pointermove",y),i.addEventListener("pointerup",w),i.addEventListener("pointercancel",w),i.addEventListener("click",m);let u=typeof MutationObserver=="function"?new MutationObserver(f):void 0;return u?.observe(e,{attributes:!0,attributeFilter:["data-presentation"]}),n?.addEventListener("resize",f),f(),()=>{u?.disconnect(),n?.removeEventListener("resize",f),i.remove(),e.style.transform=""}}function O(e,r,o=!1){return(e.type==="modal"||e.type==="sheet")&&e.mobile&&o&&r<=A?e.mobile:e.type}function W(e,r,o){let s=e.ownerDocument.defaultView,n=r.presentation,i;if((n.type==="modal"||n.type==="sheet")&&n.backdrop){let t=`lp-backdrop-${crypto.randomUUID()}`,p={none:"transparent",scrim:"#f2f2f2cc",dim:"#0006","strong-dim":"#000000bf",blur:"#0006"};e.dataset.indianaBackdrop=t,i=e.ownerDocument.createElement("style"),i.textContent=`dialog[data-indiana-backdrop="${t}"]::backdrop{background:${p[n.backdrop]};backdrop-filter:${n.backdrop==="blur"?"blur(16px)":"none"}}`,e.append(i)}let c=r.pages?.[0]?.root.style?.shape,l=c?.type==="pill"?"9999px":c?.type==="rect"?typeof c.radius=="number"?`${c.radius}px`:[c.radius.topLeft,c.radius.topRight,c.radius.bottomRight,c.radius.bottomLeft].map(t=>`${t}px`).join(" "):void 0,d=(n.type==="modal"||n.type==="sheet")&&(n.desktopWidth!==void 0||n.mobile!==void 0||n.type==="modal"&&n.position!==void 0),a=n.type,f,g,y=!1,w=t=>{y||!Number.isFinite(t)||t<0||(g=t,a!=="fullscreen"&&a!=="inline"&&(e.style.height=`min(${Math.max(t,40)}px, calc(100dvh - ${a==="sheet"?0:32}px))`))},m=()=>{if(!y&&(a=f??O(n,s?.innerWidth??1024,s?.matchMedia?.("(pointer: coarse)").matches===!0),e.dataset.presentation=a,!(!d||n.type!=="modal"&&n.type!=="sheet"))){if(e.style.boxSizing="border-box",e.style.padding="0",e.style.border="0",e.style.overflow="hidden",e.style.outline="none",e.tabIndex=-1,e.style.background=r.theme.background,e.style.color=r.theme.text,a==="fullscreen")e.style.width="100vw",e.style.height="100dvh",e.style.maxWidth="100vw",e.style.maxHeight="100dvh",e.style.margin="0",e.style.borderRadius="0";else{let t=n.mobile==="sheet"&&a==="sheet",p=n.desktopWidth,h=s?.innerWidth??1024;e.style.width=t?`${h}px`:p?`${Math.min(p.max,Math.max(h*p.viewport/100,p.min))}px`:`${T[n.size]}px`,e.style.maxWidth=`${Math.max(0,h-(a==="sheet"?0:32))}px`,e.style.maxHeight=a==="sheet"?"100dvh":"calc(100dvh - 32px)",e.style.margin=a==="sheet"?"auto auto 0":n.type==="modal"&&n.position==="top"?"16px auto auto":n.type==="modal"&&n.position==="bottom"?"auto auto 16px":"auto",e.style.borderRadius=l??(a==="sheet"?"16px 16px 0 0":"24px"),e.style.height="",g!==void 0&&w(g)}o?.(a)}},u=d?[s?.matchMedia?.(`(max-width: ${A}px)`),s?.matchMedia?.("(pointer: coarse)")].filter(t=>t!==void 0):[];if(d){s?.addEventListener("resize",m);for(let t of u)t.addEventListener?t.addEventListener("change",m):t.addListener?.(m)}return m(),{responsive:d,get type(){return a},latch(){y||f!==void 0||(m(),f=a)},setContentHeight:w,destroy(){if(!y){y=!0,i?.remove(),delete e.dataset.indianaBackdrop,s?.removeEventListener("resize",m);for(let t of u)t.removeEventListener?t.removeEventListener("change",m):t.removeListener?.(m)}}}}function me(e,r,o){let{presentation:s}=r,n="size"in s?`${z[s.size]}px`:"100vw";return e.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${n}`,W(e,r,o)}function fe(e,r,o=!1){let s=e.ownerDocument.defaultView;if(typeof e.animate!="function"||s?.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let n=o?{duration:300,easing:"cubic-bezier(0.23, 1, 0.32, 1)"}:{duration:240,easing:"cubic-bezier(0.2, 0.8, 0.2, 1)"};e.animate(r==="sheet"?[{transform:"translateY(100%)"},{transform:"none"}]:r==="modal"?[{opacity:0,transform:o?"translateY(12px) scale(0.96)":"translateY(8px) scale(0.98)"},{opacity:1,transform:"none"}]:[{opacity:0},{opacity:1}],n);try{e.animate([{opacity:0},{opacity:1}],{...n,pseudoElement:"::backdrop"})}catch{}}function $(e,r){e.style.cssText=["position:absolute","z-index:1","top:calc(4px + env(safe-area-inset-top, 0px))","inset-inline-end:calc(4px + env(safe-area-inset-right, 0px))","width:44px","height:44px","padding:0","border:0","border-radius:50%","font:400 20px/1 system-ui,sans-serif","cursor:pointer","touch-action:manipulation"].join(";"),e.style.background=`radial-gradient(circle, ${r.background} 0 15px, color-mix(in srgb, ${r.text} 22%, ${r.background}) 15px 16px, transparent 16.5px)`,e.style.color=r.text}var C=new WeakMap;function he(e,r){return C.set(e,r),()=>C.delete(e)}function ye(e){let r=e.defaultView?.HTMLElement,o=e.activeElement;for(let n=0;n<16&&o?.shadowRoot?.activeElement;n++)o=o.shadowRoot.activeElement;let s=o?C.get(o)?.():void 0;return()=>{!o?.isConnected||!r||!(o instanceof r)||(o.focus({preventScroll:!0}),s?.())}}var we=15e3;function Ee(e,r,o,s,n){let i=e.ownerDocument,c=new AbortController,l=!1,d=!1,a,f;function g(){f?.(),f=void 0,a?.tagName==="DIALOG"&&a.close?.(),a?.remove(),a=void 0}function y(u,t){d||(d=!0,g(),(u==="dismissed"||u==="error")&&c.abort(t??new DOMException("Presentation cancelled","AbortError")),!(!l&&u!=="ready")&&M(r.onPresentationState,u==="error"?{surface:o,state:u,error:t}:{surface:o,state:u}))}let w=s,m=()=>{d||w()};return{setDismissHandler(u){w=u},get active(){return l&&!d},get cancelled(){return c.signal.aborted},start(u,t,p){if(!(l||d)){if(l=!0,r.loading!=="host"){let h=(t??i.documentElement.lang)||"en",v=u&&p?.presentation?.type!=="inline",E=p!==void 0,x=i.createElement(v?"dialog":"div");a=x,x.dataset.longplayLoading=o;let S=h.startsWith("zh"),I=E?S?"正在加载套餐":"Loading plans":S?"正在加载":"Loading",R=p?.screen.theme??{background:"Canvas",text:"CanvasText"};x.setAttribute("aria-label",I);let P=i.createElement("div");P.setAttribute("role","status");let D=i.createElement("div");D.setAttribute("aria-hidden","true"),E?(P.style.cssText="padding:calc(24px + env(safe-area-inset-top, 0px)) 24px 16px;padding-inline-end:68px;font:650 20px/1.3 system-ui,sans-serif;letter-spacing:-.015em",p||(P.style.paddingBlockEnd="24px")):P.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)",P.textContent=I;let b=i.createElement("button");b.type="button",b.textContent="×",b.setAttribute("aria-label",S?"取消加载":"Cancel loading"),$(b,R),E&&(b.style.borderRadius="50%",b.style.top="calc(15px + env(safe-area-inset-top, 0px))",b.style.insetInlineEnd="calc(15px + env(safe-area-inset-right, 0px))"),b.addEventListener("click",m),x.addEventListener("cancel",L=>{L.preventDefault(),m()});let H=i.createElement("style");H.textContent="[data-longplay-loading] > button:focus-visible{outline:2px solid currentColor;outline-offset:-2px}",x.append(P,D,b,H),e.append(x);let k=()=>{if(!d&&v){let L=x;L.showModal?L.showModal():L.open=!0,b.focus({preventScroll:!0})}};p&&n?(f=n(x,D,p,h),k()):E?(x.style.cssText=v?"padding:0;border:0;border-radius:24px;background:Canvas;color:CanvasText;width:min(420px,calc(100vw - 32px))":"position:relative;background:Canvas;color:CanvasText;width:100%",k()):(_(x,D,v,o),k())}M(r.onPresentationState,{surface:o,state:"loading",dismiss:m})}},present(u){if(d)return;let t=!!a;g(),u(t),y("ready")},dismiss:m,finish:y,async wait(u,t){let p=c.signal,h,v,E=new Promise((x,S)=>{v=()=>S(p.reason),p.aborted?v():p.addEventListener("abort",v,{once:!0}),t!==void 0&&(h=setTimeout(()=>S(new Error("Presentation data timed out")),t))});try{let x=await Promise.race([E,u]);return p.throwIfAborted(),x}finally{p.removeEventListener("abort",v),clearTimeout(h)}}}}function _(e,r,o,s){e.style.cssText="position:relative;box-sizing:border-box;background:Canvas;color:CanvasText;padding:24px 48px 24px 24px;"+(o?"position:fixed;width:min(480px,calc(100% - 32px));border:0;border-radius:16px;max-height:calc(100dvh - 32px)":"width:100%"),r.style.cssText="display:grid;gap:12px";let n=s==="banner"?[["72%",12],["44%",10]]:[["46%",20],["84%",12],["65%",12],["100%",64]];for(let[i,c]of n){let l=e.ownerDocument.createElement("div");l.style.cssText=`width:${i};height:${c}px;background:currentColor;opacity:.11;border-radius:6px`,r.append(l)}}function F(e){let r={display:"block",position:"fixed",top:"0",left:"0",opacity:"0",pointerEvents:"none",zIndex:"-1"},o=Object.keys(r).map(i=>{let c=i,l=e.style[c];return e.style[c]=r[c],[c,l]}),s=e.inert??!1,n=e.getAttribute("aria-hidden");return e.inert=!0,e.setAttribute("aria-hidden","true"),()=>{for(let[i,c]of o)e.style[i]=c;e.inert=s,n===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n)}}function Pe(e,r){let o=e.style.width;e.style.width=`${r.getBoundingClientRect().width||r.ownerDocument.defaultView?.innerWidth||800}px`;let s=F(e);return()=>{s(),e.style.width=o}}export{ue as a,O as b,W as c,me as d,fe as e,$ as f,he as g,ye as h,we as i,Ee as j,F as k,Pe as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b as o,c as i}from"./chunk-
|
|
1
|
+
import{a,b as o,c as i}from"./chunk-Y2ASROJH.js";import{a as p}from"./chunk-ZDIWOE4Q.js";function c(e){if(e!==null&&typeof e=="object"&&"customerId"in e)throw new p("INVALID_REQUEST","Customer requests use the verified session identity")}function I(e){return{async previewUpdate(t){t=a(t),c(t);let r=await o(e,"previewUpdate");return i(e,r,t)},async update(t){t=a(t),c(t);let r=await o(e,"update");return i(e,r,t)},async readSubscriptionUpdate(t){t=a(t),c(t);let r=await o(e,"readSubscriptionUpdate");return i(e,r,t)},async restoreNativePurchase(t){t=a(t),c(t);let r=await o(e,"restoreNativePurchase");return i(e,r,t)},async previewAttach(t){t=a(t),c(t);let r=await o(e,"previewAttach");return i(e,r,t)},async attach(t){t=a(t),c(t);let r=await o(e,"attach");return i(e,r,t)},async readSubscriptionOperation(t){t=a(t),c(t);let r=await o(e,"readSubscriptionOperation");return i(e,r,t)}}}export{c as a,I as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as T,b as se}from"./chunk-R2OJIXYE.js";import{b as re,h as ae,j as ce}from"./chunk-AKBF7TGD.js";import{E as M,a as J}from"./chunk-YHC5WAVP.js";import{a as b,b as f,c as m}from"./chunk-PPOPJTHA.js";import{c as Z,e as ee,f as te,g as H,h as G,j as ne}from"./chunk-CI7UPAWD.js";import{a as oe,b as j}from"./chunk-A37ZU2AP.js";import{b as W,j as X}from"./chunk-MBWUIYCH.js";import{n as $}from"./chunk-L7OMFH4O.js";import{b as ie}from"./chunk-D3WC3T4U.js";import{a as B}from"./chunk-UIKMEVXM.js";import{a as s}from"./chunk-MFAEHTOH.js";import{h as Q}from"./chunk-XB24ATBA.js";import{b as K}from"./chunk-6RGARS6I.js";import{a as z}from"./chunk-DSPLGTQI.js";var U=t=>{if(!Number.isSafeInteger(t)||t<0||t>=Number.MAX_SAFE_INTEGER)throw new s("INVALID_STATE","Installation sequence exhausted");return t+1},Se=async t=>[...new Uint8Array(await crypto.subtle.digest("SHA-256",Uint8Array.from(t,e=>e.charCodeAt(0))))].map(e=>e.toString(16).padStart(2,"0")).join("");function _(t,e){return t.transaction(n=>{if(!Number.isSafeInteger(n.identitySeq)||n.identitySeq<0||!Number.isSafeInteger(n.addressSeq)||n.addressSeq<0||n.detachSeq!==null&&(!Number.isSafeInteger(n.detachSeq)||n.detachSeq<1||n.detachSeq>n.identitySeq))throw new s("INVALID_STATE","Installation journal is invalid");return e({...n})})}function ue(t,e,n){let r=null,o=0,a=0,d=0,y=Promise.resolve(),g=!1;if(t&&(!n||Q.parse(t.scope).projectId!==n.projectId||t.scope.environment!==n.environment))throw new s("SCOPE_MISMATCH","Push installation belongs to another scope");let l=()=>{if(g)throw new s("CLOSED","SDK client was destroyed");if(!t)throw new s("NOT_CONFIGURED","Configure this client's native Push host first");return t},O=i=>{if(i!==o)throw new s("IDENTITY_CHANGED","Identity changed during Push operation")};async function F(i){let c=l();if(!c.sha256&&!globalThis.crypto?.subtle)throw new s("NOT_CONFIGURED","Configure native SHA-256 for this Push host");let u=c.sha256?await c.sha256(Uint8Array.from(i,A=>A.charCodeAt(0))):await Se(i);if(!/^[a-f0-9]{64}$/.test(u))throw new s("INVALID_STATE","Push credential digest is invalid");return u}function p(i){let c=G.parse(i);if(c.installationId.toLowerCase()!==l().installationId.toLowerCase())throw new s("INVALID_RESPONSE","Push response belongs to another installation");return c}async function S(i,c){let u=l(),A={installationId:u.installationId,publicKey:u.publicKey,issuedAt:new Date().toISOString(),...c},w=await u.sign(ne(i,u.scope,A));return{...A,signature:w}}let I=(i,c,u)=>e.requestWithCredential?e.requestWithCredential(i,c,u):e.request(i,c);async function q(){let i=l(),c=o,u=r?await(e.session?.access()??r):null,A=_(i,v=>v),w;if(A.detachSeq!==null){let v=A.detachSeq,V=Z.parse(await S("detach",{sequence:v,platform:i.platform}));try{let k=await e.request("push/installations/detach",{...i.scope,...V},"POST",{installationDetach:!0});if(!k||typeof k!="object"||!("installation"in k))throw new s("INVALID_RESPONSE","Push detach acknowledgement is invalid");let x=p(k.installation);if(x.bound||x.identitySeq!==v)throw new s("INVALID_RESPONSE","Push detach acknowledgement does not match its intent")}catch(k){if(k instanceof s&&k.status===404)w=k;else if(!(k instanceof s)||k.status!==412)throw k}w||_(i,k=>({...k,detachSeq:k.detachSeq===v?null:k.detachSeq}))}if(O(c),!u){if(w)throw w;return null}let C=(await import("./operation-contracts-OSBKHIVO.js")).apiOperations.bindPushInstallation,D=C.request.parse(await S("bind",{sequence:d,platform:i.platform,credentialDigest:await F(u)}));O(c);let R=C.response.parse(await I(C.path,D,u));O(c);let N=p(R.installation);if(!N.bound||N.identitySeq!==d)throw new s("INVALID_RESPONSE","Push binding acknowledgement does not match its intent");return w&&A.detachSeq!==null&&d>A.detachSeq&&_(i,v=>({...v,detachSeq:v.detachSeq===A.detachSeq?null:v.detachSeq})),N}async function h(){l();let i=o,c=r?await(e.session?.access()??r):null;if(!c)throw new s("NOT_IDENTIFIED","Identify before reading this installation");let u=(await import("./operation-contracts-OSBKHIVO.js")).apiOperations.readPushInstallation,A=u.request.parse(await S("read",{credentialDigest:await F(c)}));O(i);let w=u.response.parse(await I(u.path,A,c));return O(i),p(w.installation)}function P(i=q){let c=y.catch(()=>{}).then(i);return y=c,c.catch(u=>{try{t?.onError?.(u instanceof Error?u:new Error("Push synchronization failed"))}catch{}}),c}async function E(i,c,u){let A=l(),w=c.identity,C=c.observation,D=r?await(e.session?.access()??r):null;if(O(w),C!==a)throw new s("INVALID_STATE","Push observation changed during recovery");if(!D)throw new s("NOT_IDENTIFIED","Identify before recovering a Push address");if(!i.connectionId||!i.kind||!i.token||!["granted","provisional"].includes(i.permission))throw new s("INVALID_REQUEST","Recovery needs a provider token and notification permission");return await P(async()=>{if(O(w),await q(),O(w),C!==a)throw new s("INVALID_STATE","Push observation changed during recovery");let R=_(A,x=>u?x:{...x,addressSeq:U(x.addressSeq)}),v=await S(u?"recovery_confirm":"recovery_request",{...i,sequence:R.addressSeq,credentialDigest:await F(D),...u?{challenge:u}:{}}),V=u?te.parse(v):ee.parse(v);if(O(w),C!==a)throw new s("INVALID_STATE","Push observation changed during recovery");let k=await I(`push/installations/recovery/${u?"confirm":"request"}`,V,D);if(O(w),C!==a||_(A,x=>x).addressSeq!==R.addressSeq)throw new s("INVALID_STATE","Push observation changed during recovery");if(u){let{apiOperations:x}=await import("./operation-contracts-OSBKHIVO.js");if(O(w),C!==a||_(A,Oe=>Oe).addressSeq!==R.addressSeq)throw new s("INVALID_STATE","Push observation changed during recovery");let Ae=x.updatePushAddress.response.parse(k),L=p(Ae.installation);if(!L.bound||L.identitySeq!==d||L.addressSeq!==R.addressSeq||L.connectionId!==i.connectionId||L.addressStatus!=="active")throw new s("INVALID_RESPONSE","Push recovery acknowledgement does not match its intent");return L}if(!k||typeof k!="object"||!("recovery"in k))throw new s("INVALID_RESPONSE","Push recovery acknowledgement is invalid");return H.parse(k.recovery)})}return{recoveryObserver(){l();let i={identity:o,observation:++a};return{async request(c){return H.parse(await E(c,i))},async confirm(c,u){return G.parse(await E(u,i,c))}}},identify(i){if(!t)return;d=_(t,u=>({...u,identitySeq:U(u.identitySeq)})).identitySeq,r=i,o++,a++},reset(){if(t)try{_(t,i=>{let c=U(i.identitySeq);return{...i,identitySeq:c,detachSeq:c}})}finally{r=null,o++,a++}},start(){t&&!g&&P()},destroy(){g=!0,r=null,o++,a++},async sync(){return await P()},read:h,async recover(){let i=l(),c=o,u=d;return a++,await P(async()=>{O(c);let A=await h();return O(c),d=_(i,C=>{if(C.identitySeq!==u)throw new s("IDENTITY_CHANGED","A newer installation intent exists");return{...C,identitySeq:U(Math.max(C.identitySeq,A.identitySeq)),addressSeq:Math.max(C.addressSeq,A.addressSeq)}}).identitySeq,await q()})},tokenObserver(){l();let i=++a,c=o;return async u=>{if(i!==a||c!==o)return null;let A=l(),w=r?await(e.session?.access()??r):null;if(!w)throw new s("NOT_IDENTIFIED","Identify before registering a Push token");if(await P(),O(c),i!==a)return null;let C=_(A,v=>({...v,addressSeq:U(v.addressSeq)})),D=(await import("./operation-contracts-OSBKHIVO.js")).apiOperations.updatePushAddress,R=D.request.parse(await S("address",{...u,sequence:C.addressSeq,credentialDigest:await F(w)}));if(O(c),i!==a)return null;let N=await I(D.path,R,w);return O(c),i!==a||_(A,v=>v).addressSeq!==C.addressSeq?null:p(D.response.parse(N).installation)}}}}function de(t,e){let n={async preference(r){let o=await f(t,"readMessagingPreference");return(await m(t,o,{channel:r})).preference},async setPreference(r){r=b(r);let o=await f(t,"setMessagingPreference");return(await m(t,o,r)).preference}};return{messaging:n,push:{sync:e.sync,read:e.read,recover:e.recover,tokenObserver:e.tokenObserver,recoveryObserver:e.recoveryObserver,async preference(){return n.preference("push")},async setPreference(r){return r=b(r),n.setPreference({...r,channel:"push"})}}}}function le(t,e,n={}){let r=!1;function o(){if(r)throw new s("CLOSED","SDK client was destroyed")}let a=new Set,d=g=>{for(let l of a)try{l(g)}catch{}},y=t.session.subscribeIdentity(()=>{d(!!t.session.peek()),n.afterChange?.()},()=>{e()});return{assertActive:o,isIdentified:()=>!r&&!!t.session.peek(),methods:{subscribeIdentity(g){return o(),a.add(g),()=>{a.delete(g)}},identify(g){o();let l=typeof g=="string"?g:g.accessToken;if(!B.test(l))throw new s("INVALID_TOKEN","Browser SDK requires a customer session");n.beforeIdentify?.(l),t.identify(g)},reset(){if(!r)try{n.beforeReset?.()}finally{t.reset()}},destroy(){if(!r){r=!0,y(),a.clear();try{n.beforeDestroy?.(),e()}finally{t.dispose()}}}}}}function pe(t){return{async checkEntitlement(e){e=b(e),T(e);let n=await f(t,"checkEntitlement"),r=n.request.parse(e),o=await m(t,n,r);return oe(r.requirement,o.check,void 0,o.scope),o},async readHoldings(e={}){e=b(e);let n=await f(t,"readHoldings"),r={...n,request:n.request.omit({customerId:!0})};return m(t,r,e)}}}function fe(t){return{async readLedger(e){e=b(e);let n=await f(t,"readLedger");return m(t,n,{query:e})},async readCreditStatement(e){e=b(e),T(e);let n=await f(t,"readCreditStatement");return m(t,n,e)},async quoteBalance(e){e=b(e),T(e);let n=await f(t,"quoteBalance");return m(t,n,{command:e})}}}function me(t){return{async setupPayment(e){e=b(e),T(e);let n=await f(t,"setupPayment");return m(t,n,e)},async readPaymentSetup(e){e=b(e),T(e);let n=await f(t,"readPaymentSetup");return m(t,n,e)},async readBillingInvoice(e){e=b(e),T(e);let n=await f(t,"readBillingInvoice");return m(t,n,e)},async readBillingControls(e={}){e=b(e),T(e);let n=await f(t,"readBillingControls");return m(t,n,e)},async prepareBillingAuthorization(e){e=b(e),T(e);let n=await f(t,"prepareBillingAuthorization");return m(t,n,e)},async confirmBillingAuthorization(e){e=b(e),T(e);let n=await f(t,"confirmBillingAuthorization");return m(t,n,e)},async setBillingCoupons(e){e=b(e),T(e);let n=await f(t,"setBillingCoupons");return m(t,n,e,{request:"Invalid billing coupon list",response:"Invalid billing coupon receipt"})},async revokeBillingAuthorization(e){e=b(e),T(e);let n=await f(t,"revokeBillingAuthorization");return m(t,n,e)},async listBillingInvoices(e={after:null,limit:25}){e=b(e),T(e);let n=await f(t,"listBillingInvoices");return m(t,n,e)},async confirmBillingAdjustment(e){e=b(e),T(e);let n=await f(t,"confirmBillingAdjustment");return m(t,n,e)}}}function ye(t){return{async redeemReward(e){return e=b(e),T(e),(await m(t,await f(t,"redeemReward"),{...e,requestId:e.requestId??crypto.randomUUID()},{request:"Invalid reward redemption",response:"Invalid reward receipt"})).redemption},async claimRewardProduct(e){return e=b(e),T(e),(await m(t,await f(t,"claimRewardProduct"),e,{request:"Invalid reward product claim",response:"Invalid reward product checkout"})).checkout},async createReferralCode(e){return e=b(e),T(e),(await m(t,await f(t,"createReferralCode"),{...e,requestId:e.requestId??crypto.randomUUID()},{request:"Invalid referral program",response:"Invalid referral code"})).referralCode},async redeemCoupon(e,n=crypto.randomUUID()){typeof e=="string"&&(e=e.trim().toUpperCase());let r=await m(t,await f(t,"redeemCoupon"),{code:e,requestId:n},{request:"Invalid coupon code",response:"Invalid Coupon receipt"});return{offer:r.offer,reason:r.reason}},async claimCoupon(e,n=crypto.randomUUID()){let r=await m(t,await f(t,"grantOffer"),{couponId:e,requestId:n},{request:"Invalid Coupon claim",response:"Invalid Coupon receipt"});return{offer:r.offer,reason:r.reason}},async listOffers(){return(await m(t,await f(t,"listOffers"),{},{response:"Invalid offers response"})).offers}}}function Ie(t){return{...pe(t),...fe(t),...me(t),...se(t),...ye(t)}}function he(t){return{async resolveContent(e){e=b(e),T(e);let n=await f(t,"resolveContent");return m(t,n,e)},async resolvePaywall(e){e=b(e),T(e);let n=await f(t,"resolvePaywall"),r=n.request.parse(e),o=await m(t,n,r);return j(r,o.paywall.check,o.scope),o},async resolveOffering(e){e=b(e),T(e);let n=await f(t,"resolveOffering"),r=n.request.parse(e),o=await m(t,n,r);return j(r,o.check,o.scope),o}}}var Y=t=>new TextEncoder().encode(JSON.stringify(t)).length,we=16384,Pe=5e3,Ce=6e4,Re=5;function Te(t){return t instanceof s&&t.status!==void 0&&t.status>=400&&t.status<500&&!t.retryable}function ge(t,e){let n=0,r,o=h=>{r={config:structuredClone(h),until:Date.now()+3e4}},a=[],d=null,y,g=0;function l(){if(!e())throw new s("NOT_IDENTIFIED","Call identify before using Features or events")}function O(){y||!a.length||!e()||(y=setTimeout(()=>{y=void 0,S().catch(()=>{}).finally(O)},Math.min(Pe*2**g,Ce)),typeof y=="object"&&"unref"in y&&y.unref())}function F(h){if(l(),r&&Date.now()<r.until&&!W(r.config,h.kind))return;q();let P=X.parse({events:[{...h,eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString()}]}).events[0];if(Y({events:[P]})>we)throw new s("INVALID_REQUEST","Event exceeds the delivery size limit");if(a.length>=500)throw new s("EVENT_QUEUE_FULL","Flush pending events before tracking more");a.push(structuredClone(P)),O()}function p(h,P={},E={}){F({kind:"custom",name:h,properties:P,...E})}async function S(h=!1){if(l(),d)return d;let P=n,E=(async()=>{let i={inserted:0,duplicates:0,rejected:0,skipped:0,rejections:[]},c=a.length;for(;c&&P===n;){let u=[],A=Y({events:[]});for(let C of a.slice(0,Math.min(c,100))){let D=Y(C)+(u.length?1:0);if(u.length&&A+D>we)break;u.push(C),A+=D}let w;try{let C=await f(t,"trackEvents");if(w=await m(t,C,{events:u},void 0,{keepalive:h}),P!==n)throw new s("IDENTITY_CHANGED","Event identity changed during delivery");if(w.inserted+w.duplicates+w.rejected+w.skipped!==u.length||w.rejections.length!==w.rejected)throw new s("INVALID_RESPONSE","Incomplete event acknowledgement")}catch(C){throw P===n&&(g++,(Te(C)||g>=Re)&&(a.splice(0,u.length),g=0)),C}g=0,o(w.analyticsConfig),a.splice(0,u.length),c-=u.length,i.inserted+=w.inserted,i.duplicates+=w.duplicates,i.rejected+=w.rejected,i.skipped+=w.skipped,i.rejections.push(...w.rejections)}return i})();d=E;try{return await E}finally{d===E&&(d=null)}}let I;function q(){if(I||typeof document>"u")return;let h=()=>{document.visibilityState==="hidden"&&e()&&a.length&&S(!0).catch(()=>{})};document.addEventListener("visibilitychange",h),I=()=>document.removeEventListener("visibilitychange",h)}return{rememberConfiguration:o,track:p,observe:F,flush:S,reset(){n++,r=void 0,clearTimeout(y),y=void 0,a=[],g=0,d=null},detachVisibility(){I?.(),I=void 0}}}function ve(t){let e=t.merchandise;if(typeof t.merchandiseId=="string")return{internalId:t.merchandiseId};if(!(!e||typeof e!="object"||Array.isArray(e))){if(typeof e.internalId=="string")return{internalId:e.internalId};if(typeof e.externalId=="string")return{id:e.externalId};if(typeof e.id=="string")return{id:e.id}}}var qe=new Set([...$,"merchandiseId","merchandise"]);function ke(t){let e=ve(t);return{...Object.fromEntries(Object.entries(t).filter(([r])=>!qe.has(r))),...e?{merchandise:e}:{}}}function Ee(t,e,n,r,o){if(o&&r&&(o.scope.projectId!==r.projectId||o.scope.environment!==r.environment))throw new s("SCOPE_MISMATCH","Configuration belongs to another App/environment");let a=0,d=new Set;function y(){if(!e())throw new s("NOT_IDENTIFIED","Call identify before using Features or events")}async function g(l={}){o||y();let O=a,F=!1,p=async()=>{if(F||O!==a)throw new s("IDENTITY_CHANGED","Feature identity changed");let R=o?{scope:{projectId:o.scope.projectId,environment:o.scope.environment},payload:await o.features()}:await m(t,await f(t,"getFeatures"),{});if(O!==a)throw new s("IDENTITY_CHANGED","Feature identity changed");if(r&&(R.scope.projectId!==r.projectId||R.scope.environment!==r.environment))throw new s("INVALID_RESPONSE","Feature response scope changed");return n.rememberConfiguration(R.payload.analyticsConfig),R},S=await p(),I=!0,q,h=R=>{try{l.onError?.(R)}catch{}},P=(R,N)=>{try{let v=ve(N);n.observe({...R,...v?{merchandise:v}:{}})}catch(v){h(v)}},E=ae({assertUsable:o?.assertFeatures,scope:S.scope,attributes:l.attributes,onError:l.onError,load:async()=>I?(I=!1,S.payload):(await p()).payload,evaluateRemote:async R=>{if(O!==a)throw new s("IDENTITY_CHANGED","Feature identity changed");let N=await f(t,"evaluateFeatures"),v=await m(t,N,{...R,attributes:ke(R.attributes)});if(v.scope.projectId!==S.scope.projectId||v.scope.environment!==S.scope.environment)throw new s("INVALID_RESPONSE","Remote Feature response scope changed");return{generation:v.generation,evaluatedAt:v.evaluatedAt,expiresAt:v.expiresAt,features:v.features,...v.merchandiseContext?{merchandiseContext:v.merchandiseContext}:{}}},onExperimentViewed:(R,N,v,V)=>P({kind:"experiment_exposure",generation:V,experimentId:R.key,variationId:N.key},v),onFeatureUsage:(R,N,v,V)=>P({kind:"feature_usage",generation:V,feature:R,value:N.value??null,source:N.source,ruleId:N.ruleId,...N.experimentResult?{variationId:N.experimentResult.key}:{}},v)}),i=E.refresh;function c(){clearTimeout(q),!o&&(F||O!==a||!E.expiresAt||(q=setTimeout(()=>{u().catch(h)},Math.min(2147483647,Math.max(1e3,Date.parse(E.expiresAt)-Date.now()))),typeof q=="object"&&"unref"in q&&q.unref()))}async function u(){try{return await i()}finally{c()}}let A=()=>{F||u().catch(h)},w=E.subscribe(c),C=o?.subscribe(()=>{!F&&o.fresh&&u().catch(h)});function D(){F||(F=!0,clearTimeout(q),typeof window<"u"&&window.removeEventListener("focus",A),w(),C?.(),E.reset(),d.delete(D))}d.add(D);try{await E.init(),(l.attributes?.merchandise||l.attributes?.merchandiseId)&&await E.refreshRemote()}catch(R){throw D(),R}return c(),!o&&typeof window<"u"&&window.addEventListener("focus",A),Object.assign(E,{refresh:u,destroy:D})}return{features:g,reset(l){a++,l();for(let O of d)O()}}}function be(t,e){let n="source"in e?{funnelId:e.source.id,funnelVersionId:e.source.versionId}:"versionId"in e?{funnelId:e.funnelId,funnelVersionId:e.versionId}:e,r=K.object({funnelId:J.shape.id,funnelVersionId:J.shape.versionId.optional()}).safeParse(n);if(!r.success)throw new s("INVALID_REQUEST","A valid Funnel source is required");let o=Object.freeze(r.data);function a(d){if("customerId"in d)throw new s("INVALID_REQUEST","Customer identity cannot be overridden");if("funnelId"in d&&d.funnelId!==void 0&&d.funnelId!==o.funnelId||"funnelVersionId"in d&&d.funnelVersionId!==void 0&&d.funnelVersionId!==o.funnelVersionId)throw new s("SCOPE_MISMATCH","The original Funnel source cannot change");return{...d,...o}}return{async claimCoupon(d,y=crypto.randomUUID()){let g=await f(t,"grantOffer"),l=await m(t,g,a({couponId:d,requestId:y}));return{offer:l.offer,reason:l.reason}},async resolveOffering(d){d=b(d);let y=await f(t,"resolveOffering"),g=y.request.parse(a(d)),l=await m(t,y,g);return j(g,l.check,l.scope),l},async resolvePaywall(d){d=b(d);let y=await f(t,"resolvePaywall"),g=y.request.parse(a(d)),l=await m(t,y,g);return j(g,l.paywall.check,l.scope),l},async previewAttach(d){d=b(d);let y=await f(t,"previewAttach");return m(t,y,a(d))}}}function xt(t){return Ne(t)}function Ne(t){let e=ie(t),n=e.request,r;try{r=ue(t.push,e,t.scope??t.configuration?.scope)}catch(y){throw e.dispose(),y}let o=le(e,()=>{d.reset(a.reset),a.detachVisibility()},{beforeIdentify:r.identify,beforeReset:r.reset,afterChange:r.start,beforeDestroy:r.destroy}),a=ge(n,o.isIdentified),d=Ee(n,o.isIdentified,a,t.scope,t.configuration);return{session:e.session,...de(n,r),...Ie(n),...he(n),forFunnel(y){return o.assertActive(),be(n,y)},async features(y={}){return o.assertActive(),d.features(y)},track(y,g,l={}){return a.track(y,g,l)},flush(){return a.flush()},...o.methods}}function Mt(t){if(!B.test(t.customerToken))throw new s("INVALID_TOKEN","A customer credential is required");if(!t.scope)throw new s("INVALID_REQUEST","An explicit App and environment scope is required");let e=ce({...t,scope:t.scope,apiKey:t.customerToken});return{async start(n){let r=await e.start(n),o=M({...t,runToken:r.runToken,initialResponse:r});o.identify(t.customerToken);let a=await o.get();return{...r,...a,controller:o}}}}function Kt(t){if(!t.scope)throw new s("INVALID_CONFIGURATION","An explicit process App/environment scope is required");if(t.session!==void 0)throw new s("INVALID_CONFIGURATION","The merchant process adapter owns the session");let e=null,n,r=0,o=new Set,a=new Map,d=new Map;async function y(p){let S,I=new Promise((q,h)=>{S=setTimeout(()=>h(new s("TIMEOUT","Process bridge request timed out")),t.timeoutMs??35e3)});try{return await Promise.race([Promise.resolve().then(p),I])}finally{clearTimeout(S)}}function g(p){throw p instanceof s&&(p.status===401||p.reason==="CUSTOMER_BINDING_CONFLICT")&&(r++,n?.reset(),n=void 0,e=null,a.clear(),d.clear()),p}function l(p,S){if(S!==r)throw new s("IDENTITY_CHANGED","Process was detached during a request");let I=re.parse(p);if(I.scope.projectId!==t.scope.projectId||I.scope.environment!==t.scope.environment)throw new s("SCOPE_MISMATCH","Process response belongs to another App/environment");if(e&&(e.run.id!==I.run.id||e.run.source.versionId!==I.run.source.versionId||e.run.source.id!==I.run.source.id||e.run.runExpiresAt!==I.run.runExpiresAt||e.run.identity.startedAs!==I.run.identity.startedAs||e.run.identity.participantId!==I.run.identity.participantId||e.run.identity.binding&&I.run.identity.binding&&e.run.identity.binding.id!==I.run.identity.binding.id))throw new s("INVALID_RESPONSE","The process changed its Run or Customer binding");if(!e||I.run.revision>=e.run.revision){if(e?.run.identity.binding&&!I.run.identity.binding)throw new s("INVALID_RESPONSE","The process lost its Customer binding");e=I;for(let A of o)z(A,I.run);I.run.instruction?.type==="authentication_required"&&z(t.onAuthenticationRequired,I.run)}I.settlement?.accepted!==void 0&&d.set(I.settlement.requestId,I.settlement.accepted);let{identity:q,instruction:h,...P}=I.run,{contract:E,settlement:i,...c}=I,u=i&&(({accepted:A,...w})=>w)(i);return{...c,run:{...P,authenticated:q.binding!==null,instruction:h?.type==="authentication_required"?null:h},...u?{settlement:u}:{}}}let O=p=>(a.has(p)||a.set(p,e?.run.identity.binding?.id??null),a.get(p));async function F(p){let S=r,I=e?.run.identity.binding?.id??null,q=P=>{if(I!==(e?.run.identity.binding?.id??null))throw P;return g(P)};if(p.operation==="page_experiments"){if(!t.adapter.pageExperiments)throw new s("CAPABILITY_UNAVAILABLE","Process page experiments are unavailable",501);return y(()=>t.adapter.pageExperiments(p.release,p.usedReceiptIds)).catch(q)}let h;if(p.operation==="get"){let{operation:P,customerToken:E,...i}=p;h=await y(()=>t.adapter.get({...i,...i.settlementRequestId?{settlementBindingId:O(i.settlementRequestId)}:{}})).catch(q)}else if(p.operation==="review")h=await y(()=>t.adapter.review(p.receiptId)).catch(q);else{if(p.operation==="start")throw new s("INVALID_REQUEST","Use process.open for entry");{let{customerToken:P,...E}=p;h=await y(()=>t.adapter.command(E,O(E.requestId))).catch(q)}}return l(h,S)}return{get view(){return e?.run??null},get controller(){return n},async open(p){let S=r,I=await y(()=>t.adapter.open(p)).catch(g),q=l(I,S);if(!n){n=M({...t,runToken:I.runToken,initialResponse:q,process:{request:F,binding:O,restore(E){for(let[i,c]of Object.entries(E))a.set(i,c)}}});let h=n,P=h.submit;h.submit=async E=>{try{return await P(E)}catch(i){if(!(i instanceof s)||i.reason!=="IDENTITY_CONTEXT_CHANGED"||E.operation!=="submit"||E.input.type!=="screen"||a.get(E.requestId)!==null)throw i;await h.settle?.(E.requestId),await h.get();let c=h.view;if(d.get(E.requestId)!==!1||!c||c.id!==e?.run.id||c.nodeId!==E.nodeId||c.visit!==E.visit||!e?.run.identity.binding)throw i;return P({...E,requestId:crypto.randomUUID(),revision:c.revision})}}}await n.get();for(let h of n.pendingCommands??[])a.has(h.requestId)&&a.get(h.requestId)!==(e?.run.identity.binding?.id??null)&&await n.settle?.(h.requestId);return{run:e.run,controller:n}},async syncIdentity(){let p=r;l(await y(()=>t.adapter.syncIdentity()).catch(g),p),await n?.get();for(let S of n?.pendingCommands??[])a.has(S.requestId)&&a.get(S.requestId)!==(e?.run.identity.binding?.id??null)&&await n?.settle?.(S.requestId);return e.run},async detach(){r++,n?.reset(),n=void 0,e=null,a.clear(),d.clear(),await y(()=>t.adapter.detach())},forProcess(p){if(!e?.run.identity.binding)throw new s("UNAUTHENTICATED","Sign in before a commercial operation",401);return{runId:e.run.id,bindingId:e.run.identity.binding.id,receiptId:p}},subscribe(p){return o.add(p),()=>{o.delete(p)}},destroy(){r++,n?.reset(),n=void 0,e=null,a.clear(),d.clear(),o.clear()}}}export{xt as a,Ne as b,Mt as c,Kt as d};
|
|
1
|
+
import{a as T,b as se}from"./chunk-3ITNAFAH.js";import{b as re,h as ae,j as ce}from"./chunk-FGQ376NB.js";import{E as M,a as J}from"./chunk-RCSDBE5K.js";import{a as b,b as f,c as m}from"./chunk-Y2ASROJH.js";import{c as Z,e as ee,f as te,g as H,h as G,j as ne}from"./chunk-TIOPNTMP.js";import{a as oe,b as j}from"./chunk-RFWVXTZ7.js";import{b as W,j as X}from"./chunk-KSME3N3A.js";import{n as $}from"./chunk-LE32WTZ7.js";import{b as ie}from"./chunk-EKN4CJLC.js";import{a as B}from"./chunk-FRRKTQNZ.js";import{a as s}from"./chunk-ZDIWOE4Q.js";import{h as Q}from"./chunk-FYD7CMS7.js";import{b as K}from"./chunk-XVCSRZX4.js";import{a as z}from"./chunk-DSPLGTQI.js";var U=t=>{if(!Number.isSafeInteger(t)||t<0||t>=Number.MAX_SAFE_INTEGER)throw new s("INVALID_STATE","Installation sequence exhausted");return t+1},Se=async t=>[...new Uint8Array(await crypto.subtle.digest("SHA-256",Uint8Array.from(t,e=>e.charCodeAt(0))))].map(e=>e.toString(16).padStart(2,"0")).join("");function _(t,e){return t.transaction(n=>{if(!Number.isSafeInteger(n.identitySeq)||n.identitySeq<0||!Number.isSafeInteger(n.addressSeq)||n.addressSeq<0||n.detachSeq!==null&&(!Number.isSafeInteger(n.detachSeq)||n.detachSeq<1||n.detachSeq>n.identitySeq))throw new s("INVALID_STATE","Installation journal is invalid");return e({...n})})}function ue(t,e,n){let r=null,o=0,a=0,d=0,y=Promise.resolve(),g=!1;if(t&&(!n||Q.parse(t.scope).projectId!==n.projectId||t.scope.environment!==n.environment))throw new s("SCOPE_MISMATCH","Push installation belongs to another scope");let l=()=>{if(g)throw new s("CLOSED","SDK client was destroyed");if(!t)throw new s("NOT_CONFIGURED","Configure this client's native Push host first");return t},O=i=>{if(i!==o)throw new s("IDENTITY_CHANGED","Identity changed during Push operation")};async function F(i){let c=l();if(!c.sha256&&!globalThis.crypto?.subtle)throw new s("NOT_CONFIGURED","Configure native SHA-256 for this Push host");let u=c.sha256?await c.sha256(Uint8Array.from(i,A=>A.charCodeAt(0))):await Se(i);if(!/^[a-f0-9]{64}$/.test(u))throw new s("INVALID_STATE","Push credential digest is invalid");return u}function p(i){let c=G.parse(i);if(c.installationId.toLowerCase()!==l().installationId.toLowerCase())throw new s("INVALID_RESPONSE","Push response belongs to another installation");return c}async function S(i,c){let u=l(),A={installationId:u.installationId,publicKey:u.publicKey,issuedAt:new Date().toISOString(),...c},w=await u.sign(ne(i,u.scope,A));return{...A,signature:w}}let I=(i,c,u)=>e.requestWithCredential?e.requestWithCredential(i,c,u):e.request(i,c);async function q(){let i=l(),c=o,u=r?await(e.session?.access()??r):null,A=_(i,v=>v),w;if(A.detachSeq!==null){let v=A.detachSeq,V=Z.parse(await S("detach",{sequence:v,platform:i.platform}));try{let k=await e.request("push/installations/detach",{...i.scope,...V},"POST",{installationDetach:!0});if(!k||typeof k!="object"||!("installation"in k))throw new s("INVALID_RESPONSE","Push detach acknowledgement is invalid");let x=p(k.installation);if(x.bound||x.identitySeq!==v)throw new s("INVALID_RESPONSE","Push detach acknowledgement does not match its intent")}catch(k){if(k instanceof s&&k.status===404)w=k;else if(!(k instanceof s)||k.status!==412)throw k}w||_(i,k=>({...k,detachSeq:k.detachSeq===v?null:k.detachSeq}))}if(O(c),!u){if(w)throw w;return null}let C=(await import("./operation-contracts-C6CMAO6S.js")).apiOperations.bindPushInstallation,D=C.request.parse(await S("bind",{sequence:d,platform:i.platform,credentialDigest:await F(u)}));O(c);let R=C.response.parse(await I(C.path,D,u));O(c);let N=p(R.installation);if(!N.bound||N.identitySeq!==d)throw new s("INVALID_RESPONSE","Push binding acknowledgement does not match its intent");return w&&A.detachSeq!==null&&d>A.detachSeq&&_(i,v=>({...v,detachSeq:v.detachSeq===A.detachSeq?null:v.detachSeq})),N}async function h(){l();let i=o,c=r?await(e.session?.access()??r):null;if(!c)throw new s("NOT_IDENTIFIED","Identify before reading this installation");let u=(await import("./operation-contracts-C6CMAO6S.js")).apiOperations.readPushInstallation,A=u.request.parse(await S("read",{credentialDigest:await F(c)}));O(i);let w=u.response.parse(await I(u.path,A,c));return O(i),p(w.installation)}function P(i=q){let c=y.catch(()=>{}).then(i);return y=c,c.catch(u=>{try{t?.onError?.(u instanceof Error?u:new Error("Push synchronization failed"))}catch{}}),c}async function E(i,c,u){let A=l(),w=c.identity,C=c.observation,D=r?await(e.session?.access()??r):null;if(O(w),C!==a)throw new s("INVALID_STATE","Push observation changed during recovery");if(!D)throw new s("NOT_IDENTIFIED","Identify before recovering a Push address");if(!i.connectionId||!i.kind||!i.token||!["granted","provisional"].includes(i.permission))throw new s("INVALID_REQUEST","Recovery needs a provider token and notification permission");return await P(async()=>{if(O(w),await q(),O(w),C!==a)throw new s("INVALID_STATE","Push observation changed during recovery");let R=_(A,x=>u?x:{...x,addressSeq:U(x.addressSeq)}),v=await S(u?"recovery_confirm":"recovery_request",{...i,sequence:R.addressSeq,credentialDigest:await F(D),...u?{challenge:u}:{}}),V=u?te.parse(v):ee.parse(v);if(O(w),C!==a)throw new s("INVALID_STATE","Push observation changed during recovery");let k=await I(`push/installations/recovery/${u?"confirm":"request"}`,V,D);if(O(w),C!==a||_(A,x=>x).addressSeq!==R.addressSeq)throw new s("INVALID_STATE","Push observation changed during recovery");if(u){let{apiOperations:x}=await import("./operation-contracts-C6CMAO6S.js");if(O(w),C!==a||_(A,Oe=>Oe).addressSeq!==R.addressSeq)throw new s("INVALID_STATE","Push observation changed during recovery");let Ae=x.updatePushAddress.response.parse(k),L=p(Ae.installation);if(!L.bound||L.identitySeq!==d||L.addressSeq!==R.addressSeq||L.connectionId!==i.connectionId||L.addressStatus!=="active")throw new s("INVALID_RESPONSE","Push recovery acknowledgement does not match its intent");return L}if(!k||typeof k!="object"||!("recovery"in k))throw new s("INVALID_RESPONSE","Push recovery acknowledgement is invalid");return H.parse(k.recovery)})}return{recoveryObserver(){l();let i={identity:o,observation:++a};return{async request(c){return H.parse(await E(c,i))},async confirm(c,u){return G.parse(await E(u,i,c))}}},identify(i){if(!t)return;d=_(t,u=>({...u,identitySeq:U(u.identitySeq)})).identitySeq,r=i,o++,a++},reset(){if(t)try{_(t,i=>{let c=U(i.identitySeq);return{...i,identitySeq:c,detachSeq:c}})}finally{r=null,o++,a++}},start(){t&&!g&&P()},destroy(){g=!0,r=null,o++,a++},async sync(){return await P()},read:h,async recover(){let i=l(),c=o,u=d;return a++,await P(async()=>{O(c);let A=await h();return O(c),d=_(i,C=>{if(C.identitySeq!==u)throw new s("IDENTITY_CHANGED","A newer installation intent exists");return{...C,identitySeq:U(Math.max(C.identitySeq,A.identitySeq)),addressSeq:Math.max(C.addressSeq,A.addressSeq)}}).identitySeq,await q()})},tokenObserver(){l();let i=++a,c=o;return async u=>{if(i!==a||c!==o)return null;let A=l(),w=r?await(e.session?.access()??r):null;if(!w)throw new s("NOT_IDENTIFIED","Identify before registering a Push token");if(await P(),O(c),i!==a)return null;let C=_(A,v=>({...v,addressSeq:U(v.addressSeq)})),D=(await import("./operation-contracts-C6CMAO6S.js")).apiOperations.updatePushAddress,R=D.request.parse(await S("address",{...u,sequence:C.addressSeq,credentialDigest:await F(w)}));if(O(c),i!==a)return null;let N=await I(D.path,R,w);return O(c),i!==a||_(A,v=>v).addressSeq!==C.addressSeq?null:p(D.response.parse(N).installation)}}}}function de(t,e){let n={async preference(r){let o=await f(t,"readMessagingPreference");return(await m(t,o,{channel:r})).preference},async setPreference(r){r=b(r);let o=await f(t,"setMessagingPreference");return(await m(t,o,r)).preference}};return{messaging:n,push:{sync:e.sync,read:e.read,recover:e.recover,tokenObserver:e.tokenObserver,recoveryObserver:e.recoveryObserver,async preference(){return n.preference("push")},async setPreference(r){return r=b(r),n.setPreference({...r,channel:"push"})}}}}function le(t,e,n={}){let r=!1;function o(){if(r)throw new s("CLOSED","SDK client was destroyed")}let a=new Set,d=g=>{for(let l of a)try{l(g)}catch{}},y=t.session.subscribeIdentity(()=>{d(!!t.session.peek()),n.afterChange?.()},()=>{e()});return{assertActive:o,isIdentified:()=>!r&&!!t.session.peek(),methods:{subscribeIdentity(g){return o(),a.add(g),()=>{a.delete(g)}},identify(g){o();let l=typeof g=="string"?g:g.accessToken;if(!B.test(l))throw new s("INVALID_TOKEN","Browser SDK requires a customer session");n.beforeIdentify?.(l),t.identify(g)},reset(){if(!r)try{n.beforeReset?.()}finally{t.reset()}},destroy(){if(!r){r=!0,y(),a.clear();try{n.beforeDestroy?.(),e()}finally{t.dispose()}}}}}}function pe(t){return{async checkEntitlement(e){e=b(e),T(e);let n=await f(t,"checkEntitlement"),r=n.request.parse(e),o=await m(t,n,r);return oe(r.requirement,o.check,void 0,o.scope),o},async readHoldings(e={}){e=b(e);let n=await f(t,"readHoldings"),r={...n,request:n.request.omit({customerId:!0})};return m(t,r,e)}}}function fe(t){return{async readLedger(e){e=b(e);let n=await f(t,"readLedger");return m(t,n,{query:e})},async readCreditStatement(e){e=b(e),T(e);let n=await f(t,"readCreditStatement");return m(t,n,e)},async quoteBalance(e){e=b(e),T(e);let n=await f(t,"quoteBalance");return m(t,n,{command:e})}}}function me(t){return{async setupPayment(e){e=b(e),T(e);let n=await f(t,"setupPayment");return m(t,n,e)},async readPaymentSetup(e){e=b(e),T(e);let n=await f(t,"readPaymentSetup");return m(t,n,e)},async readBillingInvoice(e){e=b(e),T(e);let n=await f(t,"readBillingInvoice");return m(t,n,e)},async readBillingControls(e={}){e=b(e),T(e);let n=await f(t,"readBillingControls");return m(t,n,e)},async prepareBillingAuthorization(e){e=b(e),T(e);let n=await f(t,"prepareBillingAuthorization");return m(t,n,e)},async confirmBillingAuthorization(e){e=b(e),T(e);let n=await f(t,"confirmBillingAuthorization");return m(t,n,e)},async setBillingCoupons(e){e=b(e),T(e);let n=await f(t,"setBillingCoupons");return m(t,n,e,{request:"Invalid billing coupon list",response:"Invalid billing coupon receipt"})},async revokeBillingAuthorization(e){e=b(e),T(e);let n=await f(t,"revokeBillingAuthorization");return m(t,n,e)},async listBillingInvoices(e={after:null,limit:25}){e=b(e),T(e);let n=await f(t,"listBillingInvoices");return m(t,n,e)},async confirmBillingAdjustment(e){e=b(e),T(e);let n=await f(t,"confirmBillingAdjustment");return m(t,n,e)}}}function ye(t){return{async redeemReward(e){return e=b(e),T(e),(await m(t,await f(t,"redeemReward"),{...e,requestId:e.requestId??crypto.randomUUID()},{request:"Invalid reward redemption",response:"Invalid reward receipt"})).redemption},async claimRewardProduct(e){return e=b(e),T(e),(await m(t,await f(t,"claimRewardProduct"),e,{request:"Invalid reward product claim",response:"Invalid reward product checkout"})).checkout},async createReferralCode(e){return e=b(e),T(e),(await m(t,await f(t,"createReferralCode"),{...e,requestId:e.requestId??crypto.randomUUID()},{request:"Invalid referral program",response:"Invalid referral code"})).referralCode},async redeemCoupon(e,n=crypto.randomUUID()){typeof e=="string"&&(e=e.trim().toUpperCase());let r=await m(t,await f(t,"redeemCoupon"),{code:e,requestId:n},{request:"Invalid coupon code",response:"Invalid Coupon receipt"});return{offer:r.offer,reason:r.reason}},async claimCoupon(e,n=crypto.randomUUID()){let r=await m(t,await f(t,"grantOffer"),{couponId:e,requestId:n},{request:"Invalid Coupon claim",response:"Invalid Coupon receipt"});return{offer:r.offer,reason:r.reason}},async listOffers(){return(await m(t,await f(t,"listOffers"),{},{response:"Invalid offers response"})).offers}}}function Ie(t){return{...pe(t),...fe(t),...me(t),...se(t),...ye(t)}}function he(t){return{async resolveContent(e){e=b(e),T(e);let n=await f(t,"resolveContent");return m(t,n,e)},async resolvePaywall(e){e=b(e),T(e);let n=await f(t,"resolvePaywall"),r=n.request.parse(e),o=await m(t,n,r);return j(r,o.paywall.check,o.scope),o},async resolveOffering(e){e=b(e),T(e);let n=await f(t,"resolveOffering"),r=n.request.parse(e),o=await m(t,n,r);return j(r,o.check,o.scope),o}}}var Y=t=>new TextEncoder().encode(JSON.stringify(t)).length,we=16384,Pe=5e3,Ce=6e4,Re=5;function Te(t){return t instanceof s&&t.status!==void 0&&t.status>=400&&t.status<500&&!t.retryable}function ge(t,e){let n=0,r,o=h=>{r={config:structuredClone(h),until:Date.now()+3e4}},a=[],d=null,y,g=0;function l(){if(!e())throw new s("NOT_IDENTIFIED","Call identify before using Features or events")}function O(){y||!a.length||!e()||(y=setTimeout(()=>{y=void 0,S().catch(()=>{}).finally(O)},Math.min(Pe*2**g,Ce)),typeof y=="object"&&"unref"in y&&y.unref())}function F(h){if(l(),r&&Date.now()<r.until&&!W(r.config,h.kind))return;q();let P=X.parse({events:[{...h,eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString()}]}).events[0];if(Y({events:[P]})>we)throw new s("INVALID_REQUEST","Event exceeds the delivery size limit");if(a.length>=500)throw new s("EVENT_QUEUE_FULL","Flush pending events before tracking more");a.push(structuredClone(P)),O()}function p(h,P={},E={}){F({kind:"custom",name:h,properties:P,...E})}async function S(h=!1){if(l(),d)return d;let P=n,E=(async()=>{let i={inserted:0,duplicates:0,rejected:0,skipped:0,rejections:[]},c=a.length;for(;c&&P===n;){let u=[],A=Y({events:[]});for(let C of a.slice(0,Math.min(c,100))){let D=Y(C)+(u.length?1:0);if(u.length&&A+D>we)break;u.push(C),A+=D}let w;try{let C=await f(t,"trackEvents");if(w=await m(t,C,{events:u},void 0,{keepalive:h}),P!==n)throw new s("IDENTITY_CHANGED","Event identity changed during delivery");if(w.inserted+w.duplicates+w.rejected+w.skipped!==u.length||w.rejections.length!==w.rejected)throw new s("INVALID_RESPONSE","Incomplete event acknowledgement")}catch(C){throw P===n&&(g++,(Te(C)||g>=Re)&&(a.splice(0,u.length),g=0)),C}g=0,o(w.analyticsConfig),a.splice(0,u.length),c-=u.length,i.inserted+=w.inserted,i.duplicates+=w.duplicates,i.rejected+=w.rejected,i.skipped+=w.skipped,i.rejections.push(...w.rejections)}return i})();d=E;try{return await E}finally{d===E&&(d=null)}}let I;function q(){if(I||typeof document>"u")return;let h=()=>{document.visibilityState==="hidden"&&e()&&a.length&&S(!0).catch(()=>{})};document.addEventListener("visibilitychange",h),I=()=>document.removeEventListener("visibilitychange",h)}return{rememberConfiguration:o,track:p,observe:F,flush:S,reset(){n++,r=void 0,clearTimeout(y),y=void 0,a=[],g=0,d=null},detachVisibility(){I?.(),I=void 0}}}function ve(t){let e=t.merchandise;if(typeof t.merchandiseId=="string")return{internalId:t.merchandiseId};if(!(!e||typeof e!="object"||Array.isArray(e))){if(typeof e.internalId=="string")return{internalId:e.internalId};if(typeof e.externalId=="string")return{id:e.externalId};if(typeof e.id=="string")return{id:e.id}}}var qe=new Set([...$,"merchandiseId","merchandise"]);function ke(t){let e=ve(t);return{...Object.fromEntries(Object.entries(t).filter(([r])=>!qe.has(r))),...e?{merchandise:e}:{}}}function Ee(t,e,n,r,o){if(o&&r&&(o.scope.projectId!==r.projectId||o.scope.environment!==r.environment))throw new s("SCOPE_MISMATCH","Configuration belongs to another App/environment");let a=0,d=new Set;function y(){if(!e())throw new s("NOT_IDENTIFIED","Call identify before using Features or events")}async function g(l={}){o||y();let O=a,F=!1,p=async()=>{if(F||O!==a)throw new s("IDENTITY_CHANGED","Feature identity changed");let R=o?{scope:{projectId:o.scope.projectId,environment:o.scope.environment},payload:await o.features()}:await m(t,await f(t,"getFeatures"),{});if(O!==a)throw new s("IDENTITY_CHANGED","Feature identity changed");if(r&&(R.scope.projectId!==r.projectId||R.scope.environment!==r.environment))throw new s("INVALID_RESPONSE","Feature response scope changed");return n.rememberConfiguration(R.payload.analyticsConfig),R},S=await p(),I=!0,q,h=R=>{try{l.onError?.(R)}catch{}},P=(R,N)=>{try{let v=ve(N);n.observe({...R,...v?{merchandise:v}:{}})}catch(v){h(v)}},E=ae({assertUsable:o?.assertFeatures,scope:S.scope,attributes:l.attributes,onError:l.onError,load:async()=>I?(I=!1,S.payload):(await p()).payload,evaluateRemote:async R=>{if(O!==a)throw new s("IDENTITY_CHANGED","Feature identity changed");let N=await f(t,"evaluateFeatures"),v=await m(t,N,{...R,attributes:ke(R.attributes)});if(v.scope.projectId!==S.scope.projectId||v.scope.environment!==S.scope.environment)throw new s("INVALID_RESPONSE","Remote Feature response scope changed");return{generation:v.generation,evaluatedAt:v.evaluatedAt,expiresAt:v.expiresAt,features:v.features,...v.merchandiseContext?{merchandiseContext:v.merchandiseContext}:{}}},onExperimentViewed:(R,N,v,V)=>P({kind:"experiment_exposure",generation:V,experimentId:R.key,variationId:N.key},v),onFeatureUsage:(R,N,v,V)=>P({kind:"feature_usage",generation:V,feature:R,value:N.value??null,source:N.source,ruleId:N.ruleId,...N.experimentResult?{variationId:N.experimentResult.key}:{}},v)}),i=E.refresh;function c(){clearTimeout(q),!o&&(F||O!==a||!E.expiresAt||(q=setTimeout(()=>{u().catch(h)},Math.min(2147483647,Math.max(1e3,Date.parse(E.expiresAt)-Date.now()))),typeof q=="object"&&"unref"in q&&q.unref()))}async function u(){try{return await i()}finally{c()}}let A=()=>{F||u().catch(h)},w=E.subscribe(c),C=o?.subscribe(()=>{!F&&o.fresh&&u().catch(h)});function D(){F||(F=!0,clearTimeout(q),typeof window<"u"&&window.removeEventListener("focus",A),w(),C?.(),E.reset(),d.delete(D))}d.add(D);try{await E.init(),(l.attributes?.merchandise||l.attributes?.merchandiseId)&&await E.refreshRemote()}catch(R){throw D(),R}return c(),!o&&typeof window<"u"&&window.addEventListener("focus",A),Object.assign(E,{refresh:u,destroy:D})}return{features:g,reset(l){a++,l();for(let O of d)O()}}}function be(t,e){let n="source"in e?{funnelId:e.source.id,funnelVersionId:e.source.versionId}:"versionId"in e?{funnelId:e.funnelId,funnelVersionId:e.versionId}:e,r=K.object({funnelId:J.shape.id,funnelVersionId:J.shape.versionId.optional()}).safeParse(n);if(!r.success)throw new s("INVALID_REQUEST","A valid Funnel source is required");let o=Object.freeze(r.data);function a(d){if("customerId"in d)throw new s("INVALID_REQUEST","Customer identity cannot be overridden");if("funnelId"in d&&d.funnelId!==void 0&&d.funnelId!==o.funnelId||"funnelVersionId"in d&&d.funnelVersionId!==void 0&&d.funnelVersionId!==o.funnelVersionId)throw new s("SCOPE_MISMATCH","The original Funnel source cannot change");return{...d,...o}}return{async claimCoupon(d,y=crypto.randomUUID()){let g=await f(t,"grantOffer"),l=await m(t,g,a({couponId:d,requestId:y}));return{offer:l.offer,reason:l.reason}},async resolveOffering(d){d=b(d);let y=await f(t,"resolveOffering"),g=y.request.parse(a(d)),l=await m(t,y,g);return j(g,l.check,l.scope),l},async resolvePaywall(d){d=b(d);let y=await f(t,"resolvePaywall"),g=y.request.parse(a(d)),l=await m(t,y,g);return j(g,l.paywall.check,l.scope),l},async previewAttach(d){d=b(d);let y=await f(t,"previewAttach");return m(t,y,a(d))}}}function xt(t){return Ne(t)}function Ne(t){let e=ie(t),n=e.request,r;try{r=ue(t.push,e,t.scope??t.configuration?.scope)}catch(y){throw e.dispose(),y}let o=le(e,()=>{d.reset(a.reset),a.detachVisibility()},{beforeIdentify:r.identify,beforeReset:r.reset,afterChange:r.start,beforeDestroy:r.destroy}),a=ge(n,o.isIdentified),d=Ee(n,o.isIdentified,a,t.scope,t.configuration);return{session:e.session,...de(n,r),...Ie(n),...he(n),forFunnel(y){return o.assertActive(),be(n,y)},async features(y={}){return o.assertActive(),d.features(y)},track(y,g,l={}){return a.track(y,g,l)},flush(){return a.flush()},...o.methods}}function Mt(t){if(!B.test(t.customerToken))throw new s("INVALID_TOKEN","A customer credential is required");if(!t.scope)throw new s("INVALID_REQUEST","An explicit App and environment scope is required");let e=ce({...t,scope:t.scope,apiKey:t.customerToken});return{async start(n){let r=await e.start(n),o=M({...t,runToken:r.runToken,initialResponse:r});o.identify(t.customerToken);let a=await o.get();return{...r,...a,controller:o}}}}function Kt(t){if(!t.scope)throw new s("INVALID_CONFIGURATION","An explicit process App/environment scope is required");if(t.session!==void 0)throw new s("INVALID_CONFIGURATION","The merchant process adapter owns the session");let e=null,n,r=0,o=new Set,a=new Map,d=new Map;async function y(p){let S,I=new Promise((q,h)=>{S=setTimeout(()=>h(new s("TIMEOUT","Process bridge request timed out")),t.timeoutMs??35e3)});try{return await Promise.race([Promise.resolve().then(p),I])}finally{clearTimeout(S)}}function g(p){throw p instanceof s&&(p.status===401||p.reason==="CUSTOMER_BINDING_CONFLICT")&&(r++,n?.reset(),n=void 0,e=null,a.clear(),d.clear()),p}function l(p,S){if(S!==r)throw new s("IDENTITY_CHANGED","Process was detached during a request");let I=re.parse(p);if(I.scope.projectId!==t.scope.projectId||I.scope.environment!==t.scope.environment)throw new s("SCOPE_MISMATCH","Process response belongs to another App/environment");if(e&&(e.run.id!==I.run.id||e.run.source.versionId!==I.run.source.versionId||e.run.source.id!==I.run.source.id||e.run.runExpiresAt!==I.run.runExpiresAt||e.run.identity.startedAs!==I.run.identity.startedAs||e.run.identity.participantId!==I.run.identity.participantId||e.run.identity.binding&&I.run.identity.binding&&e.run.identity.binding.id!==I.run.identity.binding.id))throw new s("INVALID_RESPONSE","The process changed its Run or Customer binding");if(!e||I.run.revision>=e.run.revision){if(e?.run.identity.binding&&!I.run.identity.binding)throw new s("INVALID_RESPONSE","The process lost its Customer binding");e=I;for(let A of o)z(A,I.run);I.run.instruction?.type==="authentication_required"&&z(t.onAuthenticationRequired,I.run)}I.settlement?.accepted!==void 0&&d.set(I.settlement.requestId,I.settlement.accepted);let{identity:q,instruction:h,...P}=I.run,{contract:E,settlement:i,...c}=I,u=i&&(({accepted:A,...w})=>w)(i);return{...c,run:{...P,authenticated:q.binding!==null,instruction:h?.type==="authentication_required"?null:h},...u?{settlement:u}:{}}}let O=p=>(a.has(p)||a.set(p,e?.run.identity.binding?.id??null),a.get(p));async function F(p){let S=r,I=e?.run.identity.binding?.id??null,q=P=>{if(I!==(e?.run.identity.binding?.id??null))throw P;return g(P)};if(p.operation==="page_experiments"){if(!t.adapter.pageExperiments)throw new s("CAPABILITY_UNAVAILABLE","Process page experiments are unavailable",501);return y(()=>t.adapter.pageExperiments(p.release,p.usedReceiptIds)).catch(q)}let h;if(p.operation==="get"){let{operation:P,customerToken:E,...i}=p;h=await y(()=>t.adapter.get({...i,...i.settlementRequestId?{settlementBindingId:O(i.settlementRequestId)}:{}})).catch(q)}else if(p.operation==="review")h=await y(()=>t.adapter.review(p.receiptId)).catch(q);else{if(p.operation==="start")throw new s("INVALID_REQUEST","Use process.open for entry");{let{customerToken:P,...E}=p;h=await y(()=>t.adapter.command(E,O(E.requestId))).catch(q)}}return l(h,S)}return{get view(){return e?.run??null},get controller(){return n},async open(p){let S=r,I=await y(()=>t.adapter.open(p)).catch(g),q=l(I,S);if(!n){n=M({...t,runToken:I.runToken,initialResponse:q,process:{request:F,binding:O,restore(E){for(let[i,c]of Object.entries(E))a.set(i,c)}}});let h=n,P=h.submit;h.submit=async E=>{try{return await P(E)}catch(i){if(!(i instanceof s)||i.reason!=="IDENTITY_CONTEXT_CHANGED"||E.operation!=="submit"||E.input.type!=="screen"||a.get(E.requestId)!==null)throw i;await h.settle?.(E.requestId),await h.get();let c=h.view;if(d.get(E.requestId)!==!1||!c||c.id!==e?.run.id||c.nodeId!==E.nodeId||c.visit!==E.visit||!e?.run.identity.binding)throw i;return P({...E,requestId:crypto.randomUUID(),revision:c.revision})}}}await n.get();for(let h of n.pendingCommands??[])a.has(h.requestId)&&a.get(h.requestId)!==(e?.run.identity.binding?.id??null)&&await n.settle?.(h.requestId);return{run:e.run,controller:n}},async syncIdentity(){let p=r;l(await y(()=>t.adapter.syncIdentity()).catch(g),p),await n?.get();for(let S of n?.pendingCommands??[])a.has(S.requestId)&&a.get(S.requestId)!==(e?.run.identity.binding?.id??null)&&await n?.settle?.(S.requestId);return e.run},async detach(){r++,n?.reset(),n=void 0,e=null,a.clear(),d.clear(),await y(()=>t.adapter.detach())},forProcess(p){if(!e?.run.identity.binding)throw new s("UNAUTHENTICATED","Sign in before a commercial operation",401);return{runId:e.run.id,bindingId:e.run.identity.binding.id,receiptId:p}},subscribe(p){return o.add(p),()=>{o.delete(p)}},destroy(){r++,n?.reset(),n=void 0,e=null,a.clear(),d.clear(),o.clear()}}}export{xt as a,Ne as b,Mt as c,Kt as d};
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import{a as I,b as L}from"./chunk-FRK6322O.js";function M(e){try{let n=e.replace(/([^\\])\//g,"$1\\/");return new RegExp(n)}catch{return}}function j(e,n){if(!n.length)return!1;let t=!1,r=!1;for(let o of n){let s=pe(e,o.type,o.pattern);if(o.include===!1){if(s)return!1}else t=!0,s&&(r=!0)}return r||!t}function he(e,n,t){try{let r=n.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return t&&(r="\\/?"+r.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+r+"$","i").test(e)}catch{return!1}}function be(e,n){try{let t=new URL(n.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),r=[[e.host,t.host,!1],[e.pathname,t.pathname,!0]];return t.hash&&r.push([e.hash,t.hash,!1]),t.searchParams.forEach((o,s)=>{r.push([e.searchParams.get(s)||"",o,!1])}),!r.some(o=>!he(o[0],o[1],o[2]))}catch{return!1}}function pe(e,n,t){try{let r=new URL(e,"https://_");if(n==="regex"){let o=M(t);return o?o.test(r.href)||o.test(r.href.substring(r.origin.length)):!1}else if(n==="simple")return be(r,t);return!1}catch{return!1}}function K(e){for(let t of["namespace","status","url","groups"])if(Object.hasOwn(e,t))throw new TypeError(`Retired experiment field: ${t}`);let n=e;if(n.hashVersion!==void 0&&n.hashVersion!==2)throw new TypeError("Only hash version 2 is supported");if(n.filters?.some(t=>t.hashVersion!==2))throw new TypeError("Only hash version 2 is supported")}function T(e){for(let n of Object.values(e)){if(Array.isArray(n))throw new TypeError("Saved groups require typed list or condition entries");if(n&&Object.hasOwn(n,"useEmptyListGroup"))throw new TypeError("Retired saved group field: useEmptyListGroup")}}function H(e){for(let n of["overrides","groups"])if(Object.hasOwn(e,n))throw new TypeError(`Retired evaluation context field: ${n}`);T(e.savedGroups??{})}function J(e){let n=2166136261,t=e.length;for(let r=0;r<t;r++)n^=e.charCodeAt(r),n+=(n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24);return n>>>0}function C(e,n,t){return t===2?J(J(e+n)+"")%1e4/1e4:null}function me(e){return e<=0?[]:new Array(e).fill(1/e)}function $(e,n){return e>=n[0]&&e<n[1]}function W(e,n){for(let[t,r]of n.entries())if($(e,r))return t;return-1}function Q(e,n,t){n=n===void 0?1:n,n<0?n=0:n>1&&(n=1);let r=me(e);t=t||r,t.length!==e&&(t=r);let o=t.reduce((a,u)=>u+a,0);(o<.99||o>1.01)&&(t=r);let s=0,i=n;return t.map(a=>{let u=s;return s+=a,[u,u+i*a]})}function z(e,n,t){if(!n)return null;let r=n.split("?")[1];if(!r)return null;let s=r.replace(/#.*/,"").split("&").map(i=>i.split("=",2)).filter(([i])=>i===e).map(([,i])=>i===void 0?NaN:parseInt(i))[0];return s!==void 0&&s>=0&&s<t?s:null}function X(e){try{return e()}catch{return!1}}function E(e){return typeof e=="string"?e:JSON.stringify(e)}function y(e){typeof e=="number"&&(e=e+""),(!e||typeof e!="string")&&(e="0");let n=e.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return n.length===3&&n.push("~"),n.map(t=>t.match(/^[0-9]+$/)?t.padStart(5," "):t).join("-")}var Y=new Map,D=32,Z=new WeakMap,ee=new WeakMap;function Se(e){return I(L(new TextEncoder().encode(String(e))))}var B=e=>Array.isArray(e)?e.map(B):typeof e=="string"||typeof e=="number"?Se(e):null,O=e=>typeof e=="string"?e.toLowerCase():e;function oe(e){let n=Z.get(e);return n||(n=new Set(e),Z.set(e,n)),n}function ve(e){let n=ee.get(e);return n||(n=new Set(e.map(O)),ee.set(e,n)),n}function Ae(e){T(e);for(let n of Object.values(e)){let t=n?.type==="list"||n?.type==="hashed"?n.values:null;t&&t.length>=D&&oe(t)}return e}function h(e,n,t,r){t=t||{},r||T(t),r=r||new Set;for(let[o,s]of Object.entries(n))switch(o){case"$or":if(!ie(e,s,t,r))return!1;break;case"$nor":if(ie(e,s,t,r))return!1;break;case"$and":if(!Fe(e,s,t,r))return!1;break;case"$not":if(h(e,s,t,r))return!1;break;case"$savedGroup":if(!we(e,s,t,r))return!1;break;default:if(!V(s,se(e,o),t,!1,r))return!1}return!0}function we(e,n,t,r){if(!n||typeof n!="object"||Array.isArray(n))return!1;let{id:o,attributeKey:s}=n;if(typeof o!="string"||r.has(o)||s!==void 0&&typeof s!="string")return!1;let i=t[o];if(!i||Array.isArray(i)||typeof i!="object")return!1;let a=new Set(r).add(o);if(i.type==="list"||i.type==="hashed"){let u=s??i.attributeKey;if(typeof u!="string"||!Array.isArray(i.values))return!1;let f=se(e,u);return S(i.type==="hashed"?B(f):f,i.values)}return i.type==="condition"?!i.condition||typeof i.condition!="object"?!1:h(e,i.condition,t,a):!1}function se(e,n){let t=n.split("."),r=e;for(let o of t)if(r&&typeof r=="object"&&o in r)r=r[o];else return null;return r}function ne(e,n=!1){let t=`${e}${n?"/i":""}`,r=Y.get(t);return r||(r=new RegExp(e.replace(/([^\\])\//g,"$1\\/"),n?"i":void 0),Y.set(t,r)),r}function V(e,n,t,r=!1,o=new Set){if(typeof e=="string")return r?String(n).toLowerCase()===e.toLowerCase():n+""===e;if(typeof e=="number")return n*1===e;if(typeof e=="boolean")return n!==null&&!!n===e;if(e===null)return n===null;if(Array.isArray(e)||!ae(e))return JSON.stringify(n)===JSON.stringify(e);let s=e;for(let i in s)if(!Re(i,n,s[i],t,o))return!1;return!0}function ae(e){let n=Object.keys(e);return n.length>0&&n.filter(t=>t[0]==="$").length===n.length}function Ee(e){if(e===null)return"null";if(Array.isArray(e))return"array";let n=typeof e;return["string","number","boolean","object","undefined"].includes(n)?n:"unknown"}function Ve(e,n,t,r){if(!Array.isArray(e))return!1;let o=ae(n)?s=>V(n,s,t,!1,r):s=>h(s,n,t,r);for(let s=0;s<e.length;s++)if((e[s]??null)!==null&&o(e[s]))return!0;return!1}function S(e,n,t=!1){if(t){let o;if(n.length>=D){let s=ve(n);o=i=>{let a=O(i);return!(typeof a=="number"&&Number.isNaN(a))&&s.has(a)}}else o=s=>n.some(i=>O(s)===O(i));return Array.isArray(e)?e.some(s=>o(s)):o(e)}let r=n.length>=D?(o=>s=>o.has(s))(oe(n)):o=>n.includes(o);return Array.isArray(e)?e.some(o=>r(o)):r(e)}function te(e){return e===void 0?[]:e&&typeof e=="object"&&(e.type==="list"||e.type==="hashed")&&Array.isArray(e.values)?e.values:null}function re(e,n,t,r=!1,o=new Set){if(!Array.isArray(e))return!1;for(let s=0;s<n.length;s++){let i=!1;for(let a=0;a<e.length;a++)if(V(n[s],e[a],t,r,o)){i=!0;break}if(!i)return!1}return!0}function Re(e,n,t,r,o=new Set){let s=n,i=t;switch(e){case"$veq":return y(n)===y(t);case"$vne":return y(n)!==y(t);case"$vgt":return y(n)>y(t);case"$vgte":return y(n)>=y(t);case"$vlt":return y(n)<y(t);case"$vlte":return y(n)<=y(t);case"$eq":return n===t;case"$ne":return n!==t;case"$lt":return s<i;case"$lte":return s<=i;case"$gt":return s>i;case"$gte":return s>=i;case"$exists":return t?n!=null:n==null;case"$in":return Array.isArray(t)?S(n,t):!1;case"$ini":return Array.isArray(t)?S(n,t,!0):!1;case"$inGroup":{let a=r[t],u=te(a);return u===null?!1:S(a?.type==="hashed"?B(n):n,u)}case"$notInGroup":{let a=r[t],u=te(a);return u===null?!1:!S(a?.type==="hashed"?B(n):n,u)}case"$nin":return Array.isArray(t)?!S(n,t):!1;case"$nini":return Array.isArray(t)?!S(n,t,!0):!1;case"$not":return!V(t,n,r,!1,o);case"$size":return Array.isArray(n)?V(t,n.length,r,!1,o):!1;case"$elemMatch":return Ve(n,t,r,o);case"$all":return Array.isArray(t)?re(n,t,r,!1,o):!1;case"$alli":return Array.isArray(t)?re(n,t,r,!0,o):!1;case"$regex":try{return ne(t).test(n)}catch{return!1}case"$regexi":try{return ne(t,!0).test(n)}catch{return!1}case"$type":return Ee(n)===t;default:return!1}}function ie(e,n,t,r){if(!n.length)return!0;for(let o of n)if(h(e,o,t,r))return!0;return!1}function Fe(e,n,t,r){for(let o of n)if(!h(e,o,t,r))return!1;return!0}function ue(e){return Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))}function U(e){return H(e),{context:e,stack:{evaluatedFeatures:new Set}}}function _(e){return{...e.attributes,...e.attributeOverrides}}function p(e,n,t){let r=n||"id",o="",s=_(e);return s[r]&&(o=s[r]),!o&&t&&(s[t]&&(o=s[t]),o&&(r=t)),{hashAttribute:r,hashValue:o}}function l(e,n,t){e.context.log?.(n,t)}function x(e,n){return n=n||0,`${e}__${n}`}function q(e,n){return`${e}||${n}`}function Te(e,n,t){let r=e.stickyBucketAssignmentDocs;if(!r)return{};let{hashAttribute:o,hashValue:s}=p(e,n),i=q(o,E(s)),{hashAttribute:a,hashValue:u}=p(e,t),f=u?q(a,E(u)):null,c={};return f&&r[f]&&Object.assign(c,r[f].assignments||{}),r[i]&&Object.assign(c,r[i].assignments||{}),c}function le({context:e,expKey:n,expBucketVersion:t,expHashAttribute:r,expFallbackAttribute:o,expMinBucketVersion:s,expMeta:i}){t=t||0,s=s||0,r=r||"id",i=i||[];let a=x(n,t),u=Te(e,r,o);if(s>0)for(let d=0;d<s;d++){let k=x(n,d);if(u[k]!==void 0)return{variation:-1,versionIsBlocked:!0}}let f=u[a];if(f===void 0)return{variation:-1};let c=i.findIndex(d=>d.key===f);return c<0?{variation:-1}:{variation:c}}function fe(e,n,t,r){let o=q(n,t),s=e.stickyBucketAssignmentDocs,i=s&&s[o]?s[o].assignments||{}:{},a={...i,...r},u=JSON.stringify(i)!==JSON.stringify(a);return{key:o,doc:{attributeName:n,attributeValue:t,assignments:a},changed:u}}function Ce(e,n){let t=U(n),r=ge(e,null,t);return n.onExperimentEval?.(e,r),r}function $e(e,n){return N(e,U(n))}function Oe(e){return e.forcedVariations||{}}function ce(e,n,t){let{context:r}=e;if(r.trackedExperiments){let o=ke(n,t);if(r.trackedExperiments.has(o))return;r.trackedExperiments.add(o)}G(()=>r.onExperimentViewed?.(n,t))}function Be(e,n,t){let{context:r}=e;if(r.trackedFeatureUsage){let o=JSON.stringify(t.value);if(r.trackedFeatureUsage[n]===o)return;r.trackedFeatureUsage[n]=o}G(()=>r.onFeatureUsage?.(n,t))}function G(e){try{let n=e();n&&typeof n.catch=="function"&&n.catch(()=>{})}catch{}}function N(e,n){let{context:t}=n;if(n.stack.evaluatedFeatures.has(e))return l(n,`evalFeature: circular dependency detected: ${n.stack.id} -> ${e}`,{from:n.stack.id,to:e}),m(n,e,null,"cyclicPrerequisite");n.stack.evaluatedFeatures.add(e),n.stack.id=e;let r=t.features?.[e];for(let s of r?.rules??[])K(s);let o=t.forcedFeatureValues;if(o&&o.has(e))return l(n,"Global override",{id:e,value:o.get(e)}),m(n,e,o.get(e),"override");if(!r)return l(n,"Unknown feature",{id:e}),m(n,e,null,"unknownFeature");if(r.rules){let s=new Set(n.stack.evaluatedFeatures);e:for(let i of r.rules){if(i.parentConditions)for(let f of i.parentConditions){n.stack.evaluatedFeatures=new Set(s);let c=N(f.id,n);if(c.source==="cyclicPrerequisite")return m(n,e,null,"cyclicPrerequisite");let d={value:c.value};if(!h(d,f.condition||{},t.savedGroups||{})){if(f.gate)return l(n,"Feature blocked by prerequisite",{id:e,rule:i}),m(n,e,null,"prerequisite");l(n,"Skip rule because prerequisite evaluation fails",{id:e,rule:i});continue e}}if(i.filters&&ye(i.filters,n)){l(n,"Skip rule because of filters",{id:e,rule:i});continue}if("force"in i){if(i.condition&&!de(i.condition,n)){l(n,"Skip rule because of condition ff",{id:e,rule:i});continue}if(!xe(n,i.seed||e,i.hashAttribute,t.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion)){l(n,"Skip rule because user not included in rollout",{id:e,rule:i});continue}return l(n,"Force value from rule",{id:e,rule:i}),i.tracks&&i.tracks.forEach(f=>{ce(n,f.experiment,f.result)}),m(n,e,i.force,"force",i.id)}if(!i.variations){l(n,"Skip invalid rule",{id:e,rule:i});continue}let a={variations:i.variations,key:i.key||e};"coverage"in i&&(a.coverage=i.coverage),i.weights&&(a.weights=i.weights),i.hashAttribute&&(a.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(a.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(a.disableStickyBucketing=i.disableStickyBucketing),i.bucketVersion!==void 0&&(a.bucketVersion=i.bucketVersion),i.minBucketVersion!==void 0&&(a.minBucketVersion=i.minBucketVersion),i.meta&&(a.meta=i.meta),i.ranges&&(a.ranges=i.ranges),i.name&&(a.name=i.name),i.phase&&(a.phase=i.phase),i.seed&&(a.seed=i.seed),i.hashVersion&&(a.hashVersion=i.hashVersion),i.filters&&(a.filters=i.filters),i.condition&&(a.condition=i.condition);let u=ge(a,e,n);if(t.onExperimentEval?.(a,u),u.inExperiment&&!u.passthrough)return m(n,e,u.value,"experiment",i.id,a,u)}}return l(n,"Use default value",{id:e,value:r.defaultValue}),m(n,e,r.defaultValue===void 0?null:r.defaultValue,"defaultValue")}function ge(e,n,t){let{context:r}=t;K(e);let o=e.key,s=e.variations.length;if(s<2)return l(t,"Invalid experiment",{id:o}),g(t,e,-1,!1,n);if(r.enabled===!1)return l(t,"Context disabled",{id:o}),g(t,e,-1,!1,n);if(e.urlPatterns&&!j(r.url||"",e.urlPatterns))return l(t,"Skip because of url targeting",{id:o}),g(t,e,-1,!1,n);let i=z(o,r.url||"",s);if(i!==null)return l(t,"Force via querystring",{id:o,variation:i}),g(t,e,i,!1,n);let u=Oe(r)[o];if(u!==void 0)return l(t,"Force via dev tools",{id:o,variation:u}),g(t,e,u,!1,n);if(e.active===!1)return l(t,"Skip because inactive",{id:o}),g(t,e,-1,!1,n);let{hashAttribute:f,hashValue:c}=p(r,e.hashAttribute,r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!c)return l(t,"Skip because missing hashAttribute",{id:o}),g(t,e,-1,!1,n);let d=-1,k=!1,R=!1;if(r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{variation:b,versionIsBlocked:v}=le(ue({context:r,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta}));k=b>=0,d=b,R=!!v}if(!k){if(e.filters&&ye(e.filters,t))return l(t,"Skip because of filters",{id:o}),g(t,e,-1,!1,n);if(e.include&&!X(e.include))return l(t,"Skip because of include function",{id:o}),g(t,e,-1,!1,n);if(e.condition&&!de(e.condition,t))return l(t,"Skip because of condition exp",{id:o}),g(t,e,-1,!1,n);if(e.parentConditions){let b=new Set(t.stack.evaluatedFeatures);for(let v of e.parentConditions){t.stack.evaluatedFeatures=new Set(b);let w=N(v.id,t);if(w.source==="cyclicPrerequisite")return g(t,e,-1,!1,n);let P={value:w.value};if(!h(P,v.condition||{},r.savedGroups||{}))return l(t,"Skip because prerequisite evaluation fails",{id:o}),g(t,e,-1,!1,n)}}}let A=C(e.seed||o,c,e.hashVersion??2);if(A===null)return l(t,"Skip because of invalid hash version",{id:o}),g(t,e,-1,!1,n);if(!k){let b=e.ranges||Q(s,e.coverage===void 0?1:e.coverage,e.weights);d=W(A,b)}if(R)return l(t,"Skip because sticky bucket version is blocked",{id:o}),g(t,e,-1,!1,n,void 0,!0);if(d<0)return l(t,"Skip because of coverage",{id:o}),g(t,e,-1,!1,n);if("force"in e)return l(t,"Force variation",{id:o,variation:e.force}),g(t,e,e.force===void 0?-1:e.force,!1,n);if(r.qaMode)return l(t,"Skip because QA mode",{id:o}),g(t,e,-1,!1,n);let F=g(t,e,d,!0,n,A,k);if(r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{changed:b,key:v,doc:w}=fe(r,f,E(c),{[x(e.key,e.bucketVersion)]:F.key});if(b){r.stickyBucketAssignmentDocs=r.stickyBucketAssignmentDocs||{},r.stickyBucketAssignmentDocs[v]=w;let P=r.saveStickyBucketAssignmentDoc;G(()=>P(w))}}return ce(t,e,F),l(t,"In experiment",{id:o,variation:F.variationId}),F}function m(e,n,t,r,o,s,i){let a={value:t,on:!!t,off:!t,source:r,ruleId:o||""};return s&&(a.experiment=s),i&&(a.experimentResult=i),r!=="override"&&Be(e,n,a),a}function de(e,n){return h(_(n.context),e,n.context.savedGroups||{})}function ye(e,n){return e.some(t=>{let{hashValue:r}=p(n.context,t.attribute);if(!r)return!0;let o=C(t.seed,r,t.hashVersion||2);return o===null?!0:!t.ranges.some(s=>$(o,s))})}function xe(e,n,t,r,o,s,i){if(!o&&s===void 0)return!0;if(!o&&s===0)return!1;let{hashValue:a}=p(e.context,t,r);if(!a)return!1;let u=C(n,a,i??2);return u===null?!1:o?$(u,o):s!==void 0?u<=s:!0}function g(e,n,t,r,o,s,i){let a=!0;(t<0||t>=n.variations.length)&&(t=0,a=!1);let{hashAttribute:u,hashValue:f}=p(e.context,n.hashAttribute,e.context.saveStickyBucketAssignmentDoc&&!n.disableStickyBucketing?n.fallbackAttribute:void 0),c=n.meta?.[t]??{},d=n.variations[0];for(let[R,A]of n.variations.entries())if(R===t){d=A;break}let k={key:c.key||""+t,featureId:o,inExperiment:a,hashUsed:r,variationId:t,value:d,hashAttribute:u,hashValue:f,stickyBucketUsed:!!i};return c.name&&(k.name=c.name),s!==void 0&&(k.bucket=s),c.passthrough&&(k.passthrough=c.passthrough),k}function ke(e,n){return n.hashAttribute+n.hashValue+e.key+n.variationId}/*!
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
5
|
-
furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all
|
|
8
|
-
copies or substantial portions of the Software.
|
|
9
|
-
|
|
10
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
14
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
-
SOFTWARE.
|
|
17
|
-
*/export{E as a,j as b,Ae as c,h as d,Ce as e,$e as f,ke as g};
|
|
1
|
+
import{a as I,b as L}from"./chunk-WPFTSHP2.js";function M(e){try{let n=e.replace(/([^\\])\//g,"$1\\/");return new RegExp(n)}catch{return}}function j(e,n){if(!n.length)return!1;let t=!1,r=!1;for(let o of n){let s=pe(e,o.type,o.pattern);if(o.include===!1){if(s)return!1}else t=!0,s&&(r=!0)}return r||!t}function he(e,n,t){try{let r=n.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return t&&(r="\\/?"+r.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+r+"$","i").test(e)}catch{return!1}}function be(e,n){try{let t=new URL(n.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),r=[[e.host,t.host,!1],[e.pathname,t.pathname,!0]];return t.hash&&r.push([e.hash,t.hash,!1]),t.searchParams.forEach((o,s)=>{r.push([e.searchParams.get(s)||"",o,!1])}),!r.some(o=>!he(o[0],o[1],o[2]))}catch{return!1}}function pe(e,n,t){try{let r=new URL(e,"https://_");if(n==="regex"){let o=M(t);return o?o.test(r.href)||o.test(r.href.substring(r.origin.length)):!1}else if(n==="simple")return be(r,t);return!1}catch{return!1}}function K(e){for(let t of["namespace","status","url","groups"])if(Object.hasOwn(e,t))throw new TypeError(`Retired experiment field: ${t}`);let n=e;if(n.hashVersion!==void 0&&n.hashVersion!==2)throw new TypeError("Only hash version 2 is supported");if(n.filters?.some(t=>t.hashVersion!==2))throw new TypeError("Only hash version 2 is supported")}function T(e){for(let n of Object.values(e)){if(Array.isArray(n))throw new TypeError("Saved groups require typed list or condition entries");if(n&&Object.hasOwn(n,"useEmptyListGroup"))throw new TypeError("Retired saved group field: useEmptyListGroup")}}function H(e){for(let n of["overrides","groups"])if(Object.hasOwn(e,n))throw new TypeError(`Retired evaluation context field: ${n}`);T(e.savedGroups??{})}function J(e){let n=2166136261,t=e.length;for(let r=0;r<t;r++)n^=e.charCodeAt(r),n+=(n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24);return n>>>0}function C(e,n,t){return t===2?J(J(e+n)+"")%1e4/1e4:null}function me(e){return e<=0?[]:new Array(e).fill(1/e)}function $(e,n){return e>=n[0]&&e<n[1]}function W(e,n){for(let[t,r]of n.entries())if($(e,r))return t;return-1}function Q(e,n,t){n=n===void 0?1:n,n<0?n=0:n>1&&(n=1);let r=me(e);t=t||r,t.length!==e&&(t=r);let o=t.reduce((a,u)=>u+a,0);(o<.99||o>1.01)&&(t=r);let s=0,i=n;return t.map(a=>{let u=s;return s+=a,[u,u+i*a]})}function z(e,n,t){if(!n)return null;let r=n.split("?")[1];if(!r)return null;let s=r.replace(/#.*/,"").split("&").map(i=>i.split("=",2)).filter(([i])=>i===e).map(([,i])=>i===void 0?NaN:parseInt(i))[0];return s!==void 0&&s>=0&&s<t?s:null}function X(e){try{return e()}catch{return!1}}function E(e){return typeof e=="string"?e:JSON.stringify(e)}function y(e){typeof e=="number"&&(e=e+""),(!e||typeof e!="string")&&(e="0");let n=e.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return n.length===3&&n.push("~"),n.map(t=>t.match(/^[0-9]+$/)?t.padStart(5," "):t).join("-")}var Y=new Map,D=32,Z=new WeakMap,ee=new WeakMap;function Se(e){return I(L(new TextEncoder().encode(String(e))))}var B=e=>Array.isArray(e)?e.map(B):typeof e=="string"||typeof e=="number"?Se(e):null,O=e=>typeof e=="string"?e.toLowerCase():e;function oe(e){let n=Z.get(e);return n||(n=new Set(e),Z.set(e,n)),n}function ve(e){let n=ee.get(e);return n||(n=new Set(e.map(O)),ee.set(e,n)),n}function Ae(e){T(e);for(let n of Object.values(e)){let t=n?.type==="list"||n?.type==="hashed"?n.values:null;t&&t.length>=D&&oe(t)}return e}function h(e,n,t,r){t=t||{},r||T(t),r=r||new Set;for(let[o,s]of Object.entries(n))switch(o){case"$or":if(!ie(e,s,t,r))return!1;break;case"$nor":if(ie(e,s,t,r))return!1;break;case"$and":if(!Fe(e,s,t,r))return!1;break;case"$not":if(h(e,s,t,r))return!1;break;case"$savedGroup":if(!we(e,s,t,r))return!1;break;default:if(!V(s,se(e,o),t,!1,r))return!1}return!0}function we(e,n,t,r){if(!n||typeof n!="object"||Array.isArray(n))return!1;let{id:o,attributeKey:s}=n;if(typeof o!="string"||r.has(o)||s!==void 0&&typeof s!="string")return!1;let i=t[o];if(!i||Array.isArray(i)||typeof i!="object")return!1;let a=new Set(r).add(o);if(i.type==="list"||i.type==="hashed"){let u=s??i.attributeKey;if(typeof u!="string"||!Array.isArray(i.values))return!1;let f=se(e,u);return S(i.type==="hashed"?B(f):f,i.values)}return i.type==="condition"?!i.condition||typeof i.condition!="object"?!1:h(e,i.condition,t,a):!1}function se(e,n){let t=n.split("."),r=e;for(let o of t)if(r&&typeof r=="object"&&o in r)r=r[o];else return null;return r}function ne(e,n=!1){let t=`${e}${n?"/i":""}`,r=Y.get(t);return r||(r=new RegExp(e.replace(/([^\\])\//g,"$1\\/"),n?"i":void 0),Y.set(t,r)),r}function V(e,n,t,r=!1,o=new Set){if(typeof e=="string")return r?String(n).toLowerCase()===e.toLowerCase():n+""===e;if(typeof e=="number")return n*1===e;if(typeof e=="boolean")return n!==null&&!!n===e;if(e===null)return n===null;if(Array.isArray(e)||!ae(e))return JSON.stringify(n)===JSON.stringify(e);let s=e;for(let i in s)if(!Re(i,n,s[i],t,o))return!1;return!0}function ae(e){let n=Object.keys(e);return n.length>0&&n.filter(t=>t[0]==="$").length===n.length}function Ee(e){if(e===null)return"null";if(Array.isArray(e))return"array";let n=typeof e;return["string","number","boolean","object","undefined"].includes(n)?n:"unknown"}function Ve(e,n,t,r){if(!Array.isArray(e))return!1;let o=ae(n)?s=>V(n,s,t,!1,r):s=>h(s,n,t,r);for(let s=0;s<e.length;s++)if((e[s]??null)!==null&&o(e[s]))return!0;return!1}function S(e,n,t=!1){if(t){let o;if(n.length>=D){let s=ve(n);o=i=>{let a=O(i);return!(typeof a=="number"&&Number.isNaN(a))&&s.has(a)}}else o=s=>n.some(i=>O(s)===O(i));return Array.isArray(e)?e.some(s=>o(s)):o(e)}let r=n.length>=D?(o=>s=>o.has(s))(oe(n)):o=>n.includes(o);return Array.isArray(e)?e.some(o=>r(o)):r(e)}function te(e){return e===void 0?[]:e&&typeof e=="object"&&(e.type==="list"||e.type==="hashed")&&Array.isArray(e.values)?e.values:null}function re(e,n,t,r=!1,o=new Set){if(!Array.isArray(e))return!1;for(let s=0;s<n.length;s++){let i=!1;for(let a=0;a<e.length;a++)if(V(n[s],e[a],t,r,o)){i=!0;break}if(!i)return!1}return!0}function Re(e,n,t,r,o=new Set){let s=n,i=t;switch(e){case"$veq":return y(n)===y(t);case"$vne":return y(n)!==y(t);case"$vgt":return y(n)>y(t);case"$vgte":return y(n)>=y(t);case"$vlt":return y(n)<y(t);case"$vlte":return y(n)<=y(t);case"$eq":return n===t;case"$ne":return n!==t;case"$lt":return s<i;case"$lte":return s<=i;case"$gt":return s>i;case"$gte":return s>=i;case"$exists":return t?n!=null:n==null;case"$in":return Array.isArray(t)?S(n,t):!1;case"$ini":return Array.isArray(t)?S(n,t,!0):!1;case"$inGroup":{let a=r[t],u=te(a);return u===null?!1:S(a?.type==="hashed"?B(n):n,u)}case"$notInGroup":{let a=r[t],u=te(a);return u===null?!1:!S(a?.type==="hashed"?B(n):n,u)}case"$nin":return Array.isArray(t)?!S(n,t):!1;case"$nini":return Array.isArray(t)?!S(n,t,!0):!1;case"$not":return!V(t,n,r,!1,o);case"$size":return Array.isArray(n)?V(t,n.length,r,!1,o):!1;case"$elemMatch":return Ve(n,t,r,o);case"$all":return Array.isArray(t)?re(n,t,r,!1,o):!1;case"$alli":return Array.isArray(t)?re(n,t,r,!0,o):!1;case"$regex":try{return ne(t).test(n)}catch{return!1}case"$regexi":try{return ne(t,!0).test(n)}catch{return!1}case"$type":return Ee(n)===t;default:return!1}}function ie(e,n,t,r){if(!n.length)return!0;for(let o of n)if(h(e,o,t,r))return!0;return!1}function Fe(e,n,t,r){for(let o of n)if(!h(e,o,t,r))return!1;return!0}function ue(e){return Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))}function U(e){return H(e),{context:e,stack:{evaluatedFeatures:new Set}}}function _(e){return{...e.attributes,...e.attributeOverrides}}function p(e,n,t){let r=n||"id",o="",s=_(e);return s[r]&&(o=s[r]),!o&&t&&(s[t]&&(o=s[t]),o&&(r=t)),{hashAttribute:r,hashValue:o}}function l(e,n,t){e.context.log?.(n,t)}function x(e,n){return n=n||0,`${e}__${n}`}function q(e,n){return`${e}||${n}`}function Te(e,n,t){let r=e.stickyBucketAssignmentDocs;if(!r)return{};let{hashAttribute:o,hashValue:s}=p(e,n),i=q(o,E(s)),{hashAttribute:a,hashValue:u}=p(e,t),f=u?q(a,E(u)):null,c={};return f&&r[f]&&Object.assign(c,r[f].assignments||{}),r[i]&&Object.assign(c,r[i].assignments||{}),c}function le({context:e,expKey:n,expBucketVersion:t,expHashAttribute:r,expFallbackAttribute:o,expMinBucketVersion:s,expMeta:i}){t=t||0,s=s||0,r=r||"id",i=i||[];let a=x(n,t),u=Te(e,r,o);if(s>0)for(let d=0;d<s;d++){let k=x(n,d);if(u[k]!==void 0)return{variation:-1,versionIsBlocked:!0}}let f=u[a];if(f===void 0)return{variation:-1};let c=i.findIndex(d=>d.key===f);return c<0?{variation:-1}:{variation:c}}function fe(e,n,t,r){let o=q(n,t),s=e.stickyBucketAssignmentDocs,i=s&&s[o]?s[o].assignments||{}:{},a={...i,...r},u=JSON.stringify(i)!==JSON.stringify(a);return{key:o,doc:{attributeName:n,attributeValue:t,assignments:a},changed:u}}function Ce(e,n){let t=U(n),r=ge(e,null,t);return n.onExperimentEval?.(e,r),r}function $e(e,n){return N(e,U(n))}function Oe(e){return e.forcedVariations||{}}function ce(e,n,t){let{context:r}=e;if(r.trackedExperiments){let o=ke(n,t);if(r.trackedExperiments.has(o))return;r.trackedExperiments.add(o)}G(()=>r.onExperimentViewed?.(n,t))}function Be(e,n,t){let{context:r}=e;if(r.trackedFeatureUsage){let o=JSON.stringify(t.value);if(r.trackedFeatureUsage[n]===o)return;r.trackedFeatureUsage[n]=o}G(()=>r.onFeatureUsage?.(n,t))}function G(e){try{let n=e();n&&typeof n.catch=="function"&&n.catch(()=>{})}catch{}}function N(e,n){let{context:t}=n;if(n.stack.evaluatedFeatures.has(e))return l(n,`evalFeature: circular dependency detected: ${n.stack.id} -> ${e}`,{from:n.stack.id,to:e}),m(n,e,null,"cyclicPrerequisite");n.stack.evaluatedFeatures.add(e),n.stack.id=e;let r=t.features?.[e];for(let s of r?.rules??[])K(s);let o=t.forcedFeatureValues;if(o&&o.has(e))return l(n,"Global override",{id:e,value:o.get(e)}),m(n,e,o.get(e),"override");if(!r)return l(n,"Unknown feature",{id:e}),m(n,e,null,"unknownFeature");if(r.rules){let s=new Set(n.stack.evaluatedFeatures);e:for(let i of r.rules){if(i.parentConditions)for(let f of i.parentConditions){n.stack.evaluatedFeatures=new Set(s);let c=N(f.id,n);if(c.source==="cyclicPrerequisite")return m(n,e,null,"cyclicPrerequisite");let d={value:c.value};if(!h(d,f.condition||{},t.savedGroups||{})){if(f.gate)return l(n,"Feature blocked by prerequisite",{id:e,rule:i}),m(n,e,null,"prerequisite");l(n,"Skip rule because prerequisite evaluation fails",{id:e,rule:i});continue e}}if(i.filters&&ye(i.filters,n)){l(n,"Skip rule because of filters",{id:e,rule:i});continue}if("force"in i){if(i.condition&&!de(i.condition,n)){l(n,"Skip rule because of condition ff",{id:e,rule:i});continue}if(!xe(n,i.seed||e,i.hashAttribute,t.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion)){l(n,"Skip rule because user not included in rollout",{id:e,rule:i});continue}return l(n,"Force value from rule",{id:e,rule:i}),i.tracks&&i.tracks.forEach(f=>{ce(n,f.experiment,f.result)}),m(n,e,i.force,"force",i.id)}if(!i.variations){l(n,"Skip invalid rule",{id:e,rule:i});continue}let a={variations:i.variations,key:i.key||e};"coverage"in i&&(a.coverage=i.coverage),i.weights&&(a.weights=i.weights),i.hashAttribute&&(a.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(a.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(a.disableStickyBucketing=i.disableStickyBucketing),i.bucketVersion!==void 0&&(a.bucketVersion=i.bucketVersion),i.minBucketVersion!==void 0&&(a.minBucketVersion=i.minBucketVersion),i.meta&&(a.meta=i.meta),i.ranges&&(a.ranges=i.ranges),i.name&&(a.name=i.name),i.phase&&(a.phase=i.phase),i.seed&&(a.seed=i.seed),i.hashVersion&&(a.hashVersion=i.hashVersion),i.filters&&(a.filters=i.filters),i.condition&&(a.condition=i.condition);let u=ge(a,e,n);if(t.onExperimentEval?.(a,u),u.inExperiment&&!u.passthrough)return m(n,e,u.value,"experiment",i.id,a,u)}}return l(n,"Use default value",{id:e,value:r.defaultValue}),m(n,e,r.defaultValue===void 0?null:r.defaultValue,"defaultValue")}function ge(e,n,t){let{context:r}=t;K(e);let o=e.key,s=e.variations.length;if(s<2)return l(t,"Invalid experiment",{id:o}),g(t,e,-1,!1,n);if(r.enabled===!1)return l(t,"Context disabled",{id:o}),g(t,e,-1,!1,n);if(e.urlPatterns&&!j(r.url||"",e.urlPatterns))return l(t,"Skip because of url targeting",{id:o}),g(t,e,-1,!1,n);let i=z(o,r.url||"",s);if(i!==null)return l(t,"Force via querystring",{id:o,variation:i}),g(t,e,i,!1,n);let u=Oe(r)[o];if(u!==void 0)return l(t,"Force via dev tools",{id:o,variation:u}),g(t,e,u,!1,n);if(e.active===!1)return l(t,"Skip because inactive",{id:o}),g(t,e,-1,!1,n);let{hashAttribute:f,hashValue:c}=p(r,e.hashAttribute,r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!c)return l(t,"Skip because missing hashAttribute",{id:o}),g(t,e,-1,!1,n);let d=-1,k=!1,R=!1;if(r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{variation:b,versionIsBlocked:v}=le(ue({context:r,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta}));k=b>=0,d=b,R=!!v}if(!k){if(e.filters&&ye(e.filters,t))return l(t,"Skip because of filters",{id:o}),g(t,e,-1,!1,n);if(e.include&&!X(e.include))return l(t,"Skip because of include function",{id:o}),g(t,e,-1,!1,n);if(e.condition&&!de(e.condition,t))return l(t,"Skip because of condition exp",{id:o}),g(t,e,-1,!1,n);if(e.parentConditions){let b=new Set(t.stack.evaluatedFeatures);for(let v of e.parentConditions){t.stack.evaluatedFeatures=new Set(b);let w=N(v.id,t);if(w.source==="cyclicPrerequisite")return g(t,e,-1,!1,n);let P={value:w.value};if(!h(P,v.condition||{},r.savedGroups||{}))return l(t,"Skip because prerequisite evaluation fails",{id:o}),g(t,e,-1,!1,n)}}}let A=C(e.seed||o,c,e.hashVersion??2);if(A===null)return l(t,"Skip because of invalid hash version",{id:o}),g(t,e,-1,!1,n);if(!k){let b=e.ranges||Q(s,e.coverage===void 0?1:e.coverage,e.weights);d=W(A,b)}if(R)return l(t,"Skip because sticky bucket version is blocked",{id:o}),g(t,e,-1,!1,n,void 0,!0);if(d<0)return l(t,"Skip because of coverage",{id:o}),g(t,e,-1,!1,n);if("force"in e)return l(t,"Force variation",{id:o,variation:e.force}),g(t,e,e.force===void 0?-1:e.force,!1,n);if(r.qaMode)return l(t,"Skip because QA mode",{id:o}),g(t,e,-1,!1,n);let F=g(t,e,d,!0,n,A,k);if(r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{changed:b,key:v,doc:w}=fe(r,f,E(c),{[x(e.key,e.bucketVersion)]:F.key});if(b){r.stickyBucketAssignmentDocs=r.stickyBucketAssignmentDocs||{},r.stickyBucketAssignmentDocs[v]=w;let P=r.saveStickyBucketAssignmentDoc;G(()=>P(w))}}return ce(t,e,F),l(t,"In experiment",{id:o,variation:F.variationId}),F}function m(e,n,t,r,o,s,i){let a={value:t,on:!!t,off:!t,source:r,ruleId:o||""};return s&&(a.experiment=s),i&&(a.experimentResult=i),r!=="override"&&Be(e,n,a),a}function de(e,n){return h(_(n.context),e,n.context.savedGroups||{})}function ye(e,n){return e.some(t=>{let{hashValue:r}=p(n.context,t.attribute);if(!r)return!0;let o=C(t.seed,r,t.hashVersion||2);return o===null?!0:!t.ranges.some(s=>$(o,s))})}function xe(e,n,t,r,o,s,i){if(!o&&s===void 0)return!0;if(!o&&s===0)return!1;let{hashValue:a}=p(e.context,t,r);if(!a)return!1;let u=C(n,a,i??2);return u===null?!1:o?$(u,o):s!==void 0?u<=s:!0}function g(e,n,t,r,o,s,i){let a=!0;(t<0||t>=n.variations.length)&&(t=0,a=!1);let{hashAttribute:u,hashValue:f}=p(e.context,n.hashAttribute,e.context.saveStickyBucketAssignmentDoc&&!n.disableStickyBucketing?n.fallbackAttribute:void 0),c=n.meta?.[t]??{},d=n.variations[0];for(let[R,A]of n.variations.entries())if(R===t){d=A;break}let k={key:c.key||""+t,featureId:o,inExperiment:a,hashUsed:r,variationId:t,value:d,hashAttribute:u,hashValue:f,stickyBucketUsed:!!i};return c.name&&(k.name=c.name),s!==void 0&&(k.bucket=s),c.passthrough&&(k.passthrough=c.passthrough),k}function ke(e,n){return n.hashAttribute+n.hashValue+e.key+n.variationId}export{E as a,j as b,Ae as c,h as d,Ce as e,$e as f,ke as g};
|
|
2
|
+
/*! For license information please see chunk-A5KU4MMN.js.LEGAL.txt */
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
Copyright (c) 2025 GrowthBook, Inc.
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
5
|
+
furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all
|
|
8
|
+
copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
14
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
+
SOFTWARE.
|
|
17
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ye,b as we}from"./chunk-N3PZMMOO.js";import{d as pe,e as $}from"./chunk-OPUIFAQS.js";import{a as fe}from"./chunk-ZDIWOE4Q.js";import{a as P}from"./chunk-DSPLGTQI.js";var Ce=5*6e4,Ae=15e3,ge=new WeakMap;function Oe(i){return ge.get(i)}var C=i=>Array.isArray(i)?i.map(C):i&&typeof i=="object"?Object.fromEntries(Object.keys(i).sort().map(n=>[n,C(i[n])])):i,R=(i,n)=>JSON.stringify(C(i))===JSON.stringify(C(n)),me=i=>JSON.stringify(C([i.funnelId,i.locale??null,i.parameters??{}])),Ee=["onObservationChange","onPurchase","onCheckoutUrl","resumeCheckout","allowNewPurchase","checkoutNavigation","terminateCheckout","purchaseConfirmation","confirmOnHostedCheckout","resolveOfferId","resolveSubscriptionChange","onOpenUrl","onEvent","onAction","onComplete","onError"];function Fe(i,n){let z=e=>structuredClone({funnelId:e.funnelId,locale:e.locale,parameters:e.parameters}),y,Q="",Y=n.start instanceof Promise?void 0:z(n.start),D=e=>e?.parameters?.commerce,Z=Promise.resolve(n.start).then(e=>e?z(e):void 0),M=n.maxAgeMs??Ce,ee=new AbortController,p=AbortSignal.any([ee.signal,n.client.identitySignal,...n.signal?[n.signal]:[]]),q=()=>o("released","aborted"),t="preparing",ne,_,x=()=>{},V=0,h=null,m=null,g=null,u=null,b,L,ae=new Map,f=null,O=new Set,S=new Map,j,te=new Promise(e=>j=e),T,he=new Promise(e=>T=e);function F(e,a){t!==e&&(t=e,ne=a,P(n.onState,e))}function be(){p.removeEventListener("abort",q),H(),m?.destroy(),m=null,h?.remove(),h=null,g=null}function o(e,a){["adopted","unavailable","released","closed"].includes(t)||(F(e,a),be(),j(!1),T(null))}let J=e=>`error:${e?.code??e?.name??"unknown"}`,U=i.ownerDocument.defaultView,A=!0,re=null,I=!1,ve=e=>e.storageArea===U?.localStorage&&(e.key===null||e.key.startsWith("indiana.funnel.purchases.")),oe=e=>{ve(e)&&N()},Pe=n.client.subscribe(()=>N());function H(){A&&(A=!1,U?.removeEventListener("storage",oe),Pe(),x())}let G=()=>A&&(t==="ready"||t==="preparing");function W(e){(t==="ready"||t==="preparing")&&o("unavailable",e)}function N(){if(t==="ready"&&Date.now()-V>=M)return H();I=!0,re??=(async()=>{for(;I&&y&&G();){I=!1;try{await n.client.retained()==="pending"&&W("purchase_pending")}catch(e){p.aborted?o("released","aborted"):W(J(e))}}})().finally(()=>{re=null,I&&y&&G()&&N()})}U?.addEventListener("storage",oe),p.addEventListener("abort",q,{once:!0});let le=n.client.findPurchase();le.catch(()=>{});let E;function K(e){let a=JSON.stringify(C(e)),r=ae.get(a);return r||(r=n.client.readPaywall({paywallVersionId:E?.paywallVersionId??n.paywallVersionId??u?.id,...E?.paywallVersionId||n.paywallVersionId||u?{}:{paywallId:E?.paywallId??n.paywallId},...e}),ae.set(a,r)),r}function B(e){let a=Object.values(e.capabilities.plans);return!(Object.values(e.document.buttons).some(c=>c.type==="checkout")&&a.length===0)&&!a.some(c=>!c.available)}function ie(e,a){if(u&&!$(e,u))return o("unavailable","paywall_changed"),!1;u=e,L=a;for(let r of S.keys())P(r,structuredClone(e));return!0}async function k(){let e=await he;if(!e)throw new fe("PURCHASE_PENDING","The purchase did not start; open it again");return e}let Se={get view(){return f?f.view:u},get signal(){return f?.signal??n.client.identitySignal},get quote(){return f?.quote??null},get operation(){return f?.operation??null},webViewUrl:"bundled",get canReselect(){return f?.canReselect},get recovery(){return f?.recovery},get pendingCancellation(){return f?.pendingCancellation},subscribe(e){return S.set(e,f?.subscribe?.(e)??(()=>{})),()=>{S.get(e)?.(),S.delete(e)}},refresh:async()=>f?f.refresh():structuredClone(u),preview:async e=>(await k()).preview(e),confirm:async()=>(await k()).confirm(),cancel:async()=>(await k()).cancel(),read:async()=>(await k()).read(),destroy(){f?.destroy()}},s={options:{},handoff:{}},se={loading:"host",focusAtReveal:!0,signal:n.client.identitySignal,start:async()=>Se,canInteract:()=>s.options.canInteract?s.options.canInteract():!["unavailable","released","closed"].includes(t),async beforeAction(){let e=t!=="adopted",a=u?.capabilities,r=await k();if(e&&!R(r.view?.capabilities,a))throw new pe;await s.options.beforeAction?.()}};for(let e of Ee)Object.defineProperty(se,e,{enumerable:!0,get:()=>s.options[e]});function X(){t!=="preparing"||!g||!m||!y||!R(L?.commerce,D(y))||L?.locale!==y.locale||(F("ready"),j(!0))}let ce={present(e){if(s.handoff.present)return s.handoff.present(e);t==="preparing"&&(g=e,V=Date.now(),X())},async dismiss(){if(s.handoff.dismiss)return s.handoff.dismiss();o("closed");for(let e of[...O])P(e)},async closeAction(e){if(s.handoff.closeAction)return s.handoff.closeAction(e);s.options.onAction?await s.options.onAction(e):await ce.dismiss()},quoteError(e){s.handoff.quoteError?s.handoff.quoteError(e):P(s.options.onError,e)}};async function Ie(){if(n.paywallVersionId||n.paywallId)return{paywallVersionId:n.paywallVersionId,paywallId:n.paywallId};let e=n.configuration;if(!e)return o("unavailable","paywall_missing"),null;let a=await Promise.resolve(n.start).catch(()=>null);if(!a||t!=="preparing")return null;let r=()=>ye(e,{funnelId:a.funnelId,customerId:n.client.customerId,parameters:a.parameters??{}});if(_=await r(),t!=="preparing")return null;let c=_;if(c.type!=="paywall")return o("unavailable",we(c)??"route"),null;let l=!1;return x=e.subscribe(()=>{l||!G()||(l=!0,r().then(d=>{!(d.type==="unavailable"&&!["funnel_stopped","route_unavailable"].includes(d.reason))&&(d.type!=="paywall"||d.paywallVersionId!==c.paywallVersionId)&&W("route_changed")}).finally(()=>l=!1))}),A||x(),{paywallVersionId:c.paywallVersionId}}(async()=>{try{let[{showPaywall:e},a]=await Promise.all([import("./paywall-C5TM2TXD.js"),Ie()]);if(p.throwIfAborted(),t!=="preparing"||!a)return;let r=n.commerce??D(Y),c=n.locale??Y?.locale;if(!r)return o("unavailable","commerce_missing");if(!c)return o("unavailable","locale_missing");E=a;let l={commerce:r,locale:c},d=await K(l);if(p.throwIfAborted(),t!=="preparing"||(!B(d)&&n.start instanceof Promise&&!b&&await Z,b&&!R(l,b)&&(l=b,d=await K(l)),p.throwIfAborted(),t!=="preparing"))return;if(!B(d))return o("unavailable","plan_unavailable");if(!ie(d,l))return;h=i.ownerDocument.createElement("div"),i.append(h);let v=setTimeout(()=>t==="preparing"&&o("unavailable","timeout"),Ae);te.then(()=>clearTimeout(v));let w=await e(h,se,ce);if(!w.host||p.aborted||t!=="preparing"){w.host?.destroy(),o(p.aborted?"released":"unavailable","error");return}m=w.host,X()}catch(e){o(p.aborted?"released":"unavailable",J(e))}})(),Z.then(async e=>{if(!e)return o("unavailable","gated");let a=e,r=D(a),c=n.commerce??r;if(!R(r&&{...r,intent:void 0},c&&{...c,intent:void 0})||n.locale!==void 0&&a.locale!==n.locale)return o("unavailable","start_mismatch");if(!r)return o("unavailable","commerce_missing");b={commerce:r,locale:a.locale};try{let l=await le,d=l==="pending"?"purchase_pending":l==="found"?"original_purchase":l==="blocked"?"purchase_blocked":void 0;if(d)return o("unavailable",d);if(t!=="preparing")return;if(A&&(I=!1,await n.client.retained()==="pending"))return o("unavailable","purchase_pending");if(E||n.paywallId||n.paywallVersionId||u){let v=await K(b);if(p.throwIfAborted(),t!=="preparing")return;if(u){if(!B(v))return o("unavailable","plan_unavailable");if(!ie(v,b))return}}}catch(l){return o(p.aborted?"released":"unavailable",J(l))}t==="preparing"&&(y=a,Q=me(a),X(),I&&N())},()=>o("unavailable","gated"));let de={get state(){return t},get reason(){return ne},ready:te,get start(){return y},get prediction(){return _?structuredClone(_):void 0},matches:e=>!!y&&me(e)===Q,open(){if(t==="preparing")return"pending";if(t!=="ready"||!g)return!1;if(Date.now()-V>=M)return o("unavailable","expired"),!1;let e=g;return g=null,H(),F("shown"),e(),"shown"},destroy(){ee.abort()}};return ge.set(de,{onClose(e){return t==="closed"?(P(e),()=>{}):(O.add(e),()=>{O.delete(e)})},claim(){H()},async adopt(e,a){let r=e.paywall?.resolution,c=e.paywall&&!e.paywall.quote&&!e.paywall.operation&&!e.paywall.purchaseRequestId&&!(e.paywall.selectionGeneration??0);if(t!=="shown"||!m||!u||!r||!c||e.source.id!==y?.funnelId||e.locale!==y?.locale||!R(e.parameters??{},y?.parameters??{})||!["running","waiting"].includes(e.status)||!$(r,u))return null;let l;try{l=await a.start()}catch{return null}if(t!=="shown"||!m)return l.destroy(),null;f=l,s.options=a.options,s.handoff=a.handoff;for(let[w]of S)S.set(w,l.subscribe?.(w)??(()=>{})),l.view&&P(w,structuredClone(l.view));p.removeEventListener("abort",q),F("adopted"),T(l),O.clear();let d=m,v=h;return m=null,h=null,g=null,new Proxy(d,{get(w,ue){return ue==="destroy"?()=>{w.destroy(),v?.remove()}:Reflect.get(w,ue,w)}})},get modal(){return u?.document.presentation.type!=="inline"},get revealable(){return t==="ready"&&!!g&&Date.now()-V<M},release(){o("released")}}),de}export{Ce as a,Oe as b,Fe as c};
|