@tinkerlandai/longplay-sdk 0.10.39 → 0.10.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +57 -2
- package/README.zh-CN.md +6 -2
- package/dist/{ai-usage-DXwAGTxT.d.ts → ai-usage-B-qsCn-k.d.ts} +1 -1
- package/dist/{api-r6FfVQpg.d.ts → api-DpRb_Pd3.d.ts} +52 -0
- package/dist/check-response-SR3PDVGE.js +1 -0
- package/dist/chunk-24Z3THUR.js +1 -0
- package/dist/{chunk-IGANLTKS.js → chunk-26UXCYBP.js} +1 -1
- package/dist/{chunk-GGYBZWWY.js → chunk-2LERKK7O.js} +1 -1
- package/dist/{chunk-JBVZ6A6V.js → chunk-2LUVO7GM.js} +1 -1
- package/dist/{chunk-YJS6NNIO.js → chunk-2P2YSNYU.js} +1 -1
- package/dist/{chunk-ONMIBSOC.js → chunk-2RUJXZCO.js} +1 -1
- package/dist/chunk-2XF34Q6D.js +1 -0
- package/dist/chunk-4B4RB36N.js +1 -0
- package/dist/chunk-5PNH2FPI.js +1 -0
- package/dist/{chunk-CEMHQQAJ.js → chunk-6EBS6MLW.js} +1 -1
- package/dist/chunk-6OVMC5BT.js +1 -0
- package/dist/{chunk-LZBJHWVH.js → chunk-6STWY5GX.js} +1 -1
- package/dist/chunk-756SIMZF.js +1 -0
- package/dist/chunk-7IVLNV5H.js +1 -0
- package/dist/chunk-ANXK3B5B.js +1 -0
- package/dist/{chunk-KIPUBMU3.js → chunk-AQQJPP3P.js} +1 -1
- package/dist/chunk-BWRRZ2NW.js +1 -0
- package/dist/{chunk-O4KXODTJ.js → chunk-CQRSMCCG.js} +1 -1
- package/dist/{chunk-JAZHNQKO.js → chunk-DPEMW2FO.js} +1 -1
- package/dist/chunk-EECTJHI6.js +1 -0
- package/dist/{chunk-525K7BPJ.js → chunk-EJSDOSP5.js} +1 -1
- package/dist/{chunk-ZORZA4WG.js → chunk-EON4IKWR.js} +1 -1
- package/dist/chunk-EOPKOAR5.js +1 -0
- package/dist/{chunk-TLRRBUGP.js → chunk-FTVNGN6Z.js} +1 -1
- package/dist/{chunk-TPXRO63H.js → chunk-G6CWZBT5.js} +1 -1
- package/dist/chunk-GXADA7OV.js +1 -0
- package/dist/{chunk-U7XD4ZR5.js → chunk-H26F3IOI.js} +1 -1
- package/dist/{chunk-GNAMACMK.js → chunk-H7AHDGVU.js} +2 -2
- package/dist/chunk-HGH2X6QM.js +1 -0
- package/dist/chunk-KINNES62.js +1 -0
- package/dist/{chunk-3JD3U45R.js → chunk-MYDMOAKX.js} +1 -1
- package/dist/chunk-NFY7DKVJ.js +1 -0
- package/dist/{chunk-QCMFCK7Z.js → chunk-O3HLNU6T.js} +1 -1
- package/dist/chunk-OAAS5LJY.js +1 -0
- package/dist/{chunk-CBZ5GW4J.js → chunk-OEONV3JY.js} +1 -1
- package/dist/chunk-P6XQC7GG.js +1 -0
- package/dist/chunk-PYLX3WF6.js +1 -0
- package/dist/{chunk-O2D3A4CS.js → chunk-QJMM37CB.js} +1 -1
- package/dist/{chunk-CE5MAAIR.js → chunk-RQTYIUWP.js} +1 -1
- package/dist/chunk-S4P4UUUF.js +1 -0
- package/dist/{chunk-DPIQ3SV7.js → chunk-SYHMHKFQ.js} +1 -1
- package/dist/{chunk-PFPMK4IO.js → chunk-TGPZJ5A7.js} +1 -1
- package/dist/chunk-VILB5M4X.js +1 -0
- package/dist/chunk-VJHURKRY.js +1 -0
- package/dist/{chunk-UKVWANDE.js → chunk-VWRQBQZD.js} +1 -1
- package/dist/chunk-W35FZWGG.js +1 -0
- package/dist/chunk-W3J2SIPY.js +1 -0
- package/dist/chunk-Y2HXKANG.js +1 -0
- package/dist/{configuration-sync-BHrAf-ql.d.ts → configuration-sync-7ruSsSrL.d.ts} +150 -1
- package/dist/content-XYUJFGY2.js +1 -0
- package/dist/funnel-host-purchase-BNS3242X.js +1 -0
- package/dist/{funnel-local-client-DR8OpKGU.d.ts → funnel-local-client-BMxDQWE6.d.ts} +51987 -22983
- package/dist/{funnel-node-evaluation-COxXtZEQ.d.ts → funnel-node-evaluation-COIh1hKs.d.ts} +3 -0
- package/dist/funnel-paywall-prerender-DDQI3GAZ.js +1 -0
- package/dist/{funnel-process-client-C87U4r_G.d.ts → funnel-process-client-DNR9nHs8.d.ts} +7338 -3163
- package/dist/funnel-route-prediction-BT5ZWU54.js +1 -0
- package/dist/funnel-route-source-7ZJMZRID.js +1 -0
- package/dist/funnel-runtime-host-3SSDNG24.js +1 -0
- package/dist/index.d.ts +273 -22
- package/dist/index.js +1 -1
- package/dist/merchant-bridge-contracts-YU53UKUN.js +1 -0
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.d.ts +2 -2
- package/dist/openrouter.js +1 -1
- package/dist/operation-contracts-GEIGP23I.js +1 -0
- package/dist/page.d.ts +1 -1
- package/dist/page.js +1 -1
- package/dist/paywall-YZAEI7TF.js +1 -0
- package/dist/paywall-content-QBSB5NA7.js +1 -0
- package/dist/paywall-session-MHBAZLS7.js +1 -0
- package/dist/popup.d.ts +2 -2
- package/dist/popup.js +1 -1
- package/dist/{presentation-loading-B_v5XZtM.d.ts → presentation-loading-B2OeFzRN.d.ts} +1 -0
- package/dist/react-native.d.ts +6 -6
- package/dist/react-native.js +1 -1
- package/dist/screen-renderer-SEJG7A2C.js +1 -0
- package/dist/server.d.ts +34204 -17797
- package/dist/server.js +1 -1
- package/dist/{visual-dom-5LUN4AHO.js → visual-dom-7YYJQ2ZI.js} +1 -1
- package/dist/visual.js +1 -1
- package/package.json +9 -10
- package/dist/check-response-MNFEOKKE.js +0 -1
- package/dist/chunk-2Y5SGDC6.js +0 -1
- package/dist/chunk-3NCMYTNG.js +0 -1
- package/dist/chunk-3S25TLC3.js +0 -1
- package/dist/chunk-73ISTR7P.js +0 -1
- package/dist/chunk-BIT6YWM7.js +0 -1
- package/dist/chunk-CKVAV2W5.js +0 -1
- package/dist/chunk-GDD26ZDV.js +0 -1
- package/dist/chunk-HFD4CLCJ.js +0 -1
- package/dist/chunk-HX36OZPQ.js +0 -1
- package/dist/chunk-IYHXEKAD.js +0 -1
- package/dist/chunk-LJBTEB2Q.js +0 -1
- package/dist/chunk-MTIOLSVM.js +0 -1
- package/dist/chunk-N774V4SQ.js +0 -1
- package/dist/chunk-NSAEHRIT.js +0 -1
- package/dist/chunk-QXOUDODX.js +0 -1
- package/dist/chunk-TA4W6SXG.js +0 -1
- package/dist/chunk-VYI6QRJW.js +0 -1
- package/dist/chunk-W3G4YIM5.js +0 -1
- package/dist/chunk-YURGISSB.js +0 -1
- package/dist/content-HSMBQFM3.js +0 -1
- package/dist/funnel-host-purchase-4KOOLMXV.js +0 -1
- package/dist/funnel-paywall-prerender-NX6ZQ7EU.js +0 -1
- package/dist/funnel-runtime-host-6XYYLVCI.js +0 -1
- package/dist/merchant-bridge-contracts-ACGAMHU6.js +0 -1
- package/dist/operation-contracts-H27WHXQC.js +0 -1
- package/dist/paywall-ZGG6DXO3.js +0 -1
- package/dist/paywall-content-ZQBE2EZP.js +0 -1
- package/dist/paywall-session-DBTBLLWI.js +0 -1
- package/dist/screen-renderer-5SJCTMJH.js +0 -1
- /package/dist/{chunk-NOOIJXRN.js → chunk-2ULWP26K.js} +0 -0
- /package/dist/{chunk-OJM6ORHE.js → chunk-4PGYQ2TI.js} +0 -0
- /package/dist/{chunk-CILM5XMH.js → chunk-PBBREFS5.js} +0 -0
package/dist/chunk-HFD4CLCJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as $A}from"./chunk-IGANLTKS.js";import{b as sA}from"./chunk-YURGISSB.js";import{a as P}from"./chunk-TPXRO63H.js";import{a as BA,c as jA,d as xA,e as MA,f as UA}from"./chunk-3S25TLC3.js";import{a as zA,b as FA}from"./chunk-JBVZ6A6V.js";function I(A){return typeof A=="string"?A:String(A)}var Se=/[\ud800-\udbff](?![\udc00-\udfff])|(^|[^\ud800-\udbff])[\udc00-\udfff]/g;function Ie(A){return A.replace(Se,"$1\uFFFD")}function mA(A,e){if(typeof A!="object"||A==null){let t="";throw t+="The provided value is not an object",new TypeError(t)}return A}function ZA(A){if(A!=null&&(typeof A=="object"||typeof A=="function")){let e=A[Symbol.iterator];if(e==null)return;if(typeof e!="function")throw new TypeError("The provided value is not iterable");let t=e.call(A);if(!t||typeof t!="object")throw new TypeError("Result of the Symbol.iterator method is not an object");return t}}function QA(A){let e;if(Array.isArray(A)){let t=A.map(I);if(t.length===2)return t}else if((e=ZA(A))!=null){let t=mA(e.next()),n=mA(e.next());if(!t.done&&!n.done)return[I(t.value),I(n.value)]}throw new TypeError("Each query pair must be an iterable [name, value] tuple")}var GA="0123456789ABCDEF",Ce=/(?:%[0-9A-Fa-f]{2})+/g;function M(A){return`%${GA[A>>4&15]}${GA[15&A]}`}function Ae(A,e,t=!1){return A>=55296&&A<=57343&&(A=65533),A<=127?t&&A===32?"+":e(A)?M(A):String.fromCharCode(A):A<=2047?M(192|A>>6)+M(128|63&A):A<=65535?M(224|A>>12)+M(128|A>>6&63)+M(128|63&A):M(240|A>>18)+M(128|A>>12&63)+M(128|A>>6&63)+M(128|63&A)}function yA(A){return A>=48&&A<=57?A-48:A>=65&&A<=70?A-65+10:A>=97&&A<=102?A-97+10:-1}function PA(A,e=!1){let t=0;for(;t<A.length;t++){let n=A.charCodeAt(t);if(n===37||e&&n===43)break}return t===A.length?A:(e?A.replace(/\+/g," "):A).replace(Ce,n=>{try{return decodeURIComponent(n)}catch{return"\uFFFD".repeat(n.length/3)}})}function AA(A){return A<=31||A>126}function be(A){switch(A){case 32:case 34:case 60:case 62:case 96:return!0;default:return AA(A)}}function TA(A){switch(A){case 32:case 34:case 35:case 60:case 62:return!0;default:return AA(A)}}function Ee(A){return TA(A)||A===39}function DA(A){switch(A){case 63:case 94:case 96:case 123:case 125:return!0;default:return TA(A)}}function cA(A){switch(A){case 47:case 58:case 59:case 61:case 64:case 91:case 92:case 93:case 124:return!0;default:return DA(A)}}function KA(A){switch(A){case 33:case 39:case 40:case 41:case 126:return!0;default:return(function(t){switch(t){case 36:case 37:case 38:case 43:case 44:return!0;default:return cA(t)}})(A)}}function ee(A,e){return Ae(A=A||0,e)}function U(A,e,t=!1){let n=0;for(;n<A.length;n++){let u=A.charCodeAt(n);if(u>=128||t&&u===32||e(u))break}if(n===A.length)return A;let r=A.slice(0,n);for(;n<A.length;n++){let u=A.charCodeAt(n),l=u;if(u>=55296&&u<=56319&&n+1<A.length){let a=A.charCodeAt(n+1);a>=56320&&a<=57343&&(l=(u-55296<<10)+a-56320+65536,n++)}r+=Ae(l,e,t)}return r}function vA(A){let e=[],t=0,n=0;for(;n<=A.length;){if(n=A.indexOf("&",t),n<0&&(n=A.length),n!==t){let r=A.slice(t,n),u=r.indexOf("=");u<0&&(u=r.length),e.push([PA(r.slice(0,u),!0),PA(r.slice(u+1),!0)])}if(t=n+1,n===A.length)break}return e}function SA(A){let e="";for(let t=0;t<A.length;t++){let n=U(A[t][0],KA,!0),r=U(A[t][1],KA,!0);e+=t!==0?`&${n}=${r}`:`${n}=${r}`}return e}var Te=[2191,2191,3164,3164,3292,3292,6863,6877,6880,6891,8385,8385,11158,11158,42958,42959,42962,42962,42964,42964,42993,42993,64451,64466,64912,64913,64968,64974,67904,67929,69317,69319,69328,69336,69370,69371,72544,72551,73136,73179,73184,73193,93856,93880,93883,93907,94194,94198,100344,100351,101641,101662,101760,101874,118010,118012,118458,118480,118496,118512,124608,124638,124640,124661,124670,124671,128728,128728,128887,128890,129232,129240,129620,129623,129674,129674,129678,129678,129736,129736,129741,129741,129770,129770,129775,129775,130042,130042,177978,177983,183970,183981,205744,210041],ve=[7296,7297,7298,7299,7300,7301,7302,7303,7304,42958,42962,42964,42993],Oe=["\u0432","\u0434","\u043E","\u0441","\u0442","\u0442","\u044A","\u0463","\uA64B","\uA7CF","\uA7D3","\uA7D5","s"],Re=[2381,2381,2509,2509,2637,2637,2765,2765,2893,2893,3021,3021,3149,3149,3277,3277,3387,3388,3405,3405,3530,3530,3642,3642,3770,3770,3972,3972,4153,4154,5908,5909,5940,5940,6098,6098,6752,6752,6980,6980,7082,7083,7154,7155,11647,11647,43014,43014,43052,43052,43204,43204,43347,43347,43456,43456,43766,43766,44013,44013,68159,68159,69702,69702,69744,69744,69759,69759,69817,69817,69939,69940,70080,70080,70197,70197,70378,70378,70477,70477,70606,70608,70722,70722,70850,70850,71103,71103,71231,71231,71350,71350,71467,71467,71737,71737,71997,71998,72160,72160,72244,72244,72263,72263,72345,72345,72767,72767,73028,73029,73111,73111,73537,73538,90415,90415];function ke(A){for(let e=0;e<A.length;e++){let t=A.codePointAt(e);if(t>65535&&e++,t<=32||t===37||t===127||t>=55296&&t<=57343||t>=128&&t<=159||t>=64976&&t<=65007||!(65534&~t)||t===65533)return!0}return!1}var[qe,Ne,Le,YA]=[[[],"0,6,7,8,m,w,10,1b,1d,1f,72,73,7k,8k,dt,2rk","AAAAAAAAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAA/AAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAADAAABwfwAAAAAAAMADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAQAAAAAAAAQCAAABAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgACAAAAAAAAAAAAAAAAD//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAP///////////////wAAAAAAAAAAAAAAAAAAAAA="],[[],"6,7,8,o,4o,7e,7f,7h,7i,7j,dl","AAAAAEF9+P/+BwAAAMAA//8AAPz/////BlADAAAAAJwAAPz///8AAADA//H/5+X8AAAAAAAAAAAA/P///wcAAAAAAAAAAAAAPv0vAD0BAABA/gAA/5/5/f8BAAAAAAAAgAAAAP//////////////AYD/////BQAAAAAAAAAAAAAAAAAAAAAAAP///////wcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8g+N8B+AAAAAAAAAAAAAAAAAAAAAAAAP//AwAAYAAAAAAAAAAAAAD/////CwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANgAAAAAAAAAAAAAAAAA//8fAB4AAAD//wMAAAAAAH3/HgwAAAAAAAD//////////w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],[[],"6,7,8,o,4o,7e,7f,7h,7i,7j,dl","AAAAAP3////+BwAAAMDu//////////////8vAADAAJwAAP3///8AAADg////////AAAAAAAAAAAA/P///wcAAAAAAAAAAAAA////Ab0H//9H/gAA/9////8BAAAAAAAAgAAAAP//////////////AYD/////BQAAAAAAAAAAAAAAAAAAAAAAAP///////wcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL/G//8T+AAAAAAAAAAAAAAAAAAAAAAAAP//AwAAfgAAAAAAAAAAAAD+////DwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANwAAAAAAAAAAAAAAAAA//8fAB4AAAD//wMAAAAAAH3/Hg4AAAAAAAD//////////w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],[[],"0,3,4,5,6,7,8,9,a,b,c,d,e,f,g,j,n,o,p,q,r,s,t,w,18,19,1c,4m,4o,4p,4q,4r,6z,72,73,75,76,77,7e,7h,7i,7j,7k,7l,7m,7n,7o,7p,7q,7r,7s,7t,7u,7v,7w,7x,7y,7z,8k,9t,a2,a3,a7,cc,cv,cx,cy,d6,dc,dd,de,dg,dh,di,dk,dl,2rk,2rl","AAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAD//////////////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/v////+/tgAAAAAAAAAAAP8XAAAAAAD4//8AAAEAAAAAAAAAAAAAAMCfnz0AAACAAgAAAP///wcAAAAAAAAAAAAAwP8BAAAAAAAA+A8gAADA++8+AAAAAAAOAAAAAAAAgP8AAAAAAPz///v///8HAAAAAAAAFP4h/gAMAAAAAgAAAAAAABAeIAAADAAAQAYAAAAAAAAQhjkCAAAAIwAGAAAAAAAAEL4hAAAMAAD8AgAAAAAAAJAeIGAADAAAAAQAAAAAAAAAASAAAAAAAAARAAAAAAAA0ME9YAAMAAAAAgAAAAAAAJBAMAAADAAAAAMAAAAAAAAYHiAAAAwAAAACAAAAAAAAAAAEXAAAAAAAAAAAAAAA8geAfwAAAAAAAAAAAAAAAPIfAH8AAAAAAAAAAAADAACgAgAAAAAAAP5/3+D//v///x9AAAAAAAAAAAAAAAAA4P1mAAAAwwEAHgBkIAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAMAAAADAAAAAwAAAAAAAAAsD9A/g8gAAAAAAC4AAAAAAAAAAAAAAAAAABgAAAAAAIAAAAAAAAAAAAAAAAAAIcBBA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAJAAAAAAAAQH/lH/ifAAAAAAAA//////8//w8AAA8AAAAAANAXBAAAAAD4DwADAAAAPDsAAAAAAABAowMAAAAAAADwzwAAAAAAAAAAAAAAAAAAAAAAAAD3//0hEAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wDIAAAAfAAAAAAAAB/8AAAAAAAAAAAAAAAA/////wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAwAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAA/////wAAAAAAPAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAID3PwAAAMAAAAAAAAAAAAAAAwBECAAAYBAAAAAAAAAAAAAAAAAAAAAAAAAwAAAA//8DgAAAAADAPwAAgP8DAAAAAAAHAAAAAADIMwAAAAAgAAAAAAAAAAB+ZgAIEAAAAAAAEAAAAAAAAJ3BAgAAAAAwQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAICEAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAP//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAMAHAAAAAAAAAAAAAAAAAAAAAG7wAAAAAACHAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAPAAAAAAAAAAAD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAA/AAAAAAAAAAAwP8BAAAAAAA8AAAAAAAAAAAAAAAAAAAAAgAAAAAAAP9/AAAAAAAZgAMAAAAAAHgGBAAAAAAAAAAHAAAAgO8fAAAAAAAAAAgAAwAAAAAAwH8AngAAAAAAAAAAAAAAgNNAAgAAAAAAAAAAAAAAAAAAAAAAAID4BwAAAwAAAAAAABgBAAAAwB8fAAAAAAAAAAD4AUAFAAYAAAAAAAAAAAAA/1wAAEAAAAAAAAAAAAAA+IUNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8sAEAADAAAAAAAAAAAAAA+KcBAAAAAAAAAAAAAAAAKL8AAAAAAAAAAAAAAACgvA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgP8GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFgIAAAAAAAAAAAAAAAAAAAAAADwDAEAAAD+BwAAAAD4eYAAfg4AAAAAAPx/AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAF0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf78AAAAAAAAAAAAA/P///G0AAAAAAAAAAAAAAAAAAAB+tL8AAAAAAAAAAACjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAwAAAAAAwAcFAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//4H/PwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMD/4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwAAAAAAAAB/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAcAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAPAAAAAAAAAAAAAAD//////z///38AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAD+P/nDwAAADwAAAAAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////9/+P//////HyAAEAAA+P7/AAAAAAAAAAAAAH////nbBwAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAfwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASMAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfwAAAAAAAAAAAAAAAADwDwAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAA////////////////AAAAAAAAAAAAAAAAAAAAAP///////////////////////////////////////wAA"]].map(function([e,t,n]){return[e,t.split(",").map(r=>parseInt(r,36)),Uint8Array.from(atob(n),r=>r.charCodeAt(0))]});function He(A,e){return e===931||e===1010||e===120531||e===120589||e===120647||e===120705||e===120763?"\u03C3":e>=5112&&e<=5117?String.fromCodePoint(e-8):e>=43888&&e<=43967?String.fromCodePoint(e-38864):e>=93856&&e<=93880?String.fromCodePoint(e+27):e===837||e===890||e>=8064&&e<=8111||e>=8114&&e<=8188?A.normalize("NFD").replace(/\u0345/g,"\u03B9").normalize("NFC").toLowerCase():""}function te(A,e){for(let t=0;t<A.length;t+=2)if(e>=A[t]&&e<=A[t+1])return!0;return!1}function W(A,e){let[t,n,r]=A,u=e>>8;for(let h=0;h<t.length;h+=2)if(u>=t[h]&&u<=t[h+1])return!0;let l=n.indexOf(u);if(l<0)return!1;let a=255&e;return!!(r[32*l+(a>>3)]&1<<(7&a))}function _e(A){let e=Array.from(A,t=>t.codePointAt(0));for(let t=0;t<e.length;t++){let n=e[t];if(n!==8204&&n!==8205||t>0&&te(Re,e[t-1]))continue;if(n===8205)return!1;let r=t-1;for(;r>=0&&W(YA,e[r]);)r--;let u=t+1;for(;u<e.length&&W(YA,e[u]);)u++;if(!(r>=0&&u<e.length&&W(Ne,e[r])&&W(Le,e[u])))return!1}return!0}var Be=/(?![\p{Mark}\p{Decimal_Number}])[\p{Script=Arabic}\p{Script=Hebrew}]/u,je=/\p{Script=Latin}/u;function xe(A){return!Be.test(A)||!je.test(A)}var F=36,iA=1,IA=26,Me=38,Ue=700,$e=72,ze=128,Fe=2147483647;function VA(A){return String.fromCharCode(A+22+75*+(A<26))}function Qe(A,e,t){let n=0;for(A=t?Math.floor(A/Ue):A>>1,A+=Math.floor(A/e);A>(F-iA)*IA>>1;n+=F)A=Math.floor(A/(F-iA));return Math.floor(n+(F-iA+1)*A/(A+Me))}function Ge(A){let e=Array.from(A,h=>h.codePointAt(0)),t="",n=0;for(let h=0;h<e.length;h++){let f=e[h];f<128&&(t+=String.fromCharCode(f),n++)}let r=n;r&&(t+="-");let u=ze,l=0,a=$e;for(;n<e.length;){let h=Fe;for(let f=0;f<e.length;f++){let g=e[f];g>=u&&g<h&&(h=g)}l+=(h-u)*(n+1),u=h;for(let f=0;f<e.length;f++){let g=e[f];if(g<u&&l++,g===u){let p=l;for(let m=F;;m+=F){let y=m<=a?iA:m>=a+IA?IA:m-a;if(p<y)break;t+=VA(y+(p-y)%(F-y)),p=Math.floor((p-y)/(F-y))}t+=VA(p),a=Qe(l,n+1,n===r),l=0,n++}}l++,u++}return t}function pA(A){let e=10;if(A.length>=2&&A[0]==="0"&&(A[1]==="x"||A[1]==="X"))A=A.slice(2),e=16;else if(A.length>=2&&A[0]==="0")A=A.slice(1),e=8;else if(A==="")return-1;let t=0;for(let n=0;n<A.length;n++){let r=yA(A.charCodeAt(n));if(r>=e||r<0)return-1;t=t*e+r}return t}function XA(A){switch(A){case".":case"%2e":case"%2E":return!0;default:return!1}}function ne(A,e){return(A>=65&&A<=90||A>=97&&A<=122)&&(e===58||e===124)}function re(A){return A.length===2&&ne(A.codePointAt(0),A.codePointAt(1))}function JA(A){return A.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u)!==-1}function b(A){switch(A){case"ftp":case"http":case"https":case"ws":case"wss":case"file":return!0;default:return!1}}function se(A){switch(A){case"ftp":return 21;case"http":case"ws":return 80;case"https":case"wss":return 443;default:return null}}function CA(A,e){if(A[0]==="[")return A[A.length-1]==="]"?(function(n){let r=[0,0,0,0,0,0,0,0],u=null,l=0,a=0,h=Array.from(n,f=>f.codePointAt(0));if(h[a]===58){if(h[a+1]!==58)return null;a+=2,l++,u=l}for(;a<h.length;){if(l===8)return null;if(h[a]===58){if(u!==null)return null;a++,l++,u=l;continue}let f=0,g=0,p=0;for(;p<4&&(f=yA(h[a]))>=0;)g=(g<<4)+f,a++,p++;if(h[a]===46){if(p===0||l>6)return null;a-=p;let m=0;for(;h[a]!==void 0;){let y=0;if(m>0)if(h[a]===46&&m<4)a++;else return null;if(h[a]==null||h[a]<48||h[a]>57)return null;for(;h[a]>=48&&h[a]<=57;){if(y=10*y+yA(h[a]),y>255)return null;a++}r[l]=256*r[l]+y,m++,m%2==0&&l++}if(m!==4)return null;break}else if(h[a]===58){if(h[++a]===void 0)return null}else if(h[a]!==void 0)return null;r[l]=g,l++}if(u!==null){let f=l-u;for(l=7;l!==0&&f>0;){let g=r[u+f-1];r[u+f-1]=r[l],r[l]=g,l--,f--}}else if(u===null&&l!==8)return null;return r})(A.substring(1,A.length-1)):null;if(e)return(function(n){return JA(n)?null:U(n,AA)})(A);{let t=(function(r){let u=!1,l=!1;for(let h=0;h<r.length;h++){let f=r.charCodeAt(h);if(f<=32||f===37||f===127)return null;if(f>=128){u=!0;break}f>=65&&f<=90&&(l=!0)}if(!u)return r!==""?l?r.toLowerCase():r:null;if((function(f){for(let g of f){let p=g.codePointAt(0);if(/[\p{Cn}\p{Co}\p{Cs}\p{Noncharacter_Code_Point}]/u.test(g)&&!te(Te,p)||W(qe,p))return!0}return!1})(r))return null;let a=(r=(function(f){let g="";for(let p of f){let m=p.codePointAt(0);if(m!==8204&&m!==8205&&/\p{Default_Ignorable_Code_Point}/u.test(p))continue;let y=He(p,m);if(y){g+=y;continue}let k=ve.indexOf(m);g+=k<0?p:Oe[k]}return g})(r).normalize("NFKC").replace(/[\u3002\uff0e\uff61]/g,".").toLowerCase()).split(".");for(let h=0;h<a.length;h++){let f=a[h];if(f==="")continue;let g=/[^\0-\x7f]/.test(f);if(ke(f)||g&&(/^\p{Mark}/u.test(f)||!_e(f)||!xe(f)||f.startsWith("xn--")))return null;g&&(a[h]=`xn--${Ge(f)}`)}return(r=a.join("."))!==""?r:null})(A.indexOf("%")===-1?A:PA(A));return t===null||JA(t)?null:(function(r){let u=r.length,l=r.lastIndexOf(".",u-2)+1;if(r.charCodeAt(u-1)===46&&u--,u<=l)return!1;if(pA(r.slice(l,u))>=0)return!0;for(;l<u;l++){let a=r.charCodeAt(l);if(a<48||a>57)return!1}return!0})(t)?(function(r){let u=r.split("."),l=u.length;if(u[l-1]||l--,l>4)return null;let a=0;for(let f=0;f<l-1;f++){let g=pA(u[f]);if(g<0||g>255)return null;a+=g*(1<<8*(3-f))}let h=pA(u[l-1]);return h<0||h>=256**(5-l)?null:(a+=h,a)})(t):t}}function bA(A){return typeof A=="number"?(function(t){let r="";return r+=`${(t>>>24&255).toString(10)}.`,r+=`${(t>>>16&255).toString(10)}.`,r+=`${(t>>>8&255).toString(10)}.`,r+=(t&255).toString(10),r})(A):Array.isArray(A)?`[${(function(t){let n=(function(a){let h=-1,f=-1,g=1,p=0;for(let m=0;m<a.length;++m)a[m]!==0?(p>g&&(h=f,g=p),f=-1,p=0):(f===-1&&(f=m),++p);return p>g?f:h})(t),r="",u=!1;for(let l=0;l<=7;++l)if(!(u&&t[l]===0)){if(u&&(u=!1),n===l){r+=l===0?"::":":",u=!0;continue}r+=t[l].toString(16),l!==7&&(r+=":")}return r})(A)}]`:A}function oe(A){A.path.length>0&&(A.path.length!==1||A.scheme!=="file"||!(function(t){return/^[A-Za-z]:$/u.test(t)})(A.path[0]))&&A.path.pop()}function ie(A){return A.username!==""||A.password!==""}function gA(A){return A.host===null||A.host===""||A.scheme==="file"}var s=0,o="",w="",D=null,i,lA=!1,uA=!1,G=!1,E;function H(A,e,t,n){e||(A=(function(l){let a=0,h=l.length;for(;a<h&&!(l.charCodeAt(a)>32);++a);for(;h>a&&!(l.charCodeAt(h-1)>32);--h);return l.substring(a,h)})(A)),A=(function(l){let a=0;for(;a<l.length;a++){let f=l.charCodeAt(a);if(f===9||f===10||f===13)break}if(a===l.length)return l;let h=l.slice(0,a);for(;a<l.length;a++){let f=l.charCodeAt(a);f!==9&&f!==10&&f!==13&&(h+=l[a])}return h})(A),s=0,o=A,w="",D=t||null,i=e||{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,opaquePath:!1},lA=!1,uA=!1,G=!1,E=n||0;let r=Ke;switch(n){case 3:case 4:r=aA;break;case 5:r=RA;break;case 6:r=K;break;case 7:r=Q;break;case 8:r=$}return r(c(A,s))!==1?i:null}function d(A,e){return s+=s===A?j(e):1,s<=o.length}function c(A,e){return e<A.length?A.codePointAt(e):void 0}function j(A){return A!=null&&A>65535?2:1}function le(A){return A==null?"":A<=65535?String.fromCharCode(A):String.fromCodePoint(A)}var Ke=A=>{let e=s;if(A!=null&&(A>=65&&A<=90||A>=97&&A<=122)){let t=s+1;for(A=o.charCodeAt(t);A===43||A===45||A===46||A>=65&&A<=90||A>=97&&A<=122||A>=48&&A<=57;)t++,A=o.charCodeAt(t);return w=o.slice(s,t).toLowerCase(),s=t,Ye(t<o.length?A:void 0)}else return E?1:(--s,d(e,A)?ue(c(o,s)):0)},Ye=A=>{let e=s;if(A===58){if(E){if(b(i.scheme)!==b(w))return 0;if((ie(i)||i.port!==null)&&w==="file")return 0;if(i.scheme==="file"&&i.host==="")return 0}return i.scheme=w,E?(i.port===se(i.scheme)&&(i.port=null),0):(w="",i.scheme==="file"?d(e,A)?kA(c(o,s)):0:b(i.scheme)&&D!==null&&D.scheme===i.scheme?d(e,A)?Ve(c(o,s)):0:b(i.scheme)?d(e,A)?Je(c(o,s)):0:c(o,s+1)===47?(s++,d(e,A)?Xe(c(o,s)):0):(i.path=[""],i.opaquePath=!0,d(e,A)?ae(c(o,s)):0))}else return E?1:(w="",s=-1,d(e,A)?ue(c(o,s)):0)},ue=A=>{let e=s;return D===null||D.opaquePath&&A!==35?1:D.opaquePath&&A===35?(i.scheme=D.scheme,i.path=D.path.slice(),i.opaquePath=D.opaquePath,i.query=D.query,i.fragment="",d(e,A)?$(c(o,s)):0):D.scheme==="file"?(s--,d(e,A)?kA(c(o,s)):0):(s--,d(e,A)?OA(c(o,s)):0)},Ve=A=>{let e=s;return A===47&&c(o,s+1)===47?(++s,d(e,A)?hA(c(o,s)):0):(s--,d(e,A)?OA(c(o,s)):0)},Xe=A=>{let e=s;return A===47?d(e,A)?J(c(o,s)):0:(s--,d(e,A)?x(c(o,s)):0)},OA=A=>{let e=s;return i.scheme=D.scheme,A===47||b(i.scheme)&&A===92?d(e,A)?WA(c(o,s)):0:(i.username=D.username,i.password=D.password,i.host=D.host,i.port=D.port,i.path=D.path.slice(),i.query=D.query,A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?$(c(o,s)):0):A!=null?(i.query=null,i.path.pop(),s--,d(e,A)?x(c(o,s)):0):d(e,A)?OA(c(o,s)):0)},WA=A=>{let e=s;return b(i.scheme)&&(A===47||A===92)?d(e,A)?hA(c(o,s)):0:A===47?d(e,A)?J(c(o,s)):0:(i.username=D.username,i.password=D.password,i.host=D.host,i.port=D.port,s--,d(e,A)?x(c(o,s)):0)},Je=A=>{let e=s;return A===47&&c(o,s+1)===47?s++:s--,d(e,A)?hA(c(o,s)):0},hA=A=>{let e=s;return A!==47&&A!==92?(s--,d(e,A)?J(c(o,s)):0):d(e,A)?hA(c(o,s)):0},J=A=>{let e=s;if(A!=null&&A!==64&&A!==35&&A!==47&&A!==63&&(A!==92||!b(i.scheme))){let t=s+j(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===64||n===35||n===47||n===63||n===92&&b(i.scheme))break;t+=j(n)}return w+=o.slice(s,t),s=t-1,d(e,A)?J(c(o,s)):0}if(A===64){lA&&(w=`%40${w}`),lA=!0;for(let t=0;t<w.length;t++){let n=w.codePointAt(t);if(n===58&&!uA){uA=!0;continue}let r=ee(n,cA);uA?i.password+=r:i.username+=r,n!=null&&n>65535&&t++}return w="",d(e,A)?J(c(o,s)):0}else return A==null||A===35||A===47||A===63||A===92&&b(i.scheme)?lA&&w===""?1:(s-=w.length+1,w="",d(e,A)?aA(c(o,s)):0):(w+=le(A),d(e,A)?J(c(o,s)):0)},aA=A=>{let e=s;if(E&&i.scheme==="file")return s--,d(e,A)?qA(c(o,s)):0;if(A!=null&&A!==58&&A!==35&&A!==47&&A!==63&&(A!==92||!b(i.scheme))){let t=s+j(A);for(A===91?G=!0:A===93&&(G=!1);t<o.length;){let n=c(o,t);if(n==null||!G&&n===58||n===35||n===47||n===63||n===92&&b(i.scheme))break;n===91?G=!0:n===93&&(G=!1),t+=j(n)}return w+=o.slice(s,t),s=t-1,d(e,A)?aA(c(o,s)):0}else if(A===58&&!G){if(w===""||E===4)return 1;let t=CA(w,!b(i.scheme));return t===null?1:(i.host=bA(t),w="",d(e,A)?RA(c(o,s)):0)}else if(A==null||A===35||A===47||A===63||A===92&&b(i.scheme)){if(s--,b(i.scheme)&&w==="")return 1;if(E&&w===""&&(ie(i)||i.port!==null))return 1;let t=CA(w,!b(i.scheme));return t===null?1:(i.host=bA(t),w="",E?0:d(e,A)?K(c(o,s)):0)}else return w+=le(A),d(e,A)?aA(c(o,s)):0},RA=A=>{let e=s;if(A!=null&&A>=48&&A<=57){let t=s+1;for(;t<o.length;){let n=o.charCodeAt(t);if(n<48||n>57)break;t++}return w+=o.slice(s,t),s=t-1,d(e,A)?RA(c(o,s)):0}else if(E||A==null||A===35||A===47||A===63||A===92&&b(i.scheme)){if(w!==""){let t=parseInt(w,10);if(t>65535)return 1;if(i.port=t===se(i.scheme)?null:t,w="",E)return 0}return E?1:(s--,d(e,A)?K(c(o,s)):0)}else return 1};function ce(A,e){let t=A.length-e;if(t<2)return!1;if(ne(c(A,e),c(A,e+1))){if(t===2)return!0;{let n=c(A,e+2);return n===47||n===92||n===63||n===35}}else return!1}var kA=A=>{let e=s;return i.scheme="file",i.host="",A===47||A===92?d(e,A)?We(c(o,s)):0:D?.scheme==="file"?(i.host=D.host,i.path=D.path.slice(),i.opaquePath=D.opaquePath,i.query=D.query,A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?$(c(o,s)):0):A!=null?(i.query=null,ce(o,s)?i.path=[]:oe(i),s--,d(e,A)?x(c(o,s)):0):d(e,A)?kA(c(o,s)):0):(s--,d(e,A)?x(c(o,s)):0)},We=A=>{let e=s;return A===47||A===92?d(e,A)?qA(c(o,s)):0:(D!==null&&D.scheme==="file"&&(!ce(o,s)&&(function(n){if(n.length===2){let r=n.codePointAt(0),u=n.codePointAt(1);return(r>=65&&r<=90||r>=97&&r<=122)&&u===58}else return!1})(D.path[0])&&i.path.push(D.path[0]),i.host=D.host),s--,d(e,A)?x(c(o,s)):0)},qA=A=>{let e=s;if(A!=null&&A!==47&&A!==92&&A!==63&&A!==35){let t=s+j(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||n===92||n===63||n===35)break;t+=j(n)}return w+=o.slice(s,t),s=t-1,d(e,A)?qA(c(o,s)):0}else if(A==null||A===47||A===92||A===63||A===35){if(s--,!E&&re(w))return d(e,A)?x(c(o,s)):0;if(w==="")return i.host="",E?0:d(e,A)?K(c(o,s)):0;{let t=CA(w,!b(i.scheme));return t===null?1:(t==="localhost"&&(t=""),i.host=bA(t),w="",E?0:d(e,A)?K(c(o,s)):0)}}return 1},K=A=>{let e=s;return b(i.scheme)?(A!==92&&A!==47&&s--,d(e,A)?x(c(o,s)):0):!E&&A===63?(i.query="",d(e,A)?Q(c(o,s)):0):!E&&A===35?(i.fragment="",d(e,A)?$(c(o,s)):0):A!=null?(A!==47&&s--,d(e,A)?x(c(o,s)):0):(E&&i.host===null&&i.path.push(""),d(e,A)?K(c(o,s)):0)},x=A=>{let e=s;if(A!=null&&A!==47&&(!b(i.scheme)||A!==92)&&(E||A!==63&&A!==35)){let t=s+j(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||b(i.scheme)&&n===92||!E&&(n===63||n===35))break;t+=j(n)}w+=U(o.slice(s,t),DA),s=t,A=c(o,t)}if(A==null||A===47||b(i.scheme)&&A===92||!E&&(A===63||A===35)){let t=b(i.scheme)&&A===92;return(function(r){switch(r){case"..":case"%2e.":case"%2E.":case".%2e":case".%2E":case"%2e%2e":case"%2E%2e":case"%2e%2E":case"%2E%2E":return!0;default:return!1}})(w)?(oe(i),A!==47&&!t&&i.path.push("")):XA(w)&&A!==47&&!t?i.path.push(""):XA(w)||(i.scheme==="file"&&i.path.length===0&&re(w)&&(w=`${w[0]}:`),i.path.push(w)),w="",A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?$(c(o,s)):0):d(e,A)?x(c(o,s)):0}else return w+=ee(A,DA),d(e,A)?x(c(o,s)):0},ae=A=>{let e=s;if(A===63)return i.query="",d(e,A)?Q(c(o,s)):0;if(A===35)return i.fragment="",d(e,A)?$(c(o,s)):0;if(A!=null){let t=s+j(A);for(;t<o.length;){let r=c(o,t);if(r===63||r===35)break;t+=j(r)}let n=o.slice(s,t);if(t<o.length&&n.charCodeAt(n.length-1)===32?i.path[0]+=U(n.slice(0,-1),AA)+"%20":i.path[0]+=U(n,AA),s=t,(A=c(o,t))===63)return i.query="",d(e,A)?Q(c(o,s)):0;if(A===35)return i.fragment="",d(e,A)?$(c(o,s)):0}return d(e,A)?ae(c(o,s)):0},Q=A=>{let e=s,t=s;if(A!=null){if(E)t=o.length;else{let r=o.indexOf("#",s);t=r===-1?o.length:r}let n=b(i.scheme)?Ee:TA;i.query+=U(o.slice(s,t),n)}return s=t,c(o,t)===35&&!E?(i.fragment="",d(e,A)?$(c(o,s)):0):d(e,A)?Q(c(o,s)):0},$=A=>{let e=s;return A!=null&&(i.fragment+=U(o.slice(s),be),s=o.length),d(e,A)?$(c(o,s)):0};function EA(A){if(A.opaquePath)return A.path[0];{let e="";for(let t of A.path)e+=`/${t}`;return e}}function fe(A){switch(A.scheme){case"blob":{let e=H(EA(A),null,null,0);return e===null||e.scheme!=="http"&&e.scheme!=="https"?"null":fe(e)}case"ftp":case"http":case"https":case"ws":case"wss":return(function(t){let n=`${t.scheme}://`;return n+=t.host,t.port!==null&&(n+=`:${t.port}`),n})(A);default:return"null"}}var S=Symbol("URLImpl"),eA=class A{constructor(e,t){if(e===void 0&&t===void 0)throw new TypeError('The "url" argument must be specified.');e=I(e),t!=null&&(t=I(t));let n=null;if(t!=null&&(n=H(t,null,null,0),n==null))throw new TypeError(`Invalid base URL: ${t}`);let r=H(e,null,n,0);if(r==null)throw new TypeError(`Invalid URL: ${e}`);this[S]={url:r,query:null}}static createObjectURL(e){throw new TypeError("URL.createObjetURL is unsupported")}static revokeObjectURL(e){}static parse(e,t){e=I(e),t!==void 0&&(t=I(t));try{return new A(e,t)}catch{return null}}static canParse(e,t){e=I(e),t!==void 0&&(t=I(t));let n=null;return t!=null&&(n=H(t,null,null,0),n==null)?!1:H(e,null,n,0)!=null}get href(){return(function(t){let n=`${t.scheme}:`;return t.host!==null&&(n+="//",(t.username!==""||t.password!=="")&&(n+=t.username,t.password!==""&&(n+=`:${t.password}`),n+="@"),n+=t.host,t.port!==null&&(n+=`:${t.port}`)),t.host===null&&!t.opaquePath&&t.path.length>1&&t.path[0]===""&&(n+="/."),n+=EA(t),t.query!==null&&(n+=`?${t.query}`),t.fragment!==null&&(n+=`#${t.fragment}`),n})(this[S].url)}set href(e){let t=H(e=I(e),null,null,0);if(t==null)throw new TypeError(`Invalid URL: ${e}`);this[S].url=t,this[S].query&&wA(this[S].query,t.query)}get origin(){return fe(this[S].url)}get protocol(){return`${this[S].url.scheme}:`}set protocol(e){H(`${e=I(e)}:`,this[S].url,null,2)}get username(){return this[S].url.username}set username(e){e=I(e),gA(this[S].url)||(function(n,r){n.username=U(r,cA)})(this[S].url,e)}get password(){return this[S].url.password}set password(e){e=I(e),gA(this[S].url)||(function(n,r){n.password=U(r,cA)})(this[S].url,e)}get host(){let{url:e}=this[S];return e.host==null?"":e.port==null?e.host:`${e.host}:${e.port}`}set host(e){e=I(e),this[S].url.opaquePath||H(e,this[S].url,null,3)}get hostname(){let{url:e}=this[S];return e.host!=null?e.host:""}set hostname(e){e=I(e),this[S].url.opaquePath||H(e,this[S].url,null,4)}get port(){let{url:e}=this[S];return e.port!=null?`${e.port}`:""}set port(e){e=I(e);let{url:t}=this[S];gA(t)||(e?H(e,t,null,5):t.port=null)}get pathname(){return EA(this[S].url)}set pathname(e){e=I(e);let{url:t}=this[S];t.opaquePath||(t.path=[],H(e,t,null,6))}get search(){let{url:e}=this[S];return e.query?`?${e.query}`:""}set search(e){e=I(e);let{url:t,query:n}=this[S];if(!e)t.query=null,n&&wA(n,null);else{let r=e[0]==="?"?e.substring(1):e;t.query="",H(r,t,null,7),n&&wA(n,t.query)}}get searchParams(){let e=this[S],t=e.query;return t==null&&(t=e.query=(function(r,u){let l=new fA;return l[C].url=r,l[C].serialized=u==null,u&&(l[C].list=vA(u)),l})(this,e.url.query)),t}get hash(){let{url:e}=this[S];return e.fragment?`#${e.fragment}`:""}set hash(e){e=I(e);let{url:t}=this[S];if(!e)t.fragment=null;else{let n=e[0]==="#"?e.substring(1):e;t.fragment="",H(n,t,null,8)}}toJSON(){return this.href}toString(){return this.href}};Object.defineProperty(eA.prototype,Symbol.toStringTag,{value:"URL",configurable:!0});var C=Symbol("URLSearchParamsImpl"),Ze=Symbol.dispose||Symbol.for("dispose");function wA(A,e){e?A[C].list=vA(e):A[C].list.length=0,A[C].serialized=e==null}function oA(A){if(A.url){let e=SA(A.list);(function(n,r){n[S].url.query=r})(A.url,e||null),A.serialized=!0}}var At=typeof Iterator<"u"?Iterator:Object,Z=class extends At{constructor(e,t){super(),this[C]={ptr:e,map:t,index:0}}next(){let e=this[C];return e.index<e.ptr.list.length?{value:e.map(e.ptr.list[e.index++]),done:!1}:{value:void 0,done:!0}}[Symbol.iterator](){return this}[Ze](){}},fA=class{constructor(e){let t=this[C]={list:[],url:null,serialized:!0},n;if(Array.isArray(e))for(let r=0;r<e.length;r++)t.list.push(QA(e[r]));else if((n=ZA(e))!=null){let r;for(;!(r=mA(n.next())).done;)t.list.push(QA(r.value))}else if((typeof e=="object"||typeof e=="function")&&e!=null){let r=Object.keys(e);for(let u=0;u<r.length;u++){let l=r[u],a=Ie(l),h=I(e[l]),f=t.list.find(g=>g[0]===a);f?f[1]=h:t.list.push([a,h])}}else if(e!==void 0){let r=I(e);r=r[0]==="?"?r.substring(1):r,t.list=vA(r)}}get size(){return this[C].list.length}append(e,t){e=I(e),t=I(t),this[C].list.push([e,t]);let n=this[C];n.url&&n.serialized?(function(u,l){let a=u[S].url;a.query=a.query?`${a.query}&${l}`:l})(n.url,SA([[e,t]])):oA(n)}delete(e,t){e=I(e),t=t!=null?I(t):void 0;let{list:n}=this[C],r=0;for(;r<n.length;)n[r][0]===e&&(t==null||n[r][1]===t)?n.splice(r,1):r++;oA(this[C])}get(e){e=I(e);let{list:t}=this[C];for(let n=0;n<t.length;n++)if(t[n][0]===e)return t[n][1];return null}getAll(e){e=I(e);let t=[],{list:n}=this[C];for(let r=0;r<n.length;r++)n[r][0]===e&&t.push(n[r][1]);return t}has(e,t){e=I(e),t=t!=null?I(t):void 0;let{list:n}=this[C];for(let r=0;r<n.length;r++)if(n[r][0]===e&&(t==null||n[r][1]===t))return!0;return!1}set(e,t){e=I(e),t=I(t);let{list:n}=this[C],r=!1,u=!1,l=0;for(;l<n.length;)n[l][0]===e?r?(n.splice(l,1),u=!0):(r=!0,n[l][1]!==t&&(n[l][1]=t,u=!0),l++):l++;r||(n.push([e,t]),u=!0),u&&oA(this[C])}sort(){this[C].list.sort((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0),oA(this[C])}forEach(e,t){if(typeof e!="function")throw new TypeError('The "callback" argument must be of type function');let{list:n}=this[C];for(let r=0;r<n.length;r++)e.call(t,n[r][1],n[r][0],this)}entries(){return new Z(this[C],e=>e)}keys(){return new Z(this[C],e=>e[0])}values(){return new Z(this[C],e=>e[1])}toString(){return SA(this[C].list)}[Symbol.iterator](){return this.entries()}};Object.defineProperty(fA.prototype,Symbol.toStringTag,{value:"URLSearchParams",configurable:!0});var NA="X-Indiana-Protocol",he="X-Indiana-SDK-Version";var LA={current:"0.10"};function de(A){let e,t=()=>typeof e=="string"?e:e?.accessToken,n=0,r,u=new Map,l=()=>{for(let p of[...u.keys()])try{p()}catch{}};function a(p){let m=++n;r=void 0,e=void 0;for(let y of[...u.values()])try{y?.()}catch{}m===n&&(e=p,l())}let h=()=>a();function f(p,m=!1){let y=$A.safeParse(p);if(!y.success||m&&Date.parse(y.data.expiresAt)<=Date.now()||Date.parse(y.data.refreshExpiresAt)<=Date.now()||Date.parse(y.data.refreshExpiresAt)<Date.parse(y.data.expiresAt))throw new P("INVALID_RESPONSE","Invalid customer session credentials");return y.data}async function g(){if(r)return r;let p=typeof e=="object"?e:void 0,m=n;if(!p||Date.parse(p.refreshExpiresAt)<=Date.now())throw p&&h(),new P("UNAUTHENTICATED","Customer authentication is required",401);let y=(async()=>{try{let k=await A(p.refreshToken);if(m!==n)throw new P("IDENTITY_CHANGED","Customer identity changed during refresh");let Y=f(k,!0);if(Y.customerId!==p.customerId||Y.sessionId!==p.sessionId)throw new P("SCOPE_MISMATCH","Refresh changed the customer session");return e=Y,{...Y}}catch(k){throw m!==n?new P("IDENTITY_CHANGED","Customer identity changed during refresh"):(k instanceof P&&k.status===401&&h(),k)}})();r=y;try{return await y}finally{r===y&&(r=void 0)}}return{identify(p){let m=typeof p=="string"?p:f(p),y=typeof m=="string"?m:m.accessToken;if(!y.trim()||/\s/.test(y)||y.length>4096)throw new P("INVALID_TOKEN","A server-issued token is required");a(m)},reset:h,subscribeIdentity(p,m){return u.set(p,m),()=>{u.delete(p)}},access(){let p=typeof e=="object"?e:void 0;if(p&&Date.parse(p.expiresAt)<=Date.now()+3e4){let y=n;return g().then(()=>{let k=t();if(y!==n||!k)throw new P("IDENTITY_CHANGED","Customer identity changed during refresh");return k})}let m=t();if(!m)throw new P("NOT_IDENTIFIED","Identify a customer session before making a request");return m},peek:t,snapshot:()=>typeof e=="object"?{...e}:void 0,refresh:g}}var pe=Symbol("IndianaNoContent");function gt(A,e,t=eA){let n=A.configuration?.scope,r=A.scope??(n&&{projectId:n.projectId,environment:n.environment}),u=r?sA.parse(r):void 0;if(u&&n&&(u.projectId!==n.projectId||u.environment!==n.environment))throw new P("SCOPE_MISMATCH","Configuration belongs to another App/environment");let l=new t(A.baseUrl??FA);if(l.username||l.password||l.search||l.hash)throw new P("INVALID_URL","baseUrl must not contain credentials, query, or fragment");if(l.protocol!=="https:"&&!(l.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(l.hostname)))throw new P("INVALID_URL","Use HTTPS, or HTTP on localhost during development");let a=A.fetch??globalThis.fetch.bind(globalThis),h=A.timeoutMs??1e4;if(!Number.isFinite(h)||h<1||h>12e4)throw new P("INVALID_TIMEOUT","timeoutMs must be between 1 and 120000");let f=!1,g=0,p=null,m=new Set,y=A.session??de(async v=>{let R=await tA("customer-sessions/refresh",{},"POST",{},v);if(!R||typeof R!="object")throw new P("INVALID_RESPONSE","Invalid refresh response");let{requestId:_,scope:B,...V}=R;return V});function k(){g+=1,p=null;for(let v of m)v.abort();m.clear()}let Y=y.subscribeIdentity(k);function ge(){f||y.reset()}async function tA(v,R={},_="POST",B={},V){let N=B.installationDetach===!0;if(N&&(v!=="push/installations/detach"||_!=="POST"))throw new P("INVALID_REQUEST","Installation authority only detaches this installation");if(!V&&!N)throw new P("NOT_IDENTIFIED","Call identify with a server-issued customer token first");let X=g,L=new AbortController;N||m.add(L);let nA=()=>!N&&X!==g?new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):new P("TIMEOUT","The request timed out"),dA,ye=new Promise((O,q)=>{dA=()=>q(nA()),L.signal.addEventListener("abort",dA,{once:!0})}),Pe=setTimeout(()=>L.abort(),B.timeoutMs??h),De=async()=>{let O=await a(`${l.href.replace(/\/$/,"")}/api/v1/${v}`,{method:_,headers:{...B.headers,"Content-Type":"application/json",...N?{}:{Authorization:`Bearer ${V}`},[NA]:LA.current,[he]:zA.version,...u?{"X-Indiana-Project":u.projectId,"X-Indiana-Environment":u.environment}:{}},body:_==="POST"?JSON.stringify(R):void 0,signal:L.signal,credentials:"omit",cache:_==="POST"&&typeof document<"u"?"default":"no-store",redirect:"error",...B.keepalive?{keepalive:!0}:{}});if(L.signal.aborted)throw nA();let q;try{q=O.status===204?pe:await O.json()}catch{throw L.signal.aborted?nA():new P(O.ok?"INVALID_RESPONSE":"HTTP_ERROR","The gateway returned an unreadable response",O.status,O.headers.get("X-Request-Id")??void 0)}if(L.signal.aborted)throw nA();if(!N&&X!==g)throw new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight");if(!O.ok){let T=MA.safeParse(et(q)),z=T.success&&(!BA.safeParse(T.data.error.code).success||xA(T.data.error.code,O.status)),HA=z?T.data.error.code:"HTTP_ERROR",_A=UA(HA,O.status,{retryAfter:O.headers.get("Retry-After"),recovery:z?T.data.error.recovery:void 0,reason:z?T.data.error.reason:void 0});throw new P(HA,z?T.data.error.message:"The request failed",O.status,O.headers.get("X-Request-Id")??(T.success?T.data.requestId:void 0),{..._A,...T.success&&T.data.error.retryable===!1?{retryable:!1}:{},..._A.retryAfterSeconds===void 0&&T.success&&T.data.error.retryAfterSeconds!==void 0?{retryAfterSeconds:T.data.error.retryAfterSeconds}:{}})}if(O.headers.get(NA)!==LA.current)throw new P("PROTOCOL_MISMATCH","Response protocol does not match this SDK");if(u&&q!==pe){let T=q&&typeof q=="object"&&"scope"in q?q:q&&typeof q=="object"&&"configuration"in q?q.configuration:null;if(!T||typeof T!="object"||!("scope"in T))throw new P("INVALID_RESPONSE","Response is missing its App/environment scope");let z=sA.safeParse(T.scope);if(!z.success||z.data.projectId!==u.projectId||z.data.environment!==u.environment)throw new P("SCOPE_MISMATCH","Response scope does not match this SDK instance")}let rA=O.headers.get("X-Indiana-Telemetry-Subject");if(rA){if(!/^[a-f0-9]{64}$/.test(rA))throw new P("INVALID_RESPONSE","Invalid telemetry identity");p!==rA&&(p=rA,e?.(p))}return q};try{return await Promise.race([De(),ye])}catch(O){throw!N&&X!==g?new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):O instanceof P?O:new P(L.signal.aborted?"TIMEOUT":"NETWORK_ERROR",L.signal.aborted?"The request timed out":"Unable to read the response")}finally{clearTimeout(Pe),L.signal.removeEventListener("abort",dA),m.delete(L)}}function we(v,R={},_="POST",B={}){if(f)return Promise.reject(new P("CLOSED","SDK client was destroyed"));if(B.installationDetach)return tA(v,R,_,B);let V=g;try{let N=y.access(),X=L=>{if(V!==g)throw new P("IDENTITY_CHANGED","Customer identity changed before dispatch");return tA(v,R,_,B,L)};return typeof N=="string"?X(N):N.then(X)}catch(N){return Promise.reject(N)}}let me=Object.assign(we,{captureIdentity(){let v=g,R=f,_=!!y.peek();return()=>{if(R)throw new P("CLOSED","SDK client was destroyed");if(!_)throw new P("NOT_IDENTIFIED","Call identify with a server-issued customer token first");if(v!==g)throw new P("IDENTITY_CHANGED","Customer identity changed before dispatch")}}});return{session:y,requestWithCredential(v,R,_,B={}){return f?Promise.reject(new P("CLOSED","SDK client was destroyed")):tA(v,R,"POST",B,_)},subjectKey:()=>p,identify(v){if(f)throw new P("CLOSED","SDK client was destroyed");if(u&&typeof v=="object"&&"scope"in v){let R=sA.safeParse(v.scope);if(!R.success||R.data.projectId!==u.projectId||R.data.environment!==u.environment)throw new P("SCOPE_MISMATCH","Customer session belongs to another App/environment")}y.identify(v)},reset:ge,dispose(){f||(f=!0,Y(),k())},request:me}}function et(A){if(!A||typeof A!="object"||!("error"in A))return A;let e=A.error;if(!e||typeof e!="object"||!("reason"in e)||jA.safeParse(e.reason).success)return A;let{reason:t,...n}=e;return{...A,error:n}}export{eA as a,gt as b};
|
package/dist/chunk-HX36OZPQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{M as S,a as v,b as A,c as C,f as h,g as f,k as w,l as j,m as R,n as M,o as P,q as b,r as y}from"./chunk-MTIOLSVM.js";import{j as O,o as q,p as B}from"./chunk-IYHXEKAD.js";import{a as D,b as g,c as k,d as N}from"./chunk-BIT6YWM7.js";import{a as s,d as U}from"./chunk-2Y5SGDC6.js";import{b as t}from"./chunk-NOOIJXRN.js";var me=t.registry(),{BillingInterval:F}=(()=>{var e;return(function(i){i.OneOff="one_off",i.Week="week",i.Month="month",i.Quarter="quarter",i.SemiAnnual="semi_annual",i.Year="year"})(e||(e={})),{BillingInterval:e}})(),{DisplaySchema:de}=(e=>({DisplaySchema:e.object({primary_text:e.string().meta({description:"Main display text (e.g. '$10' or '100 messages')."}),secondary_text:e.string().optional().meta({description:"Secondary display text (e.g. 'per month' or 'then $0.5 per 100')."})})}))(t),{withSpecDefault:pe}=(e=>({withSpecDefault:({schema:r,defaultValue:n,description:a})=>(e.add(r,{description:a,default:n}),r)}))(me),{COMMON:L}={COMMON:["usd","eur","gbp","cad","aud","jpy","chf","cny","inr"]},{STRIPE_PRESENTMENT_CURRENCIES:le}={STRIPE_PRESENTMENT_CURRENCIES:["usd","aed","afn","all","amd","ang","aoa","ars","aud","awg","azn","bam","bbd","bdt","bif","bmd","bnd","bob","brl","bsd","bwp","byn","bzd","cad","cdf","chf","clp","cny","cop","crc","cve","czk","djf","dkk","dop","dzd","egp","etb","eur","fjd","fkp","gbp","gel","gip","gmd","gnf","gtq","gyd","hkd","hnl","htg","huf","idr","ils","inr","isk","jmd","jpy","kes","kgs","khr","kmf","krw","kyd","kzt","lak","lbp","lkr","lrd","lsl","mad","mdl","mga","mkd","mmk","mnt","mop","mur","mvr","mwk","mxn","myr","mzn","nad","ngn","nio","nok","npr","nzd","pab","pen","pgk","php","pkr","pln","pyg","qar","ron","rsd","rub","rwf","sar","sbd","scr","sek","sgd","shp","sle","sos","srd","std","szl","thb","tjs","top","try","ttd","twd","tzs","uah","ugx","uyu","uzs","vnd","vuv","wst","xaf","xcd","xcg","xof","xpf","yer","zar","zmw"]},{COMMON_SET:he}=(e=>({COMMON_SET:new Set(e)}))(L),{hasNoDuplicateCurrencies:Q}={hasNoDuplicateCurrencies:i=>{let r=new Set;for(let{currency:n}of i){let a=n.toLowerCase();if(r.has(a))return!1;r.add(a)}return!0}},{DUPLICATE_CURRENCY_MESSAGE:V}={DUPLICATE_CURRENCY_MESSAGE:"Each currency may appear at most once in additional_currencies."},{ApiStripePriceProcessorSchema:fe}=(e=>({ApiStripePriceProcessorSchema:e.object({price_id:e.string().meta({description:"Stripe price ID. For prepaid with included > 0 this is the V2 price."})})}))(t),{Infinite:be}={Infinite:"inf"},{TierBehavior:ye}=(()=>{var e;return(function(i){i.Graduated="graduated",i.VolumeBased="volume"})(e||(e={})),{TierBehavior:e}})(),{BillingMethod:G}=(()=>{var e;return(function(i){i.Prepaid="prepaid",i.UsageBased="usage_based"})(e||(e={})),{BillingMethod:e}})(),{AllocatedBilling:ge}=(()=>{var e;return(function(i){i.Arrear="arrear",i.ProratedLegacy="prorated_legacy"})(e||(e={})),{AllocatedBilling:e}})(),{CREDIT_DIMENSION_NAME_MAX_LENGTH:Se}={CREDIT_DIMENSION_NAME_MAX_LENGTH:64},{USAGE_ATTRIBUTION_DIMENSION_SEPARATOR:_e}={USAGE_ATTRIBUTION_DIMENSION_SEPARATOR:"::"},{CreditMatchSchema:Ie}=(e=>({CreditMatchSchema:e.record(e.string(),e.union([e.string(),e.number(),e.boolean()]).transform(String).pipe(e.string()))}))(t),{ApiCreditTierSchema:$}=(e=>({ApiCreditTierSchema:e.object({to:e.union([e.number().positive(),e.enum(["inf"])]).meta({description:"Inclusive upper usage boundary for this graduated tier. The final tier must be 'inf'."}),credit_cost:e.number().min(0).meta({description:"Credits consumed per billing-unit group within this tier."})})}))(t),{VIOLATION_MESSAGES:xe}={VIOLATION_MESSAGES:{non_final_infinity:"Only the final tier may use an 'inf' boundary.",not_increasing:"Tier boundaries must be strictly increasing.",final_not_infinity:"The final tier must use an 'inf' boundary."}},{MarkupEntrySchema:K}=(e=>({MarkupEntrySchema:e.object({markup:e.number().min(-100)})}))(t),{ModelMarkupsSchema:ve}=((e,i)=>({ModelMarkupsSchema:e.record(e.string().regex(/.+\/.+/,'Model keys are "<provider>/<model>", e.g. "openai/gpt-4o" or "custom/my-model".'),i.extend({markup:e.number().min(-100).optional(),input_cost:e.number().min(0).optional(),output_cost:e.number().min(0).optional()})).nullish()}))(t,K),{InvoiceUsageEntrySchema:Ae}=(e=>({InvoiceUsageEntrySchema:e.object({feature_id:e.string().meta({description:"The metered feature whose units are being converted."}),quantity:e.number().nonnegative().meta({description:"Billable units of the metered feature. Converted to the credit-system feature through its rate card."}),properties:e.record(e.string(),e.unknown()).optional().meta({description:"Event properties used to pick the rate card dimension and multipliers."})}).strict()}))(t),{AttachDiscountSchema:Z}=(e=>({AttachDiscountSchema:e.object({reward_id:e.string().optional().meta({description:"The ID of the reward to apply as a discount."}),promotion_code:e.string().optional().meta({description:"The promotion code to apply as a discount."})}).refine(r=>r.reward_id||r.promotion_code,{message:"Either reward_id or promotion_code must be provided."}).meta({title:"AttachDiscount",description:"A discount to apply. Can be either a reward ID or a promotion code."})}))(t),{CustomLineItemSchema:Ce}=(e=>({CustomLineItemSchema:e.object({amount:e.number().meta({description:"Amount in dollars for this line item (e.g. 10.50). Can be negative for credits."}),description:e.string().meta({description:"Description for the line item."})})}))(t),{UnixMsTimestampSchema:Me}=(e=>({UnixMsTimestampSchema:e.number().int().safe().nonnegative()}))(t),{CreateInvoicePreviewLineSchema:Pe}=(e=>({CreateInvoicePreviewLineSchema:e.object({plan_id:e.string().nullable(),feature_id:e.string().nullable(),description:e.string(),amount:e.number(),amount_after_discounts:e.number(),quantity:e.number().nullable(),prorated:e.boolean(),period_start:e.number().nullable(),period_end:e.number().nullable()})}))(t),{ReissueInvoiceParamsSchema:ht}=(e=>({ReissueInvoiceParamsSchema:e.object({invoice_id:e.string().meta({description:"The Autumn invoice ID to void and replace.",example:"inv_2b3c4d5e6f7g8h"}),invoice_template_id:e.string().optional().meta({description:"ID of an invoice template (configured in billing settings) whose footer and memo are applied to the replacement invoice."}),net_terms_days:e.number().int().positive().optional().meta({description:"Number of days the customer has to pay the replacement invoice. Defaults to the original invoice's due date; required when that date has already passed."}),update_customer_email:e.email().optional().meta({description:"Updates the customer's billing email before the replacement is issued, so Stripe sends the new invoice to this address."})})}))(t),{InvoiceModeParamsSchema:p}=(e=>({InvoiceModeParamsSchema:e.object({enabled:e.boolean().meta({description:"When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method."}),enable_plan_immediately:e.boolean().default(!1).meta({description:"If true, enables the plan immediately even though the invoice is not paid yet."}),finalize:e.boolean().default(!0).meta({description:"If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review."}),invoice_template_id:e.string().optional().meta({description:"ID of an invoice template (configured in billing settings) whose footer (e.g. bank details) is applied to the invoice."}),net_terms_days:e.number().int().positive().optional().meta({description:"Number of days the customer has to pay the invoice before it is due (Stripe days_until_due)."})}).meta({title:"InvoiceMode",description:"Invoice mode configuration. Creates an invoice instead of charging the card immediately."})}))(t),{InvoiceTemplateSchema:ft}=(e=>({InvoiceTemplateSchema:e.object({id:e.string().meta({description:"Unique identifier for the invoice template."}),name:e.string().meta({description:"User-defined name to distinguish this template when sending an invoice."}),footer:e.string().optional().meta({description:"Footer text rendered on the invoice, typically bank details so customers can pay directly."}),memo:e.string().optional().meta({description:"Memo shown near the top of the invoice (Stripe invoice description), e.g. a contact line for payment questions."}),net_terms_days:e.number().int().positive().optional().meta({description:"Default number of days the customer has to pay before the invoice is due. Overridable when sending."}),created_at:e.number().optional().meta({description:"Timestamp (ms) when the template was created."})})}))(t),{BasePriceSchema:Oe}=((e,i,r)=>({BasePriceSchema:e.object({amount:e.number().meta({description:"Base price amount for the plan, in major currency units (e.g. dollars)."}),interval:e.enum(i).meta({description:"Billing interval (e.g. 'month', 'year')."}),interval_count:e.number().optional().meta({description:"Number of intervals per billing cycle. Defaults to 1."}),display:r.optional().meta({description:"Display text for showing this price in pricing pages."})})}))(t,F,de),{CURRENCY_CODES:Ee}=((e,i,r)=>({CURRENCY_CODES:[...e,...i.filter(a=>!r.has(a)).sort()]}))(L,le,he),{ApiPriceProcessorsSchema:W}=((e,i)=>({ApiPriceProcessorsSchema:e.object({stripe:i.nullish()}).meta({"x-atmn-mapping":!0})}))(t,fe),{AllocatedBillingFieldSchema:Te}=((e,i)=>({AllocatedBillingFieldSchema:e.enum(i).optional().meta({internal:!0,description:"How an allocated usage_based price bills mid-cycle quantity changes. 'arrear' (default) bills at period end. 'prorated_legacy' is only returned for prices still on the legacy immediate-proration behavior; omit it to migrate the price to 'arrear'."})}))(t,ge),{CreditDimensionNameSchema:we}=((e,i,r)=>({CreditDimensionNameSchema:e.string().min(1).max(i).refine(a=>!a.includes(r),{message:`Dimension names cannot contain "${r}"`})}))(t,Se,_e),{ApiCreditMatchSchema:Y}=(e=>({ApiCreditMatchSchema:e.meta({description:"Event properties this entry applies to. Every key must equal the tracked property, compared as strings."})}))(Ie),{findCreditTierViolations:je}=(e=>({findCreditTierViolations:r=>{let n=[],a=(c,m)=>n.push({index:c,reason:m,message:e[m]}),u=0;for(let[c,m]of r.entries()){let l=c===r.length-1;if(m==="inf"){l||a(c,"non_final_infinity");continue}(!Number.isFinite(m)||m<=u)&&a(c,"not_increasing"),u=m,l&&a(c,"final_not_infinity")}return n}}))(xe),{ApiCreditMultiplierSchema:Re}=((e,i)=>({ApiCreditMultiplierSchema:e.object({match:i,factor:e.number().positive().optional().meta({description:"Multiplies the matched rate. All matching multipliers stack."}),add:e.number().optional().meta({description:"Added to the rate after every factor is applied, in credits per billing-unit group."})}).strict().refine(n=>n.factor!==void 0||n.add!==void 0,{message:"A multiplier needs a factor or an add."})}))(t,Y),{ProviderMarkupsSchema:De}=((e,i)=>({ProviderMarkupsSchema:e.record(e.string(),i).nullish()}))(t,K),{InvoiceFeatureQuantitySchema:H}=((e,i,r)=>({InvoiceFeatureQuantitySchema:e.object({feature_id:e.string().meta({description:"The feature to bill."}),billing_behavior:e.enum(i).meta({description:"Which of the feature's prices to use: 'prepaid' or 'usage_based'."}),quantity:e.number().nonnegative().optional().meta({description:"Billable feature units in total, exclusive of any included usage. Not per seat or per entity. For a credit-system feature this is the number of credits."}),usage:e.array(r).optional().meta({description:"For credit-system features: billable units of the source features, converted through the credit rate card. Mutually exclusive with quantity."}),prorate:e.boolean().optional().meta({description:"Whether to prorate this line against period_start / period_end. Defaults to true for prepaid and false for usage-based."})}).strict().refine(a=>a.quantity!==void 0!=(a.usage!==void 0),{message:"Provide exactly one of quantity or usage."})}))(t,G,Ae),{CreateInvoicePreviewSchema:bt}=((e,i)=>({CreateInvoicePreviewSchema:e.object({currency:e.string(),lines:e.array(i),subtotal:e.number(),discount_total:e.number(),tax:e.object({total:e.number(),amount_inclusive:e.number(),amount_exclusive:e.number(),status:e.enum(["complete","incomplete"])}).nullable(),total:e.number(),due_date:e.number().nullable()})}))(t,Pe),{SUPPORTED_SET:ke}=(e=>({SUPPORTED_SET:new Set(e)}))(Ee),{ApiCreditDimensionBaseSchema:Ne}=((e,i)=>({ApiCreditDimensionBaseSchema:e.object({match:i,priority:e.number().int().optional().meta({description:"Breaks ties between dimensions that match the same number of keys. Higher wins."})})}))(t,Y),{refineGraduatedTiers:X}=(e=>({refineGraduatedTiers:(r,n)=>{let a=e(r.tiers.map(u=>u.to));for(let{index:u,message:c}of a)n.addIssue({code:"custom",message:c,path:["tiers",u,"to"]})}}))(je),{ApiFeatureMarkupsOverrideSchema:Ue}=((e,i,r)=>({ApiFeatureMarkupsOverrideSchema:e.strictObject({default_markup:e.number().min(-100).optional().meta({description:"Default percentage markup for customers on this plan. Use -100 to make usage free."}),provider_markups:i.meta({description:"Per-provider markup percentages for customers on this plan."}),model_markups:r.meta({description:"Per-model markup overrides for customers on this plan."})})}))(t,De,ve),{isValidCurrencyCode:qe}=(e=>({isValidCurrencyCode:r=>!!r&&e.has(r.toLowerCase())}))(ke),{ApiCreditDimensionSchema:Be}=((e,i,r,n)=>({ApiCreditDimensionSchema:e.union([i.extend({tier_behavior:e.literal("graduated"),tiers:e.array(r).min(1)}).strict().superRefine(n),i.extend({credit_cost:e.number().min(0).meta({description:"Credits consumed per billing-unit group when this dimension matches."})}).strict()])}))(t,Ne,$,X),{CurrencyCodeSchema:J}=((e,i)=>({CurrencyCodeSchema:e.string().refine(i,"must be a Stripe-supported currency code").meta({description:"Three-letter Stripe-supported currency code (e.g. 'eur', 'gbp')."})}))(t,qe),{AdditionalCurrencyTierSchema:Fe}=((e,i)=>({AdditionalCurrencyTierSchema:e.object({currency:i,amount:e.number().optional().meta({description:"Per-unit amount for this tier in this currency."}),flat_amount:e.number().optional().meta({description:"Flat amount for this tier in this currency, if the tier uses one."})}).refine(n=>n.amount!==void 0||n.flat_amount!==void 0,{message:"Either amount or flat_amount, or both must be defined",path:["amount","flat_amount"]})}))(t,J),{ApiCreditSchemaItemBaseSchema:z}=((e,i,r,n)=>({ApiCreditSchemaItemBaseSchema:e.object({metered_feature_id:e.string().nonempty().meta({description:"ID of the metered feature that draws from this credit system."}),billing_units:e.number().positive().optional().meta({description:"Number of metered-feature units priced together. Defaults to one when omitted."}),dimensions:e.record(i,r).optional().meta({description:"Named rates chosen by event properties. The most specific match sets the rate; with no match the item's own rate applies."}),multipliers:e.record(i,n).optional().meta({description:"Named adjustments chosen by event properties. Every match applies: factors multiply, then adds are summed."})})}))(t,we,Be,Re),{ApiFlatCreditSchemaItemSchema:Le}=((e,i)=>({ApiFlatCreditSchemaItemSchema:e.extend({credit_cost:i.number().min(0).meta({description:"Credits consumed per billing-unit group."})}).strict()}))(z,t),{AdditionalCurrencyPriceSchema:Qe}=((e,i)=>({AdditionalCurrencyPriceSchema:e.object({currency:i,amount:e.number().meta({description:"Price amount in this currency. Set explicitly per currency, not converted from the base amount."})})}))(t,J),{AdditionalCurrencyTierArraySchema:Ve}=((e,i,r,n)=>({AdditionalCurrencyTierArraySchema:e.array(i).refine(r,{message:n})}))(t,Fe,Q,V),{ApiGraduatedCreditSchemaItemSchema:Ge}=((e,i,r,n)=>({ApiGraduatedCreditSchemaItemSchema:e.extend({tier_behavior:i.literal("graduated"),tiers:i.array(r).min(1)}).strict().superRefine(n)}))(z,t,$,X),{AdditionalCurrencyPriceArraySchema:ee}=((e,i,r,n)=>({AdditionalCurrencyPriceArraySchema:e.array(i).refine(r,{message:n})}))(t,Qe,Q,V),{ApiUsageTierWithCurrenciesSchema:$e}=((e,i,r)=>({ApiUsageTierWithCurrenciesSchema:e.object({to:e.number().or(e.literal(i)),amount:e.number().optional(),flat_amount:e.number().optional(),additional_currencies:r.optional().meta({description:"Per-currency amounts for this tier. Tier boundaries ('to') are shared across all currencies."})}).refine(a=>a.amount!==void 0||a.flat_amount!==void 0,{message:"Either amount or flat_amount, or both must be defined",path:["amount","flat_amount"]}).transform(a=>({...a,amount:a.amount??0})).pipe(e.object({to:e.number().or(e.literal(i)),amount:e.number(),flat_amount:e.number().optional(),additional_currencies:r.optional()}))}))(t,be,Ve),{ApiCreditSchemaItemSchema:Ke}=((e,i,r)=>({ApiCreditSchemaItemSchema:e.union([i,r])}))(t,Ge,Le),{BasePriceParamsSchema:Ze}=((e,i,r,n)=>({BasePriceParamsSchema:e.omit({display:!0}).extend({interval_count:i({schema:r.number().optional(),defaultValue:1,description:"Number of intervals per billing cycle. Defaults to 1."}),additional_currencies:n.optional().meta({description:"Base price amounts in additional currencies. The base 'amount' is in the org's default currency."}),base_currency:r.string().optional().meta({internal:!0}),entitlement_id:r.string().optional().meta({internal:!0}),price_id:r.string().optional().meta({internal:!0}),stripe_price_id:r.string().optional().meta({description:"Stripe price id this base price is billed under. Set by sync flows to capture the actual Stripe price when it differs from the catalog default.",internal:!0})}).meta({title:"BasePrice",description:"Base price configuration for a plan."})}))(Oe,pe,t,ee),{PlanItemPriceParamsSchema:We}=((e,i,r,n,a,u,c)=>({PlanItemPriceParamsSchema:e.object({stripe_price_id:e.string().nullish().transform(l=>l??void 0).meta({description:"Stripe price id this feature price is billed under. Set by sync flows to preserve an existing Stripe price.",internal:!0}).optional(),amount:e.number().optional().meta({description:"Price per billing_units after included usage. Either 'amount' or 'tiers' is required."}),additional_currencies:i.optional().meta({description:"Amounts in additional currencies for this flat price. The base 'amount' is in the org's default currency. Only valid with 'amount', not 'tiers'."}),tiers:e.array(r).optional().meta({description:"Tiered pricing. Either 'amount' or 'tiers' is required."}),tier_behavior:e.enum(n).optional(),interval:e.enum(a).meta({description:"Billing interval. For consumable features, should match reset.interval."}),interval_count:e.number().default(1).optional().meta({description:"Number of intervals per billing cycle. Defaults to 1."}),billing_units:e.number().default(1).optional().meta({description:"Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200)."}),billing_method:e.enum(u).meta({description:"'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go."}),allocated_billing:c,max_purchase:e.number().nullish().meta({description:"Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. Null for no limit."})})}))(t,ee,$e,ye,F,G,Te),{ApiFeatureOverrideSchema:Ye}=((e,i,r)=>({ApiFeatureOverrideSchema:e.strictObject({credit_schema:e.array(i).optional().meta({description:"For credit system features: replaces the feature's credit_schema entirely for customers on this plan."}),markups:r.optional().meta({description:"For AI credit system features: replaces the feature's markup chain entirely for customers on this plan. An unset level means no markup at that level rather than inheriting the feature's."})})}))(t,Ke,Ue),{InvoiceBasePriceParamsSchema:te}=((e,i)=>({InvoiceBasePriceParamsSchema:e.pick({amount:!0,interval:!0,interval_count:!0}).extend({processors:i.optional().meta({description:"Bill this line under an existing Stripe price instead of an inline one."})}).strict()}))(Ze,W),{InvoiceItemPriceParamsSchema:He}=((e,i)=>({InvoiceItemPriceParamsSchema:e.pick({amount:!0,tiers:!0,tier_behavior:!0,interval:!0,interval_count:!0,billing_units:!0,billing_method:!0}).extend({processors:i.optional().meta({description:"Bill this line under an existing Stripe price instead of an inline one."})}).strict()}))(We,W),{InvoiceLicenseQuantitySchema:Xe}=((e,i,r)=>({InvoiceLicenseQuantitySchema:e.object({license_plan_id:e.string().meta({description:"The license plan linked to the parent plan."}),quantity:e.number().int().nonnegative().meta({description:"Billable seats, exclusive of any included seats."}),customize:e.object({price:i.nullable().optional()}).strict().optional().meta({description:"Override the license's per-seat price on this invoice."}),feature_quantities:e.array(r).optional().meta({description:"Feature charges priced through the license plan."}),prorate:e.boolean().optional().meta({description:"Whether to prorate seat charges against period_start / period_end. Defaults to true."})}).strict()}))(t,te,H),{InvoiceCustomizeItemSchema:Je}=((e,i,r)=>({InvoiceCustomizeItemSchema:e.object({feature_id:e.string().meta({description:"The feature whose pricing is overridden on this invoice."}),price:i.optional().meta({description:"Pricing to use for this feature on this invoice."}),feature_override:r.pick({credit_schema:!0}).strict().optional().meta({description:"For credit-system features: a credit rate card to use when converting `usage` on this invoice."})}).strict()}))(t,He,Ye),{InvoiceCustomizeSchema:ze}=((e,i,r)=>({InvoiceCustomizeSchema:e.object({price:i.nullable().optional().meta({description:"Override the plan's base price for this invoice. Pass null or an amount of 0 to omit the base price line."}),items:e.array(r).optional().meta({description:"Override feature pricing for this invoice. Only pricing fields are accepted; grants, resets and rollovers are not part of an invoice."})}).strict().meta({title:"InvoiceCustomize",description:"Pricing overrides applied to this invoice only. The catalog and the customer's plan are not changed."})}))(t,te,Je),{InvoicePlanParamsSchema:et}=((e,i,r,n,a)=>({InvoicePlanParamsSchema:e.object({plan_id:e.string().meta({description:"The catalog plan (or variant) whose pricing to use."}),version:e.number().optional().meta({description:"Plan version. Defaults to the active version."}),customize:i.optional(),feature_quantities:e.array(r).optional(),license_quantities:e.array(n).optional(),discounts:e.array(a).optional().meta({description:"Discounts applied only to this plan's lines."}),prorate:e.boolean().optional().meta({description:"Whether to prorate the base price against period_start / period_end. Defaults to true."})}).strict()}))(t,ze,H,Xe,Z),{CreateInvoiceParamsSchema:yt}=((e,i,r,n,a)=>({CreateInvoiceParamsSchema:e.object({customer_id:e.string().meta({description:"The customer to invoice."}),plans:e.array(i).optional(),custom_line_items:e.array(r).optional().meta({description:"Charges that are not tied to any plan or feature."}),discounts:e.array(n).optional().meta({description:"Discounts applied to the whole invoice."}),invoice_template_id:e.string().optional().meta({description:"ID of an invoice template whose footer, memo and default payment terms are applied."}),net_terms_days:e.number().int().positive().optional().meta({description:"Days until the invoice is due. Defaults to the template's terms, then the org default."}),tax_rate_id:e.string().optional().meta({description:"Stripe tax rate ID (txr_...) applied to every line."}),period_start:a.optional().meta({description:"Start of the period being invoiced, in milliseconds. Prorated lines are charged for period_start \u2192 period_end against one price interval starting at period_start."}),period_end:a.optional().meta({description:"End of the period being invoiced, in milliseconds."}),preview:e.boolean().optional().meta({description:"If true, returns the calculated lines and totals without creating an invoice."})}).strict().refine(c=>c.period_start===void 0==(c.period_end===void 0),{message:"period_start and period_end must be provided together."}).refine(c=>c.period_start===void 0||c.period_end===void 0||c.period_end>c.period_start,{message:"period_end must be after period_start."})}))(t,et,Ce,Z,Me);var E=t.object({type:t.literal("native_purchase"),receiptId:t.uuid(),orderId:t.uuid(),productVersionId:t.uuid(),provider:t.enum(["apple","google"]),productId:t.string().min(1).max(255),productKind:U,replacement:t.strictObject({sourceOrderId:t.uuid(),sourceProductId:t.string().min(1).max(255),policy:t.enum(["apple_store","google_full_price"]),sourceAccountTokens:t.array(t.uuid()).max(50)}).nullable(),appAccountToken:t.uuid().optional(),obfuscatedAccountId:t.string().min(1).max(64).optional(),obfuscatedProfileId:t.uuid().optional(),basePlanId:t.string().min(1).max(255).optional(),offerId:t.string().min(1).max(255).optional(),offerKind:t.enum(["none","introductory","promotional"]),currency:s,catalogAmountMinor:t.number().int().nonnegative().max(1e8),discountMinor:t.number().int().nonnegative().max(1e8),trialDays:t.number().int().min(1).max(730).nullable(),seatBundle:t.array(t.strictObject({key:t.string().regex(/^[a-z][a-z0-9_]{0,63}$/),quantity:t.number().int().min(1).max(1e4)})).max(20),applePromotionalOffer:t.strictObject({offerId:t.string().min(1).max(255),keyId:t.string().min(1).max(255),nonce:t.uuid(),signature:t.string().min(1).max(1024),timestamp:t.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER)}).nullable()}).strict().superRefine((e,i)=>{let r=e.provider==="apple";(e.replacement!==null&&(e.productKind!=="membership"||e.offerKind!=="none"||e.trialDays!==null||e.replacement.policy!==(r?"apple_store":"google_full_price"))||e.productKind!=="membership"&&(e.trialDays!==null||e.offerKind!=="none"||e.basePlanId!==void 0)||!r&&e.productKind==="membership"&&e.basePlanId===void 0||e.discountMinor>e.catalogAmountMinor||new Set(e.seatBundle.map(a=>a.key)).size!==e.seatBundle.length||e.trialDays!==null&&(e.discountMinor!==0||e.offerKind==="none")||e.offerKind==="none"&&e.discountMinor!==0||(r?!e.appAccountToken||e.obfuscatedAccountId!==void 0||e.obfuscatedProfileId!==void 0||e.basePlanId!==void 0||e.offerKind==="promotional"!=(e.applePromotionalOffer!==null)||e.offerKind==="promotional"!=(e.offerId!==void 0)||e.applePromotionalOffer!==null&&e.applePromotionalOffer.offerId!==e.offerId:e.appAccountToken!==void 0||!e.obfuscatedAccountId||!e.obfuscatedProfileId||e.applePromotionalOffer!==null||e.offerKind==="none"!=(e.offerId===void 0)))&&i.addIssue({code:"custom",message:"Native purchase terms must match the accepted store selection"})});var ie=t.strictObject({itemKey:t.string().regex(/^paid:feature:[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/),internal_feature_id:t.uuid(),includedAmount:t.string().regex(/^(0|[1-9]\d{0,11})(\.\d{1,6})?$/),quantity:t.number().int().min(0).max(1e4),terms:k,pricing:D.optional(),unitAmountMinor:t.number().int().min(0).max(1e8),productId:t.string().min(1).max(255).nullable(),priceId:t.string().min(1).max(255).nullable()}).superRefine((e,i)=>{(e.quantity<e.terms.minimumQuantity||e.quantity>e.terms.maximumQuantity||e.productId===null!=(e.priceId===null)||e.quantity>0&&(e.pricing||e.unitAmountMinor>0)&&e.priceId===null)&&i.addIssue({code:"custom",message:"Purchased quantities need their published bounds and immutable price binding"});try{N(e.includedAmount,e.terms.units,e.quantity),g({quantity:e.quantity,unitAmountMinor:e.unitAmountMinor,...e.pricing===void 0?{}:{pricing:e.pricing}})}catch{i.addIssue({code:"custom",message:"Purchased allowance exceeds the ledger quantity limit"})}});var _=t.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/,"ID \u4F7F\u7528\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u4E0B\u5212\u7EBF\uFF0C\u5E76\u4EE5\u5B57\u6BCD\u5F00\u5934"),Et=t.object({amountCents:t.number().int().min(0).max(1e8),currency:s,interval:t.enum(["free","month","year"]),currencyOptions:t.partialRecord(s,t.number().int().min(1).max(1e8)).optional()}).refine(e=>e.interval==="free"?e.amountCents===0:e.amountCents>0,"\u514D\u8D39\u5957\u9910\u91D1\u989D\u5FC5\u987B\u4E3A 0\uFF0C\u4ED8\u8D39\u91D1\u989D\u5FC5\u987B\u5927\u4E8E 0").refine(e=>!e.currencyOptions||!Object.hasOwn(e.currencyOptions,e.currency)&&(e.interval!=="free"||Object.keys(e.currencyOptions).length===0),"\u9644\u52A0\u5E01\u79CD\u4E0D\u80FD\u91CD\u590D\u9ED8\u8BA4\u5E01\u79CD\uFF1B\u514D\u8D39\u5957\u9910\u4E0D\u8BBE\u7F6E\u9644\u52A0\u4EF7\u683C");var $t=t.strictObject({requestId:t.uuid(),predecessorOperationId:t.uuid().optional(),invoiceMode:p.optional(),entityId:t.uuid().optional(),billingSubscriptionId:t.uuid().optional(),newBillingSubscription:t.literal(!0).optional(),offerId:t.uuid().optional(),nativeOffer:O.optional(),plans:t.array(t.strictObject({productVersionId:t.uuid(),seatQuantities:t.record(_,t.number().int().min(0).max(1e4)).optional(),featureQuantities:t.record(t.uuid(),t.number().int().min(0).max(1e4)).refine(e=>Object.keys(e).length<=100,"At most 100 feature quantities").optional()})).min(1).max(20).refine(e=>new Set(e.map(i=>i.productVersionId)).size===e.length,"Plan versions must be unique"),provider:t.enum(["stripe","apple","google","merchant"]),currency:s}).refine(e=>!e.offerId||!e.billingSubscriptionId&&(["stripe","merchant"].includes(e.provider)||e.nativeOffer!==void 0),"Held offers apply to new purchases; existing subscriptions use billing coupons").refine(e=>!e.nativeOffer||["apple","google"].includes(e.provider)&&e.plans.length===1,"A store selection applies to exactly one native SKU").refine(e=>!e.newBillingSubscription||["stripe","merchant"].includes(e.provider)&&!e.billingSubscriptionId,"A new billing subscription has no existing subscription target").refine(e=>!e.invoiceMode?.enabled||e.provider==="stripe"&&!e.entityId,"Invoice mode requires a Stripe subscription without an Entity target"),Kt=t.strictObject({operationId:t.uuid()}),o=t.number().int().min(0).max(1e8),tt=t.strictObject({lineId:t.uuid(),productVersionId:t.uuid(),productName:t.string().min(1).max(80),interval:t.enum(["free","week","month","year","one_time"]),intervalCount:t.number().int().min(1).max(156).optional(),baseAmountMinor:o,seats:t.array(t.strictObject({key:_,quantity:t.number().int().min(0).max(1e4),includedQuantity:t.number().int().min(0).max(1e4),maximumQuantity:t.number().int().min(0).max(1e4),unitAmountMinor:o})).max(20),prepaid:t.array(ie).max(100).optional(),catalogAmountMinor:o,trial:w.nullable()}).refine(e=>new Set(e.seats.map(i=>i.key)).size===e.seats.length&&e.seats.every(i=>i.quantity>=i.includedQuantity&&i.quantity<=i.maximumQuantity)&&e.baseAmountMinor+e.seats.reduce((i,r)=>i+r.unitAmountMinor*(r.quantity-r.includedQuantity),0)+(e.prepaid??[]).reduce((i,r)=>i+g({quantity:r.quantity,unitAmountMinor:r.unitAmountMinor,...r.pricing===void 0?{}:{pricing:r.pricing}}),0)===e.catalogAmountMinor,"Quote must retain its published base price and component quantities"),ae=t.string().regex(/^[A-Za-z0-9_-]{1,200}$/),it=t.strictObject({id:ae,name:t.string().min(1).max(40),percent_off:t.number().gt(0).max(100).optional(),amount_off:t.number().int().positive().optional(),currency:t.string().regex(/^[a-z]{3}$/).optional(),duration:t.enum(["once","repeating","forever"]),duration_in_months:t.number().int().min(1).max(36).optional()}).refine(e=>e.percent_off===void 0!=(e.amount_off===void 0)&&e.amount_off===void 0==(e.currency===void 0)&&e.duration==="repeating"==(e.duration_in_months!==void 0),"A Stripe coupon has one percentage or amount and months only when repeating"),rt=t.strictObject({subscriptionId:t.string().regex(/^sub_[A-Za-z0-9]+$/),customerId:t.string().regex(/^cus_[A-Za-z0-9]+$/),sourceItems:t.array(t.strictObject({id:t.string(),price_id:t.string(),quantity:t.number().int().nonnegative(),discounts:t.array(t.strictObject({id:t.string(),coupon:t.string(),start:t.number(),end:t.number().nullable()})).optional()})).min(1).max(100),prorationDate:t.number().int().nonnegative(),amountMinor:t.number().int().positive(),periodStartMs:t.number(),periodEndMs:t.number()}),oe=t.strictObject({invoiceMode:p.optional(),append:rt.optional(),provider:t.literal("stripe"),executor:t.enum(["indiana","merchant"]),accountId:t.string().regex(/^acct_[A-Za-z0-9]+$/),mode:t.enum(["payment","subscription"]),lineItems:t.array(t.strictObject({price:t.string().regex(/^price_[A-Za-z0-9]+$/).nullable(),quantity:t.number().int().min(1).max(1e4),priceId:t.uuid(),productName:t.string().min(1).max(80),amountMinor:t.number().int().min(0).max(1e8),currency:t.string().regex(/^[a-z]{3}$/),interval:t.enum(["week","month","year","one_off"]),intervalCount:t.number().int().min(1).max(52),slot:t.enum(["stripe_price_id","stripe_empty_price_id"]),tiers:t.strictObject({mode:t.enum(["graduated","volume"]),tiers:t.array(t.strictObject({upTo:t.number().int().min(1).max(1e6).nullable(),unitAmountMinor:t.number().int().min(0).max(1e8),flatAmountMinor:t.number().int().min(0).max(1e8).optional()})).min(2).max(12)}).nullable()})).min(1).max(100),discounts:t.array(t.strictObject({coupon:ae,terms:it})).max(1),trialPeriodDays:t.number().int().min(1).max(730).nullable(),metadata:t.strictObject({grooveCheckoutId:t.uuid(),grooveCustomerId:t.uuid()}),expiresAt:t.iso.datetime({offset:!0})}),nt=t.strictObject({operationId:t.uuid(),merchantTerms:b.optional(),entityId:t.uuid().nullable(),billingSubscriptionId:t.uuid().nullable(),discount:t.strictObject({offerId:t.uuid(),couponId:t.uuid(),discount:q,duration:B,amountMinor:o,allocations:t.array(t.strictObject({productVersionId:t.uuid(),amountMinor:o})).min(1).max(20),expiresAt:t.iso.datetime({offset:!0})}).nullable(),charge:t.strictObject({effectiveAt:t.iso.datetime({offset:!0}),periodEndsAt:t.iso.datetime({offset:!0}),debitMinor:o,discountMinor:o,taxMinor:o,totalMinor:o}).nullable(),expiresAt:t.iso.datetime({offset:!0}),provider:t.enum(["stripe","apple","google","merchant"]),nativeOffer:O.optional(),currency:s,lines:t.array(tt).min(1).max(20),catalogAmountMinor:o,nativeDiscountMinor:o.optional(),automaticTax:t.boolean(),execution:t.union([oe,v]).nullable()}).refine(e=>!e.merchantTerms||e.provider==="merchant"&&y(e.merchantTerms,e.operationId,"purchase",e.currency)).refine(e=>e.provider==="merchant"?e.execution?.provider==="merchant"&&e.execution.operationId===e.operationId&&e.execution.catalogAmountMinor===e.catalogAmountMinor&&e.execution.currency===e.currency&&Date.parse(e.execution.expiresAt)<=Date.parse(e.expiresAt)&&e.execution.trialPeriodDays===(e.lines[0]?.trial?.days??null)&&e.execution.discount?.grantId===e.discount?.offerId:e.provider==="stripe"?e.execution?.provider!=="merchant"&&(e.lines[0]?.trial?.cardRequired===!1&&!e.execution?.invoiceMode?.enabled?e.execution===null&&e.discount===null:e.execution!==null&&e.execution.metadata.grooveCheckoutId===e.operationId&&Date.parse(e.execution.expiresAt)<=Date.parse(e.expiresAt)&&e.execution.mode===(e.lines.some(i=>!["one_time","free"].includes(i.interval))?"subscription":"payment")&&e.execution.trialPeriodDays===(e.lines[0]?.trial?.days??null)&&(e.execution.executor==="indiana"||e.execution.lineItems.every(i=>i.price!==null))&&e.execution.discounts.every(i=>i.coupon===i.terms.id)&&e.execution.discounts.length===(e.discount?1:0)&&e.execution.discounts.every(i=>e.discount!==null&&(i.coupon===e.discount.couponId||e.discount.discount.type==="amount"&&i.coupon===`${e.discount.couponId}_credit_${e.discount.offerId}_${i.terms.amount_off}`&&i.terms.amount_off===e.discount.discount.amountOffCents&&i.terms.currency?.toUpperCase()===e.currency&&i.terms.duration==="once"))):e.execution===null,"Stripe execution must carry the quote identity, expiry, mode, trial and held coupon").refine(e=>(!e.discount||!e.billingSubscriptionId&&(["stripe","merchant"].includes(e.provider)||e.discount.duration.type==="once")&&e.discount.amountMinor<=e.catalogAmountMinor&&e.discount.allocations.length===e.lines.length&&e.discount.allocations.every((i,r)=>{let n=e.lines[r];return n!==void 0&&i.productVersionId===n.productVersionId&&i.amountMinor<=n.catalogAmountMinor})&&e.discount.allocations.reduce((i,r)=>i+r.amountMinor,0)===e.discount.amountMinor)&&(["stripe","merchant"].includes(e.provider)?e.nativeOffer===void 0:e.nativeOffer!==void 0&&e.lines.length===1&&e.nativeOffer.discountMinor<=e.catalogAmountMinor&&e.nativeOffer.trialDays===(e.lines[0]?.trial?.days??null)&&(!e.discount||e.nativeOffer.discountMinor===e.discount.amountMinor))&&(!e.charge||e.billingSubscriptionId!==null&&e.charge.totalMinor===e.charge.debitMinor-e.charge.discountMinor+e.charge.taxMinor&&e.charge.discountMinor<=e.charge.debitMinor&&Date.parse(e.charge.periodEndsAt)>Date.parse(e.charge.effectiveAt))&&new Set(e.lines.map(i=>i.lineId)).size===e.lines.length&&e.lines.reduce((i,r)=>i+r.catalogAmountMinor,0)===e.catalogAmountMinor,"Quote lines must conserve the catalog amount"),Zt=t.strictObject({operationId:t.uuid(),orderId:t.uuid(),append:t.boolean().optional(),invoiceMode:t.boolean().optional(),status:t.enum(["pending","complete","cancelled","failed"]),executor:t.enum(["indiana","merchant"]),checkoutUrl:t.url().refine(e=>new URL(e).protocol==="https:").nullable(),execution:t.union([oe,v]).nullable(),currency:s,catalogAmountMinor:o,taxMinor:o,totalMinor:t.number().int().min(0).max(2e8).nullable(),quoteFinalized:t.boolean(),nativePurchase:E.nullable(),confirmedAt:t.iso.datetime({offset:!0}).nullable().optional(),quote:nt.optional(),merchantExecution:f.nullable().optional(),problem:h.nullable().optional(),authority:S.optional()}).refine(e=>(e.checkoutUrl===null||e.executor==="indiana"||e.merchantExecution?.type==="purchase")&&(e.execution===null||e.executor==="merchant"),"Only Indiana-executed purchases carry a Checkout URL and only record-only purchases carry execution instructions"),x=t.strictObject({enabled:t.literal(!0),featureIds:t.array(t.uuid()).min(1).max(100).refine(e=>new Set(e).size===e.length,"Feature IDs must be unique").optional()}),Wt=t.strictObject({requestId:t.uuid(),offerId:t.uuid().optional(),invoiceMode:p.optional(),membershipId:t.uuid(),carryOverBalances:x.optional(),carryOverUsages:x.optional(),membershipIds:t.array(t.uuid()).min(1).max(20).optional(),prorationBehavior:t.enum(["prorate_immediately","none","bill_difference"]).optional(),timing:t.enum(["immediate","renewal","store"]),change:t.discriminatedUnion("type",[t.strictObject({type:t.literal("plan"),productVersionId:t.uuid()}),t.strictObject({type:t.literal("seats"),licenseKey:_,quantity:t.number().int().min(0).max(1e4)}),t.strictObject({type:t.literal("quantity"),internal_feature_id:t.uuid(),quantity:t.number().int().min(0).max(1e4)}),t.strictObject({type:t.literal("cancel")}),t.strictObject({type:t.literal("uncancel")}),t.strictObject({type:t.literal("billing_cycle"),billingCycleAnchor:t.union([t.literal("now"),t.number().int().positive().max(0xe677d21fdbff)])})])}).refine(e=>!e.offerId||e.change.type==="plan"&&e.timing!=="store","A selected plan-change offer requires a merchant target Product").refine(e=>e.timing!=="store"||e.change.type==="plan","Store timing applies to a native plan replacement").refine(e=>e.change.type!=="billing_cycle"||e.timing===(e.change.billingCycleAnchor==="now"?"immediate":"renewal"),"Use immediate for now and renewal for a future millisecond anchor").refine(e=>!e.membershipIds||["cancel","uncancel"].includes(e.change.type)&&e.membershipIds.includes(e.membershipId)&&new Set(e.membershipIds).size===e.membershipIds.length,"Grouped actions require unique cancel/uncancel targets including the primary membership").refine(e=>!e.carryOverBalances&&!e.carryOverUsages||e.change.type==="plan"&&e.timing==="immediate","Carry applies only to immediate upgrades").refine(e=>!e.prorationBehavior||e.change.type==="quantity","prorationBehavior applies to prepaid quantity changes"),I=t.string().regex(/^price_[A-Za-z0-9]+$/),re=t.strictObject({grooveUpdateId:t.uuid(),grooveCustomerId:t.uuid()}),ne=t.strictObject({price:I.nullable(),priceId:t.uuid().optional(),quantity:t.number().int().min(0).max(1e4)}),ce=t.strictObject({provider:t.literal("stripe"),invoiceMode:p.optional(),executor:t.enum(["indiana","merchant"]),accountId:t.string().regex(/^acct_[A-Za-z0-9]+$/),subscriptionId:t.string().regex(/^sub_[A-Za-z0-9]+$/),action:t.enum(["update","cancel","schedule","release"]),update:t.strictObject({items:t.array(ne).max(20),remove:t.array(I).max(20),restoreItems:t.array(t.strictObject({price:I,quantity:t.number().int().min(0).max(1e4)})).min(1).max(20).optional(),prorationBehavior:t.enum(["always_invoice","create_prorations","none"]).optional(),prorationDate:t.number().int().positive().optional(),paymentBehavior:t.literal("error_if_incomplete").optional(),cancelAtPeriodEnd:t.boolean().optional(),clearCancelAt:t.literal(!0).optional(),billingCycleAnchorNow:t.literal(!0).optional(),metadata:re}).nullable(),cancel:t.strictObject({prorate:t.literal(!1),invoiceNow:t.literal(!1)}).nullable(),schedule:t.strictObject({currentItems:t.array(t.strictObject({price:I,quantity:t.number().int().min(0).max(1e4)})).max(20),nextItems:t.array(ne).min(1).max(20),switchAt:t.number().int().positive(),interval:t.enum(["week","month","year"]),intervalCount:t.number().int().min(1).max(52),resetBillingCycleAnchor:t.literal(!0).optional(),metadata:re}).nullable(),release:t.strictObject({schedule:t.string().regex(/^sub_sched_[A-Za-z0-9]+$/)}).nullable(),expiresAt:t.iso.datetime({offset:!0})}).refine(e=>["update","cancel","schedule","release"].every(i=>e[i]!==null==(e.action===i))&&(e.executor==="indiana"||[...e.update?.items??[],...e.schedule?.nextItems??[]].every(i=>i.price!==null)),"Stripe update execution carries exactly its action, with bound Prices for the merchant"),se=t.strictObject({merchantTerms:b.optional(),carryOverBalances:x.optional(),carryOverUsages:x.optional(),operationId:t.uuid(),membershipId:t.uuid(),productVersionId:t.uuid(),timing:t.enum(["immediate","renewal"]),effectiveAt:t.iso.datetime({offset:!0}),expiresAt:t.iso.datetime({offset:!0}),currency:s,creditMinor:o,debitMinor:o,discountMinor:o,taxMinor:o,totalMinor:o,retainedProductVersionIds:t.array(t.uuid()).max(19),execution:t.union([ce,A])}).refine(e=>!e.merchantTerms||e.execution.provider==="merchant"&&y(e.merchantTerms,e.operationId,"subscription_change",e.currency)),at=t.strictObject({operationId:t.uuid(),invoiceMode:t.boolean().optional(),membershipId:t.uuid(),productVersionId:t.uuid(),status:t.enum(["prepared","quoted","confirmed","pending","scheduled","effective","cancelled","failed"]),timing:t.enum(["immediate","renewal"]),effectiveAt:t.iso.datetime({offset:!0}),checkoutUrl:t.url().refine(e=>new URL(e).protocol==="https:").nullable(),executor:t.enum(["indiana","merchant"]),execution:t.union([ce,A]).nullable(),confirmedAt:t.iso.datetime({offset:!0}).nullable().optional(),merchantExecution:f.nullable().optional(),problem:h.nullable().optional(),quote:se.optional(),authority:S.optional()}).refine(e=>e.execution===null||e.executor==="merchant","Only record-only changes carry execution instructions"),ot=t.strictObject({operationId:t.uuid(),membershipId:t.uuid(),productVersionId:t.uuid(),timing:t.literal("store"),effectiveAt:t.null(),expiresAt:t.iso.datetime({offset:!0}),currency:s,creditMinor:t.null(),debitMinor:t.null(),discountMinor:t.null(),taxMinor:t.null(),totalMinor:t.null(),retainedProductVersionIds:t.array(t.uuid()).max(19),store:t.strictObject({provider:t.enum(["apple","google"]),productId:t.string().min(1).max(255),catalogAmountMinor:o,policy:t.enum(["apple_store","google_full_price"])})}),ct=t.strictObject({operationId:t.uuid(),membershipId:t.uuid(),productVersionId:t.uuid(),status:t.enum(["prepared","pending","effective","cancelled","failed"]),timing:t.literal("store"),effectiveAt:t.iso.datetime({offset:!0}).nullable(),checkoutUrl:t.null(),nativePurchase:E.nullable()}),Yt=t.union([se,ot]),Ht=t.union([at,ct]),T=j,d=R,Xt=t.strictObject({requestId:t.uuid(),invoiceId:t.uuid(),...P.shape}).refine(M,"A partial refund states amountMinor; a full refund refunds the remaining amount"),ue=t.strictObject({provider:t.literal("stripe"),executor:t.enum(["indiana","merchant"]),accountId:t.string().regex(/^acct_[A-Za-z0-9]+$/),invoice:t.string().regex(/^in_[A-Za-z0-9]+$/),amountMinor:T,currency:t.string().regex(/^[a-z]{3}$/),metadata:t.strictObject({indianaRefundId:t.uuid()}),idempotencyKey:t.string().regex(/^indiana-refund-[0-9a-f-]{36}$/),cancelSubscriptions:t.array(t.string().regex(/^sub_[A-Za-z0-9]+$/)).max(20)}),st=t.strictObject({operationId:t.uuid(),merchantTerms:b.optional(),invoiceId:t.uuid(),providerInvoiceId:t.string().min(1).max(200),currency:s,paidMinor:d,refundedMinor:d,pendingMinor:d,amountMinor:T,mode:t.enum(["full","partial"]),entitlementAction:t.enum(["retain","revoke"]),revokes:t.strictObject({customerProductIds:t.array(t.uuid()).max(100),subscriptionIds:t.array(t.string().min(1).max(200)).max(20)}),execution:t.union([ue,C]),expiresAt:t.iso.datetime({offset:!0})}).refine(e=>!e.merchantTerms||e.execution.provider==="merchant"&&y(e.merchantTerms,e.operationId,"refund",e.currency)).refine(e=>e.amountMinor<=e.paidMinor-e.refundedMinor-e.pendingMinor&&e.execution.amountMinor===e.amountMinor&&(e.execution.provider==="merchant"?e.execution.merchantInvoiceId===e.providerInvoiceId&&e.execution.operationId===e.operationId&&e.execution.currency===e.currency:e.execution.invoice===e.providerInvoiceId&&e.execution.metadata.indianaRefundId===e.operationId&&e.execution.currency===e.currency.toLowerCase())&&(e.entitlementAction==="revoke"||e.revokes.customerProductIds.length===0&&e.revokes.subscriptionIds.length===0),"Refund quote must stay within the refundable amount and match its execution"),ut=t.strictObject({operationId:t.uuid(),invoiceId:t.uuid(),providerInvoiceId:t.string().min(1).max(200),status:t.enum(["quoted","pending","succeeded","failed","expired"]),executor:t.enum(["indiana","merchant"]),currency:s,amountMinor:T,mode:t.enum(["full","partial"]),entitlementAction:t.enum(["retain","revoke"]),refundId:t.string().min(1).max(200).nullable(),quote:st.optional(),execution:t.union([ue,C]).nullable(),confirmedAt:t.iso.datetime({offset:!0}).nullable().optional(),merchantExecution:f.nullable().optional(),problem:h.nullable().optional(),authority:S.optional(),failureReason:t.string().min(1).max(200).nullable(),createdAt:t.iso.datetime({offset:!0}),completedAt:t.iso.datetime({offset:!0}).nullable()}).refine(e=>(e.execution===null||e.executor==="merchant"&&e.status==="quoted")&&(e.status!=="succeeded"||e.refundId!==null),"Only quoted record-only refunds carry instructions; a succeeded refund names its Stripe refund"),Jt=t.strictObject({invoiceId:t.uuid(),currency:s,paidMinor:d,refundedMinor:d,pendingMinor:d,refundableMinor:d,executor:t.enum(["indiana","merchant"]).nullable(),canRefund:t.boolean(),operations:t.array(ut).max(50)}).refine(e=>e.operations.every(i=>i.invoiceId===e.invoiceId),"Refund operations belong to the invoice"),zt=t.strictObject({requestId:t.uuid(),...P.shape}).refine(M,"A partial refund states amountMinor; a full refund refunds the remaining amount");export{ht as a,bt as b,yt as c,$t as d,Kt as e,nt as f,Zt as g,Wt as h,se as i,Yt as j,Ht as k,Xt as l,st as m,ut as n};
|
package/dist/chunk-IYHXEKAD.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as ge}from"./chunk-73ISTR7P.js";import{a as Le}from"./chunk-IGANLTKS.js";import{$ as B,A as Z,B as xe,C as et,F as Se,I as v,J as N,K as G,L as W,M as Q,Z as tt,_ as X,f as Ze,g as We,h as Qe,q as Xe,s as be,t as Ye,y as H,z as J}from"./chunk-BIT6YWM7.js";import{a as he,b as He,c as Je}from"./chunk-2Y5SGDC6.js";import{b as U}from"./chunk-YURGISSB.js";import{b as e}from"./chunk-NOOIJXRN.js";var nt={"zh-Hans":{merchandise:"\u51CF {discount}\uFF08\u5355\u6B21\u4F7F\u7528\uFF09",once:"\u9996\u671F\u51CF {discount}",repeating:"\u524D {months} \u4E2A\u6708\u6BCF\u6708\u51CF {discount}",forever:"\u6BCF\u671F\u51CF {discount}"},"zh-Hant":{merchandise:"\u6E1B {discount}\uFF08\u55AE\u6B21\u4F7F\u7528\uFF09",once:"\u9996\u671F\u6E1B {discount}",repeating:"\u524D {months} \u500B\u6708\u6BCF\u6708\u6E1B {discount}",forever:"\u6BCF\u671F\u6E1B {discount}"},en:{merchandise:"{discount} off \xB7 one use",once:"{discount} off your first payment",repeating:"{discount} off each month for the first {months} months",repeatingOne:"{discount} off the first month",forever:"{discount} off every payment"},ja:{merchandise:"{discount} \u5272\u5F15\uFF081\u56DE\u306E\u307F\uFF09",once:"\u521D\u56DE\u306E\u304A\u652F\u6255\u3044\u304C {discount} \u5272\u5F15",repeating:"\u6700\u521D\u306E {months} \u304B\u6708\u9593\u3001\u6BCE\u6708 {discount} \u5272\u5F15",forever:"\u6BCE\u56DE\u306E\u304A\u652F\u6255\u3044\u304C {discount} \u5272\u5F15"},ko:{merchandise:"{discount} \uD560\uC778 \xB7 1\uD68C \uC0AC\uC6A9",once:"\uCCAB \uACB0\uC81C {discount} \uD560\uC778",repeating:"\uCCAB {months}\uAC1C\uC6D4 \uB3D9\uC548 \uB9E4\uC6D4 {discount} \uD560\uC778",forever:"\uB9E4 \uACB0\uC81C {discount} \uD560\uC778"},es:{merchandise:"{discount} de descuento \xB7 un uso",once:"{discount} de descuento en el primer pago",repeating:"{discount} de descuento cada mes durante los primeros {months} meses",forever:"{discount} de descuento en cada pago",repeatingOne:"{discount} de descuento durante el primer mes"},fr:{merchandise:"{discount} de r\xE9duction \xB7 une utilisation",once:"{discount} de r\xE9duction sur le premier paiement",repeating:"{discount} de r\xE9duction par mois pendant les {months} premiers mois",forever:"{discount} de r\xE9duction sur chaque paiement",repeatingOne:"{discount} de r\xE9duction pendant le premier mois"},de:{merchandise:"{discount} Rabatt \xB7 einmalig",once:"{discount} Rabatt auf die erste Zahlung",repeating:"{discount} Rabatt pro Monat f\xFCr die ersten {months} Monate",forever:"{discount} Rabatt auf jede Zahlung",repeatingOne:"{discount} Rabatt im ersten Monat"},pt:{merchandise:"{discount} de desconto \xB7 um uso",once:"{discount} de desconto no primeiro pagamento",repeating:"{discount} de desconto por m\xEAs nos primeiros {months} meses",forever:"{discount} de desconto em cada pagamento",repeatingOne:"{discount} de desconto no primeiro m\xEAs"},it:{merchandise:"{discount} di sconto \xB7 un utilizzo",once:"{discount} di sconto sul primo pagamento",repeating:"{discount} di sconto al mese per i primi {months} mesi",forever:"{discount} di sconto su ogni pagamento",repeatingOne:"{discount} di sconto per il primo mese"},ru:{merchandise:"\u0421\u043A\u0438\u0434\u043A\u0430 {discount} \xB7 \u043E\u0434\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435",once:"\u0421\u043A\u0438\u0434\u043A\u0430 {discount} \u043D\u0430 \u043F\u0435\u0440\u0432\u044B\u0439 \u043F\u043B\u0430\u0442\u0451\u0436",repeating:"\u0421\u043A\u0438\u0434\u043A\u0430 {discount} \u043A\u0430\u0436\u0434\u044B\u0439 \u043C\u0435\u0441\u044F\u0446 \u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0435 \u043F\u0435\u0440\u0432\u044B\u0445 {months} \u043C\u0435\u0441.",repeatingOne:"\u0421\u043A\u0438\u0434\u043A\u0430 {discount} \u0432 \u043F\u0435\u0440\u0432\u044B\u0439 \u043C\u0435\u0441\u044F\u0446",forever:"\u0421\u043A\u0438\u0434\u043A\u0430 {discount} \u043D\u0430 \u043A\u0430\u0436\u0434\u044B\u0439 \u043F\u043B\u0430\u0442\u0451\u0436"},vi:{merchandise:"Gi\u1EA3m {discount} \xB7 d\xF9ng m\u1ED9t l\u1EA7n",once:"Gi\u1EA3m {discount} cho l\u1EA7n thanh to\xE1n \u0111\u1EA7u ti\xEAn",repeating:"Gi\u1EA3m {discount} m\u1ED7i th\xE1ng trong {months} th\xE1ng \u0111\u1EA7u",forever:"Gi\u1EA3m {discount} cho m\u1ED7i l\u1EA7n thanh to\xE1n"},th:{merchandise:"\u0E25\u0E14 {discount} \xB7 \u0E43\u0E0A\u0E49\u0E44\u0E14\u0E49\u0E04\u0E23\u0E31\u0E49\u0E07\u0E40\u0E14\u0E35\u0E22\u0E27",once:"\u0E25\u0E14 {discount} \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E0A\u0E33\u0E23\u0E30\u0E40\u0E07\u0E34\u0E19\u0E04\u0E23\u0E31\u0E49\u0E07\u0E41\u0E23\u0E01",repeating:"\u0E25\u0E14 {discount} \u0E15\u0E48\u0E2D\u0E40\u0E14\u0E37\u0E2D\u0E19\u0E43\u0E19\u0E0A\u0E48\u0E27\u0E07 {months} \u0E40\u0E14\u0E37\u0E2D\u0E19\u0E41\u0E23\u0E01",forever:"\u0E25\u0E14 {discount} \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E0A\u0E33\u0E23\u0E30\u0E40\u0E07\u0E34\u0E19\u0E17\u0E38\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07"},id:{merchandise:"Diskon {discount} \xB7 sekali pakai",once:"Diskon {discount} untuk pembayaran pertama",repeating:"Diskon {discount} setiap bulan selama {months} bulan pertama",forever:"Diskon {discount} untuk setiap pembayaran"},ar:{merchandise:"\u062E\u0635\u0645 {discount} \xB7 \u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0648\u0627\u062D\u062F",once:"\u062E\u0635\u0645 {discount} \u0639\u0644\u0649 \u0627\u0644\u062F\u0641\u0639\u0629 \u0627\u0644\u0623\u0648\u0644\u0649",repeating:"\u062E\u0635\u0645 {discount} \u0634\u0647\u0631\u064A\u064B\u0627 \u0644\u0645\u062F\u0629 {period}",forever:"\u062E\u0635\u0645 {discount} \u0639\u0644\u0649 \u0643\u0644 \u062F\u0641\u0639\u0629"}};function ve(t){let r=Ye(t)??"en",n=r.split("-"),s=n[0]==="zh"?n.includes("Hans")?"zh-Hans":n.includes("Hant")||n.some(a=>["TW","HK","MO"].includes(a))?"zh-Hant":"zh-Hans":n[0]??"en",i=nt[s];return i?{locale:r,copy:i}:{locale:"en",copy:nt.en}}function Tt(t,r,n="zh-CN"){let s=He(r);return Je(t,r,ve(n).locale,{currencyDisplay:"narrowSymbol",minimumFractionDigits:t%10**s===0?0:s,maximumFractionDigits:s})}function Ut(t,r="zh-CN"){let n=ve(r).locale;return t.type==="percent"?new Intl.NumberFormat(n,{style:"percent",maximumFractionDigits:2}).format(t.percentOff/100):Tt(t.amountOffCents,t.currency,n)}var rt={zh:"\u524D {months} \u4E2A\u6708\u5185\u5F00\u51FA\u7684\u8D26\u5355\u51CF {discount}","zh-Hant":"\u524D {months} \u500B\u6708\u5167\u958B\u51FA\u7684\u5E33\u55AE\u6E1B {discount}",en:"{discount} off invoices issued within the first {months} months",ja:"\u6700\u521D\u306E {months} \u304B\u6708\u4EE5\u5185\u306E\u8ACB\u6C42\u304C {discount} \u5272\u5F15",ko:"\uCCAB {months}\uAC1C\uC6D4 \uB0B4 \uCCAD\uAD6C\uC11C {discount} \uD560\uC778",es:"{discount} de descuento en facturas emitidas durante los primeros {months} meses",fr:"{discount} de r\xE9duction sur les factures \xE9mises pendant les {months} premiers mois",de:"{discount} Rabatt auf Rechnungen innerhalb der ersten {months} Monate",pt:"{discount} de desconto nas faturas emitidas nos primeiros {months} meses",it:"{discount} di sconto sulle fatture emesse nei primi {months} mesi",ru:"\u0421\u043A\u0438\u0434\u043A\u0430 {discount} \u043D\u0430 \u0441\u0447\u0435\u0442\u0430 \u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0435 \u043F\u0435\u0440\u0432\u044B\u0445 {months} \u043C\u0435\u0441.",vi:"Gi\u1EA3m {discount} cho h\xF3a \u0111\u01A1n trong {months} th\xE1ng \u0111\u1EA7u",th:"\u0E25\u0E14 {discount} \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E43\u0E1A\u0E41\u0E08\u0E49\u0E07\u0E2B\u0E19\u0E35\u0E49\u0E43\u0E19\u0E0A\u0E48\u0E27\u0E07 {months} \u0E40\u0E14\u0E37\u0E2D\u0E19\u0E41\u0E23\u0E01",id:"Diskon {discount} untuk tagihan dalam {months} bulan pertama",ar:"\u062E\u0635\u0645 {discount} \u0639\u0644\u0649 \u0627\u0644\u0641\u0648\u0627\u062A\u064A\u0631 \u0627\u0644\u0635\u0627\u062F\u0631\u0629 \u062E\u0644\u0627\u0644 \u0623\u0648\u0644 {period}"};function Mn(t,r="zh-CN",n="month"){let s=ve(r),i=Ut(t.discount,s.locale);if(t.appliesTo?.type==="merchandise")return s.copy.merchandise.replace("{discount}",i);let a=t.duration.type==="repeating"?new Intl.NumberFormat(s.locale).format(t.duration.months):"",u=s.locale.split("-")[0]??"en",c=u==="zh"&&/(?:Hant|TW|HK|MO)/.test(s.locale)?"zh-Hant":u,f=t.duration.type==="repeating"&&n!=="month"?rt[c]??rt.en:t.duration.type==="repeating"&&t.duration.months===1?s.copy.repeatingOne??s.copy.repeating:s.copy[t.duration.type],g=t.duration.type==="repeating"?new Intl.NumberFormat(s.locale,{style:"unit",unit:"month",unitDisplay:"long"}).format(t.duration.months):"";return f.replace("{discount}",i).replace("{months}",a).replace("{period}",g)}var I=e.string().min(1).max(255).regex(/^[A-Za-z0-9_][A-Za-z0-9_.:-]*$/).refine(t=>t.split(".").every(r=>r.length>0&&!["__proto__","constructor","prototype"].includes(r)),"Reserved or empty variable path"),we=e.strictObject({type:e.enum(["string","number","boolean","strings","json","offering_version","reward","paywall_version"]),nullable:e.boolean(),enum:e.array(e.string().max(255)).min(1).max(100).optional()}),Y=we.extend({type:e.enum([...we.shape.type.options,"array"]),items:we.optional()}).superRefine((t,r)=>{(t.type==="array"!=!!t.items||t.enum&&t.type!=="string"||t.items?.enum&&t.items.type!=="string")&&r.addIssue({code:"custom",message:"Array requires items; only strings support enum"})}),ee=Y.safeExtend({source:e.discriminatedUnion("type",[e.strictObject({type:e.literal("input")}),e.strictObject({type:e.literal("node")}),e.strictObject({type:e.enum(["parameter","attribute"]),key:I})])}),Bn=e.record(I,ee),Ie=e.record(I,I).refine(t=>Object.keys(t).length<=20);function P(t,r){return t?r===null?t.nullable:t.enum&&(typeof r!="string"||!t.enum.includes(r))?!1:t.type==="array"?Array.isArray(r)&&r.length<=100&&!!t.items&&r.every(n=>P(t.items,n)):["offering_version","reward","paywall_version"].includes(t.type)?typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===2&&r.type===t.type&&e.uuid().safeParse(r.id).success:t.type==="json"||(t.type==="strings"?Array.isArray(r)&&r.every(n=>typeof n=="string"):typeof r===t.type):!1}function Oe(t,r){return t.nullable&&!r.nullable?!1:r.type==="json"?!0:t.type!==r.type||r.enum&&(!t.enum||t.enum.some(n=>!r.enum.includes(n)))?!1:t.type!=="array"||!!t.items&&!!r.items&&Oe(t.items,r.items)}function te(t,r){let n={};for(let[s,i]of Object.entries(t)){let a=i.source,u=a.type==="input"?r.answers:a.type==="node"?r.results??{}:a.type==="parameter"?r.parameters:r.attributes,c=a.type==="parameter"||a.type==="attribute"?a.key:s,f=Object.hasOwn(u,c),g=u[c];if(a.type==="attribute"&&c.includes(".")&&(!f||c.startsWith("merchandise."))){g=u,f=!0;for(let l of c.split(".")){if(!g||typeof g!="object"||!Object.hasOwn(g,l)||Array.isArray(g)&&(!/^(0|[1-9]\d*)$/.test(l)||Number(l)>=g.length)){f=!1;break}g=g[l]}}if(!(!f||g===void 0)){if(!P(i,g))throw new Error(`Invalid variable value: ${s}`);n[s]=g}}return n}function $n(t,r){let n={};for(let[s,i]of Object.entries(t.writes??{})){if(!Object.hasOwn(r,s))throw new Error(`Node output is missing: ${s}`);if(Object.hasOwn(n,i))throw new Error("Node outputs cannot overwrite one another");n[i]=r[s]}return n}function Gn(t,r,n){let s=new Set(Object.values(r.writes??{}));for(let[i,a]of Object.entries(n))if(!s.has(i)||t[i]?.source.type!=="node"||!P(t[i],a))throw new Error(`Invalid node variable write: ${i}`);if(s.size!==Object.keys(n).length)throw new Error("Node output is incomplete")}var R=e.string().min(1).max(255).regex(/^[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+){0,9}$/).refine(t=>t.split(".").every(r=>!["__proto__","constructor","prototype"].includes(r)),"Reserved value path"),E=e.discriminatedUnion("source",[e.strictObject({source:e.literal("literal"),value:v}),e.strictObject({source:e.literal("variable"),key:e.string().min(1).max(255),path:R.optional()})]);function it(t,r){if(!r)return t;for(let n of R.parse(r).split(".")){if(Array.isArray(t)){if(!/^(0|[1-9]\d*)$/.test(n)||Number(n)>=t.length)return;t=t[Number(n)];continue}if(t===null||typeof t!="object"||!Object.hasOwn(t,n))return;t=Reflect.get(t,n)}return t}function Bt(t,r){if(t.source==="literal")return structuredClone(t.value);let n=te(r.declarations,r);if(!Object.hasOwn(n,t.key))throw new Error("Capability input is missing");return structuredClone(v.parse(it(n[t.key],t.path)))}function je(t,r){let n=[...r].sort((i,a)=>a.length-i.length).find(i=>t===i||t.startsWith(i+"."));if(!n)return null;let s=t===n?void 0:t.slice(n.length+1);return s&&!R.safeParse(s).success?null:{key:n,path:s}}function ke(t){let r=Object.values(t.strings.locales).flatMap(n=>Object.values(n));return H(t,n=>{n.type==="custom_html"&&r.push(...Object.values(n.html))}),[...new Set(r.flatMap(Qe))]}function ot(t){return ke(t).filter(r=>r.startsWith("variables.")).map(r=>r.slice(10))}function M(t){let r=JSON.stringify(t);if(r===void 0)throw new TypeError("A JSON value is required");let n=new TextEncoder().encode(r).length,s=!1;for(let i=0;i<r.length;i++){let a=r.charAt(i);if(s)a==="\\"?i++:a==='"'&&(s=!1);else if(a==='"')s=!0;else if(a===":"||a===",")n++;else if(a==="-"||a>="0"&&a<="9"){let u=i;for(;i+1<r.length&&/[0-9.eE+-]/.test(r.charAt(i+1));)i++;let c=r.slice(u,i+1);if(!/[eE]/.test(c))continue;let[f="",g]=c.split(/[eE]/),l=f.replace(/^-/,""),w=l.replace(".","").length,K=(l.includes(".")?l.indexOf("."):w)+Number(g),y=K<=0?2-K+w:K>=w?K:w+1;n+=y+(f.startsWith("-")?1:0)-c.length}}return n}function F(t){let r=new Set,n=a=>a!==null&&typeof a=="object"&&!Array.isArray(a);function s(a,u){if(n(a))for(let[c,f]of Object.entries(a))c==="$elemMatch"?i(f,u):c==="$not"?s(f,u):c==="$all"&&Array.isArray(f)&&f.forEach(g=>s(g,u))}function i(a,u=""){if(n(a)){for(let[c,f]of Object.entries(a))if(["$and","$or","$nor"].includes(c)&&Array.isArray(f))f.forEach(g=>i(g,u));else if(c==="$not")i(f,u);else if(c==="$savedGroup"&&n(f))typeof f.attributeKey=="string"&&r.add(f.attributeKey);else if(!c.startsWith("$")){let g=u?`${u}.${c}`:c;r.add(g),s(f,g)}}}return i(t),[...r]}var $t=e.enum(["active","inactive"]),Gt=e.preprocess((t,r)=>{let n=0;function s(i,a){if(!(++n>1e4||a>20)){if(Array.isArray(i))i.forEach(u=>s(u,a+1));else if(i&&typeof i=="object")for(let[u,c]of Object.entries(i))["__proto__","constructor","prototype"].includes(u)&&r.addIssue({code:"custom",message:"Reserved merchandise attribute"}),s(c,a+1)}}return s(t,0),t},N),qt=e.strictObject({id:e.string().trim().min(1).max(255),name:e.string().trim().min(1).max(255),status:$t,metadata:Gt}),sr=qt.extend({internal_id:e.uuid(),project_id:e.uuid(),environment_id:e.uuid(),created_at:e.iso.datetime({offset:!0}),updated_at:e.iso.datetime({offset:!0})}),ar=e.union([e.strictObject({id:e.string().trim().min(1).max(255)}),e.strictObject({internalId:e.uuid()})]),cr=e.enum(["customer","merchandise","context"]),ur=e.enum(["system","stored","request"]),lr=e.enum(["customer","merchandise","mixed"]),st=t=>t==="merchandiseId"||t==="merchandise"||t.startsWith("merchandise.");function Ae(t,r={},n=new Set){if(F(t).some(st))return!0;for(let s of W(t)){if(n.has(s))continue;n.add(s);let i=r[s];if(i?.type==="list"&&st(i.attributeKey)||i?.type==="condition"&&Ae(i.condition,r,n))return!0}return!1}var hr=e.enum(["draft","active","paused","archived"]),at=e.discriminatedUnion("type",[e.object({type:e.literal("percent"),percentOff:e.number().min(1).max(100).multipleOf(.01)}).strict(),e.object({type:e.literal("amount"),amountOffCents:e.number().int().min(1).max(1e8),currency:he}).strict()]),ct=e.discriminatedUnion("type",[e.object({type:e.literal("once")}).strict(),e.object({type:e.literal("repeating"),months:e.number().int().min(1).max(36)}).strict(),e.object({type:e.literal("forever")}).strict()]),ut=[e.object({type:e.literal("all")}).strict(),e.object({type:e.literal("plans"),planIds:e.array(e.uuid()).min(1).max(50).refine(t=>new Set(t).size===t.length,"\u5957\u9910\u4E0D\u80FD\u91CD\u590D")}).strict()],Lt=e.discriminatedUnion("type",[...ut,e.strictObject({type:e.literal("merchandise"),scope:e.discriminatedUnion("type",[e.strictObject({type:e.literal("all")}),e.strictObject({type:e.literal("selected"),merchandiseIds:e.array(e.uuid()).min(1).max(1e3).refine(t=>new Set(t).size===t.length,"Duplicate merchandise")}),e.strictObject({type:e.literal("condition"),condition:G})])})]),Ht=e.discriminatedUnion("type",[...ut,e.strictObject({type:e.literal("merchandise"),scope:e.strictObject({type:e.enum(["all","selected","condition"])})})]),Jt=e.strictObject({firstPurchaseOnly:e.boolean(),condition:G}),br=e.object({name:e.string().trim().min(1).max(80),description:e.string().max(500),discount:at,duration:ct,nativeDiscountPolicy:ge.optional(),appliesTo:Lt,eligibility:Jt,selfClaimEnabled:e.boolean().default(!1),startsAt:e.iso.datetime().nullable(),endsAt:e.iso.datetime().nullable(),totalLimit:e.number().int().min(1).max(1e6).nullable(),perCustomerLimit:e.number().int().min(1).max(10),grantWindowHours:e.number().int().min(1).max(2160)}).strict().refine(t=>!t.startsAt||!t.endsAt||Date.parse(t.endsAt)>Date.parse(t.startsAt),{message:"\u7ED3\u675F\u65F6\u95F4\u5FC5\u987B\u665A\u4E8E\u5F00\u59CB\u65F6\u95F4",path:["endsAt"]}).refine(t=>!Ae(t.eligibility.condition),{message:"Customer eligibility cannot read merchandise; use merchandise applicability",path:["eligibility","condition"]}).refine(t=>t.appliesTo.type!=="merchandise"||t.duration.type==="once",{message:"Merchandise Coupons apply to one purchase",path:["duration"]}).refine(t=>t.appliesTo.type!=="merchandise"||!t.eligibility.firstPurchaseOnly,{message:"Merchant purchase eligibility requires trusted targeting attributes",path:["eligibility","firstPurchaseOnly"]}),xr=e.object({code:e.string().trim().transform(t=>t.toUpperCase()).pipe(e.string().regex(/^[A-Z0-9][A-Z0-9_-]{2,31}$/,"\u4F18\u60E0\u7801\u53EA\u80FD\u7528 3\u201332 \u4F4D\u5B57\u6BCD\u3001\u6570\u5B57\u3001- \u548C _\uFF0C\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u5F00\u5934")),maxRedemptions:e.number().int().min(1).max(1e6).nullable(),expiresAt:e.iso.datetime().nullable(),firstPurchaseOnly:e.boolean(),minimumAmountCents:e.number().int().min(1).max(1e8).nullable(),minimumAmountCurrency:he.nullable()}).strict().refine(t=>t.minimumAmountCents===null==(t.minimumAmountCurrency===null),"Minimum amount requires its currency");var lt=e.object({id:e.uuid(),couponId:e.uuid(),status:e.enum(["issued","reserved","redeemed","revoked","expired"]),issuedAt:e.iso.datetime(),expiresAt:e.iso.datetime(),coupon:e.object({name:e.string(),discount:at,duration:ct,nativeDiscountPolicy:ge.optional(),appliesTo:Ht}).strict()}).strict(),Sr=e.enum(["claim_disabled","unavailable","inactive","outside_window","not_targeted","not_first_purchase","limit_reached","sold_out"]);var Zt=e.string().regex(/^[a-f0-9]{64}$/),Wt=Ze.pick({text:!0,label:!0,alt:!0,html:!0,couponId:!0,countdownAt:!0,missing:!0}),pt=e.strictObject({couponDigests:e.record(e.uuid(),Zt),variables:e.record(be,e.record(e.uuid(),e.partialRecord(e.enum(["offer.name","offer.description","offer.headline","offer.eligibility","offer.validity","offer.terms","offer.discount","offer.months","offer.ends_at"]),e.string()))),locales:e.record(be,We.extend({nodes:e.record(e.string(),e.strictObject({base:Wt})),plans:e.object({}).strict(),pickers:e.object({}).strict()}).omit({paywall:!0}))});var dt=e.enum(["funnel-run/1","funnel-process/1"]),Ar="funnel-process/1";var Ce=v,Qt=["parameters","answers","results","variables"];function Xt(t){return Qt.some(r=>t===r||t.startsWith(r+"."))}function Yt(t){let r={};for(let[s,i]of Object.entries(te(t.declarations,t))){let a=s.split(".");if(a.some(f=>["__proto__","constructor","prototype"].includes(f)))throw new Error("Reserved result path");let u=r;for(let f of a.slice(0,-1)){Object.hasOwn(u,f)||(u[f]={});let g=u[f];if(!g||typeof g!="object"||Array.isArray(g))throw new Error("Ambiguous result path");u=g}let c=a.at(-1);if(c===void 0)throw new Error("Empty result path");u[c]=i}return{...Object.fromEntries(Object.entries(t.attributes).filter(([s])=>!Xt(s))),variables:r}}var ne=e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/);var _e=e.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),mt=e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,128}$/),ft=B.refine(t=>new TextEncoder().encode(JSON.stringify(t)).byteLength<=8192,"Task data exceeds 8 KiB"),Re=e.record(_e,e.enum(["string","number","boolean","strings"])).refine(t=>Object.keys(t).length<=20,"Too many output fields"),en=E,yt=e.strictObject({type:e.literal("external_task"),endpointId:e.uuid(),taskKey:_e,inputs:e.record(_e,en).refine(t=>Object.keys(t).length<=20),outputs:Re}),gt=e.strictObject({maxAttempts:e.number().int().min(1).max(5),retryDelaySeconds:e.number().int().min(1).max(30),backoff:e.enum(["fixed","exponential"]),requestTimeoutSeconds:e.number().int().min(1).max(10),timeoutSeconds:e.number().int().min(1).max(300)}).refine(t=>t.requestTimeoutSeconds<=t.timeoutSeconds,"Request timeout exceeds action deadline");var Br=e.strictObject({outcome:e.enum(["success","failure"]),data:ft});var $r=e.discriminatedUnion("operation",[e.strictObject({operation:e.literal("signal"),runId:e.uuid(),nodeId:mt,eventName:ne,eventId:e.uuid(),data:ft}),e.strictObject({operation:e.literal("read_results"),runId:e.uuid()})]),Gr=e.strictObject({scope:U,runId:e.uuid(),eventId:e.uuid(),accepted:e.boolean()}),tn=e.record(mt,Ce),qr=e.strictObject({scope:U,runId:e.uuid(),results:tn});var nn=["id","externalUserId","createdAt","ageDays","subscription"],De=e.array(e.string().trim().min(1).max(40).refine(t=>!t.includes(","),"\u6807\u7B7E\u4E0D\u80FD\u5305\u542B\u9017\u53F7")).max(20).refine(t=>new Set(t).size===t.length,"\u6807\u7B7E\u4E0D\u80FD\u91CD\u590D"),re=e.intersection(N,e.looseObject({tags:De.optional()})).refine(t=>![...nn,"parameters","answers","results"].some(r=>Object.hasOwn(t,r)),"Reserved customer attribute"),ie=e.string().trim().max(80),oe=e.string().regex(/^\+[1-9]\d{1,14}$/).nullable(),se=e.union([e.email().max(254),e.literal("")]),rn=e.string().trim().min(1).max(255).refine(t=>!/\p{Cc}/u.test(t),"Fingerprint must not contain control characters"),ht=e.string().trim().min(1).max(255).refine(t=>!t.startsWith("gg_guest_"),"Reserved guest identity namespace"),Zr=e.object({externalUserId:ht.optional(),name:ie.default(""),email:se.default(""),phone:oe.optional(),attributes:re.default({})}).strict().refine(t=>t.externalUserId!==void 0||t.email!=="","\u8BF7\u63D0\u4F9B\u4E1A\u52A1\u7528\u6237 ID \u6216\u90AE\u7BB1"),ae=e.discriminatedUnion("type",[e.strictObject({type:e.literal("id"),value:e.uuid()}),e.strictObject({type:e.literal("externalUserId"),value:ht})]),ce=e.strictObject({name:ie.optional(),email:se.optional(),phone:oe.optional(),attributes:re.optional(),fingerprint:rn.optional()}),ue=t=>!t.customerData||t.customer?.type==="externalUserId",le="customerData requires an externalUserId customer",bt=e.object({id:e.uuid(),externalUserId:e.string().min(1).max(255).nullable(),name:ie,email:se,phone:oe.optional(),attributes:re,createdAt:e.iso.datetime()}).strict(),Wr=e.object({customer:bt,changed:e.boolean(),replayed:e.boolean()}).strict(),on=e.discriminatedUnion("type",[e.object({type:e.literal("id"),value:e.uuid()}).strict(),e.object({type:e.literal("externalUserId"),value:e.string().trim().min(1).max(255)}).strict()]),sn=e.object({name:ie.optional(),email:se.optional(),phone:oe.optional(),attributes:re.refine(t=>!Object.hasOwn(t,"tags"),"Use incremental tagChanges").optional(),removeAttributes:e.array(e.string().regex(/^[a-zA-Z][a-zA-Z0-9_]{0,127}$/)).max(128).refine(t=>!t.includes("tags")).optional(),tagChanges:e.strictObject({add:De,remove:De}).optional()}).strict().refine(t=>Object.keys(t).length>0,"\u8BF7\u63D0\u4F9B\u9700\u8981\u4FEE\u6539\u7684\u5B57\u6BB5"),an=e.object({lookup:on}).strict(),Qr=an.extend({requestId:e.uuid(),patch:sn}).strict(),Xr=e.object({search:e.string().trim().max(200).default(""),tag:e.string().trim().max(40).default(""),planId:e.string().max(200).default(""),versionId:e.string().max(200).default(""),holdingStatus:e.enum(["","active","scheduled","expired","unavailable","none"]).default(""),membershipStatus:e.enum(["","active","trial","past_due","ended"]).default(""),createdFrom:e.union([e.iso.datetime(),e.literal("")]).default(""),createdUntil:e.union([e.iso.datetime(),e.literal("")]).default(""),offset:e.coerce.number().int().min(0).max(1e5).default(0),limit:e.coerce.number().int().min(1).max(100).default(50)}).strict(),Yr=e.object({customers:bt.array(),hasMore:e.boolean(),total:e.number().int().nonnegative().nullable(),evaluatedAt:e.iso.datetime()}).strict();var ii=e.enum(["local","remote"]),ze=e.strictObject({port:e.string().regex(/^[a-zA-Z0-9_.:-]{1,128}$/),value:v.optional(),sticky:e.array(e.strictObject({expected:Q.nullable(),next:Q})).max(100),exposures:e.array(v).max(100),features:e.array(v).max(100)}),xt=e.strictObject({type:e.literal("evaluate"),receiptId:e.uuid(),environmentId:e.uuid(),policyRevision:e.number().int().nonnegative(),attributes:N,sticky:e.record(e.string(),Q)}),St=xt.extend({runId:e.uuid(),versionId:e.uuid(),nodeId:e.string().min(1).max(64),visit:e.number().int().nonnegative(),revision:e.number().int().nonnegative()}),cn=xt.omit({type:!0,receiptId:!0}).extend({type:e.literal("evaluate_segment")}),vt=e.strictObject({nodeId:e.string().min(1).max(64),result:ze}),wt=cn.extend({runId:e.uuid(),versionId:e.uuid(),nodeId:e.string().min(1).max(64),visit:e.number().int().nonnegative(),revision:e.number().int().nonnegative(),parameters:B,answers:X,variables:e.record(e.string(),v)});var Ee=e.discriminatedUnion("type",[e.strictObject({type:e.literal("literal"),value:v}),e.strictObject({type:e.literal("variable"),key:I,path:R.optional()}),e.strictObject({type:e.literal("feature"),featureKey:e.string().min(1).max(128)})]),un=e.strictObject({requestId:e.uuid(),decisionId:e.uuid(),customerId:e.uuid(),externalUserId:e.string().min(1).max(255).nullable(),versionId:e.uuid(),receiptId:e.uuid(),value:v}),ln={funnelId:e.uuid(),requestId:e.uuid(),customer:ae,customerData:ce.optional(),attributes:N.refine(t=>!["parameters","answers","results","variables"].some(r=>Object.hasOwn(t,r)),"parameters, answers, results and variables are reserved flow namespaces")},mi=e.discriminatedUnion("operation",[e.strictObject({operation:e.literal("decide"),...ln}).refine(ue,le),e.strictObject({operation:e.literal("read_decision"),decisionId:e.uuid()}),e.strictObject({operation:e.literal("evaluate_decision"),decisionId:e.uuid(),requestId:e.uuid(),nodeId:e.string().min(1).max(64),visit:e.number().int().nonnegative(),revision:e.number().int().nonnegative(),receiptId:e.uuid(),policyRevision:e.number().int().nonnegative(),generation:e.string().min(1).max(256),result:ze}),e.strictObject({operation:e.literal("feature_config"),funnelId:e.uuid()}),e.strictObject({operation:e.literal("commit_decision_segment"),decisionId:e.uuid(),requestId:e.uuid(),nodeId:e.string().min(1).max(64),visit:e.number().int().nonnegative(),revision:e.number().int().nonnegative(),policyRevision:e.number().int().nonnegative(),generation:e.string().min(1).max(256),steps:e.array(vt).max(32),boundary:e.strictObject({nodeId:e.string().min(1).max(64),visit:e.number().int().nonnegative()}).optional()}),e.strictObject({operation:e.literal("segment_configuration"),funnelId:e.uuid(),versionId:e.uuid()}),e.strictObject({operation:e.literal("configuration"),funnelId:e.uuid(),versionId:e.uuid().optional()}),e.strictObject({operation:e.literal("local_configuration"),funnelId:e.uuid()}),e.strictObject({operation:e.literal("report_used"),decisionId:e.uuid(),eventId:e.uuid(),occurredAt:e.iso.datetime({offset:!0}),reference:e.string().min(1).max(128).optional()})]),fi=e.strictObject({scope:U,decisionId:e.uuid(),requestId:e.uuid(),status:e.enum(["pending","completed","failed"]),decision:un.nullable(),evaluation:e.discriminatedUnion("type",[St,wt]).optional()}).refine(t=>t.status==="completed"==(t.decision!==null)&&(!t.decision||t.decision.decisionId===t.decisionId&&t.decision.requestId===t.requestId),"Completed decisions carry their committed result"),yi=e.strictObject({scope:U,decisionId:e.uuid(),eventId:e.uuid(),source:e.literal("caller_reported")});function pn(t,r=[]){let n=[];H(t,i=>{i.hidden&&n.push("Hidden components must not be delivered"),r.includes(i.type)&&n.push(`Node type ${i.type} cannot be delivered`)});let s=new Set(xe(t).map(i=>i.key));for(let[i,a]of Object.entries(t.strings.locales))for(let u of Object.keys(a))s.has(u)||n.push(`Unused string ${u} must not be delivered (${i})`);return n}function It(t){return t.hidden?null:t.type!=="stack"?t:{...t,children:t.children.flatMap(r=>It(r)??[])}}function dn(t){let r=t.pages.map(i=>{let a=It(i.root);return a?.type==="stack"?{...i,root:a}:{...i,root:{type:"stack",id:i.root.id,...i.root.name===void 0?{}:{name:i.root.name},direction:"vertical",align:"stretch",justify:"start",children:[]}}}),n=new Set(xe({pages:r}).map(i=>i.key)),s=Object.fromEntries(Object.entries(t.strings.locales).map(([i,a])=>[i,Object.fromEntries(Object.entries(a).filter(([u])=>n.has(u)))]));return{...t,pages:r,strings:{...t.strings,locales:s}}}function Ot(t,r=[]){let n=J.parse(structuredClone(dn(t))),s=a=>a.type!=="stack"||a.interaction!==void 0||a.children.some(s);for(let a of n.pages)if(!s(a.root))throw new Error(`Page ${a.id} has no visible content`);let i=pn(n,r);if(i.length)throw new Error(i.join("; "));return n}var Si=e.discriminatedUnion("action",[e.strictObject({action:e.literal("create"),couponId:e.uuid(),productBindingId:e.uuid(),storeOfferId:e.string().min(1).max(255).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/).nullable(),storeOfferType:e.enum(["introductory","promotional"])}),e.strictObject({action:e.literal("set_enabled"),id:e.uuid(),revision:e.number().int().nonnegative(),enabled:e.boolean()})]),vi=e.array(e.strictObject({id:e.uuid(),couponId:e.uuid(),productBindingId:e.uuid(),storeOfferId:e.string().min(1).max(255).nullable(),storeOfferType:e.enum(["introductory","promotional"]),enabled:e.boolean(),revision:e.number().int().nonnegative()})).max(500),Ke=e.strictObject({offerKind:e.enum(["none","introductory","promotional"]),offerId:e.string().min(1).max(255).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/).nullable(),discountMinor:e.number().int().min(0).max(1e8),trialDays:e.number().int().min(1).max(730).nullable()}).superRefine((t,r)=>{(t.offerKind==="none"&&(t.offerId!==null||t.discountMinor!==0||t.trialDays!==null)||t.trialDays!==null&&t.discountMinor!==0)&&r.addIssue({code:"custom",message:"Select one store purchase option with its exact terms"})}),wi=e.record(e.uuid(),Ke).refine(t=>Object.keys(t).length<=20,"At most 20 native store selections");var ji=e.strictObject({schemaVersion:e.literal(1),renderKey:e.string().min(1).max(256),routeTemplate:e.string().startsWith("/").max(2048),selectors:e.array(e.string().regex(/^[a-z][a-z0-9-]*\[(?:id|data-testid|data-test|data-qa|data-indiana-id)="(?:[^"\\\x00-\x1f\x7f]|\\["\\])*"\]$/).max(512)),present:e.array(e.number().int().min(0)).min(1),absent:e.array(e.number().int().min(0))}).superRefine((t,r)=>{let n=[...t.present,...t.absent];(new Set(t.selectors).size!==t.selectors.length||new Set(n).size!==n.length||n.length!==t.selectors.length||n.some(s=>s>=t.selectors.length))&&r.addIssue({code:"custom",message:"Incomplete or ambiguous render signature"})}),jt=e.strictObject({renderKey:e.string().min(1).max(256),routeKey:e.string().min(1).max(256),stateKey:e.string().min(1).max(256),documentKey:e.string().min(1).max(256),documentHash:e.string().regex(/^[a-f0-9]{64}$/),compositionKey:e.string().min(1).max(256),entryMode:e.enum(["hard","soft"]),match:e.strictObject({present:e.array(e.number().int().min(0)),absent:e.array(e.number().int().min(0))})});var mn=["enterprise-internal-indiana-test","tinkerland-indiana-prod"],Ve="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",fn=e.string().regex(new RegExp(`^${Ve}/${Ve}/${Ve}/manifest\\.json$`)),kt=e.strictObject({kind:e.literal("gcs-resumable"),url:e.url(),bucket:e.enum(mn),objectKey:fn,byteLength:e.number().int().positive(),expiresAt:e.iso.datetime()}).superRefine((t,r)=>{let n=new URL(t.url),s=n.searchParams,i=["uploadType","upload_id","name","upload_protocol","ifGenerationMatch"];(n.origin!=="https://storage.googleapis.com"||n.username||n.password||n.hash||n.pathname!==`/upload/storage/v1/b/${t.bucket}/o`||[...s.keys()].some(a=>!i.includes(a)||s.getAll(a).length!==1)||s.get("uploadType")!=="resumable"||!/^[A-Za-z0-9_-]{1,4096}$/.test(s.get("upload_id")??"")||s.has("name")&&s.get("name")!==`app-manifests/${t.objectKey}`||s.has("upload_protocol")&&s.get("upload_protocol")!=="resumable"||s.has("ifGenerationMatch")&&s.get("ifGenerationMatch")!=="0")&&r.addIssue({code:"custom",message:"Invalid IAM upload capability"})});var S=e.string().min(1).max(256),A=e.string().regex(/^[a-f0-9]{64}$/),pe=e.strictObject({versionId:e.uuid(),manifestDigest:A,sourceGraphDigest:A,pageKey:S,stateKey:S,documentKey:S,documentHash:A,elementKey:S.optional(),nodeId:S.optional(),contentHash:A.optional(),renderKey:S.optional()}),At=e.strictObject({pageKey:S,documentKey:S,expectedDocumentHash:A,renderKey:S.optional(),nodeId:S,elementKey:S,expectedContentHash:A,property:e.enum(["text","fontSize","color"]),value:e.union([e.string().max(4e3),e.number().finite()])}),zi=e.strictObject({versionId:e.uuid(),manifestDigest:A,sourceGraphDigest:A,pageKey:S,stateKey:S,documentKey:S,documentHash:A,renderKey:S.optional(),patches:e.array(At.omit({pageKey:!0,documentKey:!0,expectedDocumentHash:!0,renderKey:!0})).min(1).max(200)}),yn=/^[a-z][a-z0-9-]{0,39}$/,q=e.string().regex(yn),Pe=e.enum(["web","ios","android"]),Ct={requestId:e.uuid(),client:q,platform:Pe,label:e.string().trim().min(1).max(100),sha256:A,bytes:e.number().int().min(1),transferBytes:e.number().int().min(1)},gn=e.strictObject({action:e.literal("upload"),...Ct,transferBytes:e.number().int().min(1).max(2e6),base64:e.string().min(4).max(2666668).regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/)}),Ei=e.discriminatedUnion("action",[gn,e.strictObject({action:e.literal("register"),...Ct}),e.strictObject({action:e.literal("complete"),versionId:e.uuid()}),e.strictObject({action:e.literal("current"),versionId:e.uuid(),expectedCurrent:e.uuid().nullable()}),e.strictObject({action:e.literal("delivery"),enabled:e.boolean()}),e.strictObject({action:e.literal("changes"),versionId:e.uuid(),experimentId:e.uuid(),variationId:S,changesetId:e.uuid().nullable(),expectedRevision:A.nullable(),editorUrl:e.string().url().max(2048),patches:e.array(At).max(200)})]),Fe=e.strictObject({id:e.uuid(),projectId:e.uuid(),environmentId:e.uuid(),clientKey:q,platform:Pe,label:e.string(),sha256:A,bytes:e.number().int().positive(),objectKey:e.string(),state:e.enum(["uploading","ready","rejected"]),isCurrent:e.boolean(),revision:e.number().int().nonnegative(),createdAt:e.string(),expiresAt:e.string(),readyAt:e.string().nullable(),summary:e.record(e.string(),e.json()),routeTree:e.json().nullable(),validation:e.record(e.string(),e.json())}),hn=e.strictObject({key:q,platform:Pe,currentId:e.uuid().nullable()}),Ki=e.strictObject({rows:e.array(Fe).max(100),nextCursor:e.uuid().nullable(),clients:e.array(hn).max(20)}),Ne=e.strictObject({storedBytes:e.number().int().nonnegative(),reservedBytes:e.number().int().nonnegative(),chargedBytes:e.number().int().nonnegative(),versions:e.number().int().nonnegative(),objects:e.number().int().nonnegative(),orphanObjects:e.number().int().nonnegative(),missingReadyObjects:e.number().int().nonnegative(),unknownObjectSizes:e.number().int().nonnegative(),byteLimit:e.number().int().positive(),versionLimit:e.number().int().positive(),remainingBytes:e.number().int().nonnegative()}),Vi=e.strictObject({asOf:e.iso.datetime({offset:!0}),reclamation:e.literal("manual-review-required"),buckets:e.strictObject({source:Ne,runtime:Ne,previews:Ne})}),Ni=e.strictObject({version:Fe,actorId:e.uuid(),claims:e.record(e.string(),e.json())}),Pi=e.strictObject({version:Fe,upload:kt.nullable()}),Fi=e.object({format:e.literal("indiana-route-state-index"),schemaVersion:e.literal(3),routes:e.array(e.object({routeKey:S,path:e.string(),documentKey:S,documentHash:A,initialStateKey:S,initialRenderKey:S})),renders:e.array(jt)}).loose().superRefine((t,r)=>{(!t.renders||t.routes.some(n=>!t.renders?.some(s=>s.renderKey===n.initialRenderKey&&s.routeKey===n.routeKey&&s.documentKey===n.documentKey&&s.stateKey===n.initialStateKey&&s.documentHash===n.documentHash&&s.entryMode==="hard")))&&r.addIssue({code:"custom",message:"Incomplete render catalog"})}),Mi=e.strictObject({rows:e.array(e.object({id:e.uuid(),name:e.string(),status:e.string(),variations:e.array(e.object({id:S,key:S,name:e.string().optional()}).loose())}).loose()),limited:e.boolean()}),Ti=e.strictObject({enabled:e.boolean(),allowedOrigins:e.array(e.string())});var bn=e.strictObject({delaySeconds:e.number().int().min(0).max(86400).optional(),maxPerDay:e.number().int().min(1).max(100).optional(),maxPerSession:e.number().int().min(1).max(100).optional()}),_t=e.strictObject({id:e.uuid(),name:e.string().trim().min(1).max(80),client:q,source:pe,event:e.enum(["screen_enter","button_click"]),cooldownSeconds:e.number().int().min(0).max(2592e3),behavior:e.literal("observe"),delivery:bn.optional()}).superRefine((t,r)=>{t.event==="button_click"&&(!t.source.nodeId||!t.source.elementKey)&&r.addIssue({code:"custom",path:["source"],message:"Choose a uniquely bound button"})});var D={flowNodes:500,logicNodes:480,pages:100,components:1500,actions:250,questions:40,documentBytes:1e6,conditionDepth:3,conditionChildren:20,conditionPredicates:100},Rt="00000000-0000-0000-0000-000000000000";var Dt=e.strictObject({type:e.literal("bundle"),paywall:E.optional(),offering:E.optional(),coupons:E,data:E}),xn=t=>e.strictObject({type:e.literal(t),id:e.uuid()}),Wi=e.strictObject({type:e.literal("bundle"),paywallVersionId:e.uuid().optional(),offeringVersionId:e.uuid().optional(),couponIds:e.array(e.uuid()).max(20).refine(t=>new Set(t).size===t.length),data:v});var Qi=e.strictObject({type:e.literal("bundle"),offering:xn("offering_version").nullable(),paywall:e.strictObject({versionId:e.uuid(),paywallId:e.uuid(),offeringVersionId:e.uuid()}).nullable(),coupons:e.array(lt).max(20),data:v});var zt=e.union([e.string(),e.number().finite(),e.boolean(),e.null()]),Sn=e.union([zt,e.array(zt).min(1).max(20)]),vn=e.record(R,Sn).refine(t=>Object.keys(t).length<=10),Et=e.strictObject({path:R,type:e.enum(["string","number","boolean","strings"]),nullable:e.boolean().optional(),aggregation:e.enum(["count","exists"]).optional(),where:vn.optional()}).superRefine((t,r)=>{(t.aggregation==="count"&&t.type!=="number"||t.aggregation==="exists"&&t.type!=="boolean"||!t.aggregation&&t.where)&&r.addIssue({code:"custom",message:"Collection summaries require their matching type"})});var wn=["sendMessage","checkEntitlement","resolveOffering","readHoldings","readLedger","readBillingInvoice","readCreditStatement","previewAttach","attach","readSubscriptionOperation","previewUpdate","update","readSubscriptionUpdate","setupPayment","readPaymentSetup","verifySubscriptions","previewRefund","refund","readRefund","restoreNativePurchase","readBillingControls","prepareBillingAuthorization","confirmBillingAuthorization","setBillingCoupons","revokeBillingAuthorization","listBillingInvoices","confirmBillingAdjustment","manageBillingLimits","readSeats","manageSeat","quoteBalance","mutateBalance","trackUsage","readUsage","setUsage","adjustBalance","readBalanceSource","manageBalanceGrant","listBalanceGrants","manageUsageEntity","readUsageAnalytics","readCreditAnalytics","submitUsageBatch","readUsageBatch","redeemCoupon","listOffers","grantOffer","redeemReward","createReferralCode","claimRewardProduct"],Kt=e.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),In=E,Vt=e.discriminatedUnion("type",[yt,e.strictObject({type:e.literal("claim_offer"),coupon:E}),e.strictObject({type:e.literal("event"),event:Kt}),e.strictObject({type:e.literal("api"),operation:e.enum(wn),inputs:e.record(R,In).refine(t=>Object.keys(t).length<=40),outputs:e.record(Kt,Et).refine(t=>Object.keys(t).length<=20)})]);var b=ne,On=e.string().regex(/^[a-zA-Z0-9_.-]{1,128}$/),C={id:b,name:e.string().trim().min(1).max(80),position:e.strictObject({x:e.number().finite(),y:e.number().finite()}).optional()},jn={success:b,cancel:b,unavailable:b,failure:b},kn=e.url().max(2048).refine(t=>{try{return new URL(t).protocol==="https:"}catch{return!1}},{message:"External pages require HTTPS"}),An=e.enum(["same_window","new_window"]),Cn=e.discriminatedUnion("type",[e.strictObject({...C,type:e.literal("entry"),next:b,triggers:e.array(_t).max(20).refine(t=>new Set(t.map(r=>r.id)).size===t.length,"Entry trigger IDs must be unique").optional()}),e.strictObject({...C,type:e.literal("screen"),screenId:b,presentation:Xe,outputs:e.record(b,b),offering:e.discriminatedUnion("source",[e.strictObject({source:e.literal("variable"),key:I}),e.strictObject({source:e.literal("fixed"),versionId:e.uuid()})]).optional()}),e.strictObject({...C,type:e.literal("offering"),configuration:e.discriminatedUnion("source",[e.strictObject({source:e.literal("fixed"),versionId:e.uuid()}),e.strictObject({source:e.literal("feature"),featureKey:e.string().min(1).max(128)})]),writes:e.strictObject({value:I}),next:b}),e.strictObject({...C,type:e.literal("coupon"),couponId:e.uuid(),writes:e.strictObject({value:I}),next:b}),e.strictObject({...C,type:e.literal("coupons"),couponIds:e.array(e.uuid()).max(20).refine(t=>new Set(t).size===t.length),writes:e.strictObject({value:I}),next:b}),e.strictObject({...C,type:e.literal("output"),value:e.discriminatedUnion("type",[...Ee.options,Dt,e.strictObject({type:e.literal("selection"),screenId:b,offeringKey:I})])}),e.strictObject({...C,type:e.literal("condition"),cases:e.array(e.strictObject({condition:G,target:b})).min(1).max(50),default:b}),e.strictObject({...C,type:e.literal("feature"),featureKey:e.string().min(1).max(128),writes:e.strictObject({value:I}),next:b}),e.strictObject({...C,type:e.literal("split"),experimentId:e.uuid(),applyPageExperiment:e.literal(!0).optional(),routes:e.record(On,b).refine(t=>Object.keys(t).length>=2&&Object.keys(t).length<=20),notParticipating:b}),e.strictObject({...C,type:e.literal("action"),...jn,execution:gt,action:Vt,writes:Ie.optional()}),e.strictObject({...C,type:e.literal("external_page"),appManifest:pe.optional(),url:kn,openIn:An,opened:b,failed:b}),e.strictObject({...C,type:e.literal("end"),outcome:e.enum(["completed","closed","ineligible","failed"]),output:Ee.optional()}),e.strictObject({...C,type:e.literal("wait"),writes:Ie.optional(),wait:e.discriminatedUnion("type",[e.strictObject({type:e.literal("duration"),delaySeconds:e.number().int().min(1).max(2592e3),elapsed:b}),e.strictObject({type:e.literal("event"),eventName:b,outputs:Re,timeoutSeconds:e.number().int().min(1).max(2592e3),received:b,timeout:b})])})]),Me=e.strictObject({version:e.literal(5),entry:b,nodes:e.array(Cn).min(1).max(D.flowNodes)}),Te=Me.superRefine((t,r)=>{_n(t,n=>r.addIssue({code:"custom",message:n.message,path:n.path,params:{reason:n.reason}}))});function de(t){switch(t.type){case"entry":case"feature":case"offering":case"coupon":case"coupons":return[t.next];case"screen":return Object.values(t.outputs);case"condition":return[...t.cases.map(r=>r.target),t.default];case"split":return[...Object.values(t.routes),t.notParticipating];case"action":return[t.success,t.cancel,t.unavailable,t.failure];case"external_page":return[t.opened,t.failed];case"end":case"output":return[];case"wait":return t.wait.type==="duration"?[t.wait.elapsed]:[t.wait.received,t.wait.timeout]}}function _n(t,r){let n=[],s=new Map(t.nodes.map(l=>[l.id,l])),i=(l,w,K)=>{n.push(l),r?.({message:l,reason:w,path:K?["nodes",t.nodes.indexOf(K)]:[]})};s.size!==t.nodes.length&&i("Node identifiers must be unique","uniqueNodes"),(s.get(t.entry)?.type!=="entry"||t.nodes.filter(l=>l.type==="entry").length!==1)&&i("A flow has exactly one entry node","entry"),(t.nodes.filter(l=>l.type==="screen").length>D.pages||t.nodes.filter(l=>!["screen","entry","end","output"].includes(l.type)).length>D.logicNodes)&&i("Flow node limit exceeded","budget");let a=new Set;for(let l of t.nodes){for(let w of de(l))w===t.entry&&i("An entry cannot be a transition target","entryTarget",l),s.has(w)||i(`Missing target ${w}`,"missingTarget",l);l.type==="screen"&&(a.has(l.screenId)&&i("Every screen has exactly one node owner","screenOwner",l),a.add(l.screenId))}let u=new Set,c=new Set,f=new Set;function g(l){if(u.has(l)){i("Flow edges must not form a cycle","cycle",s.get(l));return}if(!(c.has(l)||!s.has(l))){u.add(l),f.add(l);for(let w of de(s.get(l)))g(w);u.delete(l),c.add(l)}}g(t.entry);for(let l of t.nodes)f.has(l.id)||i("Every node must be reachable from Entry","unreachable",l);return[...new Set(n)]}var Ue={maxTransitions:1e4,runTimeoutSeconds:2592e3};function Nt(t,r,n){let s=[...r].sort((c,f)=>f.length-c.length),i=new Set,a=(c,f=!1)=>{let g=s.find(l=>c===l||f&&c.startsWith(l+"."));i.add(g??c)};if(t.type==="condition"){let c=n?.startsWith("case_")?Number(n.slice(5)):t.cases.length-1;for(let f of t.cases.slice(0,c+1))for(let g of F(f.condition))g.startsWith("variables.")&&a(g.slice(10),!0)}if(t.type==="screen"&&t.offering?.source==="variable"&&a(t.offering.key),t.type==="action"&&(t.action.type==="api"||t.action.type==="external_task"))for(let c of Object.values(t.action.inputs))c.source==="variable"&&a(c.key);t.type==="action"&&t.action.type==="claim_offer"&&t.action.coupon.source==="variable"&&a(t.action.coupon.key);let u=t.type==="output"?t.value:t.type==="end"?t.output:null;if(u?.type==="variable"&&a(u.key),u?.type==="bundle")for(let c of[u.paywall,u.offering,u.coupons,u.data])c?.source==="variable"&&a(c.key);return u?.type==="selection"&&a(u.offeringKey),[...i]}var $=e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,127}$/),me=t=>e.record(e.string(),v).refine(r=>M(r)<=t,"Funnel evidence exceeds its byte budget"),_o=e.enum(["local_segment","evaluation","presentation","timer","event","operation"]),$e=e.enum(["entry","presentation","decision","configuration","capability","wait","terminal"]),Ge=e.discriminatedUnion("type",[e.strictObject({type:e.literal("flag"),key:e.string().min(1).max(128)}),e.strictObject({type:e.literal("experiment"),id:e.uuid()}),e.strictObject({type:e.literal("saved_group"),id:e.uuid()}),e.strictObject({type:e.literal("config"),key:e.string().min(1).max(128)}),e.strictObject({type:e.literal("constant"),key:e.string().min(1).max(128)}),e.strictObject({type:e.literal("paywall_version"),id:e.uuid()}),e.strictObject({type:e.literal("offering_version"),id:e.uuid()}),e.strictObject({type:e.literal("reward"),id:e.uuid()})]),Ro=e.strictObject({schemaVersion:e.literal(1),kind:$e,selector:Ge.nullable(),context:me(131072),contract:e.strictObject({version:e.number().int().positive(),evaluator:e.string().min(1).max(128),policyRevision:e.number().int().nonnegative()})}).refine(t=>M(t)<=131072,"Node input exceeds its byte budget"),Do=e.strictObject({schemaVersion:e.literal(1),kind:$e,outcome:e.enum(["success","cancel","failure","unavailable","elapsed","received","timeout","not_participating"]),data:me(131072),route:e.string().regex(/^[a-zA-Z0-9_.-]{1,128}$/).nullable(),evidence:me(131072)}).refine(t=>M(t)<=131072,"Node result exceeds its byte budget"),zo=e.strictObject({schemaVersion:e.literal(1),operations:e.record($,e.strictObject({attempts:e.number().int().nonnegative(),maxAttempts:e.number().int().min(1).max(5),deadlineAt:e.iso.datetime({offset:!0}),retryAt:e.iso.datetime({offset:!0}).nullable(),error:e.string().regex(/^[a-z_]{1,64}$/).nullable(),reference:e.strictObject({type:$,id:e.uuid()}).nullable()}))}).refine(t=>M(t)<=65536,"Execution state exceeds its byte budget"),T={receiptId:e.uuid()},Be=e.iso.datetime({offset:!0}),Eo=e.discriminatedUnion("type",[e.strictObject({type:e.literal("node_entered"),details:e.strictObject({kind:$e})}),e.strictObject({type:e.literal("presentation_shown"),details:e.strictObject({...T,source:e.literal("client"),occurredAt:Be.optional()})}),e.strictObject({type:e.literal("decision_accepted"),details:e.strictObject(T)}),e.strictObject({type:e.literal("signal_received"),details:e.strictObject({signalId:e.uuid(),nodeId:$,eventName:$,data:me(8192),source:e.literal("server"),occurredAt:Be})}),e.strictObject({type:e.literal("signal_consumed"),details:e.strictObject({...T,signalId:e.uuid()})}),e.strictObject({type:e.literal("wait_elapsed"),details:e.strictObject(T)}),e.strictObject({type:e.literal("wait_timeout"),details:e.strictObject(T)}),e.strictObject({type:e.literal("operation_completed"),details:e.strictObject({...T,operation:$,reference:e.strictObject({type:$,id:e.uuid()}).nullable()})}),e.strictObject({type:e.literal("execution_recovered"),details:e.strictObject({generation:e.number().int().positive(),reason:e.enum(["interrupted","expired_lease","delivery_failed"])})}),e.strictObject({type:e.literal("execution_failed"),details:e.strictObject({generation:e.number().int().positive(),code:e.string().regex(/^[a-z_]{1,64}$/)})}),e.strictObject({type:e.literal("run_completed"),details:e.strictObject({outcome:e.enum(["completed","ineligible","failed"])})}),e.strictObject({type:e.literal("run_closed"),details:e.strictObject({source:e.enum(["client","server","expiry"])})}),e.strictObject({type:e.literal("treatment_used"),details:e.strictObject({...T,source:e.enum(["client","server"]),occurredAt:Be,reference:e.string().min(1).max(128).optional()})})]);var _=e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/),Rn=e.discriminatedUnion("type",[e.strictObject({id:_,type:e.literal("owned"),publicData:pt.optional(),document:J.refine(t=>["page","popup","onboarding"].includes(t.surface)&&t.pages.length===1&&t.actions.every(r=>r.type==="event"&&!r.close),"A Funnel owns one Page or Popup per screen and emits outputs; Paywall owns its purchase policies")}),e.strictObject({id:_,type:e.literal("paywall"),paywallVersionId:e.uuid()})]),qe={executionContract:dt.optional(),kind:e.literal("funnel"),schemaVersion:e.literal(4),screens:e.array(Rn).max(D.pages),references:e.record(_,Ge).refine(t=>Object.keys(t).length<=500),inputs:e.array(e.strictObject({variable:_,screenId:_,componentId:_,required:e.boolean()})).max(D.questions),variables:e.record(I,ee).refine(t=>Object.keys(t).length<=D.logicNodes),outputSchema:Y,execution:e.strictObject({runTimeoutSeconds:e.number().int().min(1).max(Ue.runTimeoutSeconds),maxTransitions:e.number().int().min(1).max(Ue.maxTransitions)})},Yo=e.strictObject({...qe,graph:Me});function Dn(t,r){let n=!1,s=(i,a)=>{let u=i.type==="stack"||i.type==="button"?i.bind?.coupon??a:a;i.type==="text"&&Object.values(t.strings.locales).some(c=>c[i.text]?.includes("{{offer."))&&!(u&&r(u))&&(n=!0),i.type==="stack"&&i.children.forEach(c=>s(c,u))};for(let i of t.pages)s(i.root);return n}function ye(t){return Array.isArray(t)?t.some(ye):!t||typeof t!="object"?!1:Object.entries(t).some(([r,n])=>r==="productVersionId"?n===Rt:ye(n))}function zn(t){let r=[],n=new Set(Object.values(t.references).flatMap(s=>s.type==="reward"?[s.id]:[]));for(let[s,i]of t.screens.entries()){if(i.type!=="owned")continue;let a;try{a=Ot(i.document)}catch(u){r.push({message:u instanceof Error?u.message:"Screen cannot be delivered",reason:"screen",path:["screens",s,"document"]});continue}for(let[u,c]of t.inputs.entries())c.screenId===i.id&&!Se(a,c.componentId)&&r.push({message:`Local Funnel input ${c.variable} targets hidden component ${c.componentId} on screen ${c.screenId}`,reason:"inputBinding",path:["inputs",u]})}for(let[s,i]of t.graph.nodes.entries()){let a=["graph","nodes",s],u=i.type==="screen"?t.screens.find(c=>c.id===i.screenId):void 0;u?.type==="owned"&&(u.document.actions.some(c=>typeof c.properties.templateKey=="string"&&c.properties.templateKey.startsWith("popup-coupon-"))&&r.push({message:"Funnel screens claim Coupons through a Claim Coupon step",reason:"coupon",path:a}),Dn(u.document,c=>n.has(c))&&r.push({message:"Offer copy shows the Coupon of a Claim Coupon step",reason:"coupon",path:a})),(i.type==="output"&&i.value.type==="literal"&&ye(i.value.value)||i.type==="end"&&i.output?.type==="literal"&&ye(i.output.value))&&r.push({message:"Checkout outputs require a Product Version",reason:"product",path:a})}return r}function Pt(t,r){for(let{message:n,reason:s,path:i}of zn(t))r.addIssue({code:"custom",message:n,path:i,params:{reason:s}})}function Ft(t,r){let n=(y,o,p=[])=>r.addIssue({code:"custom",message:y,path:p,params:{reason:o}}),s=Object.values(t.references),i=new Map(t.screens.map(y=>[y.id,y])),a=(y,o)=>s.some(p=>p.type===y&&("id"in p?p.id:p.key)===o);i.size!==t.screens.length&&n("Screen identifiers must be unique","uniqueScreens");let u=t.graph.nodes.filter(y=>y.type==="screen");(u.length!==i.size||u.some(y=>!i.has(y.screenId)))&&n("Every screen belongs to exactly one presentation node","screenOwner");let c=new Map,f=Object.keys(t.variables);f.some(y=>f.some(o=>y!==o&&o.startsWith(y+".")))&&n("Variable paths must not overlap","variable");function g(y,o){Object.hasOwn(t.variables,y)||n("Every produced variable needs a declaration","variable",["graph","nodes",t.graph.nodes.indexOf(o)]);let p=c.get(y)??new Set;p.add(o.id),c.set(y,p)}for(let[y,o]of t.graph.nodes.entries()){let p=["graph","nodes",y],O=o.type==="feature"?o.featureKey:o.type==="offering"&&o.configuration.source==="feature"?o.configuration.featureKey:o.type==="output"&&o.value.type==="feature"?o.value.featureKey:o.type==="end"&&o.output?.type==="feature"?o.output.featureKey:null;O&&!a("flag",O)&&n("Flag selectors require an explicit GB resource reference","feature",p);let j=o.type==="feature"||o.type==="offering"||o.type==="coupon"||o.type==="coupons"||o.type==="action"&&o.action.type==="api"?["value"]:o.type==="action"&&o.action.type==="external_task"?Object.keys(o.action.outputs):o.type==="wait"&&o.wait.type==="event"?Object.keys(o.wait.outputs):[],k="writes"in o?o.writes??{}:{};(j.length!==Object.keys(k).length||j.some(d=>!Object.hasOwn(k,d))||new Set(Object.values(k)).size!==Object.values(k).length)&&n("Node writes must map every named output exactly once","variable",p);for(let[d,x]of Object.entries(k)){g(x,o);let h=t.variables[x],m=o.type==="offering"?"offering_version":o.type==="coupon"?"reward":o.type==="action"&&o.action.type==="api"?"json":o.type==="action"&&o.action.type==="external_task"?o.action.outputs[d]:o.type==="wait"&&o.wait.type==="event"?o.wait.outputs[d]:void 0;(h?.source.type!=="node"||m&&h.type!==m)&&n("Node writer source or output type does not match declaration","variable",p)}if(o.type==="coupons"){let d=t.variables[o.writes.value];(d?.type!=="array"||d.items?.type!=="reward"||d.items.nullable||d.nullable)&&n("Coupons output requires a non-null Reward array","variable",p);for(let x of o.couponIds)a("reward",x)||n("Coupons require Reward references","coupon",p)}if(o.type==="split"&&!a("experiment",o.experimentId)&&n("Experiment selectors require a GB resource reference","experiment",p),o.type==="coupon"&&!a("reward",o.couponId)&&n("Coupon selectors require a Reward reference","coupon",p),o.type==="action"&&o.action.type==="claim_offer"&&o.action.coupon.source==="literal"){let d=o.action.coupon.value;(!d||typeof d!="object"||Array.isArray(d)||d.type!=="reward"||typeof d.id!="string"||Object.keys(d).length!==2||!a("reward",d.id))&&n("Coupon claims require a Reward reference","coupon",p)}if(o.type==="offering"&&o.configuration.source==="fixed"&&!a("offering_version",o.configuration.versionId)&&n("Offering selectors require an explicit Version reference","offering",p),o.type==="screen"&&o.offering?.source==="variable"&&t.variables[o.offering.key]?.type!=="offering_version"&&n("Screen Offering variable must be an Offering reference","offering",p),o.type==="action"&&o.action.type==="claim_offer"&&o.action.coupon.source==="variable"&&(t.variables[o.action.coupon.key]?.type!=="reward"||o.action.coupon.path)&&n("Coupon variable must be a complete Reward reference","coupon",p),o.type==="screen"){let d=i.get(o.screenId);if(o.offering?.source==="fixed"&&!a("offering_version",o.offering.versionId)&&n("Screen Offering requires an explicit Version reference","offering",p),d?.type==="paywall"&&o.offering&&n("Paywall owns its fixed Offering Version","offering",p),d?.type==="paywall"&&!a("paywall_version",d.paywallVersionId)&&n("Paywall screens require an explicit Version reference","paywall",p),d?.type==="owned"){let x=d.document.pages[0];if(!x){n("Owned screen requires a page","screen",p);continue}et(d.document).some(m=>!m.complete)&&n("Owned screens require complete local content","translations",p);let h=new Set(d.document.actions.map(m=>m.id));(h.size!==Object.keys(o.outputs).length||Object.keys(o.outputs).some(m=>!h.has(m)))&&n("Every screen action requires exactly one outcome route","buttonOutputs",p),Z(x.root,m=>{!o.offering&&(m.type==="plan_picker"||(m.type==="stack"||m.type==="button")&&m.bind?.plan||m.type==="customer_data"&&["customer_plans","credit_packs"].includes(m.data.source))&&n("Product presentation requires an Offering Version","offering",p),m.type==="customer_data"&&Object.values(m.data.outputs??{}).some(V=>V!==void 0&&!h.has(V))&&n("Customer components require declared screen outcomes","componentOutput",p)})}}o.type==="end"&&["completed","ineligible"].includes(o.outcome)&&!o.output&&n("Completed and ineligible ends require a declared output","output",p),o.type==="end"&&o.output?.type==="literal"&&!P(t.outputSchema,o.output.value)&&n("Terminal output does not match outputSchema","output",p),o.type==="output"&&o.value.type==="literal"&&!P(t.outputSchema,o.value.value)&&n("Terminal output does not match outputSchema","output",p);let z=o.type==="output"?o.value:o.type==="end"?o.output:void 0;if(z?.type==="variable"&&!z.path){let d=t.variables[z.key];d&&!Oe(d,t.outputSchema)&&n("Variable output does not match outputSchema","output",p)}if(o.type==="screen"){let d=i.get(o.screenId);if(d?.type==="owned")for(let x of ke(d.document))(/^(input|params)\./.test(x)||x.startsWith("variables.")&&!je(x.slice(10),f))&&n("Screen values must reference registered variables","variable",p)}if(o.type==="condition")for(let d of o.cases){for(let x of W(d.condition))a("saved_group",x)||n("Conditions require explicit Saved Group references","savedGroup",p);for(let x of F(d.condition))x.startsWith("variables.")||n("Funnel conditions read registered variables only","variable",p)}if(o.type==="output"&&o.value.type==="bundle"){t.outputSchema.type!=="json"&&n("Bundle output requires a JSON outputSchema","output",p);for(let[d,x]of[["paywall","paywall_version"],["offering","offering_version"],["coupons","reward"]]){let h=o.value[d];if(h)if(h.source==="literal"){let m=d==="coupons"?h.value:[h.value];(!Array.isArray(m)||m.length>20||m.some(V=>!P({type:x,nullable:!1},V)||!a(x,V.id))||d==="coupons"&&new Set(m.map(V=>V.id)).size!==m.length)&&n("Bundle requires distinct scoped resource references",d==="coupons"?"coupon":d==="paywall"?"paywall":"offering",[...p,"value",d])}else{let m=t.variables[h.key];(h.path||!m||m.nullable||(d==="coupons"?m.type!=="array"||m.items?.type!=="reward"||m.items.nullable:m.type!==x))&&n("Bundle binding type does not match its slot","output",p)}}}}for(let[y,o]of t.graph.nodes.entries()){let p=o.type==="screen"?i.get(o.screenId):void 0,O=[...Nt(o,f),...p?.type==="owned"?ot(p.document).map(j=>je(j,f)?.key??j):[]];for(let j of new Set(O)){let x=function(h){if(h===o.id)return!0;if(d.has(h))return!1;d.add(h);let m=t.graph.nodes.find(Mt=>Mt.id===h);return m?(z.has(h)?m.type==="action"?[m.cancel,m.unavailable,m.failure]:m.type==="wait"&&m.wait.type==="event"?[m.wait.timeout]:[]:de(m)).some(x):!1};var K=x;if(!Object.hasOwn(t.variables,j)){n("Consumed variable is undeclared","variable",["graph","nodes",y]);continue}let k=t.variables[j];if(o.type==="screen"&&k.source.type==="input"&&t.inputs.some(h=>h.screenId===o.screenId&&h.variable===j)||k.source.type==="parameter"||k.source.type==="attribute")continue;let z=k.source.type==="input"?new Set(t.inputs.filter(h=>h.variable===j&&h.required).flatMap(h=>u.filter(m=>m.screenId===h.screenId).map(m=>m.id))):c.get(j)??new Set,d=new Set;(!z.size||x(t.graph.entry))&&n("Every path must produce the consumed variable","resultReference",["graph","nodes",y])}}(new Set(t.inputs.map(y=>y.variable)).size!==t.inputs.length||new Set(t.inputs.map(y=>`${y.screenId}:${y.componentId}`)).size!==t.inputs.length)&&n("Input keys and component bindings must be unique","inputKeys");for(let[y,o]of t.inputs.entries()){t.variables[o.variable]?.source.type!=="input"&&n("Input binding requires a registered input variable","inputBinding",["inputs",y]);let p=i.get(o.screenId),O=p?.type==="owned"?Se(p.document,o.componentId):null;if((O?.type!=="stack"||!O.interaction||!["input","toggle","select","multiselect","tabs"].includes(O.interaction.type))&&n("Input requires an interactive control on its owned screen","inputBinding",["inputs",y]),O?.type==="stack"&&O.interaction){let j=O.interaction.type==="toggle"?"boolean":O.interaction.type==="multiselect"?"strings":"string";t.variables[o.variable]?.type!==j&&n("Input variable type does not match component","inputBinding",["inputs",y]);let k=t.variables[o.variable]?.enum;k&&!O.children.filter(z=>!z.hidden).every(z=>k.includes(z.id))&&n("Input choices must match the variable enum","inputBinding",["inputs",y])}}for(let[y,o]of Object.entries(t.variables))o.enum&&o.type!=="string"&&n("Only string variables support enum","variable",["variables",y]),o.source.type==="input"&&!t.inputs.some(p=>p.variable===y)&&n("Input variable requires a component binding","inputBinding",["variables",y]);let l=0,w=0;for(let y of t.screens)if(y.type==="owned"){for(let o of y.document.pages)Z(o.root,()=>{l++});w+=y.document.actions.length}(l>D.components||w>D.actions||M(t)>D.documentBytes)&&n("Funnel document exceeds its budget","budget")}var En=e.strictObject({...qe,graph:Te}).superRefine(Ft),Kn=e.strictObject({...qe,graph:Te,displayName:e.string().trim().min(1).max(80)}).superRefine(Ft),es=Kn.superRefine(Pt),ts=En.superRefine(Pt),fe=e.string().regex(Le),L={requestId:e.uuid(),nodeId:_,visit:e.number().int().nonnegative(),revision:e.number().int().nonnegative(),customerToken:fe.optional()},Vn=e.discriminatedUnion("type",[e.strictObject({type:e.literal("screen"),output:_,answers:X,selection:e.record(_,e.union([e.string().max(200),e.boolean(),e.number().int().min(0).max(1e4)])).optional()}),e.strictObject({type:e.literal("paywall_quote"),featureQuantities:e.record(e.uuid(),e.number().int().min(0).max(1e4)).refine(t=>Object.keys(t).length<=100).optional(),actionId:_,productVersionId:e.uuid(),offerId:e.uuid().optional(),nativeOffer:Ke.optional(),predecessor:e.strictObject({operationId:e.uuid().nullable(),generation:e.number().int().positive()}).optional()}),e.strictObject({type:e.literal("paywall_confirm"),operationId:e.uuid()}),e.strictObject({type:e.literal("paywall_cancel"),operationId:e.uuid()}),e.strictObject({type:e.literal("client_action"),receiptId:e.uuid(),outcome:e.enum(["success","cancel","failure","opened","failed"])})]),Nn=e.object({nodeId:_,visit:e.number().int().nonnegative(),revision:e.number().int().nonnegative(),components:e.record(_,e.object({resourceKey:e.string().regex(/^[a-z][a-z0-9_]{0,63}$/).optional(),page:e.number().int().min(1).max(1e5),after:tt.nullable(),filter:e.enum(["all","purchase","refund","source","usage","debt","settlement","issued","reserved","redeemed","expired","revoked"])}).strict()).refine(t=>Object.keys(t).length<=150)}).strict(),ns=e.discriminatedUnion("operation",[e.strictObject({operation:e.literal("start"),funnelId:e.uuid(),requestId:e.uuid(),customer:ae.optional(),customerData:ce.optional(),locale:e.string().min(1).max(35),parameters:B}).refine(ue,le),e.strictObject({operation:e.literal("get"),settlementRequestId:e.uuid().optional(),data:Nn.optional(),purchase:e.strictObject({receiptId:e.uuid(),operationId:e.uuid()}).optional(),customerToken:fe.optional()}),e.strictObject({operation:e.literal("resume"),requestId:e.uuid(),customerToken:fe.optional()}),e.strictObject({operation:e.literal("submit"),...L,input:Vn}),e.strictObject({operation:e.literal("back"),...L}),e.strictObject({operation:e.literal("shown"),...L}),e.strictObject({operation:e.literal("close"),...L}),e.strictObject({operation:e.literal("commit_segment"),...L,policyRevision:e.number().int().nonnegative(),generation:e.string().min(1).max(256)}),e.strictObject({operation:e.literal("review"),receiptId:e.uuid().optional(),customerToken:fe.optional()})]);export{I as a,Y as b,ee as c,P as d,$n as e,Gn as f,Bt as g,ot as h,M as i,Ke as j,ar as k,Tt as l,Ut as m,Mn as n,at as o,ct as p,Ht as q,lt as r,Sr as s,Zt as t,Ar as u,pn as v,ji as w,zi as x,bn as y,Xt as z,Yt as A,$r as B,Gr as C,qr as D,cn as E,nn as F,rn as G,Zr as H,ae as I,ce as J,ue as K,le as L,bt as M,Wr as N,an as O,Qr as P,Xr as Q,Yr as R,Ee as S,ln as T,mi as U,fi as V,yi as W,kn as X,An as Y,Ro as Z,Do as _,Kn as $,ns as aa};
|
package/dist/chunk-LJBTEB2Q.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as P}from"./chunk-O2D3A4CS.js";import{c as V}from"./chunk-ZORZA4WG.js";import{b as j}from"./chunk-GGYBZWWY.js";import{v as L}from"./chunk-MTIOLSVM.js";import{b as x}from"./chunk-ONMIBSOC.js";import{a as K}from"./chunk-3NCMYTNG.js";import{b as U}from"./chunk-CE5MAAIR.js";import{d as H,e as W,f as B,g as F}from"./chunk-VYI6QRJW.js";import{b as J}from"./chunk-HFD4CLCJ.js";import{a as M}from"./chunk-IGANLTKS.js";import{ea as G}from"./chunk-BIT6YWM7.js";import{a as l}from"./chunk-TPXRO63H.js";import{a as $}from"./chunk-DSPLGTQI.js";function X(w){let r=[...new Set(w.map(({path:a})=>{let m=a.map(String).join(".");return m.startsWith("selector")?"paywallId or paywallVersionId":m||"input"}))],O=r.includes("locale")?` Pass locale, the Customer's language such as "en" or "zh-CN".`:"";return new l("INVALID_REQUEST",`createPaywallSession input is invalid: ${r.join(", ")}.${O}`)}async function de(w,r){if(!M.test(r.customerToken))throw new l("INVALID_TOKEN","A verified Customer credential is required");if(w.session&&w.session.peek()!==r.customerToken)throw new l("SCOPE_MISMATCH","Paywall credential does not match the shared session");let O=P.resolvePaywall.request.safeParse({funnelId:r.funnelId,funnelVersionId:r.funnelVersionId,selector:r.paywallVersionId?{type:"version",versionId:r.paywallVersionId}:{type:"paywall",paywallId:r.paywallId},commerce:r.commerce,locale:r.locale,...r.requirement?{requirement:r.requirement}:{}});if(!O.success)throw X(O.error.issues);let a=O.data,m=J(w);w.session||m.identify(r.customerToken);let t=null,g=!1,_=new AbortController,c=null,u=null,v=null,h=null,R=null,d=null,f=null,N=0,C=null,k="",E=0,b=new Map,q=new Set;function S(){if(g)throw new l("IDENTITY_CHANGED","Paywall is closed")}function Q(){let e=JSON.stringify([N,f!==null]);if(!C||e!==k){k=e;let n=z(++E);C=n;let i=()=>{C===n&&(C=null)};n.then(i,i)}return C.then(n=>structuredClone(n))}async function z(e){S();let n=P.resolvePaywall,i=await V(m.request,n,{...a,selector:t?{type:"version",versionId:t.id}:a.selector});j(a,i.paywall.check,i.scope);let s=await x(w,i.paywall);if(S(),r.paywallVersionId?s.id!==r.paywallVersionId:s.paywallId!==r.paywallId)throw new l("INVALID_RESPONSE","The requested Paywall changed");if(t&&(!H(s,t)||s.paywallId!==t.paywallId))throw new l("INVALID_RESPONSE","The pinned Paywall or Offering Version changed");if(e!==E)return structuredClone(t??s);t=s;for(let I of q)$(I,structuredClone(t));return structuredClone(t)}async function T(e){if(S(),h&&e!=="read")throw new l("COMMAND_PENDING","Wait for the original quote");if(!c)throw new l("INVALID_REQUEST","A quoted purchase is required");let n=c;if(e!=="read"){if(f){if(d===e)return f;throw new l("COMMAND_PENDING","Wait for the original purchase command")}if(d&&d!==e)throw new l("COMMAND_PENDING","Read the original purchase before changing an uncertain command");d=e,N++,E++}let i=d,s=N,I=e==="read"&&f===null,p=JSON.stringify([n.operationId,s,f!==null]);if(e==="read"&&b.has(p))return b.get(p).then(o=>structuredClone(o));let A=e==="read"?P.readSubscriptionOperation:P.attach,y=(async()=>{let o=await V(m.request,A,{operationId:n.operationId,...e==="read"?{}:{intent:e},...e==="confirm"&&n.merchantTerms?{merchantConfirmation:L(n.merchantTerms)}:{}});return W(o.operation,{operationId:n.operationId,currency:a.commerce.currency},"The purchase operation changed"),S(),c?.operationId!==n.operationId?structuredClone(o.operation):(u=F(u,o.operation),(e!=="read"||I&&f===null)&&N===s&&d===i&&(d=null),structuredClone(u))})();if(e!=="read"){f=y;let o=()=>{f===y&&(f=null)};y.then(o,o)}else{b.set(p,y);let o=()=>{b.get(p)===y&&b.delete(p)};y.then(o,o)}return y.then(o=>structuredClone(o))}let D={signal:_.signal,get view(){return t?structuredClone(t):null},get quote(){return c?structuredClone(c):null},get operation(){return u?structuredClone(u):null},get webViewUrl(){return"bundled"},get locale(){return a.locale},get recovery(){return K({quote:c,operation:u,requestId:R,pending:h!==null||d!==null,destroyed:g})},get pendingCancellation(){return!g&&d==="cancel"},refresh:Q,subscribe(e){return g?()=>{}:(q.add(e),()=>q.delete(e))},async preview(e){if(S(),!t)throw new l("INVALID_REQUEST","Load the Paywall first");let n=t.document.buttons[e.actionId];if(n?.type!=="checkout")throw new l("INVALID_REQUEST","Choose an authored purchase action");let i=U(n.product,e.selection,t.capabilities);if(!i)throw new l("PRODUCT_UNAVAILABLE","Choose an available Product");let s=G(t.document.screen,i,e.selection,t.capabilities),I=P.previewAttach.request.parse({funnelId:a.funnelId,funnelVersionId:a.funnelVersionId,requestId:e.requestId,plans:[{productVersionId:i,...Object.keys(s).length?{featureQuantities:s}:{}}],provider:a.commerce.provider,currency:a.commerce.currency,...e.offerId?{offerId:e.offerId}:{},...e.nativeOffer?{nativeOffer:e.nativeOffer}:{}}),p=JSON.stringify(I);if(v&&v!==p&&(h||d||!u||u.status==="pending"))throw new l("COMMAND_PENDING","Finish or cancel the original purchase before changing it");if(v===p){if(h)return h;if(c)return structuredClone(c)}v!==p&&(c=null,u=null),v=p,R=I.requestId;let A=(async()=>{let y=P.previewAttach,o=await V(m.request,y,I);return S(),B(o.quote,{productVersionId:i,featureQuantities:s,currency:a.commerce.currency,provider:a.commerce.provider},"The purchase quote changed its selected Product or presentment"),c=o.quote,u=null,structuredClone(c)})();h=A;try{return await A}finally{h===A&&(h=null)}},confirm:()=>T("confirm"),cancel:()=>T("cancel"),read:()=>T("read"),destroy(){g||(g=!0,_.abort(),q.clear(),b.clear(),Y?.(),m.dispose(),t=null,c=null,u=null,v=null,R=null)}},Y=w.session?.subscribeIdentity(D.destroy);try{return await Q(),D}catch(e){throw D.destroy(),e}}export{de as a};
|
package/dist/chunk-MTIOLSVM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as G}from"./chunk-73ISTR7P.js";import{b as Z}from"./chunk-IGANLTKS.js";import{a as j,b as Q,c as x}from"./chunk-3JD3U45R.js";import{d as l}from"./chunk-YURGISSB.js";import{a as L,b as F,c as H}from"./chunk-3S25TLC3.js";import{b as e}from"./chunk-NOOIJXRN.js";var fe=["purchase.subscription","purchase.one_time","purchase.prepaid","purchase.trial","purchase.seats","purchase.tiered","tax.automatic","discount.percent.once","discount.percent.repeating","discount.percent.forever","discount.amount.once","discount.amount.repeating","discount.amount.forever","subscription.cancel.immediate","subscription.cancel.renewal","subscription.resume","subscription.plan.immediate","subscription.plan.renewal","subscription.seats","subscription.quantity","subscription.billing_cycle","subscription.proration","refund.full","refund.partial","refund.revoke"],K=e.enum(fe),W=e.enum(["purchase.completed","purchase.closed","subscription.observed","subscription.change.completed","subscription.change.closed","invoice.paid","refund.updated"]);var o=e.string().min(1).max(200),c=e.iso.datetime({offset:!0}),i=e.number().int().nonnegative().max(1e8),y=e.string().regex(/^[A-Z]{3}$/),m=e.strictObject({priceId:e.uuid(),productVersionId:e.uuid(),productId:o,quantity:e.number().int().min(1).max(1e6),unitAmountMinor:i,totalMinor:i,interval:e.enum(["week","month","year","one_off"]),intervalCount:e.number().int().min(1).max(52),kind:e.enum(["fixed","prepaid","seat"]),tiers:e.strictObject({mode:e.enum(["graduated","volume"]),tiers:e.array(e.strictObject({upTo:e.number().int().positive().nullable(),unitAmountMinor:i,flatAmountMinor:i.optional()})).min(2).max(12)}).nullable()}),I=e.strictObject({grantId:e.uuid(),couponId:e.uuid(),amountMinor:i,applicationPolicy:G.optional(),applicableProductIds:e.array(o).min(1).max(100).optional(),terms:e.discriminatedUnion("type",[e.strictObject({type:e.literal("percent"),percentOff:e.number().gt(0).max(100)}),e.strictObject({type:e.literal("amount"),amountOffMinor:i,currency:y})]),duration:e.discriminatedUnion("type",[e.strictObject({type:e.literal("once")}),e.strictObject({type:e.literal("forever")}),e.strictObject({type:e.literal("repeating"),months:e.number().int().min(1).max(36)})])}),E={provider:e.literal("merchant"),executor:e.literal("merchant"),operationId:e.uuid(),customerId:e.uuid(),configurationRevision:e.number().int().nonnegative(),connectionRevision:e.number().int().nonnegative(),currency:y,expiresAt:c},ge=e.strictObject({...E,type:e.literal("purchase"),mode:e.enum(["payment","subscription"]),lineItems:e.array(m).min(1).max(100),catalogAmountMinor:i,nativeDiscountMinor:i.optional(),discount:I.nullable(),trialPeriodDays:e.number().int().min(1).max(730).nullable(),automaticTax:e.boolean()}).refine(t=>t.lineItems.reduce((n,r)=>n+r.totalMinor,0)===t.catalogAmountMinor&&(t.discount?.amountMinor??0)+(t.nativeDiscountMinor??0)<=t.catalogAmountMinor&&new Set(t.lineItems.map(n=>n.priceId)).size===t.lineItems.length,"Purchase lines must retain the original total and unique Price identities"),S=e.strictObject({...E,type:e.literal("subscription_change"),subscriptionId:e.uuid(),merchantSubscriptionId:o,membershipId:e.uuid(),subscriptionAction:e.enum(["update","cancel","schedule","release"]),supersedesOperationId:e.uuid().nullable(),change:e.discriminatedUnion("type",[e.strictObject({type:e.literal("cancel")}),e.strictObject({type:e.literal("uncancel")}),e.strictObject({type:e.literal("plan"),productVersionId:e.uuid()}),e.strictObject({type:e.literal("seats"),licenseKey:o,quantity:e.number().int().nonnegative().max(1e6)}),e.strictObject({type:e.literal("quantity"),internal_feature_id:e.uuid(),quantity:e.number().int().nonnegative().max(1e6)}),e.strictObject({type:e.literal("billing_cycle"),billingCycleAnchor:e.union([e.literal("now"),e.number().int().positive()])})]),timing:e.enum(["immediate","renewal"]),effectiveAt:c,creditMinor:i,debitMinor:i,totalMinor:i,discountMinor:i,discount:I.nullable().optional(),taxMinor:i,proration:e.enum(["none","create_prorations","always_invoice"]),lineItems:e.array(m.extend({quantity:e.number().int().nonnegative().max(1e6)})).max(100),removePriceIds:e.array(e.uuid()).max(100),sourceLineItems:e.array(m).min(1).max(100).optional()}),xe=e.strictObject({...E,type:e.literal("refund"),invoiceId:e.uuid(),merchantInvoiceId:o,amountMinor:i.refine(t=>t>0),mode:e.enum(["full","partial"]),entitlementAction:e.enum(["retain","revoke"]),cancelSubscriptions:e.array(o).max(100)}),Y=e.discriminatedUnion("type",[ge,S,xe]);function We(t){let n=new Set;if(t.type==="purchase")n.add(t.mode==="subscription"?"purchase.subscription":"purchase.one_time"),t.lineItems.some(r=>r.kind==="prepaid")&&n.add("purchase.prepaid"),t.lineItems.some(r=>r.kind==="seat")&&n.add("purchase.seats"),t.lineItems.some(r=>r.tiers!==null)&&n.add("purchase.tiered"),t.trialPeriodDays!==null&&n.add("purchase.trial"),t.automaticTax&&n.add("tax.automatic"),t.discount&&n.add(`discount.${t.discount.terms.type}.${t.discount.duration.type}`);else if(t.type==="refund")n.add(`refund.${t.mode}`),t.entitlementAction==="revoke"&&n.add("refund.revoke");else{let r=t.change.type;r==="cancel"?n.add(`subscription.cancel.${t.timing}`):r==="uncancel"?n.add("subscription.resume"):r==="plan"?n.add(`subscription.plan.${t.timing}`):n.add(`subscription.${r}`),t.proration!=="none"&&n.add("subscription.proration"),t.discount&&n.add(`discount.${t.discount.terms.type}.${t.discount.duration.type}`)}return[...n].sort()}function Xe(t){return t.type==="purchase"?t.mode==="subscription"?["purchase.completed","purchase.closed","subscription.observed","invoice.paid"]:["purchase.completed","purchase.closed"]:t.type==="subscription_change"?["subscription.change.completed","subscription.change.closed","subscription.observed",...t.change.type==="cancel"||t.change.type==="uncancel"?[]:["invoice.paid"]]:["refund.updated",...t.entitlementAction==="revoke"&&t.cancelSubscriptions.length?["subscription.observed"]:[]]}var ye=e.strictObject({phase:e.enum(["execution","payment","fulfillment","recording"]),code:L,reason:H.optional(),recovery:F,retryable:e.boolean()}).refine(t=>t.reason!=="RESULT_UNKNOWN"||!t.retryable&&t.recovery==="recover_operation","Unknown financial effects require recovery of the original operation"),Ie=e.strictObject({type:e.literal("redirect"),url:e.url().startsWith("https://"),expiresAt:c}),B={operationId:e.uuid(),customerId:e.uuid(),merchantExecutionId:o,fulfillmentStatus:e.enum(["not_started","pending","applied","failed","not_applicable"]),recordingStatus:e.enum(["not_ready","pending","accepted","failed"]),updatedAt:c,problem:ye.nullable(),pollAfterMs:e.number().int().min(1e3).max(6e4).nullable()},T=e.discriminatedUnion("type",[e.strictObject({...B,type:e.literal("purchase"),merchantOrderId:o.nullable(),paymentStatus:e.enum(["not_started","pending","succeeded","not_required","failed","expired","unknown"]),checkoutUrl:e.url().refine(t=>new URL(t).protocol==="https:").nullable(),checkoutExpiresAt:c.nullable()}).refine(t=>!t.checkoutUrl||["not_started","pending"].includes(t.paymentStatus)&&t.checkoutExpiresAt!==null,"Only an unfinished original purchase may expose its checkout"),e.strictObject({...B,type:e.literal("subscription_change"),status:e.enum(["pending","scheduled","applied","failed","unknown"]),merchantSubscriptionId:o,scheduledFor:c.nullable(),nextAction:Ie.optional()}).refine(t=>t.status==="scheduled"==(t.scheduledFor!==null),"A scheduled change retains its future effective time"),e.strictObject({...B,type:e.literal("refund"),status:e.enum(["pending","succeeded","failed","unknown"]),merchantRefundId:o.nullable()}).refine(t=>t.status!=="succeeded"||t.merchantRefundId!==null,"A successful refund retains its original merchant identity")]),ee=e.discriminatedUnion("lookup",[e.strictObject({lookup:e.literal("found"),operationId:e.uuid(),customerId:e.uuid(),execution:T,readAt:c}),e.strictObject({lookup:e.literal("not_received"),operationId:e.uuid(),customerId:e.uuid(),execution:e.null(),readAt:c})]).refine(t=>!t.execution||t.execution.operationId===t.operationId&&t.execution.customerId===t.customerId,"Lookup must retain the original Customer and operation"),te=e.strictObject({merchantPriceId:o,productId:o,kind:e.enum(["fixed","prepaid"]),currency:y,unitAmountMinor:i,interval:e.enum(["one_off","day","week","month","year"]),intervalCount:e.number().int().min(1).max(100)}),X={merchantItemId:o,quantity:e.number().int().positive().max(1e6)},Se=t=>t.priceId??JSON.stringify(t.nativePrice),k=e.strictObject({merchantSubscriptionId:o,revision:e.number().int().positive(),status:e.enum(["incomplete","trialing","active","past_due","canceled","unpaid","paused","incomplete_expired"]),periodStartsAt:c,periodEndsAt:c,cancelAtPeriodEnd:e.boolean(),hasDiscounts:e.boolean(),items:e.array(e.union([e.strictObject({...X,priceId:e.uuid()}),e.strictObject({...X,nativePrice:te})])).min(1).max(100)}).refine(t=>Date.parse(t.periodEndsAt)>Date.parse(t.periodStartsAt)&&new Set(t.items.map(Se)).size===t.items.length&&new Set(t.items.map(n=>n.merchantItemId)).size===t.items.length,"Subscription periods and Price identities must be unambiguous"),J={merchantLineId:o,quantity:e.number().int().nonnegative().max(1e6),subtotalMinor:e.number().int().min(-1e8).max(1e8),discountMinor:i,taxMinor:i,totalMinor:e.number().int().min(-1e8).max(2e8),periodStartsAt:c.nullable(),periodEndsAt:c.nullable()},R=e.strictObject({merchantInvoiceId:o,reason:e.enum(["renewal","adjustment"]).optional(),currency:y,subtotalMinor:i,discountMinor:i,taxMinor:i,totalMinor:i,paidMinor:i,periodStartsAt:c.nullable(),periodEndsAt:c.nullable(),lines:e.array(e.union([e.strictObject({...J,priceId:e.uuid()}),e.strictObject({...J,nativePrice:te})]).refine(t=>t.subtotalMinor-t.discountMinor+t.taxMinor===t.totalMinor&&(t.subtotalMinor<0?t.discountMinor===0&&t.taxMinor===0:t.discountMinor<=t.subtotalMinor),"Invoice line amounts must retain the complete debit or credit")).min(1).max(100)}).refine(t=>t.subtotalMinor-t.discountMinor+t.taxMinor===t.totalMinor&&t.discountMinor<=t.subtotalMinor&&t.paidMinor===t.totalMinor&&new Set(t.lines.map(n=>n.merchantLineId)).size===t.lines.length&&t.lines.reduce((n,r)=>n+r.subtotalMinor,0)===t.subtotalMinor&&t.lines.reduce((n,r)=>n+r.discountMinor,0)===t.discountMinor&&t.lines.reduce((n,r)=>n+r.taxMinor,0)===t.taxMinor&&t.lines.reduce((n,r)=>n+r.totalMinor,0)===t.totalMinor,"A paid Invoice retains the complete financial amounts"),p={eventId:e.string().regex(/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,199}$/),customerId:e.uuid(),occurredAt:c},Me=e.strictObject({...p,type:e.literal("purchase.completed"),operationId:e.uuid(),merchantOrderId:o,paymentStatus:e.enum(["paid","trialing","no_payment_required"]),invoice:R.refine(t=>t.lines.every(n=>"priceId"in n),"An operation result retains its quoted Price identities").nullable(),subscription:k.refine(t=>t.items.every(n=>"priceId"in n),"An operation result retains its quoted Price identities").nullable()}),_e=e.strictObject({...p,type:e.literal("purchase.closed"),operationId:e.uuid(),status:e.enum(["failed","expired","canceled"])}),Oe=e.strictObject({...p,type:e.literal("subscription.observed"),operationId:e.uuid().nullable(),subscription:k}),ve=e.strictObject({...p,type:e.literal("subscription.change.completed"),operationId:e.uuid(),status:e.enum(["scheduled","applied"]),scheduledFor:c.nullable(),subscription:k.refine(t=>t.items.every(n=>"priceId"in n),"An operation result retains its quoted Price identities"),invoice:R.refine(t=>t.lines.every(n=>"priceId"in n),"An operation result retains its quoted Price identities").nullable()}),Ae=e.strictObject({...p,type:e.literal("subscription.change.closed"),operationId:e.uuid(),merchantSubscriptionId:o,merchantInvoiceId:o.nullable(),status:e.enum(["failed","expired","canceled"])}),je=e.strictObject({...p,type:e.literal("invoice.paid"),merchantSubscriptionId:o.nullable(),invoice:R}),Pe=e.strictObject({...p,type:e.literal("refund.updated"),operationId:e.uuid().nullable(),merchantInvoiceId:o.optional(),merchantRefundId:o,status:e.enum(["pending","succeeded","failed"]),amountMinor:i.refine(t=>t>0),currency:y}),Je=[Me.refine(t=>t.paymentStatus!=="paid"||t.invoice!==null,"A paid purchase includes its Invoice"),_e,Oe.refine(t=>t.operationId===null||t.subscription.items.every(n=>"priceId"in n),"Native Price references cannot replace an operation's quoted Prices"),ve.refine(t=>t.status==="scheduled"==(t.scheduledFor!==null),"Scheduled and applied changes are distinct facts"),Ae,je,Pe.refine(t=>t.operationId!==null||t.merchantInvoiceId!==void 0,"A native refund names its Invoice")];var z=e.strictObject({days:e.number().int().min(1).max(730),cardRequired:e.boolean()}),rt=e.object({...z.shape,featureAllowances:e.record(e.uuid(),e.number().int().min(0).max(1e9)),creditAmounts:e.record(e.uuid(),l)}).strict(),it=e.object({id:e.uuid(),planVersionId:e.uuid(),slot:e.string(),cardRequired:e.boolean(),status:e.enum(["pending","active","converted","canceled","expired","failed"]),startsAt:e.iso.datetime().nullable(),endsAt:e.iso.datetime().nullable(),createdAt:e.iso.datetime()}).strict();var qe=e.number().int().positive().max(2e8),ne=e.number().int().min(0).max(2e8),re=t=>t.mode==="partial"==(t.amountMinor!==void 0),P=e.strictObject({mode:e.enum(["full","partial"]),amountMinor:qe.optional(),entitlementAction:e.enum(["retain","revoke"])});var a=e.string().min(1).max(200),b=e.iso.datetime({offset:!0}),f=ne,ie=f.maxValue,C=e.number().int().min(-ie).max(ie),q=e.string().regex(/^[A-Z]{3}$/),oe=e.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),ae=e.array(a).max(100).refine(t=>new Set(t).size===t.length),Ce=e.strictObject({merchantProductId:a,merchantPriceId:a,productVersionId:e.uuid().optional(),quantity:l.refine(t=>/[1-9]/.test(t))}),w={subject:Q,operationId:e.uuid(),configurationRevision:oe,connectionRevision:oe,expiresAt:b},D=e.discriminatedUnion("action",[e.strictObject({...w,action:e.literal("purchase"),mode:e.enum(["payment","subscription"]),currency:q,items:e.array(Ce).min(1).max(100),offerRefs:ae}),e.strictObject({...w,action:e.literal("subscription_change"),currency:q,merchantSubscriptionId:a,change:S.shape.change,timing:S.shape.timing,proration:S.shape.proration,offerRefs:ae}),e.strictObject({...w,action:e.literal("refund"),currency:q,merchantInvoiceId:a,mode:P.shape.mode,amountMinor:P.shape.amountMinor,entitlementAction:P.shape.entitlementAction}).refine(re,"Only a partial refund chooses amountMinor")]),ht=e.strictObject({request:D,requestedAt:b,preparationAllowed:e.boolean()}).refine(t=>!t.preparationAllowed||Date.parse(t.requestedAt)<Date.parse(t.request.expiresAt),"Preparation authority must be within its original validity"),Be=e.strictObject({merchantLineId:a,merchantPriceId:a.nullable(),quantity:l.refine(t=>/[1-9]/.test(t)),subtotalMinor:C,discountMinor:f,taxMinor:f.nullable(),totalMinor:C.nullable()}).refine(t=>t.taxMinor===null==(t.totalMinor===null)&&(t.totalMinor===null||t.totalMinor===t.subtotalMinor-t.discountMinor+t.taxMinor),"A quote line retains exact known totals; unknown tax is not zero"),Ee=e.strictObject({items:e.array(e.strictObject({merchantPriceId:a,quantity:l.refine(t=>/[1-9]/.test(t)),interval:m.shape.interval.exclude(["one_off"]),intervalCount:m.shape.intervalCount,amountMinor:m.shape.totalMinor,amountAfterOfferMinor:m.shape.totalMinor.optional()})).min(1).max(100),trial:z.nullable(),discount:I.nullable().optional(),discountExpiresAt:b.nullable().optional(),initialAmountMinor:m.shape.totalMinor.optional()}),ce=e.strictObject({request:D,requestDigest:j,merchantQuoteId:a,quoteTermsDigest:j,termsVersion:a,sourceRevisions:e.array(e.strictObject({reference:a,revision:a})).max(100),observedAt:b,expiresAt:b,currency:q,automaticTax:e.boolean(),lines:e.array(Be).max(100),subscriptionTerms:Ee.nullable(),subtotalMinor:C,discountMinor:f,nativeDiscountMinor:f.optional(),discount:I.nullable().optional(),taxMinor:f.nullable(),totalMinor:C.nullable(),effectiveAt:b.nullable(),expectedEffects:e.array(e.strictObject({reference:a,kind:e.enum(["grant","revoke","change"]),description:e.string().min(1).max(1e3),quantity:l.nullable(),unit:a.nullable()}).refine(t=>t.quantity===null==(t.unit===null),"Quantified effects name their native unit")).max(100),requiredConsents:e.array(e.strictObject({reference:a,version:a,summary:e.string().min(1).max(1e3)})).max(20)}),U=ce.superRefine((t,n)=>{let{quoteTermsDigest:r,...u}=t,h=t.lines.every(s=>s.taxMinor!==null),A=t.request.action==="purchase"&&t.request.mode==="subscription"!=(t.subscriptionTerms!==null),be=t.subscriptionTerms!==null&&(t.request.action==="refund"||t.request.action==="subscription_change"&&t.request.change.type==="cancel");(t.requestDigest!==x(t.request)||t.quoteTermsDigest!==x(u)||t.currency!==t.request.currency||A||be||t.lines.length===0&&(t.request.action!=="subscription_change"||t.subtotalMinor!==0||t.discountMinor!==0||t.taxMinor!==0||t.totalMinor!==0)||Date.parse(t.observedAt)>=Date.parse(t.expiresAt)||Date.parse(t.expiresAt)>Date.parse(t.request.expiresAt)||new Set(t.lines.map(s=>s.merchantLineId)).size!==t.lines.length||new Set(t.sourceRevisions.map(s=>s.reference)).size!==t.sourceRevisions.length||new Set(t.requiredConsents.map(s=>s.reference)).size!==t.requiredConsents.length||t.subtotalMinor!==t.lines.reduce((s,g)=>s+g.subtotalMinor,0)||t.discountMinor!==t.lines.reduce((s,g)=>s+g.discountMinor,0)||t.taxMinor!==null!==h||!h&&!t.automaticTax||t.taxMinor===null!=(t.totalMinor===null)||h&&(t.taxMinor!==t.lines.reduce((s,g)=>s+g.taxMinor,0)||t.totalMinor!==t.subtotalMinor-t.discountMinor+t.taxMinor)||t.request.action!=="subscription_change"&&(t.subtotalMinor<0||t.totalMinor!==null&&t.totalMinor<0)||t.request.action==="refund"&&(t.taxMinor===null||t.totalMinor===null||t.totalMinor<=0||t.request.mode==="partial"&&t.totalMinor!==t.request.amountMinor))&&n.addIssue({code:"custom",message:"Merchant terms must retain the original selection, scope, validity, digest and totals"})});function bt(t,n,r,u){return t.request.operationId===n&&t.request.action===r&&t.currency===u}function ft(t){return x(D.parse(t))}function gt(t){return x(ce.omit({quoteTermsDigest:!0}).parse(t))}var Te=e.strictObject({quoteTermsDigest:j,consents:e.array(e.strictObject({reference:a,version:a})).max(20)});function xt(t){return{quoteTermsDigest:t.quoteTermsDigest,consents:t.requiredConsents.map(({reference:n,version:r})=>({reference:n,version:r}))}}var ke=Te.extend({operationId:e.uuid()}).refine(t=>new Set(t.consents.map(n=>n.reference)).size===t.consents.length);function yt(t,n){let r=U.parse(t),u=ke.parse(n);return u.operationId===r.request.operationId&&u.quoteTermsDigest===r.quoteTermsDigest&&u.consents.length===r.requiredConsents.length&&r.requiredConsents.every(h=>u.consents.some(A=>A.reference===h.reference&&A.version===h.version))}var M=3,Ot="/integrations/indiana",vt="X-Indiana-Merchant-Bridge-Version",Re=["session","catalog","customer_commerce","presentation","presentation_events","purchases","operation_status","billing_records","subscription_changes","refunds"],ze=e.enum(Re),At={session:{command:"session.create",authority:"merchant_user"},catalog:{command:"catalog.read",authority:"merchant_catalog_reader"},customer_commerce:{command:"customer.commerce.read",authority:"merchant_user"},presentation:{command:"presentation.resolve",authority:"merchant_user"},presentation_events:{command:"presentation.report",authority:"merchant_user"},purchases:{command:"purchase.execute",authority:"merchant_user"},operation_status:{command:"operation.read",authority:"merchant_user"},billing_records:{command:null,authority:"indiana_server_key"},subscription_changes:{command:"subscription.change",authority:"merchant_user"},refunds:{command:"refund.execute",authority:"merchant_refund_authority"}},$=e.enum(["bridge.ping","bridge.describe","session.create","catalog.read","customer.commerce.read","presentation.resolve","presentation.report","purchase.execute","operation.read","subscription.change","refund.execute"]),ue=e.string().regex(/^[A-Za-z0-9_-]{1,64}$/),we=e.string().regex(/^[A-Za-z0-9_-]{43}$/).refine(t=>"AEIMQUYcgkosw048".includes(t.at(-1)),"Use canonical base64url for a 32-byte key"),De=e.strictObject({keyId:ue,signingSecret:we}),Ue=e.string().max(300).superRefine((t,n)=>{try{let r=new URL(t);if(r.protocol!=="https:"||r.username||r.password||r.search||r.hash||r.pathname!=="/"||r.port&&r.port!=="443"||!/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?\.[a-z]{2,63}$/.test(r.hostname)||/(?:^|\.)(?:localhost|local|internal)$/.test(r.hostname))throw new Error("invalid origin")}catch{n.addIssue({code:"custom",message:"Use an exact public HTTPS origin"})}}).transform(t=>new URL(t).origin),me=e.array(ze).max(10).refine(t=>new Set(t).size===t.length,"Capabilities must be unique"),V=e.strictObject({bridgeVersion:e.literal(M),projectId:e.uuid(),environmentId:e.uuid(),environment:e.enum(["sandbox","live"]),capabilities:me,catalog:e.enum(["endpoint","static","none"]),billingEvents:e.array(W).max(7),profiles:e.array(K).max(32).refine(t=>new Set(t).size===t.length,"Profiles must be unique")}).superRefine((t,n)=>{let r=u=>t.capabilities.includes(u);r("catalog")!==(t.catalog!=="none")&&n.addIssue({code:"custom",path:["catalog"],message:"Catalog declaration differs from its capability"}),(r("billing_records")!==t.billingEvents.length>0||new Set(t.billingEvents).size!==t.billingEvents.length)&&n.addIssue({code:"custom",path:["billingEvents"],message:"Declare the unique supported billing events"})}),de=e.strictObject({origin:Ue,requiredCapabilities:me}),$e=e.strictObject({revision:e.number().int().nonnegative(),checkedAt:e.iso.datetime(),outcome:e.enum(["valid","unreachable","invalid","scope_mismatch","authentication_failed","credentials_missing"]),diagnostics:e.strictObject({ping:e.enum(["passed","failed","not_checked"]),authentication:e.enum(["passed","failed","not_checked"]),catalog:e.enum(["passed","failed","not_checked","static","unsupported"])}),manifest:V.nullable()}).superRefine((t,n)=>{t.outcome==="valid"!=(t.manifest!==null)&&n.addIssue({code:"custom",path:["manifest"],message:"Only a valid declaration carries a manifest"})}),jt=e.strictObject({projectId:e.uuid(),environmentId:e.uuid(),environment:e.enum(["sandbox","live"]),execution:e.enum(["indiana","record_only"]),accountId:e.string().nullable(),revision:e.number().int().nonnegative(),authentication:e.strictObject({keyId:ue}).nullable(),secretStoreConfigured:e.boolean().optional(),connection:de.nullable(),check:$e.nullable()});var se=e.strictObject({projectId:e.uuid(),environmentId:e.uuid()}),Pt=e.discriminatedUnion("action",[se.extend({action:e.literal("save"),revision:e.number().int().nonnegative(),connection:de,authentication:De.optional()}),se.extend({action:e.literal("check"),revision:e.number().int().nonnegative()})]),_=e.strictObject({projectId:e.uuid(),environmentId:e.uuid(),environment:e.enum(["sandbox","live"])});function qt(t){return e.strictObject({bridgeVersion:e.literal(M),requestId:e.uuid(),command:$,scope:_,data:t})}var le=e.strictObject({nativeUserId:e.string().min(1).max(128),session:Z.strict()}),pe=e.strictObject({nativeUserId:e.string().min(1).max(128),presentation:e.strictObject({customerId:e.uuid(),decisionId:e.uuid(),offeringVersionId:e.uuid(),paywallVersionId:e.uuid(),variant:e.string().min(1).max(128)}).nullable()}),he=e.strictObject({decisionId:e.uuid(),eventId:e.uuid()}),O=e.strictObject({operationId:e.uuid(),customerId:e.uuid()}),Ct=e.strictObject({bridgeVersion:e.literal(M),requestId:e.uuid(),command:e.string().min(1).max(64),scope:_,error:e.strictObject({code:e.string().regex(/^MERCHANT_BRIDGE_[A-Z_]+$/),message:e.string().min(1).max(500),retryable:e.boolean(),recovery:e.string().min(1).max(80)})});var zt=e.strictObject({scope:_,operationId:e.uuid(),customerId:e.uuid(),confirmedAt:e.iso.datetime({offset:!0}).nullable(),initialExecutionAllowed:e.boolean(),instruction:Y,merchantTerms:U.optional()}).refine(t=>t.operationId===t.instruction.operationId&&t.customerId===t.instruction.customerId&&(!t.merchantTerms||t.merchantTerms.request.operationId===t.operationId&&t.merchantTerms.request.subject.customerId===t.customerId&&t.merchantTerms.request.action===t.instruction.type&&t.merchantTerms.currency===t.instruction.currency&&Object.entries(t.scope).every(([n,r])=>t.merchantTerms.request.subject.scope[n]===r)),"Authority must refer to the original Customer and operation"),N=T,d=e.string().min(1).max(120),Ve=e.string().regex(/^-?[0-9]+(?:\.[0-9]{1,6})?$/),Ne=e.strictObject({revision:d,updatedAt:e.iso.datetime(),provider:e.literal("merchant"),items:e.array(e.strictObject({merchantProductId:d,productVersionId:e.uuid(),name:e.string().min(1).max(255),kind:e.enum(["subscription","credit_pack"]),merchantPriceId:d,currency:e.string().regex(/^[a-z]{3}$/),amountMinor:e.number().int().nonnegative().max(1e8),interval:e.enum(["one_time","month","year"]),intervalCount:e.literal(1),includedCredits:e.string().regex(/^[0-9]{1,18}(?:\.[0-9]{1,6})?$/),creditReset:e.enum(["none","month"]),creditPolicyId:d,available:e.boolean()}).superRefine((t,n)=>{(t.kind==="credit_pack"&&(t.interval!=="one_time"||t.creditReset!=="none")||t.kind==="subscription"&&t.interval==="one_time"||t.available&&t.amountMinor===0)&&n.addIssue({code:"custom",message:"Unsupported version 1 catalog terms"})})).max(500)}),Le=e.strictObject({customerId:e.uuid(),revision:e.string().min(1).max(128),observedAt:e.iso.datetime(),subscriptions:e.array(e.strictObject({merchantSubscriptionId:d,merchantProductId:d,productVersionId:e.uuid().nullable(),status:e.enum(["active","trialing","past_due","cancelled","expired"]),currentPeriodStartsAt:e.iso.datetime().nullable(),currentPeriodEndsAt:e.iso.datetime().nullable(),cancelAtPeriodEnd:e.boolean(),scheduledChange:e.strictObject({effectiveAt:e.iso.datetime(),merchantProductId:d}).nullable()})).max(100),purchaseHistory:e.strictObject({complete:e.boolean(),hasPaidPurchase:e.boolean(),lastPaidAt:e.iso.datetime().nullable()}),balances:e.array(e.strictObject({bucketId:d,key:d,available:Ve,expiresAt:e.iso.datetime().nullable(),nextResetAt:e.iso.datetime().nullable()})).max(100)}),v=e.strictObject({}),Fe={"bridge.ping":e.strictObject({challenge:e.uuid()}),"bridge.describe":v,"session.create":v,"catalog.read":v,"customer.commerce.read":v,"presentation.resolve":v,"presentation.report":he,"purchase.execute":O,"operation.read":O,"subscription.change":O,"refund.execute":O},wt={"bridge.ping":e.strictObject({challenge:e.uuid()}),"bridge.describe":V,"session.create":le,"catalog.read":Ne,"customer.commerce.read":Le,"presentation.resolve":pe,"presentation.report":e.strictObject({queued:e.literal(!0)}),"purchase.execute":N,"operation.read":ee,"subscription.change":N,"refund.execute":N},Dt=e.strictObject({bridgeVersion:e.literal(M),requestId:e.uuid(),scope:_,command:$,data:e.unknown()}).superRefine((t,n)=>{Fe[t.command].safeParse(t.data).success||n.addIssue({code:"custom",path:["data"],message:"Invalid command data"})});export{ge as a,S as b,xe as c,We as d,Xe as e,ye as f,T as g,ee as h,p as i,Je as j,z as k,qe as l,ne as m,re as n,P as o,ht as p,U as q,bt as r,ft as s,gt as t,Te as u,xt as v,yt as w,M as x,Ot as y,vt as z,Re as A,At as B,De as C,Ue as D,V as E,_ as F,qt as G,le as H,pe as I,he as J,O as K,Ct as L,zt as M,N,Le as O,Fe as P,wt as Q,Dt as R};
|