@vbotma/sdk 3.2.3 → 3.2.4
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/host-features/Notification/HostNotification.d.ts +7 -0
- package/dist/dts/host-features/index.d.ts +2 -1
- package/dist/dts/index.d.ts +1 -1
- 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 +134 -121
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.iife.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Tu=Object.defineProperty;var Vu=(c,X,Ae)=>X in c?Tu(c,X,{enumerable:!0,configurable:!0,writable:!0,value:Ae}):c[X]=Ae;var s=(c,X,Ae)=>Vu(c,typeof X!="symbol"?X+"":X,Ae);this.tmajs=this.tmajs||{};this.tmajs.sdk=(function(c){"use strict";let X;function Ae(t,e){X?X.set(t,e):e()}function Ze(t){if(X)return t();X=new Map;try{t()}finally{X.forEach(e=>e()),X=void 0}}function D(t,e){e||(e={});const n=e.equals||Object.is;let r=[],i=t;const o=p=>{if(!n(i,p)){const f=i;i=p,Ae(l,()=>{[...r].forEach(([d,b])=>{d(p,f),b&&u(d,!0)})})}};function a(p){const f=typeof p!="object"?{once:p}:p;return{once:f.once||!1,signal:f.signal||!1}}const u=(p,f)=>{const d=a(f),b=r.findIndex(([v,F])=>v===p&&F.once===d.once&&F.signal===d.signal);b>=0&&r.splice(b,1)},l=Object.assign(function(){return $s(l),i},{destroy(){r=[]},set:o,reset(){o(t)},sub(p,f){return r.push([p,a(f)]),()=>u(p,f)},unsub:u,unsubAll(){r=r.filter(p=>p[1].signal)}});return l}const Le=[];function $s(t){Le.length&&Le[Le.length-1].add(t)}function S(t,e){let n=new Set,r;function i(){return r||(r=D(a(),e))}function o(){i().set(a())}function a(){n.forEach(p=>{p.unsub(o,{signal:!0})});const u=new Set;let l;Le.push(u);try{l=t()}finally{Le.pop()}return u.forEach(p=>{p.sub(o,{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 qs=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))};function Bs(t){return t}function wn(t,e,n,r,i,o,a,u,l){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 i(r(n(e(t.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(e(t.apply(this,arguments))))))};case 7:return function(){return a(o(i(r(n(e(t.apply(this,arguments)))))))};case 8:return function(){return u(a(o(i(r(n(e(t.apply(this,arguments))))))))};case 9:return function(){return l(u(a(o(i(r(n(e(t.apply(this,arguments)))))))))}}}function h(t,e,n,r,i,o,a,u,l){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 i(r(n(e(t))));case 6:return o(i(r(n(e(t)))));case 7:return a(o(i(r(n(e(t))))));case 8:return u(a(o(i(r(n(e(t)))))));case 9:return l(u(a(o(i(r(n(e(t))))))));default:{for(var p=arguments[0],f=1;f<arguments.length;f++)p=arguments[f](p);return p}}}var Oe=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(i){return e.apply(void 0,qs([i],r,!1))}}},Ms={_tag:"None"},Ts=function(t){return{_tag:"Some",value:t}},Vs=function(t){return t._tag==="Left"},yn=function(t){return{_tag:"Left",left:t}},Fn=function(t){return{_tag:"Right",right:t}},mt={};function Ps(t,e){return function(n){return function(r){return t.ap(t.map(r,function(i){return function(o){return e.ap(i,o)}}),n)}}}function Rs(t,e){return function(n){return function(r){return t.map(r,function(i){return e.map(i,n)})}}}function bt(t){return function(e,n){return function(r){return t.chain(r,function(i){return t.map(n(i),function(o){var a;return Object.assign({},i,(a={},a[e]=o,a))})})}}}var Fe=Ms,$e=Ts,Ls=function(t,e){return h(t,Ds(e))},Os=function(t,e){return h(t,Ws(e))},js="Option",Ds=function(t){return function(e){return je(e)?Fe:$e(t(e.value))}},Us=$e,Ws=function(t){return function(e){return je(e)||je(t)?Fe:$e(e.value(t.value))}},Gs=Oe(2,function(t,e){return je(t)?Fe:e(t.value)}),Ns={URI:js,map:Ls,ap:Os,chain:Gs},je=function(t){return t._tag==="None"},Hs=function(t,e){return function(n){return je(n)?t():e(n.value)}},gt=Hs,xs=Us(mt),Sn=bt(Ns),M=yn,k=Fn,vt=Oe(2,function(t,e){return _e(t)?t:e(t.right)}),wt=function(t,e){return h(t,z(e))},Cn=function(t,e){return h(t,Qs(e))},yt="Either",z=function(t){return function(e){return _e(e)?e:k(t(e.right))}},zs={URI:yt,map:wt},Ks=k,Js=function(t){return function(e){return _e(e)?e:_e(t)?t:k(e.right(t.right))}},Qs=Js,Zs={URI:yt,map:wt,ap:Cn},Ys={URI:yt,map:wt,ap:Cn,chain:vt},Xs=function(t,e){return function(n){return _e(n)?M(t(n.left)):k(e(n.right))}},ei=function(t){return function(e){return _e(e)?M(t(e.left)):e}},_e=Vs,Ft=function(t,e){return function(n){return _e(n)?t(n.left):e(n.right)}},ti=Ft,ae=Ft,ni=ae,qe=function(t,e){try{return k(t())}catch(n){return M(e(n))}},ri=Ks(mt),si=bt(Ys),kn=si,ii=vt,oi=vt;function ai(t){return wn(k,t.of)}function ui(t){return wn(M,t.of)}function ci(t){return Rs(t,zs)}function li(t){return Ps(t,Zs)}function pi(t){return function(e,n){return t.chain(e,function(r){return _e(r)?t.of(r):n(r.right)})}}function hi(t){return function(e,n,r){return t.map(e,Xs(n,r))}}function fi(t){return function(e,n){return function(r){return t.map(r,ae(e,n))}}}var di=function(t){return qe(function(){return JSON.parse(t)},Bs)},St=function(t,e){return h(t,_i(e))},En=function(t,e){return h(t,mi(e))},_i=function(t){return function(e){return function(){return Promise.resolve().then(e).then(t)}}},mi=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],i=n[1];return r(i)})}}},Ct=function(t){return function(){return Promise.resolve(t)}},bi=Oe(2,function(t,e){return function(){return Promise.resolve().then(t).then(function(n){return e(n)()})}}),kt="Task",Et={URI:kt,map:St},In={of:Ct},gi={URI:kt,map:St,ap:En},vi={URI:kt,map:St,of:Ct,ap:En,chain:bi},wi=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function u(f){try{p(r.next(f))}catch(d){a(d)}}function l(f){try{p(r.throw(f))}catch(d){a(d)}}function p(f){f.done?o(f.value):i(f.value).then(u,l)}p((r=r.apply(t,e||[])).next())})},yi=function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(p){return function(f){return l([p,f])}}function l(p){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,p[0]&&(n=0)),n;)try{if(r=1,i&&(o=p[0]&2?i.return:p[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,p[1])).done)return o;switch(i=0,o&&(p=[p[0]&2,o.value]),p[0]){case 0:case 1:o=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,i=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]<o[3])){n.label=p[1];break}if(p[0]===6&&n.label<o[1]){n.label=o[1],o=p;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(p);break}o[2]&&n.ops.pop(),n.trys.pop();continue}p=e.call(t,n)}catch(f){p=[6,f],i=0}finally{r=o=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},U=ui(In),V=ai(In),De=Ct,Ye=fi(Et),Fi=Ye,An=function(t,e){return function(){return wi(void 0,void 0,void 0,function(){var n;return yi(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]}})})}},Si=function(t,e){return h(t,A(e))},Ci=function(t,e){return h(t,ki(e))},A=ci(Et),Ue=Oe(3,hi(Et)),ki=li(gi),It=Oe(2,pi(vi)),Ei=V,Ii="TaskEither",Ai={URI:Ii,map:Si,ap:Ci,chain:It},$i=Ei(mt),qi=bt(Ai),Xe=qi,te=It,ue=It;function ee(t){return typeof t=="function"?t():t}class We{constructor({onMounted:e,restoreState:n,initialState:r,onUnmounted:i,isPageReload:o}){s(this,"_isMounted",D(!1));s(this,"isMounted",S(this._isMounted));s(this,"mount");s(this,"unmount");this.mount=()=>{if(this.isMounted())return k(void 0);const a=ee(o)?n():void 0,u=a?k(a):typeof r=="function"?r():k(r);return h(u,z(l=>{Ze(()=>{this._isMounted.set(!0),e==null||e(l)})}))},this.unmount=()=>{this._isMounted()&&Ze(()=>{this._isMounted.set(!1),i==null||i()})}}}function At(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(i=>Object.prototype.hasOwnProperty.call(e,i)&&t[i]===e[i])}class me{constructor({initialState:e,onChange:n}){s(this,"_state");s(this,"state");s(this,"setState",e=>{const n={...this.state(),...At(e)};$t(n,this.state())||this._state.set(n)});this._state=D(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(),...At(e)},this.state())}}let ce;function qt(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)}}let Bt;function Bi(t){return Bt==null?void 0:Bt.get(t)}let Mt;function Mi(t){return Mt==null?void 0:Mt.get(t)}let Tt;function Ti(t,e){var n;return(n=Tt==null?void 0:Tt.get(t))==null?void 0:n.get(e)}function Vi(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,i){const o=i&&"input"in i?i.input:n.value,a=(i==null?void 0:i.expected)??t.expects??null,u=(i==null?void 0:i.received)??Vi(o),l={kind:t.kind,type:t.type,input:o,expected:a,received:u,message:`Invalid ${e}: ${a?`Expected ${a} but r`:"R"}eceived ${u}`,requirement:t.requirement,path:i==null?void 0:i.path,issues:i==null?void 0:i.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},p=t.kind==="schema",f=(i==null?void 0:i.message)??t.message??Ti(t.reference,l.lang)??(p?Mi(l.lang):null)??r.message??Bi(l.lang);f!==void 0&&(l.message=typeof f=="function"?f(l):f),p&&(n.typed=!1),n.issues?n.issues.push(l):n.issues=[l]}function Q(t){return{version:1,vendor:"valibot",validate(e){return t["~run"]({value:e},qt())}}}function $n(t,e){return Object.hasOwn(t,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function Pi(t,e){const n=[...new Set(t)];return n.length>1?`(${n.join(` ${e} `)})`:n[0]??"never"}var Ri=class extends Error{constructor(t){super(t[0].message),this.name="ValiError",this.issues=t}};function et(t,e){return{kind:"validation",type:"check",reference:et,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 Vt(t){return{kind:"validation",type:"integer",reference:Vt,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 Li(t,e,n){return typeof t.fallback=="function"?t.fallback(e,n):t.fallback}function Pt(t,e,n){return typeof t.default=="function"?t.default(e,n):t.default}function Rt(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 Bn(t,e){return{kind:"schema",type:"array",reference:Bn,expects:"Array",async:!1,item:t,message:e,get"~standard"(){return Q(this)},"~run"(n,r){var o;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 p={type:"array",origin:"value",input:i,key:a,value:u};for(const f of l.issues)f.path?f.path.unshift(p):f.path=[p],(o=n.issues)==null||o.push(f);if(n.issues||(n.issues=l.issues),r.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}}else J(this,"type",n,r);return n}}}function Se(t){return{kind:"schema",type:"boolean",reference:Se,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 tt(t){return{kind:"schema",type:"date",reference:tt,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 Ot(t,e){return{kind:"schema",type:"instance",reference:Ot,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 o;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]:Pt(u),p=u["~run"]({value:l},r);if(p.issues){const f={type:"object",origin:"value",input:i,key:a,value:l};for(const d of p.issues)d.path?d.path.unshift(f):d.path=[f],(o=n.issues)==null||o.push(d);if(n.issues||(n.issues=p.issues),r.abortEarly){n.typed=!1;break}}p.typed||(n.typed=!1),n.value[a]=p.value}else if(u.fallback!==void 0)n.value[a]=Li(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:i,key:a,value:i[a]}]}),r.abortEarly))break}if(!n.issues||!r.abortEarly)for(const a in i)$n(i,a)&&!(a in this.entries)&&(n.value[a]=i[a])}else J(this,"type",n,r);return n}}}function Be(t,e){return{kind:"schema",type:"nullish",reference:Be,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=Pt(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function be(t){return{kind:"schema",type:"number",reference:be,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 $(t,e){return{kind:"schema",type:"optional",reference:$,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=Pt(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function jt(t,e,n){return{kind:"schema",type:"record",reference:jt,expects:"Object",async:!1,key:t,value:e,message:n,get"~standard"(){return Q(this)},"~run"(r,i){var a,u;const o=r.value;if(o&&typeof o=="object"){r.typed=!0,r.value={};for(const l in o)if($n(o,l)){const p=o[l],f=this.key["~run"]({value:l},i);if(f.issues){const b={type:"object",origin:"key",input:o,key:l,value:p};for(const v of f.issues)v.path=[b],(a=r.issues)==null||a.push(v);if(r.issues||(r.issues=f.issues),i.abortEarly){r.typed=!1;break}}const d=this.value["~run"]({value:p},i);if(d.issues){const b={type:"object",origin:"value",input:o,key:l,value:p};for(const v of d.issues)v.path?v.path.unshift(b):v.path=[b],(u=r.issues)==null||u.push(v);if(r.issues||(r.issues=d.issues),i.abortEarly){r.typed=!1;break}}(!f.typed||!d.typed)&&(r.typed=!1),f.typed&&(r.value[f.value]=d.value)}}else J(this,"type",r,i);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 nt(t,e){return{kind:"schema",type:"union",reference:nt,expects:Pi(t.map(n=>n.expects),"|"),async:!1,options:t,message:e,get"~standard"(){return Q(this)},"~run"(n,r){let i,o,a;for(const u of this.options){const l=u["~run"]({value:n.value},r);if(l.typed)if(l.issues)o?o.push(l):o=[l];else{i=l;break}else a?a.push(l):a=[l]}if(i)return i;if(o){if(o.length===1)return o[0];J(this,"type",n,r,{issues:Mn(o)}),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 Dt(){return{kind:"schema",type:"unknown",reference:Dt,expects:"unknown",async:!1,get"~standard"(){return Q(this)},"~run"(t){return t.typed=!0,t}}}function ge(t,e,n){const r=t["~run"]({value:e},qt(n));if(r.issues)throw new Ri(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 Ut(t,e,n){const r=t["~run"]({value:e},qt(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var Oi=Object.defineProperty,ji=(t,e,n)=>e in t?Oi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Tn=(t,e,n)=>ji(t,typeof e!="symbol"?e+"":e,n),Di=Object.defineProperty,Ui=(t,e,n)=>e in t?Di(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Wt=(t,e,n)=>Ui(t,typeof e!="symbol"?e+"":e,n);function Vn(t){return e=>e instanceof t}function Pn(t,e){const n=class extends Error{constructor(...i){const o=typeof e=="function"?e(...i):typeof e=="string"?[e]:e||[];super(...o),this.name=t}};Wt(n,"is",Vn(n));let r=n;return Object.defineProperty(r,"name",{value:t}),r}function Wi(t,e,n){const r=class extends Pn(t,n){constructor(...o){super(...o),Wt(this,"data"),this.data=e(...o)}};Wt(r,"is",Vn(r));let i=r;return Object.defineProperty(i,"name",{value:t}),i}let Rn=class extends Pn("CancelledError","Promise was canceled"){},Gt=class extends Wi("TimeoutError",e=>({timeout:e}),(e,n)=>[`Timeout reached: ${e}ms`,{cause:n}]){};const Gi=Symbol("resolved");function Ni(t){return{tag:Gi,value:t}}function Ln(t,e){return t.reject=e.reject,t.resolve=e.resolve,t}class ve extends Promise{constructor(e,n){let r,i,o,a;typeof e=="function"?(o=e,a=n||{}):a=e||{};let u,l;const p=()=>!!l,f=()=>!!u;let d={};const b=[],v=()=>{b.forEach(g=>g()),b.splice(0,b.length),d={}},F=new AbortController,C=()=>f()||p();super((g,w)=>{const{abortOnResolve:m=!0,abortOnReject:O=!0}=a;i=I=>{var L,P;C()||(g(I),u=[I],(L=d.resolved)==null||L.forEach(N=>N(I)),(P=d.finalized)==null||P.forEach(N=>N({kind:"resolved",result:I})),v(),m&&F.abort(Ni(I)))},r=I=>{var L,P;C()||(w(I),l=[I],(L=d.rejected)==null||L.forEach(N=>N(I)),(P=d.finalized)==null||P.forEach(N=>N({kind:"rejected",reason:I})),v(),O&&F.abort(I))};const{abortSignal:j}=a;if(j){if(j.aborted)return r(j.reason);const I=()=>{r(j.reason)};j.addEventListener("abort",I,!0),b.push(()=>{j.removeEventListener("abort",I,!0)})}const{timeout:W}=a;if(W){const I=setTimeout(()=>{r(new Gt(W))},W);b.push(()=>{clearTimeout(I)})}try{const I=()=>{},L=o&&o(i,r,{abortSignal:F.signal,get isRejected(){return p()},get isResolved(){return f()},on(P,N){if(u||l){if(P==="finalized"){const Re=u?{kind:"resolved",result:u[0]}:{kind:"rejected",reason:l[0]};N(Re)}else P==="resolved"&&u?N(u[0]):P==="rejected"&&l&&N(l[0]);return I}return d[P]||(d[P]=[]),d[P].push(N),()=>{const Re=d[P]||[],Qe=Re.indexOf(N);Qe>=0&&Re.splice(Qe,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]}});L instanceof Promise&&L.catch(r)}catch(I){r(I)}}),Tn(this,"reject"),Tn(this,"resolve"),this.reject=r,this.resolve=i}static fn(e,n){return new ve(async(r,i,o)=>{try{r(await e(o))}catch(a){i(a)}},n)}static resolve(e){return this.fn(()=>e)}static reject(e){return new ve((n,r)=>{r(e)})}cancel(){this.reject(new Rn)}catch(e){return this.then(void 0,e)}finally(e){return Ln(super.finally(e),this)}then(e,n){return Ln(super.then(e,n),this)}}function On(t){return t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Hi(t){return t.replace(/_[a-z]/g,e=>e[1].toUpperCase())}function xi(t){return Object.entries(t).reduce((e,[n,r])=>(e[Hi(n)]=r,e),{})}function Nt(t){const e=xi(t);for(const n in e){const r=e[n];r&&typeof r=="object"&&!(r instanceof Date)&&(e[n]=Array.isArray(r)?r.map(Nt):Nt(r))}return e}function zi(t){return t.replace(/_([a-z])/g,(e,n)=>`-${n.toLowerCase()}`)}function jn(t){return`tapps/${t}`}function Ht(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 Ge(...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:i}=e,o=i===void 0?!0:i,a=typeof o=="boolean"?()=>o:o,u=(l,p,...f)=>{if(p||a()){const d="font-weight:bold;padding:0 5px;border-radius:100px",[b,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${t}`,`${d};background-color:${b};color:${v}`,"",`${d};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...f)}};return[["log","forceLog"],["warn","forceWarn"],["error","forceError"]].reduce((l,[p,f])=>(l[p]=u.bind(void 0,p,!1),l[f]=u.bind(void 0,p,!0),l),{})}function Ne(t){const e=n=>{throw n};return typeof t=="function"?ve.resolve(h(t,Ye(e,n=>n))()):h(t,ae(e,n=>n))}function ne(t){return Object.assign((...e)=>Ne(t(...e)),t)}const Me=Object.assign((t,e)=>h(An(()=>new ve((n,r,i)=>t(o=>n(k(o)),o=>n(M(o)),i),e),n=>n),ue(ae(U,V))),{fn:(t,e)=>Me((n,r,i)=>{const o=t(i);h(typeof o=="function"?o:De(o),Fi(r,n))()},e)});var Ki=Object.defineProperty,Ji=(t,e,n)=>e in t?Ki(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xt=(t,e,n)=>Ji(t,typeof e!="symbol"?e+"":e,n);function Wn(t){return e=>e instanceof t}function x(t,e){const n=class extends Error{constructor(...o){const a=typeof e=="function"?e(...o):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 rt(t,e,n){const r=class extends x(t,n){constructor(...a){super(...a),xt(this,"data"),this.data=e(...a)}};xt(r,"is",Wn(r));let i=r;return Object.defineProperty(i,"name",{value:t}),i}function Qi(t){const e=n=>{const r={};return new URLSearchParams(n).forEach((i,o)=>{const a=r[o];Array.isArray(a)?a.push(i):a===void 0?r[o]=i:r[o]=[a,i]}),ge(t,r)};return ie(nt([y(),Ot(URLSearchParams)]),et(n=>{try{return e(n),!0}catch{return!1}},"The value doesn't match required schema"),le(e))}function Zi(t){return ie(y(),et(e=>{try{return JSON.parse(e),!0}catch{return!1}},"Input is not a valid JSON value"),le(JSON.parse),t)}function pe(t){return ie(y(),Zi(t))}function zt(t){return ie(nt([y(),Ot(URLSearchParams)]),Qi(t))}function st(t){return e=>t.test(e)}const Gn=st(/^#[\da-f]{3}$/i),Nn=st(/^#[\da-f]{4}$/i),He=st(/^#[\da-f]{6}$/i),Hn=st(/^#[\da-f]{8}$/i);function xn(t){return[He,Hn,Gn,Nn].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 it(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,i)=>r+parseInt(i,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(it(t),z(e=>e.slice(0,7)))}const Yi=ne(Kn),Xi=ne(it);function eo(){return G({id:be(),photo_url:$(y()),type:y(),title:y(),username:$(y())})}function Jn(){return G({added_to_attachment_menu:$(Se()),allows_write_to_pm:$(Se()),first_name:y(),id:be(),is_bot:$(Se()),is_premium:$(Se()),last_name:$(y()),language_code:$(y()),photo_url:$(y()),username:$(y())})}function to(){return G({projectCode:y(),uid:y(),sessionId:y(),rootToken:y()})}function no(){return G({auth_date:ie(y(),le(t=>new Date(Number(t)*1e3)),tt()),can_send_after:$(ie(y(),le(Number),Vt())),chat:$(pe(eo())),chat_type:$(y()),chat_instance:$(y()),hash:$(y()),query_id:$(y()),receiver:$(pe(Jn())),start_param:$(y()),signature:$(y()),user:$(pe(Jn())),auth:$(pe(to()))})}function Qn(){return zt(no())}function Kt(){return jt(y(),ie(nt([y(),be()]),le(t=>typeof t=="number"?`#${(t&16777215).toString(16).padStart(6,"0")}`:t),et(xn)))}function ro(){const t=$(ie(y(),le(e=>e==="1")));return G({vbWebAppBotInline:t,vbWebAppData:$(Qn()),vbWebAppDefaultColors:$(pe(Kt())),vbWebAppFullscreen:t,vbWebAppPlatform:y(),vbWebAppShowSettings:t,vbWebAppStartParam:$(y()),vbWebAppThemeParams:pe(Kt()),vbWebAppVersion:y()})}function so(){return zt(ro())}function Zn(){return G({eventType:y(),eventData:$(Dt())})}function Yn(t){return qe(()=>ge(Qn(),t),e=>e)}function ot(t){return qe(()=>ge(so(),t),e=>e)}const io=ne(Yn),Xn=ne(ot);function er(t,e){return e||(e=(n,r)=>JSON.stringify(r)),new URLSearchParams(Object.entries(t).reduce((n,[r,i])=>(Array.isArray(i)?n.push(...i.map(o=>[r,String(o)])):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":e(r,i)]),n),[])).toString()}function tr(t){return er(t)}function nr(t){return er(t,(e,n)=>e==="vbWebAppData"?tr(n):JSON.stringify(n))}function oo(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(i){i(n)}),(r=t.get("*"))&&r.slice().map(function(i){i(e,n)})}}}function rr(t){return Rt(G({VBotWebviewProxy:G({postEvent:Lt()})}),t)}function sr(){try{return window.self!==window.top}catch{return!0}}class ir extends x("MethodUnsupportedError",(e,n)=>[`Method "${e}" is unsupported in Mini Apps version ${n}`]){}class or extends x("MethodParameterUnsupportedError",(e,n,r)=>[`Parameter "${n}" of "${e}" method is unsupported in Mini Apps version ${r}`]){}class ar extends rt("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.vbot-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
|
|
3
|
-
`),e,a)}mo(n,o)}const{on:Z,off:Ce,emit:mo,clear:bo}=lo(()=>{const t=window;!t.TelegramGameProxy&&(t.TelegramGameProxy={}),Yt(t.TelegramGameProxy,"receiveEvent",at),_r(t,"TelegramGameProxy"),!t.VBot&&(t.VBot={}),!t.VBot.WebView&&(t.VBot.WebView={}),Yt(t.VBot.WebView,"receiveEvent",at),_r(t.VBot,"WebView"),Yt(t,"TelegramGameProxy_receiveEvent",at),window.addEventListener("message",gr)},()=>{[["TelegramGameProxy_receiveEvent"],["TelegramGameProxy","receiveEvent"],["VBot","WebView","receiveEvent"]].forEach(t=>{const e=window;let n=[void 0,e];for(const o of t)if(n=[n[1],n[1][o]],!n[1])return;const[r,i]=n;"unwrap"in i&&(i.unwrap(),r&&r!==e&&!Object.keys(r).length&&delete e[t[0]])}),window.removeEventListener("message",gr)}),go=(...t)=>ut()(...t);function vo(t,e){h(Ve(t,e),ei(n=>{throw n}))}function Ve(t,e){he().log("Posting event:",e?{eventType:t,eventData:e}:{eventType:t});const n=window,r=JSON.stringify({eventType:t,eventData:e});return sr()?(go(r,dr()),k(void 0)):rr(n)?(n.VBotWebviewProxy.postEvent(t,JSON.stringify(e)),k(void 0)):Rt(G({external:G({notify:Lt()})}),n)?(n.external.notify(r),k(void 0)):M(new Jt)}function ct(t,e,n={}){const{capture:r=()=>!0,postEvent:i=Ve}=n,o=D(),[a,u]=Ge();(Array.isArray(e)?e:[e]).forEach(p=>{a(Z(p,f=>{const d=Array.isArray(e);r(d?{event:p,payload:f}:f)&&o.set([d?{event:p,payload:f}:f])}))});const l=p=>(u(),p);return h(async()=>i(t,n.params),ue(()=>Me((p,f,d)=>{const b=o();if(b)return p(b[0]);const v=C=>{C&&p(C[0])},F=()=>{o.unsub(v)};o.sub(v),d.on("finalized",F)},n)),Ue(l,l))}function wo(t,e){const n=Xt(t,e);return typeof n=="function"?ve.fn(()=>Ne(n)):n}function Xt(t,e){const n=rr(window);if(!t)return n||h(xe(),ae(()=>!1,()=>!0));if(n)return V(!0);const{timeout:r=100}=e||{};return h(ct("web_app_request_theme","theme_changed",{...e,timeout:r}),Ye(i=>Gt.is(i)||Jt.is(i)?k(!1):M(i),()=>k(!0)))}function yo({launchParams:t,onEvent:e,resetPostMessage:n}={}){if(t){const o=typeof t=="string"||t instanceof URLSearchParams?t.toString():nr({...t,vbWebAppData:void 0})+(t.vbWebAppData?`&vbWebAppData=${encodeURIComponent(t.vbWebAppData.toString())}`:"");try{Xn(o)}catch(a){throw new ur(o,a)}Ht("launchParams",o)}if(sr()){if(!e)return;n&&ut.reset();const o=ut();ut.set((...a)=>{const[u]=a,l=()=>{o(...a)};try{const p=ge(pe(Zn()),u);e({name:p.eventType,params:p.eventData},l)}catch{l()}});return}const r=window.VBotWebviewProxy||{},i=r.postEvent||(()=>{});window.VBotWebviewProxy={...r,postEvent(o,a){const u=()=>{i(o,a)};e?e({name:o,params:a?JSON.parse(a):void 0},u):u()}},he().log("Environment was mocked by the mockVBotEnv function")}function lt(){throw new Error("HostBridge not initialized. Call defineHostBridge() first.")}function vr(t){return({req_id:e})=>e===t}const wr={"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"],9.2:["web_app_send_notification","web_app_finish_refresh"]};function en(t,e){return Object.keys(wr).find(n=>wr[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 Fo(t,e){const n=yr(t),r=yr(e),i=Math.max(n.length,r.length);for(let o=0;o<i;o+=1){const a=n[o]||0,u=r[o]||0;if(a!==u)return a>u?1:-1}return 0}function fe(t,e,n){const r=n?en(t,e):en(t);return r?Fo(r,n||e)<=0:!1}function So(t,e="strict"){const n=typeof e=="function"?e:r=>{const{method:i,version:o}=r,a="param"in r?new or(i,r.param,o):new ir(i,o);if(e==="strict")throw a;return he().forceWarn(a.message)};return((r,i)=>fe(r,t)?r==="web_app_set_header_color"&&Rt(G({color:qn()}),i)&&!fe(r,"color",t)?n({version:t,method:r,param:"color"}):vo(r,i):n({version:t,method:r}))}function Co(t,e,n,r){return h(ct("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:t,params:e,req_id:n},capture:vr(n)}),te(({result:i,error:o})=>o?U(new cr(o)):V(i)))}function ko(t,e,n={}){const{capture:r=()=>!0,postEvent:i=Ve}=n,o=D(),[a,u]=Ge();(Array.isArray(e)?e:[e]).forEach(p=>{a(Z(p,f=>{(Array.isArray(e)?r({event:p,payload:f}):r(f))&&o.set([f])}))});const l=p=>(u(),p);return h(async()=>i(t,n.params),ue(()=>Me((p,f,d)=>{const b=o();if(b)return p(b[0]);const v=C=>{C&&p(C[0])},F=()=>{o.unsub(v)};o.sub(v),d.on("finalized",F)},n)),Ue(l,l))}function Eo(){Object.hasOwn||(Object.hasOwn=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)})}function tn(t){return qe(()=>decodeURIComponent(atob(t.replace(/-/g,"+").replace(/_/g,"/")).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")),e=>e)}const Io=ne(tn);function nn(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=nn(typeof t=="string"?t:JSON.stringify(t));return e.length>512?M(new Error("Value is too long for start parameter")):k(e)}const Ao=ne(Fr);function $o(t,e){return Ne(Sr(t,typeof e=="function"?n=>qe(()=>e(n),r=>r):e))}function Sr(t,e){return h(tn(t),oi(n=>e?typeof e=="function"?e(n):di(n):k(n)))}function qo(t){return nn(t).length<=512}function oe(t,e){return S(()=>fe(t,ee(e)))}function _(t){return Object.assign(ne(t),{ifAvailable(...e){return h(t.ifAvailable(...e),gt(()=>({ok:!1}),n=>({ok:!0,data:Ne(n)})))}})}function ke(t){return[t]}class ze extends rt("ValidationError",(e,n)=>({input:e,issues:n}),"Validation error"){}class pt extends x("CSSVarsBoundError","CSS variables are already bound"){}class Cr extends rt("DeviceStorageMethodError",e=>({error:e}),e=>[e]){}class kr extends rt("SecureStorageMethodError",e=>({error:e}),e=>[e]){}class Er extends x("NotAvailableError",ke){}class Bo extends x("InvalidEnvError",ke){}class Ir extends x("FunctionNotAvailableError",ke){}class re extends x("InvalidArgumentsError",(e,n)=>[e,{cause:n}]){}class ht extends x("ConcurrentCallError",ke){}class Ar extends x("SetEmojiStatusError",e=>[`Failed to set emoji status: ${e}`]){}class rn extends x("AccessDeniedError",ke){}class $r extends x("FullscreenFailedError",ke){}class qr extends x("ShareMessageError",ke){}class Br extends x("UnknownThemeParamsKeyError",e=>[`Unknown theme params key passed: ${e}`]){}function R(t,e){const n=S(()=>ee(e.version)||"100"),r=S(()=>ee(e.isTma)),{requires:i,returns:o}=e,a=i?typeof i=="object"?i:{every:[i]}:void 0,u=g=>{if(!e.supports)return!0;const w=e.supports[g];return fe(w.method,w.param,n())},l=()=>{if(!a)return;const[g,w]="every"in a?["every",a.every]:["some",a.some];for(let m=0;m<w.length;m++){const O=w[m],j=typeof O=="function"?O():fe(O,n())?void 0:`it is unsupported in Mini Apps version ${n()}`;if(j&&(g==="every"||m===w.length-1))return j}},p=(...g)=>{for(const w in e.supports)if(e.supports[w].shouldCheck(...g)&&!u(w))return`option ${w} is not supported in Mini Apps version ${n()}`},f=S(()=>!l()),d=S(()=>n()!=="0.0"),b=S(()=>e.isMounted?e.isMounted():!0),v=S(()=>r()&&d()&&f()&&b()),F=g=>{const w=new Ir(g);return["task","promise"].includes(e.returns)?U(w):M(w)},C=(...g)=>o==="plain"?qe(()=>t(...g),w=>w):o==="promise"?An(()=>t(...g),w=>w):t(...g);return Object.assign((...g)=>{var j;const w="Unable to call function:";if(!r())return F(`${w} it can't be called outside Mini Apps`);if(!d())return F(`${w} the SDK was not initialized. Use the SDK init() function`);const m=l();if(m)return F(`${w} ${m}`);const O=p(...g);if(O)return F(`${w} ${O}`);if(!b()){const W=(j=e.isMounting)!=null&&j.call(e)?"mounting. Wait for the mount completion":"unmounted. Use the mount() method";return F(`${w} the component is ${W}`)}return C(...g)},t,{isAvailable:v,ifAvailable(...g){return v()?$e(C(...g)):Fe}},a?{isSupported:f}:{},e.supports?{supports:u}:{})}function B(t){return e=>R(e,t)}class ft{constructor({isTma:e,storage:n,onClick:r,offClick:i,initialState:o,isPageReload:a,postEvent:u,payload:l,method:p,version:f}){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 d=new me({initialState:o,onChange(g){n.set(g)}}),b=new We({initialState:o,isPageReload:a,onMounted:d.setState,restoreState:n.get}),v={version:f,requires:p,isTma:e},F=B({...v,returns:"plain"}),C=B({...v,returns:"either",isMounted:b.isMounted});this.isMounted=b.isMounted,this.isSupported=oe(p,f),this.state=d.state,this.setStateFp=C(g=>{const w={...this.state(),...At(g)};return d.hasDiff(w)?h(u(p,l(w)),z(()=>{d.setState(w)})):k(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 g=()=>{};return h(b.mount(),ae(g,g))}),this.mount=_(this.mountFp),this.unmount=b.unmount,this.stateSetters=g=>{const w=C(m=>this.setStateFp({[g]:m}));return[_(w),w]},this.stateBoolSetters=g=>{const[,w]=this.stateSetters(g),m=C(()=>w(!1)),O=C(()=>w(!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 ft({...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 Pe(t){return e=>({...e,...ee(t)})}function Ke(t,e){return D(t,e)}const Tr=Ke(Ve),Ee=(...t)=>Tr()(...t),Vr=(...t)=>Ne(Ee(...t)),K=Pe({postEvent:Ee});function Mo(t){return{get:()=>Dn(t),set(e){Ht(t,e)}}}function To(){return performance.getEntriesByType("navigation")[0]}function Vo(){const t=To();return!!t&&t.type==="reload"}function we(t){return Pe({storage:Mo(t),isPageReload:Vo})}const sn=Ke("0.0"),q=Pe({version:sn});function on(t,e){return{...h(E(),K,q,we(t)),onClick(n,r){return Z(e,n,r)},offClick(n,r){Ce(e,n,r)}}}const Po=new Mr(on("backButton","back_button_pressed"));class an{constructor({initialState:e,onMounted:n,restoreState:r,onUnmounted:i,isPageReload:o}){s(this,"_isMounted",D(!1));s(this,"isMounted",S(this._isMounted));s(this,"mount");s(this,"unmount");this.mount=a=>{if(this._isMounted())return V(void 0);const u=ee(o)?r():void 0;return h(u?V(u):e(a),A(l=>{this._isMounted()||Ze(()=>{this._isMounted.set(!0),n==null||n(l)})}))},this.unmount=()=>{this._isMounted()&&Ze(()=>{this._isMounted.set(!1),i==null||i()})}}}function Pr(){return new Er("Biometry is not available")}function un(t){let e=!1,n=!1,r="",i=!1,o="",a=!1;return t.available&&(e=!0,n=t.token_saved,r=t.device_id,i=t.access_requested,o=t.type,a=t.access_granted),{available:e,tokenSaved:n,deviceId:r,type:o,accessGranted:a,accessRequested:i}}class Rr{constructor({version:e,request:n,postEvent:r,storage:i,onInfoReceived:o,offInfoReceived:a,isTma:u,isPageReload:l}){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 p=g=>{f.setState(un(g))},f=new me({initialState:{available:!1,type:"unknown",accessGranted:!1,accessRequested:!1,deviceId:"",tokenSaved:!1},onChange:i.set}),d=new an({initialState(g){return h(n("web_app_biometry_get_info","biometry_info_received",g),A(un))},isPageReload:l,onMounted(g){f.setState(g),o(p)},onUnmounted(){a(p)},restoreState:i.get}),b={version:e,requires:"web_app_biometry_request_auth",isTma:u},v=B({...b,returns:"either"}),F=B({...b,returns:"task"}),C=B({...b,isMounted:d.isMounted,returns:"task"});this.isAvailable=f.getter("available"),this.isMounted=d.isMounted,this.isSupported=oe("web_app_biometry_request_auth",e),this.state=f.state,this.unmount=d.unmount,this.mountFp=F(d.mount),this.authenticateFp=C(g=>this.isAvailable()?h(n("web_app_biometry_request_auth","biometry_auth_requested",{...g,params:{reason:((g||{}).reason||"").trim()}}),A(w=>(f.setState({token:w.token}),w))):U(Pr())),this.openSettingsFp=v(()=>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(w=>{const m=un(w);return m.available?(f.setState(m),V(m.accessRequested)):U(Pr())}))),this.updateTokenFp=C((g={})=>{var w;return h(n("web_app_biometry_update_token","biometry_token_updated",{...g,params:{token:g.token||"",reason:(w=g.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 Lr=(t,e,n)=>ko(t,e,{postEvent:Ee,...n}),cn=(t,e,n)=>ct(t,e,{postEvent:Ee,...n}),Ro=(...t)=>ve.fn(()=>Lr(...t)()),Lo=(...t)=>ve.fn(()=>cn(...t)()),Y=Pe({request:cn});function Oo(){return new Rr({...h(E(),K,q,Y,we("biometry")),offInfoReceived(t){Ce("biometry_info_received",t)},onInfoReceived(t){return Z("biometry_info_received",t)}})}const jo=Oo();class Or{constructor({postEvent:e,storage:n,isTma:r,isPageReload:i}){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 o=new me({initialState:{isConfirmationEnabled:!1},onChange(d){n.set(d)}}),a=new We({onMounted:o.setState,restoreState:n.get,initialState:{isConfirmationEnabled:!1},isPageReload:i}),u={requires:"web_app_setup_closing_behavior",isTma:r},l=B({...u,returns:"plain"}),p=B({...u,returns:"either",isMounted:a.isMounted}),f=d=>d===this.isConfirmationEnabled()?k(void 0):(o.setState({isConfirmationEnabled:d}),e("web_app_setup_closing_behavior",{need_confirmation:d}));this.isConfirmationEnabled=o.getter("isConfirmationEnabled"),this.isMounted=a.isMounted,this.disableConfirmationFp=p(()=>f(!1)),this.enableConfirmationFp=p(()=>f(!0)),this.mountFp=l(()=>{const d=()=>{};return h(a.mount(),ae(d,d))}),this.unmount=a.unmount,this.disableConfirmation=_(this.disableConfirmationFp),this.enableConfirmation=_(this.enableConfirmationFp),this.mount=_(this.mountFp)}}function Do(){return new Or(h(E(),we("closingBehavior"),K))}const Uo=Do();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 i=B({version:e,requires:"web_app_invoke_custom_method",isTma:n,returns:"task"});this.isSupported=oe("web_app_invoke_custom_method",e),this.deleteItemFp=i((o,a)=>{const u=Array.isArray(o)?o:[o];return h(u.length?r("deleteStorageValues",{keys:u},a):V(void 0),A(()=>{}))}),this.getItemFp=i((o,a)=>h(this.getItemsFp([o],a),A(u=>u[o]||""))),this.getItemsFp=i((o,a)=>h(o.length?r("getStorageValues",{keys:o},a):V({}),A(u=>({...o.reduce((l,p)=>(l[p]="",l),{}),...ge(jt(y(),y()),u)})))),this.getKeysFp=i(o=>h(r("getStorageKeys",{},o),A(a=>ge(Bn(y()),a)))),this.setItemFp=i((o,a,u)=>h(r("saveStorageValue",{key:o,value:a},u),A(()=>{}))),this.clearFp=i(o=>h(this.getKeysFp(o),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 ln=Ke(0);function dt(){return ln.set(ln()+1),ln().toString()}function Dr(t,e,n){return Co(t,e,dt(),{...n||{},postEvent:Ee})}const pn=Pe({invokeCustomMethod:Dr});function Wo(){return new jr(h(E(),q,pn))}const Go=Wo();class Ur{constructor({isTma:e,request:n,version:r,createRequestId:i}){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 o=B({version:r,requires:"web_app_device_storage_get_key",isTma:e,returns:"task"}),a=(u,l,p)=>{const f=i();return h(n(u,["device_storage_failed",l],{params:{...p,req_id:f},capture:(d=>"payload"in d?d.payload.req_id===f:!0)}),te(d=>d.event==="device_storage_failed"?U(new Cr(d.payload.error||"UNKNOWN_ERROR")):V(d.payload)))};this.getItemFp=o(u=>h(a("web_app_device_storage_get_key","device_storage_key_received",{key:u}),A(l=>l.value))),this.setItemFp=o((u,l)=>h(a("web_app_device_storage_save_key","device_storage_key_saved",{key:u,value:l}),A(()=>{}))),this.deleteItemFp=o(u=>this.setItemFp(u,null)),this.clearFp=o(()=>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=Pe({createRequestId:dt});function No(){return new Ur(h(E(),q,Y,Wr))}const Ho=No();function xo({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 zo(){return xo(h(E(),q,Y))}const Gr=zo(),Ko=_(Gr);function Jo({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(i=>i.event==="emoji_status_failed"?U(new Ar(i.payload.error)):V(void 0))),{...e,requires:"web_app_set_emoji_status",returns:"task"})}function Qo(){return Jo(h(E(),Y,q))}const Nr=Qo(),Zo=_(Nr);class Hr{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 i="web_app_trigger_haptic_feedback",o=B({requires:i,isTma:n,version:r,returns:"plain"});this.isSupported=oe(i,r),this.impactOccurredFp=o(a=>e(i,{type:"impact",impact_style:a})),this.notificationOccurredFp=o(a=>e(i,{type:"notification",notification_type:a})),this.selectionChangedFp=o(()=>e(i,{type:"selection_change"})),this.impactOccurred=_(this.impactOccurredFp),this.notificationOccurred=_(this.notificationOccurredFp),this.selectionChanged=_(this.selectionChangedFp)}}function Yo(){return new Hr(h(E(),K,q))}const Xo=Yo();function ea({postEvent:t,...e}){return R(()=>t("web_app_add_to_home_screen"),{...e,requires:"web_app_add_to_home_screen",returns:"either"})}function ta(){return ea(h(E(),q,K))}const xr=ta(),na=_(xr);function ra({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 sa(){return ra(h(E(),q,Y))}const zr=sa(),ia=_(zr);class Kr{constructor({retrieveInitData:e}){s(this,"_state",D());s(this,"_raw",D());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,"auth",this.fromState("auth"));s(this,"user",this.fromState("user"));s(this,"restoreFp");s(this,"restore");this.restoreFp=()=>h(e(),z(gt(()=>{},({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 oa(){return new Kr({retrieveInitData(){return h(ri,kn("obj",()=>h(Te(),z(({vbWebAppData:t})=>t?$e(t):Fe))),kn("raw",Qt),z(({obj:t,raw:e})=>h(xs,Sn("obj",()=>t),Sn("raw",()=>e))))}})}const aa=oa();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 i=B({version:e,isTma:r,requires:"web_app_open_invoice",returns:"task"}),o=D(!1),a=()=>{o.set(!1)};this.isSupported=oe("web_app_open_invoice",e),this.isOpened=S(o),this.openSlugFp=i((u,l)=>h(this.isOpened()?U(new ht("Invoice is already opened")):V(void 0),te(()=>(o.set(!0),n("web_app_open_invoice","invoice_closed",{...l,params:{slug:u},capture:p=>u===p.slug}))),Ue(p=>(a(),p),p=>(a(),p.status)))),this.openUrlFp=i((u,l)=>{const{hostname:p,pathname:f}=new URL(u,window.location.href);if(p!=="t.me")return U(new re(`Link has unexpected hostname: ${p}`));const d=f.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);return d?this.openSlugFp(d[2],l):U(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 ua(){return new Jr(h(E(),Y,q))}const ca=ua();function la({postEvent:t,...e}){return R((n,r={})=>{if(typeof n=="string")try{n=new URL(n)}catch(i){return M(new re(`"${n.toString()}" is invalid URL`,i))}return t("web_app_open_link",{url:n.toString(),try_browser:r.tryBrowser,try_instant_view:r.tryInstantView})},{...e,returns:"either"})}function pa(){return la(h(E(),K))}const Qr=pa(),ha=_(Qr);function fa({postEvent:t,version:e,...n}){return R(r=>{const i=r.toString();return i.match(/^https:\/\/t.me\/.+/)?fe("web_app_open_tg_link",ee(e))?(r=new URL(r),t("web_app_open_tg_link",{path_full:r.pathname+r.search})):(window.location.href=i,k(void 0)):M(new re(`"${i}" is invalid URL`))},{...n,returns:"either"})}function da(){return fa(h(E(),K,q))}const hn=da(),_a=_(hn);function ma({openVbotLink: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 ba(){return ma({...E(),openVbotLink:hn})}const Zr=ba(),ga=_(Zr);function va(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 Yr{constructor({version:e,request:n,postEvent:r,storage:i,isTma:o,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 me({initialState:{available:!1,accessGranted:!1,accessRequested:!1},onChange:i.set}),l=new an({isPageReload:a,restoreState:i.get,onMounted:u.setState,initialState(v){return h(n("web_app_check_location","location_checked",v),A(va))}}),p={version:e,requires:"web_app_check_location",isTma:o},f=B({...p,returns:"either"}),d=B({...p,returns:"task"}),b=B({...p,returns:"task",isMounted:l.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=l.isMounted,this.state=u.state,this.unmount=l.unmount,this.mountFp=d(l.mount),this.openSettingsFp=f(()=>r("web_app_open_location_settings")),this.requestLocationFp=b(v=>h(n("web_app_request_location","location_requested",v),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 wa(){return new Yr(h(E(),K,q,Y,we("locationManager")))}const ya=wa();class Xr{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 ft({...n,version:"100",initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Continue"},method:"web_app_setup_main_button",payload:o=>({has_shine_effect:o.hasShineEffect,is_visible:o.isVisible,is_active:o.isEnabled,is_progress_visible:o.isLoaderVisible,text:o.text,color:o.bgColor,text_color:o.textColor})}),i=(o,a)=>{const u=r.stateGetter(o);return S(()=>u()||ee(a))};this.bgColor=i("bgColor",e.bgColor),this.textColor=i("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 fn(t,e){document.documentElement.style.setProperty(t,e)}function dn(t){document.documentElement.style.removeProperty(t)}function es(t){return h(it(t),z(e=>Math.sqrt([.299,.587,.114].reduce((n,r,i)=>{const o=parseInt(e.slice(1+i*2,1+(i+1)*2),16);return n+o*o*r},0))<120))}const _n=ne(es);class ts{constructor({initialState:e,onChange:n,offChange:r,isTma:i,storage:o,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",D(!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||_n(e)}));s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");const u=new me({initialState:{},onChange:o.set}),l=v=>{u.setState(v.theme_params)},p=new We({initialState:()=>k(ee(e)),isPageReload:a,onMounted(v){u.setState(v),n(l)},onUnmounted(){r(l)},restoreState:o.get}),f={isTma:i,returns:"either"},d=B(f),b=B({...f,isMounted:p.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=p.isMounted,this.bindCssVarsFp=b(v=>{if(this._isCssVarsBound())return M(new pt);v||(v=g=>`--tg-theme-${zi(g)}`);const F=g=>{Object.entries(u.state()).forEach(([w,m])=>{m&&g(w,m)})},C=()=>{F((g,w)=>{fn(v(g),w)})};return C(),u.state.sub(C),this._isCssVarsBound.set(!0),k(()=>{F(dn),u.state.unsub(C),this._isCssVarsBound.set(!1)})}),this.mountFp=d(p.mount),this.unmount=p.unmount,this.bindCssVars=_(this.bindCssVarsFp),this.mount=_(this.mountFp)}}const mn=Ke({});function Fa(){return new ts({...h(E(),we("themeParams")),offChange(t){Ce("theme_changed",t)},onChange(t){Z("theme_changed",t)},initialState:mn})}const Je=Fa();function ns(t,e,n){return h(on(t,e),r=>({...r,defaults:n}))}const Sa=new Xr(ns("mainButton","main_button_pressed",{bgColor:S(()=>Je.buttonColor()||"#2481cc"),textColor:S(()=>Je.buttonTextColor()||"#ffffff")}));class rs{constructor({storage:e,isPageReload:n,version:r,postEvent:i,isTma:o,theme:a,onVisibilityChanged:u,offVisibilityChanged:l}){s(this,"isSupported");s(this,"isDark",S(()=>{const e=this.bgColorRgb();return e?_n(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 p=m=>{b.setState({isActive:m.is_visible})},f=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 W=O();if(!He(W)&&(j!=="web_app_set_header_color"||!["bg_color","secondary_bg_color"].includes(W))){const I=m[W];I&&i(j,{color:I})}})},d=new We({initialState(){return k({bgColor:"bg_color",headerColor:"header_bg_color",bottomBarColor:"bottom_bar_bg_color",isActive:!0})},isPageReload:n,onMounted:m=>{u(p),a.sub(f),b.setState(m)},onUnmounted(){l(p),a.unsub(f)},restoreState:e.get});this.isMounted=d.isMounted,this.mountFp=R(()=>{const m=()=>{};return h(d.mount(),ae(m,m))},{isTma:o,returns:"plain"}),this.mount=_(this.mountFp),this.unmount=d.unmount;const b=new me({initialState:{bgColor:"bg_color",bottomBarColor:"bottom_bar_bg_color",headerColor:"bg_color",isActive:!1},onChange:e.set});this.state=b.state;const v=m=>He(m)?m:ee(a)[m],F=m=>S(()=>v(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=>fe(m,ee(r))));const C=D(!1);this.isCssVarsBound=S(C),this.bindCssVarsFp=R(m=>{if(C())return M(new pt);const[O,j]=Ge(()=>{C.set(!1)}),W=(I,L)=>{const P=()=>{fn(I,L()||null)};P(),O(L.sub(P),dn.bind(null,I))};return m||(m=I=>`--tg-${On(I)}`),W(m("bgColor"),this.bgColorRgb),W(m("bottomBarColor"),this.bottomBarColorRgb),W(m("headerColor"),this.headerColorRgb),C.set(!0),k(j)},{isTma:o,returns:"either",isMounted:this.isMounted}),this.bindCssVars=_(this.bindCssVarsFp);const g=m=>{const O=b.getter(m),j=F(O),W={headerColor:"web_app_set_header_color",bgColor:"web_app_set_background_color",bottomBarColor:"web_app_set_bottom_bar_color"}[m],I=R(L=>{if(L===O())return k(void 0);if(W==="web_app_set_header_color"&&(L==="bg_color"||L==="secondary_bg_color"))return h(i("web_app_set_header_color",{color_key:L}),z(()=>{b.setState({[m]:L})}));const P=v(L);return h(P?i(W,{color:P}):M(new Br(L)),z(()=>{b.setState({[m]:L})}))},{isTma:o,version:r,requires:W,isMounted:this.isMounted,returns:"either",supports:m==="headerColor"?{rgb:{method:"web_app_set_header_color",param:"color",shouldCheck:He}}:void 0});return[O,j,_(I),I]};[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 w=B({isTma:o,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 Ca(){return new rs({...h(E(),K,q,we("miniApp")),offVisibilityChanged(t){Ce("visibility_changed",t)},onVisibilityChanged(t){Z("visibility_changed",t)},theme:Je.state})}const ss=Ca();function ka(){const t=Date.now(),e=Math.random().toString(36).substring(2,9);return`notif_${t}_${e}`}class is{constructor({}){s(this,"sendFp");s(this,"send");this.sendFp=e=>h(De(Ve("web_app_send_notification",{id:ka(),message:e.message,title:e.title,type:e.type??"default"})),A(()=>{})),this.send=e=>this.sendFp(e)().then(r=>{if(r._tag==="Left")throw r.left;return r.right})}}function Ea(){return new is(h(E()))}const Ia=Ea();function Aa(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 i=[];if(!r.length)i.push({type:"close",id:""});else for(let o=0;o<r.length;o++){const a=r[o],u=a.id||"";if(u.length>64)return M(new re(`Button with index ${o} has invalid id: ${u}`));if(!a.type||a.type==="default"||a.type==="destructive"){const l=a.text.trim();if(!l||l.length>64)return M(new re(`Button with index ${o} has invalid text: ${l}`));i.push({type:a.type,text:l,id:u})}else i.push({type:a.type,id:u})}return k({title:n,message:e,buttons:i})}class os{constructor({version:e,isTma:n,request:r}){s(this,"isOpened");s(this,"isSupported");s(this,"showFp");s(this,"show");const i=D(!1),o=()=>{i.set(!1)},a=B({version:e,isTma:n,requires:"web_app_open_popup",returns:"task"});this.isSupported=oe("web_app_open_popup",e),this.isOpened=S(i),this.showFp=a(u=>h(this.isOpened()?U(new ht("A popup is already opened")):V(void 0),ue(()=>De(Aa(u))),te(l=>(i.set(!0),r("web_app_open_popup","popup_closed",{...u,params:l}))),Ue(l=>(o(),l),l=>(o(),l.button_id)))),this.show=_(this.showFp)}}function $a(){return new os(h(E(),Y,q))}const qa=$a();function Ba({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 Ma(){return Ba(h(E(),q,Y))}const bn=Ma(),Ta=_(bn);function Va({invokeCustomMethod:t,requestPhoneAccess:e,...n}){const r=a=>h(t("getRequestedContact",{},{...a,timeout:(a||{}).timeout||5e3}),ue(u=>{const l=Ut(y(),u);if(!l.success)return U(new ze(u,l.issues));if(!l.output)return V(void 0);const p=Ut(zt(G({contact:pe(G({user_id:be(),phone_number:y(),first_name:y(),last_name:$(y())})),auth_date:ie(y(),le(f=>new Date(Number(f)*1e3)),tt()),hash:y()})),l.output);return p.success?V({raw:l.output,parsed:p.output}):U(new ze(l.output,p.issues))})),i=a=>h(r(a),Ye(u=>ze.is(u)?M(u):k(void 0),u=>k(u))),o=a=>Me(async(u,l,p)=>{let f=50;for(;!p.isRejected;){const d=await i(p)();if(d._tag==="Left")return l(d.left);if(d.right)return u(d.right);await new Promise(b=>setTimeout(b,f)),f+=50}},a);return R(a=>Me.fn(u=>h(i(u),te(l=>l?V(l):h(e(u),ue(p=>p==="sent"?o(u):U(new rn("User denied access")))))),a),{...n,returns:"task",requires:"web_app_request_phone"})}function Pa(){return Va({...h(E(),pn,q),requestPhoneAccess:bn})}function Ra({requestContact:t,...e}){return R(t,{...e,returns:"task",requires:"web_app_request_phone"})}function La(){return Ra({...h(E(),q),requestContact(t){return h(gn(t),A(e=>e.parsed))}})}const gn=Pa(),Oa=_(gn),as=La(),ja=_(as);function Da({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 Ua(){return Da(h(E(),q,Y))}const us=Ua(),Wa=_(us);class cs{constructor({version:e,onClosed:n,onTextReceived:r,isTma:i,postEvent:o}){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:i},u=B({...a,returns:"either"}),l=B({...a,returns:"task"}),p=D(!1),f=()=>{p.set(!1)};this.isSupported=oe("web_app_open_scan_qr_popup",e),this.isOpened=S(p),this.captureFp=l(d=>{let b;return h(this.openFp({...d,onCaptured:v=>{d.capture(v)&&(b=v,this.close())}}),A(()=>b))}),this.closeFp=u(()=>h(o("web_app_close_scan_qr_popup"),z(f))),this.openFp=l(d=>h(p()?U(new ht("The QR Scanner is already opened")):async()=>o("web_app_open_scan_qr_popup",{text:d.text}),ue(()=>{p.set(!0);const[b,v]=Ge(),F=C=>(v(),p.set(!1),C);return h(Me(C=>{b(n(C),p.sub(g=>{g||C()}),r(d.onCaptured))},d),Ue(F,F))}))),this.open=_(this.openFp),this.capture=_(this.captureFp),this.close=_(this.closeFp)}}function Ga(){return new cs({...h(E(),K,q),onClosed(t){return Z("scan_qr_popup_closed",t)},onTextReceived(t){return Z("qr_text_received",e=>{t(e.data)})}})}const Na=Ga();class ls{constructor({}){s(this,"isRefreshing");s(this,"finishRefreshFp");s(this,"finishRefresh");s(this,"onRefreshRequest");const e=D(!1);Z("refresh_requested",()=>{e.set(!0)}),this.isRefreshing=S(e),this.finishRefreshFp=()=>h(De(Ve("web_app_finish_refresh")),A(()=>{e.set(!1)})),this.finishRefresh=()=>this.finishRefreshFp()().then(r=>{if(r._tag==="Left")throw r.left;return r.right}),this.onRefreshRequest=n=>Z("refresh_requested",()=>{n()})}}function Ha(){return new ls(h(E()))}const xa=Ha();class ps{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 ft({...n,initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Cancel",position:"left"},method:"web_app_setup_secondary_button",payload:o=>({has_shine_effect:o.hasShineEffect,is_visible:o.isVisible,is_active:o.isEnabled,is_progress_visible:o.isLoaderVisible,text:o.text,color:o.bgColor,text_color:o.textColor,position:o.position})}),i=(o,a)=>{const u=r.stateGetter(o);return S(()=>u()||ee(a))};this.isSupported=oe("web_app_setup_secondary_button",n.version),this.bgColor=i("bgColor",e.bgColor),this.textColor=i("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 za(){return new ps(ns("secondaryButton","secondary_button_pressed",{bgColor:S(()=>ss.bottomBarColorRgb()||"#000000"),textColor:S(()=>Je.buttonColor()||"#2481cc")}))}const Ka=za();class hs{constructor({isTma:e,request:n,version:r,createRequestId:i}){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 o=B({version:r,requires:"web_app_secure_storage_get_key",isTma:e,returns:"task"}),a=(u,l,p)=>{const f=i();return h(n(u,["secure_storage_failed",l],{params:{...p,req_id:f},capture:(d=>"payload"in d?d.payload.req_id===f:!0)}),te(d=>d.event==="secure_storage_failed"?U(new kr(d.payload.error||"UNKNOWN_ERROR")):V(d.payload)))};this.getItemFp=o(u=>h(a("web_app_secure_storage_get_key","secure_storage_key_received",{key:u}),A(l=>({value:l.value,canRestore:!!l.can_restore})))),this.setItemFp=o((u,l)=>h(a("web_app_secure_storage_save_key","secure_storage_key_saved",{key:u,value:l}),A(()=>{}))),this.deleteItemFp=o(u=>this.setItemFp(u,null)),this.clearFp=o(()=>h(a("web_app_secure_storage_clear","secure_storage_cleared",{}),A(()=>{}))),this.restoreItemFp=o(u=>h(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 Ja(){return new hs(h(E(),q,Y,Wr))}const Qa=Ja();class fs{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 ft({...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 Za=new fs(on("settingsButton","settings_button_pressed"));class ds{constructor({postEvent:e,storage:n,isTma:r,isPageReload:i,version:o}){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 me({initialState:a,onChange(v){n.set(v)}}),l=new We({initialState:a,isPageReload:i,onMounted:u.setState,restoreState:n.get}),p={requires:"web_app_setup_swipe_behavior",isTma:r,version:o},f=B({...p,returns:"plain"}),d=B({...p,isMounted:l.isMounted,returns:"either"}),b=v=>{const F={isVerticalEnabled:v};return u.hasDiff(F)?h(e("web_app_setup_swipe_behavior",{allow_vertical_swipe:v}),z(()=>{u.setState(F)})):k(void 0)};this.isSupported=oe("web_app_setup_swipe_behavior",o),this.isVerticalEnabled=u.getter("isVerticalEnabled"),this.isMounted=l.isMounted,this.disableVerticalFp=d(()=>b(!1)),this.enableVerticalFp=d(()=>b(!0)),this.mountFp=f(()=>{const v=()=>{};return h(l.mount(),ae(v,v))}),this.unmount=l.unmount,this.disableVertical=_(this.disableVerticalFp),this.enableVertical=_(this.enableVerticalFp),this.mount=_(this.mountFp)}}function Ya(){return new ds(h(E(),K,q,we("swipeBehavior")))}const Xa=Ya();async function eu(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 tu({request:t,...e}){return R((n,r,i)=>h(t("web_app_request_file_download","file_download_requested",{...i,params:{url:n,file_name:r}}),te(o=>o.status==="downloading"?V(void 0):U(new rn("User denied the action")))),{...e,requires:"web_app_request_file_download",returns:"task"})}function nu(){return tu(h(E(),Y,q))}const _s=nu(),ru=_(_s);function su({invokeCustomMethod:t,...e}){return R(n=>h(t("getCurrentTime",{},n),te(r=>{const i=Ut(ie(be(),Vt(),le(o=>new Date(o*1e3)),tt()),r);return i.success?V(i.output):U(new ze(r,i.issues))})),{...e,requires:"web_app_invoke_custom_method",returns:"task"})}function iu(){return su(h(E(),pn,q))}const ms=iu(),ou=_(ms);function au({postEvent:t,...e}){return R(()=>t("web_app_hide_keyboard"),{...e,returns:"either",requires:"web_app_hide_keyboard"})}function uu(){return au(h(E(),K,q))}const bs=uu(),cu=_(bs);function lu({request:t,createRequestId:e,...n}){return R(r=>{const i=e();return h(t("web_app_read_text_from_clipboard","clipboard_text_received",{...r,params:{req_id:i},capture:vr(i)}),A(({data:o=null})=>o))},{...n,requires:"web_app_read_text_from_clipboard",returns:"task"})}function pu(){return lu({...h(E(),q,Y),createRequestId:dt})}const gs=pu(),hu=_(gs);function vs(t){const e={},n=t.match(/Telegram-Android(?:\/([^ ]+))?(?: (\([^)]+\))?|$)/);if(n){const[,r,i]=n;r&&(e.appVersion=r),i&&i.slice(1,i.length-1).split(";").forEach(o=>{const[a,u]=o.trim().split(" ");if(a==="Android")e.androidVersion=u;else if(a==="SDK"){const l=parseInt(u,10);l&&(e.sdkVersion=l)}else u?(e.manufacturer=a,e.model=u):e.performanceClass=a})}return e}function fu(){return vs(navigator.userAgent)}function du({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 _u(){return du(h(E(),K))}const ws=_u(),mu=_(ws);function bu({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(i=>i.event==="prepared_message_failed"?U(new qr(i.payload.error)):V(void 0))),{...e,requires:"web_app_send_prepared_message",returns:"task"})}function gu(){return bu(h(E(),Y,q))}const ys=gu(),vu=_(ys);function wu({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 yu(){return wu(h(E(),K,q))}const Fs=yu(),Fu=_(Fs),vn=Ke(!1);function Su({isInlineMode:t,postEvent:e,...n}){return R((r,i)=>e("web_app_switch_inline_query",{query:r,chat_types:i||[]}),{...n,requires:{every:["web_app_switch_inline_query",()=>ee(t)?void 0:"The application must be launched in the inline mode"]},returns:"either"})}function Cu(){return Su({...h(E(),K,q),isInlineMode:vn})}const Ss=Cu(),ku=_(Ss);class Cs{constructor({storage:e,isPageReload:n,onContentSafeAreaInsetsChanged:r,onSafeAreaInsetsChanged:i,onViewportChanged:o,onFullscreenChanged:a,offContentSafeAreaInsetsChanged:u,offFullscreenChanged:l,offSafeAreaInsetsChanged:p,offViewportChanged:f,request:d,isViewportStable:b,isFullscreen:v,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 w={top:0,right:0,left:0,bottom:0},m=new me({initialState:{contentSafeAreaInsets:w,height:0,isExpanded:!1,isFullscreen:!1,safeAreaInsets:w,stableHeight:0,width:0},onChange:e.set}),O=T=>{m.setState({isExpanded:T.is_expanded,height:T.height,width:T.width,stableHeight:T.is_state_stable?T.height:void 0})},j=T=>{m.setState({isFullscreen:T.is_fullscreen})},W=T=>{m.setState({safeAreaInsets:T})},I=T=>{m.setState({contentSafeAreaInsets:T})},L=new an({initialState(T){const Ie=de=>()=>{const[ye,se]=de==="safe-area"?["web_app_request_safe_area","safe_area_changed"]:["web_app_request_content_safe_area","content_safe_area_changed"];return fe(ye,ee(C))?d(ye,se,T):V({top:0,left:0,right:0,bottom:0})},H=de=>()=>typeof de=="boolean"?V(de):De(de());return h($i,Xe("safeAreaInsets",Ie("safe-area")),Xe("contentSafeAreaInsets",Ie("content-safe-area")),Xe("isFullscreen",H(v)),Xe("isViewportStable",H(b)),ue(({isViewportStable:de,...ye})=>de?V({...ye,height:window.innerHeight,isExpanded:!0,stableHeight:window.innerHeight,width:window.innerWidth}):h(d("web_app_request_viewport","viewport_changed",T),A(se=>({...ye,height:se.height,isExpanded:se.is_expanded,stableHeight:se.is_state_stable?se.height:0,width:se.width})))))},isPageReload:n,onMounted(T){o(O),a(j),i(W),r(I),m.setState(T)},onUnmounted(){f(O),l(j),p(W),u(I)},restoreState:e.get}),P=T=>S(()=>this.safeAreaInsets()[T]),N=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=P("top"),this.safeAreaInsetBottom=P("bottom"),this.safeAreaInsetLeft=P("left"),this.safeAreaInsetRight=P("right"),this.contentSafeAreaInsets=m.getter("contentSafeAreaInsets"),this.contentSafeAreaInsetTop=N("top"),this.contentSafeAreaInsetBottom=N("bottom"),this.contentSafeAreaInsetLeft=N("left"),this.contentSafeAreaInsetRight=N("right");const Re=B({isTma:F,returns:"task"}),Qe=B({isTma:F,returns:"either"}),Mu=B({isTma:F,requires:"web_app_request_fullscreen",version:C,returns:"task"}),Is=T=>Mu(Ie=>h(d(T?"web_app_request_fullscreen":"web_app_exit_fullscreen",["fullscreen_changed","fullscreen_failed"],Ie),te(H=>H.event==="fullscreen_failed"&&H.payload.error!=="ALREADY_FULLSCREEN"?U(new $r(H.payload.error)):(m.setState({isFullscreen:"is_fullscreen"in H.payload?H.payload.is_fullscreen:!0}),V(void 0)))));this.isMounted=L.isMounted,this.mountFp=Re(L.mount),this.mount=_(this.mountFp),this.isFullscreen=m.getter("isFullscreen"),this.requestFullscreenFp=Is(!0),this.requestFullscreen=_(this.requestFullscreenFp),this.exitFullscreenFp=Is(!1),this.exitFullscreen=_(this.exitFullscreenFp);const _t=D(!1);this.isCssVarsBound=S(_t),this.bindCssVarsFp=Qe(T=>{if(_t())return M(new pt);T||(T=H=>`--vb-viewport-${On(H)}`);const Ie=[["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((H,[de,ye])=>{const se=T(de);if(se){const As=()=>{fn(se,`${ye()}px`)};H.push({update:As,removeListener:ye.sub(As),cssVar:se})}return H},[]);return Ie.forEach(H=>{H.update()}),_t.set(!0),k(()=>{Ie.forEach(H=>{H.removeListener(),dn(H.cssVar)}),_t.set(!1)})}),this.bindCssVars=_(this.bindCssVarsFp),this.expandFp=Qe(()=>g("web_app_expand")),this.expand=_(this.expandFp)}}function Eu(){const t=o=>({on:a=>{Z(o,a)},off:a=>{Ce(o,a)}}),e=t("viewport_changed"),n=t("fullscreen_changed"),r=t("safe_area_changed"),i=t("content_safe_area_changed");return new Cs({...h(E(),we("viewport"),q,K,Y),isFullscreen(){return h(Te(),z(o=>!!o.vbWebAppFullscreen))},isViewportStable(){return h(Te(),z(o=>["macos","tdesktop","unigram","webk","weba","web"].includes(o.vbWebAppPlatform)))},offContentSafeAreaInsetsChanged:i.off,offFullscreenChanged:n.off,offSafeAreaInsetsChanged:r.off,offViewportChanged:e.off,onContentSafeAreaInsetsChanged:i.on,onFullscreenChanged:n.on,onSafeAreaInsetsChanged:r.on,onViewportChanged:e.on})}const Iu=Eu();class ks{constructor({request:e}){s(this,"requestAccessFp");s(this,"requestAccess");s(this,"selectFile");s(this,"selectFiles");s(this,"selectFolder");this.requestAccessFp=n=>h(e("web_app_request_storage_access","storage_access_granted",{params:{access_type:n.accessType,multiple:n.multiple,accept:n.accept,max_file_size:n.maxFileSize,read_content:n.readContent}}),A(r=>({accessType:r.access_type,items:r.items.map(i=>({name:i.name,path:i.path,size:i.size,type:i.type,content:i.content,lastModified:i.last_modified}))}))),this.requestAccess=n=>this.requestAccessFp(n)().then(i=>{if(i._tag==="Left")throw i.left;return i.right}),this.selectFile=n=>this.requestAccess({accessType:"file",multiple:!1,...n}),this.selectFiles=n=>this.requestAccess({accessType:"file",multiple:!0,...n}),this.selectFolder=()=>this.requestAccess({accessType:"folder"})}}function Au(){return new ks({request:ct})}const $u=Au();class qu{static setTheme(e){lt().send("theme_changed",{theme_params:e})}static onBackgroundColorChange(e){return lt().on("web_app_set_background_color",r=>{r&&typeof r.color=="string"&&e(r.color)})}static onHeaderColorChange(e){return lt().on("web_app_set_header_color",r=>{r&&("color_key"in r&&r.color_key?e(r.color_key):"color"in r&&r.color&&e(r.color))})}static onBottomBarColorChange(e){return lt().on("web_app_set_bottom_bar_color",r=>{r&&r.color&&e(r.color)})}}function Es(t={}){const{version:e,isInlineMode:n,themeParams:r}=t;if(e&&typeof n=="boolean"&&r)sn.set(e),vn.set(n),mn.set(r);else{const u=h(Te(),Ft(l=>l,l=>{sn.set(e||l.vbWebAppVersion),vn.set(typeof n=="boolean"?n:!!l.vbWebAppBotInline),mn.set(r||l.vbWebAppThemeParams)}));if(u)return M(u)}t.postEvent&&Tr.set(t.postEvent);const[i,o]=Ge(Z("reload_iframe",()=>{he().log("Received a request to reload the page"),Vr("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),i(Z("set_custom_style",l=>{u.innerHTML=l}),()=>{document.head.removeChild(u)})}return h(Ee("iframe_ready",{reload_supported:!0}),z(()=>(he().log("The package was initialized"),o)))}const Bu=ne(Es);return c.AccessDeniedError=rn,c.BackButton=Mr,c.Biometry=Rr,c.CSSVarsBoundError=pt,c.CancelledError=Rn,c.ClosingBehavior=Or,c.CloudStorage=jr,c.ConcurrentCallError=ht,c.DeviceStorage=Ur,c.DeviceStorageMethodError=Cr,c.FullscreenFailedError=$r,c.FunctionUnavailableError=Ir,c.HapticFeedback=Hr,c.HostThemeParams=qu,c.InitData=Kr,c.InvalidArgumentsError=re,c.InvalidEnvError=Bo,c.InvalidLaunchParamsError=ur,c.Invoice=Jr,c.InvokeCustomMethodFailedError=cr,c.LaunchParamsRetrieveError=ar,c.LocationManager=Yr,c.MainButton=Xr,c.MethodParameterUnsupportedError=or,c.MethodUnsupportedError=ir,c.MiniApp=rs,c.NotAvailableError=Er,c.Notification=is,c.Popup=os,c.QrScanner=cs,c.Refresh=ls,c.SecondaryButton=ps,c.SecureStorage=hs,c.SecureStorageMethodError=kr,c.SetEmojiStatusError=Ar,c.SettingsButton=fs,c.ShareMessageError=qr,c.StoragePermission=ks,c.SwipeBehavior=ds,c.ThemeParams=ts,c.TimeoutError=Gt,c.UnknownEnvError=Jt,c.UnknownThemeParamsKeyError=Br,c.ValidationError=ze,c.Viewport=Cs,c.addToHomeScreen=na,c.addToHomeScreenFp=xr,c.applyPolyfills=Eo,c.backButton=Po,c.biometry=jo,c.checkHomeScreenStatus=ia,c.checkHomeScreenStatusFp=zr,c.closingBehavior=Uo,c.cloudStorage=Go,c.copyTextToClipboard=eu,c.createLogger=Un,c.createPostEvent=So,c.createRequestId=dt,c.createStartParam=Ao,c.createStartParamFp=Fr,c.debug=fr,c.decodeBase64Url=Io,c.decodeBase64UrlFp=tn,c.decodeStartParam=$o,c.decodeStartParamFp=Sr,c.deepSnakeToCamelObjKeys=Nt,c.deviceStorage=Ho,c.downloadFile=ru,c.downloadFileFp=_s,c.emitEvent=at,c.encodeBase64Url=nn,c.getCurrentTime=ou,c.getCurrentTimeFp=ms,c.getReleaseVersion=en,c.hapticFeedback=Xo,c.hideKeyboard=cu,c.hideKeyboardFp=bs,c.init=Bu,c.initData=aa,c.initFp=Es,c.invoice=ca,c.invokeCustomMethod=Dr,c.isAnyRGB=xn,c.isColorDark=_n,c.isColorDarkFp=es,c.isRGB=He,c.isRGBA=Hn,c.isRGBAShort=Nn,c.isRGBShort=Gn,c.isSafeToCreateStartParam=qo,c.isVBMA=wo,c.isVBMAFp=Xt,c.locationManager=ya,c.logger=he,c.mainButton=Sa,c.miniApp=ss,c.mockVBotEnv=yo,c.notification=Ia,c.off=Ce,c.offAll=bo,c.on=Z,c.openLink=ha,c.openLinkFp=Qr,c.openVBotLink=_a,c.openVBotLinkFp=hn,c.parseInitDataQuery=io,c.parseInitDataQueryFp=Yn,c.parseLaunchParamsQuery=Xn,c.parseLaunchParamsQueryFp=ot,c.popup=qa,c.postEvent=Vr,c.postEventFp=Ee,c.qrScanner=Na,c.readTextFromClipboard=hu,c.readTextFromClipboardFp=gs,c.refresh=xa,c.request=Ro,c.request2=Lo,c.request2Fp=cn,c.requestContact=ja,c.requestContactComplete=Oa,c.requestContactCompleteFp=gn,c.requestContactFp=as,c.requestEmojiStatusAccess=Ko,c.requestEmojiStatusAccessFp=Gr,c.requestFp=Lr,c.requestPhoneAccess=Ta,c.requestPhoneAccessFp=bn,c.requestWriteAccess=Wa,c.requestWriteAccessFp=us,c.retrieveAndroidDeviceData=fu,c.retrieveAndroidDeviceDataFrom=vs,c.retrieveLaunchParams=ao,c.retrieveLaunchParamsFp=Te,c.retrieveRawInitData=uo,c.retrieveRawInitDataFp=Qt,c.retrieveRawLaunchParams=co,c.retrieveRawLaunchParamsFp=xe,c.secondaryButton=Ka,c.secureStorage=Qa,c.sendData=mu,c.sendDataFp=ws,c.serializeInitDataQuery=tr,c.serializeLaunchParamsQuery=nr,c.setDebug=ho,c.setEmojiStatus=Zo,c.setEmojiStatusFp=Nr,c.setTargetOrigin=fo,c.settingsButton=Za,c.shareMessage=vu,c.shareMessageFp=ys,c.shareStory=Fu,c.shareStoryFp=Fs,c.shareURL=ga,c.shareURLFp=Zr,c.storagePermission=$u,c.supports=fe,c.swipeBehavior=Xa,c.switchInlineQuery=ku,c.switchInlineQueryFp=Ss,c.targetOrigin=dr,c.themeParams=Je,c.toRGB=Yi,c.toRGBFp=Kn,c.toRGBFull=Xi,c.toRGBFullFp=it,c.viewport=Iu,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}),c})({});
|
|
1
|
+
var Ru=Object.defineProperty;var Lu=(c,X,Ae)=>X in c?Ru(c,X,{enumerable:!0,configurable:!0,writable:!0,value:Ae}):c[X]=Ae;var s=(c,X,Ae)=>Lu(c,typeof X!="symbol"?X+"":X,Ae);this.tmajs=this.tmajs||{};this.tmajs.sdk=(function(c){"use strict";let X;function Ae(t,e){X?X.set(t,e):e()}function Xe(t){if(X)return t();X=new Map;try{t()}finally{X.forEach(e=>e()),X=void 0}}function D(t,e){e||(e={});const n=e.equals||Object.is;let r=[],i=t;const o=p=>{if(!n(i,p)){const f=i;i=p,Ae(l,()=>{[...r].forEach(([d,b])=>{d(p,f),b&&u(d,!0)})})}};function a(p){const f=typeof p!="object"?{once:p}:p;return{once:f.once||!1,signal:f.signal||!1}}const u=(p,f)=>{const d=a(f),b=r.findIndex(([v,F])=>v===p&&F.once===d.once&&F.signal===d.signal);b>=0&&r.splice(b,1)},l=Object.assign(function(){return Bs(l),i},{destroy(){r=[]},set:o,reset(){o(t)},sub(p,f){return r.push([p,a(f)]),()=>u(p,f)},unsub:u,unsubAll(){r=r.filter(p=>p[1].signal)}});return l}const Oe=[];function Bs(t){Oe.length&&Oe[Oe.length-1].add(t)}function S(t,e){let n=new Set,r;function i(){return r||(r=D(a(),e))}function o(){i().set(a())}function a(){n.forEach(p=>{p.unsub(o,{signal:!0})});const u=new Set;let l;Oe.push(u);try{l=t()}finally{Oe.pop()}return u.forEach(p=>{p.sub(o,{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 Ms=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))};function Ts(t){return t}function yn(t,e,n,r,i,o,a,u,l){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 i(r(n(e(t.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(e(t.apply(this,arguments))))))};case 7:return function(){return a(o(i(r(n(e(t.apply(this,arguments)))))))};case 8:return function(){return u(a(o(i(r(n(e(t.apply(this,arguments))))))))};case 9:return function(){return l(u(a(o(i(r(n(e(t.apply(this,arguments)))))))))}}}function h(t,e,n,r,i,o,a,u,l){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 i(r(n(e(t))));case 6:return o(i(r(n(e(t)))));case 7:return a(o(i(r(n(e(t))))));case 8:return u(a(o(i(r(n(e(t)))))));case 9:return l(u(a(o(i(r(n(e(t))))))));default:{for(var p=arguments[0],f=1;f<arguments.length;f++)p=arguments[f](p);return p}}}var je=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(i){return e.apply(void 0,Ms([i],r,!1))}}},Vs={_tag:"None"},Ps=function(t){return{_tag:"Some",value:t}},Rs=function(t){return t._tag==="Left"},Fn=function(t){return{_tag:"Left",left:t}},Sn=function(t){return{_tag:"Right",right:t}},bt={};function Ls(t,e){return function(n){return function(r){return t.ap(t.map(r,function(i){return function(o){return e.ap(i,o)}}),n)}}}function Os(t,e){return function(n){return function(r){return t.map(r,function(i){return e.map(i,n)})}}}function gt(t){return function(e,n){return function(r){return t.chain(r,function(i){return t.map(n(i),function(o){var a;return Object.assign({},i,(a={},a[e]=o,a))})})}}}var Fe=Vs,$e=Ps,js=function(t,e){return h(t,Ws(e))},Ds=function(t,e){return h(t,Ns(e))},Us="Option",Ws=function(t){return function(e){return De(e)?Fe:$e(t(e.value))}},Gs=$e,Ns=function(t){return function(e){return De(e)||De(t)?Fe:$e(e.value(t.value))}},Hs=je(2,function(t,e){return De(t)?Fe:e(t.value)}),xs={URI:Us,map:js,ap:Ds,chain:Hs},De=function(t){return t._tag==="None"},zs=function(t,e){return function(n){return De(n)?t():e(n.value)}},vt=zs,Ks=Gs(bt),Cn=gt(xs),M=Fn,k=Sn,wt=je(2,function(t,e){return _e(t)?t:e(t.right)}),yt=function(t,e){return h(t,z(e))},kn=function(t,e){return h(t,Ys(e))},Ft="Either",z=function(t){return function(e){return _e(e)?e:k(t(e.right))}},Js={URI:Ft,map:yt},Qs=k,Zs=function(t){return function(e){return _e(e)?e:_e(t)?t:k(e.right(t.right))}},Ys=Zs,Xs={URI:Ft,map:yt,ap:kn},ei={URI:Ft,map:yt,ap:kn,chain:wt},ti=function(t,e){return function(n){return _e(n)?M(t(n.left)):k(e(n.right))}},ni=function(t){return function(e){return _e(e)?M(t(e.left)):e}},_e=Rs,St=function(t,e){return function(n){return _e(n)?t(n.left):e(n.right)}},ri=St,ae=St,si=ae,qe=function(t,e){try{return k(t())}catch(n){return M(e(n))}},ii=Qs(bt),oi=gt(ei),En=oi,ai=wt,ui=wt;function ci(t){return yn(k,t.of)}function li(t){return yn(M,t.of)}function pi(t){return Os(t,Js)}function hi(t){return Ls(t,Xs)}function fi(t){return function(e,n){return t.chain(e,function(r){return _e(r)?t.of(r):n(r.right)})}}function di(t){return function(e,n,r){return t.map(e,ti(n,r))}}function _i(t){return function(e,n){return function(r){return t.map(r,ae(e,n))}}}var mi=function(t){return qe(function(){return JSON.parse(t)},Ts)},Ct=function(t,e){return h(t,bi(e))},In=function(t,e){return h(t,gi(e))},bi=function(t){return function(e){return function(){return Promise.resolve().then(e).then(t)}}},gi=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],i=n[1];return r(i)})}}},kt=function(t){return function(){return Promise.resolve(t)}},vi=je(2,function(t,e){return function(){return Promise.resolve().then(t).then(function(n){return e(n)()})}}),Et="Task",It={URI:Et,map:Ct},An={of:kt},wi={URI:Et,map:Ct,ap:In},yi={URI:Et,map:Ct,of:kt,ap:In,chain:vi},Fi=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function u(f){try{p(r.next(f))}catch(d){a(d)}}function l(f){try{p(r.throw(f))}catch(d){a(d)}}function p(f){f.done?o(f.value):i(f.value).then(u,l)}p((r=r.apply(t,e||[])).next())})},Si=function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(p){return function(f){return l([p,f])}}function l(p){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,p[0]&&(n=0)),n;)try{if(r=1,i&&(o=p[0]&2?i.return:p[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,p[1])).done)return o;switch(i=0,o&&(p=[p[0]&2,o.value]),p[0]){case 0:case 1:o=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,i=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]<o[3])){n.label=p[1];break}if(p[0]===6&&n.label<o[1]){n.label=o[1],o=p;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(p);break}o[2]&&n.ops.pop(),n.trys.pop();continue}p=e.call(t,n)}catch(f){p=[6,f],i=0}finally{r=o=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},U=li(An),V=ci(An),Ue=kt,et=_i(It),Ci=et,$n=function(t,e){return function(){return Fi(void 0,void 0,void 0,function(){var n;return Si(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t().then(Sn)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,Fn(e(n))];case 3:return[2]}})})}},ki=function(t,e){return h(t,A(e))},Ei=function(t,e){return h(t,Ii(e))},A=pi(It),We=je(3,di(It)),Ii=hi(wi),At=je(2,fi(yi)),Ai=V,$i="TaskEither",qi={URI:$i,map:ki,ap:Ei,chain:At},Bi=Ai(bt),Mi=gt(qi),tt=Mi,te=At,ue=At;function ee(t){return typeof t=="function"?t():t}class Ge{constructor({onMounted:e,restoreState:n,initialState:r,onUnmounted:i,isPageReload:o}){s(this,"_isMounted",D(!1));s(this,"isMounted",S(this._isMounted));s(this,"mount");s(this,"unmount");this.mount=()=>{if(this.isMounted())return k(void 0);const a=ee(o)?n():void 0,u=a?k(a):typeof r=="function"?r():k(r);return h(u,z(l=>{Xe(()=>{this._isMounted.set(!0),e==null||e(l)})}))},this.unmount=()=>{this._isMounted()&&Xe(()=>{this._isMounted.set(!1),i==null||i()})}}}function $t(t){const e={};for(const n in t){const r=t[n];r!==void 0&&(e[n]=r)}return e}function qt(t,e){const n=Object.keys(t),r=Object.keys(e);return n.length!==r.length?!1:n.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&t[i]===e[i])}class me{constructor({initialState:e,onChange:n}){s(this,"_state");s(this,"state");s(this,"setState",e=>{const n={...this.state(),...$t(e)};qt(n,this.state())||this._state.set(n)});this._state=D(e,{equals:qt}),this.state=S(this._state),this.state.sub(n)}getter(e){return S(()=>this._state()[e])}hasDiff(e){return!qt({...this.state(),...$t(e)},this.state())}}let ce;function Bt(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)}}let Mt;function Ti(t){return Mt==null?void 0:Mt.get(t)}let Tt;function Vi(t){return Tt==null?void 0:Tt.get(t)}let Vt;function Pi(t,e){var n;return(n=Vt==null?void 0:Vt.get(t))==null?void 0:n.get(e)}function Ri(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,i){const o=i&&"input"in i?i.input:n.value,a=(i==null?void 0:i.expected)??t.expects??null,u=(i==null?void 0:i.received)??Ri(o),l={kind:t.kind,type:t.type,input:o,expected:a,received:u,message:`Invalid ${e}: ${a?`Expected ${a} but r`:"R"}eceived ${u}`,requirement:t.requirement,path:i==null?void 0:i.path,issues:i==null?void 0:i.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},p=t.kind==="schema",f=(i==null?void 0:i.message)??t.message??Pi(t.reference,l.lang)??(p?Vi(l.lang):null)??r.message??Ti(l.lang);f!==void 0&&(l.message=typeof f=="function"?f(l):f),p&&(n.typed=!1),n.issues?n.issues.push(l):n.issues=[l]}function Q(t){return{version:1,vendor:"valibot",validate(e){return t["~run"]({value:e},Bt())}}}function qn(t,e){return Object.hasOwn(t,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function Li(t,e){const n=[...new Set(t)];return n.length>1?`(${n.join(` ${e} `)})`:n[0]??"never"}var Oi=class extends Error{constructor(t){super(t[0].message),this.name="ValiError",this.issues=t}};function nt(t,e){return{kind:"validation",type:"check",reference:nt,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 Pt(t){return{kind:"validation",type:"integer",reference:Pt,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 ji(t,e,n){return typeof t.fallback=="function"?t.fallback(e,n):t.fallback}function Rt(t,e,n){return typeof t.default=="function"?t.default(e,n):t.default}function Lt(t,e){return!t["~run"]({value:e},{abortEarly:!0}).issues}function Bn(){return{kind:"schema",type:"any",reference:Bn,expects:"any",async:!1,get"~standard"(){return Q(this)},"~run"(t){return t.typed=!0,t}}}function Mn(t,e){return{kind:"schema",type:"array",reference:Mn,expects:"Array",async:!1,item:t,message:e,get"~standard"(){return Q(this)},"~run"(n,r){var o;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 p={type:"array",origin:"value",input:i,key:a,value:u};for(const f of l.issues)f.path?f.path.unshift(p):f.path=[p],(o=n.issues)==null||o.push(f);if(n.issues||(n.issues=l.issues),r.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}}else J(this,"type",n,r);return n}}}function Se(t){return{kind:"schema",type:"boolean",reference:Se,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 rt(t){return{kind:"schema",type:"date",reference:rt,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 Ot(t){return{kind:"schema",type:"function",reference:Ot,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 jt(t,e){return{kind:"schema",type:"instance",reference:jt,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 o;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]:Rt(u),p=u["~run"]({value:l},r);if(p.issues){const f={type:"object",origin:"value",input:i,key:a,value:l};for(const d of p.issues)d.path?d.path.unshift(f):d.path=[f],(o=n.issues)==null||o.push(d);if(n.issues||(n.issues=p.issues),r.abortEarly){n.typed=!1;break}}p.typed||(n.typed=!1),n.value[a]=p.value}else if(u.fallback!==void 0)n.value[a]=ji(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:i,key:a,value:i[a]}]}),r.abortEarly))break}if(!n.issues||!r.abortEarly)for(const a in i)qn(i,a)&&!(a in this.entries)&&(n.value[a]=i[a])}else J(this,"type",n,r);return n}}}function Be(t,e){return{kind:"schema",type:"nullish",reference:Be,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=Rt(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function be(t){return{kind:"schema",type:"number",reference:be,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 $(t,e){return{kind:"schema",type:"optional",reference:$,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=Rt(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function Dt(t,e,n){return{kind:"schema",type:"record",reference:Dt,expects:"Object",async:!1,key:t,value:e,message:n,get"~standard"(){return Q(this)},"~run"(r,i){var a,u;const o=r.value;if(o&&typeof o=="object"){r.typed=!0,r.value={};for(const l in o)if(qn(o,l)){const p=o[l],f=this.key["~run"]({value:l},i);if(f.issues){const b={type:"object",origin:"key",input:o,key:l,value:p};for(const v of f.issues)v.path=[b],(a=r.issues)==null||a.push(v);if(r.issues||(r.issues=f.issues),i.abortEarly){r.typed=!1;break}}const d=this.value["~run"]({value:p},i);if(d.issues){const b={type:"object",origin:"value",input:o,key:l,value:p};for(const v of d.issues)v.path?v.path.unshift(b):v.path=[b],(u=r.issues)==null||u.push(v);if(r.issues||(r.issues=d.issues),i.abortEarly){r.typed=!1;break}}(!f.typed||!d.typed)&&(r.typed=!1),f.typed&&(r.value[f.value]=d.value)}}else J(this,"type",r,i);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 Tn(t){let e;if(t)for(const n of t)e?e.push(...n.issues):e=n.issues;return e}function st(t,e){return{kind:"schema",type:"union",reference:st,expects:Li(t.map(n=>n.expects),"|"),async:!1,options:t,message:e,get"~standard"(){return Q(this)},"~run"(n,r){let i,o,a;for(const u of this.options){const l=u["~run"]({value:n.value},r);if(l.typed)if(l.issues)o?o.push(l):o=[l];else{i=l;break}else a?a.push(l):a=[l]}if(i)return i;if(o){if(o.length===1)return o[0];J(this,"type",n,r,{issues:Tn(o)}),n.typed=!0}else{if((a==null?void 0:a.length)===1)return a[0];J(this,"type",n,r,{issues:Tn(a)})}return n}}}function Ut(){return{kind:"schema",type:"unknown",reference:Ut,expects:"unknown",async:!1,get"~standard"(){return Q(this)},"~run"(t){return t.typed=!0,t}}}function ge(t,e,n){const r=t["~run"]({value:e},Bt(n));if(r.issues)throw new Oi(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 Wt(t,e,n){const r=t["~run"]({value:e},Bt(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var Di=Object.defineProperty,Ui=(t,e,n)=>e in t?Di(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Vn=(t,e,n)=>Ui(t,typeof e!="symbol"?e+"":e,n),Wi=Object.defineProperty,Gi=(t,e,n)=>e in t?Wi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Gt=(t,e,n)=>Gi(t,typeof e!="symbol"?e+"":e,n);function Pn(t){return e=>e instanceof t}function Rn(t,e){const n=class extends Error{constructor(...i){const o=typeof e=="function"?e(...i):typeof e=="string"?[e]:e||[];super(...o),this.name=t}};Gt(n,"is",Pn(n));let r=n;return Object.defineProperty(r,"name",{value:t}),r}function Ni(t,e,n){const r=class extends Rn(t,n){constructor(...o){super(...o),Gt(this,"data"),this.data=e(...o)}};Gt(r,"is",Pn(r));let i=r;return Object.defineProperty(i,"name",{value:t}),i}let Ln=class extends Rn("CancelledError","Promise was canceled"){},Nt=class extends Ni("TimeoutError",e=>({timeout:e}),(e,n)=>[`Timeout reached: ${e}ms`,{cause:n}]){};const Hi=Symbol("resolved");function xi(t){return{tag:Hi,value:t}}function On(t,e){return t.reject=e.reject,t.resolve=e.resolve,t}class ve extends Promise{constructor(e,n){let r,i,o,a;typeof e=="function"?(o=e,a=n||{}):a=e||{};let u,l;const p=()=>!!l,f=()=>!!u;let d={};const b=[],v=()=>{b.forEach(g=>g()),b.splice(0,b.length),d={}},F=new AbortController,C=()=>f()||p();super((g,w)=>{const{abortOnResolve:m=!0,abortOnReject:O=!0}=a;i=I=>{var L,P;C()||(g(I),u=[I],(L=d.resolved)==null||L.forEach(N=>N(I)),(P=d.finalized)==null||P.forEach(N=>N({kind:"resolved",result:I})),v(),m&&F.abort(xi(I)))},r=I=>{var L,P;C()||(w(I),l=[I],(L=d.rejected)==null||L.forEach(N=>N(I)),(P=d.finalized)==null||P.forEach(N=>N({kind:"rejected",reason:I})),v(),O&&F.abort(I))};const{abortSignal:j}=a;if(j){if(j.aborted)return r(j.reason);const I=()=>{r(j.reason)};j.addEventListener("abort",I,!0),b.push(()=>{j.removeEventListener("abort",I,!0)})}const{timeout:W}=a;if(W){const I=setTimeout(()=>{r(new Nt(W))},W);b.push(()=>{clearTimeout(I)})}try{const I=()=>{},L=o&&o(i,r,{abortSignal:F.signal,get isRejected(){return p()},get isResolved(){return f()},on(P,N){if(u||l){if(P==="finalized"){const Le=u?{kind:"resolved",result:u[0]}:{kind:"rejected",reason:l[0]};N(Le)}else P==="resolved"&&u?N(u[0]):P==="rejected"&&l&&N(l[0]);return I}return d[P]||(d[P]=[]),d[P].push(N),()=>{const Le=d[P]||[],Ye=Le.indexOf(N);Ye>=0&&Le.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]}});L instanceof Promise&&L.catch(r)}catch(I){r(I)}}),Vn(this,"reject"),Vn(this,"resolve"),this.reject=r,this.resolve=i}static fn(e,n){return new ve(async(r,i,o)=>{try{r(await e(o))}catch(a){i(a)}},n)}static resolve(e){return this.fn(()=>e)}static reject(e){return new ve((n,r)=>{r(e)})}cancel(){this.reject(new Ln)}catch(e){return this.then(void 0,e)}finally(e){return On(super.finally(e),this)}then(e,n){return On(super.then(e,n),this)}}function jn(t){return t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function zi(t){return t.replace(/_[a-z]/g,e=>e[1].toUpperCase())}function Ki(t){return Object.entries(t).reduce((e,[n,r])=>(e[zi(n)]=r,e),{})}function Ht(t){const e=Ki(t);for(const n in e){const r=e[n];r&&typeof r=="object"&&!(r instanceof Date)&&(e[n]=Array.isArray(r)?r.map(Ht):Ht(r))}return e}function Ji(t){return t.replace(/_([a-z])/g,(e,n)=>`-${n.toLowerCase()}`)}function Dn(t){return`tapps/${t}`}function xt(t,e){sessionStorage.setItem(Dn(t),JSON.stringify(e))}function Un(t){const e=sessionStorage.getItem(Dn(t));try{return e?JSON.parse(e):void 0}catch{}}function Ne(...t){const e=t.flat(1);return[e.push.bind(e),()=>{e.forEach(n=>{n()})}]}function Wn(t,e){e||(e={});const{textColor:n,bgColor:r,shouldLog:i}=e,o=i===void 0?!0:i,a=typeof o=="boolean"?()=>o:o,u=(l,p,...f)=>{if(p||a()){const d="font-weight:bold;padding:0 5px;border-radius:100px",[b,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${t}`,`${d};background-color:${b};color:${v}`,"",`${d};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...f)}};return[["log","forceLog"],["warn","forceWarn"],["error","forceError"]].reduce((l,[p,f])=>(l[p]=u.bind(void 0,p,!1),l[f]=u.bind(void 0,p,!0),l),{})}function He(t){const e=n=>{throw n};return typeof t=="function"?ve.resolve(h(t,et(e,n=>n))()):h(t,ae(e,n=>n))}function ne(t){return Object.assign((...e)=>He(t(...e)),t)}const Me=Object.assign((t,e)=>h($n(()=>new ve((n,r,i)=>t(o=>n(k(o)),o=>n(M(o)),i),e),n=>n),ue(ae(U,V))),{fn:(t,e)=>Me((n,r,i)=>{const o=t(i);h(typeof o=="function"?o:Ue(o),Ci(r,n))()},e)});var Qi=Object.defineProperty,Zi=(t,e,n)=>e in t?Qi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,zt=(t,e,n)=>Zi(t,typeof e!="symbol"?e+"":e,n);function Gn(t){return e=>e instanceof t}function x(t,e){const n=class extends Error{constructor(...o){const a=typeof e=="function"?e(...o):typeof e=="string"?[e]:e||[];super(...a),this.name=t}};zt(n,"is",Gn(n));let r=n;return Object.defineProperty(r,"name",{value:t}),r}function it(t,e,n){const r=class extends x(t,n){constructor(...a){super(...a),zt(this,"data"),this.data=e(...a)}};zt(r,"is",Gn(r));let i=r;return Object.defineProperty(i,"name",{value:t}),i}function Yi(t){const e=n=>{const r={};return new URLSearchParams(n).forEach((i,o)=>{const a=r[o];Array.isArray(a)?a.push(i):a===void 0?r[o]=i:r[o]=[a,i]}),ge(t,r)};return ie(st([y(),jt(URLSearchParams)]),nt(n=>{try{return e(n),!0}catch{return!1}},"The value doesn't match required schema"),le(e))}function Xi(t){return ie(y(),nt(e=>{try{return JSON.parse(e),!0}catch{return!1}},"Input is not a valid JSON value"),le(JSON.parse),t)}function pe(t){return ie(y(),Xi(t))}function Kt(t){return ie(st([y(),jt(URLSearchParams)]),Yi(t))}function ot(t){return e=>t.test(e)}const Nn=ot(/^#[\da-f]{3}$/i),Hn=ot(/^#[\da-f]{4}$/i),xe=ot(/^#[\da-f]{6}$/i),xn=ot(/^#[\da-f]{8}$/i);function zn(t){return[xe,xn,Nn,Hn].some(e=>e(t))}function Kn(t){let e="#";for(let n=0;n<t.length-1;n+=1)e+=t[1+n].repeat(2);return e}function at(t){const e=t.replace(/\s/g,"").toLowerCase();if(/^#[\da-f]{3}$/i.test(e))return k(Kn(e.toLowerCase()+"f"));if(/^#[\da-f]{4}$/i.test(e))return k(Kn(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,i)=>r+parseInt(i,10).toString(16).padStart(2,"0"),"#").padEnd(9,"f")):M(new Error(`Value "${t}" does not satisfy any of known RGB formats.`))}function Jn(t){return h(at(t),z(e=>e.slice(0,7)))}const eo=ne(Jn),to=ne(at);function no(){return G({id:be(),photo_url:$(y()),type:y(),title:y(),username:$(y())})}function Qn(){return G({added_to_attachment_menu:$(Se()),allows_write_to_pm:$(Se()),first_name:y(),id:be(),is_bot:$(Se()),is_premium:$(Se()),last_name:$(y()),language_code:$(y()),photo_url:$(y()),username:$(y())})}function ro(){return G({projectCode:y(),uid:y(),sessionId:y(),rootToken:y()})}function so(){return G({auth_date:ie(y(),le(t=>new Date(Number(t)*1e3)),rt()),can_send_after:$(ie(y(),le(Number),Pt())),chat:$(pe(no())),chat_type:$(y()),chat_instance:$(y()),hash:$(y()),query_id:$(y()),receiver:$(pe(Qn())),start_param:$(y()),signature:$(y()),user:$(pe(Qn())),auth:$(pe(ro()))})}function Zn(){return Kt(so())}function Jt(){return Dt(y(),ie(st([y(),be()]),le(t=>typeof t=="number"?`#${(t&16777215).toString(16).padStart(6,"0")}`:t),nt(zn)))}function io(){const t=$(ie(y(),le(e=>e==="1")));return G({vbWebAppBotInline:t,vbWebAppData:$(Zn()),vbWebAppDefaultColors:$(pe(Jt())),vbWebAppFullscreen:t,vbWebAppPlatform:y(),vbWebAppShowSettings:t,vbWebAppStartParam:$(y()),vbWebAppThemeParams:pe(Jt()),vbWebAppVersion:y()})}function oo(){return Kt(io())}function Yn(){return G({eventType:y(),eventData:$(Ut())})}function Xn(t){return qe(()=>ge(Zn(),t),e=>e)}function ut(t){return qe(()=>ge(oo(),t),e=>e)}const ao=ne(Xn),er=ne(ut);function tr(t,e){return e||(e=(n,r)=>JSON.stringify(r)),new URLSearchParams(Object.entries(t).reduce((n,[r,i])=>(Array.isArray(i)?n.push(...i.map(o=>[r,String(o)])):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":e(r,i)]),n),[])).toString()}function nr(t){return tr(t)}function rr(t){return tr(t,(e,n)=>e==="vbWebAppData"?nr(n):JSON.stringify(n))}function uo(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(i){i(n)}),(r=t.get("*"))&&r.slice().map(function(i){i(e,n)})}}}function sr(t){return Lt(G({VBotWebviewProxy:G({postEvent:Ot()})}),t)}function ir(){try{return window.self!==window.top}catch{return!0}}class or extends x("MethodUnsupportedError",(e,n)=>[`Method "${e}" is unsupported in Mini Apps version ${n}`]){}class ar extends x("MethodParameterUnsupportedError",(e,n,r)=>[`Parameter "${n}" of "${e}" method is unsupported in Mini Apps version ${r}`]){}class ur extends it("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.vbot-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 cr extends x("InvalidLaunchParamsError",(e,n)=>[`Invalid value for launch params: ${e}`,{cause:n}]){}class Qt extends x("UnknownEnvError"){}class lr extends x("InvokeCustomMethodError",e=>[`Server returned error: ${e}`]){}const pr="launchParams";function hr(t){return t.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&")}function Te(){return h(ze(),ai(ut))}const co=ne(Te);function Zt(){return h(ze(),z(t=>{const e=new URLSearchParams(t).get("vbWebAppData");return e?$e(e):Fe}))}function lo(){return h(Zt(),si(t=>{throw t},t=>t),vt(()=>{},t=>t))}function ze(){const t=[];for(const[e,n]of[[()=>hr(window.location.href),"window.location.href"],[()=>{const r=performance.getEntriesByType("navigation")[0];return r&&hr(r.name)},"performance navigation entries"],[()=>Un(pr),"local storage"]]){const r=e();if(!r){t.push({source:n,error:new Error("Source is empty")});continue}const i=h(ut(r),ri(o=>o,()=>!0));if(typeof i!="boolean"){t.push({source:n,error:i});continue}return xt(pr,r),k(r)}return M(new ur(t))}const po=ne(ze);function fr(t,e){const n=new Map,r=uo(),i=(o,a,u=!1)=>{const l=n.get(o)||new Map;n.set(o,l);const p=l.get(a)||[];l.set(a,p);const f=p.findIndex(d=>d[1]===u);if(f>=0&&(r.off(o,p[f][0]),p.splice(f,1),!p.length&&(l.delete(a),!l.size))){const d=n.size;n.delete(o),d&&!n.size&&e()}};return{on(o,a,u){!n.size&&t();const l=()=>{i(o,a,u)},p=(...b)=>{u&&l(),o==="*"?a({name:b[0],payload:b[1]}):a(...b)};r.on(o,p);const f=n.get(o)||new Map;n.set(o,f);const d=f.get(a)||[];return f.set(a,d),d.push([p,u||!1]),l},off:i,emit:r.emit,clear(){const o=n.size;r.all.clear(),n.clear(),o&&e()}}}function ct(t,e){window.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({eventType:t,eventData:e}),source:window.parent}))}const Yt=D(!1),dr=D("https://web.telegram.org"),ho=t=>{he().log("Event received:",t)},_r=S(Yt);function fo(t){t!==Yt()&&(Yt.set(t),(t?Z:Ce)("*",ho))}const mr=S(dr);function _o(t){dr.set(t),he().log("New target origin set",t)}const lt=D((...t)=>{window.parent.postMessage(...t)}),he=D(Wn("Bridge",{bgColor:"#9147ff",textColor:"white",shouldLog:_r}));function Xt(t,e,n){const r=[n],i=t[e];typeof i=="function"&&r.push(i);const o=(...u)=>{r.forEach(l=>l(...u))},a=Object.assign((...u)=>{o(...u)},{unwrap(){const{length:u}=r;if(u===1){delete t[e];return}if(u===2){vr(t,e,r[1]);return}r.unshift(1),vr(t,e,o)}});gr(t,e,()=>a,u=>r.push(u))}function br(t,e){const n=t[e];gr(t,e,()=>n,r=>{Object.entries(r).forEach(([i,o])=>{n[i]=o})})}function gr(t,e,n,r){Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:n,set:r})}function vr(t,e,n){Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n})}const mo={clipboard_text_received:G({req_id:y(),data:Be(y())}),custom_method_invoked:G({req_id:y(),result:$(Ut()),error:$(y())}),popup_closed:Be(G({button_id:Be(y(),()=>{})}),{}),viewport_changed:Be(G({height:be(),width:Be(be(),()=>window.innerWidth),is_state_stable:Se(),is_expanded:Se()}),()=>({height:window.innerHeight,is_state_stable:!0,is_expanded:!0})),theme_changed:G({theme_params:Jt()})};function wr(t){if(t.source!==window.parent)return;let e;try{e=ge(pe(Yn()),t.data)}catch{return}const{eventType:n,eventData:r}=e,i=mo[n];let o;try{o=i?ge(i,r):r}catch(a){return he().forceError([`An error occurred processing the "${n}" event from the VBot application.`,"Please, file an issue here:","https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose"].join(`
|
|
3
|
+
`),e,a)}bo(n,o)}const{on:Z,off:Ce,emit:bo,clear:go}=fr(()=>{const t=window;!t.TelegramGameProxy&&(t.TelegramGameProxy={}),Xt(t.TelegramGameProxy,"receiveEvent",ct),br(t,"TelegramGameProxy"),!t.VBot&&(t.VBot={}),!t.VBot.WebView&&(t.VBot.WebView={}),Xt(t.VBot.WebView,"receiveEvent",ct),br(t.VBot,"WebView"),Xt(t,"TelegramGameProxy_receiveEvent",ct),window.addEventListener("message",wr)},()=>{[["TelegramGameProxy_receiveEvent"],["TelegramGameProxy","receiveEvent"],["VBot","WebView","receiveEvent"]].forEach(t=>{const e=window;let n=[void 0,e];for(const o of t)if(n=[n[1],n[1][o]],!n[1])return;const[r,i]=n;"unwrap"in i&&(i.unwrap(),r&&r!==e&&!Object.keys(r).length&&delete e[t[0]])}),window.removeEventListener("message",wr)}),vo=(...t)=>lt()(...t);function wo(t,e){h(Ve(t,e),ni(n=>{throw n}))}function Ve(t,e){he().log("Posting event:",e?{eventType:t,eventData:e}:{eventType:t});const n=window,r=JSON.stringify({eventType:t,eventData:e});return ir()?(vo(r,mr()),k(void 0)):sr(n)?(n.VBotWebviewProxy.postEvent(t,JSON.stringify(e)),k(void 0)):Lt(G({external:G({notify:Ot()})}),n)?(n.external.notify(r),k(void 0)):M(new Qt)}function pt(t,e,n={}){const{capture:r=()=>!0,postEvent:i=Ve}=n,o=D(),[a,u]=Ne();(Array.isArray(e)?e:[e]).forEach(p=>{a(Z(p,f=>{const d=Array.isArray(e);r(d?{event:p,payload:f}:f)&&o.set([d?{event:p,payload:f}:f])}))});const l=p=>(u(),p);return h(async()=>i(t,n.params),ue(()=>Me((p,f,d)=>{const b=o();if(b)return p(b[0]);const v=C=>{C&&p(C[0])},F=()=>{o.unsub(v)};o.sub(v),d.on("finalized",F)},n)),We(l,l))}function yo(t,e){const n=en(t,e);return typeof n=="function"?ve.fn(()=>He(n)):n}function en(t,e){const n=sr(window);if(!t)return n||h(ze(),ae(()=>!1,()=>!0));if(n)return V(!0);const{timeout:r=100}=e||{};return h(pt("web_app_request_theme","theme_changed",{...e,timeout:r}),et(i=>Nt.is(i)||Qt.is(i)?k(!1):M(i),()=>k(!0)))}function Fo({launchParams:t,onEvent:e,resetPostMessage:n}={}){if(t){const o=typeof t=="string"||t instanceof URLSearchParams?t.toString():rr({...t,vbWebAppData:void 0})+(t.vbWebAppData?`&vbWebAppData=${encodeURIComponent(t.vbWebAppData.toString())}`:"");try{er(o)}catch(a){throw new cr(o,a)}xt("launchParams",o)}if(ir()){if(!e)return;n&<.reset();const o=lt();lt.set((...a)=>{const[u]=a,l=()=>{o(...a)};try{const p=ge(pe(Yn()),u);e({name:p.eventType,params:p.eventData},l)}catch{l()}});return}const r=window.VBotWebviewProxy||{},i=r.postEvent||(()=>{});window.VBotWebviewProxy={...r,postEvent(o,a){const u=()=>{i(o,a)};e?e({name:o,params:a?JSON.parse(a):void 0},u):u()}},he().log("Environment was mocked by the mockVBotEnv function")}function So(t,e="*"){const n=o=>{if(o.source===t.contentWindow)try{const a=JSON.parse(o.data),{eventType:u,eventData:l}=a;r.emit(u,l)}catch{}},r=fr(()=>{window.addEventListener("message",n)},()=>{window.removeEventListener("message",n)}),i={...r,send:(o,a)=>{if(t.contentWindow){const u=JSON.stringify({eventType:o,eventData:a});t.contentWindow.postMessage(u,e)}},clear:()=>{r.clear(),Ke===i&&(Ke=void 0)}};return Ke=i,i}let Ke;function Pe(){if(!Ke)throw new Error("HostBridge not initialized. Call defineHostBridge() first.");return Ke}function yr(t){return({req_id:e})=>e===t}const Fr={"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"],9.2:["web_app_send_notification","web_app_finish_refresh"]};function tn(t,e){return Object.keys(Fr).find(n=>Fr[n].some(r=>e?typeof r=="object"&&r.method===t&&r.param===e:r===t))||null}function Sr(t){return t.split(".").map(Number)}function Co(t,e){const n=Sr(t),r=Sr(e),i=Math.max(n.length,r.length);for(let o=0;o<i;o+=1){const a=n[o]||0,u=r[o]||0;if(a!==u)return a>u?1:-1}return 0}function fe(t,e,n){const r=n?tn(t,e):tn(t);return r?Co(r,n||e)<=0:!1}function ko(t,e="strict"){const n=typeof e=="function"?e:r=>{const{method:i,version:o}=r,a="param"in r?new ar(i,r.param,o):new or(i,o);if(e==="strict")throw a;return he().forceWarn(a.message)};return((r,i)=>fe(r,t)?r==="web_app_set_header_color"&&Lt(G({color:Bn()}),i)&&!fe(r,"color",t)?n({version:t,method:r,param:"color"}):wo(r,i):n({version:t,method:r}))}function Eo(t,e,n,r){return h(pt("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:t,params:e,req_id:n},capture:yr(n)}),te(({result:i,error:o})=>o?U(new lr(o)):V(i)))}function Io(t,e,n={}){const{capture:r=()=>!0,postEvent:i=Ve}=n,o=D(),[a,u]=Ne();(Array.isArray(e)?e:[e]).forEach(p=>{a(Z(p,f=>{(Array.isArray(e)?r({event:p,payload:f}):r(f))&&o.set([f])}))});const l=p=>(u(),p);return h(async()=>i(t,n.params),ue(()=>Me((p,f,d)=>{const b=o();if(b)return p(b[0]);const v=C=>{C&&p(C[0])},F=()=>{o.unsub(v)};o.sub(v),d.on("finalized",F)},n)),We(l,l))}function Ao(){Object.hasOwn||(Object.hasOwn=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)})}function nn(t){return qe(()=>decodeURIComponent(atob(t.replace(/-/g,"+").replace(/_/g,"/")).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")),e=>e)}const $o=ne(nn);function rn(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,n)=>String.fromCharCode(parseInt(`0x${n}`)))).replace(/\+/g,"-").replace(/\//g,"_")}function Cr(t){const e=rn(typeof t=="string"?t:JSON.stringify(t));return e.length>512?M(new Error("Value is too long for start parameter")):k(e)}const qo=ne(Cr);function Bo(t,e){return He(kr(t,typeof e=="function"?n=>qe(()=>e(n),r=>r):e))}function kr(t,e){return h(nn(t),ui(n=>e?typeof e=="function"?e(n):mi(n):k(n)))}function Mo(t){return rn(t).length<=512}function oe(t,e){return S(()=>fe(t,ee(e)))}function _(t){return Object.assign(ne(t),{ifAvailable(...e){return h(t.ifAvailable(...e),vt(()=>({ok:!1}),n=>({ok:!0,data:He(n)})))}})}function ke(t){return[t]}class Je extends it("ValidationError",(e,n)=>({input:e,issues:n}),"Validation error"){}class ht extends x("CSSVarsBoundError","CSS variables are already bound"){}class Er extends it("DeviceStorageMethodError",e=>({error:e}),e=>[e]){}class Ir extends it("SecureStorageMethodError",e=>({error:e}),e=>[e]){}class Ar extends x("NotAvailableError",ke){}class To extends x("InvalidEnvError",ke){}class $r extends x("FunctionNotAvailableError",ke){}class re extends x("InvalidArgumentsError",(e,n)=>[e,{cause:n}]){}class ft extends x("ConcurrentCallError",ke){}class qr extends x("SetEmojiStatusError",e=>[`Failed to set emoji status: ${e}`]){}class sn extends x("AccessDeniedError",ke){}class Br extends x("FullscreenFailedError",ke){}class Mr extends x("ShareMessageError",ke){}class Tr extends x("UnknownThemeParamsKeyError",e=>[`Unknown theme params key passed: ${e}`]){}function R(t,e){const n=S(()=>ee(e.version)||"100"),r=S(()=>ee(e.isTma)),{requires:i,returns:o}=e,a=i?typeof i=="object"?i:{every:[i]}:void 0,u=g=>{if(!e.supports)return!0;const w=e.supports[g];return fe(w.method,w.param,n())},l=()=>{if(!a)return;const[g,w]="every"in a?["every",a.every]:["some",a.some];for(let m=0;m<w.length;m++){const O=w[m],j=typeof O=="function"?O():fe(O,n())?void 0:`it is unsupported in Mini Apps version ${n()}`;if(j&&(g==="every"||m===w.length-1))return j}},p=(...g)=>{for(const w in e.supports)if(e.supports[w].shouldCheck(...g)&&!u(w))return`option ${w} is not supported in Mini Apps version ${n()}`},f=S(()=>!l()),d=S(()=>n()!=="0.0"),b=S(()=>e.isMounted?e.isMounted():!0),v=S(()=>r()&&d()&&f()&&b()),F=g=>{const w=new $r(g);return["task","promise"].includes(e.returns)?U(w):M(w)},C=(...g)=>o==="plain"?qe(()=>t(...g),w=>w):o==="promise"?$n(()=>t(...g),w=>w):t(...g);return Object.assign((...g)=>{var j;const w="Unable to call function:";if(!r())return F(`${w} it can't be called outside Mini Apps`);if(!d())return F(`${w} the SDK was not initialized. Use the SDK init() function`);const m=l();if(m)return F(`${w} ${m}`);const O=p(...g);if(O)return F(`${w} ${O}`);if(!b()){const W=(j=e.isMounting)!=null&&j.call(e)?"mounting. Wait for the mount completion":"unmounted. Use the mount() method";return F(`${w} the component is ${W}`)}return C(...g)},t,{isAvailable:v,ifAvailable(...g){return v()?$e(C(...g)):Fe}},a?{isSupported:f}:{},e.supports?{supports:u}:{})}function B(t){return e=>R(e,t)}class dt{constructor({isTma:e,storage:n,onClick:r,offClick:i,initialState:o,isPageReload:a,postEvent:u,payload:l,method:p,version:f}){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 d=new me({initialState:o,onChange(g){n.set(g)}}),b=new Ge({initialState:o,isPageReload:a,onMounted:d.setState,restoreState:n.get}),v={version:f,requires:p,isTma:e},F=B({...v,returns:"plain"}),C=B({...v,returns:"either",isMounted:b.isMounted});this.isMounted=b.isMounted,this.isSupported=oe(p,f),this.state=d.state,this.setStateFp=C(g=>{const w={...this.state(),...$t(g)};return d.hasDiff(w)?h(u(p,l(w)),z(()=>{d.setState(w)})):k(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 g=()=>{};return h(b.mount(),ae(g,g))}),this.mount=_(this.mountFp),this.unmount=b.unmount,this.stateSetters=g=>{const w=C(m=>this.setStateFp({[g]:m}));return[_(w),w]},this.stateBoolSetters=g=>{const[,w]=this.stateSetters(g),m=C(()=>w(!1)),O=C(()=>w(!0));return[[_(m),m],[_(O),O]]}}stateGetter(e){return S(()=>this.state()[e])}}class Vr{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 dt({...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(()=>en())}}function Re(t){return e=>({...e,...ee(t)})}function Qe(t,e){return D(t,e)}const Pr=Qe(Ve),Ee=(...t)=>Pr()(...t),Rr=(...t)=>He(Ee(...t)),K=Re({postEvent:Ee});function Vo(t){return{get:()=>Un(t),set(e){xt(t,e)}}}function Po(){return performance.getEntriesByType("navigation")[0]}function Ro(){const t=Po();return!!t&&t.type==="reload"}function we(t){return Re({storage:Vo(t),isPageReload:Ro})}const on=Qe("0.0"),q=Re({version:on});function an(t,e){return{...h(E(),K,q,we(t)),onClick(n,r){return Z(e,n,r)},offClick(n,r){Ce(e,n,r)}}}const Lo=new Vr(an("backButton","back_button_pressed"));class un{constructor({initialState:e,onMounted:n,restoreState:r,onUnmounted:i,isPageReload:o}){s(this,"_isMounted",D(!1));s(this,"isMounted",S(this._isMounted));s(this,"mount");s(this,"unmount");this.mount=a=>{if(this._isMounted())return V(void 0);const u=ee(o)?r():void 0;return h(u?V(u):e(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 Lr(){return new Ar("Biometry is not available")}function cn(t){let e=!1,n=!1,r="",i=!1,o="",a=!1;return t.available&&(e=!0,n=t.token_saved,r=t.device_id,i=t.access_requested,o=t.type,a=t.access_granted),{available:e,tokenSaved:n,deviceId:r,type:o,accessGranted:a,accessRequested:i}}class Or{constructor({version:e,request:n,postEvent:r,storage:i,onInfoReceived:o,offInfoReceived:a,isTma:u,isPageReload:l}){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 p=g=>{f.setState(cn(g))},f=new me({initialState:{available:!1,type:"unknown",accessGranted:!1,accessRequested:!1,deviceId:"",tokenSaved:!1},onChange:i.set}),d=new un({initialState(g){return h(n("web_app_biometry_get_info","biometry_info_received",g),A(cn))},isPageReload:l,onMounted(g){f.setState(g),o(p)},onUnmounted(){a(p)},restoreState:i.get}),b={version:e,requires:"web_app_biometry_request_auth",isTma:u},v=B({...b,returns:"either"}),F=B({...b,returns:"task"}),C=B({...b,isMounted:d.isMounted,returns:"task"});this.isAvailable=f.getter("available"),this.isMounted=d.isMounted,this.isSupported=oe("web_app_biometry_request_auth",e),this.state=f.state,this.unmount=d.unmount,this.mountFp=F(d.mount),this.authenticateFp=C(g=>this.isAvailable()?h(n("web_app_biometry_request_auth","biometry_auth_requested",{...g,params:{reason:((g||{}).reason||"").trim()}}),A(w=>(f.setState({token:w.token}),w))):U(Lr())),this.openSettingsFp=v(()=>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(w=>{const m=cn(w);return m.available?(f.setState(m),V(m.accessRequested)):U(Lr())}))),this.updateTokenFp=C((g={})=>{var w;return h(n("web_app_biometry_update_token","biometry_token_updated",{...g,params:{token:g.token||"",reason:(w=g.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 jr=(t,e,n)=>Io(t,e,{postEvent:Ee,...n}),ln=(t,e,n)=>pt(t,e,{postEvent:Ee,...n}),Oo=(...t)=>ve.fn(()=>jr(...t)()),jo=(...t)=>ve.fn(()=>ln(...t)()),Y=Re({request:ln});function Do(){return new Or({...h(E(),K,q,Y,we("biometry")),offInfoReceived(t){Ce("biometry_info_received",t)},onInfoReceived(t){return Z("biometry_info_received",t)}})}const Uo=Do();class Dr{constructor({postEvent:e,storage:n,isTma:r,isPageReload:i}){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 o=new me({initialState:{isConfirmationEnabled:!1},onChange(d){n.set(d)}}),a=new Ge({onMounted:o.setState,restoreState:n.get,initialState:{isConfirmationEnabled:!1},isPageReload:i}),u={requires:"web_app_setup_closing_behavior",isTma:r},l=B({...u,returns:"plain"}),p=B({...u,returns:"either",isMounted:a.isMounted}),f=d=>d===this.isConfirmationEnabled()?k(void 0):(o.setState({isConfirmationEnabled:d}),e("web_app_setup_closing_behavior",{need_confirmation:d}));this.isConfirmationEnabled=o.getter("isConfirmationEnabled"),this.isMounted=a.isMounted,this.disableConfirmationFp=p(()=>f(!1)),this.enableConfirmationFp=p(()=>f(!0)),this.mountFp=l(()=>{const d=()=>{};return h(a.mount(),ae(d,d))}),this.unmount=a.unmount,this.disableConfirmation=_(this.disableConfirmationFp),this.enableConfirmation=_(this.enableConfirmationFp),this.mount=_(this.mountFp)}}function Wo(){return new Dr(h(E(),we("closingBehavior"),K))}const Go=Wo();class Ur{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 i=B({version:e,requires:"web_app_invoke_custom_method",isTma:n,returns:"task"});this.isSupported=oe("web_app_invoke_custom_method",e),this.deleteItemFp=i((o,a)=>{const u=Array.isArray(o)?o:[o];return h(u.length?r("deleteStorageValues",{keys:u},a):V(void 0),A(()=>{}))}),this.getItemFp=i((o,a)=>h(this.getItemsFp([o],a),A(u=>u[o]||""))),this.getItemsFp=i((o,a)=>h(o.length?r("getStorageValues",{keys:o},a):V({}),A(u=>({...o.reduce((l,p)=>(l[p]="",l),{}),...ge(Dt(y(),y()),u)})))),this.getKeysFp=i(o=>h(r("getStorageKeys",{},o),A(a=>ge(Mn(y()),a)))),this.setItemFp=i((o,a,u)=>h(r("saveStorageValue",{key:o,value:a},u),A(()=>{}))),this.clearFp=i(o=>h(this.getKeysFp(o),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 pn=Qe(0);function _t(){return pn.set(pn()+1),pn().toString()}function Wr(t,e,n){return Eo(t,e,_t(),{...n||{},postEvent:Ee})}const hn=Re({invokeCustomMethod:Wr});function No(){return new Ur(h(E(),q,hn))}const Ho=No();class Gr{constructor({isTma:e,request:n,version:r,createRequestId:i}){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 o=B({version:r,requires:"web_app_device_storage_get_key",isTma:e,returns:"task"}),a=(u,l,p)=>{const f=i();return h(n(u,["device_storage_failed",l],{params:{...p,req_id:f},capture:(d=>"payload"in d?d.payload.req_id===f:!0)}),te(d=>d.event==="device_storage_failed"?U(new Er(d.payload.error||"UNKNOWN_ERROR")):V(d.payload)))};this.getItemFp=o(u=>h(a("web_app_device_storage_get_key","device_storage_key_received",{key:u}),A(l=>l.value))),this.setItemFp=o((u,l)=>h(a("web_app_device_storage_save_key","device_storage_key_saved",{key:u,value:l}),A(()=>{}))),this.deleteItemFp=o(u=>this.setItemFp(u,null)),this.clearFp=o(()=>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 Nr=Re({createRequestId:_t});function xo(){return new Gr(h(E(),q,Y,Nr))}const zo=xo();function Ko({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 Jo(){return Ko(h(E(),q,Y))}const Hr=Jo(),Qo=_(Hr);function Zo({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(i=>i.event==="emoji_status_failed"?U(new qr(i.payload.error)):V(void 0))),{...e,requires:"web_app_set_emoji_status",returns:"task"})}function Yo(){return Zo(h(E(),Y,q))}const xr=Yo(),Xo=_(xr);class zr{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 i="web_app_trigger_haptic_feedback",o=B({requires:i,isTma:n,version:r,returns:"plain"});this.isSupported=oe(i,r),this.impactOccurredFp=o(a=>e(i,{type:"impact",impact_style:a})),this.notificationOccurredFp=o(a=>e(i,{type:"notification",notification_type:a})),this.selectionChangedFp=o(()=>e(i,{type:"selection_change"})),this.impactOccurred=_(this.impactOccurredFp),this.notificationOccurred=_(this.notificationOccurredFp),this.selectionChanged=_(this.selectionChangedFp)}}function ea(){return new zr(h(E(),K,q))}const ta=ea();function na({postEvent:t,...e}){return R(()=>t("web_app_add_to_home_screen"),{...e,requires:"web_app_add_to_home_screen",returns:"either"})}function ra(){return na(h(E(),q,K))}const Kr=ra(),sa=_(Kr);function ia({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 oa(){return ia(h(E(),q,Y))}const Jr=oa(),aa=_(Jr);class Qr{constructor({retrieveInitData:e}){s(this,"_state",D());s(this,"_raw",D());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,"auth",this.fromState("auth"));s(this,"user",this.fromState("user"));s(this,"restoreFp");s(this,"restore");this.restoreFp=()=>h(e(),z(vt(()=>{},({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 ua(){return new Qr({retrieveInitData(){return h(ii,En("obj",()=>h(Te(),z(({vbWebAppData:t})=>t?$e(t):Fe))),En("raw",Zt),z(({obj:t,raw:e})=>h(Ks,Cn("obj",()=>t),Cn("raw",()=>e))))}})}const ca=ua();class Zr{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 i=B({version:e,isTma:r,requires:"web_app_open_invoice",returns:"task"}),o=D(!1),a=()=>{o.set(!1)};this.isSupported=oe("web_app_open_invoice",e),this.isOpened=S(o),this.openSlugFp=i((u,l)=>h(this.isOpened()?U(new ft("Invoice is already opened")):V(void 0),te(()=>(o.set(!0),n("web_app_open_invoice","invoice_closed",{...l,params:{slug:u},capture:p=>u===p.slug}))),We(p=>(a(),p),p=>(a(),p.status)))),this.openUrlFp=i((u,l)=>{const{hostname:p,pathname:f}=new URL(u,window.location.href);if(p!=="t.me")return U(new re(`Link has unexpected hostname: ${p}`));const d=f.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);return d?this.openSlugFp(d[2],l):U(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 la(){return new Zr(h(E(),Y,q))}const pa=la();function ha({postEvent:t,...e}){return R((n,r={})=>{if(typeof n=="string")try{n=new URL(n)}catch(i){return M(new re(`"${n.toString()}" is invalid URL`,i))}return t("web_app_open_link",{url:n.toString(),try_browser:r.tryBrowser,try_instant_view:r.tryInstantView})},{...e,returns:"either"})}function fa(){return ha(h(E(),K))}const Yr=fa(),da=_(Yr);function _a({postEvent:t,version:e,...n}){return R(r=>{const i=r.toString();return i.match(/^https:\/\/t.me\/.+/)?fe("web_app_open_tg_link",ee(e))?(r=new URL(r),t("web_app_open_tg_link",{path_full:r.pathname+r.search})):(window.location.href=i,k(void 0)):M(new re(`"${i}" is invalid URL`))},{...n,returns:"either"})}function ma(){return _a(h(E(),K,q))}const fn=ma(),ba=_(fn);function ga({openVbotLink: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 va(){return ga({...E(),openVbotLink:fn})}const Xr=va(),wa=_(Xr);function ya(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 es{constructor({version:e,request:n,postEvent:r,storage:i,isTma:o,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 me({initialState:{available:!1,accessGranted:!1,accessRequested:!1},onChange:i.set}),l=new un({isPageReload:a,restoreState:i.get,onMounted:u.setState,initialState(v){return h(n("web_app_check_location","location_checked",v),A(ya))}}),p={version:e,requires:"web_app_check_location",isTma:o},f=B({...p,returns:"either"}),d=B({...p,returns:"task"}),b=B({...p,returns:"task",isMounted:l.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=l.isMounted,this.state=u.state,this.unmount=l.unmount,this.mountFp=d(l.mount),this.openSettingsFp=f(()=>r("web_app_open_location_settings")),this.requestLocationFp=b(v=>h(n("web_app_request_location","location_requested",v),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 Fa(){return new es(h(E(),K,q,Y,we("locationManager")))}const Sa=Fa();class ts{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 dt({...n,version:"100",initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Continue"},method:"web_app_setup_main_button",payload:o=>({has_shine_effect:o.hasShineEffect,is_visible:o.isVisible,is_active:o.isEnabled,is_progress_visible:o.isLoaderVisible,text:o.text,color:o.bgColor,text_color:o.textColor})}),i=(o,a)=>{const u=r.stateGetter(o);return S(()=>u()||ee(a))};this.bgColor=i("bgColor",e.bgColor),this.textColor=i("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 dn(t,e){document.documentElement.style.setProperty(t,e)}function _n(t){document.documentElement.style.removeProperty(t)}function ns(t){return h(at(t),z(e=>Math.sqrt([.299,.587,.114].reduce((n,r,i)=>{const o=parseInt(e.slice(1+i*2,1+(i+1)*2),16);return n+o*o*r},0))<120))}const mn=ne(ns);class rs{constructor({initialState:e,onChange:n,offChange:r,isTma:i,storage:o,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",D(!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||mn(e)}));s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");const u=new me({initialState:{},onChange:o.set}),l=v=>{u.setState(v.theme_params)},p=new Ge({initialState:()=>k(ee(e)),isPageReload:a,onMounted(v){u.setState(v),n(l)},onUnmounted(){r(l)},restoreState:o.get}),f={isTma:i,returns:"either"},d=B(f),b=B({...f,isMounted:p.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=p.isMounted,this.bindCssVarsFp=b(v=>{if(this._isCssVarsBound())return M(new ht);v||(v=g=>`--tg-theme-${Ji(g)}`);const F=g=>{Object.entries(u.state()).forEach(([w,m])=>{m&&g(w,m)})},C=()=>{F((g,w)=>{dn(v(g),w)})};return C(),u.state.sub(C),this._isCssVarsBound.set(!0),k(()=>{F(_n),u.state.unsub(C),this._isCssVarsBound.set(!1)})}),this.mountFp=d(p.mount),this.unmount=p.unmount,this.bindCssVars=_(this.bindCssVarsFp),this.mount=_(this.mountFp)}}const bn=Qe({});function Ca(){return new rs({...h(E(),we("themeParams")),offChange(t){Ce("theme_changed",t)},onChange(t){Z("theme_changed",t)},initialState:bn})}const Ze=Ca();function ss(t,e,n){return h(an(t,e),r=>({...r,defaults:n}))}const ka=new ts(ss("mainButton","main_button_pressed",{bgColor:S(()=>Ze.buttonColor()||"#2481cc"),textColor:S(()=>Ze.buttonTextColor()||"#ffffff")}));class is{constructor({storage:e,isPageReload:n,version:r,postEvent:i,isTma:o,theme:a,onVisibilityChanged:u,offVisibilityChanged:l}){s(this,"isSupported");s(this,"isDark",S(()=>{const e=this.bgColorRgb();return e?mn(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 p=m=>{b.setState({isActive:m.is_visible})},f=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 W=O();if(!xe(W)&&(j!=="web_app_set_header_color"||!["bg_color","secondary_bg_color"].includes(W))){const I=m[W];I&&i(j,{color:I})}})},d=new Ge({initialState(){return k({bgColor:"bg_color",headerColor:"header_bg_color",bottomBarColor:"bottom_bar_bg_color",isActive:!0})},isPageReload:n,onMounted:m=>{u(p),a.sub(f),b.setState(m)},onUnmounted(){l(p),a.unsub(f)},restoreState:e.get});this.isMounted=d.isMounted,this.mountFp=R(()=>{const m=()=>{};return h(d.mount(),ae(m,m))},{isTma:o,returns:"plain"}),this.mount=_(this.mountFp),this.unmount=d.unmount;const b=new me({initialState:{bgColor:"bg_color",bottomBarColor:"bottom_bar_bg_color",headerColor:"bg_color",isActive:!1},onChange:e.set});this.state=b.state;const v=m=>xe(m)?m:ee(a)[m],F=m=>S(()=>v(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=>fe(m,ee(r))));const C=D(!1);this.isCssVarsBound=S(C),this.bindCssVarsFp=R(m=>{if(C())return M(new ht);const[O,j]=Ne(()=>{C.set(!1)}),W=(I,L)=>{const P=()=>{dn(I,L()||null)};P(),O(L.sub(P),_n.bind(null,I))};return m||(m=I=>`--tg-${jn(I)}`),W(m("bgColor"),this.bgColorRgb),W(m("bottomBarColor"),this.bottomBarColorRgb),W(m("headerColor"),this.headerColorRgb),C.set(!0),k(j)},{isTma:o,returns:"either",isMounted:this.isMounted}),this.bindCssVars=_(this.bindCssVarsFp);const g=m=>{const O=b.getter(m),j=F(O),W={headerColor:"web_app_set_header_color",bgColor:"web_app_set_background_color",bottomBarColor:"web_app_set_bottom_bar_color"}[m],I=R(L=>{if(L===O())return k(void 0);if(W==="web_app_set_header_color"&&(L==="bg_color"||L==="secondary_bg_color"))return h(i("web_app_set_header_color",{color_key:L}),z(()=>{b.setState({[m]:L})}));const P=v(L);return h(P?i(W,{color:P}):M(new Tr(L)),z(()=>{b.setState({[m]:L})}))},{isTma:o,version:r,requires:W,isMounted:this.isMounted,returns:"either",supports:m==="headerColor"?{rgb:{method:"web_app_set_header_color",param:"color",shouldCheck:xe}}:void 0});return[O,j,_(I),I]};[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 w=B({isTma:o,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 Ea(){return new is({...h(E(),K,q,we("miniApp")),offVisibilityChanged(t){Ce("visibility_changed",t)},onVisibilityChanged(t){Z("visibility_changed",t)},theme:Ze.state})}const os=Ea();function Ia(){const t=Date.now(),e=Math.random().toString(36).substring(2,9);return`notif_${t}_${e}`}class as{constructor({}){s(this,"sendFp");s(this,"send");this.sendFp=e=>h(Ue(Ve("web_app_send_notification",{id:Ia(),message:e.message,title:e.title,type:e.type??"default"})),A(()=>{})),this.send=e=>this.sendFp(e)().then(r=>{if(r._tag==="Left")throw r.left;return r.right})}}function Aa(){return new as(h(E()))}const $a=Aa();function qa(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 i=[];if(!r.length)i.push({type:"close",id:""});else for(let o=0;o<r.length;o++){const a=r[o],u=a.id||"";if(u.length>64)return M(new re(`Button with index ${o} has invalid id: ${u}`));if(!a.type||a.type==="default"||a.type==="destructive"){const l=a.text.trim();if(!l||l.length>64)return M(new re(`Button with index ${o} has invalid text: ${l}`));i.push({type:a.type,text:l,id:u})}else i.push({type:a.type,id:u})}return k({title:n,message:e,buttons:i})}class us{constructor({version:e,isTma:n,request:r}){s(this,"isOpened");s(this,"isSupported");s(this,"showFp");s(this,"show");const i=D(!1),o=()=>{i.set(!1)},a=B({version:e,isTma:n,requires:"web_app_open_popup",returns:"task"});this.isSupported=oe("web_app_open_popup",e),this.isOpened=S(i),this.showFp=a(u=>h(this.isOpened()?U(new ft("A popup is already opened")):V(void 0),ue(()=>Ue(qa(u))),te(l=>(i.set(!0),r("web_app_open_popup","popup_closed",{...u,params:l}))),We(l=>(o(),l),l=>(o(),l.button_id)))),this.show=_(this.showFp)}}function Ba(){return new us(h(E(),Y,q))}const Ma=Ba();function Ta({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 Va(){return Ta(h(E(),q,Y))}const gn=Va(),Pa=_(gn);function Ra({invokeCustomMethod:t,requestPhoneAccess:e,...n}){const r=a=>h(t("getRequestedContact",{},{...a,timeout:(a||{}).timeout||5e3}),ue(u=>{const l=Wt(y(),u);if(!l.success)return U(new Je(u,l.issues));if(!l.output)return V(void 0);const p=Wt(Kt(G({contact:pe(G({user_id:be(),phone_number:y(),first_name:y(),last_name:$(y())})),auth_date:ie(y(),le(f=>new Date(Number(f)*1e3)),rt()),hash:y()})),l.output);return p.success?V({raw:l.output,parsed:p.output}):U(new Je(l.output,p.issues))})),i=a=>h(r(a),et(u=>Je.is(u)?M(u):k(void 0),u=>k(u))),o=a=>Me(async(u,l,p)=>{let f=50;for(;!p.isRejected;){const d=await i(p)();if(d._tag==="Left")return l(d.left);if(d.right)return u(d.right);await new Promise(b=>setTimeout(b,f)),f+=50}},a);return R(a=>Me.fn(u=>h(i(u),te(l=>l?V(l):h(e(u),ue(p=>p==="sent"?o(u):U(new sn("User denied access")))))),a),{...n,returns:"task",requires:"web_app_request_phone"})}function La(){return Ra({...h(E(),hn,q),requestPhoneAccess:gn})}function Oa({requestContact:t,...e}){return R(t,{...e,returns:"task",requires:"web_app_request_phone"})}function ja(){return Oa({...h(E(),q),requestContact(t){return h(vn(t),A(e=>e.parsed))}})}const vn=La(),Da=_(vn),cs=ja(),Ua=_(cs);function Wa({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 Ga(){return Wa(h(E(),q,Y))}const ls=Ga(),Na=_(ls);class ps{constructor({version:e,onClosed:n,onTextReceived:r,isTma:i,postEvent:o}){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:i},u=B({...a,returns:"either"}),l=B({...a,returns:"task"}),p=D(!1),f=()=>{p.set(!1)};this.isSupported=oe("web_app_open_scan_qr_popup",e),this.isOpened=S(p),this.captureFp=l(d=>{let b;return h(this.openFp({...d,onCaptured:v=>{d.capture(v)&&(b=v,this.close())}}),A(()=>b))}),this.closeFp=u(()=>h(o("web_app_close_scan_qr_popup"),z(f))),this.openFp=l(d=>h(p()?U(new ft("The QR Scanner is already opened")):async()=>o("web_app_open_scan_qr_popup",{text:d.text}),ue(()=>{p.set(!0);const[b,v]=Ne(),F=C=>(v(),p.set(!1),C);return h(Me(C=>{b(n(C),p.sub(g=>{g||C()}),r(d.onCaptured))},d),We(F,F))}))),this.open=_(this.openFp),this.capture=_(this.captureFp),this.close=_(this.closeFp)}}function Ha(){return new ps({...h(E(),K,q),onClosed(t){return Z("scan_qr_popup_closed",t)},onTextReceived(t){return Z("qr_text_received",e=>{t(e.data)})}})}const xa=Ha();class hs{constructor({}){s(this,"isRefreshing");s(this,"finishRefreshFp");s(this,"finishRefresh");s(this,"onRefreshRequest");const e=D(!1);Z("refresh_requested",()=>{e.set(!0)}),this.isRefreshing=S(e),this.finishRefreshFp=()=>h(Ue(Ve("web_app_finish_refresh")),A(()=>{e.set(!1)})),this.finishRefresh=()=>this.finishRefreshFp()().then(r=>{if(r._tag==="Left")throw r.left;return r.right}),this.onRefreshRequest=n=>Z("refresh_requested",()=>{n()})}}function za(){return new hs(h(E()))}const Ka=za();class fs{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 dt({...n,initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Cancel",position:"left"},method:"web_app_setup_secondary_button",payload:o=>({has_shine_effect:o.hasShineEffect,is_visible:o.isVisible,is_active:o.isEnabled,is_progress_visible:o.isLoaderVisible,text:o.text,color:o.bgColor,text_color:o.textColor,position:o.position})}),i=(o,a)=>{const u=r.stateGetter(o);return S(()=>u()||ee(a))};this.isSupported=oe("web_app_setup_secondary_button",n.version),this.bgColor=i("bgColor",e.bgColor),this.textColor=i("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 Ja(){return new fs(ss("secondaryButton","secondary_button_pressed",{bgColor:S(()=>os.bottomBarColorRgb()||"#000000"),textColor:S(()=>Ze.buttonColor()||"#2481cc")}))}const Qa=Ja();class ds{constructor({isTma:e,request:n,version:r,createRequestId:i}){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 o=B({version:r,requires:"web_app_secure_storage_get_key",isTma:e,returns:"task"}),a=(u,l,p)=>{const f=i();return h(n(u,["secure_storage_failed",l],{params:{...p,req_id:f},capture:(d=>"payload"in d?d.payload.req_id===f:!0)}),te(d=>d.event==="secure_storage_failed"?U(new Ir(d.payload.error||"UNKNOWN_ERROR")):V(d.payload)))};this.getItemFp=o(u=>h(a("web_app_secure_storage_get_key","secure_storage_key_received",{key:u}),A(l=>({value:l.value,canRestore:!!l.can_restore})))),this.setItemFp=o((u,l)=>h(a("web_app_secure_storage_save_key","secure_storage_key_saved",{key:u,value:l}),A(()=>{}))),this.deleteItemFp=o(u=>this.setItemFp(u,null)),this.clearFp=o(()=>h(a("web_app_secure_storage_clear","secure_storage_cleared",{}),A(()=>{}))),this.restoreItemFp=o(u=>h(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 Za(){return new ds(h(E(),q,Y,Nr))}const Ya=Za();class _s{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 dt({...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 Xa=new _s(an("settingsButton","settings_button_pressed"));class ms{constructor({postEvent:e,storage:n,isTma:r,isPageReload:i,version:o}){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 me({initialState:a,onChange(v){n.set(v)}}),l=new Ge({initialState:a,isPageReload:i,onMounted:u.setState,restoreState:n.get}),p={requires:"web_app_setup_swipe_behavior",isTma:r,version:o},f=B({...p,returns:"plain"}),d=B({...p,isMounted:l.isMounted,returns:"either"}),b=v=>{const F={isVerticalEnabled:v};return u.hasDiff(F)?h(e("web_app_setup_swipe_behavior",{allow_vertical_swipe:v}),z(()=>{u.setState(F)})):k(void 0)};this.isSupported=oe("web_app_setup_swipe_behavior",o),this.isVerticalEnabled=u.getter("isVerticalEnabled"),this.isMounted=l.isMounted,this.disableVerticalFp=d(()=>b(!1)),this.enableVerticalFp=d(()=>b(!0)),this.mountFp=f(()=>{const v=()=>{};return h(l.mount(),ae(v,v))}),this.unmount=l.unmount,this.disableVertical=_(this.disableVerticalFp),this.enableVertical=_(this.enableVerticalFp),this.mount=_(this.mountFp)}}function eu(){return new ms(h(E(),K,q,we("swipeBehavior")))}const tu=eu();async function nu(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 ru({request:t,...e}){return R((n,r,i)=>h(t("web_app_request_file_download","file_download_requested",{...i,params:{url:n,file_name:r}}),te(o=>o.status==="downloading"?V(void 0):U(new sn("User denied the action")))),{...e,requires:"web_app_request_file_download",returns:"task"})}function su(){return ru(h(E(),Y,q))}const bs=su(),iu=_(bs);function ou({invokeCustomMethod:t,...e}){return R(n=>h(t("getCurrentTime",{},n),te(r=>{const i=Wt(ie(be(),Pt(),le(o=>new Date(o*1e3)),rt()),r);return i.success?V(i.output):U(new Je(r,i.issues))})),{...e,requires:"web_app_invoke_custom_method",returns:"task"})}function au(){return ou(h(E(),hn,q))}const gs=au(),uu=_(gs);function cu({postEvent:t,...e}){return R(()=>t("web_app_hide_keyboard"),{...e,returns:"either",requires:"web_app_hide_keyboard"})}function lu(){return cu(h(E(),K,q))}const vs=lu(),pu=_(vs);function hu({request:t,createRequestId:e,...n}){return R(r=>{const i=e();return h(t("web_app_read_text_from_clipboard","clipboard_text_received",{...r,params:{req_id:i},capture:yr(i)}),A(({data:o=null})=>o))},{...n,requires:"web_app_read_text_from_clipboard",returns:"task"})}function fu(){return hu({...h(E(),q,Y),createRequestId:_t})}const ws=fu(),du=_(ws);function ys(t){const e={},n=t.match(/Telegram-Android(?:\/([^ ]+))?(?: (\([^)]+\))?|$)/);if(n){const[,r,i]=n;r&&(e.appVersion=r),i&&i.slice(1,i.length-1).split(";").forEach(o=>{const[a,u]=o.trim().split(" ");if(a==="Android")e.androidVersion=u;else if(a==="SDK"){const l=parseInt(u,10);l&&(e.sdkVersion=l)}else u?(e.manufacturer=a,e.model=u):e.performanceClass=a})}return e}function _u(){return ys(navigator.userAgent)}function mu({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 bu(){return mu(h(E(),K))}const Fs=bu(),gu=_(Fs);function vu({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(i=>i.event==="prepared_message_failed"?U(new Mr(i.payload.error)):V(void 0))),{...e,requires:"web_app_send_prepared_message",returns:"task"})}function wu(){return vu(h(E(),Y,q))}const Ss=wu(),yu=_(Ss);function Fu({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 Su(){return Fu(h(E(),K,q))}const Cs=Su(),Cu=_(Cs),wn=Qe(!1);function ku({isInlineMode:t,postEvent:e,...n}){return R((r,i)=>e("web_app_switch_inline_query",{query:r,chat_types:i||[]}),{...n,requires:{every:["web_app_switch_inline_query",()=>ee(t)?void 0:"The application must be launched in the inline mode"]},returns:"either"})}function Eu(){return ku({...h(E(),K,q),isInlineMode:wn})}const ks=Eu(),Iu=_(ks);class Es{constructor({storage:e,isPageReload:n,onContentSafeAreaInsetsChanged:r,onSafeAreaInsetsChanged:i,onViewportChanged:o,onFullscreenChanged:a,offContentSafeAreaInsetsChanged:u,offFullscreenChanged:l,offSafeAreaInsetsChanged:p,offViewportChanged:f,request:d,isViewportStable:b,isFullscreen:v,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 w={top:0,right:0,left:0,bottom:0},m=new me({initialState:{contentSafeAreaInsets:w,height:0,isExpanded:!1,isFullscreen:!1,safeAreaInsets:w,stableHeight:0,width:0},onChange:e.set}),O=T=>{m.setState({isExpanded:T.is_expanded,height:T.height,width:T.width,stableHeight:T.is_state_stable?T.height:void 0})},j=T=>{m.setState({isFullscreen:T.is_fullscreen})},W=T=>{m.setState({safeAreaInsets:T})},I=T=>{m.setState({contentSafeAreaInsets:T})},L=new un({initialState(T){const Ie=de=>()=>{const[ye,se]=de==="safe-area"?["web_app_request_safe_area","safe_area_changed"]:["web_app_request_content_safe_area","content_safe_area_changed"];return fe(ye,ee(C))?d(ye,se,T):V({top:0,left:0,right:0,bottom:0})},H=de=>()=>typeof de=="boolean"?V(de):Ue(de());return h(Bi,tt("safeAreaInsets",Ie("safe-area")),tt("contentSafeAreaInsets",Ie("content-safe-area")),tt("isFullscreen",H(v)),tt("isViewportStable",H(b)),ue(({isViewportStable:de,...ye})=>de?V({...ye,height:window.innerHeight,isExpanded:!0,stableHeight:window.innerHeight,width:window.innerWidth}):h(d("web_app_request_viewport","viewport_changed",T),A(se=>({...ye,height:se.height,isExpanded:se.is_expanded,stableHeight:se.is_state_stable?se.height:0,width:se.width})))))},isPageReload:n,onMounted(T){o(O),a(j),i(W),r(I),m.setState(T)},onUnmounted(){f(O),l(j),p(W),u(I)},restoreState:e.get}),P=T=>S(()=>this.safeAreaInsets()[T]),N=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=P("top"),this.safeAreaInsetBottom=P("bottom"),this.safeAreaInsetLeft=P("left"),this.safeAreaInsetRight=P("right"),this.contentSafeAreaInsets=m.getter("contentSafeAreaInsets"),this.contentSafeAreaInsetTop=N("top"),this.contentSafeAreaInsetBottom=N("bottom"),this.contentSafeAreaInsetLeft=N("left"),this.contentSafeAreaInsetRight=N("right");const Le=B({isTma:F,returns:"task"}),Ye=B({isTma:F,returns:"either"}),Pu=B({isTma:F,requires:"web_app_request_fullscreen",version:C,returns:"task"}),$s=T=>Pu(Ie=>h(d(T?"web_app_request_fullscreen":"web_app_exit_fullscreen",["fullscreen_changed","fullscreen_failed"],Ie),te(H=>H.event==="fullscreen_failed"&&H.payload.error!=="ALREADY_FULLSCREEN"?U(new Br(H.payload.error)):(m.setState({isFullscreen:"is_fullscreen"in H.payload?H.payload.is_fullscreen:!0}),V(void 0)))));this.isMounted=L.isMounted,this.mountFp=Le(L.mount),this.mount=_(this.mountFp),this.isFullscreen=m.getter("isFullscreen"),this.requestFullscreenFp=$s(!0),this.requestFullscreen=_(this.requestFullscreenFp),this.exitFullscreenFp=$s(!1),this.exitFullscreen=_(this.exitFullscreenFp);const mt=D(!1);this.isCssVarsBound=S(mt),this.bindCssVarsFp=Ye(T=>{if(mt())return M(new ht);T||(T=H=>`--vb-viewport-${jn(H)}`);const Ie=[["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((H,[de,ye])=>{const se=T(de);if(se){const qs=()=>{dn(se,`${ye()}px`)};H.push({update:qs,removeListener:ye.sub(qs),cssVar:se})}return H},[]);return Ie.forEach(H=>{H.update()}),mt.set(!0),k(()=>{Ie.forEach(H=>{H.removeListener(),_n(H.cssVar)}),mt.set(!1)})}),this.bindCssVars=_(this.bindCssVarsFp),this.expandFp=Ye(()=>g("web_app_expand")),this.expand=_(this.expandFp)}}function Au(){const t=o=>({on:a=>{Z(o,a)},off:a=>{Ce(o,a)}}),e=t("viewport_changed"),n=t("fullscreen_changed"),r=t("safe_area_changed"),i=t("content_safe_area_changed");return new Es({...h(E(),we("viewport"),q,K,Y),isFullscreen(){return h(Te(),z(o=>!!o.vbWebAppFullscreen))},isViewportStable(){return h(Te(),z(o=>["macos","tdesktop","unigram","webk","weba","web"].includes(o.vbWebAppPlatform)))},offContentSafeAreaInsetsChanged:i.off,offFullscreenChanged:n.off,offSafeAreaInsetsChanged:r.off,offViewportChanged:e.off,onContentSafeAreaInsetsChanged:i.on,onFullscreenChanged:n.on,onSafeAreaInsetsChanged:r.on,onViewportChanged:e.on})}const $u=Au();class Is{constructor({request:e}){s(this,"requestAccessFp");s(this,"requestAccess");s(this,"selectFile");s(this,"selectFiles");s(this,"selectFolder");this.requestAccessFp=n=>h(e("web_app_request_storage_access","storage_access_granted",{params:{access_type:n.accessType,multiple:n.multiple,accept:n.accept,max_file_size:n.maxFileSize,read_content:n.readContent}}),A(r=>({accessType:r.access_type,items:r.items.map(i=>({name:i.name,path:i.path,size:i.size,type:i.type,content:i.content,lastModified:i.last_modified}))}))),this.requestAccess=n=>this.requestAccessFp(n)().then(i=>{if(i._tag==="Left")throw i.left;return i.right}),this.selectFile=n=>this.requestAccess({accessType:"file",multiple:!1,...n}),this.selectFiles=n=>this.requestAccess({accessType:"file",multiple:!0,...n}),this.selectFolder=()=>this.requestAccess({accessType:"folder"})}}function qu(){return new Is({request:pt})}const Bu=qu();class Mu{static onSend(e){return Pe().on("web_app_send_notification",r=>{r&&e(r)})}}class Tu{static setTheme(e){Pe().send("theme_changed",{theme_params:e})}static onBackgroundColorChange(e){return Pe().on("web_app_set_background_color",r=>{r&&typeof r.color=="string"&&e(r.color)})}static onHeaderColorChange(e){return Pe().on("web_app_set_header_color",r=>{r&&("color_key"in r&&r.color_key?e(r.color_key):"color"in r&&r.color&&e(r.color))})}static onBottomBarColorChange(e){return Pe().on("web_app_set_bottom_bar_color",r=>{r&&r.color&&e(r.color)})}}function As(t={}){const{version:e,isInlineMode:n,themeParams:r}=t;if(e&&typeof n=="boolean"&&r)on.set(e),wn.set(n),bn.set(r);else{const u=h(Te(),St(l=>l,l=>{on.set(e||l.vbWebAppVersion),wn.set(typeof n=="boolean"?n:!!l.vbWebAppBotInline),bn.set(r||l.vbWebAppThemeParams)}));if(u)return M(u)}t.postEvent&&Pr.set(t.postEvent);const[i,o]=Ne(Z("reload_iframe",()=>{he().log("Received a request to reload the page"),Rr("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),i(Z("set_custom_style",l=>{u.innerHTML=l}),()=>{document.head.removeChild(u)})}return h(Ee("iframe_ready",{reload_supported:!0}),z(()=>(he().log("The package was initialized"),o)))}const Vu=ne(As);return c.AccessDeniedError=sn,c.BackButton=Vr,c.Biometry=Or,c.CSSVarsBoundError=ht,c.CancelledError=Ln,c.ClosingBehavior=Dr,c.CloudStorage=Ur,c.ConcurrentCallError=ft,c.DeviceStorage=Gr,c.DeviceStorageMethodError=Er,c.FullscreenFailedError=Br,c.FunctionUnavailableError=$r,c.HapticFeedback=zr,c.HostNotification=Mu,c.HostThemeParams=Tu,c.InitData=Qr,c.InvalidArgumentsError=re,c.InvalidEnvError=To,c.InvalidLaunchParamsError=cr,c.Invoice=Zr,c.InvokeCustomMethodFailedError=lr,c.LaunchParamsRetrieveError=ur,c.LocationManager=es,c.MainButton=ts,c.MethodParameterUnsupportedError=ar,c.MethodUnsupportedError=or,c.MiniApp=is,c.NotAvailableError=Ar,c.Notification=as,c.Popup=us,c.QrScanner=ps,c.Refresh=hs,c.SecondaryButton=fs,c.SecureStorage=ds,c.SecureStorageMethodError=Ir,c.SetEmojiStatusError=qr,c.SettingsButton=_s,c.ShareMessageError=Mr,c.StoragePermission=Is,c.SwipeBehavior=ms,c.ThemeParams=rs,c.TimeoutError=Nt,c.UnknownEnvError=Qt,c.UnknownThemeParamsKeyError=Tr,c.ValidationError=Je,c.Viewport=Es,c.addToHomeScreen=sa,c.addToHomeScreenFp=Kr,c.applyPolyfills=Ao,c.backButton=Lo,c.biometry=Uo,c.checkHomeScreenStatus=aa,c.checkHomeScreenStatusFp=Jr,c.closingBehavior=Go,c.cloudStorage=Ho,c.copyTextToClipboard=nu,c.createLogger=Wn,c.createPostEvent=ko,c.createRequestId=_t,c.createStartParam=qo,c.createStartParamFp=Cr,c.debug=_r,c.decodeBase64Url=$o,c.decodeBase64UrlFp=nn,c.decodeStartParam=Bo,c.decodeStartParamFp=kr,c.deepSnakeToCamelObjKeys=Ht,c.defineHostBridge=So,c.deviceStorage=zo,c.downloadFile=iu,c.downloadFileFp=bs,c.emitEvent=ct,c.encodeBase64Url=rn,c.getCurrentTime=uu,c.getCurrentTimeFp=gs,c.getHostBridge=Pe,c.getReleaseVersion=tn,c.hapticFeedback=ta,c.hideKeyboard=pu,c.hideKeyboardFp=vs,c.init=Vu,c.initData=ca,c.initFp=As,c.invoice=pa,c.invokeCustomMethod=Wr,c.isAnyRGB=zn,c.isColorDark=mn,c.isColorDarkFp=ns,c.isRGB=xe,c.isRGBA=xn,c.isRGBAShort=Hn,c.isRGBShort=Nn,c.isSafeToCreateStartParam=Mo,c.isVBMA=yo,c.isVBMAFp=en,c.locationManager=Sa,c.logger=he,c.mainButton=ka,c.miniApp=os,c.mockVBotEnv=Fo,c.notification=$a,c.off=Ce,c.offAll=go,c.on=Z,c.openLink=da,c.openLinkFp=Yr,c.openVBotLink=ba,c.openVBotLinkFp=fn,c.parseInitDataQuery=ao,c.parseInitDataQueryFp=Xn,c.parseLaunchParamsQuery=er,c.parseLaunchParamsQueryFp=ut,c.popup=Ma,c.postEvent=Rr,c.postEventFp=Ee,c.qrScanner=xa,c.readTextFromClipboard=du,c.readTextFromClipboardFp=ws,c.refresh=Ka,c.request=Oo,c.request2=jo,c.request2Fp=ln,c.requestContact=Ua,c.requestContactComplete=Da,c.requestContactCompleteFp=vn,c.requestContactFp=cs,c.requestEmojiStatusAccess=Qo,c.requestEmojiStatusAccessFp=Hr,c.requestFp=jr,c.requestPhoneAccess=Pa,c.requestPhoneAccessFp=gn,c.requestWriteAccess=Na,c.requestWriteAccessFp=ls,c.retrieveAndroidDeviceData=_u,c.retrieveAndroidDeviceDataFrom=ys,c.retrieveLaunchParams=co,c.retrieveLaunchParamsFp=Te,c.retrieveRawInitData=lo,c.retrieveRawInitDataFp=Zt,c.retrieveRawLaunchParams=po,c.retrieveRawLaunchParamsFp=ze,c.secondaryButton=Qa,c.secureStorage=Ya,c.sendData=gu,c.sendDataFp=Fs,c.serializeInitDataQuery=nr,c.serializeLaunchParamsQuery=rr,c.setDebug=fo,c.setEmojiStatus=Xo,c.setEmojiStatusFp=xr,c.setTargetOrigin=_o,c.settingsButton=Xa,c.shareMessage=yu,c.shareMessageFp=Ss,c.shareStory=Cu,c.shareStoryFp=Cs,c.shareURL=wa,c.shareURLFp=Xr,c.storagePermission=Bu,c.supports=fe,c.swipeBehavior=tu,c.switchInlineQuery=Iu,c.switchInlineQueryFp=ks,c.targetOrigin=mr,c.themeParams=Ze,c.toRGB=eo,c.toRGBFp=Jn,c.toRGBFull=to,c.toRGBFullFp=at,c.viewport=$u,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}),c})({});
|
|
4
4
|
//# sourceMappingURL=index.iife.js.map
|