@tma.js/bridge 2.1.0 → 2.1.1
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/README.md +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +261 -261
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.iife.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
this.tapps=this.tapps||{};this.tapps.bridge=function(f){"use strict";var P;function We(e){return{lang:(e==null?void 0:e.lang)??(P==null?void 0:P.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(P==null?void 0:P.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(P==null?void 0:P.abortPipeEarly)}}var ue;function un(e){return ue==null?void 0:ue.get(e)}var ae;function an(e){return ae==null?void 0:ae.get(e)}var ie;function sn(e,t){var n;return(n=ie==null?void 0:ie.get(e))==null?void 0:n.get(t)}function on(e){var n,r;const t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(e&&((r=(n=Object.getPrototypeOf(e))==null?void 0:n.constructor)==null?void 0:r.name))??"null":t}function y(e,t,n,r,a){const u=a&&"input"in a?a.input:n.value,s=(a==null?void 0:a.expected)??e.expects??null,o=(a==null?void 0:a.received)??on(u),c={kind:e.kind,type:e.type,input:u,expected:s,received:o,message:`Invalid ${t}: ${s?`Expected ${s} but r`:"R"}eceived ${o}`,requirement:e.requirement,path:a==null?void 0:a.path,issues:a==null?void 0:a.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},i=e.kind==="schema",l=(a==null?void 0:a.message)??e.message??sn(e.reference,c.lang)??(i?an(c.lang):null)??r.message??un(c.lang);l!==void 0&&(c.message=typeof l=="function"?l(c):l),i&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function v(e){return{version:1,vendor:"valibot",validate(t){return e["~run"]({value:t},We())}}}function qe(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function cn(e,t){const n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??"never"}var ln=class extends Error{constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function K(e,t){return{kind:"validation",type:"check",reference:K,async:!1,expects:null,requirement:e,message:t,"~run"(n,r){return n.typed&&!this.requirement(n.value)&&y(this,"input",n,r),n}}}function Ue(e){return{kind:"validation",type:"integer",reference:Ue,async:!1,expects:null,requirement:Number.isInteger,message:e,"~run"(t,n){return t.typed&&!this.requirement(t.value)&&y(this,"integer",t,n),t}}}function L(e){return{kind:"transformation",type:"transform",reference:L,async:!1,operation:e,"~run"(t){return t.value=this.operation(t.value),t}}}function fn(e,t,n){return typeof e.fallback=="function"?e.fallback(t,n):e.fallback}function se(e,t,n){return typeof e.default=="function"?e.default(t,n):e.default}function oe(e,t){return!e["~run"]({value:t},{abortEarly:!0}).issues}function De(){return{kind:"schema",type:"any",reference:De,expects:"any",async:!1,get"~standard"(){return v(this)},"~run"(e){return e.typed=!0,e}}}function M(e){return{kind:"schema",type:"boolean",reference:M,expects:"boolean",async:!1,message:e,get"~standard"(){return v(this)},"~run"(t,n){return typeof t.value=="boolean"?t.typed=!0:y(this,"type",t,n),t}}}function xe(e){return{kind:"schema",type:"date",reference:xe,expects:"Date",async:!1,message:e,get"~standard"(){return v(this)},"~run"(t,n){return t.value instanceof Date?isNaN(t.value)?y(this,"type",t,n,{received:'"Invalid Date"'}):t.typed=!0:y(this,"type",t,n),t}}}function ce(e){return{kind:"schema",type:"function",reference:ce,expects:"Function",async:!1,message:e,get"~standard"(){return v(this)},"~run"(t,n){return typeof t.value=="function"?t.typed=!0:y(this,"type",t,n),t}}}function le(e,t){return{kind:"schema",type:"instance",reference:le,expects:e.name,async:!1,class:e,message:t,get"~standard"(){return v(this)},"~run"(n,r){return n.value instanceof this.class?n.typed=!0:y(this,"type",n,r),n}}}function g(e,t){return{kind:"schema",type:"loose_object",reference:g,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return v(this)},"~run"(n,r){var u;const a=n.value;if(a&&typeof a=="object"){n.typed=!0,n.value={};for(const s in this.entries){const o=this.entries[s];if(s in a||(o.type==="exact_optional"||o.type==="optional"||o.type==="nullish")&&o.default!==void 0){const c=s in a?a[s]:se(o),i=o["~run"]({value:c},r);if(i.issues){const l={type:"object",origin:"value",input:a,key:s,value:c};for(const p of i.issues)p.path?p.path.unshift(l):p.path=[l],(u=n.issues)==null||u.push(p);if(n.issues||(n.issues=i.issues),r.abortEarly){n.typed=!1;break}}i.typed||(n.typed=!1),n.value[s]=i.value}else if(o.fallback!==void 0)n.value[s]=fn(o);else if(o.type!=="exact_optional"&&o.type!=="optional"&&o.type!=="nullish"&&(y(this,"key",n,r,{input:void 0,expected:`"${s}"`,path:[{type:"object",origin:"key",input:a,key:s,value:a[s]}]}),r.abortEarly))break}if(!n.issues||!r.abortEarly)for(const s in a)qe(a,s)&&!(s in this.entries)&&(n.value[s]=a[s])}else y(this,"type",n,r);return n}}}function F(e,t){return{kind:"schema",type:"nullish",reference:F,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return v(this)},"~run"(n,r){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=se(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function W(e){return{kind:"schema",type:"number",reference:W,expects:"number",async:!1,message:e,get"~standard"(){return v(this)},"~run"(t,n){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:y(this,"type",t,n),t}}}function d(e,t){return{kind:"schema",type:"optional",reference:d,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return v(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=se(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function Ne(e,t,n){return{kind:"schema",type:"record",reference:Ne,expects:"Object",async:!1,key:e,value:t,message:n,get"~standard"(){return v(this)},"~run"(r,a){var s,o;const u=r.value;if(u&&typeof u=="object"){r.typed=!0,r.value={};for(const c in u)if(qe(u,c)){const i=u[c],l=this.key["~run"]({value:c},a);if(l.issues){const m={type:"object",origin:"key",input:u,key:c,value:i};for(const b of l.issues)b.path=[m],(s=r.issues)==null||s.push(b);if(r.issues||(r.issues=l.issues),a.abortEarly){r.typed=!1;break}}const p=this.value["~run"]({value:i},a);if(p.issues){const m={type:"object",origin:"value",input:u,key:c,value:i};for(const b of p.issues)b.path?b.path.unshift(m):b.path=[m],(o=r.issues)==null||o.push(b);if(r.issues||(r.issues=p.issues),a.abortEarly){r.typed=!1;break}}(!l.typed||!p.typed)&&(r.typed=!1),l.typed&&(r.value[l.value]=p.value)}}else y(this,"type",r,a);return r}}}function h(e){return{kind:"schema",type:"string",reference:h,expects:"string",async:!1,message:e,get"~standard"(){return v(this)},"~run"(t,n){return typeof t.value=="string"?t.typed=!0:y(this,"type",t,n),t}}}function Ge(e){let t;if(e)for(const n of e)t?t.push(...n.issues):t=n.issues;return t}function H(e,t){return{kind:"schema",type:"union",reference:H,expects:cn(e.map(n=>n.expects),"|"),async:!1,options:e,message:t,get"~standard"(){return v(this)},"~run"(n,r){let a,u,s;for(const o of this.options){const c=o["~run"]({value:n.value},r);if(c.typed)if(c.issues)u?u.push(c):u=[c];else{a=c;break}else s?s.push(c):s=[c]}if(a)return a;if(u){if(u.length===1)return u[0];y(this,"type",n,r,{issues:Ge(u)}),n.typed=!0}else{if((s==null?void 0:s.length)===1)return s[0];y(this,"type",n,r,{issues:Ge(s)})}return n}}}function fe(){return{kind:"schema",type:"unknown",reference:fe,expects:"unknown",async:!1,get"~standard"(){return v(this)},"~run"(e){return e.typed=!0,e}}}function q(e,t,n){const r=e["~run"]({value:t},We(n));if(r.issues)throw new ln(r.issues);return r.value}function S(...e){return{...e[0],pipe:e,get"~standard"(){return v(this)},"~run"(t,n){for(const r of e)if(r.kind!=="metadata"){if(t.issues&&(r.kind==="schema"||r.kind==="transformation")){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r["~run"](t,n))}return t}}}function pe(e){return oe(g({TelegramWebviewProxy:g({postEvent:ce()})}),e)}function he(){try{return window.self!==window.top}catch{return!0}}var pn=Object.defineProperty,hn=(e,t,n)=>t in e?pn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ve=(e,t,n)=>hn(e,typeof t!="symbol"?t+"":t,n),dn=Object.defineProperty,mn=(e,t,n)=>t in e?dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,de=(e,t,n)=>mn(e,typeof t!="symbol"?t+"":t,n);function Je(e){return t=>t instanceof e}function ze(e,t){const n=class extends Error{constructor(...a){const u=typeof t=="function"?t(...a):typeof t=="string"?[t]:t||[];super(...u),this.name=e}};de(n,"is",Je(n));let r=n;return Object.defineProperty(r,"name",{value:e}),r}function _n(e,t,n){const r=class extends ze(e,n){constructor(...u){super(...u),de(this,"data"),this.data=t(...u)}};de(r,"is",Je(r));let a=r;return Object.defineProperty(a,"name",{value:e}),a}let Be=class extends ze("CancelledError","Promise was canceled"){},me=class extends _n("TimeoutError",t=>({timeout:t}),(t,n)=>[`Timeout reached: ${t}ms`,{cause:n}]){};const gn=Symbol("resolved");function yn(e){return{tag:gn,value:e}}function Ke(e,t){return e.reject=t.reject,e.resolve=t.resolve,e}let Q=class Fe extends Promise{constructor(t,n){let r,a,u,s;typeof t=="function"?(u=t,s=n||{}):s=t||{};let o,c;const i=()=>!!c,l=()=>!!o;let p={};const m=[],b=()=>{m.forEach(Ie=>Ie()),m.splice(0,m.length),p={}},T=new AbortController,nn=()=>l()||i();super((Ie,gu)=>{const{abortOnResolve:yu=!0,abortOnReject:vu=!0}=s;a=_=>{var R,w;nn()||(Ie(_),o=[_],(R=p.resolved)==null||R.forEach($=>$(_)),(w=p.finalized)==null||w.forEach($=>$({kind:"resolved",result:_})),b(),yu&&T.abort(yn(_)))},r=_=>{var R,w;nn()||(gu(_),c=[_],(R=p.rejected)==null||R.forEach($=>$(_)),(w=p.finalized)==null||w.forEach($=>$({kind:"rejected",reason:_})),b(),vu&&T.abort(_))};const{abortSignal:N}=s;if(N){if(N.aborted)return r(N.reason);const _=()=>{r(N.reason)};N.addEventListener("abort",_,!0),m.push(()=>{N.removeEventListener("abort",_,!0)})}const{timeout:Ce}=s;if(Ce){const _=setTimeout(()=>{r(new me(Ce))},Ce);m.push(()=>{clearTimeout(_)})}try{const _=()=>{},R=u&&u(a,r,{abortSignal:T.signal,get isRejected(){return i()},get isResolved(){return l()},on(w,$){if(o||c){if(w==="finalized"){const re=o?{kind:"resolved",result:o[0]}:{kind:"rejected",reason:c[0]};$(re)}else w==="resolved"&&o?$(o[0]):w==="rejected"&&c&&$(c[0]);return _}return p[w]||(p[w]=[]),p[w].push($),()=>{const re=p[w]||[],rn=re.indexOf($);rn>=0&&re.splice(rn,1)}},get result(){return o==null?void 0:o[0]},get rejectReason(){return c==null?void 0:c[0]},throwIfRejected(){if(c)throw c[0]}});R instanceof Promise&&R.catch(r)}catch(_){r(_)}}),Ve(this,"reject"),Ve(this,"resolve"),this.reject=r,this.resolve=a}static fn(t,n){return new Fe(async(r,a,u)=>{try{r(await t(u))}catch(s){a(s)}},n)}static resolve(t){return this.fn(()=>t)}static reject(t){return new Fe((n,r)=>{r(t)})}cancel(){this.reject(new Be)}catch(t){return this.then(void 0,t)}finally(t){return Ke(super.finally(t),this)}then(t,n){return Ke(super.then(t,n),this)}};function vn(e){return e.replace(/_[a-z]/g,t=>t[1].toUpperCase())}function bn(e){return Object.entries(e).reduce((t,[n,r])=>(t[vn(n)]=r,t),{})}function _e(e){const t=bn(e);for(const n in t){const r=t[n];r&&typeof r=="object"&&!(r instanceof Date)&&(t[n]=Array.isArray(r)?r.map(_e):_e(r))}return t}function He(e){return`tapps/${e}`}function Qe(e,t){sessionStorage.setItem(He(e),JSON.stringify(t))}function wn(e){const t=sessionStorage.getItem(He(e));try{return t?JSON.parse(t):void 0}catch{}}function $n(...e){const t=e.flat(1);return[t.push.bind(t),()=>{t.forEach(n=>{n()})}]}function Ye(e,t){t||(t={});const{textColor:n,bgColor:r,shouldLog:a}=t,u=a===void 0?!0:a,s=typeof u=="boolean"?()=>u:u,o=(c,i,...l)=>{if(i||s()){const p="font-weight:bold;padding:0 5px;border-radius:100px",[m,b,T]={log:["#0089c3","white","INFO"],error:["#ff0000F0","white","ERR"],warn:["#D38E15","white","WARN"]}[c];console[c](`%c${T} ${Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(new Date)}%c %c${e}`,`${p};background-color:${m};color:${b}`,"",`${p};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...l)}};return[["log","forceLog"],["warn","forceWarn"],["error","forceError"]].reduce((c,[i,l])=>(c[i]=o.bind(void 0,i,!1),c[l]=o.bind(void 0,i,!0),c),{})}var En=function(e,t,n){if(arguments.length===2)for(var r=0,a=t.length,u;r<a;r++)(u||!(r in t))&&(u||(u=Array.prototype.slice.call(t,0,r)),u[r]=t[r]);return e.concat(u||Array.prototype.slice.call(t))};function Ze(e,t,n,r,a,u,s,o,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return a(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return u(a(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return s(u(a(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return o(s(u(a(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(o(s(u(a(r(n(t(e.apply(this,arguments)))))))))}}}function U(e,t,n,r,a,u,s,o,c){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return a(r(n(t(e))));case 6:return u(a(r(n(t(e)))));case 7:return s(u(a(r(n(t(e))))));case 8:return o(s(u(a(r(n(t(e)))))));case 9:return c(o(s(u(a(r(n(t(e))))))));default:{for(var i=arguments[0],l=1;l<arguments.length;l++)i=arguments[l](i);return i}}}var Xe=function(e,t){var n=function(r){return r.length>=e};return function(){var r=Array.from(arguments);return n(arguments)?t.apply(this,r):function(a){return t.apply(void 0,En([a],r,!1))}}},kn=function(e){return e._tag==="Left"},et=function(e){return{_tag:"Left",left:e}},tt=function(e){return{_tag:"Right",right:e}},nt=et,rt=tt,ut=kn,Pn=function(e,t){return function(n){return ut(n)?e(n.left):t(n.right)}},ge=Pn;function Sn(e){return Ze(rt,e.of)}function jn(e){return Ze(nt,e.of)}function An(e){return function(t,n){return e.chain(t,function(r){return ut(r)?e.of(r):n(r.right)})}}function On(e){return function(t,n){return function(r){return e.map(r,ge(t,n))}}}var at=function(e,t){return U(e,Rn(t))},Tn=function(e,t){return U(e,Ln(t))},Rn=function(e){return function(t){return function(){return Promise.resolve().then(t).then(e)}}},Ln=function(e){return function(t){return function(){return Promise.all([Promise.resolve().then(t),Promise.resolve().then(e)]).then(function(n){var r=n[0],a=n[1];return r(a)})}}},ye=function(e){return function(){return Promise.resolve(e)}},Mn=Xe(2,function(e,t){return function(){return Promise.resolve().then(e).then(function(n){return t(n)()})}}),it="Task",In={URI:it,map:at},st={of:ye},Cn={URI:it,map:at,of:ye,ap:Tn,chain:Mn},Fn=function(e,t,n,r){function a(u){return u instanceof n?u:new n(function(s){s(u)})}return new(n||(n=Promise))(function(u,s){function o(l){try{i(r.next(l))}catch(p){s(p)}}function c(l){try{i(r.throw(l))}catch(p){s(p)}}function i(l){l.done?u(l.value):a(l.value).then(o,c)}i((r=r.apply(e,[])).next())})},Wn=function(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},r,a,u,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(i){return function(l){return c([i,l])}}function c(i){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,i[0]&&(n=0)),n;)try{if(r=1,a&&(u=i[0]&2?a.return:i[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,i[1])).done)return u;switch(a=0,u&&(i=[i[0]&2,u.value]),i[0]){case 0:case 1:u=i;break;case 4:return n.label++,{value:i[1],done:!1};case 5:n.label++,a=i[1],i=[0];continue;case 7:i=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(i[0]===6||i[0]===2)){n=0;continue}if(i[0]===3&&(!u||i[1]>u[0]&&i[1]<u[3])){n.label=i[1];break}if(i[0]===6&&n.label<u[1]){n.label=u[1],u=i;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(i);break}u[2]&&n.ops.pop(),n.trys.pop();continue}i=t.call(e,n)}catch(l){i=[6,l],a=0}finally{r=u=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}},qn=jn(st),Un=Sn(st),Dn=ye,ot=On(In),xn=ot,Nn=function(e,t){return function(){return Fn(void 0,void 0,void 0,function(){var n;return Wn(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e().then(tt)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,et(t(n))];case 3:return[2]}})})}},Gn=Xe(2,An(Cn)),Vn=Gn;function Y(e){const t=n=>{throw n};return typeof e=="function"?Q.resolve(U(e,ot(t,n=>n))()):U(e,ge(t,n=>n))}function j(e){return Object.assign((...t)=>Y(e(...t)),e)}const ct=Object.assign((e,t)=>U(Nn(()=>new Q((n,r,a)=>e(u=>n(rt(u)),u=>n(nt(u)),a),t),n=>n),Vn(ge(qn,Un))),{fn:(e,t)=>ct((n,r,a)=>{const u=e(a);U(typeof u=="function"?u:Dn(u),xn(r,n))()},t)});var Jn=function(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,u;r<a;r++)(u||!(r in t))&&(u||(u=Array.prototype.slice.call(t,0,r)),u[r]=t[r]);return e.concat(u||Array.prototype.slice.call(t))};function zn(e){return e}function G(e,t,n,r,a,u,s,o,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return a(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return u(a(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return s(u(a(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return o(s(u(a(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(o(s(u(a(r(n(t(e.apply(this,arguments)))))))))}}}function k(e,t,n,r,a,u,s,o,c){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return a(r(n(t(e))));case 6:return u(a(r(n(t(e)))));case 7:return s(u(a(r(n(t(e))))));case 8:return o(s(u(a(r(n(t(e)))))));case 9:return c(o(s(u(a(r(n(t(e))))))));default:{for(var i=arguments[0],l=1;l<arguments.length;l++)i=arguments[l](i);return i}}}var ve=function(e,t){var n=typeof e=="number"?function(r){return r.length>=e}:e;return function(){var r=Array.from(arguments);return n(arguments)?t.apply(this,r):function(a){return t.apply(void 0,Jn([a],r,!1))}}},Bn={_tag:"None"},Kn=function(e){return{_tag:"Some",value:e}},Hn=function(e){return e._tag==="Left"},Qn=function(e){return{_tag:"Left",left:e}},Yn=function(e){return{_tag:"Right",right:e}},A=Qn,E=Yn,lt=ve(2,function(e,t){return V(e)?e:t(e.right)}),Zn=function(e){return function(t){return V(t)?t:E(e(t.right))}},Xn=function(e){return function(t){return V(t)?A(e(t.left)):t}},V=Hn,ft=function(e,t){return function(n){return V(n)?e(n.left):t(n.right)}},er=ft,be=ft,tr=be,we=function(e,t){try{return E(e())}catch(n){return A(t(n))}},nr=lt,rr=lt,ur=Bn,ar=Kn,ir=function(e){return e._tag==="None"},sr=function(e,t){return function(n){return ir(n)?e():t(n.value)}},or=sr;function cr(e){return G(E,e.of)}function lr(e){return G(A,e.of)}function fr(e){return function(t,n){return e.chain(t,function(r){return V(r)?e.of(r):n(r.right)})}}function pr(e){return function(t,n){return function(r){return e.map(r,be(t,n))}}}var pt=function(e,t){return k(e,dr(t))},hr=function(e,t){return k(e,mr(t))},dr=function(e){return function(t){return function(){return Promise.resolve().then(t).then(e)}}},mr=function(e){return function(t){return function(){return Promise.all([Promise.resolve().then(t),Promise.resolve().then(e)]).then(function(n){var r=n[0],a=n[1];return r(a)})}}},ht=function(e){return function(){return Promise.resolve(e)}},_r=ve(2,function(e,t){return function(){return Promise.resolve().then(e).then(function(n){return t(n)()})}}),dt="Task",gr={URI:dt,map:pt},mt={of:ht},yr={URI:dt,map:pt,of:ht,ap:hr,chain:_r},vr=lr(mt),_t=cr(mt),gt=pr(gr),yt=ve(2,fr(yr)),br=yt,wr=yt;function $r(e,t,n,r,a,u,s,o,c){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return a(r(n(t(e))));case 6:return u(a(r(n(t(e)))));case 7:return s(u(a(r(n(t(e))))));case 8:return o(s(u(a(r(n(t(e)))))));case 9:return c(o(s(u(a(r(n(t(e))))))));default:{for(var i=arguments[0],l=1;l<arguments.length;l++)i=arguments[l](i);return i}}}var Er=function(e){return e._tag==="Left"},kr=function(e){return{_tag:"Left",left:e}},Pr=function(e){return{_tag:"Right",right:e}},vt=kr,I=Pr,Sr=function(e){return function(t){return jr(t)?t:I(e(t.right))}},jr=Er,bt=function(e,t){try{return I(e())}catch(n){return vt(t(n))}};function Ar(e){const t=n=>{const r={};return new URLSearchParams(n).forEach((a,u)=>{const s=r[u];Array.isArray(s)?s.push(a):s===void 0?r[u]=a:r[u]=[s,a]}),q(e,r)};return S(H([h(),le(URLSearchParams)]),K(n=>{try{return t(n),!0}catch{return!1}},"The value doesn't match required schema"),L(t))}function Or(e){return S(h(),K(t=>{try{return JSON.parse(t),!0}catch{return!1}},"Input is not a valid JSON value"),L(JSON.parse),e)}function C(e){return S(h(),Or(e))}function wt(e){return S(H([h(),le(URLSearchParams)]),Ar(e))}function Z(e){return t=>e.test(t)}const Tr=Z(/^#[\da-f]{3}$/i),Rr=Z(/^#[\da-f]{4}$/i),Lr=Z(/^#[\da-f]{6}$/i),Mr=Z(/^#[\da-f]{8}$/i);function Ir(e){return[Lr,Mr,Tr,Rr].some(t=>t(e))}function $t(e){let t="#";for(let n=0;n<e.length-1;n+=1)t+=e[1+n].repeat(2);return t}function Et(e){const t=e.replace(/\s/g,"").toLowerCase();if(/^#[\da-f]{3}$/i.test(t))return I($t(t.toLowerCase()+"f"));if(/^#[\da-f]{4}$/i.test(t))return I($t(t.toLowerCase()));if(/^#[\da-f]{6}$/i.test(t))return I(t.toLowerCase()+"ff");if(/^#[\da-f]{8}$/i.test(t))return I(t.toLowerCase());const n=t.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||t.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(\d{1,3})\)$/);return n?I(n.slice(1).reduce((r,a)=>r+parseInt(a,10).toString(16).padStart(2,"0"),"#").padEnd(9,"f")):vt(new Error(`Value "${e}" does not satisfy any of known RGB formats.`))}function Cr(e){return $r(Et(e),Sr(t=>t.slice(0,7)))}j(Cr),j(Et);function Fr(){return g({id:W(),photo_url:d(h()),type:h(),title:h(),username:d(h())})}function kt(){return g({added_to_attachment_menu:d(M()),allows_write_to_pm:d(M()),first_name:h(),id:W(),is_bot:d(M()),is_premium:d(M()),last_name:d(h()),language_code:d(h()),photo_url:d(h()),username:d(h())})}function Wr(){return g({auth_date:S(h(),L(e=>new Date(Number(e)*1e3)),xe()),can_send_after:d(S(h(),L(Number),Ue())),chat:d(C(Fr())),chat_type:d(h()),chat_instance:d(h()),hash:h(),query_id:d(h()),receiver:d(C(kt())),start_param:d(h()),signature:h(),user:d(C(kt()))})}function Pt(){return wt(Wr())}function $e(){return Ne(h(),S(H([h(),W()]),L(e=>typeof e=="number"?`#${(e&16777215).toString(16).padStart(6,"0")}`:e),K(Ir)))}function qr(){const e=d(S(h(),L(t=>t==="1")));return g({tgWebAppBotInline:e,tgWebAppData:d(Pt()),tgWebAppDefaultColors:d(C($e())),tgWebAppFullscreen:e,tgWebAppPlatform:h(),tgWebAppShowSettings:e,tgWebAppStartParam:d(h()),tgWebAppThemeParams:C($e()),tgWebAppVersion:h()})}function Ur(){return wt(qr())}function St(){return g({eventType:h(),eventData:d(fe())})}function Dr(e){return bt(()=>q(Pt(),e),t=>t)}function Ee(e){return bt(()=>q(Ur(),e),t=>t)}j(Dr);const xr=j(Ee);function jt(e,t){return t||(t=(n,r)=>JSON.stringify(r)),new URLSearchParams(Object.entries(e).reduce((n,[r,a])=>(Array.isArray(a)?n.push(...a.map(u=>[r,String(u)])):a!=null&&n.push([r,a instanceof Date?(a.getTime()/1e3|0).toString():typeof a=="string"||typeof a=="number"?String(a):typeof a=="boolean"?a?"1":"0":t(r,a)]),n),[])).toString()}function Nr(e){return jt(e)}function Gr(e){return jt(e,(t,n)=>t==="tgWebAppData"?Nr(n):JSON.stringify(n))}var Vr=Object.defineProperty,Jr=(e,t,n)=>t in e?Vr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ke=(e,t,n)=>Jr(e,typeof t!="symbol"?t+"":t,n);function At(e){return t=>t instanceof e}function D(e,t){const n=class extends Error{constructor(...u){const s=typeof t=="function"?t(...u):typeof t=="string"?[t]:t||[];super(...s),this.name=e}};ke(n,"is",At(n));let r=n;return Object.defineProperty(r,"name",{value:e}),r}function zr(e,t,n){const r=class extends D(e,n){constructor(...s){super(...s),ke(this,"data"),this.data=t(...s)}};ke(r,"is",At(r));let a=r;return Object.defineProperty(a,"name",{value:e}),a}class Ot extends D("MethodUnsupportedError",(t,n)=>[`Method "${t}" is unsupported in Mini Apps version ${n}`]){}class Tt extends D("MethodParameterUnsupportedError",(t,n,r)=>[`Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${r}`]){}class Rt extends zr("LaunchParamsRetrieveError",t=>({errors:t}),t=>[["Unable to retrieve launch parameters from any known source. Perhaps, you have opened your app outside Telegram?","📖 Refer to docs for more information:","https://docs.telegram-mini-apps.com/packages/tma-js-bridge/environment","","Collected errors:",...t.map(({source:n,error:r})=>`Source: ${n} / ${r instanceof Error?r.message:String(r)}`)].join(`
|
|
2
|
-
`)]){}class Lt extends D("InvalidLaunchParamsError",(t,n)=>[`Invalid value for launch params: ${t}`,{cause:n}]){}class Mt extends D("UnknownEnvError"){}class It extends D("InvokeCustomMethodError",t=>[`Server returned error: ${t}`]){}const Ct="launchParams";function Ft(e){return e.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&")}const Wt=G(J,nr(Ee)),Br=j(Wt),qt=G(J,Zn(e=>{const t=new URLSearchParams(e).get("tgWebAppData");return t?ar(t):ur})),Kr=G(qt,tr(e=>{throw e},e=>e),or(()=>{},e=>e));function J(){const e=[];for(const[t,n]of[[()=>Ft(window.location.href),"window.location.href"],[()=>{const r=performance.getEntriesByType("navigation")[0];return r&&Ft(r.name)},"performance navigation entries"],[()=>wn(Ct),"local storage"]]){const r=t();if(!r){e.push({source:n,error:new Error("Source is empty")});continue}const a=k(Ee(r),er(u=>u,()=>!0));if(typeof a!="boolean"){e.push({source:n,error:a});continue}return Qe(Ct,r),E(r)}return A(new Rt(e))}const Hr=j(J);function Qr(e,t){t()}function z(e,t){t||(t={});const n=t.equals||Object.is;let r=[],a=e;const u=i=>{if(!n(a,i)){const l=a;a=i,Qr(c,()=>{[...r].forEach(([p,m])=>{p(i,l),m&&o(p,!0)})})}};function s(i){const l=typeof i!="object"?{once:i}:i;return{once:l.once||!1,signal:l.signal||!1}}const o=(i,l)=>{const p=s(l),m=r.findIndex(([b,T])=>b===i&&T.once===p.once&&T.signal===p.signal);m>=0&&r.splice(m,1)},c=Object.assign(function(){return Yr(c),a},{destroy(){r=[]},set:u,reset(){u(e)},sub(i,l){return r.push([i,s(l)]),()=>o(i,l)},unsub:o,unsubAll(){r=r.filter(i=>i[1].signal)}});return c}const B=[];function Yr(e){B.length&&B[B.length-1].add(e)}function Ut(e,t){let n=new Set,r;function a(){return r||(r=z(s(),t))}function u(){a().set(s())}function s(){n.forEach(i=>{i.unsub(u,{signal:!0})});const o=new Set;let c;B.push(o);try{c=e()}finally{B.pop()}return o.forEach(i=>{i.sub(u,{signal:!0})}),n=o,c}return Object.assign(function(){return a()()},{destroy(){a().destroy()},sub(...o){return a().sub(...o)},unsub(...o){a().unsub(...o)},unsubAll(...o){a().unsubAll(...o)}})}function Zr(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(a){a(n)}),(r=e.get("*"))&&r.slice().map(function(a){a(t,n)})}}}function Xr(e,t){const n=new Map,r=Zr(),a=(u,s,o=!1)=>{const c=n.get(u)||new Map;n.set(u,c);const i=c.get(s)||[];c.set(s,i);const l=i.findIndex(p=>p[1]===o);if(l>=0&&(r.off(u,i[l][0]),i.splice(l,1),!i.length&&(c.delete(s),!c.size))){const p=n.size;n.delete(u),p&&!n.size&&t()}};return{on(u,s,o){!n.size&&e();const c=()=>{a(u,s,o)},i=(...m)=>{o&&c(),u==="*"?s({name:m[0],payload:m[1]}):s(...m)};r.on(u,i);const l=n.get(u)||new Map;n.set(u,l);const p=l.get(s)||[];return l.set(s,p),p.push([i,o||!1]),c},off:a,emit:r.emit,clear(){const u=n.size;r.all.clear(),n.clear(),u&&t()}}}function X(e,t){window.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({eventType:e,eventData:t}),source:window.parent}))}function Pe(e,t,n){const r=[n],a=e[t];typeof a=="function"&&r.push(a);const u=(...o)=>{r.forEach(c=>c(...o))},s=Object.assign((...o)=>{u(...o)},{unwrap(){const{length:o}=r;if(o===1){delete e[t];return}if(o===2){Nt(e,t,r[1]);return}r.unshift(1),Nt(e,t,u)}});xt(e,t,()=>s,o=>r.push(o))}function Dt(e,t){const n=e[t];xt(e,t,()=>n,r=>{Object.entries(r).forEach(([a,u])=>{n[a]=u})})}function xt(e,t,n,r){Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:n,set:r})}function Nt(e,t,n){Object.defineProperty(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n})}const eu={clipboard_text_received:g({req_id:h(),data:F(h())}),custom_method_invoked:g({req_id:h(),result:d(fe()),error:d(h())}),popup_closed:F(g({button_id:F(h(),()=>{})}),{}),viewport_changed:F(g({height:W(),width:F(W(),()=>window.innerWidth),is_state_stable:M(),is_expanded:M()}),()=>({height:window.innerHeight,is_state_stable:!0,is_expanded:!0})),theme_changed:g({theme_params:$e()})};function Gt(e){if(e.source!==window.parent)return;let t;try{t=q(C(St()),e.data)}catch{return}const{eventType:n,eventData:r}=t,a=eu[n];let u;try{u=a?q(a,r):r}catch(s){return O().forceError([`An error occurred processing the "${n}" event from the Telegram application.`,"Please, file an issue here:","https://github.com/Telegram-Mini-Apps/
|
|
2
|
+
`)]){}class Lt extends D("InvalidLaunchParamsError",(t,n)=>[`Invalid value for launch params: ${t}`,{cause:n}]){}class Mt extends D("UnknownEnvError"){}class It extends D("InvokeCustomMethodError",t=>[`Server returned error: ${t}`]){}const Ct="launchParams";function Ft(e){return e.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&")}const Wt=G(J,nr(Ee)),Br=j(Wt),qt=G(J,Zn(e=>{const t=new URLSearchParams(e).get("tgWebAppData");return t?ar(t):ur})),Kr=G(qt,tr(e=>{throw e},e=>e),or(()=>{},e=>e));function J(){const e=[];for(const[t,n]of[[()=>Ft(window.location.href),"window.location.href"],[()=>{const r=performance.getEntriesByType("navigation")[0];return r&&Ft(r.name)},"performance navigation entries"],[()=>wn(Ct),"local storage"]]){const r=t();if(!r){e.push({source:n,error:new Error("Source is empty")});continue}const a=k(Ee(r),er(u=>u,()=>!0));if(typeof a!="boolean"){e.push({source:n,error:a});continue}return Qe(Ct,r),E(r)}return A(new Rt(e))}const Hr=j(J);function Qr(e,t){t()}function z(e,t){t||(t={});const n=t.equals||Object.is;let r=[],a=e;const u=i=>{if(!n(a,i)){const l=a;a=i,Qr(c,()=>{[...r].forEach(([p,m])=>{p(i,l),m&&o(p,!0)})})}};function s(i){const l=typeof i!="object"?{once:i}:i;return{once:l.once||!1,signal:l.signal||!1}}const o=(i,l)=>{const p=s(l),m=r.findIndex(([b,T])=>b===i&&T.once===p.once&&T.signal===p.signal);m>=0&&r.splice(m,1)},c=Object.assign(function(){return Yr(c),a},{destroy(){r=[]},set:u,reset(){u(e)},sub(i,l){return r.push([i,s(l)]),()=>o(i,l)},unsub:o,unsubAll(){r=r.filter(i=>i[1].signal)}});return c}const B=[];function Yr(e){B.length&&B[B.length-1].add(e)}function Ut(e,t){let n=new Set,r;function a(){return r||(r=z(s(),t))}function u(){a().set(s())}function s(){n.forEach(i=>{i.unsub(u,{signal:!0})});const o=new Set;let c;B.push(o);try{c=e()}finally{B.pop()}return o.forEach(i=>{i.sub(u,{signal:!0})}),n=o,c}return Object.assign(function(){return a()()},{destroy(){a().destroy()},sub(...o){return a().sub(...o)},unsub(...o){a().unsub(...o)},unsubAll(...o){a().unsubAll(...o)}})}function Zr(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(a){a(n)}),(r=e.get("*"))&&r.slice().map(function(a){a(t,n)})}}}function Xr(e,t){const n=new Map,r=Zr(),a=(u,s,o=!1)=>{const c=n.get(u)||new Map;n.set(u,c);const i=c.get(s)||[];c.set(s,i);const l=i.findIndex(p=>p[1]===o);if(l>=0&&(r.off(u,i[l][0]),i.splice(l,1),!i.length&&(c.delete(s),!c.size))){const p=n.size;n.delete(u),p&&!n.size&&t()}};return{on(u,s,o){!n.size&&e();const c=()=>{a(u,s,o)},i=(...m)=>{o&&c(),u==="*"?s({name:m[0],payload:m[1]}):s(...m)};r.on(u,i);const l=n.get(u)||new Map;n.set(u,l);const p=l.get(s)||[];return l.set(s,p),p.push([i,o||!1]),c},off:a,emit:r.emit,clear(){const u=n.size;r.all.clear(),n.clear(),u&&t()}}}function X(e,t){window.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({eventType:e,eventData:t}),source:window.parent}))}function Pe(e,t,n){const r=[n],a=e[t];typeof a=="function"&&r.push(a);const u=(...o)=>{r.forEach(c=>c(...o))},s=Object.assign((...o)=>{u(...o)},{unwrap(){const{length:o}=r;if(o===1){delete e[t];return}if(o===2){Nt(e,t,r[1]);return}r.unshift(1),Nt(e,t,u)}});xt(e,t,()=>s,o=>r.push(o))}function Dt(e,t){const n=e[t];xt(e,t,()=>n,r=>{Object.entries(r).forEach(([a,u])=>{n[a]=u})})}function xt(e,t,n,r){Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:n,set:r})}function Nt(e,t,n){Object.defineProperty(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n})}const eu={clipboard_text_received:g({req_id:h(),data:F(h())}),custom_method_invoked:g({req_id:h(),result:d(fe()),error:d(h())}),popup_closed:F(g({button_id:F(h(),()=>{})}),{}),viewport_changed:F(g({height:W(),width:F(W(),()=>window.innerWidth),is_state_stable:M(),is_expanded:M()}),()=>({height:window.innerHeight,is_state_stable:!0,is_expanded:!0})),theme_changed:g({theme_params:$e()})};function Gt(e){if(e.source!==window.parent)return;let t;try{t=q(C(St()),e.data)}catch{return}const{eventType:n,eventData:r}=t,a=eu[n];let u;try{u=a?q(a,r):r}catch(s){return O().forceError([`An error occurred processing the "${n}" event from the Telegram application.`,"Please, file an issue here:","https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose"].join(`
|
|
3
3
|
`),t,s)}tu(n,u)}const{on:Se,off:Vt,emit:tu,clear:Jt}=Xr(()=>{const e=window;!e.TelegramGameProxy&&(e.TelegramGameProxy={}),Pe(e.TelegramGameProxy,"receiveEvent",X),Dt(e,"TelegramGameProxy"),!e.Telegram&&(e.Telegram={}),!e.Telegram.WebView&&(e.Telegram.WebView={}),Pe(e.Telegram.WebView,"receiveEvent",X),Dt(e.Telegram,"WebView"),Pe(e,"TelegramGameProxy_receiveEvent",X),window.addEventListener("message",Gt)},()=>{[["TelegramGameProxy_receiveEvent"],["TelegramGameProxy","receiveEvent"],["Telegram","WebView","receiveEvent"]].forEach(e=>{const t=window;let n=[void 0,t];for(const u of e)if(n=[n[1],n[1][u]],!n[1])return;const[r,a]=n;"unwrap"in a&&(a.unwrap(),r&&r!==t&&!Object.keys(r).length&&delete t[e[0]])}),window.removeEventListener("message",Gt)}),ee=z(!1),je=z("https://web.telegram.org"),nu=e=>{O().log("Event received:",e)},Ae=Ut(ee);function ru(e){e!==ee()&&(ee.set(e),(e?Se:Vt)("*",nu))}const Oe=Ut(je);function uu(e){je.set(e),O().log("New target origin set",e)}const x=z((...e)=>{window.parent.postMessage(...e)}),O=z(Ye("Bridge",{bgColor:"#9147ff",textColor:"white",shouldLog:Ae}));function au(){Jt(),[x,je,Oe,ee,Ae,O].forEach(e=>{e.unsubAll(),"reset"in e&&e.reset()})}const zt=(...e)=>x()(...e);function Bt(e,t){k(te(e,t),Xn(n=>{throw n}))}function te(e,t){O().log("Posting event:",t?{eventType:e,eventData:t}:{eventType:e});const n=window,r=JSON.stringify({eventType:e,eventData:t});return he()?(zt(r,Oe()),E(void 0)):pe(n)?(n.TelegramWebviewProxy.postEvent(e,JSON.stringify(t)),E(void 0)):oe(g({external:g({notify:ce()})}),n)?(n.external.notify(r),E(void 0)):A(new Mt)}function ne(e,t,n={}){const{capture:r=()=>!0,postEvent:a=te}=n;return k(async()=>a(e,n.params),wr(()=>ct((u,s,o)=>{const[c,i]=$n();(Array.isArray(t)?t:[t]).forEach(l=>{c(Se(l,p=>{(Array.isArray(t)?r({event:l,payload:p}):r(p))&&u(p)}))}),o.on("finalized",i)},n)))}function iu(e,t,n){const{postEvent:r}=n||{};return Y(ne(e,t,{...n,postEvent:r?(...a)=>{try{return r(...a),E(void 0)}catch(u){return A(u)}}:te}))}function su(e,t){const n=Kt(e,t);return typeof n=="function"?Q.fn(()=>Y(n)):n}function Kt(e,t){const n=pe(window);if(!e)return n||k(J(),be(()=>!1,()=>!0));if(n)return _t(!0);const{timeout:r=100}=t||{};return k(ne("web_app_request_theme","theme_changed",{...t,timeout:r}),gt(a=>me.is(a)?E(!1):A(a),()=>E(!0)))}function ou({launchParams:e,onEvent:t,resetPostMessage:n}={}){if(e){const u=typeof e=="string"||e instanceof URLSearchParams?e.toString():Gr({...e,tgWebAppData:void 0})+(e.tgWebAppData?`&tgWebAppData=${encodeURIComponent(e.tgWebAppData.toString())}`:"");try{xr(u)}catch(s){throw new Lt(u,s)}Qe("launchParams",u)}if(he()){if(!t)return;n&&x.reset();const u=x();x.set((...s)=>{const[o]=s,c=()=>{u(...s)};try{const i=q(C(St()),o);t([i.eventType,i.eventData],c)}catch{c()}});return}const r=window.TelegramWebviewProxy||{},a=r.postEvent||(()=>{});window.TelegramWebviewProxy={...r,postEvent(u,s){const o=()=>{a(u,s)};t?t([u,s?JSON.parse(s):void 0],o):o()}},O().log("Environment was mocked by the mockTelegramEnv function")}function Ht(e){return({req_id:t})=>t===e}function Qt(e){return e.split(".").map(Number)}function Yt(e,t){const n=Qt(e),r=Qt(t),a=Math.max(n.length,r.length);for(let u=0;u<a;u+=1){const s=n[u]||0,o=r[u]||0;if(s!==o)return s>o?1:-1}return 0}const Zt={"6.0":["iframe_ready","iframe_will_reload","web_app_close","web_app_data_send","web_app_expand","web_app_open_link","web_app_ready","web_app_request_theme","web_app_request_viewport","web_app_setup_main_button","web_app_setup_closing_behavior"],6.1:["web_app_open_tg_link","web_app_open_invoice","web_app_setup_back_button","web_app_set_background_color","web_app_set_header_color","web_app_trigger_haptic_feedback"],6.2:["web_app_open_popup"],6.4:["web_app_close_scan_qr_popup","web_app_open_scan_qr_popup","web_app_read_text_from_clipboard",{method:"web_app_open_link",param:"try_instant_view"}],6.7:["web_app_switch_inline_query"],6.9:["web_app_invoke_custom_method","web_app_request_write_access","web_app_request_phone",{method:"web_app_set_header_color",param:"color"}],"6.10":["web_app_setup_settings_button"],7.2:["web_app_biometry_get_info","web_app_biometry_open_settings","web_app_biometry_request_access","web_app_biometry_request_auth","web_app_biometry_update_token"],7.6:[{method:"web_app_open_link",param:"try_browser"},{method:"web_app_close",param:"return_back"}],7.7:["web_app_setup_swipe_behavior"],7.8:["web_app_share_to_story"],"7.10":["web_app_setup_secondary_button","web_app_set_bottom_bar_color",{method:"web_app_setup_main_button",param:"has_shine_effect"}],"8.0":["web_app_request_safe_area","web_app_request_content_safe_area","web_app_request_fullscreen","web_app_exit_fullscreen","web_app_set_emoji_status","web_app_add_to_home_screen","web_app_check_home_screen","web_app_request_emoji_status_access","web_app_check_location","web_app_open_location_settings","web_app_request_file_download","web_app_request_location","web_app_send_prepared_message","web_app_start_accelerometer","web_app_start_device_orientation","web_app_start_gyroscope","web_app_stop_accelerometer","web_app_stop_device_orientation","web_app_stop_gyroscope","web_app_toggle_orientation_lock"],"9.0":["web_app_device_storage_clear","web_app_device_storage_get_key","web_app_device_storage_save_key","web_app_secure_storage_clear","web_app_secure_storage_get_key","web_app_secure_storage_restore_key","web_app_secure_storage_save_key"],9.1:["web_app_hide_keyboard"]};function Te(e,t){return Object.keys(Zt).find(r=>Zt[r].some(a=>t?typeof a=="object"&&a.method===e&&a.param===t:a===e))||null}function Re(e,t,n){const r=n?Te(e,t):Te(e);return r?Yt(r,n||t)<=0:!1}function cu(e,t="strict"){const n=typeof t=="function"?t:r=>{const{method:a,version:u}=r,s="param"in r?new Tt(a,r.param,u):new Ot(a,u);if(t==="strict")throw s;return O().forceWarn(s.message)};return(r,a)=>Re(r,e)?r==="web_app_set_header_color"&&oe(g({color:De()}),a)&&!Re(r,"color",e)?n({version:e,method:r,param:"color"}):Bt(r,a):n({version:e,method:r})}function Xt(e,t,n,r){return k(ne("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:e,params:t,req_id:n},capture:Ht(n)}),br(({result:a,error:u})=>u?vr(new It(u)):_t(a)))}function lu(e,t,n,r){return Q.fn(()=>k(Xt(e,t,n,r),gt(a=>{throw a},a=>a))())}function fu(){Object.hasOwn||(Object.hasOwn=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)})}function Le(e){return we(()=>decodeURIComponent(atob(e).replace(/-/g,"+").replace(/_/g,"/").split("").map(t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join("")),t=>t)}const pu=j(Le);function Me(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(t,n)=>String.fromCharCode(parseInt(`0x${n}`)))).replace(/\+/g,"-").replace(/\//g,"_")}var hu=function(e){return we(function(){return JSON.parse(e)},zn)};function en(e){const t=Me(typeof e=="string"?e:JSON.stringify(e));return t.length>512?A(new Error("Value is too long for start parameter")):E(t)}const du=j(en);function mu(e,t){return Y(tn(e,typeof t=="function"?n=>we(()=>t(n),r=>r):t))}function tn(e,t){return k(Le(e),rr(n=>t?typeof t=="function"?t(n):hu(n):E(n)))}function _u(e){return Me(e).length<=512}return f.CancelledError=Be,f.InvalidLaunchParamsError=Lt,f.InvokeCustomMethodFailedError=It,f.LaunchParamsRetrieveError=Rt,f.MethodParameterUnsupportedError=Tt,f.MethodUnsupportedError=Ot,f.TimeoutError=me,f.UnknownEnvError=Mt,f.applyPolyfills=fu,f.captureSameReq=Ht,f.compareVersions=Yt,f.createLogger=Ye,f.createPostEvent=cu,f.createStartParam=du,f.createStartParamFp=en,f.debug=Ae,f.decodeBase64Url=pu,f.decodeBase64UrlFp=Le,f.decodeStartParam=mu,f.decodeStartParamFp=tn,f.deepSnakeToCamelObjKeys=_e,f.emitEvent=X,f.encodeBase64Url=Me,f.getReleaseVersion=Te,f.hasWebviewProxy=pe,f.invokeCustomMethod=lu,f.invokeCustomMethodFp=Xt,f.isIframe=he,f.isSafeToCreateStartParam=_u,f.isTMA=su,f.isTMAFp=Kt,f.logger=O,f.mockTelegramEnv=ou,f.off=Vt,f.offAll=Jt,f.on=Se,f.postEvent=Bt,f.postEventFp=te,f.postMessage=zt,f.postMessageImpl=x,f.request=iu,f.requestFp=ne,f.resetGlobals=au,f.retrieveLaunchParams=Br,f.retrieveLaunchParamsFp=Wt,f.retrieveRawInitData=Kr,f.retrieveRawInitDataFp=qt,f.retrieveRawLaunchParams=Hr,f.retrieveRawLaunchParamsFp=J,f.setDebug=ru,f.setTargetOrigin=uu,f.supports=Re,f.targetOrigin=Oe,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}),f}({});
|
|
4
4
|
//# sourceMappingURL=index.iife.js.map
|