@tma.js/sdk 3.1.4 → 3.1.5
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/dist/dts/composables/AsyncMountable.d.ts +1 -1
- package/dist/dts/composables/Button.d.ts +1 -1
- package/dist/dts/composables/Mountable.d.ts +1 -1
- package/dist/dts/features/BackButton/BackButton.d.ts +1 -1
- package/dist/dts/features/Biometry/Biometry.d.ts +1 -2
- package/dist/dts/features/ClosingBehavior/ClosingBehavior.d.ts +1 -1
- package/dist/dts/features/CloudStorage/CloudStorage.d.ts +1 -1
- package/dist/dts/features/DeviceStorage/DeviceStorage.d.ts +1 -1
- package/dist/dts/features/HapticFeedback/HapticFeedback.d.ts +1 -1
- package/dist/dts/features/InitData/InitData.d.ts +1 -2
- package/dist/dts/features/Invoice/Invoice.d.ts +1 -1
- package/dist/dts/features/LocationManager/LocationManager.d.ts +1 -2
- package/dist/dts/features/MainButton/MainButton.d.ts +1 -1
- package/dist/dts/features/MiniApp/MiniApp.d.ts +1 -1
- package/dist/dts/features/Popup/Popup.d.ts +2 -2
- package/dist/dts/features/Popup/prepareParams.d.ts +1 -1
- package/dist/dts/features/QrScanner/QrScanner.d.ts +3 -4
- package/dist/dts/features/SecondaryButton/SecondaryButton.d.ts +1 -1
- package/dist/dts/features/SecureStorage/SecureStorage.d.ts +1 -1
- package/dist/dts/features/SettingsButton/SettingsButton.d.ts +1 -1
- package/dist/dts/features/SwipeBehavior/SwipeBehavior.d.ts +1 -1
- package/dist/dts/features/ThemeParams/ThemeParams.d.ts +1 -1
- package/dist/dts/features/Viewport/Viewport.d.ts +1 -2
- package/dist/dts/features/emoji-status/requestEmojiStatusAccess.d.ts +1 -1
- package/dist/dts/features/emoji-status/setEmojiStatus.d.ts +2 -2
- package/dist/dts/features/home-screen/checkHomeScreenStatus.d.ts +1 -1
- package/dist/dts/features/links/openLink.d.ts +1 -1
- package/dist/dts/features/links/openTelegramLink.d.ts +1 -1
- package/dist/dts/features/links/shareURL.d.ts +1 -1
- package/dist/dts/features/privacy/requestContact.d.ts +1 -1
- package/dist/dts/features/privacy/requestPhoneAccess.d.ts +1 -1
- package/dist/dts/features/privacy/requestWriteAccess.d.ts +1 -1
- package/dist/dts/features/uncategorized/downloadFile.d.ts +2 -2
- package/dist/dts/features/uncategorized/getCurrentTime.d.ts +1 -1
- package/dist/dts/features/uncategorized/hideKeyboard.d.ts +1 -1
- package/dist/dts/features/uncategorized/readTextFromClipboard.d.ts +1 -1
- package/dist/dts/features/uncategorized/sendData.d.ts +1 -1
- package/dist/dts/features/uncategorized/shareMessage.d.ts +1 -1
- package/dist/dts/features/uncategorized/shareStory.d.ts +2 -2
- package/dist/dts/features/uncategorized/switchInlineQuery.d.ts +2 -2
- package/dist/dts/globals/invokeCustomMethod.d.ts +1 -1
- package/dist/dts/helpers/isColorDark.d.ts +1 -1
- package/dist/dts/init.d.ts +1 -1
- package/dist/dts/with-checks/throwifyWithChecksFp.d.ts +1 -1
- package/dist/dts/with-checks/withChecksFp.d.ts +1 -3
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +3 -3
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +1703 -2081
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.iife.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var nl=Object.defineProperty;var rl=(p,Z,Ie)=>Z in p?nl(p,Z,{enumerable:!0,configurable:!0,writable:!0,value:Ie}):p[Z]=Ie;var o=(p,Z,Ie)=>rl(p,typeof Z!="symbol"?Z+"":Z,Ie);this.tmajs=this.tmajs||{};this.tmajs.sdk=function(p){"use strict";let Z;function Ie(e,t){Z?Z.set(e,t):t()}function Xe(e){if(Z)return e();Z=new Map;try{e()}finally{Z.forEach(t=>t()),Z=void 0}}function D(e,t){t||(t={});const n=t.equals||Object.is;let r=[],i=e;const s=c=>{if(!n(i,c)){const h=i;i=c,Ie(l,()=>{[...r].forEach(([f,g])=>{f(c,h),g&&u(f,!0)})})}};function a(c){const h=typeof c!="object"?{once:c}:c;return{once:h.once||!1,signal:h.signal||!1}}const u=(c,h)=>{const f=a(h),g=r.findIndex(([v,F])=>v===c&&F.once===f.once&&F.signal===f.signal);g>=0&&r.splice(g,1)},l=Object.assign(function(){return si(l),i},{destroy(){r=[]},set:s,reset(){s(e)},sub(c,h){return r.push([c,a(h)]),()=>u(c,h)},unsub:u,unsubAll(){r=r.filter(c=>c[1].signal)}});return l}const Oe=[];function si(e){Oe.length&&Oe[Oe.length-1].add(e)}function S(e,t){let n=new Set,r;function i(){return r||(r=D(a(),t))}function s(){i().set(a())}function a(){n.forEach(c=>{c.unsub(s,{signal:!0})});const u=new Set;let l;Oe.push(u);try{l=e()}finally{Oe.pop()}return u.forEach(c=>{c.sub(s,{signal:!0})}),n=u,l}return Object.assign(function(){return i()()},{destroy(){i().destroy()},sub(...u){return i().sub(...u)},unsub(...u){i().unsub(...u)},unsubAll(...u){i().unsubAll(...u)}})}var ii=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))};function kn(e,t,n,r,i,s,a,u,l){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return s(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return a(s(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return u(a(s(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return l(u(a(s(i(r(n(t(e.apply(this,arguments)))))))))}}}function d(e,t,n,r,i,s,a,u,l){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return i(r(n(t(e))));case 6:return s(i(r(n(t(e)))));case 7:return a(s(i(r(n(t(e))))));case 8:return u(a(s(i(r(n(t(e)))))));case 9:return l(u(a(s(i(r(n(t(e))))))));default:{for(var c=arguments[0],h=1;h<arguments.length;h++)c=arguments[h](c);return c}}}var je=function(e,t){var n=typeof e=="number"?function(r){return r.length>=e}:e;return function(){var r=Array.from(arguments);return n(arguments)?t.apply(this,r):function(i){return t.apply(void 0,ii([i],r,!1))}}},oi={_tag:"None"},ai=function(e){return{_tag:"Some",value:e}},ui=function(e){return e._tag==="Left"},$n=function(e){return{_tag:"Left",left:e}},En=function(e){return{_tag:"Right",right:e}},gt={};function ci(e,t){return function(n){return function(r){return e.ap(e.map(r,function(i){return function(s){return t.ap(i,s)}}),n)}}}function li(e,t){return function(n){return function(r){return e.map(r,function(i){return t.map(i,n)})}}}function bt(e){return function(t,n){return function(r){return e.chain(r,function(i){return e.map(n(i),function(s){var a;return Object.assign({},i,(a={},a[t]=s,a))})})}}}var U=$n,L=En,pi=je(2,function(e,t){return ye(e)?e:t(e.right)}),vt=function(e,t){return d(e,Y(t))},In=function(e,t){return d(e,_i(t))},wt="Either",Y=function(e){return function(t){return ye(t)?t:L(e(t.right))}},hi={URI:wt,map:vt},fi=L,di=function(e){return function(t){return ye(t)?t:ye(e)?e:L(t.right(e.right))}},_i=di,mi={URI:wt,map:vt,ap:In},gi={URI:wt,map:vt,ap:In,chain:pi},bi=function(e,t){return function(n){return ye(n)?U(e(n.left)):L(t(n.right))}},ye=ui,An=function(e,t){return function(n){return ye(n)?e(n.left):t(n.right)}},De=An,vi=function(e,t){try{return L(e())}catch(n){return U(t(n))}},wi=fi(gt),yi=bt(gi),qn=yi;function X(e){return typeof e=="function"?e():e}class Ue{constructor({onMounted:t,restoreState:n,initialState:r,onUnmounted:i,isPageReload:s}){o(this,"_isMounted",D(!1));o(this,"isMounted",S(this._isMounted));o(this,"mount");o(this,"unmount");this.mount=()=>{if(this.isMounted())return L(void 0);const a=X(s)?n():void 0,u=a?L(a):typeof r=="function"?r():L(r);return d(u,Y(l=>{Xe(()=>{this._isMounted.set(!0),t==null||t(l)})}))},this.unmount=()=>{this._isMounted()&&Xe(()=>{this._isMounted.set(!1),i==null||i()})}}}function yt(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=r)}return t}function Ft(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(i=>Object.prototype.hasOwnProperty.call(t,i)&&e[i]===t[i])}class de{constructor({initialState:t,onChange:n}){o(this,"_state");o(this,"state");o(this,"setState",t=>{const n={...this.state(),...yt(t)};Ft(n,this.state())||this._state.set(n)});this._state=D(t,{equals:Ft}),this.state=S(this._state),this.state.sub(n)}getter(t){return S(()=>this._state()[t])}hasDiff(t){return!Ft({...this.state(),...yt(t)},this.state())}}var ce;function St(e){return{lang:(e==null?void 0:e.lang)??(ce==null?void 0:ce.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(ce==null?void 0:ce.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(ce==null?void 0:ce.abortPipeEarly)}}var Ct;function Fi(e){return Ct==null?void 0:Ct.get(e)}var kt;function Si(e){return kt==null?void 0:kt.get(e)}var $t;function Ci(e,t){var n;return(n=$t==null?void 0:$t.get(e))==null?void 0:n.get(t)}function ki(e){var n,r;const t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(e&&((r=(n=Object.getPrototypeOf(e))==null?void 0:n.constructor)==null?void 0:r.name))??"null":t}function K(e,t,n,r,i){const s=i&&"input"in i?i.input:n.value,a=(i==null?void 0:i.expected)??e.expects??null,u=(i==null?void 0:i.received)??ki(s),l={kind:e.kind,type:e.type,input:s,expected:a,received:u,message:`Invalid ${t}: ${a?`Expected ${a} but r`:"R"}eceived ${u}`,requirement:e.requirement,path:i==null?void 0:i.path,issues:i==null?void 0:i.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},c=e.kind==="schema",h=(i==null?void 0:i.message)??e.message??Ci(e.reference,l.lang)??(c?Si(l.lang):null)??r.message??Fi(l.lang);h!==void 0&&(l.message=typeof h=="function"?h(l):h),c&&(n.typed=!1),n.issues?n.issues.push(l):n.issues=[l]}function J(e){return{version:1,vendor:"valibot",validate(t){return e["~run"]({value:t},St())}}}function Tn(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function $i(e,t){const n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??"never"}var Ei=class extends Error{constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function et(e,t){return{kind:"validation",type:"check",reference:et,async:!1,expects:null,requirement:e,message:t,"~run"(n,r){return n.typed&&!this.requirement(n.value)&&K(this,"input",n,r),n}}}function Et(e){return{kind:"validation",type:"integer",reference:Et,async:!1,expects:null,requirement:Number.isInteger,message:e,"~run"(t,n){return t.typed&&!this.requirement(t.value)&&K(this,"integer",t,n),t}}}function le(e){return{kind:"transformation",type:"transform",reference:le,async:!1,operation:e,"~run"(t){return t.value=this.operation(t.value),t}}}function Ii(e,t,n){return typeof e.fallback=="function"?e.fallback(t,n):e.fallback}function It(e,t,n){return typeof e.default=="function"?e.default(t,n):e.default}function At(e,t){return!e["~run"]({value:t},{abortEarly:!0}).issues}function Mn(){return{kind:"schema",type:"any",reference:Mn,expects:"any",async:!1,get"~standard"(){return J(this)},"~run"(e){return e.typed=!0,e}}}function Bn(e,t){return{kind:"schema",type:"array",reference:Bn,expects:"Array",async:!1,item:e,message:t,get"~standard"(){return J(this)},"~run"(n,r){var s;const i=n.value;if(Array.isArray(i)){n.typed=!0,n.value=[];for(let a=0;a<i.length;a++){const u=i[a],l=this.item["~run"]({value:u},r);if(l.issues){const c={type:"array",origin:"value",input:i,key:a,value:u};for(const h of l.issues)h.path?h.path.unshift(c):h.path=[c],(s=n.issues)==null||s.push(h);if(n.issues||(n.issues=l.issues),r.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}}else K(this,"type",n,r);return n}}}function Fe(e){return{kind:"schema",type:"boolean",reference:Fe,expects:"boolean",async:!1,message:e,get"~standard"(){return J(this)},"~run"(t,n){return typeof t.value=="boolean"?t.typed=!0:K(this,"type",t,n),t}}}function tt(e){return{kind:"schema",type:"date",reference:tt,expects:"Date",async:!1,message:e,get"~standard"(){return J(this)},"~run"(t,n){return t.value instanceof Date?isNaN(t.value)?K(this,"type",t,n,{received:'"Invalid Date"'}):t.typed=!0:K(this,"type",t,n),t}}}function qt(e){return{kind:"schema",type:"function",reference:qt,expects:"Function",async:!1,message:e,get"~standard"(){return J(this)},"~run"(t,n){return typeof t.value=="function"?t.typed=!0:K(this,"type",t,n),t}}}function Tt(e,t){return{kind:"schema",type:"instance",reference:Tt,expects:e.name,async:!1,class:e,message:t,get"~standard"(){return J(this)},"~run"(n,r){return n.value instanceof this.class?n.typed=!0:K(this,"type",n,r),n}}}function W(e,t){return{kind:"schema",type:"loose_object",reference:W,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return J(this)},"~run"(n,r){var s;const i=n.value;if(i&&typeof i=="object"){n.typed=!0,n.value={};for(const a in this.entries){const u=this.entries[a];if(a in i||(u.type==="exact_optional"||u.type==="optional"||u.type==="nullish")&&u.default!==void 0){const l=a in i?i[a]:It(u),c=u["~run"]({value:l},r);if(c.issues){const h={type:"object",origin:"value",input:i,key:a,value:l};for(const f of c.issues)f.path?f.path.unshift(h):f.path=[h],(s=n.issues)==null||s.push(f);if(n.issues||(n.issues=c.issues),r.abortEarly){n.typed=!1;break}}c.typed||(n.typed=!1),n.value[a]=c.value}else if(u.fallback!==void 0)n.value[a]=Ii(u);else if(u.type!=="exact_optional"&&u.type!=="optional"&&u.type!=="nullish"&&(K(this,"key",n,r,{input:void 0,expected:`"${a}"`,path:[{type:"object",origin:"key",input:i,key:a,value:i[a]}]}),r.abortEarly))break}if(!n.issues||!r.abortEarly)for(const a in i)Tn(i,a)&&!(a in this.entries)&&(n.value[a]=i[a])}else K(this,"type",n,r);return n}}}function Ae(e,t){return{kind:"schema",type:"nullish",reference:Ae,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return J(this)},"~run"(n,r){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=It(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function _e(e){return{kind:"schema",type:"number",reference:_e,expects:"number",async:!1,message:e,get"~standard"(){return J(this)},"~run"(t,n){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:K(this,"type",t,n),t}}}function I(e,t){return{kind:"schema",type:"optional",reference:I,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return J(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=It(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function Mt(e,t,n){return{kind:"schema",type:"record",reference:Mt,expects:"Object",async:!1,key:e,value:t,message:n,get"~standard"(){return J(this)},"~run"(r,i){var a,u;const s=r.value;if(s&&typeof s=="object"){r.typed=!0,r.value={};for(const l in s)if(Tn(s,l)){const c=s[l],h=this.key["~run"]({value:l},i);if(h.issues){const g={type:"object",origin:"key",input:s,key:l,value:c};for(const v of h.issues)v.path=[g],(a=r.issues)==null||a.push(v);if(r.issues||(r.issues=h.issues),i.abortEarly){r.typed=!1;break}}const f=this.value["~run"]({value:c},i);if(f.issues){const g={type:"object",origin:"value",input:s,key:l,value:c};for(const v of f.issues)v.path?v.path.unshift(g):v.path=[g],(u=r.issues)==null||u.push(v);if(r.issues||(r.issues=f.issues),i.abortEarly){r.typed=!1;break}}(!h.typed||!f.typed)&&(r.typed=!1),h.typed&&(r.value[h.value]=f.value)}}else K(this,"type",r,i);return r}}}function y(e){return{kind:"schema",type:"string",reference:y,expects:"string",async:!1,message:e,get"~standard"(){return J(this)},"~run"(t,n){return typeof t.value=="string"?t.typed=!0:K(this,"type",t,n),t}}}function Pn(e){let t;if(e)for(const n of e)t?t.push(...n.issues):t=n.issues;return t}function nt(e,t){return{kind:"schema",type:"union",reference:nt,expects:$i(e.map(n=>n.expects),"|"),async:!1,options:e,message:t,get"~standard"(){return J(this)},"~run"(n,r){let i,s,a;for(const u of this.options){const l=u["~run"]({value:n.value},r);if(l.typed)if(l.issues)s?s.push(l):s=[l];else{i=l;break}else a?a.push(l):a=[l]}if(i)return i;if(s){if(s.length===1)return s[0];K(this,"type",n,r,{issues:Pn(s)}),n.typed=!0}else{if((a==null?void 0:a.length)===1)return a[0];K(this,"type",n,r,{issues:Pn(a)})}return n}}}function Bt(){return{kind:"schema",type:"unknown",reference:Bt,expects:"unknown",async:!1,get"~standard"(){return J(this)},"~run"(e){return e.typed=!0,e}}}function me(e,t,n){const r=e["~run"]({value:t},St(n));if(r.issues)throw new Ei(r.issues);return r.value}function ae(...e){return{...e[0],pipe:e,get"~standard"(){return J(this)},"~run"(t,n){for(const r of e)if(r.kind!=="metadata"){if(t.issues&&(r.kind==="schema"||r.kind==="transformation")){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r["~run"](t,n))}return t}}}function Pt(e,t,n){const r=e["~run"]({value:t},St(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var Ai=Object.defineProperty,qi=(e,t,n)=>t in e?Ai(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ln=(e,t,n)=>qi(e,typeof t!="symbol"?t+"":t,n),Ti=Object.defineProperty,Mi=(e,t,n)=>t in e?Ti(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lt=(e,t,n)=>Mi(e,typeof t!="symbol"?t+"":t,n);function Rn(e){return t=>t instanceof e}function Vn(e,t){const n=class extends Error{constructor(...i){const s=typeof t=="function"?t(...i):typeof t=="string"?[t]:t||[];super(...s),this.name=e}};Lt(n,"is",Rn(n));let r=n;return Object.defineProperty(r,"name",{value:e}),r}function Bi(e,t,n){const r=class extends Vn(e,n){constructor(...s){super(...s),Lt(this,"data"),this.data=t(...s)}};Lt(r,"is",Rn(r));let i=r;return Object.defineProperty(i,"name",{value:e}),i}let On=class extends Vn("CancelledError","Promise was canceled"){},Rt=class extends Bi("TimeoutError",t=>({timeout:t}),(t,n)=>[`Timeout reached: ${t}ms`,{cause:n}]){};const Pi=Symbol("resolved");function Li(e){return{tag:Pi,value:e}}function jn(e,t){return e.reject=t.reject,e.resolve=t.resolve,e}let We=class Cn extends Promise{constructor(t,n){let r,i,s,a;typeof t=="function"?(s=t,a=n||{}):a=t||{};let u,l;const c=()=>!!l,h=()=>!!u;let f={};const g=[],v=()=>{g.forEach(b=>b()),g.splice(0,g.length),f={}},F=new AbortController,C=()=>h()||c();super((b,w)=>{const{abortOnResolve:m=!0,abortOnReject:R=!0}=a;i=$=>{var P,M;C()||(b($),u=[$],(P=f.resolved)==null||P.forEach(x=>x($)),(M=f.finalized)==null||M.forEach(x=>x({kind:"resolved",result:$})),v(),m&&F.abort(Li($)))},r=$=>{var P,M;C()||(w($),l=[$],(P=f.rejected)==null||P.forEach(x=>x($)),(M=f.finalized)==null||M.forEach(x=>x({kind:"rejected",reason:$})),v(),R&&F.abort($))};const{abortSignal:V}=a;if(V){if(V.aborted)return r(V.reason);const $=()=>{r(V.reason)};V.addEventListener("abort",$,!0),g.push(()=>{V.removeEventListener("abort",$,!0)})}const{timeout:j}=a;if(j){const $=setTimeout(()=>{r(new Rt(j))},j);g.push(()=>{clearTimeout($)})}try{const $=()=>{},P=s&&s(i,r,{abortSignal:F.signal,get isRejected(){return c()},get isResolved(){return h()},on(M,x){if(u||l){if(M==="finalized"){const Ve=u?{kind:"resolved",result:u[0]}:{kind:"rejected",reason:l[0]};x(Ve)}else M==="resolved"&&u?x(u[0]):M==="rejected"&&l&&x(l[0]);return $}return f[M]||(f[M]=[]),f[M].push(x),()=>{const Ve=f[M]||[],Ye=Ve.indexOf(x);Ye>=0&&Ve.splice(Ye,1)}},get result(){return u==null?void 0:u[0]},get rejectReason(){return l==null?void 0:l[0]},throwIfRejected(){if(l)throw l[0]}});P instanceof Promise&&P.catch(r)}catch($){r($)}}),Ln(this,"reject"),Ln(this,"resolve"),this.reject=r,this.resolve=i}static fn(t,n){return new Cn(async(r,i,s)=>{try{r(await t(s))}catch(a){i(a)}},n)}static resolve(t){return this.fn(()=>t)}static reject(t){return new Cn((n,r)=>{r(t)})}cancel(){this.reject(new On)}catch(t){return this.then(void 0,t)}finally(t){return jn(super.finally(t),this)}then(t,n){return jn(super.then(t,n),this)}};function Dn(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Ri(e){return e.replace(/_[a-z]/g,t=>t[1].toUpperCase())}function Vi(e){return Object.entries(e).reduce((t,[n,r])=>(t[Ri(n)]=r,t),{})}function Vt(e){const t=Vi(e);for(const n in t){const r=t[n];r&&typeof r=="object"&&!(r instanceof Date)&&(t[n]=Array.isArray(r)?r.map(Vt):Vt(r))}return t}function Oi(e){return e.replace(/_([a-z])/g,(t,n)=>`-${n.toLowerCase()}`)}function Un(e){return`tapps/${e}`}function Ot(e,t){sessionStorage.setItem(Un(e),JSON.stringify(t))}function Wn(e){const t=sessionStorage.getItem(Un(e));try{return t?JSON.parse(t):void 0}catch{}}function Ge(...e){const t=e.flat(1);return[t.push.bind(t),()=>{t.forEach(n=>{n()})}]}function Gn(e,t){t||(t={});const{textColor:n,bgColor:r,shouldLog:i}=t,s=i===void 0?!0:i,a=typeof s=="boolean"?()=>s:s,u=(l,c,...h)=>{if(c||a()){const f="font-weight:bold;padding:0 5px;border-radius:100px",[g,v,F]={log:["#0089c3","white","INFO"],error:["#ff0000F0","white","ERR"],warn:["#D38E15","white","WARN"]}[l];console[l](`%c${F} ${Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(new Date)}%c %c${e}`,`${f};background-color:${g};color:${v}`,"",`${f};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...h)}};return[["log","forceLog"],["warn","forceWarn"],["error","forceError"]].reduce((l,[c,h])=>(l[c]=u.bind(void 0,c,!1),l[h]=u.bind(void 0,c,!0),l),{})}var ji=function(e,t,n){if(arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))};function xn(e,t,n,r,i,s,a,u,l){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return s(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return a(s(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return u(a(s(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return l(u(a(s(i(r(n(t(e.apply(this,arguments)))))))))}}}function qe(e,t,n,r,i,s,a,u,l){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return i(r(n(t(e))));case 6:return s(i(r(n(t(e)))));case 7:return a(s(i(r(n(t(e))))));case 8:return u(a(s(i(r(n(t(e)))))));case 9:return l(u(a(s(i(r(n(t(e))))))));default:{for(var c=arguments[0],h=1;h<arguments.length;h++)c=arguments[h](c);return c}}}var Nn=function(e,t){var n=function(r){return r.length>=e};return function(){var r=Array.from(arguments);return n(arguments)?t.apply(this,r):function(i){return t.apply(void 0,ji([i],r,!1))}}},Di=function(e){return e._tag==="Left"},Hn=function(e){return{_tag:"Left",left:e}},zn=function(e){return{_tag:"Right",right:e}},Kn=Hn,Jn=zn,Qn=Di,Ui=function(e,t){return function(n){return Qn(n)?e(n.left):t(n.right)}},jt=Ui;function Wi(e){return xn(Jn,e.of)}function Gi(e){return xn(Kn,e.of)}function xi(e){return function(t,n){return e.chain(t,function(r){return Qn(r)?e.of(r):n(r.right)})}}function Ni(e){return function(t,n){return function(r){return e.map(r,jt(t,n))}}}var Zn=function(e,t){return qe(e,zi(t))},Hi=function(e,t){return qe(e,Ki(t))},zi=function(e){return function(t){return function(){return Promise.resolve().then(t).then(e)}}},Ki=function(e){return function(t){return function(){return Promise.all([Promise.resolve().then(t),Promise.resolve().then(e)]).then(function(n){var r=n[0],i=n[1];return r(i)})}}},Dt=function(e){return function(){return Promise.resolve(e)}},Ji=Nn(2,function(e,t){return function(){return Promise.resolve().then(e).then(function(n){return t(n)()})}}),Yn="Task",Qi={URI:Yn,map:Zn},Xn={of:Dt},Zi={URI:Yn,map:Zn,of:Dt,ap:Hi,chain:Ji},Yi=function(e,t,n,r){function i(s){return s instanceof n?s:new n(function(a){a(s)})}return new(n||(n=Promise))(function(s,a){function u(h){try{c(r.next(h))}catch(f){a(f)}}function l(h){try{c(r.throw(h))}catch(f){a(f)}}function c(h){h.done?s(h.value):i(h.value).then(u,l)}c((r=r.apply(e,[])).next())})},Xi=function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){n.label=c[1];break}if(c[0]===6&&n.label<s[1]){n.label=s[1],s=c;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(c);break}s[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(h){c=[6,h],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},eo=Gi(Xn),to=Wi(Xn),no=Dt,er=Ni(Qi),ro=er,so=function(e,t){return function(){return Yi(void 0,void 0,void 0,function(){var n;return Xi(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e().then(zn)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,Hn(t(n))];case 3:return[2]}})})}},io=Nn(2,xi(Zi)),oo=io;function xe(e){const t=n=>{throw n};return typeof e=="function"?We.resolve(qe(e,er(t,n=>n))()):qe(e,jt(t,n=>n))}function ne(e){return Object.assign((...t)=>xe(e(...t)),e)}const Te=Object.assign((e,t)=>qe(so(()=>new We((n,r,i)=>e(s=>n(Jn(s)),s=>n(Kn(s)),i),t),n=>n),oo(jt(eo,to))),{fn:(e,t)=>Te((n,r,i)=>{const s=e(i);qe(typeof s=="function"?s:no(s),ro(r,n))()},t)});var ao=Object.defineProperty,uo=(e,t,n)=>t in e?ao(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ut=(e,t,n)=>uo(e,typeof t!="symbol"?t+"":t,n);function tr(e){return t=>t instanceof e}function H(e,t){const n=class extends Error{constructor(...s){const a=typeof t=="function"?t(...s):typeof t=="string"?[t]:t||[];super(...a),this.name=e}};Ut(n,"is",tr(n));let r=n;return Object.defineProperty(r,"name",{value:e}),r}function rt(e,t,n){const r=class extends H(e,n){constructor(...a){super(...a),Ut(this,"data"),this.data=t(...a)}};Ut(r,"is",tr(r));let i=r;return Object.defineProperty(i,"name",{value:e}),i}function co(e,t,n,r,i,s,a,u,l){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return i(r(n(t(e))));case 6:return s(i(r(n(t(e)))));case 7:return a(s(i(r(n(t(e))))));case 8:return u(a(s(i(r(n(t(e)))))));case 9:return l(u(a(s(i(r(n(t(e))))))));default:{for(var c=arguments[0],h=1;h<arguments.length;h++)c=arguments[h](c);return c}}}var lo=function(e){return e._tag==="Left"},po=function(e){return{_tag:"Left",left:e}},ho=function(e){return{_tag:"Right",right:e}},nr=po,Se=ho,fo=function(e){return function(t){return _o(t)?t:Se(e(t.right))}},_o=lo,rr=function(e,t){try{return Se(e())}catch(n){return nr(t(n))}};function mo(e){const t=n=>{const r={};return new URLSearchParams(n).forEach((i,s)=>{const a=r[s];Array.isArray(a)?a.push(i):a===void 0?r[s]=i:r[s]=[a,i]}),me(e,r)};return ae(nt([y(),Tt(URLSearchParams)]),et(n=>{try{return t(n),!0}catch{return!1}},"The value doesn't match required schema"),le(t))}function go(e){return ae(y(),et(t=>{try{return JSON.parse(t),!0}catch{return!1}},"Input is not a valid JSON value"),le(JSON.parse),e)}function ge(e){return ae(y(),go(e))}function Wt(e){return ae(nt([y(),Tt(URLSearchParams)]),mo(e))}function st(e){return t=>e.test(t)}const sr=st(/^#[\da-f]{3}$/i),ir=st(/^#[\da-f]{4}$/i),Ne=st(/^#[\da-f]{6}$/i),or=st(/^#[\da-f]{8}$/i);function ar(e){return[Ne,or,sr,ir].some(t=>t(e))}function ur(e){let t="#";for(let n=0;n<e.length-1;n+=1)t+=e[1+n].repeat(2);return t}function it(e){const t=e.replace(/\s/g,"").toLowerCase();if(/^#[\da-f]{3}$/i.test(t))return Se(ur(t.toLowerCase()+"f"));if(/^#[\da-f]{4}$/i.test(t))return Se(ur(t.toLowerCase()));if(/^#[\da-f]{6}$/i.test(t))return Se(t.toLowerCase()+"ff");if(/^#[\da-f]{8}$/i.test(t))return Se(t.toLowerCase());const n=t.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||t.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(\d{1,3})\)$/);return n?Se(n.slice(1).reduce((r,i)=>r+parseInt(i,10).toString(16).padStart(2,"0"),"#").padEnd(9,"f")):nr(new Error(`Value "${e}" does not satisfy any of known RGB formats.`))}function cr(e){return co(it(e),fo(t=>t.slice(0,7)))}const bo=ne(cr),vo=ne(it);function wo(){return W({id:_e(),photo_url:I(y()),type:y(),title:y(),username:I(y())})}function lr(){return W({added_to_attachment_menu:I(Fe()),allows_write_to_pm:I(Fe()),first_name:y(),id:_e(),is_bot:I(Fe()),is_premium:I(Fe()),last_name:I(y()),language_code:I(y()),photo_url:I(y()),username:I(y())})}function yo(){return W({auth_date:ae(y(),le(e=>new Date(Number(e)*1e3)),tt()),can_send_after:I(ae(y(),le(Number),Et())),chat:I(ge(wo())),chat_type:I(y()),chat_instance:I(y()),hash:y(),query_id:I(y()),receiver:I(ge(lr())),start_param:I(y()),signature:y(),user:I(ge(lr()))})}function pr(){return Wt(yo())}function Gt(){return Mt(y(),ae(nt([y(),_e()]),le(e=>typeof e=="number"?`#${(e&16777215).toString(16).padStart(6,"0")}`:e),et(ar)))}function Fo(){const e=I(ae(y(),le(t=>t==="1")));return W({tgWebAppBotInline:e,tgWebAppData:I(pr()),tgWebAppDefaultColors:I(ge(Gt())),tgWebAppFullscreen:e,tgWebAppPlatform:y(),tgWebAppShowSettings:e,tgWebAppStartParam:I(y()),tgWebAppThemeParams:ge(Gt()),tgWebAppVersion:y()})}function So(){return Wt(Fo())}function hr(){return W({eventType:y(),eventData:I(Bt())})}function fr(e){return rr(()=>me(pr(),e),t=>t)}function ot(e){return rr(()=>me(So(),e),t=>t)}const Co=ne(fr),dr=ne(ot);function _r(e,t){return t||(t=(n,r)=>JSON.stringify(r)),new URLSearchParams(Object.entries(e).reduce((n,[r,i])=>(Array.isArray(i)?n.push(...i.map(s=>[r,String(s)])):i!=null&&n.push([r,i instanceof Date?(i.getTime()/1e3|0).toString():typeof i=="string"||typeof i=="number"?String(i):typeof i=="boolean"?i?"1":"0":t(r,i)]),n),[])).toString()}function mr(e){return _r(e)}function gr(e){return _r(e,(t,n)=>t==="tgWebAppData"?mr(n):JSON.stringify(n))}function ko(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(i){i(n)}),(r=e.get("*"))&&r.slice().map(function(i){i(t,n)})}}}function br(e){return At(W({TelegramWebviewProxy:W({postEvent:qt()})}),e)}function vr(){try{return window.self!==window.top}catch{return!0}}var $o=function(e,t,n){if(arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))};function Eo(e){return e}function wr(e,t,n,r,i,s,a,u,l){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return s(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return a(s(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return u(a(s(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return l(u(a(s(i(r(n(t(e.apply(this,arguments)))))))))}}}function ee(e,t,n,r,i,s,a,u,l){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return i(r(n(t(e))));case 6:return s(i(r(n(t(e)))));case 7:return a(s(i(r(n(t(e))))));case 8:return u(a(s(i(r(n(t(e)))))));case 9:return l(u(a(s(i(r(n(t(e))))))));default:{for(var c=arguments[0],h=1;h<arguments.length;h++)c=arguments[h](c);return c}}}var at=function(e,t){var n=typeof e=="number"?function(r){return r.length>=e}:e;return function(){var r=Array.from(arguments);return n(arguments)?t.apply(this,r):function(i){return t.apply(void 0,$o([i],r,!1))}}},Io={_tag:"None"},Ao=function(e){return{_tag:"Some",value:e}},qo=function(e){return e._tag==="Left"},To=function(e){return{_tag:"Left",left:e}},Mo=function(e){return{_tag:"Right",right:e}},be=To,re=Mo,yr=at(2,function(e,t){return Me(e)?e:t(e.right)}),Bo=function(e){return function(t){return Me(t)?t:re(e(t.right))}},Po=function(e,t){return function(n){return Me(n)?be(e(n.left)):re(t(n.right))}},Lo=function(e){return function(t){return Me(t)?be(e(t.left)):t}},Me=qo,Fr=function(e,t){return function(n){return Me(n)?e(n.left):t(n.right)}},Ro=Fr,xt=Fr,Vo=xt,Nt=function(e,t){try{return re(e())}catch(n){return be(t(n))}},Oo=yr,jo=yr,Do=Io,Uo=Ao,Wo=function(e){return e._tag==="None"},Go=function(e,t){return function(n){return Wo(n)?e():t(n.value)}},xo=Go;function No(e){return wr(re,e.of)}function Ho(e){return wr(be,e.of)}function zo(e){return function(t,n){return e.chain(t,function(r){return Me(r)?e.of(r):n(r.right)})}}function Ko(e){return function(t,n,r){return e.map(t,Po(n,r))}}function Jo(e){return function(t,n){return function(r){return e.map(r,xt(t,n))}}}var Sr=function(e,t){return ee(e,Zo(t))},Qo=function(e,t){return ee(e,Yo(t))},Zo=function(e){return function(t){return function(){return Promise.resolve().then(t).then(e)}}},Yo=function(e){return function(t){return function(){return Promise.all([Promise.resolve().then(t),Promise.resolve().then(e)]).then(function(n){var r=n[0],i=n[1];return r(i)})}}},Cr=function(e){return function(){return Promise.resolve(e)}},Xo=at(2,function(e,t){return function(){return Promise.resolve().then(e).then(function(n){return t(n)()})}}),kr="Task",$r={URI:kr,map:Sr},Er={of:Cr},ea={URI:kr,map:Sr,of:Cr,ap:Qo,chain:Xo},ta=Ho(Er),Ir=No(Er),na=Jo($r),Ar=at(3,Ko($r)),qr=at(2,zo(ea)),ra=qr,Tr=qr;class Mr extends H("MethodUnsupportedError",(t,n)=>[`Method "${t}" is unsupported in Mini Apps version ${n}`]){}class Br extends H("MethodParameterUnsupportedError",(t,n,r)=>[`Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${r}`]){}class Pr extends rt("LaunchParamsRetrieveError",t=>({errors:t}),t=>[["Unable to retrieve launch parameters from any known source. Perhaps, you have opened your app outside Telegram?","📖 Refer to docs for more information:","https://docs.telegram-mini-apps.com/packages/tma-js-bridge/environment","","Collected errors:",...t.map(({source:n,error:r})=>`Source: ${n} / ${r instanceof Error?r.message:String(r)}`)].join(`
|
|
2
|
-
`)]){}class
|
|
3
|
-
`),t,a)}ha(n,s)}const{on:te,off:Ce,emit:ha,clear:fa}=aa(()=>{const e=window;!e.TelegramGameProxy&&(e.TelegramGameProxy={}),Jt(e.TelegramGameProxy,"receiveEvent",ut),Wr(e,"TelegramGameProxy"),!e.Telegram&&(e.Telegram={}),!e.Telegram.WebView&&(e.Telegram.WebView={}),Jt(e.Telegram.WebView,"receiveEvent",ut),Wr(e.Telegram,"WebView"),Jt(e,"TelegramGameProxy_receiveEvent",ut),window.addEventListener("message",Nr)},()=>{[["TelegramGameProxy_receiveEvent"],["TelegramGameProxy","receiveEvent"],["Telegram","WebView","receiveEvent"]].forEach(e=>{const t=window;let n=[void 0,t];for(const s of e)if(n=[n[1],n[1][s]],!n[1])return;const[r,i]=n;"unwrap"in i&&(i.unwrap(),r&&r!==t&&!Object.keys(r).length&&delete t[e[0]])}),window.removeEventListener("message",Nr)}),da=(...e)=>ct()(...e);function _a(e,t){ee(lt(e,t),Lo(n=>{throw n}))}function lt(e,t){pe().log("Posting event:",t?{eventType:e,eventData:t}:{eventType:e});const n=window,r=JSON.stringify({eventType:e,eventData:t});return vr()?(da(r,Ur()),re(void 0)):br(n)?(n.TelegramWebviewProxy.postEvent(e,JSON.stringify(t)),re(void 0)):At(W({external:W({notify:qt()})}),n)?(n.external.notify(r),re(void 0)):be(new Ht)}function Qt(e,t,n={}){const{capture:r=()=>!0,postEvent:i=lt}=n,s=D(),[a,u]=Ge();(Array.isArray(t)?t:[t]).forEach(c=>{a(te(c,h=>{const f=Array.isArray(t);r(f?{event:c,payload:h}:h)&&s.set([f?{event:c,payload:h}:h])}))});const l=c=>(u(),c);return ee(async()=>i(e,n.params),Tr(()=>Te((c,h,f)=>{const g=s();if(g)return c(g[0]);const v=C=>{C&&c(C[0])},F=()=>{s.unsub(v)};s.sub(v),f.on("finalized",F)},n)),Ar(l,l))}function ma(e,t){const n=Zt(e,t);return typeof n=="function"?We.fn(()=>xe(n)):n}function Zt(e,t){const n=br(window);if(!e)return n||ee(He(),xt(()=>!1,()=>!0));if(n)return Ir(!0);const{timeout:r=100}=t||{};return ee(Qt("web_app_request_theme","theme_changed",{...t,timeout:r}),na(i=>Rt.is(i)||Ht.is(i)?re(!1):be(i),()=>re(!0)))}function ga({launchParams:e,onEvent:t,resetPostMessage:n}={}){if(e){const s=typeof e=="string"||e instanceof URLSearchParams?e.toString():gr({...e,tgWebAppData:void 0})+(e.tgWebAppData?`&tgWebAppData=${encodeURIComponent(e.tgWebAppData.toString())}`:"");try{dr(s)}catch(a){throw new Lr(s,a)}Ot("launchParams",s)}if(vr()){if(!t)return;n&&ct.reset();const s=ct();ct.set((...a)=>{const[u]=a,l=()=>{s(...a)};try{const c=me(ge(hr()),u);t({name:c.eventType,params:c.eventData},l)}catch{l()}});return}const r=window.TelegramWebviewProxy||{},i=r.postEvent||(()=>{});window.TelegramWebviewProxy={...r,postEvent(s,a){const u=()=>{i(s,a)};t?t({name:s,params:a?JSON.parse(a):void 0},u):u()}},pe().log("Environment was mocked by the mockTelegramEnv function")}function Hr(e){return({req_id:t})=>t===e}const zr={"6.0":["iframe_ready","iframe_will_reload","web_app_close","web_app_data_send","web_app_expand","web_app_open_link","web_app_ready","web_app_request_theme","web_app_request_viewport","web_app_setup_main_button","web_app_setup_closing_behavior"],6.1:["web_app_open_tg_link","web_app_open_invoice","web_app_setup_back_button","web_app_set_background_color","web_app_set_header_color","web_app_trigger_haptic_feedback"],6.2:["web_app_open_popup"],6.4:["web_app_close_scan_qr_popup","web_app_open_scan_qr_popup","web_app_read_text_from_clipboard",{method:"web_app_open_link",param:"try_instant_view"}],6.7:["web_app_switch_inline_query"],6.9:["web_app_invoke_custom_method","web_app_request_write_access","web_app_request_phone",{method:"web_app_set_header_color",param:"color"}],"6.10":["web_app_setup_settings_button"],7.2:["web_app_biometry_get_info","web_app_biometry_open_settings","web_app_biometry_request_access","web_app_biometry_request_auth","web_app_biometry_update_token"],7.6:[{method:"web_app_open_link",param:"try_browser"},{method:"web_app_close",param:"return_back"}],7.7:["web_app_setup_swipe_behavior"],7.8:["web_app_share_to_story"],"7.10":["web_app_setup_secondary_button","web_app_set_bottom_bar_color",{method:"web_app_setup_main_button",param:"has_shine_effect"}],"8.0":["web_app_request_safe_area","web_app_request_content_safe_area","web_app_request_fullscreen","web_app_exit_fullscreen","web_app_set_emoji_status","web_app_add_to_home_screen","web_app_check_home_screen","web_app_request_emoji_status_access","web_app_check_location","web_app_open_location_settings","web_app_request_file_download","web_app_request_location","web_app_send_prepared_message","web_app_start_accelerometer","web_app_start_device_orientation","web_app_start_gyroscope","web_app_stop_accelerometer","web_app_stop_device_orientation","web_app_stop_gyroscope","web_app_toggle_orientation_lock"],"9.0":["web_app_device_storage_clear","web_app_device_storage_get_key","web_app_device_storage_save_key","web_app_secure_storage_clear","web_app_secure_storage_get_key","web_app_secure_storage_restore_key","web_app_secure_storage_save_key"],9.1:["web_app_hide_keyboard"]};function Yt(e,t){return Object.keys(zr).find(n=>zr[n].some(r=>t?typeof r=="object"&&r.method===e&&r.param===t:r===e))||null}function Kr(e){return e.split(".").map(Number)}function ba(e,t){const n=Kr(e),r=Kr(t),i=Math.max(n.length,r.length);for(let s=0;s<i;s+=1){const a=n[s]||0,u=r[s]||0;if(a!==u)return a>u?1:-1}return 0}function he(e,t,n){const r=n?Yt(e,t):Yt(e);return r?ba(r,n||t)<=0:!1}function va(e,t="strict"){const n=typeof t=="function"?t:r=>{const{method:i,version:s}=r,a="param"in r?new Br(i,r.param,s):new Mr(i,s);if(t==="strict")throw a;return pe().forceWarn(a.message)};return(r,i)=>he(r,e)?r==="web_app_set_header_color"&&At(W({color:Mn()}),i)&&!he(r,"color",e)?n({version:e,method:r,param:"color"}):_a(r,i):n({version:e,method:r})}function wa(e,t,n,r){return ee(Qt("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:e,params:t,req_id:n},capture:Hr(n)}),ra(({result:i,error:s})=>s?ta(new Rr(s)):Ir(i)))}function ya(e,t,n={}){const{capture:r=()=>!0,postEvent:i=lt}=n,s=D(),[a,u]=Ge();(Array.isArray(t)?t:[t]).forEach(c=>{a(te(c,h=>{(Array.isArray(t)?r({event:c,payload:h}):r(h))&&s.set([h])}))});const l=c=>(u(),c);return ee(async()=>i(e,n.params),Tr(()=>Te((c,h,f)=>{const g=s();if(g)return c(g[0]);const v=C=>{C&&c(C[0])},F=()=>{s.unsub(v)};s.sub(v),f.on("finalized",F)},n)),Ar(l,l))}function Fa(){Object.hasOwn||(Object.hasOwn=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)})}function Xt(e){return Nt(()=>decodeURIComponent(atob(e.replace(/-/g,"+").replace(/_/g,"/")).split("").map(t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join("")),t=>t)}const Sa=ne(Xt);function en(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(t,n)=>String.fromCharCode(parseInt(`0x${n}`)))).replace(/\+/g,"-").replace(/\//g,"_")}var Ca=function(e){return Nt(function(){return JSON.parse(e)},Eo)};function Jr(e){const t=en(typeof e=="string"?e:JSON.stringify(e));return t.length>512?be(new Error("Value is too long for start parameter")):re(t)}const ka=ne(Jr);function $a(e,t){return xe(Qr(e,typeof t=="function"?n=>Nt(()=>t(n),r=>r):t))}function Qr(e,t){return ee(Xt(e),jo(n=>t?typeof t=="function"?t(n):Ca(n):re(n)))}function Ea(e){return en(e).length<=512}function ue(e,t){return S(()=>he(e,X(t)))}var Pe=oi,ze=ai,Ia=function(e,t){return d(e,Ta(t))},Aa=function(e,t){return d(e,Ba(t))},qa="Option",Ta=function(e){return function(t){return Ke(t)?Pe:ze(e(t.value))}},Ma=ze,Ba=function(e){return function(t){return Ke(t)||Ke(e)?Pe:ze(t.value(e.value))}},Pa=je(2,function(e,t){return Ke(e)?Pe:t(e.value)}),La={URI:qa,map:Ia,ap:Aa,chain:Pa},Ke=function(e){return e._tag==="None"},Ra=function(e,t){return function(n){return Ke(n)?e():t(n.value)}},Zr=Ra,Va=Ma(gt),Yr=bt(La);function _(e){return Object.assign(ne(e),{ifAvailable(...t){return d(e.ifAvailable(...t),Zr(()=>({ok:!1}),n=>({ok:!0,data:xe(n)})))}})}function Oa(e){return kn(L,e.of)}function ja(e){return kn(U,e.of)}function Da(e){return li(e,hi)}function Ua(e){return ci(e,mi)}function Wa(e){return function(t,n){return e.chain(t,function(r){return ye(r)?e.of(r):n(r.right)})}}function Ga(e){return function(t,n,r){return e.map(t,bi(n,r))}}function xa(e){return function(t,n){return function(r){return e.map(r,De(t,n))}}}var tn=function(e,t){return d(e,Na(t))},Xr=function(e,t){return d(e,Ha(t))},Na=function(e){return function(t){return function(){return Promise.resolve().then(t).then(e)}}},Ha=function(e){return function(t){return function(){return Promise.all([Promise.resolve().then(t),Promise.resolve().then(e)]).then(function(n){var r=n[0],i=n[1];return r(i)})}}},nn=function(e){return function(){return Promise.resolve(e)}},za=je(2,function(e,t){return function(){return Promise.resolve().then(e).then(function(n){return t(n)()})}}),rn="Task",sn={URI:rn,map:tn},es={of:nn},Ka={URI:rn,map:tn,ap:Xr},Ja={URI:rn,map:tn,of:nn,ap:Xr,chain:za},Qa=function(e,t,n,r){function i(s){return s instanceof n?s:new n(function(a){a(s)})}return new(n||(n=Promise))(function(s,a){function u(h){try{c(r.next(h))}catch(f){a(f)}}function l(h){try{c(r.throw(h))}catch(f){a(f)}}function c(h){h.done?s(h.value):i(h.value).then(u,l)}c((r=r.apply(e,t||[])).next())})},Za=function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){n.label=c[1];break}if(c[0]===6&&n.label<s[1]){n.label=s[1],s=c;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(c);break}s[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(h){c=[6,h],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},G=ja(es),O=Oa(es),ts=nn,Ya=xa(sn),Xa=function(e,t){return function(){return Qa(void 0,void 0,void 0,function(){var n;return Za(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e().then(En)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,$n(t(n))];case 3:return[2]}})})}},eu=function(e,t){return d(e,A(t))},tu=function(e,t){return d(e,nu(t))},A=Da(sn),on=je(3,Ga(sn)),nu=Ua(Ka),an=je(2,Wa(Ja)),ru=O,su="TaskEither",iu={URI:su,map:eu,ap:tu,chain:an},ou=ru(gt),au=bt(iu),pt=au,se=an,Le=an;function ke(e){return[e]}class Je extends rt("ValidationError",(t,n)=>({input:t,issues:n}),"Validation error"){}class ht extends H("CSSVarsBoundError","CSS variables are already bound"){}class ns extends rt("DeviceStorageMethodError",t=>({error:t}),t=>[t]){}class rs extends rt("SecureStorageMethodError",t=>({error:t}),t=>[t]){}class ss extends H("NotAvailableError",ke){}class uu extends H("InvalidEnvError",ke){}class is extends H("FunctionNotAvailableError",ke){}class ie extends H("InvalidArgumentsError",(t,n)=>[t,{cause:n}]){}class ft extends H("ConcurrentCallError",ke){}class os extends H("SetEmojiStatusError",t=>[`Failed to set emoji status: ${t}`]){}class un extends H("AccessDeniedError",ke){}class as extends H("FullscreenFailedError",ke){}class us extends H("ShareMessageError",ke){}class cs extends H("UnknownThemeParamsKeyError",t=>[`Unknown theme params key passed: ${t}`]){}function B(e,t){const n=S(()=>X(t.version)||"100"),r=S(()=>X(t.isTma)),{requires:i,returns:s}=t,a=i?typeof i=="object"?i:{every:[i]}:void 0,u=b=>{if(!t.supports)return!0;const w=t.supports[b];return he(w.method,w.param,n())},l=()=>{if(!a)return;const[b,w]="every"in a?["every",a.every]:["some",a.some];for(let m=0;m<w.length;m++){const R=w[m],V=typeof R=="function"?R():he(R,n())?void 0:`it is unsupported in Mini Apps version ${n()}`;if(V&&(b==="every"||m===w.length-1))return V}},c=(...b)=>{for(const w in t.supports)if(t.supports[w].shouldCheck(...b)&&!u(w))return`option ${w} is not supported in Mini Apps version ${n()}`},h=S(()=>!l()),f=S(()=>n()!=="0.0"),g=S(()=>t.isMounted?t.isMounted():!0),v=S(()=>r()&&f()&&h()&&g()),F=b=>{const w=new is(b);return["task","promise"].includes(t.returns)?G(w):U(w)},C=(...b)=>s==="plain"?vi(()=>e(...b),w=>w):s==="promise"?Xa(()=>e(...b),w=>w):e(...b);return Object.assign((...b)=>{var V;const w="Unable to call function:";if(!r())return F(`${w} it can't be called outside Mini Apps`);if(!f())return F(`${w} the SDK was not initialized. Use the SDK init() function`);const m=l();if(m)return F(`${w} ${m}`);const R=c(...b);if(R)return F(`${w} ${R}`);if(!g()){const j=(V=t.isMounting)!=null&&V.call(t)?"mounting. Wait for the mount completion":"unmounted. Use the mount() method";return F(`${w} the component is ${j}`)}return C(...b)},e,{isAvailable:v,ifAvailable(...b){return v()?ze(C(...b)):Pe}},a?{isSupported:h}:{},t.supports?{supports:u}:{})}function q(e){return t=>B(t,e)}class dt{constructor({isTma:t,storage:n,onClick:r,offClick:i,initialState:s,isPageReload:a,postEvent:u,payload:l,method:c,version:h}){o(this,"isMounted");o(this,"isSupported");o(this,"state");o(this,"stateSetters");o(this,"stateBoolSetters");o(this,"setStateFp");o(this,"setState");o(this,"onClickFp");o(this,"onClick");o(this,"offClickFp");o(this,"offClick");o(this,"mountFp");o(this,"mount");o(this,"unmount");const f=new de({initialState:s,onChange(b){n.set(b)}}),g=new Ue({initialState:s,isPageReload:a,onMounted:f.setState,restoreState:n.get}),v={version:h,requires:c,isTma:t},F=q({...v,returns:"plain"}),C=q({...v,returns:"either",isMounted:g.isMounted});this.isMounted=g.isMounted,this.isSupported=ue(c,h),this.state=f.state,this.setStateFp=C(b=>{const w={...this.state(),...yt(b)};return f.hasDiff(w)?d(u(c,l(w)),Y(()=>{f.setState(w)})):L(void 0)}),this.setState=_(this.setStateFp),this.onClickFp=F(r),this.onClick=_(this.onClickFp),this.offClickFp=F(i),this.offClick=_(this.offClickFp),this.mountFp=F(()=>{const b=()=>{};return d(g.mount(),De(b,b))}),this.mount=_(this.mountFp),this.unmount=g.unmount,this.stateSetters=b=>{const w=C(m=>this.setStateFp({[b]:m}));return[_(w),w]},this.stateBoolSetters=b=>{const[,w]=this.stateSetters(b),m=C(()=>w(!1)),R=C(()=>w(!0));return[[_(m),m],[_(R),R]]}}stateGetter(t){return S(()=>this.state()[t])}}class ls{constructor(t){o(this,"isVisible");o(this,"isMounted");o(this,"isSupported");o(this,"hideFp");o(this,"hide");o(this,"showFp");o(this,"show");o(this,"onClickFp");o(this,"onClick");o(this,"offClickFp");o(this,"offClick");o(this,"mountFp");o(this,"mount");o(this,"unmount");const n=new dt({...t,method:"web_app_setup_back_button",payload:r=>({is_visible:r.isVisible}),initialState:{isVisible:!1}});this.isVisible=n.stateGetter("isVisible"),this.isMounted=n.isMounted,this.isSupported=n.isSupported,[[this.hide,this.hideFp],[this.show,this.showFp]]=n.stateBoolSetters("isVisible"),this.onClick=n.onClick,this.onClickFp=n.onClickFp,this.offClick=n.offClick,this.offClickFp=n.offClickFp,this.mount=n.mount,this.mountFp=n.mountFp,this.unmount=n.unmount}}function k(){return{isTma:S(()=>Zt())}}function Re(e){return t=>({...t,...X(e)})}function Qe(e,t){return D(e,t)}const ps=Qe(lt),$e=(...e)=>ps()(...e),hs=(...e)=>xe($e(...e)),z=Re({postEvent:$e});function cu(e){return{get:()=>Wn(e),set(t){Ot(e,t)}}}function lu(){return performance.getEntriesByType("navigation")[0]}function pu(){const e=lu();return!!e&&e.type==="reload"}function ve(e){return Re({storage:cu(e),isPageReload:pu})}const cn=Qe("0.0"),E=Re({version:cn});function ln(e,t){return{...d(k(),z,E,ve(e)),onClick(n,r){return te(t,n,r)},offClick(n,r){Ce(t,n,r)}}}const hu=new ls(ln("backButton","back_button_pressed"));class pn{constructor({initialState:t,onMounted:n,restoreState:r,onUnmounted:i,isPageReload:s}){o(this,"_isMounted",D(!1));o(this,"isMounted",S(this._isMounted));o(this,"mount");o(this,"unmount");this.mount=a=>{if(this._isMounted())return O(void 0);const u=X(s)?r():void 0;return d(u?O(u):t(a),A(l=>{this._isMounted()||Xe(()=>{this._isMounted.set(!0),n==null||n(l)})}))},this.unmount=()=>{this._isMounted()&&Xe(()=>{this._isMounted.set(!1),i==null||i()})}}}function fs(){return new ss("Biometry is not available")}function hn(e){let t=!1,n=!1,r="",i=!1,s="",a=!1;return e.available&&(t=!0,n=e.token_saved,r=e.device_id,i=e.access_requested,s=e.type,a=e.access_granted),{available:t,tokenSaved:n,deviceId:r,type:s,accessGranted:a,accessRequested:i}}class ds{constructor({version:t,request:n,postEvent:r,storage:i,onInfoReceived:s,offInfoReceived:a,isTma:u,isPageReload:l}){o(this,"isAvailable");o(this,"isSupported");o(this,"isMounted");o(this,"state");o(this,"authenticateFp");o(this,"authenticate");o(this,"openSettingsFp");o(this,"openSettings");o(this,"requestAccessFp");o(this,"requestAccess");o(this,"updateTokenFp");o(this,"updateToken");o(this,"mountFp");o(this,"mount");o(this,"unmount");const c=b=>{h.setState(hn(b))},h=new de({initialState:{available:!1,type:"unknown",accessGranted:!1,accessRequested:!1,deviceId:"",tokenSaved:!1},onChange:i.set}),f=new pn({initialState(b){return d(n("web_app_biometry_get_info","biometry_info_received",b),A(hn))},isPageReload:l,onMounted(b){h.setState(b),s(c)},onUnmounted(){a(c)},restoreState:i.get}),g={version:t,requires:"web_app_biometry_request_auth",isTma:u},v=q({...g,returns:"either"}),F=q({...g,returns:"task"}),C=q({...g,isMounted:f.isMounted,returns:"task"});this.isAvailable=h.getter("available"),this.isMounted=f.isMounted,this.isSupported=ue("web_app_biometry_request_auth",t),this.state=h.state,this.unmount=f.unmount,this.mountFp=F(f.mount),this.authenticateFp=C(b=>this.isAvailable()?d(n("web_app_biometry_request_auth","biometry_auth_requested",{...b,params:{reason:((b||{}).reason||"").trim()}}),A(w=>(h.setState({token:w.token}),w))):G(fs())),this.openSettingsFp=v(()=>r("web_app_biometry_open_settings")),this.requestAccessFp=C(b=>d(n("web_app_biometry_request_access","biometry_info_received",{...b,params:{reason:((b||{}).reason||"").trim()}}),se(w=>{const m=hn(w);return m.available?(h.setState(m),O(m.accessRequested)):G(fs())}))),this.updateTokenFp=C((b={})=>{var w;return d(n("web_app_biometry_update_token","biometry_token_updated",{...b,params:{token:b.token||"",reason:(w=b.reason)==null?void 0:w.trim()}}),A(m=>m.status))}),this.authenticate=_(this.authenticateFp),this.openSettings=_(this.openSettingsFp),this.requestAccess=_(this.requestAccessFp),this.updateToken=_(this.updateTokenFp),this.mount=_(this.mountFp)}}const _s=(e,t,n)=>ya(e,t,{postEvent:$e,...n}),fn=(e,t,n)=>Qt(e,t,{postEvent:$e,...n}),fu=(...e)=>We.fn(()=>_s(...e)()),du=(...e)=>We.fn(()=>fn(...e)()),Q=Re({request:fn});function _u(){return new ds({...d(k(),z,E,Q,ve("biometry")),offInfoReceived(e){Ce("biometry_info_received",e)},onInfoReceived(e){return te("biometry_info_received",e)}})}const mu=_u();class ms{constructor({postEvent:t,storage:n,isTma:r,isPageReload:i}){o(this,"isConfirmationEnabled");o(this,"isMounted");o(this,"mountFp");o(this,"mount");o(this,"unmount");o(this,"disableConfirmationFp");o(this,"disableConfirmation");o(this,"enableConfirmationFp");o(this,"enableConfirmation");const s=new de({initialState:{isConfirmationEnabled:!1},onChange(f){n.set(f)}}),a=new Ue({onMounted:s.setState,restoreState:n.get,initialState:{isConfirmationEnabled:!1},isPageReload:i}),u={requires:"web_app_setup_closing_behavior",isTma:r},l=q({...u,returns:"plain"}),c=q({...u,returns:"either",isMounted:a.isMounted}),h=f=>f===this.isConfirmationEnabled()?L(void 0):(s.setState({isConfirmationEnabled:f}),t("web_app_setup_closing_behavior",{need_confirmation:f}));this.isConfirmationEnabled=s.getter("isConfirmationEnabled"),this.isMounted=a.isMounted,this.disableConfirmationFp=c(()=>h(!1)),this.enableConfirmationFp=c(()=>h(!0)),this.mountFp=l(()=>{const f=()=>{};return d(a.mount(),De(f,f))}),this.unmount=a.unmount,this.disableConfirmation=_(this.disableConfirmationFp),this.enableConfirmation=_(this.enableConfirmationFp),this.mount=_(this.mountFp)}}function gu(){return new ms(d(k(),ve("closingBehavior"),z))}const bu=gu();class gs{constructor({version:t,isTma:n,invokeCustomMethod:r}){o(this,"isSupported");o(this,"deleteItemFp");o(this,"deleteItem");o(this,"getItemFp");o(this,"getItem");o(this,"getItemsFp");o(this,"getItems");o(this,"getKeysFp");o(this,"getKeys");o(this,"setItemFp");o(this,"setItem");o(this,"clearFp");o(this,"clear");const i=q({version:t,requires:"web_app_invoke_custom_method",isTma:n,returns:"task"});this.isSupported=ue("web_app_invoke_custom_method",t),this.deleteItemFp=i((s,a)=>{const u=Array.isArray(s)?s:[s];return d(u.length?r("deleteStorageValues",{keys:u},a):O(void 0),A(()=>{}))}),this.getItemFp=i((s,a)=>d(this.getItemsFp([s],a),A(u=>u[s]||""))),this.getItemsFp=i((s,a)=>d(s.length?r("getStorageValues",{keys:s},a):O({}),A(u=>({...s.reduce((l,c)=>(l[c]="",l),{}),...me(Mt(y(),y()),u)})))),this.getKeysFp=i(s=>d(r("getStorageKeys",{},s),A(a=>me(Bn(y()),a)))),this.setItemFp=i((s,a,u)=>d(r("saveStorageValue",{key:s,value:a},u),A(()=>{}))),this.clearFp=i(s=>d(this.getKeysFp(s),se(this.deleteItemFp))),this.deleteItem=_(this.deleteItemFp),this.getItem=_(this.getItemFp),this.getItems=_(this.getItemsFp),this.getKeys=_(this.getKeysFp),this.setItem=_(this.setItemFp),this.clear=_(this.clearFp)}}const dn=Qe(0);function _t(){return dn.set(dn()+1),dn().toString()}function bs(e,t,n){return wa(e,t,_t(),{...n||{},postEvent:$e})}const _n=Re({invokeCustomMethod:bs});function vu(){return new gs(d(k(),E,_n))}const wu=vu();class vs{constructor({isTma:t,request:n,version:r,createRequestId:i}){o(this,"getItemFp");o(this,"getItem");o(this,"setItemFp");o(this,"setItem");o(this,"deleteItemFp");o(this,"deleteItem");o(this,"clearFp");o(this,"clear");const s=q({version:r,requires:"web_app_device_storage_get_key",isTma:t,returns:"task"}),a=(u,l,c)=>{const h=i();return d(n(u,["device_storage_failed",l],{params:{...c,req_id:h},capture:f=>"payload"in f?f.payload.req_id===h:!0}),se(f=>f.event==="device_storage_failed"?G(new ns(f.payload.error||"UNKNOWN_ERROR")):O(f.payload)))};this.getItemFp=s(u=>d(a("web_app_device_storage_get_key","device_storage_key_received",{key:u}),A(l=>l.value))),this.setItemFp=s((u,l)=>d(a("web_app_device_storage_save_key","device_storage_key_saved",{key:u,value:l}),A(()=>{}))),this.deleteItemFp=s(u=>this.setItemFp(u,null)),this.clearFp=s(()=>d(a("web_app_device_storage_clear","device_storage_cleared",{}),A(()=>{}))),this.getItem=_(this.getItemFp),this.setItem=_(this.setItemFp),this.deleteItem=_(this.deleteItemFp),this.clear=_(this.clearFp)}}const ws=Re({createRequestId:_t});function yu(){return new vs(d(k(),E,Q,ws))}const Fu=yu();function Su({request:e,...t}){return B(n=>d(e("web_app_request_emoji_status_access","emoji_status_access_requested",n),A(r=>r.status)),{...t,requires:"web_app_request_emoji_status_access",returns:"task"})}function Cu(){return Su(d(k(),E,Q))}const ys=Cu(),ku=_(ys);function $u({request:e,...t}){return B((n,r)=>d(e("web_app_set_emoji_status",["emoji_status_set","emoji_status_failed"],{params:{custom_emoji_id:n,duration:(r||{}).duration},...r}),Le(i=>i.event==="emoji_status_failed"?G(new os(i.payload.error)):O(void 0))),{...t,requires:"web_app_set_emoji_status",returns:"task"})}function Eu(){return $u(d(k(),Q,E))}const Fs=Eu(),Iu=_(Fs);class Ss{constructor({postEvent:t,isTma:n,version:r}){o(this,"isSupported");o(this,"impactOccurredFp");o(this,"impactOccurred");o(this,"notificationOccurredFp");o(this,"notificationOccurred");o(this,"selectionChangedFp");o(this,"selectionChanged");const i="web_app_trigger_haptic_feedback",s=q({requires:i,isTma:n,version:r,returns:"plain"});this.isSupported=ue(i,r),this.impactOccurredFp=s(a=>t(i,{type:"impact",impact_style:a})),this.notificationOccurredFp=s(a=>t(i,{type:"notification",notification_type:a})),this.selectionChangedFp=s(()=>t(i,{type:"selection_change"})),this.impactOccurred=_(this.impactOccurredFp),this.notificationOccurred=_(this.notificationOccurredFp),this.selectionChanged=_(this.selectionChangedFp)}}function Au(){return new Ss(d(k(),z,E))}const qu=Au();function Tu({postEvent:e,...t}){return B(()=>e("web_app_add_to_home_screen"),{...t,requires:"web_app_add_to_home_screen",returns:"either"})}function Mu(){return Tu(d(k(),E,z))}const Cs=Mu(),Bu=_(Cs);function Pu({request:e,...t}){return B(n=>d(e("web_app_check_home_screen","home_screen_checked",n),A(r=>r.status||"unknown")),{...t,requires:"web_app_check_home_screen",returns:"task"})}function Lu(){return Pu(d(k(),E,Q))}const ks=Lu(),Ru=_(ks);class $s{constructor({retrieveInitData:t}){o(this,"_state",D());o(this,"_raw",D());o(this,"state",S(this._state));o(this,"authDate",this.fromState("auth_date"));o(this,"canSendAfter",this.fromState("can_send_after"));o(this,"canSendAfterDate",S(()=>{const t=this.authDate(),n=this.canSendAfter();return n&&t?new Date(t.getTime()+n*1e3):void 0}));o(this,"chat",this.fromState("chat"));o(this,"chatType",this.fromState("chat_type"));o(this,"chatInstance",this.fromState("chat_instance"));o(this,"hash",this.fromState("hash"));o(this,"queryId",this.fromState("query_id"));o(this,"raw",S(this._raw));o(this,"receiver",this.fromState("receiver"));o(this,"signature",this.fromState("signature"));o(this,"startParam",this.fromState("start_param"));o(this,"user",this.fromState("user"));o(this,"restoreFp");o(this,"restore");this.restoreFp=()=>d(t(),Y(Zr(()=>{},({raw:n,obj:r})=>{this._state.set(r),this._raw.set(n)}))),this.restore=ne(this.restoreFp)}fromState(t){return S(()=>{const n=this._state();return n?n[t]:void 0})}}function Vu(){return new $s({retrieveInitData(){return d(wi,qn("obj",()=>d(Be(),Y(({tgWebAppData:e})=>e?ze(e):Pe))),qn("raw",zt),Y(({obj:e,raw:t})=>d(Va,Yr("obj",()=>e),Yr("raw",()=>t))))}})}const Ou=Vu();class Es{constructor({version:t,request:n,isTma:r}){o(this,"isOpened");o(this,"isSupported");o(this,"openSlugFp");o(this,"openSlug");o(this,"openUrlFp");o(this,"openUrl");const i=q({version:t,isTma:r,requires:"web_app_open_invoice",returns:"task"}),s=D(!1),a=()=>{s.set(!1)};this.isSupported=ue("web_app_open_invoice",t),this.isOpened=S(s),this.openSlugFp=i((u,l)=>d(this.isOpened()?G(new ft("Invoice is already opened")):O(void 0),se(()=>(s.set(!0),n("web_app_open_invoice","invoice_closed",{...l,params:{slug:u},capture:c=>u===c.slug}))),on(c=>(a(),c),c=>(a(),c.status)))),this.openUrlFp=i((u,l)=>{const{hostname:c,pathname:h}=new URL(u,window.location.href);if(c!=="t.me")return G(new ie(`Link has unexpected hostname: ${c}`));const f=h.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);return f?this.openSlugFp(f[2],l):G(new ie('Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"'))}),this.openUrl=_(this.openUrlFp),this.openSlug=_(this.openSlugFp)}}function ju(){return new Es(d(k(),Q,E))}const Du=ju();function Uu({postEvent:e,...t}){return B((n,r={})=>{if(typeof n=="string")try{n=new URL(n)}catch(i){return U(new ie(`"${n.toString()}" is invalid URL`,i))}return e("web_app_open_link",{url:n.toString(),try_browser:r.tryBrowser,try_instant_view:r.tryInstantView})},{...t,returns:"either"})}function Wu(){return Uu(d(k(),z))}const Is=Wu(),Gu=_(Is);function xu({postEvent:e,version:t,...n}){return B(r=>{const i=r.toString();return i.match(/^https:\/\/t.me\/.+/)?he("web_app_open_tg_link",X(t))?(r=new URL(r),e("web_app_open_tg_link",{path_full:r.pathname+r.search})):(window.location.href=i,L(void 0)):U(new ie(`"${i}" is invalid URL`))},{...n,returns:"either"})}function Nu(){return xu(d(k(),z,E))}const mn=Nu(),Hu=_(mn);function zu({openTelegramLink:e,...t}){return B((n,r)=>e("https://t.me/share/url?"+new URLSearchParams({url:n,text:r||""}).toString().replace(/\+/g,"%20")),{...t,returns:"either"})}function Ku(){return zu({...k(),openTelegramLink:mn})}const As=Ku(),Ju=_(As);function Qu(e){let t=!1,n,r;return e.available&&(t=!0,n=e.access_requested,r=e.access_granted),{available:t,accessGranted:r||!1,accessRequested:n||!1}}class qs{constructor({version:t,request:n,postEvent:r,storage:i,isTma:s,isPageReload:a}){o(this,"state");o(this,"isAvailable");o(this,"isAccessGranted");o(this,"isAccessRequested");o(this,"isMounted");o(this,"isSupported");o(this,"openSettingsFp");o(this,"openSettings");o(this,"requestLocationFp");o(this,"requestLocation");o(this,"mountFp");o(this,"mount");o(this,"unmount");const u=new de({initialState:{available:!1,accessGranted:!1,accessRequested:!1},onChange:i.set}),l=new pn({isPageReload:a,restoreState:i.get,onMounted:u.setState,initialState(v){return d(n("web_app_check_location","location_checked",v),A(Qu))}}),c={version:t,requires:"web_app_check_location",isTma:s},h=q({...c,returns:"either"}),f=q({...c,returns:"task"}),g=q({...c,returns:"task",isMounted:l.isMounted});this.isAvailable=u.getter("available"),this.isAccessRequested=u.getter("accessRequested"),this.isAccessGranted=u.getter("accessGranted"),this.isSupported=ue("web_app_check_location",t),this.isMounted=l.isMounted,this.state=u.state,this.unmount=l.unmount,this.mountFp=f(l.mount),this.openSettingsFp=h(()=>r("web_app_open_location_settings")),this.requestLocationFp=g(v=>d(n("web_app_request_location","location_requested",v),A(F=>{if(!F.available)return u.setState({available:!1}),null;const{available:C,...b}=F;return b}))),this.mount=_(this.mountFp),this.openSettings=_(this.openSettingsFp),this.requestLocation=_(this.requestLocationFp)}}function Zu(){return new qs(d(k(),z,E,Q,ve("locationManager")))}const Yu=Zu();class Ts{constructor({defaults:t,...n}){o(this,"bgColor");o(this,"hasShineEffect");o(this,"isEnabled");o(this,"isLoaderVisible");o(this,"isVisible");o(this,"isMounted");o(this,"state");o(this,"text");o(this,"textColor");o(this,"showFp");o(this,"show");o(this,"hideFp");o(this,"hide");o(this,"enableFp");o(this,"enable");o(this,"enableShineEffectFp");o(this,"enableShineEffect");o(this,"disableFp");o(this,"disable");o(this,"disableShineEffectFp");o(this,"disableShineEffect");o(this,"setBgColorFp");o(this,"setBgColor");o(this,"setTextColorFp");o(this,"setTextColor");o(this,"setTextFp");o(this,"setText");o(this,"showLoaderFp");o(this,"showLoader");o(this,"hideLoaderFp");o(this,"hideLoader");o(this,"setParamsFp");o(this,"setParams");o(this,"mountFp");o(this,"mount");o(this,"unmount");o(this,"onClickFp");o(this,"onClick");o(this,"offClickFp");o(this,"offClick");const r=new dt({...n,version:"100",initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Continue"},method:"web_app_setup_main_button",payload:s=>({has_shine_effect:s.hasShineEffect,is_visible:s.isVisible,is_active:s.isEnabled,is_progress_visible:s.isLoaderVisible,text:s.text,color:s.bgColor,text_color:s.textColor})}),i=(s,a)=>{const u=r.stateGetter(s);return S(()=>u()||X(a))};this.bgColor=i("bgColor",t.bgColor),this.textColor=i("textColor",t.textColor),this.hasShineEffect=r.stateGetter("hasShineEffect"),this.isEnabled=r.stateGetter("isEnabled"),this.isLoaderVisible=r.stateGetter("isLoaderVisible"),this.text=r.stateGetter("text"),this.isVisible=r.stateGetter("isVisible"),this.isMounted=r.isMounted,this.state=r.state,[this.setBgColor,this.setBgColorFp]=r.stateSetters("bgColor"),[this.setTextColor,this.setTextColorFp]=r.stateSetters("textColor"),[[this.disableShineEffect,this.disableShineEffectFp],[this.enableShineEffect,this.enableShineEffectFp]]=r.stateBoolSetters("hasShineEffect"),[[this.disable,this.disableFp],[this.enable,this.enableFp]]=r.stateBoolSetters("isEnabled"),[[this.hideLoader,this.hideLoaderFp],[this.showLoader,this.showLoaderFp]]=r.stateBoolSetters("isLoaderVisible"),[this.setText,this.setTextFp]=r.stateSetters("text"),[[this.hide,this.hideFp],[this.show,this.showFp]]=r.stateBoolSetters("isVisible"),this.setParams=r.setState,this.setParamsFp=r.setStateFp,this.onClick=r.onClick,this.onClickFp=r.onClickFp,this.offClick=r.offClick,this.offClickFp=r.offClickFp,this.mount=r.mount,this.mountFp=r.mountFp,this.unmount=r.unmount}}function gn(e,t){document.documentElement.style.setProperty(e,t)}function bn(e){document.documentElement.style.removeProperty(e)}function Ms(e){return d(it(e),Y(t=>Math.sqrt([.299,.587,.114].reduce((n,r,i)=>{const s=parseInt(t.slice(1+i*2,1+(i+1)*2),16);return n+s*s*r},0))<120))}const vn=ne(Ms);class Bs{constructor({initialState:t,onChange:n,offChange:r,isTma:i,storage:s,isPageReload:a}){o(this,"accentTextColor");o(this,"bgColor");o(this,"buttonColor");o(this,"buttonTextColor");o(this,"bottomBarBgColor");o(this,"destructiveTextColor");o(this,"headerBgColor");o(this,"hintColor");o(this,"linkColor");o(this,"secondaryBgColor");o(this,"sectionBgColor");o(this,"sectionHeaderTextColor");o(this,"sectionSeparatorColor");o(this,"subtitleTextColor");o(this,"textColor");o(this,"_isCssVarsBound",D(!1));o(this,"isCssVarsBound",S(this._isCssVarsBound));o(this,"bindCssVarsFp");o(this,"bindCssVars");o(this,"state");o(this,"isDark",S(()=>{const t=this.bgColor();return!t||vn(t)}));o(this,"isMounted");o(this,"mountFp");o(this,"mount");o(this,"unmount");const u=new de({initialState:{},onChange:s.set}),l=v=>{u.setState(v.theme_params)},c=new Ue({initialState:()=>L(X(t)),isPageReload:a,onMounted(v){u.setState(v),n(l)},onUnmounted(){r(l)},restoreState:s.get}),h={isTma:i,returns:"either"},f=q(h),g=q({...h,isMounted:c.isMounted});this.accentTextColor=u.getter("accent_text_color"),this.bgColor=u.getter("bg_color"),this.buttonColor=u.getter("button_color"),this.buttonTextColor=u.getter("button_text_color"),this.bottomBarBgColor=u.getter("bottom_bar_bg_color"),this.destructiveTextColor=u.getter("destructive_text_color"),this.headerBgColor=u.getter("header_bg_color"),this.hintColor=u.getter("hint_color"),this.linkColor=u.getter("link_color"),this.secondaryBgColor=u.getter("secondary_bg_color"),this.sectionBgColor=u.getter("section_bg_color"),this.sectionHeaderTextColor=u.getter("section_header_text_color"),this.sectionSeparatorColor=u.getter("section_separator_color"),this.subtitleTextColor=u.getter("subtitle_text_color"),this.textColor=u.getter("text_color"),this.state=u.state,this.isMounted=c.isMounted,this.bindCssVarsFp=g(v=>{if(this._isCssVarsBound())return U(new ht);v||(v=b=>`--tg-theme-${Oi(b)}`);const F=b=>{Object.entries(u.state()).forEach(([w,m])=>{m&&b(w,m)})},C=()=>{F((b,w)=>{gn(v(b),w)})};return C(),u.state.sub(C),this._isCssVarsBound.set(!0),L(()=>{F(bn),u.state.unsub(C),this._isCssVarsBound.set(!1)})}),this.mountFp=f(c.mount),this.unmount=c.unmount,this.bindCssVars=_(this.bindCssVarsFp),this.mount=_(this.mountFp)}}const wn=Qe({});function Xu(){return new Bs({...d(k(),ve("themeParams")),offChange(e){Ce("theme_changed",e)},onChange(e){te("theme_changed",e)},initialState:wn})}const Ze=Xu();function Ps(e,t,n){return d(ln(e,t),r=>({...r,defaults:n}))}const ec=new Ts(Ps("mainButton","main_button_pressed",{bgColor:S(()=>Ze.buttonColor()||"#2481cc"),textColor:S(()=>Ze.buttonTextColor()||"#ffffff")}));class Ls{constructor({storage:t,isPageReload:n,version:r,postEvent:i,isTma:s,theme:a,onVisibilityChanged:u,offVisibilityChanged:l}){o(this,"isSupported");o(this,"isDark",S(()=>{const t=this.bgColorRgb();return t?vn(t):!1}));o(this,"isActive");o(this,"state");o(this,"isCssVarsBound");o(this,"bindCssVarsFp");o(this,"bindCssVars");o(this,"isMounted");o(this,"mountFp");o(this,"mount");o(this,"unmount");o(this,"bgColor");o(this,"bgColorRgb");o(this,"setBgColorFp");o(this,"setBgColor");o(this,"headerColor");o(this,"headerColorRgb");o(this,"setHeaderColorFp");o(this,"setHeaderColor");o(this,"bottomBarColor");o(this,"bottomBarColorRgb");o(this,"setBottomBarColorFp");o(this,"setBottomBarColor");o(this,"closeFp");o(this,"close");o(this,"readyFp");o(this,"ready");const c=m=>{g.setState({isActive:m.is_visible})},h=m=>{[[this.headerColor,"web_app_set_header_color"],[this.bgColor,"web_app_set_background_color"],[this.bottomBarColor,"web_app_set_bottom_bar_color"]].forEach(([R,V])=>{const j=R();if(!Ne(j)&&(V!=="web_app_set_header_color"||!["bg_color","secondary_bg_color"].includes(j))){const $=m[j];$&&i(V,{color:$})}})},f=new Ue({initialState(){return L({bgColor:"bg_color",headerColor:"header_bg_color",bottomBarColor:"bottom_bar_bg_color",isActive:!0})},isPageReload:n,onMounted:m=>{u(c),a.sub(h),g.setState(m)},onUnmounted(){l(c),a.unsub(h)},restoreState:t.get});this.isMounted=f.isMounted,this.mountFp=B(()=>{const m=()=>{};return d(f.mount(),De(m,m))},{isTma:s,returns:"plain"}),this.mount=_(this.mountFp),this.unmount=f.unmount;const g=new de({initialState:{bgColor:"bg_color",bottomBarColor:"bottom_bar_bg_color",headerColor:"bg_color",isActive:!1},onChange:t.set});this.state=g.state;const v=m=>Ne(m)?m:X(a)[m],F=m=>S(()=>v(m()));this.isActive=g.getter("isActive"),this.isSupported=S(()=>["web_app_set_header_color","web_app_set_background_color","web_app_set_bottom_bar_color"].some(m=>he(m,X(r))));const C=D(!1);this.isCssVarsBound=S(C),this.bindCssVarsFp=B(m=>{if(C())return U(new ht);const[R,V]=Ge(()=>{C.set(!1)}),j=($,P)=>{const M=()=>{gn($,P()||null)};M(),R(P.sub(M),bn.bind(null,$))};return m||(m=$=>`--tg-${Dn($)}`),j(m("bgColor"),this.bgColorRgb),j(m("bottomBarColor"),this.bottomBarColorRgb),j(m("headerColor"),this.headerColorRgb),C.set(!0),L(V)},{isTma:s,returns:"either",isMounted:this.isMounted}),this.bindCssVars=_(this.bindCssVarsFp);const b=m=>{const R=g.getter(m),V=F(R),j={headerColor:"web_app_set_header_color",bgColor:"web_app_set_background_color",bottomBarColor:"web_app_set_bottom_bar_color"}[m],$=B(P=>{if(P===R())return L(void 0);if(j==="web_app_set_header_color"&&(P==="bg_color"||P==="secondary_bg_color"))return d(i("web_app_set_header_color",{color_key:P}),Y(()=>{g.setState({[m]:P})}));const M=v(P);return d(M?i(j,{color:M}):U(new cs(P)),Y(()=>{g.setState({[m]:P})}))},{isTma:s,version:r,requires:j,isMounted:this.isMounted,returns:"either",supports:m==="headerColor"?{rgb:{method:"web_app_set_header_color",param:"color",shouldCheck:Ne}}:void 0});return[R,V,_($),$]};[this.bgColor,this.bgColorRgb,this.setBgColor,this.setBgColorFp]=b("bgColor"),[this.headerColor,this.headerColorRgb,this.setHeaderColor,this.setHeaderColorFp]=b("headerColor"),[this.bottomBarColor,this.bottomBarColorRgb,this.setBottomBarColor,this.setBottomBarColorFp]=b("bottomBarColor");const w=q({isTma:s,returns:"either"});this.closeFp=w(m=>i("web_app_close",{return_back:m})),this.close=_(this.closeFp),this.readyFp=w(()=>i("web_app_ready")),this.ready=_(this.readyFp)}}function tc(){return new Ls({...d(k(),z,E,ve("miniApp")),offVisibilityChanged(e){Ce("visibility_changed",e)},onVisibilityChanged(e){te("visibility_changed",e)},theme:Ze.state})}const Rs=tc();function nc(e){const t=e.message.trim(),n=(e.title||"").trim(),r=e.buttons||[];if(n.length>64)return U(new ie(`Invalid title: ${n}`));if(!t||t.length>256)return U(new ie(`Invalid message: ${t}`));if(r.length>3)return U(new ie(`Invalid buttons count: ${r.length}`));const i=[];if(!r.length)i.push({type:"close",id:""});else for(let s=0;s<r.length;s++){const a=r[s],u=a.id||"";if(u.length>64)return U(new ie(`Button with index ${s} has invalid id: ${u}`));if(!a.type||a.type==="default"||a.type==="destructive"){const l=a.text.trim();if(!l||l.length>64)return U(new ie(`Button with index ${s} has invalid text: ${l}`));i.push({type:a.type,text:l,id:u})}else i.push({type:a.type,id:u})}return L({title:n,message:t,buttons:i})}class Vs{constructor({version:t,isTma:n,request:r}){o(this,"isOpened");o(this,"isSupported");o(this,"showFp");o(this,"show");const i=D(!1),s=()=>{i.set(!1)},a=q({version:t,isTma:n,requires:"web_app_open_popup",returns:"task"});this.isSupported=ue("web_app_open_popup",t),this.isOpened=S(i),this.showFp=a(u=>d(this.isOpened()?G(new ft("A popup is already opened")):O(void 0),Le(()=>ts(nc(u))),se(l=>(i.set(!0),r("web_app_open_popup","popup_closed",{...u,params:l}))),on(l=>(s(),l),l=>(s(),l.button_id)))),this.show=_(this.showFp)}}function rc(){return new Vs(d(k(),Q,E))}const sc=rc();function ic({request:e,...t}){return B(n=>d(e("web_app_request_phone","phone_requested",n),A(r=>r.status)),{...t,requires:"web_app_request_phone",returns:"task"})}function oc(){return ic(d(k(),E,Q))}const yn=oc(),ac=_(yn);function uc({invokeCustomMethod:e,requestPhoneAccess:t,...n}){const r=a=>d(e("getRequestedContact",{},{...a,timeout:(a||{}).timeout||5e3}),Le(u=>{const l=Pt(y(),u);if(!l.success)return G(new Je(u,l.issues));if(!l.output)return O(void 0);const c=Pt(Wt(W({contact:ge(W({user_id:_e(),phone_number:y(),first_name:y(),last_name:I(y())})),auth_date:ae(y(),le(h=>new Date(Number(h)*1e3)),tt()),hash:y()})),l.output);return c.success?O({raw:l.output,parsed:c.output}):G(new Je(l.output,c.issues))})),i=a=>d(r(a),Ya(u=>Je.is(u)?U(u):L(void 0),u=>L(u))),s=a=>Te(async(u,l,c)=>{let h=50;for(;!c.isRejected;){const f=await i(c)();if(f._tag==="Left")return l(f.left);if(f.right)return u(f.right);await new Promise(g=>setTimeout(g,h)),h+=50}},a);return B(a=>Te.fn(u=>d(i(u),se(l=>l?O(l):d(t(u),Le(c=>c==="sent"?s(u):G(new un("User denied access")))))),a),{...n,returns:"task",requires:"web_app_request_phone"})}function cc(){return uc({...d(k(),_n,E),requestPhoneAccess:yn})}function lc({requestContact:e,...t}){return B(e,{...t,returns:"task",requires:"web_app_request_phone"})}function pc(){return lc({...d(k(),E),requestContact(e){return d(Fn(e),A(t=>t.parsed))}})}const Fn=cc(),hc=_(Fn),Os=pc(),fc=_(Os);function dc({request:e,...t}){return B(n=>d(e("web_app_request_write_access","write_access_requested",n),A(r=>r.status)),{...t,requires:"web_app_request_write_access",returns:"task"})}function _c(){return dc(d(k(),E,Q))}const js=_c(),mc=_(js);class Ds{constructor({version:t,onClosed:n,onTextReceived:r,isTma:i,postEvent:s}){o(this,"isOpened");o(this,"isSupported");o(this,"captureFp");o(this,"capture");o(this,"closeFp");o(this,"close");o(this,"openFp");o(this,"open");const a={version:t,requires:"web_app_open_scan_qr_popup",isTma:i},u=q({...a,returns:"either"}),l=q({...a,returns:"task"}),c=D(!1),h=()=>{c.set(!1)};this.isSupported=ue("web_app_open_scan_qr_popup",t),this.isOpened=S(c),this.captureFp=l(f=>{let g;return d(this.openFp({...f,onCaptured:v=>{f.capture(v)&&(g=v,this.close())}}),A(()=>g))}),this.closeFp=u(()=>d(s("web_app_close_scan_qr_popup"),Y(h))),this.openFp=l(f=>d(c()?G(new ft("The QR Scanner is already opened")):async()=>s("web_app_open_scan_qr_popup",{text:f.text}),Le(()=>{c.set(!0);const[g,v]=Ge(),F=C=>(v(),c.set(!1),C);return d(Te(C=>{g(n(C),c.sub(b=>{b||C()}),r(f.onCaptured))},f),on(F,F))}))),this.open=_(this.openFp),this.capture=_(this.captureFp),this.close=_(this.closeFp)}}function gc(){return new Ds({...d(k(),z,E),onClosed(e){return te("scan_qr_popup_closed",e)},onTextReceived(e){return te("qr_text_received",t=>{e(t.data)})}})}const bc=gc();class Us{constructor({defaults:t,...n}){o(this,"isSupported");o(this,"position");o(this,"bgColor");o(this,"hasShineEffect");o(this,"isEnabled");o(this,"isLoaderVisible");o(this,"isVisible");o(this,"isMounted");o(this,"state");o(this,"text");o(this,"textColor");o(this,"showFp");o(this,"show");o(this,"hideFp");o(this,"hide");o(this,"enableFp");o(this,"enable");o(this,"enableShineEffectFp");o(this,"enableShineEffect");o(this,"disableFp");o(this,"disable");o(this,"disableShineEffectFp");o(this,"disableShineEffect");o(this,"setBgColorFp");o(this,"setBgColor");o(this,"setTextColorFp");o(this,"setTextColor");o(this,"setTextFp");o(this,"setText");o(this,"setPositionFp");o(this,"setPosition");o(this,"showLoaderFp");o(this,"showLoader");o(this,"hideLoaderFp");o(this,"hideLoader");o(this,"setParamsFp");o(this,"setParams");o(this,"mountFp");o(this,"mount");o(this,"unmount");o(this,"onClickFp");o(this,"onClick");o(this,"offClickFp");o(this,"offClick");const r=new dt({...n,initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Cancel",position:"left"},method:"web_app_setup_secondary_button",payload:s=>({has_shine_effect:s.hasShineEffect,is_visible:s.isVisible,is_active:s.isEnabled,is_progress_visible:s.isLoaderVisible,text:s.text,color:s.bgColor,text_color:s.textColor,position:s.position})}),i=(s,a)=>{const u=r.stateGetter(s);return S(()=>u()||X(a))};this.isSupported=ue("web_app_setup_secondary_button",n.version),this.bgColor=i("bgColor",t.bgColor),this.textColor=i("textColor",t.textColor),this.position=r.stateGetter("position"),this.hasShineEffect=r.stateGetter("hasShineEffect"),this.isEnabled=r.stateGetter("isEnabled"),this.isLoaderVisible=r.stateGetter("isLoaderVisible"),this.text=r.stateGetter("text"),this.isVisible=r.stateGetter("isVisible"),this.isMounted=r.isMounted,this.state=r.state,[this.setPosition,this.setPositionFp]=r.stateSetters("position"),[this.setBgColor,this.setBgColorFp]=r.stateSetters("bgColor"),[this.setTextColor,this.setTextColorFp]=r.stateSetters("textColor"),[[this.disableShineEffect,this.disableShineEffectFp],[this.enableShineEffect,this.enableShineEffectFp]]=r.stateBoolSetters("hasShineEffect"),[[this.disable,this.disableFp],[this.enable,this.enableFp]]=r.stateBoolSetters("isEnabled"),[[this.hideLoader,this.hideLoaderFp],[this.showLoader,this.showLoaderFp]]=r.stateBoolSetters("isLoaderVisible"),[this.setText,this.setTextFp]=r.stateSetters("text"),[[this.hide,this.hideFp],[this.show,this.showFp]]=r.stateBoolSetters("isVisible"),this.setParams=r.setState,this.setParamsFp=r.setStateFp,this.onClick=r.onClick,this.onClickFp=r.onClickFp,this.offClick=r.offClick,this.offClickFp=r.offClickFp,this.mount=r.mount,this.mountFp=r.mountFp,this.unmount=r.unmount}}function vc(){return new Us(Ps("secondaryButton","secondary_button_pressed",{bgColor:S(()=>Rs.bottomBarColorRgb()||"#000000"),textColor:S(()=>Ze.buttonColor()||"#2481cc")}))}const wc=vc();class Ws{constructor({isTma:t,request:n,version:r,createRequestId:i}){o(this,"getItemFp");o(this,"getItem");o(this,"restoreItemFp");o(this,"restoreItem");o(this,"setItemFp");o(this,"setItem");o(this,"deleteItemFp");o(this,"deleteItem");o(this,"clearFp");o(this,"clear");const s=q({version:r,requires:"web_app_secure_storage_get_key",isTma:t,returns:"task"}),a=(u,l,c)=>{const h=i();return d(n(u,["secure_storage_failed",l],{params:{...c,req_id:h},capture:f=>"payload"in f?f.payload.req_id===h:!0}),se(f=>f.event==="secure_storage_failed"?G(new rs(f.payload.error||"UNKNOWN_ERROR")):O(f.payload)))};this.getItemFp=s(u=>d(a("web_app_secure_storage_get_key","secure_storage_key_received",{key:u}),A(l=>({value:l.value,canRestore:!!l.can_restore})))),this.setItemFp=s((u,l)=>d(a("web_app_secure_storage_save_key","secure_storage_key_saved",{key:u,value:l}),A(()=>{}))),this.deleteItemFp=s(u=>this.setItemFp(u,null)),this.clearFp=s(()=>d(a("web_app_secure_storage_clear","secure_storage_cleared",{}),A(()=>{}))),this.restoreItemFp=s(u=>d(a("web_app_secure_storage_restore_key","secure_storage_key_restored",{key:u}),A(l=>l.value))),this.getItem=_(this.getItemFp),this.setItem=_(this.setItemFp),this.deleteItem=_(this.deleteItemFp),this.clear=_(this.clearFp),this.restoreItem=_(this.restoreItemFp)}}function yc(){return new Ws(d(k(),E,Q,ws))}const Fc=yc();class Gs{constructor(t){o(this,"isVisible");o(this,"isMounted");o(this,"isSupported");o(this,"hideFp");o(this,"hide");o(this,"showFp");o(this,"show");o(this,"onClickFp");o(this,"onClick");o(this,"offClickFp");o(this,"offClick");o(this,"mountFp");o(this,"mount");o(this,"unmount");const n=new dt({...t,method:"web_app_setup_settings_button",payload:r=>({is_visible:r.isVisible}),initialState:{isVisible:!1}});this.isVisible=n.stateGetter("isVisible"),this.isMounted=n.isMounted,this.isSupported=n.isSupported,[[this.hide,this.hideFp],[this.show,this.showFp]]=n.stateBoolSetters("isVisible"),this.onClick=n.onClick,this.onClickFp=n.onClickFp,this.offClick=n.offClick,this.offClickFp=n.offClickFp,this.mount=n.mount,this.mountFp=n.mountFp,this.unmount=n.unmount}}const Sc=new Gs(ln("settingsButton","settings_button_pressed"));class xs{constructor({postEvent:t,storage:n,isTma:r,isPageReload:i,version:s}){o(this,"isSupported");o(this,"isVerticalEnabled");o(this,"isMounted");o(this,"mountFp");o(this,"mount");o(this,"unmount");o(this,"disableVerticalFp");o(this,"disableVertical");o(this,"enableVerticalFp");o(this,"enableVertical");const a={isVerticalEnabled:!0},u=new de({initialState:a,onChange(v){n.set(v)}}),l=new Ue({initialState:a,isPageReload:i,onMounted:u.setState,restoreState:n.get}),c={requires:"web_app_setup_swipe_behavior",isTma:r,version:s},h=q({...c,returns:"plain"}),f=q({...c,isMounted:l.isMounted,returns:"either"}),g=v=>{const F={isVerticalEnabled:v};return u.hasDiff(F)?d(t("web_app_setup_swipe_behavior",{allow_vertical_swipe:v}),Y(()=>{u.setState(F)})):L(void 0)};this.isSupported=ue("web_app_setup_swipe_behavior",s),this.isVerticalEnabled=u.getter("isVerticalEnabled"),this.isMounted=l.isMounted,this.disableVerticalFp=f(()=>g(!1)),this.enableVerticalFp=f(()=>g(!0)),this.mountFp=h(()=>{const v=()=>{};return d(l.mount(),De(v,v))}),this.unmount=l.unmount,this.disableVertical=_(this.disableVerticalFp),this.enableVertical=_(this.enableVerticalFp),this.mount=_(this.mountFp)}}function Cc(){return new xs(d(k(),z,E,ve("swipeBehavior")))}const kc=Cc();async function $c(e){try{const{clipboard:n}=navigator;if(n)return await n.writeText(e)}catch{}const t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}finally{document.body.removeChild(t)}}function Ec({request:e,...t}){return B((n,r,i)=>d(e("web_app_request_file_download","file_download_requested",{...i,params:{url:n,file_name:r}}),se(s=>s.status==="downloading"?O(void 0):G(new un("User denied the action")))),{...t,requires:"web_app_request_file_download",returns:"task"})}function Ic(){return Ec(d(k(),Q,E))}const Ns=Ic(),Ac=_(Ns);function qc({invokeCustomMethod:e,...t}){return B(n=>d(e("getCurrentTime",{},n),se(r=>{const i=Pt(ae(_e(),Et(),le(s=>new Date(s*1e3)),tt()),r);return i.success?O(i.output):G(new Je(r,i.issues))})),{...t,requires:"web_app_invoke_custom_method",returns:"task"})}function Tc(){return qc(d(k(),_n,E))}const Hs=Tc(),Mc=_(Hs);function Bc({postEvent:e,...t}){return B(()=>e("web_app_hide_keyboard"),{...t,returns:"either",requires:"web_app_hide_keyboard"})}function Pc(){return Bc(d(k(),z,E))}const zs=Pc(),Lc=_(zs);function Rc({request:e,createRequestId:t,...n}){return B(r=>{const i=t();return d(e("web_app_read_text_from_clipboard","clipboard_text_received",{...r,params:{req_id:i},capture:Hr(i)}),A(({data:s=null})=>s))},{...n,requires:"web_app_read_text_from_clipboard",returns:"task"})}function Vc(){return Rc({...d(k(),E,Q),createRequestId:_t})}const Ks=Vc(),Oc=_(Ks);function Js(e){const t={},n=e.match(/Telegram-Android(?:\/([^ ]+))?(?: (\([^)]+\))?|$)/);if(n){const[,r,i]=n;r&&(t.appVersion=r),i&&i.slice(1,i.length-1).split(";").forEach(s=>{const[a,u]=s.trim().split(" ");if(a==="Android")t.androidVersion=u;else if(a==="SDK"){const l=parseInt(u,10);l&&(t.sdkVersion=l)}else u?(t.manufacturer=a,t.model=u):t.performanceClass=a})}return t}function jc(){return Js(navigator.userAgent)}function Dc({postEvent:e,...t}){return B(n=>{const{size:r}=new Blob([n]);return!r||r>4096?U(new ie(r?"Maximum size of data to send is 4096 bytes":"Attempted to send empty data")):e("web_app_data_send",{data:n})},{...t,returns:"either"})}function Uc(){return Dc(d(k(),z))}const Qs=Uc(),Wc=_(Qs);function Gc({request:e,...t}){return B((n,r)=>d(e("web_app_send_prepared_message",["prepared_message_failed","prepared_message_sent"],{...r,params:{id:n}}),se(i=>i.event==="prepared_message_failed"?G(new us(i.payload.error)):O(void 0))),{...t,requires:"web_app_send_prepared_message",returns:"task"})}function xc(){return Gc(d(k(),Q,E))}const Zs=xc(),Nc=_(Zs);function Hc({postEvent:e,...t}){return B((n,r={})=>e("web_app_share_to_story",{text:r.text,media_url:n,widget_link:r.widgetLink}),{...t,requires:"web_app_share_to_story",returns:"either"})}function zc(){return Hc(d(k(),z,E))}const Ys=zc(),Kc=_(Ys),Sn=Qe(!1);function Jc({isInlineMode:e,postEvent:t,...n}){return B((r,i)=>t("web_app_switch_inline_query",{query:r,chat_types:i||[]}),{...n,requires:{every:["web_app_switch_inline_query",()=>X(e)?void 0:"The application must be launched in the inline mode"]},returns:"either"})}function Qc(){return Jc({...d(k(),z,E),isInlineMode:Sn})}const Xs=Qc(),Zc=_(Xs);class ei{constructor({storage:t,isPageReload:n,onContentSafeAreaInsetsChanged:r,onSafeAreaInsetsChanged:i,onViewportChanged:s,onFullscreenChanged:a,offContentSafeAreaInsetsChanged:u,offFullscreenChanged:l,offSafeAreaInsetsChanged:c,offViewportChanged:h,request:f,isViewportStable:g,isFullscreen:v,isTma:F,version:C,postEvent:b}){o(this,"state");o(this,"height");o(this,"stableHeight");o(this,"width");o(this,"isExpanded");o(this,"isStable",S(()=>this.height()===this.stableHeight()));o(this,"contentSafeAreaInsets");o(this,"contentSafeAreaInsetTop");o(this,"contentSafeAreaInsetLeft");o(this,"contentSafeAreaInsetRight");o(this,"contentSafeAreaInsetBottom");o(this,"safeAreaInsets");o(this,"safeAreaInsetTop");o(this,"safeAreaInsetLeft");o(this,"safeAreaInsetRight");o(this,"safeAreaInsetBottom");o(this,"isFullscreen");o(this,"requestFullscreenFp");o(this,"requestFullscreen");o(this,"exitFullscreenFp");o(this,"exitFullscreen");o(this,"isCssVarsBound");o(this,"bindCssVarsFp");o(this,"bindCssVars");o(this,"isMounted");o(this,"mountFp");o(this,"mount");o(this,"expandFp");o(this,"expand");const w={top:0,right:0,left:0,bottom:0},m=new de({initialState:{contentSafeAreaInsets:w,height:0,isExpanded:!1,isFullscreen:!1,safeAreaInsets:w,stableHeight:0,width:0},onChange:t.set}),R=T=>{m.setState({isExpanded:T.is_expanded,height:T.height,width:T.width,stableHeight:T.is_state_stable?T.height:void 0})},V=T=>{m.setState({isFullscreen:T.is_fullscreen})},j=T=>{m.setState({safeAreaInsets:T})},$=T=>{m.setState({contentSafeAreaInsets:T})},P=new pn({initialState(T){const Ee=fe=>()=>{const[we,oe]=fe==="safe-area"?["web_app_request_safe_area","safe_area_changed"]:["web_app_request_content_safe_area","content_safe_area_changed"];return he(we,X(C))?f(we,oe,T):O({top:0,left:0,right:0,bottom:0})},N=fe=>()=>typeof fe=="boolean"?O(fe):ts(fe());return d(ou,pt("safeAreaInsets",Ee("safe-area")),pt("contentSafeAreaInsets",Ee("content-safe-area")),pt("isFullscreen",N(v)),pt("isViewportStable",N(g)),Le(({isViewportStable:fe,...we})=>fe?O({...we,height:window.innerHeight,isExpanded:!0,stableHeight:window.innerHeight,width:window.innerWidth}):d(f("web_app_request_viewport","viewport_changed",T),A(oe=>({...we,height:oe.height,isExpanded:oe.is_expanded,stableHeight:oe.is_state_stable?oe.height:0,width:oe.width})))))},isPageReload:n,onMounted(T){s(R),a(V),i(j),r($),m.setState(T)},onUnmounted(){h(R),l(V),c(j),u($)},restoreState:t.get}),M=T=>S(()=>this.safeAreaInsets()[T]),x=T=>S(()=>this.contentSafeAreaInsets()[T]);this.state=m.state,this.height=m.getter("height"),this.stableHeight=m.getter("stableHeight"),this.width=m.getter("width"),this.isExpanded=m.getter("isExpanded"),this.safeAreaInsets=m.getter("safeAreaInsets"),this.safeAreaInsetTop=M("top"),this.safeAreaInsetBottom=M("bottom"),this.safeAreaInsetLeft=M("left"),this.safeAreaInsetRight=M("right"),this.contentSafeAreaInsets=m.getter("contentSafeAreaInsets"),this.contentSafeAreaInsetTop=x("top"),this.contentSafeAreaInsetBottom=x("bottom"),this.contentSafeAreaInsetLeft=x("left"),this.contentSafeAreaInsetRight=x("right");const Ve=q({isTma:F,returns:"task"}),Ye=q({isTma:F,returns:"either"}),tl=q({isTma:F,requires:"web_app_request_fullscreen",version:C,returns:"task"}),ni=T=>tl(Ee=>d(f(T?"web_app_request_fullscreen":"web_app_exit_fullscreen",["fullscreen_changed","fullscreen_failed"],Ee),se(N=>N.event==="fullscreen_failed"&&N.payload.error!=="ALREADY_FULLSCREEN"?G(new as(N.payload.error)):(m.setState({isFullscreen:"is_fullscreen"in N.payload?N.payload.is_fullscreen:!0}),O(void 0)))));this.isMounted=P.isMounted,this.mountFp=Ve(P.mount),this.mount=_(this.mountFp),this.isFullscreen=m.getter("isFullscreen"),this.requestFullscreenFp=ni(!0),this.requestFullscreen=_(this.requestFullscreenFp),this.exitFullscreenFp=ni(!1),this.exitFullscreen=_(this.exitFullscreenFp);const mt=D(!1);this.isCssVarsBound=S(mt),this.bindCssVarsFp=Ye(T=>{if(mt())return U(new ht);T||(T=N=>`--tg-viewport-${Dn(N)}`);const Ee=[["height",this.height],["stableHeight",this.stableHeight],["width",this.width],["safeAreaInsetTop",this.safeAreaInsetTop],["safeAreaInsetBottom",this.safeAreaInsetBottom],["safeAreaInsetLeft",this.safeAreaInsetLeft],["safeAreaInsetRight",this.safeAreaInsetRight],["contentSafeAreaInsetTop",this.contentSafeAreaInsetTop],["contentSafeAreaInsetBottom",this.contentSafeAreaInsetBottom],["contentSafeAreaInsetLeft",this.contentSafeAreaInsetLeft],["contentSafeAreaInsetRight",this.contentSafeAreaInsetRight]].reduce((N,[fe,we])=>{const oe=T(fe);if(oe){const ri=()=>{gn(oe,`${we()}px`)};N.push({update:ri,removeListener:we.sub(ri),cssVar:oe})}return N},[]);return Ee.forEach(N=>{N.update()}),mt.set(!0),L(()=>{Ee.forEach(N=>{N.removeListener(),bn(N.cssVar)}),mt.set(!1)})}),this.bindCssVars=_(this.bindCssVarsFp),this.expandFp=Ye(()=>b("web_app_expand")),this.expand=_(this.expandFp)}}function Yc(){const e=s=>({on:a=>{te(s,a)},off:a=>{Ce(s,a)}}),t=e("viewport_changed"),n=e("fullscreen_changed"),r=e("safe_area_changed"),i=e("content_safe_area_changed");return new ei({...d(k(),ve("viewport"),E,z,Q),isFullscreen(){return d(Be(),Y(s=>!!s.tgWebAppFullscreen))},isViewportStable(){return d(Be(),Y(s=>["macos","tdesktop","unigram","webk","weba","web"].includes(s.tgWebAppPlatform)))},offContentSafeAreaInsetsChanged:i.off,offFullscreenChanged:n.off,offSafeAreaInsetsChanged:r.off,offViewportChanged:t.off,onContentSafeAreaInsetsChanged:i.on,onFullscreenChanged:n.on,onSafeAreaInsetsChanged:r.on,onViewportChanged:t.on})}const Xc=Yc();function ti(e={}){const{version:t,isInlineMode:n,themeParams:r}=e;if(t&&typeof n=="boolean"&&r)cn.set(t),Sn.set(n),wn.set(r);else{const u=d(Be(),An(l=>l,l=>{cn.set(t||l.tgWebAppVersion),Sn.set(typeof n=="boolean"?n:!!l.tgWebAppBotInline),wn.set(r||l.tgWebAppThemeParams)}));if(u)return U(u)}e.postEvent&&ps.set(e.postEvent);const[i,s]=Ge(te("reload_iframe",()=>{pe().log("Received a request to reload the page"),hs("iframe_will_reload"),window.location.reload()})),{acceptCustomStyles:a=!0}=e;if(a){const u=document.createElement("style");u.id="telegram-custom-styles",document.head.appendChild(u),i(te("set_custom_style",l=>{u.innerHTML=l}),()=>{document.head.removeChild(u)})}return d($e("iframe_ready",{reload_supported:!0}),Y(()=>(pe().log("The package was initialized"),s)))}const el=ne(ti);return p.AccessDeniedError=un,p.BackButton=ls,p.Biometry=ds,p.CSSVarsBoundError=ht,p.CancelledError=On,p.ClosingBehavior=ms,p.CloudStorage=gs,p.ConcurrentCallError=ft,p.DeviceStorage=vs,p.DeviceStorageMethodError=ns,p.FullscreenFailedError=as,p.FunctionUnavailableError=is,p.HapticFeedback=Ss,p.InitData=$s,p.InvalidArgumentsError=ie,p.InvalidEnvError=uu,p.InvalidLaunchParamsError=Lr,p.Invoice=Es,p.InvokeCustomMethodFailedError=Rr,p.LaunchParamsRetrieveError=Pr,p.LocationManager=qs,p.MainButton=Ts,p.MethodParameterUnsupportedError=Br,p.MethodUnsupportedError=Mr,p.MiniApp=Ls,p.NotAvailableError=ss,p.Popup=Vs,p.QrScanner=Ds,p.SecondaryButton=Us,p.SecureStorage=Ws,p.SecureStorageMethodError=rs,p.SetEmojiStatusError=os,p.SettingsButton=Gs,p.ShareMessageError=us,p.SwipeBehavior=xs,p.ThemeParams=Bs,p.TimeoutError=Rt,p.UnknownEnvError=Ht,p.UnknownThemeParamsKeyError=cs,p.ValidationError=Je,p.Viewport=ei,p.addToHomeScreen=Bu,p.addToHomeScreenFp=Cs,p.applyPolyfills=Fa,p.backButton=hu,p.biometry=mu,p.checkHomeScreenStatus=Ru,p.checkHomeScreenStatusFp=ks,p.closingBehavior=bu,p.cloudStorage=wu,p.copyTextToClipboard=$c,p.createLogger=Gn,p.createPostEvent=va,p.createRequestId=_t,p.createStartParam=ka,p.createStartParamFp=Jr,p.debug=Dr,p.decodeBase64Url=Sa,p.decodeBase64UrlFp=Xt,p.decodeStartParam=$a,p.decodeStartParamFp=Qr,p.deepSnakeToCamelObjKeys=Vt,p.deviceStorage=Fu,p.downloadFile=Ac,p.downloadFileFp=Ns,p.emitEvent=ut,p.encodeBase64Url=en,p.getCurrentTime=Mc,p.getCurrentTimeFp=Hs,p.getReleaseVersion=Yt,p.hapticFeedback=qu,p.hideKeyboard=Lc,p.hideKeyboardFp=zs,p.init=el,p.initData=Ou,p.initFp=ti,p.invoice=Du,p.invokeCustomMethod=bs,p.isAnyRGB=ar,p.isColorDark=vn,p.isColorDarkFp=Ms,p.isRGB=Ne,p.isRGBA=or,p.isRGBAShort=ir,p.isRGBShort=sr,p.isSafeToCreateStartParam=Ea,p.isTMA=ma,p.isTMAFp=Zt,p.locationManager=Yu,p.logger=pe,p.mainButton=ec,p.miniApp=Rs,p.mockTelegramEnv=ga,p.off=Ce,p.offAll=fa,p.on=te,p.openLink=Gu,p.openLinkFp=Is,p.openTelegramLink=Hu,p.openTelegramLinkFp=mn,p.parseInitDataQuery=Co,p.parseInitDataQueryFp=fr,p.parseLaunchParamsQuery=dr,p.parseLaunchParamsQueryFp=ot,p.popup=sc,p.postEvent=hs,p.postEventFp=$e,p.qrScanner=bc,p.readTextFromClipboard=Oc,p.readTextFromClipboardFp=Ks,p.request=fu,p.request2=du,p.request2Fp=fn,p.requestContact=fc,p.requestContactComplete=hc,p.requestContactCompleteFp=Fn,p.requestContactFp=Os,p.requestEmojiStatusAccess=ku,p.requestEmojiStatusAccessFp=ys,p.requestFp=_s,p.requestPhoneAccess=ac,p.requestPhoneAccessFp=yn,p.requestWriteAccess=mc,p.requestWriteAccessFp=js,p.retrieveAndroidDeviceData=jc,p.retrieveAndroidDeviceDataFrom=Js,p.retrieveLaunchParams=sa,p.retrieveLaunchParamsFp=Be,p.retrieveRawInitData=ia,p.retrieveRawInitDataFp=zt,p.retrieveRawLaunchParams=oa,p.retrieveRawLaunchParamsFp=He,p.secondaryButton=wc,p.secureStorage=Fc,p.sendData=Wc,p.sendDataFp=Qs,p.serializeInitDataQuery=mr,p.serializeLaunchParamsQuery=gr,p.setDebug=ca,p.setEmojiStatus=Iu,p.setEmojiStatusFp=Fs,p.setTargetOrigin=la,p.settingsButton=Sc,p.shareMessage=Nc,p.shareMessageFp=Zs,p.shareStory=Kc,p.shareStoryFp=Ys,p.shareURL=Ju,p.shareURLFp=As,p.supports=he,p.swipeBehavior=kc,p.switchInlineQuery=Zc,p.switchInlineQueryFp=Xs,p.targetOrigin=Ur,p.themeParams=Ze,p.toRGB=bo,p.toRGBFp=cr,p.toRGBFull=vo,p.toRGBFullFp=it,p.viewport=Xc,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),p}({});
|
|
1
|
+
var yu=Object.defineProperty;var Fu=(p,X,$e)=>X in p?yu(p,X,{enumerable:!0,configurable:!0,writable:!0,value:$e}):p[X]=$e;var s=(p,X,$e)=>Fu(p,typeof X!="symbol"?X+"":X,$e);this.tmajs=this.tmajs||{};this.tmajs.sdk=function(p){"use strict";let X;function $e(t,e){X?X.set(t,e):e()}function Je(t){if(X)return t();X=new Map;try{t()}finally{X.forEach(e=>e()),X=void 0}}function W(t,e){e||(e={});const n=e.equals||Object.is;let r=[],o=t;const i=l=>{if(!n(o,l)){const d=o;o=l,$e(c,()=>{[...r].forEach(([f,b])=>{f(l,d),b&&u(f,!0)})})}};function a(l){const d=typeof l!="object"?{once:l}:l;return{once:d.once||!1,signal:d.signal||!1}}const u=(l,d)=>{const f=a(d),b=r.findIndex(([w,F])=>w===l&&F.once===f.once&&F.signal===f.signal);b>=0&&r.splice(b,1)},c=Object.assign(function(){return Es(c),o},{destroy(){r=[]},set:i,reset(){i(t)},sub(l,d){return r.push([l,a(d)]),()=>u(l,d)},unsub:u,unsubAll(){r=r.filter(l=>l[1].signal)}});return c}const Le=[];function Es(t){Le.length&&Le[Le.length-1].add(t)}function S(t,e){let n=new Set,r;function o(){return r||(r=W(a(),e))}function i(){o().set(a())}function a(){n.forEach(l=>{l.unsub(i,{signal:!0})});const u=new Set;let c;Le.push(u);try{c=t()}finally{Le.pop()}return u.forEach(l=>{l.sub(i,{signal:!0})}),n=u,c}return Object.assign(function(){return o()()},{destroy(){o().destroy()},sub(...u){return o().sub(...u)},unsub(...u){o().unsub(...u)},unsubAll(...u){o().unsubAll(...u)}})}var $s=function(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))};function Is(t){return t}function vn(t,e,n,r,o,i,a,u,c){switch(arguments.length){case 1:return t;case 2:return function(){return e(t.apply(this,arguments))};case 3:return function(){return n(e(t.apply(this,arguments)))};case 4:return function(){return r(n(e(t.apply(this,arguments))))};case 5:return function(){return o(r(n(e(t.apply(this,arguments)))))};case 6:return function(){return i(o(r(n(e(t.apply(this,arguments))))))};case 7:return function(){return a(i(o(r(n(e(t.apply(this,arguments)))))))};case 8:return function(){return u(a(i(o(r(n(e(t.apply(this,arguments))))))))};case 9:return function(){return c(u(a(i(o(r(n(e(t.apply(this,arguments)))))))))}}}function h(t,e,n,r,o,i,a,u,c){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return n(e(t));case 4:return r(n(e(t)));case 5:return o(r(n(e(t))));case 6:return i(o(r(n(e(t)))));case 7:return a(i(o(r(n(e(t))))));case 8:return u(a(i(o(r(n(e(t)))))));case 9:return c(u(a(i(o(r(n(e(t))))))));default:{for(var l=arguments[0],d=1;d<arguments.length;d++)l=arguments[d](l);return l}}}var Re=function(t,e){var n=typeof t=="number"?function(r){return r.length>=t}:t;return function(){var r=Array.from(arguments);return n(arguments)?e.apply(this,r):function(o){return e.apply(void 0,$s([o],r,!1))}}},As={_tag:"None"},qs=function(t){return{_tag:"Some",value:t}},Ts=function(t){return t._tag==="Left"},yn=function(t){return{_tag:"Left",left:t}},Fn=function(t){return{_tag:"Right",right:t}},dt={};function Ms(t,e){return function(n){return function(r){return t.ap(t.map(r,function(o){return function(i){return e.ap(o,i)}}),n)}}}function Bs(t,e){return function(n){return function(r){return t.map(r,function(o){return e.map(o,n)})}}}function ft(t){return function(e,n){return function(r){return t.chain(r,function(o){return t.map(n(o),function(i){var a;return Object.assign({},o,(a={},a[e]=i,a))})})}}}var ye=As,Ie=qs,Ps=function(t,e){return h(t,Vs(e))},Ls=function(t,e){return h(t,js(e))},Rs="Option",Vs=function(t){return function(e){return Ve(e)?ye:Ie(t(e.value))}},Os=Ie,js=function(t){return function(e){return Ve(e)||Ve(t)?ye:Ie(e.value(t.value))}},Ds=Re(2,function(t,e){return Ve(t)?ye:e(t.value)}),Us={URI:Rs,map:Ps,ap:Ls,chain:Ds},Ve=function(t){return t._tag==="None"},Ws=function(t,e){return function(n){return Ve(n)?t():e(n.value)}},_t=Ws,Gs=Os(dt),Sn=ft(Us),M=yn,k=Fn,mt=Re(2,function(t,e){return fe(t)?t:e(t.right)}),bt=function(t,e){return h(t,z(e))},Cn=function(t,e){return h(t,zs(e))},gt="Either",z=function(t){return function(e){return fe(e)?e:k(t(e.right))}},xs={URI:gt,map:bt},Ns=k,Hs=function(t){return function(e){return fe(e)?e:fe(t)?t:k(e.right(t.right))}},zs=Hs,Ks={URI:gt,map:bt,ap:Cn},Js={URI:gt,map:bt,ap:Cn,chain:mt},Qs=function(t,e){return function(n){return fe(n)?M(t(n.left)):k(e(n.right))}},Zs=function(t){return function(e){return fe(e)?M(t(e.left)):e}},fe=Ts,wt=function(t,e){return function(n){return fe(n)?t(n.left):e(n.right)}},Xs=wt,ae=wt,Ys=ae,Ae=function(t,e){try{return k(t())}catch(n){return M(e(n))}},ei=Ns(dt),ti=ft(Js),kn=ti,ni=mt,ri=mt;function si(t){return vn(k,t.of)}function ii(t){return vn(M,t.of)}function oi(t){return Bs(t,xs)}function ai(t){return Ms(t,Ks)}function ui(t){return function(e,n){return t.chain(e,function(r){return fe(r)?t.of(r):n(r.right)})}}function ci(t){return function(e,n,r){return t.map(e,Qs(n,r))}}function li(t){return function(e,n){return function(r){return t.map(r,ae(e,n))}}}var pi=function(t){return Ae(function(){return JSON.parse(t)},Is)},vt=function(t,e){return h(t,hi(e))},En=function(t,e){return h(t,di(e))},hi=function(t){return function(e){return function(){return Promise.resolve().then(e).then(t)}}},di=function(t){return function(e){return function(){return Promise.all([Promise.resolve().then(e),Promise.resolve().then(t)]).then(function(n){var r=n[0],o=n[1];return r(o)})}}},yt=function(t){return function(){return Promise.resolve(t)}},fi=Re(2,function(t,e){return function(){return Promise.resolve().then(t).then(function(n){return e(n)()})}}),Ft="Task",St={URI:Ft,map:vt},$n={of:yt},_i={URI:Ft,map:vt,ap:En},mi={URI:Ft,map:vt,of:yt,ap:En,chain:fi},bi=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function u(d){try{l(r.next(d))}catch(f){a(f)}}function c(d){try{l(r.throw(d))}catch(f){a(f)}}function l(d){d.done?i(d.value):o(d.value).then(u,c)}l((r=r.apply(t,e||[])).next())})},gi=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(l){return function(d){return c([l,d])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(d){l=[6,d],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},D=ii($n),P=si($n),Ct=yt,Qe=li(St),wi=Qe,In=function(t,e){return function(){return bi(void 0,void 0,void 0,function(){var n;return gi(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t().then(Fn)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,yn(e(n))];case 3:return[2]}})})}},vi=function(t,e){return h(t,A(e))},yi=function(t,e){return h(t,Fi(e))},A=oi(St),Oe=Re(3,ci(St)),Fi=ai(_i),kt=Re(2,ui(mi)),Si=P,Ci="TaskEither",ki={URI:Ci,map:vi,ap:yi,chain:kt},Ei=Si(dt),$i=ft(ki),Ze=$i,te=kt,ue=kt;function Y(t){return typeof t=="function"?t():t}class je{constructor({onMounted:e,restoreState:n,initialState:r,onUnmounted:o,isPageReload:i}){s(this,"_isMounted",W(!1));s(this,"isMounted",S(this._isMounted));s(this,"mount");s(this,"unmount");this.mount=()=>{if(this.isMounted())return k(void 0);const a=Y(i)?n():void 0,u=a?k(a):typeof r=="function"?r():k(r);return h(u,z(c=>{Je(()=>{this._isMounted.set(!0),e==null||e(c)})}))},this.unmount=()=>{this._isMounted()&&Je(()=>{this._isMounted.set(!1),o==null||o()})}}}function Et(t){const e={};for(const n in t){const r=t[n];r!==void 0&&(e[n]=r)}return e}function $t(t,e){const n=Object.keys(t),r=Object.keys(e);return n.length!==r.length?!1:n.every(o=>Object.prototype.hasOwnProperty.call(e,o)&&t[o]===e[o])}class _e{constructor({initialState:e,onChange:n}){s(this,"_state");s(this,"state");s(this,"setState",e=>{const n={...this.state(),...Et(e)};$t(n,this.state())||this._state.set(n)});this._state=W(e,{equals:$t}),this.state=S(this._state),this.state.sub(n)}getter(e){return S(()=>this._state()[e])}hasDiff(e){return!$t({...this.state(),...Et(e)},this.state())}}var ce;function It(t){return{lang:(t==null?void 0:t.lang)??(ce==null?void 0:ce.lang),message:t==null?void 0:t.message,abortEarly:(t==null?void 0:t.abortEarly)??(ce==null?void 0:ce.abortEarly),abortPipeEarly:(t==null?void 0:t.abortPipeEarly)??(ce==null?void 0:ce.abortPipeEarly)}}var At;function Ii(t){return At==null?void 0:At.get(t)}var qt;function Ai(t){return qt==null?void 0:qt.get(t)}var Tt;function qi(t,e){var n;return(n=Tt==null?void 0:Tt.get(t))==null?void 0:n.get(e)}function Ti(t){var n,r;const e=typeof t;return e==="string"?`"${t}"`:e==="number"||e==="bigint"||e==="boolean"?`${t}`:e==="object"||e==="function"?(t&&((r=(n=Object.getPrototypeOf(t))==null?void 0:n.constructor)==null?void 0:r.name))??"null":e}function J(t,e,n,r,o){const i=o&&"input"in o?o.input:n.value,a=(o==null?void 0:o.expected)??t.expects??null,u=(o==null?void 0:o.received)??Ti(i),c={kind:t.kind,type:t.type,input:i,expected:a,received:u,message:`Invalid ${e}: ${a?`Expected ${a} but r`:"R"}eceived ${u}`,requirement:t.requirement,path:o==null?void 0:o.path,issues:o==null?void 0:o.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=t.kind==="schema",d=(o==null?void 0:o.message)??t.message??qi(t.reference,c.lang)??(l?Ai(c.lang):null)??r.message??Ii(c.lang);d!==void 0&&(c.message=typeof d=="function"?d(c):d),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function Q(t){return{version:1,vendor:"valibot",validate(e){return t["~run"]({value:e},It())}}}function An(t,e){return Object.hasOwn(t,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function Mi(t,e){const n=[...new Set(t)];return n.length>1?`(${n.join(` ${e} `)})`:n[0]??"never"}var Bi=class extends Error{constructor(t){super(t[0].message),this.name="ValiError",this.issues=t}};function Xe(t,e){return{kind:"validation",type:"check",reference:Xe,async:!1,expects:null,requirement:t,message:e,"~run"(n,r){return n.typed&&!this.requirement(n.value)&&J(this,"input",n,r),n}}}function Mt(t){return{kind:"validation",type:"integer",reference:Mt,async:!1,expects:null,requirement:Number.isInteger,message:t,"~run"(e,n){return e.typed&&!this.requirement(e.value)&&J(this,"integer",e,n),e}}}function le(t){return{kind:"transformation",type:"transform",reference:le,async:!1,operation:t,"~run"(e){return e.value=this.operation(e.value),e}}}function Pi(t,e,n){return typeof t.fallback=="function"?t.fallback(e,n):t.fallback}function Bt(t,e,n){return typeof t.default=="function"?t.default(e,n):t.default}function Pt(t,e){return!t["~run"]({value:e},{abortEarly:!0}).issues}function qn(){return{kind:"schema",type:"any",reference:qn,expects:"any",async:!1,get"~standard"(){return Q(this)},"~run"(t){return t.typed=!0,t}}}function Tn(t,e){return{kind:"schema",type:"array",reference:Tn,expects:"Array",async:!1,item:t,message:e,get"~standard"(){return Q(this)},"~run"(n,r){var i;const o=n.value;if(Array.isArray(o)){n.typed=!0,n.value=[];for(let a=0;a<o.length;a++){const u=o[a],c=this.item["~run"]({value:u},r);if(c.issues){const l={type:"array",origin:"value",input:o,key:a,value:u};for(const d of c.issues)d.path?d.path.unshift(l):d.path=[l],(i=n.issues)==null||i.push(d);if(n.issues||(n.issues=c.issues),r.abortEarly){n.typed=!1;break}}c.typed||(n.typed=!1),n.value.push(c.value)}}else J(this,"type",n,r);return n}}}function Fe(t){return{kind:"schema",type:"boolean",reference:Fe,expects:"boolean",async:!1,message:t,get"~standard"(){return Q(this)},"~run"(e,n){return typeof e.value=="boolean"?e.typed=!0:J(this,"type",e,n),e}}}function Ye(t){return{kind:"schema",type:"date",reference:Ye,expects:"Date",async:!1,message:t,get"~standard"(){return Q(this)},"~run"(e,n){return e.value instanceof Date?isNaN(e.value)?J(this,"type",e,n,{received:'"Invalid Date"'}):e.typed=!0:J(this,"type",e,n),e}}}function Lt(t){return{kind:"schema",type:"function",reference:Lt,expects:"Function",async:!1,message:t,get"~standard"(){return Q(this)},"~run"(e,n){return typeof e.value=="function"?e.typed=!0:J(this,"type",e,n),e}}}function Rt(t,e){return{kind:"schema",type:"instance",reference:Rt,expects:t.name,async:!1,class:t,message:e,get"~standard"(){return Q(this)},"~run"(n,r){return n.value instanceof this.class?n.typed=!0:J(this,"type",n,r),n}}}function G(t,e){return{kind:"schema",type:"loose_object",reference:G,expects:"Object",async:!1,entries:t,message:e,get"~standard"(){return Q(this)},"~run"(n,r){var i;const o=n.value;if(o&&typeof o=="object"){n.typed=!0,n.value={};for(const a in this.entries){const u=this.entries[a];if(a in o||(u.type==="exact_optional"||u.type==="optional"||u.type==="nullish")&&u.default!==void 0){const c=a in o?o[a]:Bt(u),l=u["~run"]({value:c},r);if(l.issues){const d={type:"object",origin:"value",input:o,key:a,value:c};for(const f of l.issues)f.path?f.path.unshift(d):f.path=[d],(i=n.issues)==null||i.push(f);if(n.issues||(n.issues=l.issues),r.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value[a]=l.value}else if(u.fallback!==void 0)n.value[a]=Pi(u);else if(u.type!=="exact_optional"&&u.type!=="optional"&&u.type!=="nullish"&&(J(this,"key",n,r,{input:void 0,expected:`"${a}"`,path:[{type:"object",origin:"key",input:o,key:a,value:o[a]}]}),r.abortEarly))break}if(!n.issues||!r.abortEarly)for(const a in o)An(o,a)&&!(a in this.entries)&&(n.value[a]=o[a])}else J(this,"type",n,r);return n}}}function qe(t,e){return{kind:"schema",type:"nullish",reference:qe,expects:`(${t.expects} | null | undefined)`,async:!1,wrapped:t,default:e,get"~standard"(){return Q(this)},"~run"(n,r){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=Bt(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function me(t){return{kind:"schema",type:"number",reference:me,expects:"number",async:!1,message:t,get"~standard"(){return Q(this)},"~run"(e,n){return typeof e.value=="number"&&!isNaN(e.value)?e.typed=!0:J(this,"type",e,n),e}}}function q(t,e){return{kind:"schema",type:"optional",reference:q,expects:`(${t.expects} | undefined)`,async:!1,wrapped:t,default:e,get"~standard"(){return Q(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=Bt(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function Vt(t,e,n){return{kind:"schema",type:"record",reference:Vt,expects:"Object",async:!1,key:t,value:e,message:n,get"~standard"(){return Q(this)},"~run"(r,o){var a,u;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const c in i)if(An(i,c)){const l=i[c],d=this.key["~run"]({value:c},o);if(d.issues){const b={type:"object",origin:"key",input:i,key:c,value:l};for(const w of d.issues)w.path=[b],(a=r.issues)==null||a.push(w);if(r.issues||(r.issues=d.issues),o.abortEarly){r.typed=!1;break}}const f=this.value["~run"]({value:l},o);if(f.issues){const b={type:"object",origin:"value",input:i,key:c,value:l};for(const w of f.issues)w.path?w.path.unshift(b):w.path=[b],(u=r.issues)==null||u.push(w);if(r.issues||(r.issues=f.issues),o.abortEarly){r.typed=!1;break}}(!d.typed||!f.typed)&&(r.typed=!1),d.typed&&(r.value[d.value]=f.value)}}else J(this,"type",r,o);return r}}}function y(t){return{kind:"schema",type:"string",reference:y,expects:"string",async:!1,message:t,get"~standard"(){return Q(this)},"~run"(e,n){return typeof e.value=="string"?e.typed=!0:J(this,"type",e,n),e}}}function Mn(t){let e;if(t)for(const n of t)e?e.push(...n.issues):e=n.issues;return e}function et(t,e){return{kind:"schema",type:"union",reference:et,expects:Mi(t.map(n=>n.expects),"|"),async:!1,options:t,message:e,get"~standard"(){return Q(this)},"~run"(n,r){let o,i,a;for(const u of this.options){const c=u["~run"]({value:n.value},r);if(c.typed)if(c.issues)i?i.push(c):i=[c];else{o=c;break}else a?a.push(c):a=[c]}if(o)return o;if(i){if(i.length===1)return i[0];J(this,"type",n,r,{issues:Mn(i)}),n.typed=!0}else{if((a==null?void 0:a.length)===1)return a[0];J(this,"type",n,r,{issues:Mn(a)})}return n}}}function Ot(){return{kind:"schema",type:"unknown",reference:Ot,expects:"unknown",async:!1,get"~standard"(){return Q(this)},"~run"(t){return t.typed=!0,t}}}function be(t,e,n){const r=t["~run"]({value:e},It(n));if(r.issues)throw new Bi(r.issues);return r.value}function ie(...t){return{...t[0],pipe:t,get"~standard"(){return Q(this)},"~run"(e,n){for(const r of t)if(r.kind!=="metadata"){if(e.issues&&(r.kind==="schema"||r.kind==="transformation")){e.typed=!1;break}(!e.issues||!n.abortEarly&&!n.abortPipeEarly)&&(e=r["~run"](e,n))}return e}}}function jt(t,e,n){const r=t["~run"]({value:e},It(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var Li=Object.defineProperty,Ri=(t,e,n)=>e in t?Li(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Bn=(t,e,n)=>Ri(t,typeof e!="symbol"?e+"":e,n),Vi=Object.defineProperty,Oi=(t,e,n)=>e in t?Vi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Dt=(t,e,n)=>Oi(t,typeof e!="symbol"?e+"":e,n);function Pn(t){return e=>e instanceof t}function Ln(t,e){const n=class extends Error{constructor(...o){const i=typeof e=="function"?e(...o):typeof e=="string"?[e]:e||[];super(...i),this.name=t}};Dt(n,"is",Pn(n));let r=n;return Object.defineProperty(r,"name",{value:t}),r}function ji(t,e,n){const r=class extends Ln(t,n){constructor(...i){super(...i),Dt(this,"data"),this.data=e(...i)}};Dt(r,"is",Pn(r));let o=r;return Object.defineProperty(o,"name",{value:t}),o}let Rn=class extends Ln("CancelledError","Promise was canceled"){},Ut=class extends ji("TimeoutError",e=>({timeout:e}),(e,n)=>[`Timeout reached: ${e}ms`,{cause:n}]){};const Di=Symbol("resolved");function Ui(t){return{tag:Di,value:t}}function Vn(t,e){return t.reject=e.reject,t.resolve=e.resolve,t}let De=class wn extends Promise{constructor(e,n){let r,o,i,a;typeof e=="function"?(i=e,a=n||{}):a=e||{};let u,c;const l=()=>!!c,d=()=>!!u;let f={};const b=[],w=()=>{b.forEach(g=>g()),b.splice(0,b.length),f={}},F=new AbortController,C=()=>d()||l();super((g,v)=>{const{abortOnResolve:m=!0,abortOnReject:O=!0}=a;o=$=>{var V,L;C()||(g($),u=[$],(V=f.resolved)==null||V.forEach(x=>x($)),(L=f.finalized)==null||L.forEach(x=>x({kind:"resolved",result:$})),w(),m&&F.abort(Ui($)))},r=$=>{var V,L;C()||(v($),c=[$],(V=f.rejected)==null||V.forEach(x=>x($)),(L=f.finalized)==null||L.forEach(x=>x({kind:"rejected",reason:$})),w(),O&&F.abort($))};const{abortSignal:j}=a;if(j){if(j.aborted)return r(j.reason);const $=()=>{r(j.reason)};j.addEventListener("abort",$,!0),b.push(()=>{j.removeEventListener("abort",$,!0)})}const{timeout:U}=a;if(U){const $=setTimeout(()=>{r(new Ut(U))},U);b.push(()=>{clearTimeout($)})}try{const $=()=>{},V=i&&i(o,r,{abortSignal:F.signal,get isRejected(){return l()},get isResolved(){return d()},on(L,x){if(u||c){if(L==="finalized"){const Pe=u?{kind:"resolved",result:u[0]}:{kind:"rejected",reason:c[0]};x(Pe)}else L==="resolved"&&u?x(u[0]):L==="rejected"&&c&&x(c[0]);return $}return f[L]||(f[L]=[]),f[L].push(x),()=>{const Pe=f[L]||[],Ke=Pe.indexOf(x);Ke>=0&&Pe.splice(Ke,1)}},get result(){return u==null?void 0:u[0]},get rejectReason(){return c==null?void 0:c[0]},throwIfRejected(){if(c)throw c[0]}});V instanceof Promise&&V.catch(r)}catch($){r($)}}),Bn(this,"reject"),Bn(this,"resolve"),this.reject=r,this.resolve=o}static fn(e,n){return new wn(async(r,o,i)=>{try{r(await e(i))}catch(a){o(a)}},n)}static resolve(e){return this.fn(()=>e)}static reject(e){return new wn((n,r)=>{r(e)})}cancel(){this.reject(new Rn)}catch(e){return this.then(void 0,e)}finally(e){return Vn(super.finally(e),this)}then(e,n){return Vn(super.then(e,n),this)}};function On(t){return t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Wi(t){return t.replace(/_[a-z]/g,e=>e[1].toUpperCase())}function Gi(t){return Object.entries(t).reduce((e,[n,r])=>(e[Wi(n)]=r,e),{})}function Wt(t){const e=Gi(t);for(const n in e){const r=e[n];r&&typeof r=="object"&&!(r instanceof Date)&&(e[n]=Array.isArray(r)?r.map(Wt):Wt(r))}return e}function xi(t){return t.replace(/_([a-z])/g,(e,n)=>`-${n.toLowerCase()}`)}function jn(t){return`tapps/${t}`}function Gt(t,e){sessionStorage.setItem(jn(t),JSON.stringify(e))}function Dn(t){const e=sessionStorage.getItem(jn(t));try{return e?JSON.parse(e):void 0}catch{}}function Ue(...t){const e=t.flat(1);return[e.push.bind(e),()=>{e.forEach(n=>{n()})}]}function Un(t,e){e||(e={});const{textColor:n,bgColor:r,shouldLog:o}=e,i=o===void 0?!0:o,a=typeof i=="boolean"?()=>i:i,u=(c,l,...d)=>{if(l||a()){const f="font-weight:bold;padding:0 5px;border-radius:100px",[b,w,F]={log:["#0089c3","white","INFO"],error:["#ff0000F0","white","ERR"],warn:["#D38E15","white","WARN"]}[c];console[c](`%c${F} ${Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(new Date)}%c %c${t}`,`${f};background-color:${b};color:${w}`,"",`${f};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...d)}};return[["log","forceLog"],["warn","forceWarn"],["error","forceError"]].reduce((c,[l,d])=>(c[l]=u.bind(void 0,l,!1),c[d]=u.bind(void 0,l,!0),c),{})}function We(t){const e=n=>{throw n};return typeof t=="function"?De.resolve(h(t,Qe(e,n=>n))()):h(t,ae(e,n=>n))}function ne(t){return Object.assign((...e)=>We(t(...e)),t)}const Te=Object.assign((t,e)=>h(In(()=>new De((n,r,o)=>t(i=>n(k(i)),i=>n(M(i)),o),e),n=>n),ue(ae(D,P))),{fn:(t,e)=>Te((n,r,o)=>{const i=t(o);h(typeof i=="function"?i:Ct(i),wi(r,n))()},e)});var Ni=Object.defineProperty,Hi=(t,e,n)=>e in t?Ni(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xt=(t,e,n)=>Hi(t,typeof e!="symbol"?e+"":e,n);function Wn(t){return e=>e instanceof t}function H(t,e){const n=class extends Error{constructor(...i){const a=typeof e=="function"?e(...i):typeof e=="string"?[e]:e||[];super(...a),this.name=t}};xt(n,"is",Wn(n));let r=n;return Object.defineProperty(r,"name",{value:t}),r}function tt(t,e,n){const r=class extends H(t,n){constructor(...a){super(...a),xt(this,"data"),this.data=e(...a)}};xt(r,"is",Wn(r));let o=r;return Object.defineProperty(o,"name",{value:t}),o}function zi(t){const e=n=>{const r={};return new URLSearchParams(n).forEach((o,i)=>{const a=r[i];Array.isArray(a)?a.push(o):a===void 0?r[i]=o:r[i]=[a,o]}),be(t,r)};return ie(et([y(),Rt(URLSearchParams)]),Xe(n=>{try{return e(n),!0}catch{return!1}},"The value doesn't match required schema"),le(e))}function Ki(t){return ie(y(),Xe(e=>{try{return JSON.parse(e),!0}catch{return!1}},"Input is not a valid JSON value"),le(JSON.parse),t)}function ge(t){return ie(y(),Ki(t))}function Nt(t){return ie(et([y(),Rt(URLSearchParams)]),zi(t))}function nt(t){return e=>t.test(e)}const Gn=nt(/^#[\da-f]{3}$/i),xn=nt(/^#[\da-f]{4}$/i),Ge=nt(/^#[\da-f]{6}$/i),Nn=nt(/^#[\da-f]{8}$/i);function Hn(t){return[Ge,Nn,Gn,xn].some(e=>e(t))}function zn(t){let e="#";for(let n=0;n<t.length-1;n+=1)e+=t[1+n].repeat(2);return e}function rt(t){const e=t.replace(/\s/g,"").toLowerCase();if(/^#[\da-f]{3}$/i.test(e))return k(zn(e.toLowerCase()+"f"));if(/^#[\da-f]{4}$/i.test(e))return k(zn(e.toLowerCase()));if(/^#[\da-f]{6}$/i.test(e))return k(e.toLowerCase()+"ff");if(/^#[\da-f]{8}$/i.test(e))return k(e.toLowerCase());const n=e.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||e.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(\d{1,3})\)$/);return n?k(n.slice(1).reduce((r,o)=>r+parseInt(o,10).toString(16).padStart(2,"0"),"#").padEnd(9,"f")):M(new Error(`Value "${t}" does not satisfy any of known RGB formats.`))}function Kn(t){return h(rt(t),z(e=>e.slice(0,7)))}const Ji=ne(Kn),Qi=ne(rt);function Zi(){return G({id:me(),photo_url:q(y()),type:y(),title:y(),username:q(y())})}function Jn(){return G({added_to_attachment_menu:q(Fe()),allows_write_to_pm:q(Fe()),first_name:y(),id:me(),is_bot:q(Fe()),is_premium:q(Fe()),last_name:q(y()),language_code:q(y()),photo_url:q(y()),username:q(y())})}function Xi(){return G({auth_date:ie(y(),le(t=>new Date(Number(t)*1e3)),Ye()),can_send_after:q(ie(y(),le(Number),Mt())),chat:q(ge(Zi())),chat_type:q(y()),chat_instance:q(y()),hash:y(),query_id:q(y()),receiver:q(ge(Jn())),start_param:q(y()),signature:y(),user:q(ge(Jn()))})}function Qn(){return Nt(Xi())}function Ht(){return Vt(y(),ie(et([y(),me()]),le(t=>typeof t=="number"?`#${(t&16777215).toString(16).padStart(6,"0")}`:t),Xe(Hn)))}function Yi(){const t=q(ie(y(),le(e=>e==="1")));return G({tgWebAppBotInline:t,tgWebAppData:q(Qn()),tgWebAppDefaultColors:q(ge(Ht())),tgWebAppFullscreen:t,tgWebAppPlatform:y(),tgWebAppShowSettings:t,tgWebAppStartParam:q(y()),tgWebAppThemeParams:ge(Ht()),tgWebAppVersion:y()})}function eo(){return Nt(Yi())}function Zn(){return G({eventType:y(),eventData:q(Ot())})}function Xn(t){return Ae(()=>be(Qn(),t),e=>e)}function st(t){return Ae(()=>be(eo(),t),e=>e)}const to=ne(Xn),Yn=ne(st);function er(t,e){return e||(e=(n,r)=>JSON.stringify(r)),new URLSearchParams(Object.entries(t).reduce((n,[r,o])=>(Array.isArray(o)?n.push(...o.map(i=>[r,String(i)])):o!=null&&n.push([r,o instanceof Date?(o.getTime()/1e3|0).toString():typeof o=="string"||typeof o=="number"?String(o):typeof o=="boolean"?o?"1":"0":e(r,o)]),n),[])).toString()}function tr(t){return er(t)}function nr(t){return er(t,(e,n)=>e==="tgWebAppData"?tr(n):JSON.stringify(n))}function no(t){return{all:t=t||new Map,on:function(e,n){var r=t.get(e);r?r.push(n):t.set(e,[n])},off:function(e,n){var r=t.get(e);r&&(n?r.splice(r.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var r=t.get(e);r&&r.slice().map(function(o){o(n)}),(r=t.get("*"))&&r.slice().map(function(o){o(e,n)})}}}function rr(t){return Pt(G({TelegramWebviewProxy:G({postEvent:Lt()})}),t)}function sr(){try{return window.self!==window.top}catch{return!0}}class ir extends H("MethodUnsupportedError",(e,n)=>[`Method "${e}" is unsupported in Mini Apps version ${n}`]){}class or extends H("MethodParameterUnsupportedError",(e,n,r)=>[`Parameter "${n}" of "${e}" method is unsupported in Mini Apps version ${r}`]){}class ar extends tt("LaunchParamsRetrieveError",e=>({errors:e}),e=>[["Unable to retrieve launch parameters from any known source. Perhaps, you have opened your app outside Telegram?","📖 Refer to docs for more information:","https://docs.telegram-mini-apps.com/packages/tma-js-bridge/environment","","Collected errors:",...e.map(({source:n,error:r})=>`Source: ${n} / ${r instanceof Error?r.message:String(r)}`)].join(`
|
|
2
|
+
`)]){}class ur extends H("InvalidLaunchParamsError",(e,n)=>[`Invalid value for launch params: ${e}`,{cause:n}]){}class zt extends H("UnknownEnvError"){}class cr extends H("InvokeCustomMethodError",e=>[`Server returned error: ${e}`]){}const lr="launchParams";function pr(t){return t.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&")}function Me(){return h(xe(),ni(st))}const ro=ne(Me);function Kt(){return h(xe(),z(t=>{const e=new URLSearchParams(t).get("tgWebAppData");return e?Ie(e):ye}))}function so(){return h(Kt(),Ys(t=>{throw t},t=>t),_t(()=>{},t=>t))}function xe(){const t=[];for(const[e,n]of[[()=>pr(window.location.href),"window.location.href"],[()=>{const r=performance.getEntriesByType("navigation")[0];return r&&pr(r.name)},"performance navigation entries"],[()=>Dn(lr),"local storage"]]){const r=e();if(!r){t.push({source:n,error:new Error("Source is empty")});continue}const o=h(st(r),Xs(i=>i,()=>!0));if(typeof o!="boolean"){t.push({source:n,error:o});continue}return Gt(lr,r),k(r)}return M(new ar(t))}const io=ne(xe);function oo(t,e){const n=new Map,r=no(),o=(i,a,u=!1)=>{const c=n.get(i)||new Map;n.set(i,c);const l=c.get(a)||[];c.set(a,l);const d=l.findIndex(f=>f[1]===u);if(d>=0&&(r.off(i,l[d][0]),l.splice(d,1),!l.length&&(c.delete(a),!c.size))){const f=n.size;n.delete(i),f&&!n.size&&e()}};return{on(i,a,u){!n.size&&t();const c=()=>{o(i,a,u)},l=(...b)=>{u&&c(),i==="*"?a({name:b[0],payload:b[1]}):a(...b)};r.on(i,l);const d=n.get(i)||new Map;n.set(i,d);const f=d.get(a)||[];return d.set(a,f),f.push([l,u||!1]),c},off:o,emit:r.emit,clear(){const i=n.size;r.all.clear(),n.clear(),i&&e()}}}function it(t,e){window.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({eventType:t,eventData:e}),source:window.parent}))}const Jt=W(!1),hr=W("https://web.telegram.org"),ao=t=>{pe().log("Event received:",t)},dr=S(Jt);function uo(t){t!==Jt()&&(Jt.set(t),(t?ee:Se)("*",ao))}const fr=S(hr);function co(t){hr.set(t),pe().log("New target origin set",t)}const ot=W((...t)=>{window.parent.postMessage(...t)}),pe=W(Un("Bridge",{bgColor:"#9147ff",textColor:"white",shouldLog:dr}));function Qt(t,e,n){const r=[n],o=t[e];typeof o=="function"&&r.push(o);const i=(...u)=>{r.forEach(c=>c(...u))},a=Object.assign((...u)=>{i(...u)},{unwrap(){const{length:u}=r;if(u===1){delete t[e];return}if(u===2){br(t,e,r[1]);return}r.unshift(1),br(t,e,i)}});mr(t,e,()=>a,u=>r.push(u))}function _r(t,e){const n=t[e];mr(t,e,()=>n,r=>{Object.entries(r).forEach(([o,i])=>{n[o]=i})})}function mr(t,e,n,r){Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:n,set:r})}function br(t,e,n){Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n})}const lo={clipboard_text_received:G({req_id:y(),data:qe(y())}),custom_method_invoked:G({req_id:y(),result:q(Ot()),error:q(y())}),popup_closed:qe(G({button_id:qe(y(),()=>{})}),{}),viewport_changed:qe(G({height:me(),width:qe(me(),()=>window.innerWidth),is_state_stable:Fe(),is_expanded:Fe()}),()=>({height:window.innerHeight,is_state_stable:!0,is_expanded:!0})),theme_changed:G({theme_params:Ht()})};function gr(t){if(t.source!==window.parent)return;let e;try{e=be(ge(Zn()),t.data)}catch{return}const{eventType:n,eventData:r}=e,o=lo[n];let i;try{i=o?be(o,r):r}catch(a){return pe().forceError([`An error occurred processing the "${n}" event from the Telegram application.`,"Please, file an issue here:","https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose"].join(`
|
|
3
|
+
`),e,a)}po(n,i)}const{on:ee,off:Se,emit:po,clear:ho}=oo(()=>{const t=window;!t.TelegramGameProxy&&(t.TelegramGameProxy={}),Qt(t.TelegramGameProxy,"receiveEvent",it),_r(t,"TelegramGameProxy"),!t.Telegram&&(t.Telegram={}),!t.Telegram.WebView&&(t.Telegram.WebView={}),Qt(t.Telegram.WebView,"receiveEvent",it),_r(t.Telegram,"WebView"),Qt(t,"TelegramGameProxy_receiveEvent",it),window.addEventListener("message",gr)},()=>{[["TelegramGameProxy_receiveEvent"],["TelegramGameProxy","receiveEvent"],["Telegram","WebView","receiveEvent"]].forEach(t=>{const e=window;let n=[void 0,e];for(const i of t)if(n=[n[1],n[1][i]],!n[1])return;const[r,o]=n;"unwrap"in o&&(o.unwrap(),r&&r!==e&&!Object.keys(r).length&&delete e[t[0]])}),window.removeEventListener("message",gr)}),fo=(...t)=>ot()(...t);function _o(t,e){h(at(t,e),Zs(n=>{throw n}))}function at(t,e){pe().log("Posting event:",e?{eventType:t,eventData:e}:{eventType:t});const n=window,r=JSON.stringify({eventType:t,eventData:e});return sr()?(fo(r,fr()),k(void 0)):rr(n)?(n.TelegramWebviewProxy.postEvent(t,JSON.stringify(e)),k(void 0)):Pt(G({external:G({notify:Lt()})}),n)?(n.external.notify(r),k(void 0)):M(new zt)}function Zt(t,e,n={}){const{capture:r=()=>!0,postEvent:o=at}=n,i=W(),[a,u]=Ue();(Array.isArray(e)?e:[e]).forEach(l=>{a(ee(l,d=>{const f=Array.isArray(e);r(f?{event:l,payload:d}:d)&&i.set([f?{event:l,payload:d}:d])}))});const c=l=>(u(),l);return h(async()=>o(t,n.params),ue(()=>Te((l,d,f)=>{const b=i();if(b)return l(b[0]);const w=C=>{C&&l(C[0])},F=()=>{i.unsub(w)};i.sub(w),f.on("finalized",F)},n)),Oe(c,c))}function mo(t,e){const n=Xt(t,e);return typeof n=="function"?De.fn(()=>We(n)):n}function Xt(t,e){const n=rr(window);if(!t)return n||h(xe(),ae(()=>!1,()=>!0));if(n)return P(!0);const{timeout:r=100}=e||{};return h(Zt("web_app_request_theme","theme_changed",{...e,timeout:r}),Qe(o=>Ut.is(o)||zt.is(o)?k(!1):M(o),()=>k(!0)))}function bo({launchParams:t,onEvent:e,resetPostMessage:n}={}){if(t){const i=typeof t=="string"||t instanceof URLSearchParams?t.toString():nr({...t,tgWebAppData:void 0})+(t.tgWebAppData?`&tgWebAppData=${encodeURIComponent(t.tgWebAppData.toString())}`:"");try{Yn(i)}catch(a){throw new ur(i,a)}Gt("launchParams",i)}if(sr()){if(!e)return;n&&ot.reset();const i=ot();ot.set((...a)=>{const[u]=a,c=()=>{i(...a)};try{const l=be(ge(Zn()),u);e({name:l.eventType,params:l.eventData},c)}catch{c()}});return}const r=window.TelegramWebviewProxy||{},o=r.postEvent||(()=>{});window.TelegramWebviewProxy={...r,postEvent(i,a){const u=()=>{o(i,a)};e?e({name:i,params:a?JSON.parse(a):void 0},u):u()}},pe().log("Environment was mocked by the mockTelegramEnv function")}function wr(t){return({req_id:e})=>e===t}const vr={"6.0":["iframe_ready","iframe_will_reload","web_app_close","web_app_data_send","web_app_expand","web_app_open_link","web_app_ready","web_app_request_theme","web_app_request_viewport","web_app_setup_main_button","web_app_setup_closing_behavior"],6.1:["web_app_open_tg_link","web_app_open_invoice","web_app_setup_back_button","web_app_set_background_color","web_app_set_header_color","web_app_trigger_haptic_feedback"],6.2:["web_app_open_popup"],6.4:["web_app_close_scan_qr_popup","web_app_open_scan_qr_popup","web_app_read_text_from_clipboard",{method:"web_app_open_link",param:"try_instant_view"}],6.7:["web_app_switch_inline_query"],6.9:["web_app_invoke_custom_method","web_app_request_write_access","web_app_request_phone",{method:"web_app_set_header_color",param:"color"}],"6.10":["web_app_setup_settings_button"],7.2:["web_app_biometry_get_info","web_app_biometry_open_settings","web_app_biometry_request_access","web_app_biometry_request_auth","web_app_biometry_update_token"],7.6:[{method:"web_app_open_link",param:"try_browser"},{method:"web_app_close",param:"return_back"}],7.7:["web_app_setup_swipe_behavior"],7.8:["web_app_share_to_story"],"7.10":["web_app_setup_secondary_button","web_app_set_bottom_bar_color",{method:"web_app_setup_main_button",param:"has_shine_effect"}],"8.0":["web_app_request_safe_area","web_app_request_content_safe_area","web_app_request_fullscreen","web_app_exit_fullscreen","web_app_set_emoji_status","web_app_add_to_home_screen","web_app_check_home_screen","web_app_request_emoji_status_access","web_app_check_location","web_app_open_location_settings","web_app_request_file_download","web_app_request_location","web_app_send_prepared_message","web_app_start_accelerometer","web_app_start_device_orientation","web_app_start_gyroscope","web_app_stop_accelerometer","web_app_stop_device_orientation","web_app_stop_gyroscope","web_app_toggle_orientation_lock"],"9.0":["web_app_device_storage_clear","web_app_device_storage_get_key","web_app_device_storage_save_key","web_app_secure_storage_clear","web_app_secure_storage_get_key","web_app_secure_storage_restore_key","web_app_secure_storage_save_key"],9.1:["web_app_hide_keyboard"]};function Yt(t,e){return Object.keys(vr).find(n=>vr[n].some(r=>e?typeof r=="object"&&r.method===t&&r.param===e:r===t))||null}function yr(t){return t.split(".").map(Number)}function go(t,e){const n=yr(t),r=yr(e),o=Math.max(n.length,r.length);for(let i=0;i<o;i+=1){const a=n[i]||0,u=r[i]||0;if(a!==u)return a>u?1:-1}return 0}function he(t,e,n){const r=n?Yt(t,e):Yt(t);return r?go(r,n||e)<=0:!1}function wo(t,e="strict"){const n=typeof e=="function"?e:r=>{const{method:o,version:i}=r,a="param"in r?new or(o,r.param,i):new ir(o,i);if(e==="strict")throw a;return pe().forceWarn(a.message)};return(r,o)=>he(r,t)?r==="web_app_set_header_color"&&Pt(G({color:qn()}),o)&&!he(r,"color",t)?n({version:t,method:r,param:"color"}):_o(r,o):n({version:t,method:r})}function vo(t,e,n,r){return h(Zt("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:t,params:e,req_id:n},capture:wr(n)}),te(({result:o,error:i})=>i?D(new cr(i)):P(o)))}function yo(t,e,n={}){const{capture:r=()=>!0,postEvent:o=at}=n,i=W(),[a,u]=Ue();(Array.isArray(e)?e:[e]).forEach(l=>{a(ee(l,d=>{(Array.isArray(e)?r({event:l,payload:d}):r(d))&&i.set([d])}))});const c=l=>(u(),l);return h(async()=>o(t,n.params),ue(()=>Te((l,d,f)=>{const b=i();if(b)return l(b[0]);const w=C=>{C&&l(C[0])},F=()=>{i.unsub(w)};i.sub(w),f.on("finalized",F)},n)),Oe(c,c))}function Fo(){Object.hasOwn||(Object.hasOwn=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)})}function en(t){return Ae(()=>decodeURIComponent(atob(t.replace(/-/g,"+").replace(/_/g,"/")).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")),e=>e)}const So=ne(en);function tn(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,n)=>String.fromCharCode(parseInt(`0x${n}`)))).replace(/\+/g,"-").replace(/\//g,"_")}function Fr(t){const e=tn(typeof t=="string"?t:JSON.stringify(t));return e.length>512?M(new Error("Value is too long for start parameter")):k(e)}const Co=ne(Fr);function ko(t,e){return We(Sr(t,typeof e=="function"?n=>Ae(()=>e(n),r=>r):e))}function Sr(t,e){return h(en(t),ri(n=>e?typeof e=="function"?e(n):pi(n):k(n)))}function Eo(t){return tn(t).length<=512}function oe(t,e){return S(()=>he(t,Y(e)))}function _(t){return Object.assign(ne(t),{ifAvailable(...e){return h(t.ifAvailable(...e),_t(()=>({ok:!1}),n=>({ok:!0,data:We(n)})))}})}function Ce(t){return[t]}class Ne extends tt("ValidationError",(e,n)=>({input:e,issues:n}),"Validation error"){}class ut extends H("CSSVarsBoundError","CSS variables are already bound"){}class Cr extends tt("DeviceStorageMethodError",e=>({error:e}),e=>[e]){}class kr extends tt("SecureStorageMethodError",e=>({error:e}),e=>[e]){}class Er extends H("NotAvailableError",Ce){}class $o extends H("InvalidEnvError",Ce){}class $r extends H("FunctionNotAvailableError",Ce){}class re extends H("InvalidArgumentsError",(e,n)=>[e,{cause:n}]){}class ct extends H("ConcurrentCallError",Ce){}class Ir extends H("SetEmojiStatusError",e=>[`Failed to set emoji status: ${e}`]){}class nn extends H("AccessDeniedError",Ce){}class Ar extends H("FullscreenFailedError",Ce){}class qr extends H("ShareMessageError",Ce){}class Tr extends H("UnknownThemeParamsKeyError",e=>[`Unknown theme params key passed: ${e}`]){}function R(t,e){const n=S(()=>Y(e.version)||"100"),r=S(()=>Y(e.isTma)),{requires:o,returns:i}=e,a=o?typeof o=="object"?o:{every:[o]}:void 0,u=g=>{if(!e.supports)return!0;const v=e.supports[g];return he(v.method,v.param,n())},c=()=>{if(!a)return;const[g,v]="every"in a?["every",a.every]:["some",a.some];for(let m=0;m<v.length;m++){const O=v[m],j=typeof O=="function"?O():he(O,n())?void 0:`it is unsupported in Mini Apps version ${n()}`;if(j&&(g==="every"||m===v.length-1))return j}},l=(...g)=>{for(const v in e.supports)if(e.supports[v].shouldCheck(...g)&&!u(v))return`option ${v} is not supported in Mini Apps version ${n()}`},d=S(()=>!c()),f=S(()=>n()!=="0.0"),b=S(()=>e.isMounted?e.isMounted():!0),w=S(()=>r()&&f()&&d()&&b()),F=g=>{const v=new $r(g);return["task","promise"].includes(e.returns)?D(v):M(v)},C=(...g)=>i==="plain"?Ae(()=>t(...g),v=>v):i==="promise"?In(()=>t(...g),v=>v):t(...g);return Object.assign((...g)=>{var j;const v="Unable to call function:";if(!r())return F(`${v} it can't be called outside Mini Apps`);if(!f())return F(`${v} the SDK was not initialized. Use the SDK init() function`);const m=c();if(m)return F(`${v} ${m}`);const O=l(...g);if(O)return F(`${v} ${O}`);if(!b()){const U=(j=e.isMounting)!=null&&j.call(e)?"mounting. Wait for the mount completion":"unmounted. Use the mount() method";return F(`${v} the component is ${U}`)}return C(...g)},t,{isAvailable:w,ifAvailable(...g){return w()?Ie(C(...g)):ye}},a?{isSupported:d}:{},e.supports?{supports:u}:{})}function T(t){return e=>R(e,t)}class lt{constructor({isTma:e,storage:n,onClick:r,offClick:o,initialState:i,isPageReload:a,postEvent:u,payload:c,method:l,version:d}){s(this,"isMounted");s(this,"isSupported");s(this,"state");s(this,"stateSetters");s(this,"stateBoolSetters");s(this,"setStateFp");s(this,"setState");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");s(this,"mountFp");s(this,"mount");s(this,"unmount");const f=new _e({initialState:i,onChange(g){n.set(g)}}),b=new je({initialState:i,isPageReload:a,onMounted:f.setState,restoreState:n.get}),w={version:d,requires:l,isTma:e},F=T({...w,returns:"plain"}),C=T({...w,returns:"either",isMounted:b.isMounted});this.isMounted=b.isMounted,this.isSupported=oe(l,d),this.state=f.state,this.setStateFp=C(g=>{const v={...this.state(),...Et(g)};return f.hasDiff(v)?h(u(l,c(v)),z(()=>{f.setState(v)})):k(void 0)}),this.setState=_(this.setStateFp),this.onClickFp=F(r),this.onClick=_(this.onClickFp),this.offClickFp=F(o),this.offClick=_(this.offClickFp),this.mountFp=F(()=>{const g=()=>{};return h(b.mount(),ae(g,g))}),this.mount=_(this.mountFp),this.unmount=b.unmount,this.stateSetters=g=>{const v=C(m=>this.setStateFp({[g]:m}));return[_(v),v]},this.stateBoolSetters=g=>{const[,v]=this.stateSetters(g),m=C(()=>v(!1)),O=C(()=>v(!0));return[[_(m),m],[_(O),O]]}}stateGetter(e){return S(()=>this.state()[e])}}class Mr{constructor(e){s(this,"isVisible");s(this,"isMounted");s(this,"isSupported");s(this,"hideFp");s(this,"hide");s(this,"showFp");s(this,"show");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");s(this,"mountFp");s(this,"mount");s(this,"unmount");const n=new lt({...e,method:"web_app_setup_back_button",payload:r=>({is_visible:r.isVisible}),initialState:{isVisible:!1}});this.isVisible=n.stateGetter("isVisible"),this.isMounted=n.isMounted,this.isSupported=n.isSupported,[[this.hide,this.hideFp],[this.show,this.showFp]]=n.stateBoolSetters("isVisible"),this.onClick=n.onClick,this.onClickFp=n.onClickFp,this.offClick=n.offClick,this.offClickFp=n.offClickFp,this.mount=n.mount,this.mountFp=n.mountFp,this.unmount=n.unmount}}function E(){return{isTma:S(()=>Xt())}}function Be(t){return e=>({...e,...Y(t)})}function He(t,e){return W(t,e)}const Br=He(at),ke=(...t)=>Br()(...t),Pr=(...t)=>We(ke(...t)),K=Be({postEvent:ke});function Io(t){return{get:()=>Dn(t),set(e){Gt(t,e)}}}function Ao(){return performance.getEntriesByType("navigation")[0]}function qo(){const t=Ao();return!!t&&t.type==="reload"}function we(t){return Be({storage:Io(t),isPageReload:qo})}const rn=He("0.0"),I=Be({version:rn});function sn(t,e){return{...h(E(),K,I,we(t)),onClick(n,r){return ee(e,n,r)},offClick(n,r){Se(e,n,r)}}}const To=new Mr(sn("backButton","back_button_pressed"));class on{constructor({initialState:e,onMounted:n,restoreState:r,onUnmounted:o,isPageReload:i}){s(this,"_isMounted",W(!1));s(this,"isMounted",S(this._isMounted));s(this,"mount");s(this,"unmount");this.mount=a=>{if(this._isMounted())return P(void 0);const u=Y(i)?r():void 0;return h(u?P(u):e(a),A(c=>{this._isMounted()||Je(()=>{this._isMounted.set(!0),n==null||n(c)})}))},this.unmount=()=>{this._isMounted()&&Je(()=>{this._isMounted.set(!1),o==null||o()})}}}function Lr(){return new Er("Biometry is not available")}function an(t){let e=!1,n=!1,r="",o=!1,i="",a=!1;return t.available&&(e=!0,n=t.token_saved,r=t.device_id,o=t.access_requested,i=t.type,a=t.access_granted),{available:e,tokenSaved:n,deviceId:r,type:i,accessGranted:a,accessRequested:o}}class Rr{constructor({version:e,request:n,postEvent:r,storage:o,onInfoReceived:i,offInfoReceived:a,isTma:u,isPageReload:c}){s(this,"isAvailable");s(this,"isSupported");s(this,"isMounted");s(this,"state");s(this,"authenticateFp");s(this,"authenticate");s(this,"openSettingsFp");s(this,"openSettings");s(this,"requestAccessFp");s(this,"requestAccess");s(this,"updateTokenFp");s(this,"updateToken");s(this,"mountFp");s(this,"mount");s(this,"unmount");const l=g=>{d.setState(an(g))},d=new _e({initialState:{available:!1,type:"unknown",accessGranted:!1,accessRequested:!1,deviceId:"",tokenSaved:!1},onChange:o.set}),f=new on({initialState(g){return h(n("web_app_biometry_get_info","biometry_info_received",g),A(an))},isPageReload:c,onMounted(g){d.setState(g),i(l)},onUnmounted(){a(l)},restoreState:o.get}),b={version:e,requires:"web_app_biometry_request_auth",isTma:u},w=T({...b,returns:"either"}),F=T({...b,returns:"task"}),C=T({...b,isMounted:f.isMounted,returns:"task"});this.isAvailable=d.getter("available"),this.isMounted=f.isMounted,this.isSupported=oe("web_app_biometry_request_auth",e),this.state=d.state,this.unmount=f.unmount,this.mountFp=F(f.mount),this.authenticateFp=C(g=>this.isAvailable()?h(n("web_app_biometry_request_auth","biometry_auth_requested",{...g,params:{reason:((g||{}).reason||"").trim()}}),A(v=>(d.setState({token:v.token}),v))):D(Lr())),this.openSettingsFp=w(()=>r("web_app_biometry_open_settings")),this.requestAccessFp=C(g=>h(n("web_app_biometry_request_access","biometry_info_received",{...g,params:{reason:((g||{}).reason||"").trim()}}),te(v=>{const m=an(v);return m.available?(d.setState(m),P(m.accessRequested)):D(Lr())}))),this.updateTokenFp=C((g={})=>{var v;return h(n("web_app_biometry_update_token","biometry_token_updated",{...g,params:{token:g.token||"",reason:(v=g.reason)==null?void 0:v.trim()}}),A(m=>m.status))}),this.authenticate=_(this.authenticateFp),this.openSettings=_(this.openSettingsFp),this.requestAccess=_(this.requestAccessFp),this.updateToken=_(this.updateTokenFp),this.mount=_(this.mountFp)}}const Vr=(t,e,n)=>yo(t,e,{postEvent:ke,...n}),un=(t,e,n)=>Zt(t,e,{postEvent:ke,...n}),Mo=(...t)=>De.fn(()=>Vr(...t)()),Bo=(...t)=>De.fn(()=>un(...t)()),Z=Be({request:un});function Po(){return new Rr({...h(E(),K,I,Z,we("biometry")),offInfoReceived(t){Se("biometry_info_received",t)},onInfoReceived(t){return ee("biometry_info_received",t)}})}const Lo=Po();class Or{constructor({postEvent:e,storage:n,isTma:r,isPageReload:o}){s(this,"isConfirmationEnabled");s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"disableConfirmationFp");s(this,"disableConfirmation");s(this,"enableConfirmationFp");s(this,"enableConfirmation");const i=new _e({initialState:{isConfirmationEnabled:!1},onChange(f){n.set(f)}}),a=new je({onMounted:i.setState,restoreState:n.get,initialState:{isConfirmationEnabled:!1},isPageReload:o}),u={requires:"web_app_setup_closing_behavior",isTma:r},c=T({...u,returns:"plain"}),l=T({...u,returns:"either",isMounted:a.isMounted}),d=f=>f===this.isConfirmationEnabled()?k(void 0):(i.setState({isConfirmationEnabled:f}),e("web_app_setup_closing_behavior",{need_confirmation:f}));this.isConfirmationEnabled=i.getter("isConfirmationEnabled"),this.isMounted=a.isMounted,this.disableConfirmationFp=l(()=>d(!1)),this.enableConfirmationFp=l(()=>d(!0)),this.mountFp=c(()=>{const f=()=>{};return h(a.mount(),ae(f,f))}),this.unmount=a.unmount,this.disableConfirmation=_(this.disableConfirmationFp),this.enableConfirmation=_(this.enableConfirmationFp),this.mount=_(this.mountFp)}}function Ro(){return new Or(h(E(),we("closingBehavior"),K))}const Vo=Ro();class jr{constructor({version:e,isTma:n,invokeCustomMethod:r}){s(this,"isSupported");s(this,"deleteItemFp");s(this,"deleteItem");s(this,"getItemFp");s(this,"getItem");s(this,"getItemsFp");s(this,"getItems");s(this,"getKeysFp");s(this,"getKeys");s(this,"setItemFp");s(this,"setItem");s(this,"clearFp");s(this,"clear");const o=T({version:e,requires:"web_app_invoke_custom_method",isTma:n,returns:"task"});this.isSupported=oe("web_app_invoke_custom_method",e),this.deleteItemFp=o((i,a)=>{const u=Array.isArray(i)?i:[i];return h(u.length?r("deleteStorageValues",{keys:u},a):P(void 0),A(()=>{}))}),this.getItemFp=o((i,a)=>h(this.getItemsFp([i],a),A(u=>u[i]||""))),this.getItemsFp=o((i,a)=>h(i.length?r("getStorageValues",{keys:i},a):P({}),A(u=>({...i.reduce((c,l)=>(c[l]="",c),{}),...be(Vt(y(),y()),u)})))),this.getKeysFp=o(i=>h(r("getStorageKeys",{},i),A(a=>be(Tn(y()),a)))),this.setItemFp=o((i,a,u)=>h(r("saveStorageValue",{key:i,value:a},u),A(()=>{}))),this.clearFp=o(i=>h(this.getKeysFp(i),te(this.deleteItemFp))),this.deleteItem=_(this.deleteItemFp),this.getItem=_(this.getItemFp),this.getItems=_(this.getItemsFp),this.getKeys=_(this.getKeysFp),this.setItem=_(this.setItemFp),this.clear=_(this.clearFp)}}const cn=He(0);function pt(){return cn.set(cn()+1),cn().toString()}function Dr(t,e,n){return vo(t,e,pt(),{...n||{},postEvent:ke})}const ln=Be({invokeCustomMethod:Dr});function Oo(){return new jr(h(E(),I,ln))}const jo=Oo();class Ur{constructor({isTma:e,request:n,version:r,createRequestId:o}){s(this,"getItemFp");s(this,"getItem");s(this,"setItemFp");s(this,"setItem");s(this,"deleteItemFp");s(this,"deleteItem");s(this,"clearFp");s(this,"clear");const i=T({version:r,requires:"web_app_device_storage_get_key",isTma:e,returns:"task"}),a=(u,c,l)=>{const d=o();return h(n(u,["device_storage_failed",c],{params:{...l,req_id:d},capture:f=>"payload"in f?f.payload.req_id===d:!0}),te(f=>f.event==="device_storage_failed"?D(new Cr(f.payload.error||"UNKNOWN_ERROR")):P(f.payload)))};this.getItemFp=i(u=>h(a("web_app_device_storage_get_key","device_storage_key_received",{key:u}),A(c=>c.value))),this.setItemFp=i((u,c)=>h(a("web_app_device_storage_save_key","device_storage_key_saved",{key:u,value:c}),A(()=>{}))),this.deleteItemFp=i(u=>this.setItemFp(u,null)),this.clearFp=i(()=>h(a("web_app_device_storage_clear","device_storage_cleared",{}),A(()=>{}))),this.getItem=_(this.getItemFp),this.setItem=_(this.setItemFp),this.deleteItem=_(this.deleteItemFp),this.clear=_(this.clearFp)}}const Wr=Be({createRequestId:pt});function Do(){return new Ur(h(E(),I,Z,Wr))}const Uo=Do();function Wo({request:t,...e}){return R(n=>h(t("web_app_request_emoji_status_access","emoji_status_access_requested",n),A(r=>r.status)),{...e,requires:"web_app_request_emoji_status_access",returns:"task"})}function Go(){return Wo(h(E(),I,Z))}const Gr=Go(),xo=_(Gr);function No({request:t,...e}){return R((n,r)=>h(t("web_app_set_emoji_status",["emoji_status_set","emoji_status_failed"],{params:{custom_emoji_id:n,duration:(r||{}).duration},...r}),ue(o=>o.event==="emoji_status_failed"?D(new Ir(o.payload.error)):P(void 0))),{...e,requires:"web_app_set_emoji_status",returns:"task"})}function Ho(){return No(h(E(),Z,I))}const xr=Ho(),zo=_(xr);class Nr{constructor({postEvent:e,isTma:n,version:r}){s(this,"isSupported");s(this,"impactOccurredFp");s(this,"impactOccurred");s(this,"notificationOccurredFp");s(this,"notificationOccurred");s(this,"selectionChangedFp");s(this,"selectionChanged");const o="web_app_trigger_haptic_feedback",i=T({requires:o,isTma:n,version:r,returns:"plain"});this.isSupported=oe(o,r),this.impactOccurredFp=i(a=>e(o,{type:"impact",impact_style:a})),this.notificationOccurredFp=i(a=>e(o,{type:"notification",notification_type:a})),this.selectionChangedFp=i(()=>e(o,{type:"selection_change"})),this.impactOccurred=_(this.impactOccurredFp),this.notificationOccurred=_(this.notificationOccurredFp),this.selectionChanged=_(this.selectionChangedFp)}}function Ko(){return new Nr(h(E(),K,I))}const Jo=Ko();function Qo({postEvent:t,...e}){return R(()=>t("web_app_add_to_home_screen"),{...e,requires:"web_app_add_to_home_screen",returns:"either"})}function Zo(){return Qo(h(E(),I,K))}const Hr=Zo(),Xo=_(Hr);function Yo({request:t,...e}){return R(n=>h(t("web_app_check_home_screen","home_screen_checked",n),A(r=>r.status||"unknown")),{...e,requires:"web_app_check_home_screen",returns:"task"})}function ea(){return Yo(h(E(),I,Z))}const zr=ea(),ta=_(zr);class Kr{constructor({retrieveInitData:e}){s(this,"_state",W());s(this,"_raw",W());s(this,"state",S(this._state));s(this,"authDate",this.fromState("auth_date"));s(this,"canSendAfter",this.fromState("can_send_after"));s(this,"canSendAfterDate",S(()=>{const e=this.authDate(),n=this.canSendAfter();return n&&e?new Date(e.getTime()+n*1e3):void 0}));s(this,"chat",this.fromState("chat"));s(this,"chatType",this.fromState("chat_type"));s(this,"chatInstance",this.fromState("chat_instance"));s(this,"hash",this.fromState("hash"));s(this,"queryId",this.fromState("query_id"));s(this,"raw",S(this._raw));s(this,"receiver",this.fromState("receiver"));s(this,"signature",this.fromState("signature"));s(this,"startParam",this.fromState("start_param"));s(this,"user",this.fromState("user"));s(this,"restoreFp");s(this,"restore");this.restoreFp=()=>h(e(),z(_t(()=>{},({raw:n,obj:r})=>{this._state.set(r),this._raw.set(n)}))),this.restore=ne(this.restoreFp)}fromState(e){return S(()=>{const n=this._state();return n?n[e]:void 0})}}function na(){return new Kr({retrieveInitData(){return h(ei,kn("obj",()=>h(Me(),z(({tgWebAppData:t})=>t?Ie(t):ye))),kn("raw",Kt),z(({obj:t,raw:e})=>h(Gs,Sn("obj",()=>t),Sn("raw",()=>e))))}})}const ra=na();class Jr{constructor({version:e,request:n,isTma:r}){s(this,"isOpened");s(this,"isSupported");s(this,"openSlugFp");s(this,"openSlug");s(this,"openUrlFp");s(this,"openUrl");const o=T({version:e,isTma:r,requires:"web_app_open_invoice",returns:"task"}),i=W(!1),a=()=>{i.set(!1)};this.isSupported=oe("web_app_open_invoice",e),this.isOpened=S(i),this.openSlugFp=o((u,c)=>h(this.isOpened()?D(new ct("Invoice is already opened")):P(void 0),te(()=>(i.set(!0),n("web_app_open_invoice","invoice_closed",{...c,params:{slug:u},capture:l=>u===l.slug}))),Oe(l=>(a(),l),l=>(a(),l.status)))),this.openUrlFp=o((u,c)=>{const{hostname:l,pathname:d}=new URL(u,window.location.href);if(l!=="t.me")return D(new re(`Link has unexpected hostname: ${l}`));const f=d.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);return f?this.openSlugFp(f[2],c):D(new re('Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"'))}),this.openUrl=_(this.openUrlFp),this.openSlug=_(this.openSlugFp)}}function sa(){return new Jr(h(E(),Z,I))}const ia=sa();function oa({postEvent:t,...e}){return R((n,r={})=>{if(typeof n=="string")try{n=new URL(n)}catch(o){return M(new re(`"${n.toString()}" is invalid URL`,o))}return t("web_app_open_link",{url:n.toString(),try_browser:r.tryBrowser,try_instant_view:r.tryInstantView})},{...e,returns:"either"})}function aa(){return oa(h(E(),K))}const Qr=aa(),ua=_(Qr);function ca({postEvent:t,version:e,...n}){return R(r=>{const o=r.toString();return o.match(/^https:\/\/t.me\/.+/)?he("web_app_open_tg_link",Y(e))?(r=new URL(r),t("web_app_open_tg_link",{path_full:r.pathname+r.search})):(window.location.href=o,k(void 0)):M(new re(`"${o}" is invalid URL`))},{...n,returns:"either"})}function la(){return ca(h(E(),K,I))}const pn=la(),pa=_(pn);function ha({openTelegramLink:t,...e}){return R((n,r)=>t("https://t.me/share/url?"+new URLSearchParams({url:n,text:r||""}).toString().replace(/\+/g,"%20")),{...e,returns:"either"})}function da(){return ha({...E(),openTelegramLink:pn})}const Zr=da(),fa=_(Zr);function _a(t){let e=!1,n,r;return t.available&&(e=!0,n=t.access_requested,r=t.access_granted),{available:e,accessGranted:r||!1,accessRequested:n||!1}}class Xr{constructor({version:e,request:n,postEvent:r,storage:o,isTma:i,isPageReload:a}){s(this,"state");s(this,"isAvailable");s(this,"isAccessGranted");s(this,"isAccessRequested");s(this,"isMounted");s(this,"isSupported");s(this,"openSettingsFp");s(this,"openSettings");s(this,"requestLocationFp");s(this,"requestLocation");s(this,"mountFp");s(this,"mount");s(this,"unmount");const u=new _e({initialState:{available:!1,accessGranted:!1,accessRequested:!1},onChange:o.set}),c=new on({isPageReload:a,restoreState:o.get,onMounted:u.setState,initialState(w){return h(n("web_app_check_location","location_checked",w),A(_a))}}),l={version:e,requires:"web_app_check_location",isTma:i},d=T({...l,returns:"either"}),f=T({...l,returns:"task"}),b=T({...l,returns:"task",isMounted:c.isMounted});this.isAvailable=u.getter("available"),this.isAccessRequested=u.getter("accessRequested"),this.isAccessGranted=u.getter("accessGranted"),this.isSupported=oe("web_app_check_location",e),this.isMounted=c.isMounted,this.state=u.state,this.unmount=c.unmount,this.mountFp=f(c.mount),this.openSettingsFp=d(()=>r("web_app_open_location_settings")),this.requestLocationFp=b(w=>h(n("web_app_request_location","location_requested",w),A(F=>{if(!F.available)return u.setState({available:!1}),null;const{available:C,...g}=F;return g}))),this.mount=_(this.mountFp),this.openSettings=_(this.openSettingsFp),this.requestLocation=_(this.requestLocationFp)}}function ma(){return new Xr(h(E(),K,I,Z,we("locationManager")))}const ba=ma();class Yr{constructor({defaults:e,...n}){s(this,"bgColor");s(this,"hasShineEffect");s(this,"isEnabled");s(this,"isLoaderVisible");s(this,"isVisible");s(this,"isMounted");s(this,"state");s(this,"text");s(this,"textColor");s(this,"showFp");s(this,"show");s(this,"hideFp");s(this,"hide");s(this,"enableFp");s(this,"enable");s(this,"enableShineEffectFp");s(this,"enableShineEffect");s(this,"disableFp");s(this,"disable");s(this,"disableShineEffectFp");s(this,"disableShineEffect");s(this,"setBgColorFp");s(this,"setBgColor");s(this,"setTextColorFp");s(this,"setTextColor");s(this,"setTextFp");s(this,"setText");s(this,"showLoaderFp");s(this,"showLoader");s(this,"hideLoaderFp");s(this,"hideLoader");s(this,"setParamsFp");s(this,"setParams");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");const r=new lt({...n,version:"100",initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Continue"},method:"web_app_setup_main_button",payload:i=>({has_shine_effect:i.hasShineEffect,is_visible:i.isVisible,is_active:i.isEnabled,is_progress_visible:i.isLoaderVisible,text:i.text,color:i.bgColor,text_color:i.textColor})}),o=(i,a)=>{const u=r.stateGetter(i);return S(()=>u()||Y(a))};this.bgColor=o("bgColor",e.bgColor),this.textColor=o("textColor",e.textColor),this.hasShineEffect=r.stateGetter("hasShineEffect"),this.isEnabled=r.stateGetter("isEnabled"),this.isLoaderVisible=r.stateGetter("isLoaderVisible"),this.text=r.stateGetter("text"),this.isVisible=r.stateGetter("isVisible"),this.isMounted=r.isMounted,this.state=r.state,[this.setBgColor,this.setBgColorFp]=r.stateSetters("bgColor"),[this.setTextColor,this.setTextColorFp]=r.stateSetters("textColor"),[[this.disableShineEffect,this.disableShineEffectFp],[this.enableShineEffect,this.enableShineEffectFp]]=r.stateBoolSetters("hasShineEffect"),[[this.disable,this.disableFp],[this.enable,this.enableFp]]=r.stateBoolSetters("isEnabled"),[[this.hideLoader,this.hideLoaderFp],[this.showLoader,this.showLoaderFp]]=r.stateBoolSetters("isLoaderVisible"),[this.setText,this.setTextFp]=r.stateSetters("text"),[[this.hide,this.hideFp],[this.show,this.showFp]]=r.stateBoolSetters("isVisible"),this.setParams=r.setState,this.setParamsFp=r.setStateFp,this.onClick=r.onClick,this.onClickFp=r.onClickFp,this.offClick=r.offClick,this.offClickFp=r.offClickFp,this.mount=r.mount,this.mountFp=r.mountFp,this.unmount=r.unmount}}function hn(t,e){document.documentElement.style.setProperty(t,e)}function dn(t){document.documentElement.style.removeProperty(t)}function es(t){return h(rt(t),z(e=>Math.sqrt([.299,.587,.114].reduce((n,r,o)=>{const i=parseInt(e.slice(1+o*2,1+(o+1)*2),16);return n+i*i*r},0))<120))}const fn=ne(es);class ts{constructor({initialState:e,onChange:n,offChange:r,isTma:o,storage:i,isPageReload:a}){s(this,"accentTextColor");s(this,"bgColor");s(this,"buttonColor");s(this,"buttonTextColor");s(this,"bottomBarBgColor");s(this,"destructiveTextColor");s(this,"headerBgColor");s(this,"hintColor");s(this,"linkColor");s(this,"secondaryBgColor");s(this,"sectionBgColor");s(this,"sectionHeaderTextColor");s(this,"sectionSeparatorColor");s(this,"subtitleTextColor");s(this,"textColor");s(this,"_isCssVarsBound",W(!1));s(this,"isCssVarsBound",S(this._isCssVarsBound));s(this,"bindCssVarsFp");s(this,"bindCssVars");s(this,"state");s(this,"isDark",S(()=>{const e=this.bgColor();return!e||fn(e)}));s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");const u=new _e({initialState:{},onChange:i.set}),c=w=>{u.setState(w.theme_params)},l=new je({initialState:()=>k(Y(e)),isPageReload:a,onMounted(w){u.setState(w),n(c)},onUnmounted(){r(c)},restoreState:i.get}),d={isTma:o,returns:"either"},f=T(d),b=T({...d,isMounted:l.isMounted});this.accentTextColor=u.getter("accent_text_color"),this.bgColor=u.getter("bg_color"),this.buttonColor=u.getter("button_color"),this.buttonTextColor=u.getter("button_text_color"),this.bottomBarBgColor=u.getter("bottom_bar_bg_color"),this.destructiveTextColor=u.getter("destructive_text_color"),this.headerBgColor=u.getter("header_bg_color"),this.hintColor=u.getter("hint_color"),this.linkColor=u.getter("link_color"),this.secondaryBgColor=u.getter("secondary_bg_color"),this.sectionBgColor=u.getter("section_bg_color"),this.sectionHeaderTextColor=u.getter("section_header_text_color"),this.sectionSeparatorColor=u.getter("section_separator_color"),this.subtitleTextColor=u.getter("subtitle_text_color"),this.textColor=u.getter("text_color"),this.state=u.state,this.isMounted=l.isMounted,this.bindCssVarsFp=b(w=>{if(this._isCssVarsBound())return M(new ut);w||(w=g=>`--tg-theme-${xi(g)}`);const F=g=>{Object.entries(u.state()).forEach(([v,m])=>{m&&g(v,m)})},C=()=>{F((g,v)=>{hn(w(g),v)})};return C(),u.state.sub(C),this._isCssVarsBound.set(!0),k(()=>{F(dn),u.state.unsub(C),this._isCssVarsBound.set(!1)})}),this.mountFp=f(l.mount),this.unmount=l.unmount,this.bindCssVars=_(this.bindCssVarsFp),this.mount=_(this.mountFp)}}const _n=He({});function ga(){return new ts({...h(E(),we("themeParams")),offChange(t){Se("theme_changed",t)},onChange(t){ee("theme_changed",t)},initialState:_n})}const ze=ga();function ns(t,e,n){return h(sn(t,e),r=>({...r,defaults:n}))}const wa=new Yr(ns("mainButton","main_button_pressed",{bgColor:S(()=>ze.buttonColor()||"#2481cc"),textColor:S(()=>ze.buttonTextColor()||"#ffffff")}));class rs{constructor({storage:e,isPageReload:n,version:r,postEvent:o,isTma:i,theme:a,onVisibilityChanged:u,offVisibilityChanged:c}){s(this,"isSupported");s(this,"isDark",S(()=>{const e=this.bgColorRgb();return e?fn(e):!1}));s(this,"isActive");s(this,"state");s(this,"isCssVarsBound");s(this,"bindCssVarsFp");s(this,"bindCssVars");s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"bgColor");s(this,"bgColorRgb");s(this,"setBgColorFp");s(this,"setBgColor");s(this,"headerColor");s(this,"headerColorRgb");s(this,"setHeaderColorFp");s(this,"setHeaderColor");s(this,"bottomBarColor");s(this,"bottomBarColorRgb");s(this,"setBottomBarColorFp");s(this,"setBottomBarColor");s(this,"closeFp");s(this,"close");s(this,"readyFp");s(this,"ready");const l=m=>{b.setState({isActive:m.is_visible})},d=m=>{[[this.headerColor,"web_app_set_header_color"],[this.bgColor,"web_app_set_background_color"],[this.bottomBarColor,"web_app_set_bottom_bar_color"]].forEach(([O,j])=>{const U=O();if(!Ge(U)&&(j!=="web_app_set_header_color"||!["bg_color","secondary_bg_color"].includes(U))){const $=m[U];$&&o(j,{color:$})}})},f=new je({initialState(){return k({bgColor:"bg_color",headerColor:"header_bg_color",bottomBarColor:"bottom_bar_bg_color",isActive:!0})},isPageReload:n,onMounted:m=>{u(l),a.sub(d),b.setState(m)},onUnmounted(){c(l),a.unsub(d)},restoreState:e.get});this.isMounted=f.isMounted,this.mountFp=R(()=>{const m=()=>{};return h(f.mount(),ae(m,m))},{isTma:i,returns:"plain"}),this.mount=_(this.mountFp),this.unmount=f.unmount;const b=new _e({initialState:{bgColor:"bg_color",bottomBarColor:"bottom_bar_bg_color",headerColor:"bg_color",isActive:!1},onChange:e.set});this.state=b.state;const w=m=>Ge(m)?m:Y(a)[m],F=m=>S(()=>w(m()));this.isActive=b.getter("isActive"),this.isSupported=S(()=>["web_app_set_header_color","web_app_set_background_color","web_app_set_bottom_bar_color"].some(m=>he(m,Y(r))));const C=W(!1);this.isCssVarsBound=S(C),this.bindCssVarsFp=R(m=>{if(C())return M(new ut);const[O,j]=Ue(()=>{C.set(!1)}),U=($,V)=>{const L=()=>{hn($,V()||null)};L(),O(V.sub(L),dn.bind(null,$))};return m||(m=$=>`--tg-${On($)}`),U(m("bgColor"),this.bgColorRgb),U(m("bottomBarColor"),this.bottomBarColorRgb),U(m("headerColor"),this.headerColorRgb),C.set(!0),k(j)},{isTma:i,returns:"either",isMounted:this.isMounted}),this.bindCssVars=_(this.bindCssVarsFp);const g=m=>{const O=b.getter(m),j=F(O),U={headerColor:"web_app_set_header_color",bgColor:"web_app_set_background_color",bottomBarColor:"web_app_set_bottom_bar_color"}[m],$=R(V=>{if(V===O())return k(void 0);if(U==="web_app_set_header_color"&&(V==="bg_color"||V==="secondary_bg_color"))return h(o("web_app_set_header_color",{color_key:V}),z(()=>{b.setState({[m]:V})}));const L=w(V);return h(L?o(U,{color:L}):M(new Tr(V)),z(()=>{b.setState({[m]:V})}))},{isTma:i,version:r,requires:U,isMounted:this.isMounted,returns:"either",supports:m==="headerColor"?{rgb:{method:"web_app_set_header_color",param:"color",shouldCheck:Ge}}:void 0});return[O,j,_($),$]};[this.bgColor,this.bgColorRgb,this.setBgColor,this.setBgColorFp]=g("bgColor"),[this.headerColor,this.headerColorRgb,this.setHeaderColor,this.setHeaderColorFp]=g("headerColor"),[this.bottomBarColor,this.bottomBarColorRgb,this.setBottomBarColor,this.setBottomBarColorFp]=g("bottomBarColor");const v=T({isTma:i,returns:"either"});this.closeFp=v(m=>o("web_app_close",{return_back:m})),this.close=_(this.closeFp),this.readyFp=v(()=>o("web_app_ready")),this.ready=_(this.readyFp)}}function va(){return new rs({...h(E(),K,I,we("miniApp")),offVisibilityChanged(t){Se("visibility_changed",t)},onVisibilityChanged(t){ee("visibility_changed",t)},theme:ze.state})}const ss=va();function ya(t){const e=t.message.trim(),n=(t.title||"").trim(),r=t.buttons||[];if(n.length>64)return M(new re(`Invalid title: ${n}`));if(!e||e.length>256)return M(new re(`Invalid message: ${e}`));if(r.length>3)return M(new re(`Invalid buttons count: ${r.length}`));const o=[];if(!r.length)o.push({type:"close",id:""});else for(let i=0;i<r.length;i++){const a=r[i],u=a.id||"";if(u.length>64)return M(new re(`Button with index ${i} has invalid id: ${u}`));if(!a.type||a.type==="default"||a.type==="destructive"){const c=a.text.trim();if(!c||c.length>64)return M(new re(`Button with index ${i} has invalid text: ${c}`));o.push({type:a.type,text:c,id:u})}else o.push({type:a.type,id:u})}return k({title:n,message:e,buttons:o})}class is{constructor({version:e,isTma:n,request:r}){s(this,"isOpened");s(this,"isSupported");s(this,"showFp");s(this,"show");const o=W(!1),i=()=>{o.set(!1)},a=T({version:e,isTma:n,requires:"web_app_open_popup",returns:"task"});this.isSupported=oe("web_app_open_popup",e),this.isOpened=S(o),this.showFp=a(u=>h(this.isOpened()?D(new ct("A popup is already opened")):P(void 0),ue(()=>Ct(ya(u))),te(c=>(o.set(!0),r("web_app_open_popup","popup_closed",{...u,params:c}))),Oe(c=>(i(),c),c=>(i(),c.button_id)))),this.show=_(this.showFp)}}function Fa(){return new is(h(E(),Z,I))}const Sa=Fa();function Ca({request:t,...e}){return R(n=>h(t("web_app_request_phone","phone_requested",n),A(r=>r.status)),{...e,requires:"web_app_request_phone",returns:"task"})}function ka(){return Ca(h(E(),I,Z))}const mn=ka(),Ea=_(mn);function $a({invokeCustomMethod:t,requestPhoneAccess:e,...n}){const r=a=>h(t("getRequestedContact",{},{...a,timeout:(a||{}).timeout||5e3}),ue(u=>{const c=jt(y(),u);if(!c.success)return D(new Ne(u,c.issues));if(!c.output)return P(void 0);const l=jt(Nt(G({contact:ge(G({user_id:me(),phone_number:y(),first_name:y(),last_name:q(y())})),auth_date:ie(y(),le(d=>new Date(Number(d)*1e3)),Ye()),hash:y()})),c.output);return l.success?P({raw:c.output,parsed:l.output}):D(new Ne(c.output,l.issues))})),o=a=>h(r(a),Qe(u=>Ne.is(u)?M(u):k(void 0),u=>k(u))),i=a=>Te(async(u,c,l)=>{let d=50;for(;!l.isRejected;){const f=await o(l)();if(f._tag==="Left")return c(f.left);if(f.right)return u(f.right);await new Promise(b=>setTimeout(b,d)),d+=50}},a);return R(a=>Te.fn(u=>h(o(u),te(c=>c?P(c):h(e(u),ue(l=>l==="sent"?i(u):D(new nn("User denied access")))))),a),{...n,returns:"task",requires:"web_app_request_phone"})}function Ia(){return $a({...h(E(),ln,I),requestPhoneAccess:mn})}function Aa({requestContact:t,...e}){return R(t,{...e,returns:"task",requires:"web_app_request_phone"})}function qa(){return Aa({...h(E(),I),requestContact(t){return h(bn(t),A(e=>e.parsed))}})}const bn=Ia(),Ta=_(bn),os=qa(),Ma=_(os);function Ba({request:t,...e}){return R(n=>h(t("web_app_request_write_access","write_access_requested",n),A(r=>r.status)),{...e,requires:"web_app_request_write_access",returns:"task"})}function Pa(){return Ba(h(E(),I,Z))}const as=Pa(),La=_(as);class us{constructor({version:e,onClosed:n,onTextReceived:r,isTma:o,postEvent:i}){s(this,"isOpened");s(this,"isSupported");s(this,"captureFp");s(this,"capture");s(this,"closeFp");s(this,"close");s(this,"openFp");s(this,"open");const a={version:e,requires:"web_app_open_scan_qr_popup",isTma:o},u=T({...a,returns:"either"}),c=T({...a,returns:"task"}),l=W(!1),d=()=>{l.set(!1)};this.isSupported=oe("web_app_open_scan_qr_popup",e),this.isOpened=S(l),this.captureFp=c(f=>{let b;return h(this.openFp({...f,onCaptured:w=>{f.capture(w)&&(b=w,this.close())}}),A(()=>b))}),this.closeFp=u(()=>h(i("web_app_close_scan_qr_popup"),z(d))),this.openFp=c(f=>h(l()?D(new ct("The QR Scanner is already opened")):async()=>i("web_app_open_scan_qr_popup",{text:f.text}),ue(()=>{l.set(!0);const[b,w]=Ue(),F=C=>(w(),l.set(!1),C);return h(Te(C=>{b(n(C),l.sub(g=>{g||C()}),r(f.onCaptured))},f),Oe(F,F))}))),this.open=_(this.openFp),this.capture=_(this.captureFp),this.close=_(this.closeFp)}}function Ra(){return new us({...h(E(),K,I),onClosed(t){return ee("scan_qr_popup_closed",t)},onTextReceived(t){return ee("qr_text_received",e=>{t(e.data)})}})}const Va=Ra();class cs{constructor({defaults:e,...n}){s(this,"isSupported");s(this,"position");s(this,"bgColor");s(this,"hasShineEffect");s(this,"isEnabled");s(this,"isLoaderVisible");s(this,"isVisible");s(this,"isMounted");s(this,"state");s(this,"text");s(this,"textColor");s(this,"showFp");s(this,"show");s(this,"hideFp");s(this,"hide");s(this,"enableFp");s(this,"enable");s(this,"enableShineEffectFp");s(this,"enableShineEffect");s(this,"disableFp");s(this,"disable");s(this,"disableShineEffectFp");s(this,"disableShineEffect");s(this,"setBgColorFp");s(this,"setBgColor");s(this,"setTextColorFp");s(this,"setTextColor");s(this,"setTextFp");s(this,"setText");s(this,"setPositionFp");s(this,"setPosition");s(this,"showLoaderFp");s(this,"showLoader");s(this,"hideLoaderFp");s(this,"hideLoader");s(this,"setParamsFp");s(this,"setParams");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");const r=new lt({...n,initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Cancel",position:"left"},method:"web_app_setup_secondary_button",payload:i=>({has_shine_effect:i.hasShineEffect,is_visible:i.isVisible,is_active:i.isEnabled,is_progress_visible:i.isLoaderVisible,text:i.text,color:i.bgColor,text_color:i.textColor,position:i.position})}),o=(i,a)=>{const u=r.stateGetter(i);return S(()=>u()||Y(a))};this.isSupported=oe("web_app_setup_secondary_button",n.version),this.bgColor=o("bgColor",e.bgColor),this.textColor=o("textColor",e.textColor),this.position=r.stateGetter("position"),this.hasShineEffect=r.stateGetter("hasShineEffect"),this.isEnabled=r.stateGetter("isEnabled"),this.isLoaderVisible=r.stateGetter("isLoaderVisible"),this.text=r.stateGetter("text"),this.isVisible=r.stateGetter("isVisible"),this.isMounted=r.isMounted,this.state=r.state,[this.setPosition,this.setPositionFp]=r.stateSetters("position"),[this.setBgColor,this.setBgColorFp]=r.stateSetters("bgColor"),[this.setTextColor,this.setTextColorFp]=r.stateSetters("textColor"),[[this.disableShineEffect,this.disableShineEffectFp],[this.enableShineEffect,this.enableShineEffectFp]]=r.stateBoolSetters("hasShineEffect"),[[this.disable,this.disableFp],[this.enable,this.enableFp]]=r.stateBoolSetters("isEnabled"),[[this.hideLoader,this.hideLoaderFp],[this.showLoader,this.showLoaderFp]]=r.stateBoolSetters("isLoaderVisible"),[this.setText,this.setTextFp]=r.stateSetters("text"),[[this.hide,this.hideFp],[this.show,this.showFp]]=r.stateBoolSetters("isVisible"),this.setParams=r.setState,this.setParamsFp=r.setStateFp,this.onClick=r.onClick,this.onClickFp=r.onClickFp,this.offClick=r.offClick,this.offClickFp=r.offClickFp,this.mount=r.mount,this.mountFp=r.mountFp,this.unmount=r.unmount}}function Oa(){return new cs(ns("secondaryButton","secondary_button_pressed",{bgColor:S(()=>ss.bottomBarColorRgb()||"#000000"),textColor:S(()=>ze.buttonColor()||"#2481cc")}))}const ja=Oa();class ls{constructor({isTma:e,request:n,version:r,createRequestId:o}){s(this,"getItemFp");s(this,"getItem");s(this,"restoreItemFp");s(this,"restoreItem");s(this,"setItemFp");s(this,"setItem");s(this,"deleteItemFp");s(this,"deleteItem");s(this,"clearFp");s(this,"clear");const i=T({version:r,requires:"web_app_secure_storage_get_key",isTma:e,returns:"task"}),a=(u,c,l)=>{const d=o();return h(n(u,["secure_storage_failed",c],{params:{...l,req_id:d},capture:f=>"payload"in f?f.payload.req_id===d:!0}),te(f=>f.event==="secure_storage_failed"?D(new kr(f.payload.error||"UNKNOWN_ERROR")):P(f.payload)))};this.getItemFp=i(u=>h(a("web_app_secure_storage_get_key","secure_storage_key_received",{key:u}),A(c=>({value:c.value,canRestore:!!c.can_restore})))),this.setItemFp=i((u,c)=>h(a("web_app_secure_storage_save_key","secure_storage_key_saved",{key:u,value:c}),A(()=>{}))),this.deleteItemFp=i(u=>this.setItemFp(u,null)),this.clearFp=i(()=>h(a("web_app_secure_storage_clear","secure_storage_cleared",{}),A(()=>{}))),this.restoreItemFp=i(u=>h(a("web_app_secure_storage_restore_key","secure_storage_key_restored",{key:u}),A(c=>c.value))),this.getItem=_(this.getItemFp),this.setItem=_(this.setItemFp),this.deleteItem=_(this.deleteItemFp),this.clear=_(this.clearFp),this.restoreItem=_(this.restoreItemFp)}}function Da(){return new ls(h(E(),I,Z,Wr))}const Ua=Da();class ps{constructor(e){s(this,"isVisible");s(this,"isMounted");s(this,"isSupported");s(this,"hideFp");s(this,"hide");s(this,"showFp");s(this,"show");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");s(this,"mountFp");s(this,"mount");s(this,"unmount");const n=new lt({...e,method:"web_app_setup_settings_button",payload:r=>({is_visible:r.isVisible}),initialState:{isVisible:!1}});this.isVisible=n.stateGetter("isVisible"),this.isMounted=n.isMounted,this.isSupported=n.isSupported,[[this.hide,this.hideFp],[this.show,this.showFp]]=n.stateBoolSetters("isVisible"),this.onClick=n.onClick,this.onClickFp=n.onClickFp,this.offClick=n.offClick,this.offClickFp=n.offClickFp,this.mount=n.mount,this.mountFp=n.mountFp,this.unmount=n.unmount}}const Wa=new ps(sn("settingsButton","settings_button_pressed"));class hs{constructor({postEvent:e,storage:n,isTma:r,isPageReload:o,version:i}){s(this,"isSupported");s(this,"isVerticalEnabled");s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"disableVerticalFp");s(this,"disableVertical");s(this,"enableVerticalFp");s(this,"enableVertical");const a={isVerticalEnabled:!0},u=new _e({initialState:a,onChange(w){n.set(w)}}),c=new je({initialState:a,isPageReload:o,onMounted:u.setState,restoreState:n.get}),l={requires:"web_app_setup_swipe_behavior",isTma:r,version:i},d=T({...l,returns:"plain"}),f=T({...l,isMounted:c.isMounted,returns:"either"}),b=w=>{const F={isVerticalEnabled:w};return u.hasDiff(F)?h(e("web_app_setup_swipe_behavior",{allow_vertical_swipe:w}),z(()=>{u.setState(F)})):k(void 0)};this.isSupported=oe("web_app_setup_swipe_behavior",i),this.isVerticalEnabled=u.getter("isVerticalEnabled"),this.isMounted=c.isMounted,this.disableVerticalFp=f(()=>b(!1)),this.enableVerticalFp=f(()=>b(!0)),this.mountFp=d(()=>{const w=()=>{};return h(c.mount(),ae(w,w))}),this.unmount=c.unmount,this.disableVertical=_(this.disableVerticalFp),this.enableVertical=_(this.enableVerticalFp),this.mount=_(this.mountFp)}}function Ga(){return new hs(h(E(),K,I,we("swipeBehavior")))}const xa=Ga();async function Na(t){try{const{clipboard:n}=navigator;if(n)return await n.writeText(t)}catch{}const e=document.createElement("textarea");e.value=t,e.style.top="0",e.style.left="0",e.style.position="fixed",document.body.appendChild(e),e.focus(),e.select();try{document.execCommand("copy")}finally{document.body.removeChild(e)}}function Ha({request:t,...e}){return R((n,r,o)=>h(t("web_app_request_file_download","file_download_requested",{...o,params:{url:n,file_name:r}}),te(i=>i.status==="downloading"?P(void 0):D(new nn("User denied the action")))),{...e,requires:"web_app_request_file_download",returns:"task"})}function za(){return Ha(h(E(),Z,I))}const ds=za(),Ka=_(ds);function Ja({invokeCustomMethod:t,...e}){return R(n=>h(t("getCurrentTime",{},n),te(r=>{const o=jt(ie(me(),Mt(),le(i=>new Date(i*1e3)),Ye()),r);return o.success?P(o.output):D(new Ne(r,o.issues))})),{...e,requires:"web_app_invoke_custom_method",returns:"task"})}function Qa(){return Ja(h(E(),ln,I))}const fs=Qa(),Za=_(fs);function Xa({postEvent:t,...e}){return R(()=>t("web_app_hide_keyboard"),{...e,returns:"either",requires:"web_app_hide_keyboard"})}function Ya(){return Xa(h(E(),K,I))}const _s=Ya(),eu=_(_s);function tu({request:t,createRequestId:e,...n}){return R(r=>{const o=e();return h(t("web_app_read_text_from_clipboard","clipboard_text_received",{...r,params:{req_id:o},capture:wr(o)}),A(({data:i=null})=>i))},{...n,requires:"web_app_read_text_from_clipboard",returns:"task"})}function nu(){return tu({...h(E(),I,Z),createRequestId:pt})}const ms=nu(),ru=_(ms);function bs(t){const e={},n=t.match(/Telegram-Android(?:\/([^ ]+))?(?: (\([^)]+\))?|$)/);if(n){const[,r,o]=n;r&&(e.appVersion=r),o&&o.slice(1,o.length-1).split(";").forEach(i=>{const[a,u]=i.trim().split(" ");if(a==="Android")e.androidVersion=u;else if(a==="SDK"){const c=parseInt(u,10);c&&(e.sdkVersion=c)}else u?(e.manufacturer=a,e.model=u):e.performanceClass=a})}return e}function su(){return bs(navigator.userAgent)}function iu({postEvent:t,...e}){return R(n=>{const{size:r}=new Blob([n]);return!r||r>4096?M(new re(r?"Maximum size of data to send is 4096 bytes":"Attempted to send empty data")):t("web_app_data_send",{data:n})},{...e,returns:"either"})}function ou(){return iu(h(E(),K))}const gs=ou(),au=_(gs);function uu({request:t,...e}){return R((n,r)=>h(t("web_app_send_prepared_message",["prepared_message_failed","prepared_message_sent"],{...r,params:{id:n}}),te(o=>o.event==="prepared_message_failed"?D(new qr(o.payload.error)):P(void 0))),{...e,requires:"web_app_send_prepared_message",returns:"task"})}function cu(){return uu(h(E(),Z,I))}const ws=cu(),lu=_(ws);function pu({postEvent:t,...e}){return R((n,r={})=>t("web_app_share_to_story",{text:r.text,media_url:n,widget_link:r.widgetLink}),{...e,requires:"web_app_share_to_story",returns:"either"})}function hu(){return pu(h(E(),K,I))}const vs=hu(),du=_(vs),gn=He(!1);function fu({isInlineMode:t,postEvent:e,...n}){return R((r,o)=>e("web_app_switch_inline_query",{query:r,chat_types:o||[]}),{...n,requires:{every:["web_app_switch_inline_query",()=>Y(t)?void 0:"The application must be launched in the inline mode"]},returns:"either"})}function _u(){return fu({...h(E(),K,I),isInlineMode:gn})}const ys=_u(),mu=_(ys);class Fs{constructor({storage:e,isPageReload:n,onContentSafeAreaInsetsChanged:r,onSafeAreaInsetsChanged:o,onViewportChanged:i,onFullscreenChanged:a,offContentSafeAreaInsetsChanged:u,offFullscreenChanged:c,offSafeAreaInsetsChanged:l,offViewportChanged:d,request:f,isViewportStable:b,isFullscreen:w,isTma:F,version:C,postEvent:g}){s(this,"state");s(this,"height");s(this,"stableHeight");s(this,"width");s(this,"isExpanded");s(this,"isStable",S(()=>this.height()===this.stableHeight()));s(this,"contentSafeAreaInsets");s(this,"contentSafeAreaInsetTop");s(this,"contentSafeAreaInsetLeft");s(this,"contentSafeAreaInsetRight");s(this,"contentSafeAreaInsetBottom");s(this,"safeAreaInsets");s(this,"safeAreaInsetTop");s(this,"safeAreaInsetLeft");s(this,"safeAreaInsetRight");s(this,"safeAreaInsetBottom");s(this,"isFullscreen");s(this,"requestFullscreenFp");s(this,"requestFullscreen");s(this,"exitFullscreenFp");s(this,"exitFullscreen");s(this,"isCssVarsBound");s(this,"bindCssVarsFp");s(this,"bindCssVars");s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"expandFp");s(this,"expand");const v={top:0,right:0,left:0,bottom:0},m=new _e({initialState:{contentSafeAreaInsets:v,height:0,isExpanded:!1,isFullscreen:!1,safeAreaInsets:v,stableHeight:0,width:0},onChange:e.set}),O=B=>{m.setState({isExpanded:B.is_expanded,height:B.height,width:B.width,stableHeight:B.is_state_stable?B.height:void 0})},j=B=>{m.setState({isFullscreen:B.is_fullscreen})},U=B=>{m.setState({safeAreaInsets:B})},$=B=>{m.setState({contentSafeAreaInsets:B})},V=new on({initialState(B){const Ee=de=>()=>{const[ve,se]=de==="safe-area"?["web_app_request_safe_area","safe_area_changed"]:["web_app_request_content_safe_area","content_safe_area_changed"];return he(ve,Y(C))?f(ve,se,B):P({top:0,left:0,right:0,bottom:0})},N=de=>()=>typeof de=="boolean"?P(de):Ct(de());return h(Ei,Ze("safeAreaInsets",Ee("safe-area")),Ze("contentSafeAreaInsets",Ee("content-safe-area")),Ze("isFullscreen",N(w)),Ze("isViewportStable",N(b)),ue(({isViewportStable:de,...ve})=>de?P({...ve,height:window.innerHeight,isExpanded:!0,stableHeight:window.innerHeight,width:window.innerWidth}):h(f("web_app_request_viewport","viewport_changed",B),A(se=>({...ve,height:se.height,isExpanded:se.is_expanded,stableHeight:se.is_state_stable?se.height:0,width:se.width})))))},isPageReload:n,onMounted(B){i(O),a(j),o(U),r($),m.setState(B)},onUnmounted(){d(O),c(j),l(U),u($)},restoreState:e.get}),L=B=>S(()=>this.safeAreaInsets()[B]),x=B=>S(()=>this.contentSafeAreaInsets()[B]);this.state=m.state,this.height=m.getter("height"),this.stableHeight=m.getter("stableHeight"),this.width=m.getter("width"),this.isExpanded=m.getter("isExpanded"),this.safeAreaInsets=m.getter("safeAreaInsets"),this.safeAreaInsetTop=L("top"),this.safeAreaInsetBottom=L("bottom"),this.safeAreaInsetLeft=L("left"),this.safeAreaInsetRight=L("right"),this.contentSafeAreaInsets=m.getter("contentSafeAreaInsets"),this.contentSafeAreaInsetTop=x("top"),this.contentSafeAreaInsetBottom=x("bottom"),this.contentSafeAreaInsetLeft=x("left"),this.contentSafeAreaInsetRight=x("right");const Pe=T({isTma:F,returns:"task"}),Ke=T({isTma:F,returns:"either"}),vu=T({isTma:F,requires:"web_app_request_fullscreen",version:C,returns:"task"}),Cs=B=>vu(Ee=>h(f(B?"web_app_request_fullscreen":"web_app_exit_fullscreen",["fullscreen_changed","fullscreen_failed"],Ee),te(N=>N.event==="fullscreen_failed"&&N.payload.error!=="ALREADY_FULLSCREEN"?D(new Ar(N.payload.error)):(m.setState({isFullscreen:"is_fullscreen"in N.payload?N.payload.is_fullscreen:!0}),P(void 0)))));this.isMounted=V.isMounted,this.mountFp=Pe(V.mount),this.mount=_(this.mountFp),this.isFullscreen=m.getter("isFullscreen"),this.requestFullscreenFp=Cs(!0),this.requestFullscreen=_(this.requestFullscreenFp),this.exitFullscreenFp=Cs(!1),this.exitFullscreen=_(this.exitFullscreenFp);const ht=W(!1);this.isCssVarsBound=S(ht),this.bindCssVarsFp=Ke(B=>{if(ht())return M(new ut);B||(B=N=>`--tg-viewport-${On(N)}`);const Ee=[["height",this.height],["stableHeight",this.stableHeight],["width",this.width],["safeAreaInsetTop",this.safeAreaInsetTop],["safeAreaInsetBottom",this.safeAreaInsetBottom],["safeAreaInsetLeft",this.safeAreaInsetLeft],["safeAreaInsetRight",this.safeAreaInsetRight],["contentSafeAreaInsetTop",this.contentSafeAreaInsetTop],["contentSafeAreaInsetBottom",this.contentSafeAreaInsetBottom],["contentSafeAreaInsetLeft",this.contentSafeAreaInsetLeft],["contentSafeAreaInsetRight",this.contentSafeAreaInsetRight]].reduce((N,[de,ve])=>{const se=B(de);if(se){const ks=()=>{hn(se,`${ve()}px`)};N.push({update:ks,removeListener:ve.sub(ks),cssVar:se})}return N},[]);return Ee.forEach(N=>{N.update()}),ht.set(!0),k(()=>{Ee.forEach(N=>{N.removeListener(),dn(N.cssVar)}),ht.set(!1)})}),this.bindCssVars=_(this.bindCssVarsFp),this.expandFp=Ke(()=>g("web_app_expand")),this.expand=_(this.expandFp)}}function bu(){const t=i=>({on:a=>{ee(i,a)},off:a=>{Se(i,a)}}),e=t("viewport_changed"),n=t("fullscreen_changed"),r=t("safe_area_changed"),o=t("content_safe_area_changed");return new Fs({...h(E(),we("viewport"),I,K,Z),isFullscreen(){return h(Me(),z(i=>!!i.tgWebAppFullscreen))},isViewportStable(){return h(Me(),z(i=>["macos","tdesktop","unigram","webk","weba","web"].includes(i.tgWebAppPlatform)))},offContentSafeAreaInsetsChanged:o.off,offFullscreenChanged:n.off,offSafeAreaInsetsChanged:r.off,offViewportChanged:e.off,onContentSafeAreaInsetsChanged:o.on,onFullscreenChanged:n.on,onSafeAreaInsetsChanged:r.on,onViewportChanged:e.on})}const gu=bu();function Ss(t={}){const{version:e,isInlineMode:n,themeParams:r}=t;if(e&&typeof n=="boolean"&&r)rn.set(e),gn.set(n),_n.set(r);else{const u=h(Me(),wt(c=>c,c=>{rn.set(e||c.tgWebAppVersion),gn.set(typeof n=="boolean"?n:!!c.tgWebAppBotInline),_n.set(r||c.tgWebAppThemeParams)}));if(u)return M(u)}t.postEvent&&Br.set(t.postEvent);const[o,i]=Ue(ee("reload_iframe",()=>{pe().log("Received a request to reload the page"),Pr("iframe_will_reload"),window.location.reload()})),{acceptCustomStyles:a=!0}=t;if(a){const u=document.createElement("style");u.id="telegram-custom-styles",document.head.appendChild(u),o(ee("set_custom_style",c=>{u.innerHTML=c}),()=>{document.head.removeChild(u)})}return h(ke("iframe_ready",{reload_supported:!0}),z(()=>(pe().log("The package was initialized"),i)))}const wu=ne(Ss);return p.AccessDeniedError=nn,p.BackButton=Mr,p.Biometry=Rr,p.CSSVarsBoundError=ut,p.CancelledError=Rn,p.ClosingBehavior=Or,p.CloudStorage=jr,p.ConcurrentCallError=ct,p.DeviceStorage=Ur,p.DeviceStorageMethodError=Cr,p.FullscreenFailedError=Ar,p.FunctionUnavailableError=$r,p.HapticFeedback=Nr,p.InitData=Kr,p.InvalidArgumentsError=re,p.InvalidEnvError=$o,p.InvalidLaunchParamsError=ur,p.Invoice=Jr,p.InvokeCustomMethodFailedError=cr,p.LaunchParamsRetrieveError=ar,p.LocationManager=Xr,p.MainButton=Yr,p.MethodParameterUnsupportedError=or,p.MethodUnsupportedError=ir,p.MiniApp=rs,p.NotAvailableError=Er,p.Popup=is,p.QrScanner=us,p.SecondaryButton=cs,p.SecureStorage=ls,p.SecureStorageMethodError=kr,p.SetEmojiStatusError=Ir,p.SettingsButton=ps,p.ShareMessageError=qr,p.SwipeBehavior=hs,p.ThemeParams=ts,p.TimeoutError=Ut,p.UnknownEnvError=zt,p.UnknownThemeParamsKeyError=Tr,p.ValidationError=Ne,p.Viewport=Fs,p.addToHomeScreen=Xo,p.addToHomeScreenFp=Hr,p.applyPolyfills=Fo,p.backButton=To,p.biometry=Lo,p.checkHomeScreenStatus=ta,p.checkHomeScreenStatusFp=zr,p.closingBehavior=Vo,p.cloudStorage=jo,p.copyTextToClipboard=Na,p.createLogger=Un,p.createPostEvent=wo,p.createRequestId=pt,p.createStartParam=Co,p.createStartParamFp=Fr,p.debug=dr,p.decodeBase64Url=So,p.decodeBase64UrlFp=en,p.decodeStartParam=ko,p.decodeStartParamFp=Sr,p.deepSnakeToCamelObjKeys=Wt,p.deviceStorage=Uo,p.downloadFile=Ka,p.downloadFileFp=ds,p.emitEvent=it,p.encodeBase64Url=tn,p.getCurrentTime=Za,p.getCurrentTimeFp=fs,p.getReleaseVersion=Yt,p.hapticFeedback=Jo,p.hideKeyboard=eu,p.hideKeyboardFp=_s,p.init=wu,p.initData=ra,p.initFp=Ss,p.invoice=ia,p.invokeCustomMethod=Dr,p.isAnyRGB=Hn,p.isColorDark=fn,p.isColorDarkFp=es,p.isRGB=Ge,p.isRGBA=Nn,p.isRGBAShort=xn,p.isRGBShort=Gn,p.isSafeToCreateStartParam=Eo,p.isTMA=mo,p.isTMAFp=Xt,p.locationManager=ba,p.logger=pe,p.mainButton=wa,p.miniApp=ss,p.mockTelegramEnv=bo,p.off=Se,p.offAll=ho,p.on=ee,p.openLink=ua,p.openLinkFp=Qr,p.openTelegramLink=pa,p.openTelegramLinkFp=pn,p.parseInitDataQuery=to,p.parseInitDataQueryFp=Xn,p.parseLaunchParamsQuery=Yn,p.parseLaunchParamsQueryFp=st,p.popup=Sa,p.postEvent=Pr,p.postEventFp=ke,p.qrScanner=Va,p.readTextFromClipboard=ru,p.readTextFromClipboardFp=ms,p.request=Mo,p.request2=Bo,p.request2Fp=un,p.requestContact=Ma,p.requestContactComplete=Ta,p.requestContactCompleteFp=bn,p.requestContactFp=os,p.requestEmojiStatusAccess=xo,p.requestEmojiStatusAccessFp=Gr,p.requestFp=Vr,p.requestPhoneAccess=Ea,p.requestPhoneAccessFp=mn,p.requestWriteAccess=La,p.requestWriteAccessFp=as,p.retrieveAndroidDeviceData=su,p.retrieveAndroidDeviceDataFrom=bs,p.retrieveLaunchParams=ro,p.retrieveLaunchParamsFp=Me,p.retrieveRawInitData=so,p.retrieveRawInitDataFp=Kt,p.retrieveRawLaunchParams=io,p.retrieveRawLaunchParamsFp=xe,p.secondaryButton=ja,p.secureStorage=Ua,p.sendData=au,p.sendDataFp=gs,p.serializeInitDataQuery=tr,p.serializeLaunchParamsQuery=nr,p.setDebug=uo,p.setEmojiStatus=zo,p.setEmojiStatusFp=xr,p.setTargetOrigin=co,p.settingsButton=Wa,p.shareMessage=lu,p.shareMessageFp=ws,p.shareStory=du,p.shareStoryFp=vs,p.shareURL=fa,p.shareURLFp=Zr,p.supports=he,p.swipeBehavior=xa,p.switchInlineQuery=mu,p.switchInlineQueryFp=ys,p.targetOrigin=fr,p.themeParams=ze,p.toRGB=Ji,p.toRGBFp=Kn,p.toRGBFull=Qi,p.toRGBFullFp=rt,p.viewport=gu,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),p}({});
|
|
4
4
|
//# sourceMappingURL=index.iife.js.map
|