@tinkerlandai/longplay-sdk 0.10.8 → 0.10.11
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 +15 -0
- package/README.md +38 -2
- package/README.zh-CN.md +2 -0
- package/dist/{ai-usage-Btwg1nD7.d.ts → ai-usage-C-OZBxgW.d.ts} +1 -1
- package/dist/{api-5gAz4-Sb.d.ts → api-Bf_aRlXs.d.ts} +82 -0
- package/dist/chunk-33FQUT3Z.js +179 -0
- package/dist/chunk-4B5G3ZVV.js +4 -0
- package/dist/chunk-4C5XH3T3.js +1 -0
- package/dist/chunk-7DUOIHRD.js +6 -0
- package/dist/chunk-7RDYCTR4.js +1 -0
- package/dist/chunk-CDG7GM4C.js +1 -0
- package/dist/chunk-GDFBOM3V.js +1 -0
- package/dist/chunk-JGFAFQKK.js +1 -0
- package/dist/chunk-OZZMZH7X.js +1 -0
- package/dist/chunk-PYIHBK7E.js +1 -0
- package/dist/chunk-QHJAF5T2.js +1 -0
- package/dist/chunk-VSJOHWDL.js +17 -0
- package/dist/chunk-VSMITXQD.js +1 -0
- package/dist/chunk-ZYQPKGJM.js +1 -0
- package/dist/{configuration-sync-CywDxRkX.d.ts → configuration-sync-D2n_gGj6.d.ts} +1 -0
- package/dist/content-YQ7IJ47M.js +1 -0
- package/dist/{funnel-local-client-B4Z3dvNf.d.ts → funnel-local-client-DJq2K7an.d.ts} +8869 -93
- package/dist/{funnel-node-evaluation-P5B4fPfJ.d.ts → funnel-node-evaluation-CJSkUkbv.d.ts} +36 -0
- package/dist/{funnel-resource-client-BhbXsB2q.d.ts → funnel-process-client-C_UhTH8g.d.ts} +5132 -41
- package/dist/funnel-runtime-host-K2SXD2R2.js +1 -0
- package/dist/index.d.ts +102 -77
- package/dist/index.js +1 -1
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.d.ts +2 -2
- package/dist/openrouter.js +1 -1
- package/dist/page.d.ts +1 -1
- package/dist/page.js +1 -1
- package/dist/paywall-PJEMTVSZ.js +1 -0
- package/dist/popup.js +1 -1
- package/dist/react-native.d.ts +109 -106
- package/dist/react-native.js +1 -1
- package/dist/screen-renderer-NHJ6OQTF.js +1 -0
- package/dist/server.d.ts +10677 -25
- package/dist/server.js +1 -1
- package/dist/{visual-dom-OIXANRP3.js → visual-dom-7IF7ITAK.js} +1 -1
- package/dist/visual.js +1 -1
- package/package.json +10 -9
- package/dist/chunk-5JJZSH23.js +0 -179
- package/dist/chunk-5ZS3TNC4.js +0 -1
- package/dist/chunk-7DXL3LHT.js +0 -1
- package/dist/chunk-7XVAFQEE.js +0 -1
- package/dist/chunk-ACF2FBUB.js +0 -1
- package/dist/chunk-CBVZUTNH.js +0 -1
- package/dist/chunk-DCV6IS2Z.js +0 -4
- package/dist/chunk-EI2VRDYJ.js +0 -1
- package/dist/chunk-G56XGVMS.js +0 -1
- package/dist/chunk-GJRXHH6G.js +0 -1
- package/dist/chunk-R26BYN3U.js +0 -1
- package/dist/chunk-RP2P3FU4.js +0 -1
- package/dist/chunk-SBPTOOYB.js +0 -1
- package/dist/chunk-U4UEOR5W.js +0 -6
- package/dist/chunk-XSVQHPQT.js +0 -17
- package/dist/content-XXVHMKKL.js +0 -1
- package/dist/funnel-runtime-host-PBJ63LOE.js +0 -1
- package/dist/paywall-CDR4GZMX.js +0 -1
- package/dist/screen-renderer-NLB3FAQJ.js +0 -1
- /package/dist/{chunk-AK3IJ6FZ.js → chunk-OJM6ORHE.js} +0 -0
package/dist/chunk-XSVQHPQT.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
function P(e){let t=2166136261,n=e.length;for(let r=0;r<n;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}function R(e,t,n){return n===2?P(P(e+t)+"")%1e4/1e4:null}function oe(e){return e<=0?[]:new Array(e).fill(1/e)}function C(e,t){return e>=t[0]&&e<t[1]}function K(e,t){for(let[n,r]of t.entries())if(C(e,r))return n;return-1}function G(e,t,n){t=t===void 0?1:t,t<0?t=0:t>1&&(t=1);let r=oe(e);n=n||r,n.length!==e&&(n=r);let o=n.reduce((a,u)=>u+a,0);(o<.99||o>1.01)&&(n=r);let i=0,s=t;return n.map(a=>{let u=i;return i+=a,[u,u+s*a]})}function N(e,t,n){if(!t)return null;let r=t.split("?")[1];if(!r)return null;let i=r.replace(/#.*/,"").split("&").map(s=>s.split("=",2)).filter(([s])=>s===e).map(([,s])=>s===void 0?NaN:parseInt(s))[0];return i!==void 0&&i>=0&&i<n?i:null}function M(e){try{return e()}catch{return!1}}function T(e){return typeof e=="string"?e:JSON.stringify(e)}function g(e){typeof e=="number"&&(e=e+""),(!e||typeof e!="string")&&(e="0");let t=e.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return t.length===3&&t.push("~"),t.map(n=>n.match(/^[0-9]+$/)?n.padStart(5," "):n).join("-")}function se(e){try{let t=e.replace(/([^\\])\//g,"$1\\/");return new RegExp(t)}catch{return}}function I(e,t){if(!t.length)return!1;let n=!1,r=!1;for(let o of t){let i=De(e,o.type,o.pattern);if(o.include===!1){if(i)return!1}else n=!0,i&&(r=!0)}return r||!n}function Ue(e,t,n){try{let r=t.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return n&&(r="\\/?"+r.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+r+"$","i").test(e)}catch{return!1}}function _e(e,t){try{let n=new URL(t.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),r=[[e.host,n.host,!1],[e.pathname,n.pathname,!0]];return n.hash&&r.push([e.hash,n.hash,!1]),n.searchParams.forEach((o,i)=>{r.push([e.searchParams.get(i)||"",o,!1])}),!r.some(o=>!Ue(o[0],o[1],o[2]))}catch{return!1}}function De(e,t,n){try{let r=new URL(e,"https://_");if(t==="regex"){let o=se(n);return o?o.test(r.href)||o.test(r.href.substring(r.origin.length)):!1}else if(t==="simple")return _e(r,n);return!1}catch{return!1}}function q(e){for(let n of["namespace","status","url","groups"])if(Object.hasOwn(e,n))throw new TypeError(`Retired experiment field: ${n}`);let t=e;if(t.hashVersion!==void 0&&t.hashVersion!==2)throw new TypeError("Only hash version 2 is supported");if(t.filters?.some(n=>n.hashVersion!==2))throw new TypeError("Only hash version 2 is supported")}function O(e){for(let t of Object.values(e)){if(Array.isArray(t))throw new TypeError("Saved groups require typed list or condition entries");if(t&&Object.hasOwn(t,"useEmptyListGroup"))throw new TypeError("Retired saved group field: useEmptyListGroup")}}function ie(e){for(let t of["overrides","groups"])if(Object.hasOwn(e,t))throw new TypeError(`Retired evaluation context field: ${t}`);O(e.savedGroups??{})}var je=e=>e/2**32|0,Pe=e=>e>>>0;function ae(e,t,n,r){let o=je(n),i=Pe(n);e.setUint32(t,r?i:o,r),e.setUint32(t+4,r?o:i,r)}function ue(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var W=e=>e?`"${e}" `:"";function Ke(e,t=""){if(typeof e!="number")throw new TypeError(W(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(W(t)+"expected integer >= 0, got "+e);return e}function $(e,t,n=""){if(ue(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Ke(t,"length");let r=ue(e),o=t!==void 0?` of length ${t}`:"",i=r?`length=${e.length}`:`type=${typeof e}`,s=W(n)+"expected Uint8Array"+o+", got "+i;throw r?new RangeError(s):new TypeError(s)}var Ge=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError((t==="object"?"":`"${t}" `)+"expected object, got type="+typeof e)},ce=(e,t)=>{Ge(e,t);let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw new TypeError(`"${t}" expected plain object`);if(Object.hasOwn(e,"__proto__"))throw new TypeError(`"${t}.__proto__" is not allowed`)};function J(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function fe(e,t){$(e,void 0,"output");let n=t.outputLen;if(!(e.length>=n))throw new RangeError('"output" expected length >= '+n)}function Q(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function H(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function x(e,t){return e<<32-t|e>>>t}var Ne=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Me=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function le(e){if($(e),Ne)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Me[e[n]];return t}function Ie(e,t,n="opts"){return ce(e,"defaults"),t!==void 0&&ce(t,n),Object.assign(Object.create(null),e,t)}function de(e,t={}){if(typeof e!="function")throw new TypeError('"hashCons" expected function, got type='+typeof e);t=Ie({},t,"info");let n=(o,i)=>e(i).update(o).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=o=>e(o),Object.assign(n,t),Object.freeze(n)}var he=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function be(e,t,n){return e&t^~e&n}function ge(e,t,n){return e&t^e&n^t&n}var L=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,n,r,o){this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=H(this.buffer)}update(t){J(this),$(t);let{view:n,buffer:r,blockLen:o}=this,i=t.length,s=!1;for(let a=0;a<i;){let u=Math.min(o-this.pos,i-a);if(u===o){let f=H(t);for(;o<=i-a;a+=o)this.process(f,a);s=!0;continue}r.set(a===0&&u===i?t:t.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===o&&(this.process(n,0),this.pos=0,s=!0)}return this.length+=t.length,s&&this.roundClean(),this}digestInto(t){J(this),fe(t,this),this.finished=!0;let{buffer:n,view:r,blockLen:o,isLE:i}=this,{pos:s}=this;n[s++]=128,n.fill(0,s),this.padOffset>o-s&&(this.process(r,0),n.fill(0)),ae(r,o-8,this.length*8,i),this.process(r,0),this.roundClean();let a=t===n?r:H(t),u=this.outputLen,f=u/4,d=this.get();if(u%4||f>d.length)throw new Error("invalid outputLen");for(let c=0;c<f;c++)a.setUint32(4*c,d[c],i)}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let r=t.slice(0,n);return this.destroy(),r}_cloneIntoMeta(t){let{buffer:n,length:r,finished:o,destroyed:i,pos:s}=this;return t.destroyed=i,t.finished=o,t.length=r,t.pos=s,s&&t.buffer.set(n),t}clone(){return this._cloneInto()}},pe=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var qe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),S=new Uint32Array(64),X=class extends L{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(t,n){super(64,t,8,!1),this.A=n[0]|0,this.B=n[1]|0,this.C=n[2]|0,this.D=n[3]|0,this.E=n[4]|0,this.F=n[5]|0,this.G=n[6]|0,this.H=n[7]|0}get(){let{A:t,B:n,C:r,D:o,E:i,F:s,G:a,H:u}=this;return[t,n,r,o,i,s,a,u]}set(t,n,r,o,i,s,a,u){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=i|0,this.F=s|0,this.G=a|0,this.H=u|0}_cloneInto(t){return(t||=new this.constructor).set(...this.get()),this._cloneIntoMeta(t)}process(t,n){for(let c=0;c<16;c++,n+=4)S[c]=t.getUint32(n,!1);for(let c=16;c<64;c++){let h=S[c-15],p=S[c-2],k=x(h,7)^x(h,18)^h>>>3,m=x(p,17)^x(p,19)^p>>>10;S[c]=m+S[c-7]+k+S[c-16]|0}let{A:r,B:o,C:i,D:s,E:a,F:u,G:f,H:d}=this;for(let c=0;c<64;c++){let h=x(a,6)^x(a,11)^x(a,25),p=d+h+be(a,u,f)+qe[c]+S[c]|0,m=(x(r,2)^x(r,13)^x(r,22))+ge(r,o,i)|0;d=f,f=u,u=a,a=s+p|0,s=i,i=o,o=r,r=p+m|0}r=r+this.A|0,o=o+this.B|0,i=i+this.C|0,s=s+this.D|0,a=a+this.E|0,u=u+this.F|0,f=f+this.G|0,d=d+this.H|0,this.set(r,o,i,s,a,u,f,d)}roundClean(){Q(S)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Q(this.buffer)}},z=class extends X{constructor(){super(32,pe)}};var xe=de(()=>new z,he(1));var ye=new Map,Y=32,ke=new WeakMap,me=new WeakMap;function We(e){return le(xe(new TextEncoder().encode(String(e))))}var _=e=>Array.isArray(e)?e.map(_):typeof e=="string"||typeof e=="number"?We(e):null,U=e=>typeof e=="string"?e.toLowerCase():e;function ve(e){let t=ke.get(e);return t||(t=new Set(e),ke.set(e,t)),t}function Je(e){let t=me.get(e);return t||(t=new Set(e.map(U)),me.set(e,t)),t}function Qe(e){O(e);for(let t of Object.values(e)){let n=t?.type==="list"||t?.type==="hashed"?t.values:null;n&&n.length>=Y&&ve(n)}return e}function y(e,t,n,r){n=n||{},r||O(n),r=r||new Set;for(let[o,i]of Object.entries(t))switch(o){case"$or":if(!Ee(e,i,n,r))return!1;break;case"$nor":if(Ee(e,i,n,r))return!1;break;case"$and":if(!et(e,i,n,r))return!1;break;case"$not":if(y(e,i,n,r))return!1;break;case"$savedGroup":if(!Xe(e,i,n,r))return!1;break;default:if(!V(i,Be(e,o),n,!1,r))return!1}return!0}function Xe(e,t,n,r){if(!t||typeof t!="object"||Array.isArray(t))return!1;let{id:o,attributeKey:i}=t;if(typeof o!="string"||r.has(o)||i!==void 0&&typeof i!="string")return!1;let s=n[o];if(!s||Array.isArray(s)||typeof s!="object")return!1;let a=new Set(r).add(o);if(s.type==="list"||s.type==="hashed"){let u=i??s.attributeKey;if(typeof u!="string"||!Array.isArray(s.values))return!1;let f=Be(e,u);return v(s.type==="hashed"?_(f):f,s.values)}return s.type==="condition"?!s.condition||typeof s.condition!="object"?!1:y(e,s.condition,n,a):!1}function Be(e,t){let n=t.split("."),r=e;for(let o of n)if(r&&typeof r=="object"&&o in r)r=r[o];else return null;return r}function we(e,t=!1){let n=`${e}${t?"/i":""}`,r=ye.get(n);return r||(r=new RegExp(e.replace(/([^\\])\//g,"$1\\/"),t?"i":void 0),ye.set(n,r)),r}function V(e,t,n,r=!1,o=new Set){if(typeof e=="string")return r?String(t).toLowerCase()===e.toLowerCase():t+""===e;if(typeof e=="number")return t*1===e;if(typeof e=="boolean")return t!==null&&!!t===e;if(e===null)return t===null;if(Array.isArray(e)||!Te(e))return JSON.stringify(t)===JSON.stringify(e);let i=e;for(let s in i)if(!Ze(s,t,i[s],n,o))return!1;return!0}function Te(e){let t=Object.keys(e);return t.length>0&&t.filter(n=>n[0]==="$").length===t.length}function ze(e){if(e===null)return"null";if(Array.isArray(e))return"array";let t=typeof e;return["string","number","boolean","object","undefined"].includes(t)?t:"unknown"}function Ye(e,t,n,r){if(!Array.isArray(e))return!1;let o=Te(t)?i=>V(t,i,n,!1,r):i=>y(i,t,n,r);for(let i=0;i<e.length;i++)if((e[i]??null)!==null&&o(e[i]))return!0;return!1}function v(e,t,n=!1){if(n){let o;if(t.length>=Y){let i=Je(t);o=s=>{let a=U(s);return!(typeof a=="number"&&Number.isNaN(a))&&i.has(a)}}else o=i=>t.some(s=>U(i)===U(s));return Array.isArray(e)?e.some(i=>o(i)):o(e)}let r=t.length>=Y?(o=>i=>o.has(i))(ve(t)):o=>t.includes(o);return Array.isArray(e)?e.some(o=>r(o)):r(e)}function Se(e){return e===void 0?[]:e&&typeof e=="object"&&(e.type==="list"||e.type==="hashed")&&Array.isArray(e.values)?e.values:null}function Ae(e,t,n,r=!1,o=new Set){if(!Array.isArray(e))return!1;for(let i=0;i<t.length;i++){let s=!1;for(let a=0;a<e.length;a++)if(V(t[i],e[a],n,r,o)){s=!0;break}if(!s)return!1}return!0}function Ze(e,t,n,r,o=new Set){let i=t,s=n;switch(e){case"$veq":return g(t)===g(n);case"$vne":return g(t)!==g(n);case"$vgt":return g(t)>g(n);case"$vgte":return g(t)>=g(n);case"$vlt":return g(t)<g(n);case"$vlte":return g(t)<=g(n);case"$eq":return t===n;case"$ne":return t!==n;case"$lt":return i<s;case"$lte":return i<=s;case"$gt":return i>s;case"$gte":return i>=s;case"$exists":return n?t!=null:t==null;case"$in":return Array.isArray(n)?v(t,n):!1;case"$ini":return Array.isArray(n)?v(t,n,!0):!1;case"$inGroup":{let a=r[n],u=Se(a);return u===null?!1:v(a?.type==="hashed"?_(t):t,u)}case"$notInGroup":{let a=r[n],u=Se(a);return u===null?!1:!v(a?.type==="hashed"?_(t):t,u)}case"$nin":return Array.isArray(n)?!v(t,n):!1;case"$nini":return Array.isArray(n)?!v(t,n,!0):!1;case"$not":return!V(n,t,r,!1,o);case"$size":return Array.isArray(t)?V(n,t.length,r,!1,o):!1;case"$elemMatch":return Ye(t,n,r,o);case"$all":return Array.isArray(n)?Ae(t,n,r,!1,o):!1;case"$alli":return Array.isArray(n)?Ae(t,n,r,!0,o):!1;case"$regex":try{return we(n).test(t)}catch{return!1}case"$regexi":try{return we(n,!0).test(t)}catch{return!1}case"$type":return ze(t)===n;default:return!1}}function Ee(e,t,n,r){if(!t.length)return!0;for(let o of t)if(y(e,o,n,r))return!0;return!1}function et(e,t,n,r){for(let o of t)if(!y(e,o,n,r))return!1;return!0}function Z(e){return ie(e),{context:e,stack:{evaluatedFeatures:new Set}}}function ee(e){return{...e.attributes,...e.attributeOverrides}}function A(e,t,n){let r=t||"id",o="",i=ee(e);return i[r]&&(o=i[r]),!o&&n&&(i[n]&&(o=i[n]),o&&(r=n)),{hashAttribute:r,hashValue:o}}function l(e,t,n){e.context.log?.(t,n)}function D(e,t){return t=t||0,`${e}__${t}`}function te(e,t){return`${e}||${t}`}function tt(e,t,n){let r=e.stickyBucketAssignmentDocs;if(!r)return{};let{hashAttribute:o,hashValue:i}=A(e,t),s=te(o,T(i)),{hashAttribute:a,hashValue:u}=A(e,n),f=u?te(a,T(u)):null,d={};return f&&r[f]&&Object.assign(d,r[f].assignments||{}),r[s]&&Object.assign(d,r[s].assignments||{}),d}function Fe({context:e,expKey:t,expBucketVersion:n,expHashAttribute:r,expFallbackAttribute:o,expMinBucketVersion:i,expMeta:s}){n=n||0,i=i||0,r=r||"id",s=s||[];let a=D(t,n),u=tt(e,r,o);if(i>0)for(let c=0;c<i;c++){let h=D(t,c);if(u[h]!==void 0)return{variation:-1,versionIsBlocked:!0}}let f=u[a];if(f===void 0)return{variation:-1};let d=s.findIndex(c=>c.key===f);return d<0?{variation:-1}:{variation:d}}function Re(e,t,n,r){let o=te(t,n),i=e.stickyBucketAssignmentDocs,s=i&&i[o]?i[o].assignments||{}:{},a={...s,...r},u=JSON.stringify(s)!==JSON.stringify(a);return{key:o,doc:{attributeName:t,attributeValue:n,assignments:a},changed:u}}function Ce(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function nt(e,t){let n=Z(t),r=Oe(e,null,n);return t.onExperimentEval?.(e,r),r}function rt(e,t){return re(e,Z(t))}function ot(e){return e.forcedVariations||{}}function Ve(e,t,n){let{context:r}=e;if(r.trackedExperiments){let o=Le(t,n);if(r.trackedExperiments.has(o))return;r.trackedExperiments.add(o)}ne(()=>r.onExperimentViewed?.(t,n))}function st(e,t,n){let{context:r}=e;if(r.trackedFeatureUsage){let o=JSON.stringify(n.value);if(r.trackedFeatureUsage[t]===o)return;r.trackedFeatureUsage[t]=o}ne(()=>r.onFeatureUsage?.(t,n))}function ne(e){try{let t=e();t&&typeof t.catch=="function"&&t.catch(()=>{})}catch{}}function re(e,t){let{context:n}=t;if(t.stack.evaluatedFeatures.has(e))return l(t,`evalFeature: circular dependency detected: ${t.stack.id} -> ${e}`,{from:t.stack.id,to:e}),E(t,e,null,"cyclicPrerequisite");t.stack.evaluatedFeatures.add(e),t.stack.id=e;let r=n.features?.[e];for(let i of r?.rules??[])q(i);let o=n.forcedFeatureValues;if(o&&o.has(e))return l(t,"Global override",{id:e,value:o.get(e)}),E(t,e,o.get(e),"override");if(!r)return l(t,"Unknown feature",{id:e}),E(t,e,null,"unknownFeature");if(r.rules){let i=new Set(t.stack.evaluatedFeatures);e:for(let s of r.rules){if(s.parentConditions)for(let f of s.parentConditions){t.stack.evaluatedFeatures=new Set(i);let d=re(f.id,t);if(d.source==="cyclicPrerequisite")return E(t,e,null,"cyclicPrerequisite");let c={value:d.value};if(!y(c,f.condition||{},n.savedGroups||{})){if(f.gate)return l(t,"Feature blocked by prerequisite",{id:e,rule:s}),E(t,e,null,"prerequisite");l(t,"Skip rule because prerequisite evaluation fails",{id:e,rule:s});continue e}}if(s.filters&&He(s.filters,t)){l(t,"Skip rule because of filters",{id:e,rule:s});continue}if("force"in s){if(s.condition&&!$e(s.condition,t)){l(t,"Skip rule because of condition ff",{id:e,rule:s});continue}if(!it(t,s.seed||e,s.hashAttribute,n.saveStickyBucketAssignmentDoc&&!s.disableStickyBucketing?s.fallbackAttribute:void 0,s.range,s.coverage,s.hashVersion)){l(t,"Skip rule because user not included in rollout",{id:e,rule:s});continue}return l(t,"Force value from rule",{id:e,rule:s}),s.tracks&&s.tracks.forEach(f=>{Ve(t,f.experiment,f.result)}),E(t,e,s.force,"force",s.id)}if(!s.variations){l(t,"Skip invalid rule",{id:e,rule:s});continue}let a={variations:s.variations,key:s.key||e};"coverage"in s&&(a.coverage=s.coverage),s.weights&&(a.weights=s.weights),s.hashAttribute&&(a.hashAttribute=s.hashAttribute),s.fallbackAttribute&&(a.fallbackAttribute=s.fallbackAttribute),s.disableStickyBucketing&&(a.disableStickyBucketing=s.disableStickyBucketing),s.bucketVersion!==void 0&&(a.bucketVersion=s.bucketVersion),s.minBucketVersion!==void 0&&(a.minBucketVersion=s.minBucketVersion),s.meta&&(a.meta=s.meta),s.ranges&&(a.ranges=s.ranges),s.name&&(a.name=s.name),s.phase&&(a.phase=s.phase),s.seed&&(a.seed=s.seed),s.hashVersion&&(a.hashVersion=s.hashVersion),s.filters&&(a.filters=s.filters),s.condition&&(a.condition=s.condition);let u=Oe(a,e,t);if(n.onExperimentEval?.(a,u),u.inExperiment&&!u.passthrough)return E(t,e,u.value,"experiment",s.id,a,u)}}return l(t,"Use default value",{id:e,value:r.defaultValue}),E(t,e,r.defaultValue===void 0?null:r.defaultValue,"defaultValue")}function Oe(e,t,n){let{context:r}=n;q(e);let o=e.key,i=e.variations.length;if(i<2)return l(n,"Invalid experiment",{id:o}),b(n,e,-1,!1,t);if(r.enabled===!1)return l(n,"Context disabled",{id:o}),b(n,e,-1,!1,t);if(e.urlPatterns&&!I(r.url||"",e.urlPatterns))return l(n,"Skip because of url targeting",{id:o}),b(n,e,-1,!1,t);let s=N(o,r.url||"",i);if(s!==null)return l(n,"Force via querystring",{id:o,variation:s}),b(n,e,s,!1,t);let u=ot(r)[o];if(u!==void 0)return l(n,"Force via dev tools",{id:o,variation:u}),b(n,e,u,!1,t);if(e.active===!1)return l(n,"Skip because inactive",{id:o}),b(n,e,-1,!1,t);let{hashAttribute:f,hashValue:d}=A(r,e.hashAttribute,r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!d)return l(n,"Skip because missing hashAttribute",{id:o}),b(n,e,-1,!1,t);let c=-1,h=!1,p=!1;if(r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{variation:w,versionIsBlocked:B}=Fe(Ce({context:r,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta}));h=w>=0,c=w,p=!!B}if(!h){if(e.filters&&He(e.filters,n))return l(n,"Skip because of filters",{id:o}),b(n,e,-1,!1,t);if(e.include&&!M(e.include))return l(n,"Skip because of include function",{id:o}),b(n,e,-1,!1,t);if(e.condition&&!$e(e.condition,n))return l(n,"Skip because of condition exp",{id:o}),b(n,e,-1,!1,t);if(e.parentConditions){let w=new Set(n.stack.evaluatedFeatures);for(let B of e.parentConditions){n.stack.evaluatedFeatures=new Set(w);let F=re(B.id,n);if(F.source==="cyclicPrerequisite")return b(n,e,-1,!1,t);let j={value:F.value};if(!y(j,B.condition||{},r.savedGroups||{}))return l(n,"Skip because prerequisite evaluation fails",{id:o}),b(n,e,-1,!1,t)}}}let k=R(e.seed||o,d,e.hashVersion??2);if(k===null)return l(n,"Skip because of invalid hash version",{id:o}),b(n,e,-1,!1,t);if(!h){let w=e.ranges||G(i,e.coverage===void 0?1:e.coverage,e.weights);c=K(k,w)}if(p)return l(n,"Skip because sticky bucket version is blocked",{id:o}),b(n,e,-1,!1,t,void 0,!0);if(c<0)return l(n,"Skip because of coverage",{id:o}),b(n,e,-1,!1,t);if("force"in e)return l(n,"Force variation",{id:o,variation:e.force}),b(n,e,e.force===void 0?-1:e.force,!1,t);if(r.qaMode)return l(n,"Skip because QA mode",{id:o}),b(n,e,-1,!1,t);let m=b(n,e,c,!0,t,k,h);if(r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{changed:w,key:B,doc:F}=Re(r,f,T(d),{[D(e.key,e.bucketVersion)]:m.key});if(w){r.stickyBucketAssignmentDocs=r.stickyBucketAssignmentDocs||{},r.stickyBucketAssignmentDocs[B]=F;let j=r.saveStickyBucketAssignmentDoc;ne(()=>j(F))}}return Ve(n,e,m),l(n,"In experiment",{id:o,variation:m.variationId}),m}function E(e,t,n,r,o,i,s){let a={value:n,on:!!n,off:!n,source:r,ruleId:o||""};return i&&(a.experiment=i),s&&(a.experimentResult=s),r!=="override"&&st(e,t,a),a}function $e(e,t){return y(ee(t.context),e,t.context.savedGroups||{})}function He(e,t){return e.some(n=>{let{hashValue:r}=A(t.context,n.attribute);if(!r)return!0;let o=R(n.seed,r,n.hashVersion||2);return o===null?!0:!n.ranges.some(i=>C(o,i))})}function it(e,t,n,r,o,i,s){if(!o&&i===void 0)return!0;if(!o&&i===0)return!1;let{hashValue:a}=A(e.context,n,r);if(!a)return!1;let u=R(t,a,s??2);return u===null?!1:o?C(u,o):i!==void 0?u<=i:!0}function b(e,t,n,r,o,i,s){let a=!0;(n<0||n>=t.variations.length)&&(n=0,a=!1);let{hashAttribute:u,hashValue:f}=A(e.context,t.hashAttribute,e.context.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0),d=t.meta?.[n]??{},c=t.variations[0];for(let[p,k]of t.variations.entries())if(p===n){c=k;break}let h={key:d.key||""+n,featureId:o,inExperiment:a,hashUsed:r,variationId:n,value:c,hashAttribute:u,hashValue:f,stickyBucketUsed:!!s};return d.name&&(h.name=d.name),i!==void 0&&(h.bucket=i),d.passthrough&&(h.passthrough=d.passthrough),h}function Le(e,t){return t.hashAttribute+t.hashValue+e.key+t.variationId}/*!
|
|
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
|
-
*/export{T as a,I as b,le as c,xe as d,Qe as e,y as f,nt as g,rt as h,Le as i};
|
package/dist/content-XXVHMKKL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as F,j as Q}from"./chunk-5JJZSH23.js";import{b as B}from"./chunk-SSLZKIIU.js";import{a as z,b as _}from"./chunk-MOWYD2TV.js";import{L as M}from"./chunk-U4UEOR5W.js";import{Y as P,ca as U,ja as N,ka as q,qa as d}from"./chunk-ACF2FBUB.js";import{a as v}from"./chunk-DSPLGTQI.js";import"./chunk-G56XGVMS.js";import"./chunk-7XVAFQEE.js";import{a as V}from"./chunk-7DXL3LHT.js";import"./chunk-XSVQHPQT.js";import{z as p}from"zod";var x=new WeakMap;function W(r){let t={string:p.string(),number:p.number().finite(),boolean:p.boolean(),strings:p.array(p.string()),json:V}[r.type];return r.nullable?t.nullable():t}async function ie(r,t){return $(r,t,!1)}async function se(r,t){return $(r,t,!0)}async function $(r,t,w){t.signal?.throwIfAborted();let L=M.parse(t.content),o=L.document;if(x.has(r))throw new d("CONFLICT","Content is already mounted in this container");let f=p.record(p.string(),V).parse(t.inputs??{});if(Object.keys(f).length>40)throw new d("INVALID_REQUEST","Too many content inputs");for(let[e,s]of Object.entries(f))N.parse({[e]:s});if(Object.keys(f).some(e=>!Object.hasOwn(o.contract.inputs,e)))throw new d("INVALID_REQUEST","Undeclared content input");for(let[e,s]of Object.entries(o.contract.inputs))if(Object.hasOwn(f,e))W(s).parse(f[e]);else if(s.required)throw new d("INVALID_REQUEST",`Missing content input ${e}`);for(let e of Object.keys(o.contract.outputs))if(typeof t.actions[e]!="function")throw new d("INVALID_REQUEST",`Missing host handler for ${e}`);let J=q.parse(t.bindings??[]),c=r.ownerDocument,T,k=o.kind==="popup",n=k?c.createElement("dialog"):null,i=c.createElement("div");if(i.dataset.indianaContent=o.kind,i.setAttribute("aria-label",o.name),i.style.cssText="width:100%;min-width:0",n){n.setAttribute("aria-label",o.name);let e=o.screen.presentation;n.style.cssText="box-sizing:border-box;padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto",e.type==="modal"||e.type==="sheet"?(n.style.width=`${P[e.size]}px`,e.type==="sheet"&&(n.style.margin="auto auto 0")):n.style.width="100vw",n.append(i),r.append(n)}else r.append(i);let l=!1,C=!1,g=!1;w&&!n&&(i.style.width=`${r.getBoundingClientRect().width||c.defaultView?.innerWidth||800}px`);let G=w?F(n??i):()=>{},D,A,S=new Promise((e,s)=>{D=e,A=s});S.catch(()=>{});let u=null,E=structuredClone(o.screen);E.actions=E.actions.map(e=>e.type==="event"?{...e,close:!1}:e);let y;function m(){l||(l=!0,t.signal?.removeEventListener("abort",m),A(new Error("Content preparation cancelled")),y?.destroy(),n?.close(),n?.remove(),i.remove(),x.delete(r),n&&T?.())}let O=()=>{g&&(m(),v(t.onDismiss))};if(n){let e=c.createElement("button");e.type="button",e.textContent="\xD7",e.setAttribute("aria-label",t.locale?.startsWith("zh")?"\u5173\u95ED":"Close"),_(e,o.screen.theme),e.addEventListener("click",O),n.prepend(e)}n?.addEventListener("cancel",e=>{e.preventDefault(),O()});async function H(){if(l||!g||C||!u)return;let e=u;C=!0,i.setAttribute("aria-busy","true");try{await t.actions[e.actionId](structuredClone(e)),u=null}catch(s){v(t.onError,s)}finally{C=!1,l||i.removeAttribute("aria-busy")}}function R(){if(l)throw new d("CONFLICT","Content host has been destroyed");g||(T=B(c),G(),w&&!n&&(i.style.width="100%"),n&&(n.showModal(),z(n,o.screen.presentation.type)),g=!0)}try{w||R(),y=Q(i,{mode:"live",rendererUrl:t.rendererUrl,title:o.name,viewportHeight:o.kind==="page"?r.clientHeight||c.defaultView?.innerHeight||800:void 0,onRendered:a=>{a&&n?.setAttribute("aria-label",a),D()},onError:a=>{let I=new Error(a);A(I),v(t.onError,I)},onEscape:k?O:void 0,onAction:(a,I,K)=>{if(l||!g||C||u)return;let h=o.screen.actions.find(b=>b.id===a),j=o.contract.outputs[a];if(!(h?.type!=="event"||!j))try{let b=W(j).parse(Object.hasOwn(h.properties,"value")?h.properties.value:h.properties);u={requestId:crypto.randomUUID(),contentVersionId:L.id,actionId:a,event:h.event,value:b,selection:I??{},answers:K??{},requestedClose:h.close},H()}catch(b){v(t.onError,b)}}});let e={destroy:m,show:R,get pendingAction(){return u?structuredClone(u):null},retryAction:H,updateCapabilities:a=>y?.updateCapabilities(a)};x.set(r,e),t.signal?.addEventListener("abort",m,{once:!0}),t.signal?.aborted&&(m(),t.signal.throwIfAborted());let s=U(E,[t.locale,...c.defaultView?.navigator.languages??[]]);if(y.update(E,s,{capabilities:t.capabilities,serverInput:{bindings:J,answers:{},values:f}}),await Promise.race([y.ready,S]),w&&await S,l)throw new Error("Content preparation cancelled");return e}catch(e){throw m(),e}}export{ie as mountContent,se as prepareContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as a}from"./chunk-R26BYN3U.js";import"./chunk-MOWYD2TV.js";import"./chunk-SBPTOOYB.js";import"./chunk-U4UEOR5W.js";import"./chunk-ACF2FBUB.js";import"./chunk-SLUA7ABW.js";import"./chunk-5ZS3TNC4.js";import"./chunk-DSPLGTQI.js";import"./chunk-G56XGVMS.js";import"./chunk-7XVAFQEE.js";import"./chunk-7DXL3LHT.js";import"./chunk-XSVQHPQT.js";export{a as showFunnelRun};
|
package/dist/paywall-CDR4GZMX.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as ee}from"./chunk-SSLZKIIU.js";import{a as Z}from"./chunk-MOWYD2TV.js";import{M as B}from"./chunk-U4UEOR5W.js";import{L as V,i as G,ma as W,oa as X,qa as w}from"./chunk-ACF2FBUB.js";import{a as j}from"./chunk-DSPLGTQI.js";import"./chunk-G56XGVMS.js";import"./chunk-7XVAFQEE.js";import"./chunk-7DXL3LHT.js";import"./chunk-XSVQHPQT.js";async function te(b,n,y){if(n.status!=="complete")throw new w("INVALID_RESPONSE","A verified completed purchase is required");if(await y.onComplete?.(n),!b||!y.check)return;let R=V.parse(await y.check());if(R.internal_feature_id!==b.internal_feature_id||R.quantity!==b.quantity)throw new w("INVALID_RESPONSE","The access requirement changed");R.allowed&&await y.onAccessGranted?.(R)}async function he(b,n){let y=n.check?V.parse(await n.check()):null;if(y?.allowed)return await n.onAccessGranted?.(y),{check:y,host:null};let R=ee(b.ownerDocument),r=await n.start(),E=r.view??await r.refresh();if(!E)throw new w("INVALID_RESPONSE","Paywall presentation is missing");let{mountScreenPreview:ne}=await import("./screen-renderer-NLB3FAQJ.js"),c=b.ownerDocument,D=new AbortController,C=c.createElement("section"),K=c.createElement("div"),L=c.createElement("div"),g=c.createElement("p"),u=c.createElement("button"),M=c.createElement("button"),d=c.createElement("dialog"),i=E.document.screen.strings.defaultLocale.startsWith("zh");C.dataset.indianaPaywall="",C.setAttribute("aria-label",E.document.name),C.style.cssText="width:100%;box-sizing:border-box;background:#fff;color:#172033;font:14px/1.5 system-ui,sans-serif",L.style.cssText="display:flex;gap:12px;padding:12px 20px;align-items:center;flex-wrap:wrap",g.setAttribute("role","status"),M.textContent=i?"\u5173\u95ED":"Close",u.textContent=i?"\u91CD\u8BD5":"Retry",u.hidden=!0,L.append(g,u,M),C.append(K,L);let O=E.document.presentation,U,p=!1,$=!1,f=null,Y=!1,m=()=>!Y&&n.canInteract?.()!==!1,q=!1,a=null,N=null,Q=new Map;async function H(e){if(!(!m()||!e.checkoutUrl||Q.get(e.operationId)===e.checkoutUrl)){Q.set(e.operationId,e.checkoutUrl);try{n.onCheckoutUrl?await n.onCheckoutUrl(e.checkoutUrl):c.defaultView?.location.assign(e.checkoutUrl)}catch(o){throw Q.delete(e.operationId),o}}}let _=e=>{g.textContent=e instanceof Error?e.message:i?"\u8BF7\u6C42\u5931\u8D25":"Request failed",j(n.onError,e),u.hidden=a===null};async function k(e){if(!($||p||!m())){$=!0,u.hidden=!0,g.textContent="";try{await e()}catch(o){p||_(o)}finally{$=!1}}}async function re(e){await te(y,e,n)}async function v(e){if(p)return;if(!m()){a=async()=>v(await r.read()),u.hidden=!1;return}if(g.textContent=e.status,e.problem){let t=e.problem;a=T,u.textContent=i?"\u68C0\u67E5\u5E76\u6062\u590D\u539F\u64CD\u4F5C":"Check and recover original purchase",_(new w(t.code,t.reason==="RESULT_UNKNOWN"?i?"\u4ED8\u6B3E\u7ED3\u679C\u5C1A\u672A\u786E\u5B9A\uFF0C\u8BF7\u6062\u590D\u539F\u64CD\u4F5C\uFF0C\u6682\u52FF\u91CD\u590D\u8D2D\u4E70\u3002":"The payment result is unknown. Recover the original purchase before buying again.":t.phase==="fulfillment"?i?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u5546\u6237\u6743\u76CA\u5904\u7406\u9700\u8981\u6838\u5BF9\u3002":"Payment was recorded. Access fulfillment needs attention.":t.code==="CAPABILITY_UNAVAILABLE"?i?"\u5546\u6237\u5C1A\u4E0D\u652F\u6301\u672C\u6B21\u8D2D\u4E70\u6240\u9700\u7684\u5B8C\u6574\u80FD\u529B\uFF0C\u8BF7\u5904\u7406\u540E\u6062\u590D\u539F\u64CD\u4F5C\u3002":"The merchant does not currently support all actions required by this purchase. Recover the original purchase after this is resolved.":t.code==="NOT_CONFIGURED"?i?"\u4ED8\u6B3E\u670D\u52A1\u8FDE\u63A5\u9700\u8981\u5904\u7406\uFF0C\u8BF7\u8054\u7CFB\u5546\u6237\u540E\u6062\u590D\u539F\u64CD\u4F5C\u3002":"The payment connection needs attention. Contact the merchant, then recover the original purchase.":i?"\u539F\u8D2D\u4E70\u64CD\u4F5C\u9700\u8981\u5904\u7406\uFF0C\u8BF7\u67E5\u8BE2\u6216\u6062\u590D\u6B64\u64CD\u4F5C\u3002":"The original purchase needs attention. Check or recover this operation.",void 0,void 0,t));return}if(e.merchantExecution?.type==="purchase"&&e.merchantExecution.paymentStatus==="succeeded"&&!["applied","not_applicable"].includes(e.merchantExecution.fulfillmentStatus)&&(g.textContent=i?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u6B63\u5728\u7B49\u5F85\u5546\u6237\u5B8C\u6210\u5904\u7406\u3002":"Payment was recorded. Waiting for merchant fulfillment."),e.status==="complete"){a=null,await re(e);return}if(e.status!=="pending"){if(r.canReselect===!1){g.textContent=i?"\u6B63\u5728\u6838\u5BF9\u539F\u8D2D\u4E70\u7ED3\u679C":"Checking the original purchase result",u.textContent=i?"\u67E5\u8BE2\u7ED3\u679C":"Check result",a=async()=>v(await r.read()),u.hidden=!1;return}u.textContent=i?"\u91CD\u8BD5":"Retry",a=null,f=null;return}await H(e);let o=Date.now()+6e5,l=2e3;for(;!p&&Date.now()<o;){if(await new Promise(h=>{let P=()=>{clearTimeout(I),h()},I=setTimeout(()=>{D.signal.removeEventListener("abort",P),h()},l);D.signal.addEventListener("abort",P,{once:!0})}),p)return;if(!m()){a=async()=>v(await r.read()),u.hidden=!1;return}let t=await r.read();if(!t.problem&&t.status==="pending"&&await H(t),t.status!=="pending"||t.problem){await v(t);return}l=Math.min(l*1.5,3e4)}a=async()=>v(await r.read()),u.hidden=!1}async function T(){N?.remove(),N=null,a=T;let e=await r.confirm();if(!m()){a=T,u.hidden=!1;return}if(e.problem){await v(e);return}if(e.status==="pending"){if(e.checkoutUrl)await H(e);else if(e.execution&&e.execution.provider!=="merchant"||e.nativePurchase){if(!n.onPurchase)throw new w("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await n.onPurchase({operation:e,signal:D.signal})}}a=async()=>v(await r.read()),await v(e)}function ae(e){N?.remove();let o=c.createElement("div"),l=c.createElement("button"),t=c.createElement("button"),h=c.createElement("p");h.textContent=e.lines.map(s=>s.productName).join(", ")+" \xB7 "+G(e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),e.currency),l.textContent=i?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",t.textContent=i?"\u53D6\u6D88":"Cancel",l.onclick=()=>{k(T)};let P=async()=>{let s=await r.cancel();p||(o.remove(),N=null,await v(s))};t.onclick=()=>{a=P,k(P)};let I=c.createElement("div");for(let s of e.lines){let J=c.createElement("p");J.textContent=`${s.productName} \xB7 ${G(s.catalogAmountMinor,e.currency)}${W(s.interval,i?"zh-CN":"en",s.intervalCount??1)}`,I.append(J);for(let x of s.prepaid??[]){let F=c.createElement("p"),A=r.view?.capabilities.plans[s.productVersionId]?.prepaid?.find(ie=>ie.internalFeatureId===x.internal_feature_id);F.textContent=`${A?.name??x.internal_feature_id} \xB7 ${x.quantity} ${i?"\u4EFD":"packs"} \xD7 ${x.terms.units}`,A&&(F.textContent+=W(A.reset==="week"||A.reset==="month"||A.reset==="year"?A.reset:"one_time",i?"zh-CN":"en",A.resetCount)),I.append(F)}if(s.trial){let x=c.createElement("p");x.textContent=i?`\u8BD5\u7528 ${s.trial.days} \u5929\uFF1B${s.trial.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${s.trial.days}; ${s.trial.cardRequired?"a payment method is required":"no payment method is required"}`,I.append(x)}}if(!e.charge){let s=c.createElement("p");s.textContent=i?"\u76EE\u5F55\u4EF7\u683C\uFF1B\u6700\u7EC8\u91D1\u989D\u4EE5\u7ED3\u8D26\u65F6\u7A0E\u8D39\u548C\u8BD5\u7528\u89C4\u5219\u4E3A\u51C6\u3002":"Catalog price; the final charge depends on checkout taxes and trial terms.",I.append(s)}o.append(h,I,l,t),L.prepend(o),N=o,a=null}async function z(){if(!f)return;if(a=z,!q){let o=r.view,l=o?.document.buttons[f.actionId],t=o&&l?.type==="checkout"?B(l.product,f.selection,o.capabilities):null;if(!t)throw new w("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");let h=await n.resolveOfferId?.({actionId:f.actionId,productVersionId:t});if(p)return;h!==void 0&&(f.offerId=h),q=!0}if(!m()){u.hidden=!1;return}let e=await r.preview(f);p||ae(e)}function S(e="destroy"){p||(p=!0,D.abort(),U?.destroy(),r.destroy(),d.open&&d.close(),d.remove(),C.remove(),R(),e==="dismiss"&&j(n.onDismiss))}M.onclick=()=>{m()&&S("dismiss")},d.addEventListener("cancel",e=>{e.preventDefault(),m()&&S("dismiss")}),u.onclick=()=>{a&&k(a)};try{if(O.type==="inline")b.append(C);else{let e={sm:420,md:640,lg:900};d.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${"size"in O?e[O.size]+"px":"100vw"}`,d.setAttribute("aria-label",E.document.name),d.append(C),b.append(d),m()&&(d.showModal(),Z(d,O.type))}U=ne(K,{mode:"live",rendererUrl:r.webViewUrl,title:E.document.name,onAction(e,o={}){if(!m())return;let l=r.view,t=l?.document.buttons[e];if(!t)return;if(t.type==="close"){k(async()=>{await n.onAction?.(e),S(n.onAction?"action":"dismiss")});return}if(t.type==="action"){a=async()=>{if(t.action.type==="event"){if(!n.onEvent)throw new w("EVENT_HANDLER_REQUIRED","Provide the event handler");await n.onEvent(t.action.event)}else n.onOpenUrl?await n.onOpenUrl(t.action.url):c.defaultView?.location.assign(t.action.url);await n.onAction?.(e),a=null},k(a);return}if((r.quote||f)&&r.canReselect===!1){a=r.quote?async()=>v(await r.read()):z,k(a);return}let h=l&&B(t.product,o,l.capabilities);if(!l||!h){_(new w("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(n.onPurchaseIntent){a=null,k(async()=>{let P={actionId:e,productVersionId:h,selection:structuredClone(o),featureQuantities:X(l.document.screen,h,o,l.capabilities)};await n.onPurchaseIntent(P)});return}if(f&&f.actionId!==e){_(new w("COMMAND_PENDING","Finish the current purchase"));return}f||(f={requestId:crypto.randomUUID(),actionId:e,selection:o},q=!1),k(z)},onEscape:()=>{m()&&S("dismiss")},onError:e=>_(new Error(e)),onRendered:e=>{e&&d.setAttribute("aria-label",e)}}),U.update(E.document.screen,E.document.screen.strings.defaultLocale,{capabilities:E.capabilities,serverInput:{bindings:[],answers:{}}}),await U.ready}catch(e){throw S(),e}return{check:y,host:{setSuspended(e){Y=e,C.hidden=e,e&&d.open?d.close():!e&&!p&&O.type!=="inline"&&!d.open&&d.showModal()},destroy:S,refresh:async()=>{if(!m()){if(r.view)return r.view;throw new w("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await r.refresh();return p||U?.updateCapabilities(e.capabilities),e}}}}export{he as showPaywall};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,g as f,h as g,i as h,j as i}from"./chunk-5JJZSH23.js";import"./chunk-SSLZKIIU.js";import"./chunk-MOWYD2TV.js";import"./chunk-ACF2FBUB.js";import"./chunk-DSPLGTQI.js";import"./chunk-7DXL3LHT.js";import"./chunk-XSVQHPQT.js";export{f as formatCustomerDecimal,b as hostedRendererScript,a as hostedRendererShell,d as inspectCustomHtml,i as mountScreenPreview,h as preparePopup,e as prepareScreen,c as sanitizeCustomHtml,g as showPopup};
|
|
File without changes
|