@effect-ak/tg-bot-client 0.6.1 → 0.6.3

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.
@@ -0,0 +1,22 @@
1
+ "use strict";var Ye=Object.defineProperty;var Rs=Object.getOwnPropertyDescriptor;var Ns=Object.getOwnPropertyNames;var Ps=Object.prototype.hasOwnProperty;var Fs=(t,e)=>{for(var r in e)Ye(t,r,{get:e[r],enumerable:!0})},Ls=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ns(e))!Ps.call(t,n)&&n!==r&&Ye(t,n,{get:()=>e[n],enumerable:!(o=Rs(e,n))||o.enumerable});return t};var Us=t=>Ls(Ye({},"__esModule",{value:!0}),t);var jc={};Fs(jc,{BatchUpdateResult:()=>qt,BotPollSettings:()=>Ht,BotPollSettingsTag:()=>F,BotResponse:()=>ee,BotRunService:()=>ce,BotUpdateHandlersTag:()=>st,HandleUpdateError:()=>yt,defineBot:()=>Bc,extractUpdate:()=>Is,handleEntireBatch:()=>As,handleOneByOne:()=>vs,handleOneUpdate:()=>Ms,handleUpdates:()=>oo,launchBot:()=>no,runTgChatBot:()=>Dc});module.exports=Us(jc);var Ke=t=>typeof t=="function",u=function(t,e){if(typeof t=="function")return function(){return t(arguments)?e.apply(this,arguments):r=>e(r,...arguments)};switch(t){case 0:case 1:throw new RangeError(`Invalid arity ${t}`);case 2:return function(r,o){return arguments.length>=2?e(r,o):function(n){return e(n,r)}};case 3:return function(r,o,n){return arguments.length>=3?e(r,o,n):function(s){return e(s,r,o)}};case 4:return function(r,o,n,s){return arguments.length>=4?e(r,o,n,s):function(i){return e(i,r,o,n)}};case 5:return function(r,o,n,s,i){return arguments.length>=5?e(r,o,n,s,i):function(c){return e(c,r,o,n,s)}};default:return function(){if(arguments.length>=t)return e.apply(this,arguments);let r=arguments;return function(o){return e(o,...r)}}}};var A=t=>t;var Ze=t=>()=>t,ae=Ze(!0),Qe=Ze(!1);var Xe=Ze(void 0),so=Xe;function b(t,e,r,o,n,s,i,c,a){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return r(e(t));case 4:return o(r(e(t)));case 5:return n(o(r(e(t))));case 6:return s(n(o(r(e(t)))));case 7:return i(s(n(o(r(e(t))))));case 8:return c(i(s(n(o(r(e(t)))))));case 9:return a(c(i(s(n(o(r(e(t))))))));default:{let p=arguments[0];for(let h=1;h<arguments.length;h++)p=arguments[h](p);return p}}}var co=t=>(e,r)=>e===r||t(e,r);var qs="3.12.0",pe=()=>qs;var er=Symbol.for(`effect/GlobalValue/globalStoreId/${pe()}`);er in globalThis||(globalThis[er]=new Map);var tr=globalThis[er],L=(t,e)=>(tr.has(t)||tr.set(t,e()),tr.get(t));var Wt=Ke;var Ds=t=>typeof t=="object"&&t!==null,rr=t=>Ds(t)||Wt(t),_=u(2,(t,e)=>rr(t)&&e in t),or=u(2,(t,e)=>_(t,"_tag")&&t._tag===e);var Gt=t=>`BUG: ${t} - please report an issue at https://github.com/Effect-TS/effect/issues`;var po=Symbol.for("effect/Gen/GenKind");var uo=class{value;constructor(e){this.value=e}get _F(){return A}get _R(){return e=>e}get _O(){return e=>e}get _E(){return e=>e}[po]=po;[Symbol.iterator](){return new ut(this)}},ut=class t{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new t(this.self)}};var nr=Symbol.for("effect/Utils/YieldWrap"),J=class{#t;constructor(e){this.#t=e}[nr](){return this.#t}};function lo(t){if(typeof t=="object"&&t!==null&&nr in t)return t[nr]();throw new Error(Gt("yieldWrapGet"))}var N=L("effect/Utils/isStructuralRegion",()=>({enabled:!1,tester:void 0}));var Zc=function*(){}.constructor;var sr=L(Symbol.for("effect/Hash/randomHashCache"),()=>new WeakMap),f=Symbol.for("effect/Hash"),l=t=>{if(N.enabled===!0)return 0;switch(typeof t){case"number":return le(t);case"bigint":return U(t.toString(10));case"boolean":return U(String(t));case"symbol":return U(String(t));case"string":return U(t);case"undefined":return U("undefined");case"function":case"object":return t===null?U("null"):t instanceof Date?l(t.toISOString()):Bs(t)?t[f]():Ot(t);default:throw new Error(`BUG: unhandled typeof ${typeof t} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Ot=t=>(sr.has(t)||sr.set(t,le(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),sr.get(t)),M=t=>e=>e*53^t,ue=t=>t&3221225471|t>>>1&1073741824,Bs=t=>_(t,f),le=t=>{if(t!==t||t===1/0)return 0;let e=t|0;for(e!==t&&(e^=t*4294967295);t>4294967295;)e^=t/=4294967295;return ue(e)},U=t=>{let e=5381,r=t.length;for(;r;)e=e*33^t.charCodeAt(--r);return ue(e)},js=(t,e)=>{let r=12289;for(let o=0;o<e.length;o++)r^=b(U(e[o]),M(l(t[e[o]])));return ue(r)},fo=t=>js(t,Object.keys(t)),fe=t=>{let e=6151;for(let r=0;r<t.length;r++)e=b(e,M(l(t[r])));return ue(e)},S=function(){if(arguments.length===1){let r=arguments[0];return function(o){return Object.defineProperty(r,f,{value(){return o},enumerable:!1}),o}}let t=arguments[0],e=arguments[1];return Object.defineProperty(t,f,{value(){return e},enumerable:!1}),e};var m=Symbol.for("effect/Equal");function x(){return arguments.length===1?t=>de(t,arguments[0]):de(arguments[0],arguments[1])}function de(t,e){if(t===e)return!0;let r=typeof t;if(r!==typeof e)return!1;if(r==="object"||r==="function"){if(t!==null&&e!==null){if(ho(t)&&ho(e))return l(t)===l(e)&&t[m](e)?!0:N.enabled&&N.tester?N.tester(t,e):!1;if(t instanceof Date&&e instanceof Date)return t.toISOString()===e.toISOString()}if(N.enabled){if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every((o,n)=>de(o,e[n]));if(Object.getPrototypeOf(t)===Object.prototype&&Object.getPrototypeOf(t)===Object.prototype){let o=Object.keys(t),n=Object.keys(e);if(o.length===n.length){for(let s of o)if(!(s in e&&de(t[s],e[s])))return N.tester?N.tester(t,e):!1;return!0}}return N.tester?N.tester(t,e):!1}}return N.enabled&&N.tester?N.tester(t,e):!1}var ho=t=>_(t,m);var y=Symbol.for("nodejs.util.inspect.custom"),O=t=>{try{if(_(t,"toJSON")&&Wt(t.toJSON)&&t.toJSON.length===0)return t.toJSON();if(Array.isArray(t))return t.map(O)}catch{return{}}return Ws(t)},E=t=>JSON.stringify(t,null,2),ca={toJSON(){return O(this)},[y](){return this.toJSON()},toString(){return E(this.toJSON())}},mo=class{[y](){return this.toJSON()}toString(){return E(this.toJSON())}},xo=(t,e=2)=>{if(typeof t=="string")return t;try{return typeof t=="object"?ir(t,e):String(t)}catch{return String(t)}},ir=(t,e)=>{let r=[],o=JSON.stringify(t,(n,s)=>typeof s=="object"&&s!==null?r.includes(s)?void 0:r.push(s)&&(he.fiberRefs!==void 0&&go(s)?s[cr](he.fiberRefs):s):s,e);return r=void 0,o},cr=Symbol.for("effect/Inspectable/Redactable"),go=t=>typeof t=="object"&&t!==null&&cr in t,he=L("effect/Inspectable/redactableState",()=>({fiberRefs:void 0}));var Ws=t=>go(t)&&he.fiberRefs!==void 0?t[cr](he.fiberRefs):t;var C=(t,e)=>{switch(e.length){case 0:return t;case 1:return e[0](t);case 2:return e[1](e[0](t));case 3:return e[2](e[1](e[0](t)));case 4:return e[3](e[2](e[1](e[0](t))));case 5:return e[4](e[3](e[2](e[1](e[0](t)))));case 6:return e[5](e[4](e[3](e[2](e[1](e[0](t))))));case 7:return e[6](e[5](e[4](e[3](e[2](e[1](e[0](t)))))));case 8:return e[7](e[6](e[5](e[4](e[3](e[2](e[1](e[0](t))))))));case 9:return e[8](e[7](e[6](e[5](e[4](e[3](e[2](e[1](e[0](t)))))))));default:{let r=t;for(let o=0,n=e.length;o<n;o++)r=e[o](r);return r}}};var ar="Commit",_o="Failure";var yo="WithRuntime";var So=Symbol.for("effect/Effect"),bo=Symbol.for("effect/Stream"),Eo=Symbol.for("effect/Sink"),Co=Symbol.for("effect/Channel"),et={_R:t=>t,_E:t=>t,_A:t=>t,_V:pe()},Gs={_A:t=>t,_In:t=>t,_L:t=>t,_E:t=>t,_R:t=>t},zs={_Env:t=>t,_InErr:t=>t,_InElem:t=>t,_InDone:t=>t,_OutErr:t=>t,_OutElem:t=>t,_OutDone:t=>t},$={[So]:et,[bo]:et,[Eo]:Gs,[Co]:zs,[m](t){return this===t},[f](){return S(this,Ot(this))},[Symbol.iterator](){return new ut(new J(this))},pipe(){return C(this,arguments)}},pr={[f](){return S(this,fo(this))},[m](t){let e=Object.keys(this),r=Object.keys(t);if(e.length!==r.length)return!1;for(let o of e)if(!(o in t&&x(this[o],t[o])))return!1;return!0}},ur={...$,_op:ar},lr={...ur,...pr};var ko=Symbol.for("effect/Option"),Io={...$,[ko]:{_A:t=>t},[y](){return this.toJSON()},toString(){return E(this.toJSON())}},$s=Object.assign(Object.create(Io),{_tag:"Some",_op:"Some",[m](t){return fr(t)&&hr(t)&&x(this.value,t.value)},[f](){return S(this,M(l(this._tag))(l(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:O(this.value)}}}),Vs=l("None"),Ys=Object.assign(Object.create(Io),{_tag:"None",_op:"None",[m](t){return fr(t)&&dr(t)},[f](){return Vs},toJSON(){return{_id:"Option",_tag:this._tag}}}),fr=t=>_(t,ko),dr=t=>t._tag==="None",hr=t=>t._tag==="Some",Ao=Object.create(Ys),vo=t=>{let e=Object.create($s);return e.value=t,e};var mr=Symbol.for("effect/Either"),Mo={...$,[mr]:{_R:t=>t},[y](){return this.toJSON()},toString(){return E(this.toJSON())}},Zs=Object.assign(Object.create(Mo),{_tag:"Right",_op:"Right",[m](t){return xr(t)&&To(t)&&x(this.right,t.right)},[f](){return M(l(this._tag))(l(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:O(this.right)}}}),Qs=Object.assign(Object.create(Mo),{_tag:"Left",_op:"Left",[m](t){return xr(t)&&wo(t)&&x(this.left,t.left)},[f](){return M(l(this._tag))(l(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:O(this.left)}}}),xr=t=>_(t,mr),wo=t=>t._tag==="Left",To=t=>t._tag==="Right",Ro=t=>{let e=Object.create(Qs);return e.left=t,e},No=t=>{let e=Object.create(Zs);return e.right=t,e};var zt=No,gr=Ro;var T=()=>Ao,V=vo;var P=dr,rt=hr;var Po=u(2,(t,e)=>P(t)?e():t.value);var Fo=Po(Xe);var $t=t=>Array.isArray(t)?t:Array.from(t);var Ca=Array.isArray;var _r=t=>Array.from(t).reverse();var yr=u(3,(t,e,r)=>$t(t).reduce((o,n,s)=>r(o,n,s),e));var Lo=Symbol.for("effect/Chunk");function ei(t,e,r,o,n){for(let s=e;s<Math.min(t.length,e+n);s++)r[o+s-e]=t[s];return r}var Uo=[],ri=t=>co((e,r)=>e.length===r.length&&St(e).every((o,n)=>t(o,bt(r,n)))),oi=ri(x),ni={[Lo]:{_A:t=>t},toString(){return E(this.toJSON())},toJSON(){return{_id:"Chunk",values:St(this).map(O)}},[y](){return this.toJSON()},[m](t){return Ho(t)&&oi(this,t)},[f](){return S(this,fe(St(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return Uo[Symbol.iterator]();default:return St(this)[Symbol.iterator]()}},pipe(){return C(this,arguments)}},w=t=>{let e=Object.create(ni);switch(e.backing=t,t._tag){case"IEmpty":{e.length=0,e.depth=0,e.left=e,e.right=e;break}case"IConcat":{e.length=t.left.length+t.right.length,e.depth=1+Math.max(t.left.depth,t.right.depth),e.left=t.left,e.right=t.right;break}case"IArray":{e.length=t.array.length,e.depth=0,e.left=Y,e.right=Y;break}case"ISingleton":{e.length=1,e.depth=0,e.left=Y,e.right=Y;break}case"ISlice":{e.length=t.length,e.depth=t.chunk.depth+1,e.left=Y,e.right=Y;break}}return e},Ho=t=>_(t,Lo),Y=w({_tag:"IEmpty"}),lt=()=>Y,Yt=(...t)=>t.length===1?ft(t[0]):ci(t),ft=t=>w({_tag:"ISingleton",a:t}),qo=t=>Ho(t)?t:w({_tag:"IArray",array:$t(t)}),Sr=(t,e,r)=>{switch(t.backing._tag){case"IArray":{ei(t.backing.array,0,e,r,t.length);break}case"IConcat":{Sr(t.left,e,r),Sr(t.right,e,r+t.left.length);break}case"ISingleton":{e[r]=t.backing.a;break}case"ISlice":{let o=0,n=r;for(;o<t.length;)e[n]=bt(t,o),o+=1,n+=1;break}}};var si=t=>{switch(t.backing._tag){case"IEmpty":return Uo;case"IArray":return t.backing.array;default:{let e=new Array(t.length);return Sr(t,e,0),t.backing={_tag:"IArray",array:e},t.left=Y,t.right=Y,t.depth=0,e}}},St=si,ii=t=>{switch(t.backing._tag){case"IEmpty":case"ISingleton":return t;case"IArray":return w({_tag:"IArray",array:_r(t.backing.array)});case"IConcat":return w({_tag:"IConcat",left:Vt(t.backing.right),right:Vt(t.backing.left)});case"ISlice":return Do(_r(St(t)))}},Vt=ii;var Do=t=>w({_tag:"IArray",array:t}),ci=t=>Do(t),bt=u(2,(t,e)=>{switch(t.backing._tag){case"IEmpty":throw new Error("Index out of bounds");case"ISingleton":{if(e!==0)throw new Error("Index out of bounds");return t.backing.a}case"IArray":{if(e>=t.length||e<0)throw new Error("Index out of bounds");return t.backing.array[e]}case"IConcat":return e<t.left.length?bt(t.left,e):bt(t.right,e-t.left.length);case"ISlice":return bt(t.backing.chunk,e+t.backing.offset)}});var me=u(2,(t,e)=>K(ft(e),t));var K=u(2,(t,e)=>{if(t.backing._tag==="IEmpty")return e;if(e.backing._tag==="IEmpty")return t;let r=e.depth-t.depth;if(Math.abs(r)<=1)return w({_tag:"IConcat",left:t,right:e});if(r<-1)if(t.left.depth>=t.right.depth){let o=K(t.right,e);return w({_tag:"IConcat",left:t.left,right:o})}else{let o=K(t.right.right,e);if(o.depth===t.depth-3){let n=w({_tag:"IConcat",left:t.right.left,right:o});return w({_tag:"IConcat",left:t.left,right:n})}else{let n=w({_tag:"IConcat",left:t.left,right:t.right.left});return w({_tag:"IConcat",left:n,right:o})}}else if(e.right.depth>=e.left.depth){let o=K(t,e.left);return w({_tag:"IConcat",left:o,right:e.right})}else{let o=K(t,e.left.left);if(o.depth===e.depth-3){let n=w({_tag:"IConcat",left:o,right:e.left.right});return w({_tag:"IConcat",left:n,right:e.right})}else{let n=w({_tag:"IConcat",left:e.left.right,right:e.right});return w({_tag:"IConcat",left:o,right:n})}}});var Bo=t=>t.length===0,xe=t=>t.length>0;var jo=t=>bt(t,0),ge=jo;var Go=Symbol.for("effect/Context/Tag"),_e=Symbol.for("effect/Context/Reference"),ai="effect/STM",pi=Symbol.for(ai),zo={...$,_op:"Tag",[pi]:et,[Go]:{_Service:t=>t,_Identifier:t=>t},toString(){return E(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[y](){return this.toJSON()},of(t){return t},context(t){return Cr(this,t)}},ui={...zo,[_e]:_e};var Jo=t=>()=>{let e=Error.stackTraceLimit;Error.stackTraceLimit=2;let r=new Error;Error.stackTraceLimit=e;function o(){}return Object.setPrototypeOf(o,zo),o.key=t,Object.defineProperty(o,"stack",{get(){return r.stack}}),o},$o=()=>(t,e)=>{let r=Error.stackTraceLimit;Error.stackTraceLimit=2;let o=new Error;Error.stackTraceLimit=r;function n(){}return Object.setPrototypeOf(n,ui),n.key=t,n.defaultValue=e.defaultValue,Object.defineProperty(n,"stack",{get(){return o.stack}}),n},Er=Symbol.for("effect/Context"),li={[Er]:{_Services:t=>t},[m](t){if(Vo(t)&&this.unsafeMap.size===t.unsafeMap.size){for(let e of this.unsafeMap.keys())if(!t.unsafeMap.has(e)||!x(this.unsafeMap.get(e),t.unsafeMap.get(e)))return!1;return!0}return!1},[f](){return S(this,le(this.unsafeMap.size))},pipe(){return C(this,arguments)},toString(){return E(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(O)}},[y](){return this.toJSON()}},ye=t=>{let e=Object.create(li);return e.unsafeMap=t,e},fi=t=>{let e=new Error(`Service not found${t.key?`: ${String(t.key)}`:""}`);if(t.stack){let r=t.stack.split(`
2
+ `);if(r.length>2){let o=r[2].match(/at (.*)/);o&&(e.message=e.message+` (defined at ${o[1]})`)}}if(e.stack){let r=e.stack.split(`
3
+ `);r.splice(1,3),e.stack=r.join(`
4
+ `)}return e},Vo=t=>_(t,Er);var Cr=(t,e)=>ye(new Map([[t.key,e]])),Yo=u(3,(t,e,r)=>{let o=new Map(t.unsafeMap);return o.set(e.key,r),ye(o)}),br=L("effect/Context/defaultValueCache",()=>new Map),Ko=t=>{if(br.has(t.key))return br.get(t.key);let e=t.defaultValue();return br.set(t.key,e),e},Zo=(t,e)=>t.unsafeMap.has(e.key)?t.unsafeMap.get(e.key):Ko(e),Qo=u(2,(t,e)=>{if(!t.unsafeMap.has(e.key)){if(_e in e)return Ko(e);throw fi(e)}return t.unsafeMap.get(e.key)});var Xo=u(2,(t,e)=>{let r=new Map(t.unsafeMap);for(let[o,n]of e.unsafeMap)r.set(o,n);return ye(r)});var en=Cr,rn=Yo;var on=Qo;var nn=Xo;var Oe=Jo,q=$o;var kr=Math.pow(2,5),sn=kr-1,cn=kr/2,an=kr/4;function di(t){return t-=t>>1&1431655765,t=(t&858993459)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,t&127}function ot(t,e){return e>>>t&sn}function nt(t){return 1<<t}function Se(t,e){return di(t&e-1)}var pn=(t,e)=>({value:t,previous:e});function dt(t,e,r,o){let n=o;if(!t){let s=o.length;n=new Array(s);for(let i=0;i<s;++i)n[i]=o[i]}return n[e]=r,n}function Ir(t,e,r){let o=r.length-1,n=0,s=0,i=r;if(t)n=s=e;else for(i=new Array(o);n<e;)i[s++]=r[n++];for(++n;n<=o;)i[s++]=r[n++];return t&&(i.length=o),i}function un(t,e,r,o){let n=o.length;if(t){let a=n;for(;a>=e;)o[a--]=o[a];return o[e]=r,o}let s=0,i=0,c=new Array(n+1);for(;s<e;)c[i++]=o[s++];for(c[e]=r;s<n;)c[++i]=o[s++];return c}var Z=class t{_tag="EmptyNode";modify(e,r,o,n,s,i){let c=o(T());return P(c)?new t:(++i.value,new Ct(e,n,s,c))}};function z(t){return or(t,"EmptyNode")}function mi(t){return z(t)||t._tag==="LeafNode"||t._tag==="CollisionNode"}function be(t,e){return z(t)?!1:e===t.edit}var Ct=class t{edit;hash;key;value;_tag="LeafNode";constructor(e,r,o,n){this.edit=e,this.hash=r,this.key=o,this.value=n}modify(e,r,o,n,s,i){if(x(s,this.key)){let a=o(this.value);return a===this.value?this:P(a)?(--i.value,new Z):be(this,e)?(this.value=a,this):new t(e,n,s,a)}let c=o(T());return P(c)?this:(++i.value,ln(e,r,this.hash,this,n,new t(e,n,s,c)))}},Ar=class t{edit;hash;children;_tag="CollisionNode";constructor(e,r,o){this.edit=e,this.hash=r,this.children=o}modify(e,r,o,n,s,i){if(n===this.hash){let a=be(this,e),p=this.updateCollisionList(a,e,this.hash,this.children,o,s,i);return p===this.children?this:p.length>1?new t(e,this.hash,p):p[0]}let c=o(T());return P(c)?this:(++i.value,ln(e,r,this.hash,this,n,new Ct(e,n,s,c)))}updateCollisionList(e,r,o,n,s,i,c){let a=n.length;for(let h=0;h<a;++h){let g=n[h];if("key"in g&&x(i,g.key)){let v=g.value,I=s(v);return I===v?n:P(I)?(--c.value,Ir(e,h,n)):dt(e,h,new Ct(r,o,i,I),n)}}let p=s(T());return P(p)?n:(++c.value,dt(e,a,new Ct(r,o,i,p),n))}},Kt=class t{edit;mask;children;_tag="IndexedNode";constructor(e,r,o){this.edit=e,this.mask=r,this.children=o}modify(e,r,o,n,s,i){let c=this.mask,a=this.children,p=ot(r,n),h=nt(p),g=Se(c,h),v=c&h,I=be(this,e);if(!v){let pt=new Z().modify(e,r+5,o,n,s,i);return pt?a.length>=cn?gi(e,p,pt,c,a):new t(e,c|h,un(I,g,pt,a)):this}let Dt=a[g],it=Dt.modify(e,r+5,o,n,s,i);if(Dt===it)return this;let ct=c,at;if(z(it)){if(ct&=~h,!ct)return new Z;if(a.length<=2&&mi(a[g^1]))return a[g^1];at=Ir(I,g,a)}else at=dt(I,g,it,a);return I?(this.mask=ct,this.children=at,this):new t(e,ct,at)}},vr=class t{edit;size;children;_tag="ArrayNode";constructor(e,r,o){this.edit=e,this.size=r,this.children=o}modify(e,r,o,n,s,i){let c=this.size,a=this.children,p=ot(r,n),h=a[p],g=(h||new Z).modify(e,r+5,o,n,s,i);if(h===g)return this;let v=be(this,e),I;if(z(h)&&!z(g))++c,I=dt(v,p,g,a);else if(!z(h)&&z(g)){if(--c,c<=an)return xi(e,c,p,a);I=dt(v,p,new Z,a)}else I=dt(v,p,g,a);return v?(this.size=c,this.children=I,this):new t(e,c,I)}};function xi(t,e,r,o){let n=new Array(e-1),s=0,i=0;for(let c=0,a=o.length;c<a;++c)if(c!==r){let p=o[c];p&&!z(p)&&(n[s++]=p,i|=1<<c)}return new Kt(t,i,n)}function gi(t,e,r,o,n){let s=[],i=o,c=0;for(let a=0;i;++a)i&1&&(s[a]=n[c++]),i>>>=1;return s[e]=r,new vr(t,c+1,s)}function _i(t,e,r,o,n,s){if(r===n)return new Ar(t,r,[s,o]);let i=ot(e,r),c=ot(e,n);if(i===c)return a=>new Kt(t,nt(i)|nt(c),[a]);{let a=i<c?[o,s]:[s,o];return new Kt(t,nt(i)|nt(c),a)}}function ln(t,e,r,o,n,s){let i,c=e;for(;;){let a=_i(t,c,r,o,n,s);if(typeof a=="function")i=pn(a,i),c=c+5;else{let p=a;for(;i!=null;)p=i.value(p),i=i.previous;return p}}}var fn="effect/HashMap",Mr=Symbol.for(fn),Oi={[Mr]:Mr,[Symbol.iterator](){return new Ee(this,(t,e)=>[t,e])},[f](){let t=l(fn);for(let e of this)t^=b(l(e[0]),M(l(e[1])));return S(this,t)},[m](t){if(bi(t)){if(t._size!==this._size)return!1;for(let e of this){let r=b(t,Ei(e[0],l(e[0])));if(P(r))return!1;if(!x(e[1],r.value))return!1}return!0}return!1},toString(){return E(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(O)}},[y](){return this.toJSON()},pipe(){return C(this,arguments)}},Tr=(t,e,r,o)=>{let n=Object.create(Oi);return n._editable=t,n._edit=e,n._root=r,n._size=o,n},Ee=class t{map;f;v;constructor(e,r){this.map=e,this.f=r,this.v=dn(this.map._root,this.f,void 0)}next(){if(P(this.v))return{done:!0,value:void 0};let e=this.v.value;return this.v=Ce(e.cont),{done:!1,value:e.value}}[Symbol.iterator](){return new t(this.map,this.f)}},Ce=t=>t?hn(t[0],t[1],t[2],t[3],t[4]):T(),dn=(t,e,r=void 0)=>{switch(t._tag){case"LeafNode":return rt(t.value)?V({value:e(t.key,t.value.value),cont:r}):Ce(r);case"CollisionNode":case"ArrayNode":case"IndexedNode":{let o=t.children;return hn(o.length,o,0,e,r)}default:return Ce(r)}},hn=(t,e,r,o,n)=>{for(;r<t;){let s=e[r++];if(s&&!z(s))return dn(s,o,[t,e,r,o,n])}return Ce(n)},Si=Tr(!1,0,new Z,0),mn=()=>Si;var bi=t=>_(t,Mr);var Ei=u(3,(t,e,r)=>{let o=t._root,n=0;for(;;)switch(o._tag){case"LeafNode":return x(e,o.key)?o.value:T();case"CollisionNode":{if(r===o.hash){let s=o.children;for(let i=0,c=s.length;i<c;++i){let a=s[i];if("key"in a&&x(e,a.key))return a.value}}return T()}case"IndexedNode":{let s=ot(n,r),i=nt(s);if(o.mask&i){o=o.children[Se(o.mask,i)],n+=5;break}return T()}case"ArrayNode":{if(o=o.children[ot(n,r)],o){n+=5;break}return T()}default:return T()}});var Rr=u(3,(t,e,r)=>ki(t,e,()=>V(r))),Ci=u(3,(t,e,r)=>t._editable?(t._root=e,t._size=r,t):e===t._root?t:Tr(t._editable,t._edit,e,r)),xn=t=>new Ee(t,e=>e);var ke=t=>t._size,gn=t=>Tr(!0,t._edit+1,t._root,t._size);var ki=u(3,(t,e,r)=>Ii(t,e,l(e),r)),Ii=u(4,(t,e,r,o)=>{let n={value:t._size},s=t._root.modify(t._editable?t._edit:NaN,0,o,r,e,n);return b(t,Ci(s,n.value))});var _n=u(2,(t,e)=>yn(t,void 0,(r,o,n)=>e(o,n))),yn=u(3,(t,e,r)=>{let o=t._root;if(o._tag==="LeafNode")return rt(o.value)?r(e,o.value.value,o.key):e;if(o._tag==="EmptyNode")return e;let n=[o.children],s;for(;s=n.pop();)for(let i=0,c=s.length;i<c;){let a=s[i++];a&&!z(a)&&(a._tag==="LeafNode"?rt(a.value)&&(e=r(e,a.value.value,a.key)):n.push(a.children))}return e});var On="effect/HashSet",Ie=Symbol.for(On),vi={[Ie]:Ie,[Symbol.iterator](){return xn(this._keyMap)},[f](){return S(this,M(l(this._keyMap))(l(On)))},[m](t){return Sn(t)?ke(this._keyMap)===ke(t._keyMap)&&x(this._keyMap,t._keyMap):!1},toString(){return E(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(O)}},[y](){return this.toJSON()},pipe(){return C(this,arguments)}},Nr=t=>{let e=Object.create(vi);return e._keyMap=t,e},Sn=t=>_(t,Ie),Mi=Nr(mn()),Pr=()=>Mi;var bn=t=>ke(t._keyMap),En=t=>Nr(gn(t._keyMap)),Cn=t=>(t._keyMap._editable=!1,t),kn=u(2,(t,e)=>{let r=En(t);return e(r),Cn(r)}),Ae=u(2,(t,e)=>t._keyMap._editable?(Rr(e,!0)(t._keyMap),t):Nr(Rr(e,!0)(t._keyMap)));var In=u(2,(t,e)=>kn(Pr(),r=>{An(t,o=>Ae(r,o));for(let o of e)Ae(r,o)}));var An=u(2,(t,e)=>_n(t._keyMap,(r,o)=>e(o)));var Zt=Pr;var vn=bn;var ve=Ae;var Me=In;var Ri=Object.assign(Object.create(Array.prototype),{[f](){return S(this,fe(this))},[m](t){return Array.isArray(t)&&this.length===t.length?this.every((e,r)=>x(e,t[r])):!1}}),Mn=function(){function t(e){e&&Object.assign(this,e)}return t.prototype=pr,t}();var Fr="Die",we="Empty",Te="Fail",Lr="Interrupt",It="Parallel",At="Sequential";var Pn="effect/Cause",Fn=Symbol.for(Pn),Fi={_E:t=>t},Hr={[Fn]:Fi,[f](){return b(l(Pn),M(l(Hi(this))),S(this))},[m](t){return Li(t)&&Ui(this,t)},pipe(){return C(this,arguments)},toJSON(){switch(this._tag){case"Empty":return{_id:"Cause",_tag:this._tag};case"Die":return{_id:"Cause",_tag:this._tag,defect:O(this.defect)};case"Interrupt":return{_id:"Cause",_tag:this._tag,fiberId:this.fiberId.toJSON()};case"Fail":return{_id:"Cause",_tag:this._tag,failure:O(this.error)};case"Sequential":case"Parallel":return{_id:"Cause",_tag:this._tag,left:O(this.left),right:O(this.right)}}},toString(){return qr(this)},[y](){return this.toJSON()}};var Ne=t=>{let e=Object.create(Hr);return e._tag=Te,e.error=t,e};var Ln=(t,e)=>{let r=Object.create(Hr);return r._tag=It,r.left=t,r.right=e,r},Qt=(t,e)=>{let r=Object.create(Hr);return r._tag=At,r.left=t,r.right=e,r},Li=t=>_(t,Fn);var Un=t=>Hn(void 0,Di)(t);var Ui=(t,e)=>{let r=ft(t),o=ft(e);for(;xe(r)&&xe(o);){let[n,s]=b(ge(r),Rn([Zt(),lt()],([a,p],h)=>{let[g,v]=Ur(h);return V([b(a,Me(g)),b(p,K(v))])})),[i,c]=b(ge(o),Rn([Zt(),lt()],([a,p],h)=>{let[g,v]=Ur(h);return V([b(a,Me(g)),b(p,K(v))])}));if(!x(n,i))return!1;r=s,o=c}return!0},Hi=t=>qi(ft(t),lt()),qi=(t,e)=>{for(;;){let[r,o]=b(t,yr([Zt(),lt()],([s,i],c)=>{let[a,p]=Ur(c);return[b(s,Me(a)),b(i,K(p))]})),n=vn(r)>0?b(e,me(r)):e;if(Bo(o))return Vt(n);t=o,e=n}throw new Error(Gt("Cause.flattenCauseLoop"))};var Ur=t=>{let e=t,r=[],o=Zt(),n=lt();for(;e!==void 0;)switch(e._tag){case we:{if(r.length===0)return[o,n];e=r.pop();break}case Te:{if(o=ve(o,Yt(e._tag,e.error)),r.length===0)return[o,n];e=r.pop();break}case Fr:{if(o=ve(o,Yt(e._tag,e.defect)),r.length===0)return[o,n];e=r.pop();break}case Lr:{if(o=ve(o,Yt(e._tag,e.fiberId)),r.length===0)return[o,n];e=r.pop();break}case At:{switch(e.left._tag){case we:{e=e.right;break}case At:{e=Qt(e.left.left,Qt(e.left.right,e.right));break}case It:{e=Ln(Qt(e.left.left,e.right),Qt(e.left.right,e.right));break}default:{n=me(n,e.right),e=e.left;break}}break}case It:{r.push(e.right),e=e.left;break}}throw new Error(Gt("Cause.evaluateCauseLoop"))};var Di={emptyCase:ae,failCase:Qe,dieCase:Qe,interruptCase:ae,sequentialCase:(t,e,r)=>e&&r,parallelCase:(t,e,r)=>e&&r};var wn="SequentialCase",Tn="ParallelCase";var Rn=u(3,(t,e,r)=>{let o=e,n=t,s=[];for(;n!==void 0;){let i=r(o,n);switch(o=rt(i)?i.value:o,n._tag){case At:{s.push(n.right),n=n.left;break}case It:{s.push(n.right),n=n.left;break}default:{n=void 0;break}}n===void 0&&s.length>0&&(n=s.pop())}return o}),Hn=u(3,(t,e,r)=>{let o=[t],n=[];for(;o.length>0;){let i=o.pop();switch(i._tag){case we:{n.push(zt(r.emptyCase(e)));break}case Te:{n.push(zt(r.failCase(e,i.error)));break}case Fr:{n.push(zt(r.dieCase(e,i.defect)));break}case Lr:{n.push(zt(r.interruptCase(e,i.fiberId)));break}case At:{o.push(i.right),o.push(i.left),n.push(gr({_tag:wn}));break}case It:{o.push(i.right),o.push(i.left),n.push(gr({_tag:Tn}));break}}}let s=[];for(;n.length>0;){let i=n.pop();switch(i._tag){case"Left":{switch(i.left._tag){case wn:{let c=s.pop(),a=s.pop(),p=r.sequentialCase(e,c,a);s.push(p);break}case Tn:{let c=s.pop(),a=s.pop(),p=r.parallelCase(e,c,a);s.push(p);break}}break}case"Right":{s.push(i.right);break}}}if(s.length===0)throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return s.pop()}),qr=(t,e)=>Un(t)?"All fibers interrupted without errors.":zi(t).map(function(r){return e?.renderErrorCause!==!0||r.cause===void 0?r.stack:`${r.stack} {
5
+ ${qn(r.cause," ")}
6
+ }`}).join(`
7
+ `),qn=(t,e)=>{let r=t.stack.split(`
8
+ `),o=`${e}[cause]: ${r[0]}`;for(let n=1,s=r.length;n<s;n++)o+=`
9
+ ${e}${r[n]}`;return t.cause&&(o+=` {
10
+ ${qn(t.cause,`${e} `)}
11
+ ${e}}`),o},Re=class t extends globalThis.Error{span=void 0;constructor(e){let r=typeof e=="object"&&e!==null,o=Error.stackTraceLimit;Error.stackTraceLimit=1,super(Bi(e),r&&"cause"in e&&typeof e.cause<"u"?{cause:new t(e.cause)}:void 0),this.message===""&&(this.message="An error has occurred"),Error.stackTraceLimit=o,this.name=e instanceof Error?e.name:"Error",r&&(Nn in e&&(this.span=e[Nn]),Object.keys(e).forEach(n=>{n in this||(this[n]=e[n])})),this.stack=Gi(`${this.name}: ${this.message}`,e instanceof Error&&e.stack?e.stack:"",this.span)}},Bi=t=>{if(typeof t=="string")return t;if(typeof t=="object"&&t!==null&&t instanceof Error)return t.message;try{if(_(t,"toString")&&Wt(t.toString)&&t.toString!==Object.prototype.toString&&t.toString!==globalThis.Array.prototype.toString)return t.toString()}catch{}return ir(t)},ji=/\((.*)\)/g,Wi=L("effect/Tracer/spanToTrace",()=>new WeakMap),Gi=(t,e,r)=>{let o=[t],n=e.startsWith(t)?e.slice(t.length).split(`
12
+ `):e.split(`
13
+ `);for(let s=1;s<n.length&&!n[s].includes("Generator.next");s++){if(n[s].includes("effect_internal_function")){o.pop();break}o.push(n[s].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(r){let s=r,i=0;for(;s&&s._tag==="Span"&&i<10;){let c=Wi.get(s);if(typeof c=="function"){let a=c();if(typeof a=="string"){let p=a.matchAll(ji),h=!1;for(let[,g]of p)h=!0,o.push(` at ${s.name} (${g})`);h||o.push(` at ${s.name} (${a.replace(/^at /,"")})`)}else o.push(` at ${s.name}`)}else o.push(` at ${s.name}`);s=Fo(s.parent),i++}}return o.join(`
14
+ `)},Nn=Symbol.for("effect/SpanAnnotation"),zi=t=>Hn(t,void 0,{emptyCase:()=>[],dieCase:(e,r)=>[new Re(r)],failCase:(e,r)=>[new Re(r)],interruptCase:()=>[],parallelCase:(e,r,o)=>[...r,...o],sequentialCase:(e,r,o)=>[...r,...o]});var vt=class t{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new t(this.self)}};var Pe=Symbol.for("effect/Effect");var Dr=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Pe]=et;constructor(e){this._op=e}[m](e){return this===e}[f](){return S(this,Ot(this))}pipe(){return C(this,arguments)}toJSON(){return{_id:"Effect",_op:this._op,effect_instruction_i0:O(this.effect_instruction_i0),effect_instruction_i1:O(this.effect_instruction_i1),effect_instruction_i2:O(this.effect_instruction_i2)}}toString(){return E(this.toJSON())}[y](){return this.toJSON()}[Symbol.iterator](){return new vt(new J(this))}},Br=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Pe]=et;constructor(e){this._op=e,this._tag=e}[m](e){return Qn(e)&&e._op==="Failure"&&x(this.effect_instruction_i0,e.effect_instruction_i0)}[f](){return b(U(this._tag),M(l(this.effect_instruction_i0)),S(this))}get cause(){return this.effect_instruction_i0}pipe(){return C(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return E(this.toJSON())}[y](){return this.toJSON()}[Symbol.iterator](){return new vt(new J(this))}},Dn=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Pe]=et;constructor(e){this._op=e,this._tag=e}[m](e){return Qn(e)&&e._op==="Success"&&x(this.effect_instruction_i0,e.effect_instruction_i0)}[f](){return b(U(this._tag),M(l(this.effect_instruction_i0)),S(this))}get value(){return this.effect_instruction_i0}pipe(){return C(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:O(this.value)}}toString(){return E(this.toJSON())}[y](){return this.toJSON()}[Symbol.iterator](){return new vt(new J(this))}},$i=t=>_(t,Pe),Vi=t=>{let e=new Dr(yo);return e.effect_instruction_i0=t,e};var jr=Symbol.for("effect/SpanAnnotation"),Bn=Symbol.for("effect/OriginalAnnotation");var Yi=(t,e)=>rt(e)?new Proxy(t,{has(r,o){return o===jr||o===Bn||o in r},get(r,o){return o===jr?e.value:o===Bn?t:r[o]}}):t;var Ki=t=>rr(t)&&!(jr in t)?Vi(e=>jn(Ne(Yi(t,tc(e))))):jn(Ne(t));var jn=t=>{let e=new Br(_o);return e.effect_instruction_i0=t,e};var Vu={_tag:"All",syslog:0,label:"ALL",ordinal:Number.MIN_SAFE_INTEGER,pipe(){return C(this,arguments)}};var Yu={_tag:"None",syslog:7,label:"OFF",ordinal:Number.MAX_SAFE_INTEGER,pipe(){return C(this,arguments)}};var Zi="effect/RequestResolver",Zn=Symbol.for(Zi),Qi={_A:t=>t,_R:t=>t},Wn=class t{runAll;target;[Zn]=Qi;constructor(e,r){this.runAll=e,this.target=r}[f](){return S(this,this.target?l(this.target):Ot(this))}[m](e){return this.target?Xi(e)&&x(this.target,e.target):this===e}identified(...e){return new t(this.runAll,qo(e))}pipe(){return C(this,arguments)}},Xi=t=>_(t,Zn);var Wr=function(){class t extends globalThis.Error{commit(){return Ki(this)}toJSON(){return{...this}}[y](){return this.toString!==globalThis.Error.prototype.toString?this.stack?`${this.toString()}
15
+ ${this.stack.split(`
16
+ `).slice(1).join(`
17
+ `)}`:this.toString():"Bun"in globalThis?qr(Ne(this),{renderErrorCause:!0}):this}}return Object.assign(t.prototype,lr),t}(),ht=(t,e)=>{class r extends Wr{_tag=e}return Object.assign(r.prototype,t),r.prototype.name=e,r},Gn=Symbol.for("effect/Cause/errors/RuntimeException"),Ku=ht({[Gn]:Gn},"RuntimeException");var zn=Symbol.for("effect/Cause/errors/InterruptedException"),Zu=ht({[zn]:zn},"InterruptedException");var Jn=Symbol.for("effect/Cause/errors/IllegalArgument"),Qu=ht({[Jn]:Jn},"IllegalArgumentException");var $n=Symbol.for("effect/Cause/errors/NoSuchElement"),Xu=ht({[$n]:$n},"NoSuchElementException");var Vn=Symbol.for("effect/Cause/errors/InvalidPubSubCapacityException"),tl=ht({[Vn]:Vn},"InvalidPubSubCapacityException"),Yn=Symbol.for("effect/Cause/errors/ExceededCapacityException"),el=ht({[Yn]:Yn},"ExceededCapacityException");var Kn=Symbol.for("effect/Cause/errors/Timeout"),rl=ht({[Kn]:Kn},"TimeoutException");var Qn=t=>$i(t)&&"_tag"in t&&(t._tag==="Success"||t._tag==="Failure");var tc=t=>{let e=t.currentSpan;return e!==void 0&&e._tag==="Span"?V(e):T()};var Xt=Mn,Xn=t=>{class e extends Xt{_tag=t}return e};var rc=function(){let t=Symbol.for("effect/Data/Error/plainArgs");return class extends Wr{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0),r&&(Object.assign(this,r),Object.defineProperty(this,t,{value:r,enumerable:!1}))}toJSON(){return{...this[t],...this}}}}(),Mt=t=>{class e extends rc{_tag=t}return e.prototype.name=t,e};var ee=class t extends Xn("BotResponse"){static make(e){return new t({response:e})}static ignore=new t({})};var ts=$;var ss=Symbol.for("effect/Micro"),Fe=Symbol.for("effect/Micro/MicroExit"),re=t=>typeof t=="object"&&t!==null&&ss in t,es=Symbol.for("effect/Micro/MicroCause");var nc={_E:A},oe=class extends globalThis.Error{_tag;traces;[es];constructor(e,r,o){let n=`MicroCause.${e}`,s,i,c;if(r instanceof globalThis.Error){s=`(${n}) ${r.name}`,i=r.message;let a=i.split(`
18
+ `).length;c=r.stack?`(${n}) ${r.stack.split(`
19
+ `).slice(0,a+3).join(`
20
+ `)}`:`${s}: ${i}`}else s=n,i=xo(r,0),c=`${s}: ${i}`;o.length>0&&(c+=`
21
+ ${o.join(`
22
+ `)}`),super(i),this._tag=e,this.traces=o,this[es]=nc,this.name=s,this.stack=c}pipe(){return C(this,arguments)}toString(){return this.stack}[y](){return this.stack}},zr=class extends oe{error;constructor(e,r=[]){super("Fail",e,r),this.error=e}},sc=(t,e=[])=>new zr(t,e),Jr=class extends oe{defect;constructor(e,r=[]){super("Die",e,r),this.defect=e}},ic=(t,e=[])=>new Jr(t,e),$r=class extends oe{constructor(e=[]){super("Interrupt","interrupted",e)}},cc=(t=[])=>new $r(t),ac=t=>t._tag==="Fail";var is=t=>t._tag==="Interrupt";var rs=Symbol.for("effect/Micro/MicroFiber"),pc={_A:A,_E:A},Le=class{context;interruptible;[rs];_stack=[];_observers=[];_exit;_children;currentOpCount=0;constructor(e,r=!0){this.context=e,this.interruptible=r,this[rs]=pc}getRef(e){return Zo(this.context,e)}addObserver(e){return this._exit?(e(this._exit),so):(this._observers.push(e),()=>{let r=this._observers.indexOf(e);r>=0&&this._observers.splice(r,1)})}_interrupted=!1;unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(Qr))}unsafePoll(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){let n=this._yielded;this._yielded=void 0,n()}let r=this.runLoop(e);if(r===wt)return;let o=os.interruptChildren&&os.interruptChildren(this);if(o!==void 0)return this.evaluate(B(o,()=>r));this._exit=r;for(let n=0;n<this._observers.length;n++)this._observers[n](r);this._observers.length=0}runLoop(e){let r=!1,o=e;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!r&&this.getRef(Nt).shouldYield(this)){r=!0;let n=o;o=B(us,()=>n)}if(o=o[Vr](this),o===wt){let n=this._yielded;return Fe in n?(this._yielded=void 0,n):wt}}}catch(n){return _(o,Vr)?He(n):He(`MicroFiber.runLoop: Not a valid effect: ${String(o)}`)}}getCont(e){for(;;){let r=this._stack.pop();if(!r)return;let o=r[Ue]&&r[Ue](this);if(o)return{[e]:o};if(r[e])return r}}_yielded=void 0;yieldWith(e){return this._yielded=e,wt}children(){return this._children??=new Set}},os=L("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0}));var uc=t=>De(e=>Rt(t.addObserver(r=>e(k(r)))));var cs=t=>X(()=>(t.unsafeInterrupt(),_c(uc(t)))),lc=t=>X(()=>{for(let o of t)o.unsafeInterrupt();let e=t[Symbol.iterator](),r=X(()=>{let o=e.next();for(;!o.done;){if(o.value.unsafePoll()){o=e.next();continue}let n=o.value;return De(s=>{n.addObserver(i=>{s(r)})})}return gt});return r}),as=Symbol.for("effect/Micro/identifier"),d=Symbol.for("effect/Micro/args"),Vr=Symbol.for("effect/Micro/evaluate"),Q=Symbol.for("effect/Micro/successCont"),mt=Symbol.for("effect/Micro/failureCont"),Ue=Symbol.for("effect/Micro/ensureCont"),wt=Symbol.for("effect/Micro/Yield"),fc={_A:A,_E:A,_R:A},dc={...ts,_op:"Micro",[ss]:fc,pipe(){return C(this,arguments)},[Symbol.iterator](){return new ut(new J(this))},toJSON(){return{_id:"Micro",op:this[as],...d in this?{args:this[d]}:void 0}},toString(){return E(this)},[y](){return E(this)}};function hc(t){return He("Micro.evaluate: Not implemented")}var ne=t=>({...dc,[as]:t.op,[Vr]:t.eval??hc,[Q]:t.contA,[mt]:t.contE,[Ue]:t.ensure}),tt=t=>{let e=ne(t);return function(){let r=Object.create(e);return r[d]=t.single===!1?arguments:arguments[0],r}},ps=t=>{let e={...ne(t),[Fe]:Fe,_tag:t.op,get[t.prop](){return this[d]},toJSON(){return{_id:"MicroExit",_tag:t.op,[t.prop]:this[d]}},[m](r){return Sc(r)&&r._tag===t.op&&x(this[d],r[d])},[f](){return S(this,M(U(t.op))(l(this[d])))}};return function(r){let o=Object.create(e);return o[d]=r,o[Q]=void 0,o[mt]=void 0,o[Ue]=void 0,o}},k=ps({op:"Success",prop:"value",eval(t){let e=t.getCont(Q);return e?e[Q](this[d],t):t.yieldWith(this)}}),Tt=ps({op:"Failure",prop:"cause",eval(t){let e=t.getCont(mt);for(;is(this[d])&&e&&t.interruptible;)e=t.getCont(mt);return e?e[mt](this[d],t):t.yieldWith(this)}}),D=t=>Tt(sc(t)),Rt=tt({op:"Sync",eval(t){let e=this[d](),r=t.getCont(Q);return r?r[Q](e,t):t.yieldWith(Be(e))}}),X=tt({op:"Suspend",eval(t){return this[d]()}}),mc=tt({op:"Yield",eval(t){let e=!1;return t.getRef(Nt).scheduleTask(()=>{e||t.evaluate(gt)},this[d]??0),t.yieldWith(()=>{e=!0})}}),us=mc(0);var xt=k(void 0);var Zr=t=>X(()=>{try{return k(t.try())}catch(e){return D(t.catch(e))}});var Pt=t=>ls(function(e,r){try{t.try(r).then(o=>e(k(o)),o=>e(D(t.catch(o))))}catch(o){e(D(t.catch(o)))}},t.try.length!==0),Ft=tt({op:"WithMicroFiber",eval(t){return this[d](t)}});var ls=tt({op:"Async",single:!1,eval(t){let e=this[d][0],r=!1,o=!1,n=this[d][1]?new AbortController:void 0,s=e(i=>{r||(r=!0,o?t.evaluate(i):o=i)},n?.signal);return o!==!1?o:(o=!0,t._yielded=()=>{r=!0},n===void 0&&s===void 0||t._stack.push(xc(()=>(r=!0,n?.abort(),s??gt))),wt)}}),xc=tt({op:"AsyncFinalizer",ensure(t){t.interruptible&&(t.interruptible=!1,t._stack.push(to(!0)))},contE(t,e){return is(t)?B(this[d](),()=>Tt(t)):Tt(t)}}),De=t=>ls(t,t.length>=2);var j=(...t)=>X(()=>gc(t.length===1?t[0]():t[1].call(t[0]))),gc=tt({op:"Iterator",contA(t,e){let r=this[d].next(t);return r.done?k(r.value):(e._stack.push(this),lo(r.value))},eval(t){return this[Q](void 0,t)}}),fs=u(2,(t,e)=>Oc(t,r=>e));var W=u(2,(t,e)=>B(t,r=>{let o=re(e)?e:typeof e=="function"?e(r):e;return re(o)?o:k(o)})),se=u(2,(t,e)=>B(t,r=>{let o=re(e)?e:typeof e=="function"?e(r):e;return re(o)?fs(o,r):k(r)})),_c=t=>B(t,e=>gt),ds=t=>Mc(t,{onFailure:je,onSuccess:Be});var B=u(2,(t,e)=>{let r=Object.create(yc);return r[d]=t,r[Q]=e,r}),yc=ne({op:"OnSuccess",eval(t){return t._stack.push(this),this[d]}});var Oc=u(2,(t,e)=>B(t,r=>k(e(r)))),Sc=t=>_(t,Fe),Be=k,je=Tt,Qr=je(cc());var He=t=>je(ic(t));var gt=Be(void 0),bc=t=>{for(let e of t)if(e._tag==="Failure")return e;return gt},Ec="setImmediate"in globalThis?globalThis.setImmediate:t=>setTimeout(t,0),qe=class{tasks=[];running=!1;scheduleTask(e,r){this.tasks.push(e),this.running||(this.running=!0,Ec(this.afterScheduled))}afterScheduled=()=>{this.running=!1,this.runTasks()};runTasks(){let e=this.tasks;this.tasks=[];for(let r=0,o=e.length;r<o;r++)e[r]()}shouldYield(e){return e.currentOpCount>=e.getRef(Yr)}flush(){for(;this.tasks.length>0;)this.runTasks()}},R=t=>Ft(e=>k(on(e.context,t)));var hs=u(2,(t,e)=>Ft(r=>{let o=r.context;return r.context=e(o),wc(t,()=>(r.context=o,xt))}));var Xr=u(2,(t,e)=>hs(t,nn(e))),We=u(3,(t,e,r)=>hs(t,rn(e,r)));var Yr=class extends q()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){},Kr=class extends q()("effect/Micro/currentConcurrency",{defaultValue:()=>"unbounded"}){},Nt=class extends q()("effect/Micro/currentScheduler",{defaultValue:()=>new qe}){};var Cc=u(2,(t,e)=>X(()=>{let r=e.schedule?Date.now():0,o=0,n=B(ds(t),s=>{if(e.while!==void 0&&!e.while(s))return s;if(e.times!==void 0&&o>=e.times)return s;o++;let i=us;if(e.schedule!==void 0){let c=Date.now()-r,a=e.schedule(o,c);if(P(a))return s;i=gs(a.value)}return B(i,()=>n)});return n})),ms=u(t=>re(t[0]),(t,e)=>Cc(t,{...e,while:r=>r._tag==="Success"&&(e?.while===void 0||e.while(r.value))}));var kc=u(2,(t,e)=>{let r=Object.create(Ic);return r[d]=t,r[mt]=e,r}),Ic=ne({op:"OnFailure",eval(t){return t._stack.push(this),this[d]}}),Ac=u(3,(t,e,r)=>kc(t,o=>e(o)?r(o):Tt(o))),Ge=u(2,(t,e)=>Ac(t,ac,r=>e(r.error)));var xs=u(2,(t,e)=>{let r=Object.create(vc);return r[d]=t,r[Q]=e.onSuccess,r[mt]=e.onFailure,r}),vc=ne({op:"OnSuccessAndFailure",eval(t){return t._stack.push(this),this[d]}}),Mc=u(2,(t,e)=>xs(t,{onFailure:r=>Rt(()=>e.onFailure(r)),onSuccess:r=>Rt(()=>e.onSuccess(r))}));var gs=t=>De(e=>{let r=setTimeout(()=>{e(xt)},t);return Rt(()=>{clearTimeout(r)})}),_s=u(2,(t,e)=>W(gs(e),t));var Gr=Symbol.for("effect/Micro/MicroScope");var ns=class t{[Gr];state={_tag:"Open",finalizers:new Set};constructor(){this[Gr]=Gr}unsafeAddFinalizer(e){this.state._tag==="Open"&&this.state.finalizers.add(e)}addFinalizer(e){return X(()=>this.state._tag==="Open"?(this.state.finalizers.add(e),xt):e(this.state.exit))}unsafeRemoveFinalizer(e){this.state._tag==="Open"&&this.state.finalizers.delete(e)}close(e){return X(()=>{if(this.state._tag==="Open"){let r=Array.from(this.state.finalizers).reverse();return this.state={_tag:"Closed",exit:e},B(eo(r,o=>ds(o(e))),bc)}return xt})}get fork(){return Rt(()=>{let e=new t;if(this.state._tag==="Closed")return e.state=this.state,e;function r(o){return e.close(o)}return this.state.finalizers.add(r),e.unsafeAddFinalizer(o=>Rt(()=>this.unsafeRemoveFinalizer(r))),e})}};var wc=u(2,(t,e)=>Rc(r=>xs(r(t),{onFailure:o=>B(e(je(o)),()=>Tt(o)),onSuccess:o=>B(e(Be(o)),()=>k(o))})));var to=tt({op:"SetInterruptible",ensure(t){if(t.interruptible=this[d],t._interrupted&&t.interruptible)return()=>Qr}}),Tc=t=>Ft(e=>e.interruptible?t:(e.interruptible=!0,e._stack.push(to(!1)),e._interrupted?Qr:t)),Rc=t=>Ft(e=>e.interruptible?(e.interruptible=!1,e._stack.push(to(!0)),t(Tc)):t(A));var Nc=tt({op:"While",contA(t,e){return this[d].step(t),this[d].while()?(e._stack.push(this),this[d].body()):gt},eval(t){return this[d].while()?(t._stack.push(this),this[d].body()):gt}}),eo=(t,e,r)=>Ft(o=>{let n=r?.concurrency==="inherit"?o.getRef(Kr):r?.concurrency??1,s=n==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,n),i=$t(t),c=i.length;if(c===0)return r?.discard?xt:k([]);let a=r?.discard?void 0:new Array(c),p=0;return s===1?fs(Nc({while:()=>p<i.length,body:()=>e(i[p],p),step:a?h=>a[p++]=h:h=>p++}),a):De(h=>{let g=new Set,v,I=0,Dt=0,it=!1,ct=!1;function at(){for(it=!0;I<s&&p<c;){let pt=p,ws=i[pt];p++,I++;try{let Bt=ys(o,e(ws,pt),!0,!0);g.add(Bt),Bt.addObserver(jt=>{g.delete(Bt),!ct&&(jt._tag==="Failure"?v===void 0&&(v=jt,c=p,g.forEach(Ts=>Ts.unsafeInterrupt())):a!==void 0&&(a[pt]=jt.value),Dt++,I--,Dt===c?h(v??k(a)):!it&&I<s&&at())})}catch(Bt){v=He(Bt),c=p,g.forEach(jt=>jt.unsafeInterrupt())}}it=!1}return at(),X(()=>(ct=!0,p=c,lc(g)))})});var ys=(t,e,r=!1,o=!1)=>{let n=new Le(t.context,t.interruptible);return o||(t.children().add(n),n.addObserver(()=>t.children().delete(n))),r?n.evaluate(e):t.getRef(Nt).scheduleTask(()=>n.evaluate(e),0),n},Os=t=>Ft(e=>k(ys(e,t,!1,!0)));var Pc=(t,e)=>{let r=new Le(Nt.context(e?.scheduler??new qe));if(r.evaluate(t),e?.signal)if(e.signal.aborted)r.unsafeInterrupt();else{let o=()=>r.unsafeInterrupt();e.signal.addEventListener("abort",o,{once:!0}),r.addObserver(()=>e.signal.removeEventListener("abort",o))}return r},Fc=(t,e)=>new Promise((r,o)=>{Pc(t,e).addObserver(r)}),ze=(t,e)=>Fc(t,e).then(r=>{if(r._tag==="Failure")throw r.cause;return r.value});var Ss=t=>{let e=t[0];for(let r=1;r<t.length;r++)e+=t[r]==="_"?t[++r].toUpperCase():t[r];return e};var _t=class extends Mt("TgBotClientError"){};var bs=t=>typeof t=="object"&&t!=null&&"file_content"in t&&t.file_content instanceof Uint8Array&&"file_name"in t&&typeof t.file_name=="string",Es=t=>typeof t=="object"&&t!=null&&"ok"in t&&typeof t.ok=="boolean";var Cs="https://api.telegram.org",ro={"\u{1F525}":"5104841245755180586","\u{1F44D}":"5107584321108051014","\u{1F44E}":"5104858069142078462","\u2764\uFE0F":"5159385139981059251","\u{1F389}":"5046509860389126442","\u{1F4A9}":"5046589136895476101"},Ol=Object.keys(ro);var Je=class extends q()("TgBotApiBaseUrl",{defaultValue:()=>Cs}){},Ut=class extends Oe("TgBotApiToken")(){};var ks=t=>{let e=Object.entries(t);if(e.length==0)return;let r=new FormData;for(let[o,n]of e)n&&(typeof n!="object"?r.append(o,`${n}`):bs(n)?r.append(o,new Blob([n.file_content]),n.file_name):r.append(o,JSON.stringify(n)));return r};var ie=(t,e)=>j(function*(){let r=yield*R(Ut),o=yield*R(Je),n=yield*Pt({try:()=>fetch(`${o}/bot${r}/${Ss(t)}`,{body:ks(e)??null,method:"POST"}),catch:i=>new _t({cause:{_tag:"ClientInternalError",cause:i}})}),s=yield*Pt({try:()=>n.json(),catch:()=>new _t({cause:{_tag:"NotJsonResponse",response:n}})});return Es(s)?n.ok?s.result:yield*D(new _t({cause:{_tag:"NotOkResponse",...s.error_code?{errorCode:s.error_code}:void 0,...s.description?{details:s.description}:void 0}})):yield*D(new _t({cause:{_tag:"UnexpectedResponse",response:s}}))});var st=class extends Oe("BotUpdateHandlers")(){},Ht=class t extends Xt{static make(e){let r=e.batch_size??10,o=e.poll_timeout??10,n=e.max_empty_responses,s=e.log_level??"info",i=e.on_error;(r<10||r>100)&&(console.warn("Wrong batch_size, must be in [10..100], using 10 instead"),r=10),(o<2||o>120)&&(console.warn("Wrong poll_timeout, must be in [2..120], using 20 instead"),o=20),n&&n<2&&(console.warn("Wrong max_empty_responses, must be in [2..infinity], using infinity"),n=void 0),s||(s="info"),i||(i="stop");let c=new t({batch_size:r,poll_timeout:o,max_empty_responses:n,log_level:s,on_error:i});return console.log("bot poll settings",c),c}},F=class extends q()("BotSettings",{defaultValue(){return Ht.make({})}}){};var Is=t=>{for(let[e,r]of Object.entries(t))if(e!="update_id")return{type:e,...r}},qt=class extends Xt{},oo=t=>j(function*(){let e=yield*R(F),r=yield*R(st);return r.type=="single"?yield*vs(t,r,e):yield*As(t,r)}),As=(t,e)=>Zr({try:()=>e.on_batch(t),catch:A}).pipe(W(r=>r instanceof Promise?Pt({try:()=>r,catch:A}):k(r)),W(r=>new qt({hasErrors:!r,updates:t})),Ge(r=>(console.warn("handle batch error",{errorMessage:r instanceof Error?r.message:void 0,updates:t.map(o=>Object.keys(o).at(1)),error:r}),k(new qt({hasErrors:!0,updates:t}))))),yt=class extends Mt("HandleUpdateError"){},vs=(t,e,r)=>eo(t,o=>Ms(o,e).pipe(Ge(n=>(console.log("update handle error",{updateId:o.update_id,updateKey:Object.keys(o).at(1),name:n._tag,...n.cause instanceof Error?{error:n.cause.message}:void 0}),k(n)))),{concurrency:10}).pipe(W(o=>(r.log_level=="debug"&&console.debug("handle batch result",o),new qt({hasErrors:!o.every(n=>n==null),updates:t})))),Ms=(t,e)=>j(function*(){let r=Is(t);if(!r)return yield*D(new yt({name:"UnknownUpdate",update:t}));let o=e[`on_${r.type}`];if(!o)return yield*D(new yt({name:"HandlerNotDefined",update:t}));r.type=="message"&&"text"in r&&console.info("Got a new text message",{chatId:r.chat.id,chatType:r.chat.type,message:`${r.text.slice(0,5)}...`});let n,s=yield*Zr({try:()=>o(r),catch:c=>new yt({name:"BotHandlerError",update:t,cause:c})}).pipe(W(c=>c instanceof Promise?Pt({try:()=>c,catch:a=>new yt({name:"BotHandlerError",update:t,cause:a})}):k(c)),Ge(c=>(n=c,console.log("error",{updateId:t.update_id,updateKey:Object.keys(t).at(1),name:c._tag,...c.cause instanceof Error?{error:c.cause.message}:void 0}),k(ee.make({type:"message",text:`Some internal error has happend(${c.name}) while handling this message`,message_effect_id:ro["\u{1F4A9}"],...t.message?.message_id?{reply_parameters:{message_id:t.message?.message_id}}:void 0}))))),i=yield*R(F);if(!s&&i.log_level=="debug"){console.log(`Bot response is undefined for update with ID #${t.update_id}.`);return}if("chat"in r&&s.response){let c=yield*ie(`send_${s.response.type}`,{...s.response,chat_id:r.chat.id});i.log_level=="debug"&&console.debug("bot response",c)}return n});var $e=class extends q()("BotFetchUpdatesService",{defaultValue:()=>{let e={lastUpdateId:void 0,emptyResponses:0},r=Uc(e).pipe(se(n=>{let s=n.map(i=>i.update_id).sort().at(-1);console.log("updating last update id",s),e.lastUpdateId=s?s+1:void 0,console.log(e)})),o=Hc(e);return{state:e,fetchUpdates:r,commit:o}}}){},Ve=class extends Mt("FetchUpdatesError"){},Uc=t=>j(function*(){let e=yield*R(F);if(e.max_empty_responses&&t.emptyResponses==e.max_empty_responses)return yield*D(new Ve({name:"TooManyEmptyResponses"}));let r=t.lastUpdateId;e.log_level=="debug"&&console.debug("getting updates",t);let o=yield*ie("get_updates",{timeout:e.poll_timeout,...r?{offset:r}:void 0}).pipe(W(n=>n.sort(s=>s.update_id)));return o.length?(console.debug(`got a batch of updates (${o.length})`),t.emptyResponses=0,o):(t.emptyResponses+=1,[])}),Hc=t=>j(function*(){return console.log("commit",{pollState:t}),t.lastUpdateId?yield*ie("get_updates",{offset:t.lastUpdateId,limit:0}).pipe(W(W(R(F),e=>{e.log_level=="debug"&&console.debug("committed offset",t)}))):yield*D(new Ve({name:"NoUpdatesToCommit"}))});var ce=class extends q()("BotRunService",{defaultValue:()=>{console.log("Initiating BotRunService");let e={fiber:void 0};return{runBotInBackground:qc(e),getFiber:()=>e.fiber}}}){},qc=t=>j(function*(){console.log("running telegram chat bot");let e=yield*R($e),r=yield*R(F),o=s=>r.on_error=="continue"?!0:!s,n=_s(1e3)(e.fetchUpdates.pipe(W(oo),se(s=>s.updates.length>0&&o(s.hasErrors)?e.commit:xt))).pipe(ms({while:s=>o(s.hasErrors)}),Os,se(s=>s.addObserver(i=>{console.log("bot's fiber has been closed",i)})));t.fiber&&(console.log("killing previous bot's fiber"),yield*cs(t.fiber)),t.fiber=yield*n,console.log("Fetching bot updates via long polling...")});var no=t=>j(function*(){let e=yield*R(ce),r=en(Ut,t.bot_token);return yield*e.runBotInBackground.pipe(We(st,t.mode),We(F,Ht.make(t.poll??{})),Xr(r)),{reload:n=>e.runBotInBackground.pipe(We(st,n),Xr(r),ze),fiber:e.getFiber}});var Dc=t=>no(t).pipe(ze),Bc=t=>(Object.keys(t).length==0&&console.warn("No handlers are defined for bot"),t);0&&(module.exports={BatchUpdateResult,BotPollSettings,BotPollSettingsTag,BotResponse,BotRunService,BotUpdateHandlersTag,HandleUpdateError,defineBot,extractUpdate,handleEntireBatch,handleOneByOne,handleOneUpdate,handleUpdates,launchBot,runTgChatBot});
@@ -0,0 +1,22 @@
1
+ var Ye=t=>typeof t=="function",u=function(t,e){if(typeof t=="function")return function(){return t(arguments)?e.apply(this,arguments):r=>e(r,...arguments)};switch(t){case 0:case 1:throw new RangeError(`Invalid arity ${t}`);case 2:return function(r,o){return arguments.length>=2?e(r,o):function(n){return e(n,r)}};case 3:return function(r,o,n){return arguments.length>=3?e(r,o,n):function(s){return e(s,r,o)}};case 4:return function(r,o,n,s){return arguments.length>=4?e(r,o,n,s):function(i){return e(i,r,o,n)}};case 5:return function(r,o,n,s,i){return arguments.length>=5?e(r,o,n,s,i):function(c){return e(c,r,o,n,s)}};default:return function(){if(arguments.length>=t)return e.apply(this,arguments);let r=arguments;return function(o){return e(o,...r)}}}};var A=t=>t;var Ke=t=>()=>t,ie=Ke(!0),Ze=Ke(!1);var Qe=Ke(void 0),ro=Qe;function b(t,e,r,o,n,s,i,c,a){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return r(e(t));case 4:return o(r(e(t)));case 5:return n(o(r(e(t))));case 6:return s(n(o(r(e(t)))));case 7:return i(s(n(o(r(e(t))))));case 8:return c(i(s(n(o(r(e(t)))))));case 9:return a(c(i(s(n(o(r(e(t))))))));default:{let p=arguments[0];for(let h=1;h<arguments.length;h++)p=arguments[h](p);return p}}}var no=t=>(e,r)=>e===r||t(e,r);var vs="3.12.0",ce=()=>vs;var tr=Symbol.for(`effect/GlobalValue/globalStoreId/${ce()}`);tr in globalThis||(globalThis[tr]=new Map);var Xe=globalThis[tr],F=(t,e)=>(Xe.has(t)||Xe.set(t,e()),Xe.get(t));var Bt=Ye;var Ms=t=>typeof t=="object"&&t!==null,er=t=>Ms(t)||Bt(t),_=u(2,(t,e)=>er(t)&&e in t),rr=u(2,(t,e)=>_(t,"_tag")&&t._tag===e);var jt=t=>`BUG: ${t} - please report an issue at https://github.com/Effect-TS/effect/issues`;var io=Symbol.for("effect/Gen/GenKind");var co=class{value;constructor(e){this.value=e}get _F(){return A}get _R(){return e=>e}get _O(){return e=>e}get _E(){return e=>e}[io]=io;[Symbol.iterator](){return new pt(this)}},pt=class t{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new t(this.self)}};var or=Symbol.for("effect/Utils/YieldWrap"),J=class{#t;constructor(e){this.#t=e}[or](){return this.#t}};function ao(t){if(typeof t=="object"&&t!==null&&or in t)return t[or]();throw new Error(jt("yieldWrapGet"))}var N=F("effect/Utils/isStructuralRegion",()=>({enabled:!1,tester:void 0}));var Dc=function*(){}.constructor;var nr=F(Symbol.for("effect/Hash/randomHashCache"),()=>new WeakMap),f=Symbol.for("effect/Hash"),l=t=>{if(N.enabled===!0)return 0;switch(typeof t){case"number":return pe(t);case"bigint":return L(t.toString(10));case"boolean":return L(String(t));case"symbol":return L(String(t));case"string":return L(t);case"undefined":return L("undefined");case"function":case"object":return t===null?L("null"):t instanceof Date?l(t.toISOString()):ws(t)?t[f]():yt(t);default:throw new Error(`BUG: unhandled typeof ${typeof t} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},yt=t=>(nr.has(t)||nr.set(t,pe(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),nr.get(t)),M=t=>e=>e*53^t,ae=t=>t&3221225471|t>>>1&1073741824,ws=t=>_(t,f),pe=t=>{if(t!==t||t===1/0)return 0;let e=t|0;for(e!==t&&(e^=t*4294967295);t>4294967295;)e^=t/=4294967295;return ae(e)},L=t=>{let e=5381,r=t.length;for(;r;)e=e*33^t.charCodeAt(--r);return ae(e)},Ts=(t,e)=>{let r=12289;for(let o=0;o<e.length;o++)r^=b(L(e[o]),M(l(t[e[o]])));return ae(r)},po=t=>Ts(t,Object.keys(t)),ue=t=>{let e=6151;for(let r=0;r<t.length;r++)e=b(e,M(l(t[r])));return ae(e)},S=function(){if(arguments.length===1){let r=arguments[0];return function(o){return Object.defineProperty(r,f,{value(){return o},enumerable:!1}),o}}let t=arguments[0],e=arguments[1];return Object.defineProperty(t,f,{value(){return e},enumerable:!1}),e};var m=Symbol.for("effect/Equal");function x(){return arguments.length===1?t=>le(t,arguments[0]):le(arguments[0],arguments[1])}function le(t,e){if(t===e)return!0;let r=typeof t;if(r!==typeof e)return!1;if(r==="object"||r==="function"){if(t!==null&&e!==null){if(uo(t)&&uo(e))return l(t)===l(e)&&t[m](e)?!0:N.enabled&&N.tester?N.tester(t,e):!1;if(t instanceof Date&&e instanceof Date)return t.toISOString()===e.toISOString()}if(N.enabled){if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every((o,n)=>le(o,e[n]));if(Object.getPrototypeOf(t)===Object.prototype&&Object.getPrototypeOf(t)===Object.prototype){let o=Object.keys(t),n=Object.keys(e);if(o.length===n.length){for(let s of o)if(!(s in e&&le(t[s],e[s])))return N.tester?N.tester(t,e):!1;return!0}}return N.tester?N.tester(t,e):!1}}return N.enabled&&N.tester?N.tester(t,e):!1}var uo=t=>_(t,m);var y=Symbol.for("nodejs.util.inspect.custom"),O=t=>{try{if(_(t,"toJSON")&&Bt(t.toJSON)&&t.toJSON.length===0)return t.toJSON();if(Array.isArray(t))return t.map(O)}catch{return{}}return Rs(t)},E=t=>JSON.stringify(t,null,2),Kc={toJSON(){return O(this)},[y](){return this.toJSON()},toString(){return E(this.toJSON())}},lo=class{[y](){return this.toJSON()}toString(){return E(this.toJSON())}},fo=(t,e=2)=>{if(typeof t=="string")return t;try{return typeof t=="object"?sr(t,e):String(t)}catch{return String(t)}},sr=(t,e)=>{let r=[],o=JSON.stringify(t,(n,s)=>typeof s=="object"&&s!==null?r.includes(s)?void 0:r.push(s)&&(fe.fiberRefs!==void 0&&ho(s)?s[ir](fe.fiberRefs):s):s,e);return r=void 0,o},ir=Symbol.for("effect/Inspectable/Redactable"),ho=t=>typeof t=="object"&&t!==null&&ir in t,fe=F("effect/Inspectable/redactableState",()=>({fiberRefs:void 0}));var Rs=t=>ho(t)&&fe.fiberRefs!==void 0?t[ir](fe.fiberRefs):t;var C=(t,e)=>{switch(e.length){case 0:return t;case 1:return e[0](t);case 2:return e[1](e[0](t));case 3:return e[2](e[1](e[0](t)));case 4:return e[3](e[2](e[1](e[0](t))));case 5:return e[4](e[3](e[2](e[1](e[0](t)))));case 6:return e[5](e[4](e[3](e[2](e[1](e[0](t))))));case 7:return e[6](e[5](e[4](e[3](e[2](e[1](e[0](t)))))));case 8:return e[7](e[6](e[5](e[4](e[3](e[2](e[1](e[0](t))))))));case 9:return e[8](e[7](e[6](e[5](e[4](e[3](e[2](e[1](e[0](t)))))))));default:{let r=t;for(let o=0,n=e.length;o<n;o++)r=e[o](r);return r}}};var cr="Commit",mo="Failure";var xo="WithRuntime";var _o=Symbol.for("effect/Effect"),yo=Symbol.for("effect/Stream"),Oo=Symbol.for("effect/Sink"),So=Symbol.for("effect/Channel"),et={_R:t=>t,_E:t=>t,_A:t=>t,_V:ce()},Ns={_A:t=>t,_In:t=>t,_L:t=>t,_E:t=>t,_R:t=>t},Ps={_Env:t=>t,_InErr:t=>t,_InElem:t=>t,_InDone:t=>t,_OutErr:t=>t,_OutElem:t=>t,_OutDone:t=>t},$={[_o]:et,[yo]:et,[Oo]:Ns,[So]:Ps,[m](t){return this===t},[f](){return S(this,yt(this))},[Symbol.iterator](){return new pt(new J(this))},pipe(){return C(this,arguments)}},ar={[f](){return S(this,po(this))},[m](t){let e=Object.keys(this),r=Object.keys(t);if(e.length!==r.length)return!1;for(let o of e)if(!(o in t&&x(this[o],t[o])))return!1;return!0}},pr={...$,_op:cr},ur={...pr,...ar};var bo=Symbol.for("effect/Option"),Eo={...$,[bo]:{_A:t=>t},[y](){return this.toJSON()},toString(){return E(this.toJSON())}},Ls=Object.assign(Object.create(Eo),{_tag:"Some",_op:"Some",[m](t){return lr(t)&&dr(t)&&x(this.value,t.value)},[f](){return S(this,M(l(this._tag))(l(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:O(this.value)}}}),Us=l("None"),Hs=Object.assign(Object.create(Eo),{_tag:"None",_op:"None",[m](t){return lr(t)&&fr(t)},[f](){return Us},toJSON(){return{_id:"Option",_tag:this._tag}}}),lr=t=>_(t,bo),fr=t=>t._tag==="None",dr=t=>t._tag==="Some",Co=Object.create(Hs),ko=t=>{let e=Object.create(Ls);return e.value=t,e};var hr=Symbol.for("effect/Either"),Io={...$,[hr]:{_R:t=>t},[y](){return this.toJSON()},toString(){return E(this.toJSON())}},Ds=Object.assign(Object.create(Io),{_tag:"Right",_op:"Right",[m](t){return mr(t)&&vo(t)&&x(this.right,t.right)},[f](){return M(l(this._tag))(l(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:O(this.right)}}}),Bs=Object.assign(Object.create(Io),{_tag:"Left",_op:"Left",[m](t){return mr(t)&&Ao(t)&&x(this.left,t.left)},[f](){return M(l(this._tag))(l(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:O(this.left)}}}),mr=t=>_(t,hr),Ao=t=>t._tag==="Left",vo=t=>t._tag==="Right",Mo=t=>{let e=Object.create(Bs);return e.left=t,e},wo=t=>{let e=Object.create(Ds);return e.right=t,e};var Wt=wo,xr=Mo;var T=()=>Co,V=ko;var P=fr,rt=dr;var To=u(2,(t,e)=>P(t)?e():t.value);var Ro=To(Qe);var zt=t=>Array.isArray(t)?t:Array.from(t);var da=Array.isArray;var gr=t=>Array.from(t).reverse();var _r=u(3,(t,e,r)=>zt(t).reduce((o,n,s)=>r(o,n,s),e));var No=Symbol.for("effect/Chunk");function Gs(t,e,r,o,n){for(let s=e;s<Math.min(t.length,e+n);s++)r[o+s-e]=t[s];return r}var Po=[],zs=t=>no((e,r)=>e.length===r.length&&Ot(e).every((o,n)=>t(o,St(r,n)))),Js=zs(x),$s={[No]:{_A:t=>t},toString(){return E(this.toJSON())},toJSON(){return{_id:"Chunk",values:Ot(this).map(O)}},[y](){return this.toJSON()},[m](t){return Fo(t)&&Js(this,t)},[f](){return S(this,ue(Ot(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return Po[Symbol.iterator]();default:return Ot(this)[Symbol.iterator]()}},pipe(){return C(this,arguments)}},w=t=>{let e=Object.create($s);switch(e.backing=t,t._tag){case"IEmpty":{e.length=0,e.depth=0,e.left=e,e.right=e;break}case"IConcat":{e.length=t.left.length+t.right.length,e.depth=1+Math.max(t.left.depth,t.right.depth),e.left=t.left,e.right=t.right;break}case"IArray":{e.length=t.array.length,e.depth=0,e.left=Y,e.right=Y;break}case"ISingleton":{e.length=1,e.depth=0,e.left=Y,e.right=Y;break}case"ISlice":{e.length=t.length,e.depth=t.chunk.depth+1,e.left=Y,e.right=Y;break}}return e},Fo=t=>_(t,No),Y=w({_tag:"IEmpty"}),ut=()=>Y,$t=(...t)=>t.length===1?lt(t[0]):Ks(t),lt=t=>w({_tag:"ISingleton",a:t}),Lo=t=>Fo(t)?t:w({_tag:"IArray",array:zt(t)}),Or=(t,e,r)=>{switch(t.backing._tag){case"IArray":{Gs(t.backing.array,0,e,r,t.length);break}case"IConcat":{Or(t.left,e,r),Or(t.right,e,r+t.left.length);break}case"ISingleton":{e[r]=t.backing.a;break}case"ISlice":{let o=0,n=r;for(;o<t.length;)e[n]=St(t,o),o+=1,n+=1;break}}};var Vs=t=>{switch(t.backing._tag){case"IEmpty":return Po;case"IArray":return t.backing.array;default:{let e=new Array(t.length);return Or(t,e,0),t.backing={_tag:"IArray",array:e},t.left=Y,t.right=Y,t.depth=0,e}}},Ot=Vs,Ys=t=>{switch(t.backing._tag){case"IEmpty":case"ISingleton":return t;case"IArray":return w({_tag:"IArray",array:gr(t.backing.array)});case"IConcat":return w({_tag:"IConcat",left:Jt(t.backing.right),right:Jt(t.backing.left)});case"ISlice":return Uo(gr(Ot(t)))}},Jt=Ys;var Uo=t=>w({_tag:"IArray",array:t}),Ks=t=>Uo(t),St=u(2,(t,e)=>{switch(t.backing._tag){case"IEmpty":throw new Error("Index out of bounds");case"ISingleton":{if(e!==0)throw new Error("Index out of bounds");return t.backing.a}case"IArray":{if(e>=t.length||e<0)throw new Error("Index out of bounds");return t.backing.array[e]}case"IConcat":return e<t.left.length?St(t.left,e):St(t.right,e-t.left.length);case"ISlice":return St(t.backing.chunk,e+t.backing.offset)}});var de=u(2,(t,e)=>K(lt(e),t));var K=u(2,(t,e)=>{if(t.backing._tag==="IEmpty")return e;if(e.backing._tag==="IEmpty")return t;let r=e.depth-t.depth;if(Math.abs(r)<=1)return w({_tag:"IConcat",left:t,right:e});if(r<-1)if(t.left.depth>=t.right.depth){let o=K(t.right,e);return w({_tag:"IConcat",left:t.left,right:o})}else{let o=K(t.right.right,e);if(o.depth===t.depth-3){let n=w({_tag:"IConcat",left:t.right.left,right:o});return w({_tag:"IConcat",left:t.left,right:n})}else{let n=w({_tag:"IConcat",left:t.left,right:t.right.left});return w({_tag:"IConcat",left:n,right:o})}}else if(e.right.depth>=e.left.depth){let o=K(t,e.left);return w({_tag:"IConcat",left:o,right:e.right})}else{let o=K(t,e.left.left);if(o.depth===e.depth-3){let n=w({_tag:"IConcat",left:o,right:e.left.right});return w({_tag:"IConcat",left:n,right:e.right})}else{let n=w({_tag:"IConcat",left:e.left.right,right:e.right});return w({_tag:"IConcat",left:o,right:n})}}});var Ho=t=>t.length===0,he=t=>t.length>0;var qo=t=>St(t,0),me=qo;var Bo=Symbol.for("effect/Context/Tag"),xe=Symbol.for("effect/Context/Reference"),Zs="effect/STM",Qs=Symbol.for(Zs),jo={...$,_op:"Tag",[Qs]:et,[Bo]:{_Service:t=>t,_Identifier:t=>t},toString(){return E(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[y](){return this.toJSON()},of(t){return t},context(t){return Er(this,t)}},Xs={...jo,[xe]:xe};var Wo=t=>()=>{let e=Error.stackTraceLimit;Error.stackTraceLimit=2;let r=new Error;Error.stackTraceLimit=e;function o(){}return Object.setPrototypeOf(o,jo),o.key=t,Object.defineProperty(o,"stack",{get(){return r.stack}}),o},Go=()=>(t,e)=>{let r=Error.stackTraceLimit;Error.stackTraceLimit=2;let o=new Error;Error.stackTraceLimit=r;function n(){}return Object.setPrototypeOf(n,Xs),n.key=t,n.defaultValue=e.defaultValue,Object.defineProperty(n,"stack",{get(){return o.stack}}),n},br=Symbol.for("effect/Context"),ti={[br]:{_Services:t=>t},[m](t){if(zo(t)&&this.unsafeMap.size===t.unsafeMap.size){for(let e of this.unsafeMap.keys())if(!t.unsafeMap.has(e)||!x(this.unsafeMap.get(e),t.unsafeMap.get(e)))return!1;return!0}return!1},[f](){return S(this,pe(this.unsafeMap.size))},pipe(){return C(this,arguments)},toString(){return E(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(O)}},[y](){return this.toJSON()}},ge=t=>{let e=Object.create(ti);return e.unsafeMap=t,e},ei=t=>{let e=new Error(`Service not found${t.key?`: ${String(t.key)}`:""}`);if(t.stack){let r=t.stack.split(`
2
+ `);if(r.length>2){let o=r[2].match(/at (.*)/);o&&(e.message=e.message+` (defined at ${o[1]})`)}}if(e.stack){let r=e.stack.split(`
3
+ `);r.splice(1,3),e.stack=r.join(`
4
+ `)}return e},zo=t=>_(t,br);var Er=(t,e)=>ge(new Map([[t.key,e]])),Jo=u(3,(t,e,r)=>{let o=new Map(t.unsafeMap);return o.set(e.key,r),ge(o)}),Sr=F("effect/Context/defaultValueCache",()=>new Map),$o=t=>{if(Sr.has(t.key))return Sr.get(t.key);let e=t.defaultValue();return Sr.set(t.key,e),e},Vo=(t,e)=>t.unsafeMap.has(e.key)?t.unsafeMap.get(e.key):$o(e),Yo=u(2,(t,e)=>{if(!t.unsafeMap.has(e.key)){if(xe in e)return $o(e);throw ei(e)}return t.unsafeMap.get(e.key)});var Ko=u(2,(t,e)=>{let r=new Map(t.unsafeMap);for(let[o,n]of e.unsafeMap)r.set(o,n);return ge(r)});var Qo=Er,Xo=Jo;var tn=Yo;var en=Ko;var _e=Wo,H=Go;var Cr=Math.pow(2,5),rn=Cr-1,on=Cr/2,nn=Cr/4;function ri(t){return t-=t>>1&1431655765,t=(t&858993459)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,t&127}function ot(t,e){return e>>>t&rn}function nt(t){return 1<<t}function ye(t,e){return ri(t&e-1)}var sn=(t,e)=>({value:t,previous:e});function ft(t,e,r,o){let n=o;if(!t){let s=o.length;n=new Array(s);for(let i=0;i<s;++i)n[i]=o[i]}return n[e]=r,n}function kr(t,e,r){let o=r.length-1,n=0,s=0,i=r;if(t)n=s=e;else for(i=new Array(o);n<e;)i[s++]=r[n++];for(++n;n<=o;)i[s++]=r[n++];return t&&(i.length=o),i}function cn(t,e,r,o){let n=o.length;if(t){let a=n;for(;a>=e;)o[a--]=o[a];return o[e]=r,o}let s=0,i=0,c=new Array(n+1);for(;s<e;)c[i++]=o[s++];for(c[e]=r;s<n;)c[++i]=o[s++];return c}var Z=class t{_tag="EmptyNode";modify(e,r,o,n,s,i){let c=o(T());return P(c)?new t:(++i.value,new Et(e,n,s,c))}};function z(t){return rr(t,"EmptyNode")}function ni(t){return z(t)||t._tag==="LeafNode"||t._tag==="CollisionNode"}function Oe(t,e){return z(t)?!1:e===t.edit}var Et=class t{edit;hash;key;value;_tag="LeafNode";constructor(e,r,o,n){this.edit=e,this.hash=r,this.key=o,this.value=n}modify(e,r,o,n,s,i){if(x(s,this.key)){let a=o(this.value);return a===this.value?this:P(a)?(--i.value,new Z):Oe(this,e)?(this.value=a,this):new t(e,n,s,a)}let c=o(T());return P(c)?this:(++i.value,an(e,r,this.hash,this,n,new t(e,n,s,c)))}},Ir=class t{edit;hash;children;_tag="CollisionNode";constructor(e,r,o){this.edit=e,this.hash=r,this.children=o}modify(e,r,o,n,s,i){if(n===this.hash){let a=Oe(this,e),p=this.updateCollisionList(a,e,this.hash,this.children,o,s,i);return p===this.children?this:p.length>1?new t(e,this.hash,p):p[0]}let c=o(T());return P(c)?this:(++i.value,an(e,r,this.hash,this,n,new Et(e,n,s,c)))}updateCollisionList(e,r,o,n,s,i,c){let a=n.length;for(let h=0;h<a;++h){let g=n[h];if("key"in g&&x(i,g.key)){let v=g.value,I=s(v);return I===v?n:P(I)?(--c.value,kr(e,h,n)):ft(e,h,new Et(r,o,i,I),n)}}let p=s(T());return P(p)?n:(++c.value,ft(e,a,new Et(r,o,i,p),n))}},Vt=class t{edit;mask;children;_tag="IndexedNode";constructor(e,r,o){this.edit=e,this.mask=r,this.children=o}modify(e,r,o,n,s,i){let c=this.mask,a=this.children,p=ot(r,n),h=nt(p),g=ye(c,h),v=c&h,I=Oe(this,e);if(!v){let at=new Z().modify(e,r+5,o,n,s,i);return at?a.length>=on?ii(e,p,at,c,a):new t(e,c|h,cn(I,g,at,a)):this}let Ht=a[g],st=Ht.modify(e,r+5,o,n,s,i);if(Ht===st)return this;let it=c,ct;if(z(st)){if(it&=~h,!it)return new Z;if(a.length<=2&&ni(a[g^1]))return a[g^1];ct=kr(I,g,a)}else ct=ft(I,g,st,a);return I?(this.mask=it,this.children=ct,this):new t(e,it,ct)}},Ar=class t{edit;size;children;_tag="ArrayNode";constructor(e,r,o){this.edit=e,this.size=r,this.children=o}modify(e,r,o,n,s,i){let c=this.size,a=this.children,p=ot(r,n),h=a[p],g=(h||new Z).modify(e,r+5,o,n,s,i);if(h===g)return this;let v=Oe(this,e),I;if(z(h)&&!z(g))++c,I=ft(v,p,g,a);else if(!z(h)&&z(g)){if(--c,c<=nn)return si(e,c,p,a);I=ft(v,p,new Z,a)}else I=ft(v,p,g,a);return v?(this.size=c,this.children=I,this):new t(e,c,I)}};function si(t,e,r,o){let n=new Array(e-1),s=0,i=0;for(let c=0,a=o.length;c<a;++c)if(c!==r){let p=o[c];p&&!z(p)&&(n[s++]=p,i|=1<<c)}return new Vt(t,i,n)}function ii(t,e,r,o,n){let s=[],i=o,c=0;for(let a=0;i;++a)i&1&&(s[a]=n[c++]),i>>>=1;return s[e]=r,new Ar(t,c+1,s)}function ci(t,e,r,o,n,s){if(r===n)return new Ir(t,r,[s,o]);let i=ot(e,r),c=ot(e,n);if(i===c)return a=>new Vt(t,nt(i)|nt(c),[a]);{let a=i<c?[o,s]:[s,o];return new Vt(t,nt(i)|nt(c),a)}}function an(t,e,r,o,n,s){let i,c=e;for(;;){let a=ci(t,c,r,o,n,s);if(typeof a=="function")i=sn(a,i),c=c+5;else{let p=a;for(;i!=null;)p=i.value(p),i=i.previous;return p}}}var pn="effect/HashMap",vr=Symbol.for(pn),pi={[vr]:vr,[Symbol.iterator](){return new Se(this,(t,e)=>[t,e])},[f](){let t=l(pn);for(let e of this)t^=b(l(e[0]),M(l(e[1])));return S(this,t)},[m](t){if(li(t)){if(t._size!==this._size)return!1;for(let e of this){let r=b(t,fi(e[0],l(e[0])));if(P(r))return!1;if(!x(e[1],r.value))return!1}return!0}return!1},toString(){return E(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(O)}},[y](){return this.toJSON()},pipe(){return C(this,arguments)}},wr=(t,e,r,o)=>{let n=Object.create(pi);return n._editable=t,n._edit=e,n._root=r,n._size=o,n},Se=class t{map;f;v;constructor(e,r){this.map=e,this.f=r,this.v=un(this.map._root,this.f,void 0)}next(){if(P(this.v))return{done:!0,value:void 0};let e=this.v.value;return this.v=be(e.cont),{done:!1,value:e.value}}[Symbol.iterator](){return new t(this.map,this.f)}},be=t=>t?ln(t[0],t[1],t[2],t[3],t[4]):T(),un=(t,e,r=void 0)=>{switch(t._tag){case"LeafNode":return rt(t.value)?V({value:e(t.key,t.value.value),cont:r}):be(r);case"CollisionNode":case"ArrayNode":case"IndexedNode":{let o=t.children;return ln(o.length,o,0,e,r)}default:return be(r)}},ln=(t,e,r,o,n)=>{for(;r<t;){let s=e[r++];if(s&&!z(s))return un(s,o,[t,e,r,o,n])}return be(n)},ui=wr(!1,0,new Z,0),fn=()=>ui;var li=t=>_(t,vr);var fi=u(3,(t,e,r)=>{let o=t._root,n=0;for(;;)switch(o._tag){case"LeafNode":return x(e,o.key)?o.value:T();case"CollisionNode":{if(r===o.hash){let s=o.children;for(let i=0,c=s.length;i<c;++i){let a=s[i];if("key"in a&&x(e,a.key))return a.value}}return T()}case"IndexedNode":{let s=ot(n,r),i=nt(s);if(o.mask&i){o=o.children[ye(o.mask,i)],n+=5;break}return T()}case"ArrayNode":{if(o=o.children[ot(n,r)],o){n+=5;break}return T()}default:return T()}});var Tr=u(3,(t,e,r)=>hi(t,e,()=>V(r))),di=u(3,(t,e,r)=>t._editable?(t._root=e,t._size=r,t):e===t._root?t:wr(t._editable,t._edit,e,r)),dn=t=>new Se(t,e=>e);var Ee=t=>t._size,hn=t=>wr(!0,t._edit+1,t._root,t._size);var hi=u(3,(t,e,r)=>mi(t,e,l(e),r)),mi=u(4,(t,e,r,o)=>{let n={value:t._size},s=t._root.modify(t._editable?t._edit:NaN,0,o,r,e,n);return b(t,di(s,n.value))});var mn=u(2,(t,e)=>xn(t,void 0,(r,o,n)=>e(o,n))),xn=u(3,(t,e,r)=>{let o=t._root;if(o._tag==="LeafNode")return rt(o.value)?r(e,o.value.value,o.key):e;if(o._tag==="EmptyNode")return e;let n=[o.children],s;for(;s=n.pop();)for(let i=0,c=s.length;i<c;){let a=s[i++];a&&!z(a)&&(a._tag==="LeafNode"?rt(a.value)&&(e=r(e,a.value.value,a.key)):n.push(a.children))}return e});var gn="effect/HashSet",Ce=Symbol.for(gn),gi={[Ce]:Ce,[Symbol.iterator](){return dn(this._keyMap)},[f](){return S(this,M(l(this._keyMap))(l(gn)))},[m](t){return _n(t)?Ee(this._keyMap)===Ee(t._keyMap)&&x(this._keyMap,t._keyMap):!1},toString(){return E(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(O)}},[y](){return this.toJSON()},pipe(){return C(this,arguments)}},Rr=t=>{let e=Object.create(gi);return e._keyMap=t,e},_n=t=>_(t,Ce),_i=Rr(fn()),Nr=()=>_i;var yn=t=>Ee(t._keyMap),On=t=>Rr(hn(t._keyMap)),Sn=t=>(t._keyMap._editable=!1,t),bn=u(2,(t,e)=>{let r=On(t);return e(r),Sn(r)}),ke=u(2,(t,e)=>t._keyMap._editable?(Tr(e,!0)(t._keyMap),t):Rr(Tr(e,!0)(t._keyMap)));var En=u(2,(t,e)=>bn(Nr(),r=>{Cn(t,o=>ke(r,o));for(let o of e)ke(r,o)}));var Cn=u(2,(t,e)=>mn(t._keyMap,(r,o)=>e(o)));var Yt=Nr;var kn=yn;var Ie=ke;var Ae=En;var Si=Object.assign(Object.create(Array.prototype),{[f](){return S(this,ue(this))},[m](t){return Array.isArray(t)&&this.length===t.length?this.every((e,r)=>x(e,t[r])):!1}}),In=function(){function t(e){e&&Object.assign(this,e)}return t.prototype=ar,t}();var Pr="Die",ve="Empty",Me="Fail",Fr="Interrupt",kt="Parallel",It="Sequential";var Tn="effect/Cause",Rn=Symbol.for(Tn),Ci={_E:t=>t},Ur={[Rn]:Ci,[f](){return b(l(Tn),M(l(Ai(this))),S(this))},[m](t){return ki(t)&&Ii(this,t)},pipe(){return C(this,arguments)},toJSON(){switch(this._tag){case"Empty":return{_id:"Cause",_tag:this._tag};case"Die":return{_id:"Cause",_tag:this._tag,defect:O(this.defect)};case"Interrupt":return{_id:"Cause",_tag:this._tag,fiberId:this.fiberId.toJSON()};case"Fail":return{_id:"Cause",_tag:this._tag,failure:O(this.error)};case"Sequential":case"Parallel":return{_id:"Cause",_tag:this._tag,left:O(this.left),right:O(this.right)}}},toString(){return Hr(this)},[y](){return this.toJSON()}};var Te=t=>{let e=Object.create(Ur);return e._tag=Me,e.error=t,e};var Nn=(t,e)=>{let r=Object.create(Ur);return r._tag=kt,r.left=t,r.right=e,r},Kt=(t,e)=>{let r=Object.create(Ur);return r._tag=It,r.left=t,r.right=e,r},ki=t=>_(t,Rn);var Pn=t=>Fn(void 0,Mi)(t);var Ii=(t,e)=>{let r=lt(t),o=lt(e);for(;he(r)&&he(o);){let[n,s]=b(me(r),Mn([Yt(),ut()],([a,p],h)=>{let[g,v]=Lr(h);return V([b(a,Ae(g)),b(p,K(v))])})),[i,c]=b(me(o),Mn([Yt(),ut()],([a,p],h)=>{let[g,v]=Lr(h);return V([b(a,Ae(g)),b(p,K(v))])}));if(!x(n,i))return!1;r=s,o=c}return!0},Ai=t=>vi(lt(t),ut()),vi=(t,e)=>{for(;;){let[r,o]=b(t,_r([Yt(),ut()],([s,i],c)=>{let[a,p]=Lr(c);return[b(s,Ae(a)),b(i,K(p))]})),n=kn(r)>0?b(e,de(r)):e;if(Ho(o))return Jt(n);t=o,e=n}throw new Error(jt("Cause.flattenCauseLoop"))};var Lr=t=>{let e=t,r=[],o=Yt(),n=ut();for(;e!==void 0;)switch(e._tag){case ve:{if(r.length===0)return[o,n];e=r.pop();break}case Me:{if(o=Ie(o,$t(e._tag,e.error)),r.length===0)return[o,n];e=r.pop();break}case Pr:{if(o=Ie(o,$t(e._tag,e.defect)),r.length===0)return[o,n];e=r.pop();break}case Fr:{if(o=Ie(o,$t(e._tag,e.fiberId)),r.length===0)return[o,n];e=r.pop();break}case It:{switch(e.left._tag){case ve:{e=e.right;break}case It:{e=Kt(e.left.left,Kt(e.left.right,e.right));break}case kt:{e=Nn(Kt(e.left.left,e.right),Kt(e.left.right,e.right));break}default:{n=de(n,e.right),e=e.left;break}}break}case kt:{r.push(e.right),e=e.left;break}}throw new Error(jt("Cause.evaluateCauseLoop"))};var Mi={emptyCase:ie,failCase:Ze,dieCase:Ze,interruptCase:ie,sequentialCase:(t,e,r)=>e&&r,parallelCase:(t,e,r)=>e&&r};var An="SequentialCase",vn="ParallelCase";var Mn=u(3,(t,e,r)=>{let o=e,n=t,s=[];for(;n!==void 0;){let i=r(o,n);switch(o=rt(i)?i.value:o,n._tag){case It:{s.push(n.right),n=n.left;break}case kt:{s.push(n.right),n=n.left;break}default:{n=void 0;break}}n===void 0&&s.length>0&&(n=s.pop())}return o}),Fn=u(3,(t,e,r)=>{let o=[t],n=[];for(;o.length>0;){let i=o.pop();switch(i._tag){case ve:{n.push(Wt(r.emptyCase(e)));break}case Me:{n.push(Wt(r.failCase(e,i.error)));break}case Pr:{n.push(Wt(r.dieCase(e,i.defect)));break}case Fr:{n.push(Wt(r.interruptCase(e,i.fiberId)));break}case It:{o.push(i.right),o.push(i.left),n.push(xr({_tag:An}));break}case kt:{o.push(i.right),o.push(i.left),n.push(xr({_tag:vn}));break}}}let s=[];for(;n.length>0;){let i=n.pop();switch(i._tag){case"Left":{switch(i.left._tag){case An:{let c=s.pop(),a=s.pop(),p=r.sequentialCase(e,c,a);s.push(p);break}case vn:{let c=s.pop(),a=s.pop(),p=r.parallelCase(e,c,a);s.push(p);break}}break}case"Right":{s.push(i.right);break}}}if(s.length===0)throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return s.pop()}),Hr=(t,e)=>Pn(t)?"All fibers interrupted without errors.":Pi(t).map(function(r){return e?.renderErrorCause!==!0||r.cause===void 0?r.stack:`${r.stack} {
5
+ ${Ln(r.cause," ")}
6
+ }`}).join(`
7
+ `),Ln=(t,e)=>{let r=t.stack.split(`
8
+ `),o=`${e}[cause]: ${r[0]}`;for(let n=1,s=r.length;n<s;n++)o+=`
9
+ ${e}${r[n]}`;return t.cause&&(o+=` {
10
+ ${Ln(t.cause,`${e} `)}
11
+ ${e}}`),o},we=class t extends globalThis.Error{span=void 0;constructor(e){let r=typeof e=="object"&&e!==null,o=Error.stackTraceLimit;Error.stackTraceLimit=1,super(wi(e),r&&"cause"in e&&typeof e.cause<"u"?{cause:new t(e.cause)}:void 0),this.message===""&&(this.message="An error has occurred"),Error.stackTraceLimit=o,this.name=e instanceof Error?e.name:"Error",r&&(wn in e&&(this.span=e[wn]),Object.keys(e).forEach(n=>{n in this||(this[n]=e[n])})),this.stack=Ni(`${this.name}: ${this.message}`,e instanceof Error&&e.stack?e.stack:"",this.span)}},wi=t=>{if(typeof t=="string")return t;if(typeof t=="object"&&t!==null&&t instanceof Error)return t.message;try{if(_(t,"toString")&&Bt(t.toString)&&t.toString!==Object.prototype.toString&&t.toString!==globalThis.Array.prototype.toString)return t.toString()}catch{}return sr(t)},Ti=/\((.*)\)/g,Ri=F("effect/Tracer/spanToTrace",()=>new WeakMap),Ni=(t,e,r)=>{let o=[t],n=e.startsWith(t)?e.slice(t.length).split(`
12
+ `):e.split(`
13
+ `);for(let s=1;s<n.length&&!n[s].includes("Generator.next");s++){if(n[s].includes("effect_internal_function")){o.pop();break}o.push(n[s].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(r){let s=r,i=0;for(;s&&s._tag==="Span"&&i<10;){let c=Ri.get(s);if(typeof c=="function"){let a=c();if(typeof a=="string"){let p=a.matchAll(Ti),h=!1;for(let[,g]of p)h=!0,o.push(` at ${s.name} (${g})`);h||o.push(` at ${s.name} (${a.replace(/^at /,"")})`)}else o.push(` at ${s.name}`)}else o.push(` at ${s.name}`);s=Ro(s.parent),i++}}return o.join(`
14
+ `)},wn=Symbol.for("effect/SpanAnnotation"),Pi=t=>Fn(t,void 0,{emptyCase:()=>[],dieCase:(e,r)=>[new we(r)],failCase:(e,r)=>[new we(r)],interruptCase:()=>[],parallelCase:(e,r,o)=>[...r,...o],sequentialCase:(e,r,o)=>[...r,...o]});var At=class t{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new t(this.self)}};var Re=Symbol.for("effect/Effect");var qr=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Re]=et;constructor(e){this._op=e}[m](e){return this===e}[f](){return S(this,yt(this))}pipe(){return C(this,arguments)}toJSON(){return{_id:"Effect",_op:this._op,effect_instruction_i0:O(this.effect_instruction_i0),effect_instruction_i1:O(this.effect_instruction_i1),effect_instruction_i2:O(this.effect_instruction_i2)}}toString(){return E(this.toJSON())}[y](){return this.toJSON()}[Symbol.iterator](){return new At(new J(this))}},Dr=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Re]=et;constructor(e){this._op=e,this._tag=e}[m](e){return Yn(e)&&e._op==="Failure"&&x(this.effect_instruction_i0,e.effect_instruction_i0)}[f](){return b(L(this._tag),M(l(this.effect_instruction_i0)),S(this))}get cause(){return this.effect_instruction_i0}pipe(){return C(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return E(this.toJSON())}[y](){return this.toJSON()}[Symbol.iterator](){return new At(new J(this))}},Un=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Re]=et;constructor(e){this._op=e,this._tag=e}[m](e){return Yn(e)&&e._op==="Success"&&x(this.effect_instruction_i0,e.effect_instruction_i0)}[f](){return b(L(this._tag),M(l(this.effect_instruction_i0)),S(this))}get value(){return this.effect_instruction_i0}pipe(){return C(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:O(this.value)}}toString(){return E(this.toJSON())}[y](){return this.toJSON()}[Symbol.iterator](){return new At(new J(this))}},Li=t=>_(t,Re),Ui=t=>{let e=new qr(xo);return e.effect_instruction_i0=t,e};var Br=Symbol.for("effect/SpanAnnotation"),Hn=Symbol.for("effect/OriginalAnnotation");var Hi=(t,e)=>rt(e)?new Proxy(t,{has(r,o){return o===Br||o===Hn||o in r},get(r,o){return o===Br?e.value:o===Hn?t:r[o]}}):t;var qi=t=>er(t)&&!(Br in t)?Ui(e=>qn(Te(Hi(t,Wi(e))))):qn(Te(t));var qn=t=>{let e=new Dr(mo);return e.effect_instruction_i0=t,e};var Uu={_tag:"All",syslog:0,label:"ALL",ordinal:Number.MIN_SAFE_INTEGER,pipe(){return C(this,arguments)}};var Hu={_tag:"None",syslog:7,label:"OFF",ordinal:Number.MAX_SAFE_INTEGER,pipe(){return C(this,arguments)}};var Di="effect/RequestResolver",Vn=Symbol.for(Di),Bi={_A:t=>t,_R:t=>t},Dn=class t{runAll;target;[Vn]=Bi;constructor(e,r){this.runAll=e,this.target=r}[f](){return S(this,this.target?l(this.target):yt(this))}[m](e){return this.target?ji(e)&&x(this.target,e.target):this===e}identified(...e){return new t(this.runAll,Lo(e))}pipe(){return C(this,arguments)}},ji=t=>_(t,Vn);var jr=function(){class t extends globalThis.Error{commit(){return qi(this)}toJSON(){return{...this}}[y](){return this.toString!==globalThis.Error.prototype.toString?this.stack?`${this.toString()}
15
+ ${this.stack.split(`
16
+ `).slice(1).join(`
17
+ `)}`:this.toString():"Bun"in globalThis?Hr(Te(this),{renderErrorCause:!0}):this}}return Object.assign(t.prototype,ur),t}(),dt=(t,e)=>{class r extends jr{_tag=e}return Object.assign(r.prototype,t),r.prototype.name=e,r},Bn=Symbol.for("effect/Cause/errors/RuntimeException"),qu=dt({[Bn]:Bn},"RuntimeException");var jn=Symbol.for("effect/Cause/errors/InterruptedException"),Du=dt({[jn]:jn},"InterruptedException");var Wn=Symbol.for("effect/Cause/errors/IllegalArgument"),Bu=dt({[Wn]:Wn},"IllegalArgumentException");var Gn=Symbol.for("effect/Cause/errors/NoSuchElement"),ju=dt({[Gn]:Gn},"NoSuchElementException");var zn=Symbol.for("effect/Cause/errors/InvalidPubSubCapacityException"),Wu=dt({[zn]:zn},"InvalidPubSubCapacityException"),Jn=Symbol.for("effect/Cause/errors/ExceededCapacityException"),Gu=dt({[Jn]:Jn},"ExceededCapacityException");var $n=Symbol.for("effect/Cause/errors/Timeout"),zu=dt({[$n]:$n},"TimeoutException");var Yn=t=>Li(t)&&"_tag"in t&&(t._tag==="Success"||t._tag==="Failure");var Wi=t=>{let e=t.currentSpan;return e!==void 0&&e._tag==="Span"?V(e):T()};var Zt=In,Kn=t=>{class e extends Zt{_tag=t}return e};var zi=function(){let t=Symbol.for("effect/Data/Error/plainArgs");return class extends jr{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0),r&&(Object.assign(this,r),Object.defineProperty(this,t,{value:r,enumerable:!1}))}toJSON(){return{...this[t],...this}}}}(),vt=t=>{class e extends zi{_tag=t}return e.prototype.name=t,e};var Ne=class t extends Kn("BotResponse"){static make(e){return new t({response:e})}static ignore=new t({})};var Zn=$;var rs=Symbol.for("effect/Micro"),Pe=Symbol.for("effect/Micro/MicroExit"),Xt=t=>typeof t=="object"&&t!==null&&rs in t,Qn=Symbol.for("effect/Micro/MicroCause");var $i={_E:A},te=class extends globalThis.Error{_tag;traces;[Qn];constructor(e,r,o){let n=`MicroCause.${e}`,s,i,c;if(r instanceof globalThis.Error){s=`(${n}) ${r.name}`,i=r.message;let a=i.split(`
18
+ `).length;c=r.stack?`(${n}) ${r.stack.split(`
19
+ `).slice(0,a+3).join(`
20
+ `)}`:`${s}: ${i}`}else s=n,i=fo(r,0),c=`${s}: ${i}`;o.length>0&&(c+=`
21
+ ${o.join(`
22
+ `)}`),super(i),this._tag=e,this.traces=o,this[Qn]=$i,this.name=s,this.stack=c}pipe(){return C(this,arguments)}toString(){return this.stack}[y](){return this.stack}},Gr=class extends te{error;constructor(e,r=[]){super("Fail",e,r),this.error=e}},Vi=(t,e=[])=>new Gr(t,e),zr=class extends te{defect;constructor(e,r=[]){super("Die",e,r),this.defect=e}},Yi=(t,e=[])=>new zr(t,e),Jr=class extends te{constructor(e=[]){super("Interrupt","interrupted",e)}},Ki=(t=[])=>new Jr(t),Zi=t=>t._tag==="Fail";var os=t=>t._tag==="Interrupt";var Xn=Symbol.for("effect/Micro/MicroFiber"),Qi={_A:A,_E:A},Fe=class{context;interruptible;[Xn];_stack=[];_observers=[];_exit;_children;currentOpCount=0;constructor(e,r=!0){this.context=e,this.interruptible=r,this[Xn]=Qi}getRef(e){return Vo(this.context,e)}addObserver(e){return this._exit?(e(this._exit),ro):(this._observers.push(e),()=>{let r=this._observers.indexOf(e);r>=0&&this._observers.splice(r,1)})}_interrupted=!1;unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(Zr))}unsafePoll(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){let n=this._yielded;this._yielded=void 0,n()}let r=this.runLoop(e);if(r===Mt)return;let o=ts.interruptChildren&&ts.interruptChildren(this);if(o!==void 0)return this.evaluate(D(o,()=>r));this._exit=r;for(let n=0;n<this._observers.length;n++)this._observers[n](r);this._observers.length=0}runLoop(e){let r=!1,o=e;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!r&&this.getRef(Rt).shouldYield(this)){r=!0;let n=o;o=D(cs,()=>n)}if(o=o[$r](this),o===Mt){let n=this._yielded;return Pe in n?(this._yielded=void 0,n):Mt}}}catch(n){return _(o,$r)?Ue(n):Ue(`MicroFiber.runLoop: Not a valid effect: ${String(o)}`)}}getCont(e){for(;;){let r=this._stack.pop();if(!r)return;let o=r[Le]&&r[Le](this);if(o)return{[e]:o};if(r[e])return r}}_yielded=void 0;yieldWith(e){return this._yielded=e,Mt}children(){return this._children??=new Set}},ts=F("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0}));var Xi=t=>qe(e=>Tt(t.addObserver(r=>e(k(r)))));var ns=t=>X(()=>(t.unsafeInterrupt(),cc(Xi(t)))),tc=t=>X(()=>{for(let o of t)o.unsafeInterrupt();let e=t[Symbol.iterator](),r=X(()=>{let o=e.next();for(;!o.done;){if(o.value.unsafePoll()){o=e.next();continue}let n=o.value;return qe(s=>{n.addObserver(i=>{s(r)})})}return xt});return r}),ss=Symbol.for("effect/Micro/identifier"),d=Symbol.for("effect/Micro/args"),$r=Symbol.for("effect/Micro/evaluate"),Q=Symbol.for("effect/Micro/successCont"),ht=Symbol.for("effect/Micro/failureCont"),Le=Symbol.for("effect/Micro/ensureCont"),Mt=Symbol.for("effect/Micro/Yield"),ec={_A:A,_E:A,_R:A},rc={...Zn,_op:"Micro",[rs]:ec,pipe(){return C(this,arguments)},[Symbol.iterator](){return new pt(new J(this))},toJSON(){return{_id:"Micro",op:this[ss],...d in this?{args:this[d]}:void 0}},toString(){return E(this)},[y](){return E(this)}};function oc(t){return Ue("Micro.evaluate: Not implemented")}var ee=t=>({...rc,[ss]:t.op,[$r]:t.eval??oc,[Q]:t.contA,[ht]:t.contE,[Le]:t.ensure}),tt=t=>{let e=ee(t);return function(){let r=Object.create(e);return r[d]=t.single===!1?arguments:arguments[0],r}},is=t=>{let e={...ee(t),[Pe]:Pe,_tag:t.op,get[t.prop](){return this[d]},toJSON(){return{_id:"MicroExit",_tag:t.op,[t.prop]:this[d]}},[m](r){return uc(r)&&r._tag===t.op&&x(this[d],r[d])},[f](){return S(this,M(L(t.op))(l(this[d])))}};return function(r){let o=Object.create(e);return o[d]=r,o[Q]=void 0,o[ht]=void 0,o[Le]=void 0,o}},k=is({op:"Success",prop:"value",eval(t){let e=t.getCont(Q);return e?e[Q](this[d],t):t.yieldWith(this)}}),wt=is({op:"Failure",prop:"cause",eval(t){let e=t.getCont(ht);for(;os(this[d])&&e&&t.interruptible;)e=t.getCont(ht);return e?e[ht](this[d],t):t.yieldWith(this)}}),q=t=>wt(Vi(t)),Tt=tt({op:"Sync",eval(t){let e=this[d](),r=t.getCont(Q);return r?r[Q](e,t):t.yieldWith(De(e))}}),X=tt({op:"Suspend",eval(t){return this[d]()}}),nc=tt({op:"Yield",eval(t){let e=!1;return t.getRef(Rt).scheduleTask(()=>{e||t.evaluate(xt)},this[d]??0),t.yieldWith(()=>{e=!0})}}),cs=nc(0);var mt=k(void 0);var Kr=t=>X(()=>{try{return k(t.try())}catch(e){return q(t.catch(e))}});var Nt=t=>as(function(e,r){try{t.try(r).then(o=>e(k(o)),o=>e(q(t.catch(o))))}catch(o){e(q(t.catch(o)))}},t.try.length!==0),Pt=tt({op:"WithMicroFiber",eval(t){return this[d](t)}});var as=tt({op:"Async",single:!1,eval(t){let e=this[d][0],r=!1,o=!1,n=this[d][1]?new AbortController:void 0,s=e(i=>{r||(r=!0,o?t.evaluate(i):o=i)},n?.signal);return o!==!1?o:(o=!0,t._yielded=()=>{r=!0},n===void 0&&s===void 0||t._stack.push(sc(()=>(r=!0,n?.abort(),s??xt))),Mt)}}),sc=tt({op:"AsyncFinalizer",ensure(t){t.interruptible&&(t.interruptible=!1,t._stack.push(Xr(!0)))},contE(t,e){return os(t)?D(this[d](),()=>wt(t)):wt(t)}}),qe=t=>as(t,t.length>=2);var B=(...t)=>X(()=>ic(t.length===1?t[0]():t[1].call(t[0]))),ic=tt({op:"Iterator",contA(t,e){let r=this[d].next(t);return r.done?k(r.value):(e._stack.push(this),ao(r.value))},eval(t){return this[Q](void 0,t)}}),ps=u(2,(t,e)=>pc(t,r=>e));var j=u(2,(t,e)=>D(t,r=>{let o=Xt(e)?e:typeof e=="function"?e(r):e;return Xt(o)?o:k(o)})),re=u(2,(t,e)=>D(t,r=>{let o=Xt(e)?e:typeof e=="function"?e(r):e;return Xt(o)?ps(o,r):k(r)})),cc=t=>D(t,e=>xt),us=t=>_c(t,{onFailure:Be,onSuccess:De});var D=u(2,(t,e)=>{let r=Object.create(ac);return r[d]=t,r[Q]=e,r}),ac=ee({op:"OnSuccess",eval(t){return t._stack.push(this),this[d]}});var pc=u(2,(t,e)=>D(t,r=>k(e(r)))),uc=t=>_(t,Pe),De=k,Be=wt,Zr=Be(Ki());var Ue=t=>Be(Yi(t));var xt=De(void 0),lc=t=>{for(let e of t)if(e._tag==="Failure")return e;return xt},fc="setImmediate"in globalThis?globalThis.setImmediate:t=>setTimeout(t,0),He=class{tasks=[];running=!1;scheduleTask(e,r){this.tasks.push(e),this.running||(this.running=!0,fc(this.afterScheduled))}afterScheduled=()=>{this.running=!1,this.runTasks()};runTasks(){let e=this.tasks;this.tasks=[];for(let r=0,o=e.length;r<o;r++)e[r]()}shouldYield(e){return e.currentOpCount>=e.getRef(Vr)}flush(){for(;this.tasks.length>0;)this.runTasks()}},R=t=>Pt(e=>k(tn(e.context,t)));var ls=u(2,(t,e)=>Pt(r=>{let o=r.context;return r.context=e(o),yc(t,()=>(r.context=o,mt))}));var Qr=u(2,(t,e)=>ls(t,en(e))),je=u(3,(t,e,r)=>ls(t,Xo(e,r)));var Vr=class extends H()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){},Yr=class extends H()("effect/Micro/currentConcurrency",{defaultValue:()=>"unbounded"}){},Rt=class extends H()("effect/Micro/currentScheduler",{defaultValue:()=>new He}){};var dc=u(2,(t,e)=>X(()=>{let r=e.schedule?Date.now():0,o=0,n=D(us(t),s=>{if(e.while!==void 0&&!e.while(s))return s;if(e.times!==void 0&&o>=e.times)return s;o++;let i=cs;if(e.schedule!==void 0){let c=Date.now()-r,a=e.schedule(o,c);if(P(a))return s;i=hs(a.value)}return D(i,()=>n)});return n})),fs=u(t=>Xt(t[0]),(t,e)=>dc(t,{...e,while:r=>r._tag==="Success"&&(e?.while===void 0||e.while(r.value))}));var hc=u(2,(t,e)=>{let r=Object.create(mc);return r[d]=t,r[ht]=e,r}),mc=ee({op:"OnFailure",eval(t){return t._stack.push(this),this[d]}}),xc=u(3,(t,e,r)=>hc(t,o=>e(o)?r(o):wt(o))),We=u(2,(t,e)=>xc(t,Zi,r=>e(r.error)));var ds=u(2,(t,e)=>{let r=Object.create(gc);return r[d]=t,r[Q]=e.onSuccess,r[ht]=e.onFailure,r}),gc=ee({op:"OnSuccessAndFailure",eval(t){return t._stack.push(this),this[d]}}),_c=u(2,(t,e)=>ds(t,{onFailure:r=>Tt(()=>e.onFailure(r)),onSuccess:r=>Tt(()=>e.onSuccess(r))}));var hs=t=>qe(e=>{let r=setTimeout(()=>{e(mt)},t);return Tt(()=>{clearTimeout(r)})}),ms=u(2,(t,e)=>j(hs(e),t));var Wr=Symbol.for("effect/Micro/MicroScope");var es=class t{[Wr];state={_tag:"Open",finalizers:new Set};constructor(){this[Wr]=Wr}unsafeAddFinalizer(e){this.state._tag==="Open"&&this.state.finalizers.add(e)}addFinalizer(e){return X(()=>this.state._tag==="Open"?(this.state.finalizers.add(e),mt):e(this.state.exit))}unsafeRemoveFinalizer(e){this.state._tag==="Open"&&this.state.finalizers.delete(e)}close(e){return X(()=>{if(this.state._tag==="Open"){let r=Array.from(this.state.finalizers).reverse();return this.state={_tag:"Closed",exit:e},D(to(r,o=>us(o(e))),lc)}return mt})}get fork(){return Tt(()=>{let e=new t;if(this.state._tag==="Closed")return e.state=this.state,e;function r(o){return e.close(o)}return this.state.finalizers.add(r),e.unsafeAddFinalizer(o=>Tt(()=>this.unsafeRemoveFinalizer(r))),e})}};var yc=u(2,(t,e)=>Sc(r=>ds(r(t),{onFailure:o=>D(e(Be(o)),()=>wt(o)),onSuccess:o=>D(e(De(o)),()=>k(o))})));var Xr=tt({op:"SetInterruptible",ensure(t){if(t.interruptible=this[d],t._interrupted&&t.interruptible)return()=>Zr}}),Oc=t=>Pt(e=>e.interruptible?t:(e.interruptible=!0,e._stack.push(Xr(!1)),e._interrupted?Zr:t)),Sc=t=>Pt(e=>e.interruptible?(e.interruptible=!1,e._stack.push(Xr(!0)),t(Oc)):t(A));var bc=tt({op:"While",contA(t,e){return this[d].step(t),this[d].while()?(e._stack.push(this),this[d].body()):xt},eval(t){return this[d].while()?(t._stack.push(this),this[d].body()):xt}}),to=(t,e,r)=>Pt(o=>{let n=r?.concurrency==="inherit"?o.getRef(Yr):r?.concurrency??1,s=n==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,n),i=zt(t),c=i.length;if(c===0)return r?.discard?mt:k([]);let a=r?.discard?void 0:new Array(c),p=0;return s===1?ps(bc({while:()=>p<i.length,body:()=>e(i[p],p),step:a?h=>a[p++]=h:h=>p++}),a):qe(h=>{let g=new Set,v,I=0,Ht=0,st=!1,it=!1;function ct(){for(st=!0;I<s&&p<c;){let at=p,ks=i[at];p++,I++;try{let qt=xs(o,e(ks,at),!0,!0);g.add(qt),qt.addObserver(Dt=>{g.delete(qt),!it&&(Dt._tag==="Failure"?v===void 0&&(v=Dt,c=p,g.forEach(Is=>Is.unsafeInterrupt())):a!==void 0&&(a[at]=Dt.value),Ht++,I--,Ht===c?h(v??k(a)):!st&&I<s&&ct())})}catch(qt){v=Ue(qt),c=p,g.forEach(Dt=>Dt.unsafeInterrupt())}}st=!1}return ct(),X(()=>(it=!0,p=c,tc(g)))})});var xs=(t,e,r=!1,o=!1)=>{let n=new Fe(t.context,t.interruptible);return o||(t.children().add(n),n.addObserver(()=>t.children().delete(n))),r?n.evaluate(e):t.getRef(Rt).scheduleTask(()=>n.evaluate(e),0),n},gs=t=>Pt(e=>k(xs(e,t,!1,!0)));var Ec=(t,e)=>{let r=new Fe(Rt.context(e?.scheduler??new He));if(r.evaluate(t),e?.signal)if(e.signal.aborted)r.unsafeInterrupt();else{let o=()=>r.unsafeInterrupt();e.signal.addEventListener("abort",o,{once:!0}),r.addObserver(()=>e.signal.removeEventListener("abort",o))}return r},Cc=(t,e)=>new Promise((r,o)=>{Ec(t,e).addObserver(r)}),Ge=(t,e)=>Cc(t,e).then(r=>{if(r._tag==="Failure")throw r.cause;return r.value});var _s=t=>{let e=t[0];for(let r=1;r<t.length;r++)e+=t[r]==="_"?t[++r].toUpperCase():t[r];return e};var gt=class extends vt("TgBotClientError"){};var ys=t=>typeof t=="object"&&t!=null&&"file_content"in t&&t.file_content instanceof Uint8Array&&"file_name"in t&&typeof t.file_name=="string",Os=t=>typeof t=="object"&&t!=null&&"ok"in t&&typeof t.ok=="boolean";var Ss="https://api.telegram.org",eo={"\u{1F525}":"5104841245755180586","\u{1F44D}":"5107584321108051014","\u{1F44E}":"5104858069142078462","\u2764\uFE0F":"5159385139981059251","\u{1F389}":"5046509860389126442","\u{1F4A9}":"5046589136895476101"},pl=Object.keys(eo);var ze=class extends H()("TgBotApiBaseUrl",{defaultValue:()=>Ss}){},Lt=class extends _e("TgBotApiToken")(){};var bs=t=>{let e=Object.entries(t);if(e.length==0)return;let r=new FormData;for(let[o,n]of e)n&&(typeof n!="object"?r.append(o,`${n}`):ys(n)?r.append(o,new Blob([n.file_content]),n.file_name):r.append(o,JSON.stringify(n)));return r};var oe=(t,e)=>B(function*(){let r=yield*R(Lt),o=yield*R(ze),n=yield*Nt({try:()=>fetch(`${o}/bot${r}/${_s(t)}`,{body:bs(e)??null,method:"POST"}),catch:i=>new gt({cause:{_tag:"ClientInternalError",cause:i}})}),s=yield*Nt({try:()=>n.json(),catch:()=>new gt({cause:{_tag:"NotJsonResponse",response:n}})});return Os(s)?n.ok?s.result:yield*q(new gt({cause:{_tag:"NotOkResponse",...s.error_code?{errorCode:s.error_code}:void 0,...s.description?{details:s.description}:void 0}})):yield*q(new gt({cause:{_tag:"UnexpectedResponse",response:s}}))});var _t=class extends _e("BotUpdateHandlers")(){},ne=class t extends Zt{static make(e){let r=e.batch_size??10,o=e.poll_timeout??10,n=e.max_empty_responses,s=e.log_level??"info",i=e.on_error;(r<10||r>100)&&(console.warn("Wrong batch_size, must be in [10..100], using 10 instead"),r=10),(o<2||o>120)&&(console.warn("Wrong poll_timeout, must be in [2..120], using 20 instead"),o=20),n&&n<2&&(console.warn("Wrong max_empty_responses, must be in [2..infinity], using infinity"),n=void 0),s||(s="info"),i||(i="stop");let c=new t({batch_size:r,poll_timeout:o,max_empty_responses:n,log_level:s,on_error:i});return console.log("bot poll settings",c),c}},W=class extends H()("BotSettings",{defaultValue(){return ne.make({})}}){};var Ic=t=>{for(let[e,r]of Object.entries(t))if(e!="update_id")return{type:e,...r}},se=class extends Zt{},Es=t=>B(function*(){let e=yield*R(W),r=yield*R(_t);return r.type=="single"?yield*vc(t,r,e):yield*Ac(t,r)}),Ac=(t,e)=>Kr({try:()=>e.on_batch(t),catch:A}).pipe(j(r=>r instanceof Promise?Nt({try:()=>r,catch:A}):k(r)),j(r=>new se({hasErrors:!r,updates:t})),We(r=>(console.warn("handle batch error",{errorMessage:r instanceof Error?r.message:void 0,updates:t.map(o=>Object.keys(o).at(1)),error:r}),k(new se({hasErrors:!0,updates:t}))))),Ut=class extends vt("HandleUpdateError"){},vc=(t,e,r)=>to(t,o=>Mc(o,e).pipe(We(n=>(console.log("update handle error",{updateId:o.update_id,updateKey:Object.keys(o).at(1),name:n._tag,...n.cause instanceof Error?{error:n.cause.message}:void 0}),k(n)))),{concurrency:10}).pipe(j(o=>(r.log_level=="debug"&&console.debug("handle batch result",o),new se({hasErrors:!o.every(n=>n==null),updates:t})))),Mc=(t,e)=>B(function*(){let r=Ic(t);if(!r)return yield*q(new Ut({name:"UnknownUpdate",update:t}));let o=e[`on_${r.type}`];if(!o)return yield*q(new Ut({name:"HandlerNotDefined",update:t}));r.type=="message"&&"text"in r&&console.info("Got a new text message",{chatId:r.chat.id,chatType:r.chat.type,message:`${r.text.slice(0,5)}...`});let n,s=yield*Kr({try:()=>o(r),catch:c=>new Ut({name:"BotHandlerError",update:t,cause:c})}).pipe(j(c=>c instanceof Promise?Nt({try:()=>c,catch:a=>new Ut({name:"BotHandlerError",update:t,cause:a})}):k(c)),We(c=>(n=c,console.log("error",{updateId:t.update_id,updateKey:Object.keys(t).at(1),name:c._tag,...c.cause instanceof Error?{error:c.cause.message}:void 0}),k(Ne.make({type:"message",text:`Some internal error has happend(${c.name}) while handling this message`,message_effect_id:eo["\u{1F4A9}"],...t.message?.message_id?{reply_parameters:{message_id:t.message?.message_id}}:void 0}))))),i=yield*R(W);if(!s&&i.log_level=="debug"){console.log(`Bot response is undefined for update with ID #${t.update_id}.`);return}if("chat"in r&&s.response){let c=yield*oe(`send_${s.response.type}`,{...s.response,chat_id:r.chat.id});i.log_level=="debug"&&console.debug("bot response",c)}return n});var Je=class extends H()("BotFetchUpdatesService",{defaultValue:()=>{let e={lastUpdateId:void 0,emptyResponses:0},r=wc(e).pipe(re(n=>{let s=n.map(i=>i.update_id).sort().at(-1);console.log("updating last update id",s),e.lastUpdateId=s?s+1:void 0,console.log(e)})),o=Tc(e);return{state:e,fetchUpdates:r,commit:o}}}){},$e=class extends vt("FetchUpdatesError"){},wc=t=>B(function*(){let e=yield*R(W);if(e.max_empty_responses&&t.emptyResponses==e.max_empty_responses)return yield*q(new $e({name:"TooManyEmptyResponses"}));let r=t.lastUpdateId;e.log_level=="debug"&&console.debug("getting updates",t);let o=yield*oe("get_updates",{timeout:e.poll_timeout,...r?{offset:r}:void 0}).pipe(j(n=>n.sort(s=>s.update_id)));return o.length?(console.debug(`got a batch of updates (${o.length})`),t.emptyResponses=0,o):(t.emptyResponses+=1,[])}),Tc=t=>B(function*(){return console.log("commit",{pollState:t}),t.lastUpdateId?yield*oe("get_updates",{offset:t.lastUpdateId,limit:0}).pipe(j(j(R(W),e=>{e.log_level=="debug"&&console.debug("committed offset",t)}))):yield*q(new $e({name:"NoUpdatesToCommit"}))});var Ve=class extends H()("BotRunService",{defaultValue:()=>{console.log("Initiating BotRunService");let e={fiber:void 0};return{runBotInBackground:Rc(e),getFiber:()=>e.fiber}}}){},Rc=t=>B(function*(){console.log("running telegram chat bot");let e=yield*R(Je),r=yield*R(W),o=s=>r.on_error=="continue"?!0:!s,n=ms(1e3)(e.fetchUpdates.pipe(j(Es),re(s=>s.updates.length>0&&o(s.hasErrors)?e.commit:mt))).pipe(fs({while:s=>o(s.hasErrors)}),gs,re(s=>s.addObserver(i=>{console.log("bot's fiber has been closed",i)})));t.fiber&&(console.log("killing previous bot's fiber"),yield*ns(t.fiber)),t.fiber=yield*n,console.log("Fetching bot updates via long polling...")});var Cs=t=>B(function*(){let e=yield*R(Ve),r=Qo(Lt,t.bot_token);return yield*e.runBotInBackground.pipe(je(_t,t.mode),je(W,ne.make(t.poll??{})),Qr(r)),{reload:n=>e.runBotInBackground.pipe(je(_t,n),Qr(r),Ge),fiber:e.getFiber}});var Bl=t=>Cs(t).pipe(Ge),jl=t=>(Object.keys(t).length==0&&console.warn("No handlers are defined for bot"),t);export{se as BatchUpdateResult,ne as BotPollSettings,W as BotPollSettingsTag,Ne as BotResponse,Ve as BotRunService,_t as BotUpdateHandlersTag,Ut as HandleUpdateError,jl as defineBot,Ic as extractUpdate,Ac as handleEntireBatch,vc as handleOneByOne,Mc as handleOneUpdate,Es as handleUpdates,Cs as launchBot,Bl as runTgChatBot};
package/dist/bot.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as effect_Types from 'effect/Types';
2
- import { A as Api, U as Update, a as TgBotApiToken, T as TgBotClientError } from './config-BZUAEyeb.js';
2
+ import { A as Api, U as Update, a as TgBotApiToken, T as TgBotClientError } from './config-DAcDINJv.js';
3
3
  import * as effect_Cause from 'effect/Cause';
4
4
  import * as Micro from 'effect/Micro';
5
5
  import * as Data from 'effect/Data';
package/dist/bot.js CHANGED
@@ -1 +1 @@
1
- "use strict";var ee=Object.create;var T=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var se=(e,o)=>{for(var t in o)T(e,t,{get:o[t],enumerable:!0})},P=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of oe(o))!re.call(e,n)&&n!==t&&T(e,n,{get:()=>o[n],enumerable:!(r=te(o,n))||r.enumerable});return e};var c=(e,o,t)=>(t=e!=null?ee(ne(e)):{},P(o||!e||!e.__esModule?T(t,"default",{value:e,enumerable:!0}):t,e)),ie=e=>P(T({},"__esModule",{value:!0}),e);var me={};se(me,{BatchUpdateResult:()=>B,BotPollSettings:()=>x,BotPollSettingsTag:()=>m,BotResponse:()=>_,BotRunService:()=>U,BotUpdateHandlersTag:()=>g,HandleUpdateError:()=>M,defineBot:()=>le,extractUpdate:()=>z,handleEntireBatch:()=>V,handleOneByOne:()=>W,handleOneUpdate:()=>J,handleUpdates:()=>F,launchBot:()=>I,runTgChatBot:()=>de});module.exports=ie(me);var H=c(require("effect/Data")),_=class e extends H.TaggedClass("BotResponse"){static make(o){return new e({response:o})}static ignore=new e({})};var s=c(require("effect/Micro")),v=c(require("effect/Data")),A=c(require("effect/Function"));var K=c(require("effect/String")),u=c(require("effect/Micro"));var D=c(require("effect/Data")),y=class e extends D.TaggedError("TgBotClientError"){static missingSuccess=new e({cause:{type:"ClientInternalError",cause:"Expected 'success' to be defined"}})};var $=e=>typeof e=="object"&&e!=null&&"file_content"in e&&e.file_content instanceof Uint8Array&&"file_name"in e&&typeof e.file_name=="string",N=e=>typeof e=="object"&&e!=null&&"ok"in e&&typeof e.ok=="boolean";var k=c(require("effect/Context"));var O="https://api.telegram.org",C={"\u{1F525}":"5104841245755180586","\u{1F44D}":"5107584321108051014","\u{1F44E}":"5104858069142078462","\u2764\uFE0F":"5159385139981059251","\u{1F389}":"5046509860389126442","\u{1F4A9}":"5046589136895476101"},Me=Object.keys(C);var E=class extends k.Reference()("TgBotApiBaseUrl",{defaultValue:()=>O}){},h=class extends k.Tag("TgBotApiToken")(){};var G=e=>{let o=Object.entries(e);if(o.length==0)return;let t=new FormData;for(let[r,n]of o)n&&(typeof n!="object"?t.append(r,`${n}`):$(n)?t.append(r,new Blob([n.file_content]),n.file_name):t.append(r,JSON.stringify(n)));return t};var b=(e,o)=>u.gen(function*(){let t=yield*u.service(h),r=yield*u.service(E),n=yield*u.tryPromise({try:()=>fetch(`${r}/bot${t}/${K.snakeToCamel(e)}`,{body:G(o)??null,method:"POST"}),catch:l=>new y({cause:{type:"ClientInternalError",cause:l}})}),i=yield*u.tryPromise({try:()=>n.json(),catch:()=>new y({cause:{type:"NotJsonResponse",response:n}})});return N(i)?n.ok?i.result:yield*u.fail(new y({cause:{type:"NotOkResponse",...i.error_code?{errorCode:i.error_code}:void 0,...i.description?{details:i.description}:void 0}})):yield*u.fail(new y({cause:{type:"UnexpectedResponse",response:i}}))});var R=c(require("effect/Context")),j=c(require("effect/Data")),g=class extends R.Tag("BotUpdateHandlers")(){},x=class e extends j.Class{static make(o){let t=o.batch_size??10,r=o.poll_timeout??10,n=o.max_empty_responses,i=o.log_level??"info",l=o.on_error;(t<10||t>100)&&(console.warn("Wrong batch_size, must be in [10..100], using 10 instead"),t=10),(r<2||r>120)&&(console.warn("Wrong poll_timeout, must be in [2..120], using 20 instead"),r=20),n&&n<2&&(console.warn("Wrong max_empty_responses, must be in [2..infinity], using infinity"),n=void 0),i||(i="info"),l||(l="stop");let p=new e({batch_size:t,poll_timeout:r,max_empty_responses:n,log_level:i,on_error:l});return console.log("bot poll settings",p),p}},m=class extends R.Reference()("BotSettings",{defaultValue(){return x.make({})}}){};var z=e=>{for(let[o,t]of Object.entries(e))if(o!="update_id")return{type:o,...t}},B=class extends v.Class{},F=e=>s.gen(function*(){let o=yield*s.service(m),t=yield*s.service(g);return t.type=="single"?yield*W(e,t,o):yield*V(e,t)}),V=(e,o)=>s.try({try:()=>o.on_batch(e),catch:A.identity}).pipe(s.andThen(t=>t instanceof Promise?s.tryPromise({try:()=>t,catch:A.identity}):s.succeed(t)),s.andThen(t=>new B({hasErrors:!t,updates:e})),s.catchAll(t=>(console.warn("handle batch error",{errorMessage:t instanceof Error?t.message:void 0,updates:e.map(r=>Object.keys(r).at(1)),error:t}),s.succeed(new B({hasErrors:!0,updates:e}))))),M=class extends v.TaggedError("HandleUpdateError"){},W=(e,o,t)=>s.forEach(e,r=>J(r,o).pipe(s.catchAll(n=>(console.log("update handle error",{updateId:r.update_id,updateKey:Object.keys(r).at(1),name:n._tag,...n.cause instanceof Error?{error:n.cause.message}:void 0}),s.succeed(n)))),{concurrency:10}).pipe(s.andThen(r=>(t.log_level=="debug"&&console.debug("handle batch result",r),new B({hasErrors:!r.every(n=>n==null),updates:e})))),J=(e,o)=>s.gen(function*(){let t=z(e);if(!t)return yield*s.fail(new M({name:"UnknownUpdate",update:e}));let r=o[`on_${t.type}`];if(!r)return yield*s.fail(new M({name:"HandlerNotDefined",update:e}));t.type=="message"&&"text"in t&&console.info("Got a new text message",{chatId:t.chat.id,chatType:t.chat.type,message:`${t.text.slice(0,5)}...`});let n,i=yield*s.try({try:()=>r(t),catch:p=>new M({name:"BotHandlerError",update:e,cause:p})}).pipe(s.andThen(p=>p instanceof Promise?s.tryPromise({try:()=>p,catch:Z=>new M({name:"BotHandlerError",update:e,cause:Z})}):s.succeed(p)),s.catchAll(p=>(n=p,console.log("error",{updateId:e.update_id,updateKey:Object.keys(e).at(1),name:p._tag,...p.cause instanceof Error?{error:p.cause.message}:void 0}),s.succeed(_.make({type:"message",text:`Some internal error has happend(${p.name}) while handling this message`,message_effect_id:C["\u{1F4A9}"],...e.message?.message_id?{reply_parameters:{message_id:e.message?.message_id}}:void 0}))))),l=yield*s.service(m);if(!i&&l.log_level=="debug"){console.log(`Bot response is undefined for update with ID #${e.update_id}.`);return}if("chat"in t&&i.response){let p=yield*b(`send_${i.response.type}`,{...i.response,chat_id:t.chat.id});l.log_level=="debug"&&console.debug("bot response",p)}return n});var f=c(require("effect/Micro")),X=c(require("effect/Context"));var Q=c(require("effect/Context")),a=c(require("effect/Micro"));var L=c(require("effect/Context")),q=c(require("effect/Data")),d=c(require("effect/Micro"));var w=class extends L.Reference()("BotFetchUpdatesService",{defaultValue:()=>{let o={lastUpdateId:void 0,emptyResponses:0},t=ae(o).pipe(d.tap(n=>{let i=n.map(l=>l.update_id).sort().at(-1);console.log("updating last update id",i),o.lastUpdateId=i?i+1:void 0,console.log(o)})),r=ce(o);return{state:o,fetchUpdates:t,commit:r}}}){},S=class extends q.TaggedError("FetchUpdatesError"){},ae=e=>d.gen(function*(){let o=yield*d.service(m);if(o.max_empty_responses&&e.emptyResponses==o.max_empty_responses)return yield*d.fail(new S({name:"TooManyEmptyResponses"}));let t=e.lastUpdateId;o.log_level=="debug"&&console.debug("getting updates",e);let r=yield*b("get_updates",{timeout:o.poll_timeout,...t?{offset:t}:void 0}).pipe(d.andThen(n=>n.sort(i=>i.update_id)));return r.length?(console.debug(`got a batch of updates (${r.length})`),e.emptyResponses=0,r):(e.emptyResponses+=1,[])}),ce=e=>d.gen(function*(){return console.log("commit",{pollState:e}),e.lastUpdateId?yield*b("get_updates",{offset:e.lastUpdateId,limit:0}).pipe(d.andThen(d.andThen(d.service(m),o=>{o.log_level=="debug"&&console.debug("committed offset",e)}))):yield*d.fail(new S({name:"NoUpdatesToCommit"}))});var U=class extends Q.Reference()("BotRunService",{defaultValue:()=>{console.log("Initiating BotRunService");let o={fiber:void 0};return{runBotInBackground:pe(o),getFiber:()=>o.fiber}}}){},pe=e=>a.gen(function*(){console.log("running telegram chat bot");let o=yield*a.service(w),t=yield*a.service(m),r=i=>t.on_error=="continue"?!0:!i,n=a.delay(1e3)(o.fetchUpdates.pipe(a.andThen(F),a.tap(i=>i.updates.length>0&&r(i.hasErrors)?o.commit:a.void))).pipe(a.repeat({while:i=>r(i.hasErrors)}),a.forkDaemon,a.tap(i=>i.addObserver(l=>{console.log("bot's fiber has been closed",l)})));e.fiber&&(console.log("killing previous bot's fiber"),yield*a.fiberInterrupt(e.fiber)),e.fiber=yield*n,console.log("Fetching bot updates via long polling...")});var I=e=>f.gen(function*(){let o=yield*f.service(U),t=X.make(h,e.bot_token);return yield*o.runBotInBackground.pipe(f.provideService(g,e.mode),f.provideService(m,x.make(e.poll??{})),f.provideContext(t)),{reload:n=>o.runBotInBackground.pipe(f.provideService(g,n),f.provideContext(t),f.runPromise),fiber:o.getFiber}});var Y=c(require("effect/Micro"));var de=e=>I(e).pipe(Y.runPromise),le=e=>(Object.keys(e).length==0&&console.warn("No handlers are defined for bot"),e);0&&(module.exports={BatchUpdateResult,BotPollSettings,BotPollSettingsTag,BotResponse,BotRunService,BotUpdateHandlersTag,HandleUpdateError,defineBot,extractUpdate,handleEntireBatch,handleOneByOne,handleOneUpdate,handleUpdates,launchBot,runTgChatBot});
1
+ "use strict";var ee=Object.create;var T=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var se=(e,o)=>{for(var t in o)T(e,t,{get:o[t],enumerable:!0})},P=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of oe(o))!re.call(e,n)&&n!==t&&T(e,n,{get:()=>o[n],enumerable:!(r=te(o,n))||r.enumerable});return e};var c=(e,o,t)=>(t=e!=null?ee(ne(e)):{},P(o||!e||!e.__esModule?T(t,"default",{value:e,enumerable:!0}):t,e)),ie=e=>P(T({},"__esModule",{value:!0}),e);var me={};se(me,{BatchUpdateResult:()=>B,BotPollSettings:()=>x,BotPollSettingsTag:()=>m,BotResponse:()=>_,BotRunService:()=>U,BotUpdateHandlersTag:()=>g,HandleUpdateError:()=>M,defineBot:()=>le,extractUpdate:()=>z,handleEntireBatch:()=>V,handleOneByOne:()=>W,handleOneUpdate:()=>J,handleUpdates:()=>F,launchBot:()=>I,runTgChatBot:()=>de});module.exports=ie(me);var H=c(require("effect/Data")),_=class e extends H.TaggedClass("BotResponse"){static make(o){return new e({response:o})}static ignore=new e({})};var s=c(require("effect/Micro")),v=c(require("effect/Data")),A=c(require("effect/Function"));var K=c(require("effect/String")),u=c(require("effect/Micro"));var D=c(require("effect/Data")),y=class extends D.TaggedError("TgBotClientError"){};var $=e=>typeof e=="object"&&e!=null&&"file_content"in e&&e.file_content instanceof Uint8Array&&"file_name"in e&&typeof e.file_name=="string",N=e=>typeof e=="object"&&e!=null&&"ok"in e&&typeof e.ok=="boolean";var k=c(require("effect/Context"));var O="https://api.telegram.org",C={"\u{1F525}":"5104841245755180586","\u{1F44D}":"5107584321108051014","\u{1F44E}":"5104858069142078462","\u2764\uFE0F":"5159385139981059251","\u{1F389}":"5046509860389126442","\u{1F4A9}":"5046589136895476101"},Me=Object.keys(C);var E=class extends k.Reference()("TgBotApiBaseUrl",{defaultValue:()=>O}){},h=class extends k.Tag("TgBotApiToken")(){};var G=e=>{let o=Object.entries(e);if(o.length==0)return;let t=new FormData;for(let[r,n]of o)n&&(typeof n!="object"?t.append(r,`${n}`):$(n)?t.append(r,new Blob([n.file_content]),n.file_name):t.append(r,JSON.stringify(n)));return t};var b=(e,o)=>u.gen(function*(){let t=yield*u.service(h),r=yield*u.service(E),n=yield*u.tryPromise({try:()=>fetch(`${r}/bot${t}/${K.snakeToCamel(e)}`,{body:G(o)??null,method:"POST"}),catch:l=>new y({cause:{_tag:"ClientInternalError",cause:l}})}),i=yield*u.tryPromise({try:()=>n.json(),catch:()=>new y({cause:{_tag:"NotJsonResponse",response:n}})});return N(i)?n.ok?i.result:yield*u.fail(new y({cause:{_tag:"NotOkResponse",...i.error_code?{errorCode:i.error_code}:void 0,...i.description?{details:i.description}:void 0}})):yield*u.fail(new y({cause:{_tag:"UnexpectedResponse",response:i}}))});var R=c(require("effect/Context")),j=c(require("effect/Data")),g=class extends R.Tag("BotUpdateHandlers")(){},x=class e extends j.Class{static make(o){let t=o.batch_size??10,r=o.poll_timeout??10,n=o.max_empty_responses,i=o.log_level??"info",l=o.on_error;(t<10||t>100)&&(console.warn("Wrong batch_size, must be in [10..100], using 10 instead"),t=10),(r<2||r>120)&&(console.warn("Wrong poll_timeout, must be in [2..120], using 20 instead"),r=20),n&&n<2&&(console.warn("Wrong max_empty_responses, must be in [2..infinity], using infinity"),n=void 0),i||(i="info"),l||(l="stop");let p=new e({batch_size:t,poll_timeout:r,max_empty_responses:n,log_level:i,on_error:l});return console.log("bot poll settings",p),p}},m=class extends R.Reference()("BotSettings",{defaultValue(){return x.make({})}}){};var z=e=>{for(let[o,t]of Object.entries(e))if(o!="update_id")return{type:o,...t}},B=class extends v.Class{},F=e=>s.gen(function*(){let o=yield*s.service(m),t=yield*s.service(g);return t.type=="single"?yield*W(e,t,o):yield*V(e,t)}),V=(e,o)=>s.try({try:()=>o.on_batch(e),catch:A.identity}).pipe(s.andThen(t=>t instanceof Promise?s.tryPromise({try:()=>t,catch:A.identity}):s.succeed(t)),s.andThen(t=>new B({hasErrors:!t,updates:e})),s.catchAll(t=>(console.warn("handle batch error",{errorMessage:t instanceof Error?t.message:void 0,updates:e.map(r=>Object.keys(r).at(1)),error:t}),s.succeed(new B({hasErrors:!0,updates:e}))))),M=class extends v.TaggedError("HandleUpdateError"){},W=(e,o,t)=>s.forEach(e,r=>J(r,o).pipe(s.catchAll(n=>(console.log("update handle error",{updateId:r.update_id,updateKey:Object.keys(r).at(1),name:n._tag,...n.cause instanceof Error?{error:n.cause.message}:void 0}),s.succeed(n)))),{concurrency:10}).pipe(s.andThen(r=>(t.log_level=="debug"&&console.debug("handle batch result",r),new B({hasErrors:!r.every(n=>n==null),updates:e})))),J=(e,o)=>s.gen(function*(){let t=z(e);if(!t)return yield*s.fail(new M({name:"UnknownUpdate",update:e}));let r=o[`on_${t.type}`];if(!r)return yield*s.fail(new M({name:"HandlerNotDefined",update:e}));t.type=="message"&&"text"in t&&console.info("Got a new text message",{chatId:t.chat.id,chatType:t.chat.type,message:`${t.text.slice(0,5)}...`});let n,i=yield*s.try({try:()=>r(t),catch:p=>new M({name:"BotHandlerError",update:e,cause:p})}).pipe(s.andThen(p=>p instanceof Promise?s.tryPromise({try:()=>p,catch:Z=>new M({name:"BotHandlerError",update:e,cause:Z})}):s.succeed(p)),s.catchAll(p=>(n=p,console.log("error",{updateId:e.update_id,updateKey:Object.keys(e).at(1),name:p._tag,...p.cause instanceof Error?{error:p.cause.message}:void 0}),s.succeed(_.make({type:"message",text:`Some internal error has happend(${p.name}) while handling this message`,message_effect_id:C["\u{1F4A9}"],...e.message?.message_id?{reply_parameters:{message_id:e.message?.message_id}}:void 0}))))),l=yield*s.service(m);if(!i&&l.log_level=="debug"){console.log(`Bot response is undefined for update with ID #${e.update_id}.`);return}if("chat"in t&&i.response){let p=yield*b(`send_${i.response.type}`,{...i.response,chat_id:t.chat.id});l.log_level=="debug"&&console.debug("bot response",p)}return n});var f=c(require("effect/Micro")),X=c(require("effect/Context"));var Q=c(require("effect/Context")),a=c(require("effect/Micro"));var L=c(require("effect/Context")),q=c(require("effect/Data")),d=c(require("effect/Micro"));var w=class extends L.Reference()("BotFetchUpdatesService",{defaultValue:()=>{let o={lastUpdateId:void 0,emptyResponses:0},t=ae(o).pipe(d.tap(n=>{let i=n.map(l=>l.update_id).sort().at(-1);console.log("updating last update id",i),o.lastUpdateId=i?i+1:void 0,console.log(o)})),r=ce(o);return{state:o,fetchUpdates:t,commit:r}}}){},S=class extends q.TaggedError("FetchUpdatesError"){},ae=e=>d.gen(function*(){let o=yield*d.service(m);if(o.max_empty_responses&&e.emptyResponses==o.max_empty_responses)return yield*d.fail(new S({name:"TooManyEmptyResponses"}));let t=e.lastUpdateId;o.log_level=="debug"&&console.debug("getting updates",e);let r=yield*b("get_updates",{timeout:o.poll_timeout,...t?{offset:t}:void 0}).pipe(d.andThen(n=>n.sort(i=>i.update_id)));return r.length?(console.debug(`got a batch of updates (${r.length})`),e.emptyResponses=0,r):(e.emptyResponses+=1,[])}),ce=e=>d.gen(function*(){return console.log("commit",{pollState:e}),e.lastUpdateId?yield*b("get_updates",{offset:e.lastUpdateId,limit:0}).pipe(d.andThen(d.andThen(d.service(m),o=>{o.log_level=="debug"&&console.debug("committed offset",e)}))):yield*d.fail(new S({name:"NoUpdatesToCommit"}))});var U=class extends Q.Reference()("BotRunService",{defaultValue:()=>{console.log("Initiating BotRunService");let o={fiber:void 0};return{runBotInBackground:pe(o),getFiber:()=>o.fiber}}}){},pe=e=>a.gen(function*(){console.log("running telegram chat bot");let o=yield*a.service(w),t=yield*a.service(m),r=i=>t.on_error=="continue"?!0:!i,n=a.delay(1e3)(o.fetchUpdates.pipe(a.andThen(F),a.tap(i=>i.updates.length>0&&r(i.hasErrors)?o.commit:a.void))).pipe(a.repeat({while:i=>r(i.hasErrors)}),a.forkDaemon,a.tap(i=>i.addObserver(l=>{console.log("bot's fiber has been closed",l)})));e.fiber&&(console.log("killing previous bot's fiber"),yield*a.fiberInterrupt(e.fiber)),e.fiber=yield*n,console.log("Fetching bot updates via long polling...")});var I=e=>f.gen(function*(){let o=yield*f.service(U),t=X.make(h,e.bot_token);return yield*o.runBotInBackground.pipe(f.provideService(g,e.mode),f.provideService(m,x.make(e.poll??{})),f.provideContext(t)),{reload:n=>o.runBotInBackground.pipe(f.provideService(g,n),f.provideContext(t),f.runPromise),fiber:o.getFiber}});var Y=c(require("effect/Micro"));var de=e=>I(e).pipe(Y.runPromise),le=e=>(Object.keys(e).length==0&&console.warn("No handlers are defined for bot"),e);0&&(module.exports={BatchUpdateResult,BotPollSettings,BotPollSettingsTag,BotResponse,BotRunService,BotUpdateHandlersTag,HandleUpdateError,defineBot,extractUpdate,handleEntireBatch,handleOneByOne,handleOneUpdate,handleUpdates,launchBot,runTgChatBot});
package/dist/bot.mjs CHANGED
@@ -1 +1 @@
1
- import*as C from"effect/Data";var _=class e extends C.TaggedClass("BotResponse"){static make(o){return new e({response:o})}static ignore=new e({})};import*as s from"effect/Micro";import*as E from"effect/Data";import*as S from"effect/Function";import*as D from"effect/String";import*as f from"effect/Micro";import*as A from"effect/Data";var u=class e extends A.TaggedError("TgBotClientError"){static missingSuccess=new e({cause:{type:"ClientInternalError",cause:"Expected 'success' to be defined"}})};var F=e=>typeof e=="object"&&e!=null&&"file_content"in e&&e.file_content instanceof Uint8Array&&"file_name"in e&&typeof e.file_name=="string",I=e=>typeof e=="object"&&e!=null&&"ok"in e&&typeof e.ok=="boolean";import*as U from"effect/Context";var P="https://api.telegram.org",w={"\u{1F525}":"5104841245755180586","\u{1F44D}":"5107584321108051014","\u{1F44E}":"5104858069142078462","\u2764\uFE0F":"5159385139981059251","\u{1F389}":"5046509860389126442","\u{1F4A9}":"5046589136895476101"},ne=Object.keys(w);var b=class extends U.Reference()("TgBotApiBaseUrl",{defaultValue:()=>P}){},y=class extends U.Tag("TgBotApiToken")(){};var H=e=>{let o=Object.entries(e);if(o.length==0)return;let t=new FormData;for(let[r,n]of o)n&&(typeof n!="object"?t.append(r,`${n}`):F(n)?t.append(r,new Blob([n.file_content]),n.file_name):t.append(r,JSON.stringify(n)));return t};var h=(e,o)=>f.gen(function*(){let t=yield*f.service(y),r=yield*f.service(b),n=yield*f.tryPromise({try:()=>fetch(`${r}/bot${t}/${D.snakeToCamel(e)}`,{body:H(o)??null,method:"POST"}),catch:d=>new u({cause:{type:"ClientInternalError",cause:d}})}),i=yield*f.tryPromise({try:()=>n.json(),catch:()=>new u({cause:{type:"NotJsonResponse",response:n}})});return I(i)?n.ok?i.result:yield*f.fail(new u({cause:{type:"NotOkResponse",...i.error_code?{errorCode:i.error_code}:void 0,...i.description?{details:i.description}:void 0}})):yield*f.fail(new u({cause:{type:"UnexpectedResponse",response:i}}))});import*as T from"effect/Context";import*as $ from"effect/Data";var g=class extends T.Tag("BotUpdateHandlers")(){},x=class e extends $.Class{static make(o){let t=o.batch_size??10,r=o.poll_timeout??10,n=o.max_empty_responses,i=o.log_level??"info",d=o.on_error;(t<10||t>100)&&(console.warn("Wrong batch_size, must be in [10..100], using 10 instead"),t=10),(r<2||r>120)&&(console.warn("Wrong poll_timeout, must be in [2..120], using 20 instead"),r=20),n&&n<2&&(console.warn("Wrong max_empty_responses, must be in [2..infinity], using infinity"),n=void 0),i||(i="info"),d||(d="stop");let c=new e({batch_size:t,poll_timeout:r,max_empty_responses:n,log_level:i,on_error:d});return console.log("bot poll settings",c),c}},m=class extends T.Reference()("BotSettings",{defaultValue(){return x.make({})}}){};var J=e=>{for(let[o,t]of Object.entries(e))if(o!="update_id")return{type:o,...t}},B=class extends E.Class{},N=e=>s.gen(function*(){let o=yield*s.service(m),t=yield*s.service(g);return t.type=="single"?yield*q(e,t,o):yield*L(e,t)}),L=(e,o)=>s.try({try:()=>o.on_batch(e),catch:S.identity}).pipe(s.andThen(t=>t instanceof Promise?s.tryPromise({try:()=>t,catch:S.identity}):s.succeed(t)),s.andThen(t=>new B({hasErrors:!t,updates:e})),s.catchAll(t=>(console.warn("handle batch error",{errorMessage:t instanceof Error?t.message:void 0,updates:e.map(r=>Object.keys(r).at(1)),error:t}),s.succeed(new B({hasErrors:!0,updates:e}))))),M=class extends E.TaggedError("HandleUpdateError"){},q=(e,o,t)=>s.forEach(e,r=>Q(r,o).pipe(s.catchAll(n=>(console.log("update handle error",{updateId:r.update_id,updateKey:Object.keys(r).at(1),name:n._tag,...n.cause instanceof Error?{error:n.cause.message}:void 0}),s.succeed(n)))),{concurrency:10}).pipe(s.andThen(r=>(t.log_level=="debug"&&console.debug("handle batch result",r),new B({hasErrors:!r.every(n=>n==null),updates:e})))),Q=(e,o)=>s.gen(function*(){let t=J(e);if(!t)return yield*s.fail(new M({name:"UnknownUpdate",update:e}));let r=o[`on_${t.type}`];if(!r)return yield*s.fail(new M({name:"HandlerNotDefined",update:e}));t.type=="message"&&"text"in t&&console.info("Got a new text message",{chatId:t.chat.id,chatType:t.chat.type,message:`${t.text.slice(0,5)}...`});let n,i=yield*s.try({try:()=>r(t),catch:c=>new M({name:"BotHandlerError",update:e,cause:c})}).pipe(s.andThen(c=>c instanceof Promise?s.tryPromise({try:()=>c,catch:W=>new M({name:"BotHandlerError",update:e,cause:W})}):s.succeed(c)),s.catchAll(c=>(n=c,console.log("error",{updateId:e.update_id,updateKey:Object.keys(e).at(1),name:c._tag,...c.cause instanceof Error?{error:c.cause.message}:void 0}),s.succeed(_.make({type:"message",text:`Some internal error has happend(${c.name}) while handling this message`,message_effect_id:w["\u{1F4A9}"],...e.message?.message_id?{reply_parameters:{message_id:e.message?.message_id}}:void 0}))))),d=yield*s.service(m);if(!i&&d.log_level=="debug"){console.log(`Bot response is undefined for update with ID #${e.update_id}.`);return}if("chat"in t&&i.response){let c=yield*h(`send_${i.response.type}`,{...i.response,chat_id:t.chat.id});d.log_level=="debug"&&console.debug("bot response",c)}return n});import*as l from"effect/Micro";import*as j from"effect/Context";import*as K from"effect/Context";import*as a from"effect/Micro";import*as O from"effect/Context";import*as G from"effect/Data";import*as p from"effect/Micro";var k=class extends O.Reference()("BotFetchUpdatesService",{defaultValue:()=>{let o={lastUpdateId:void 0,emptyResponses:0},t=X(o).pipe(p.tap(n=>{let i=n.map(d=>d.update_id).sort().at(-1);console.log("updating last update id",i),o.lastUpdateId=i?i+1:void 0,console.log(o)})),r=Y(o);return{state:o,fetchUpdates:t,commit:r}}}){},R=class extends G.TaggedError("FetchUpdatesError"){},X=e=>p.gen(function*(){let o=yield*p.service(m);if(o.max_empty_responses&&e.emptyResponses==o.max_empty_responses)return yield*p.fail(new R({name:"TooManyEmptyResponses"}));let t=e.lastUpdateId;o.log_level=="debug"&&console.debug("getting updates",e);let r=yield*h("get_updates",{timeout:o.poll_timeout,...t?{offset:t}:void 0}).pipe(p.andThen(n=>n.sort(i=>i.update_id)));return r.length?(console.debug(`got a batch of updates (${r.length})`),e.emptyResponses=0,r):(e.emptyResponses+=1,[])}),Y=e=>p.gen(function*(){return console.log("commit",{pollState:e}),e.lastUpdateId?yield*h("get_updates",{offset:e.lastUpdateId,limit:0}).pipe(p.andThen(p.andThen(p.service(m),o=>{o.log_level=="debug"&&console.debug("committed offset",e)}))):yield*p.fail(new R({name:"NoUpdatesToCommit"}))});var v=class extends K.Reference()("BotRunService",{defaultValue:()=>{console.log("Initiating BotRunService");let o={fiber:void 0};return{runBotInBackground:Z(o),getFiber:()=>o.fiber}}}){},Z=e=>a.gen(function*(){console.log("running telegram chat bot");let o=yield*a.service(k),t=yield*a.service(m),r=i=>t.on_error=="continue"?!0:!i,n=a.delay(1e3)(o.fetchUpdates.pipe(a.andThen(N),a.tap(i=>i.updates.length>0&&r(i.hasErrors)?o.commit:a.void))).pipe(a.repeat({while:i=>r(i.hasErrors)}),a.forkDaemon,a.tap(i=>i.addObserver(d=>{console.log("bot's fiber has been closed",d)})));e.fiber&&(console.log("killing previous bot's fiber"),yield*a.fiberInterrupt(e.fiber)),e.fiber=yield*n,console.log("Fetching bot updates via long polling...")});var z=e=>l.gen(function*(){let o=yield*l.service(v),t=j.make(y,e.bot_token);return yield*o.runBotInBackground.pipe(l.provideService(g,e.mode),l.provideService(m,x.make(e.poll??{})),l.provideContext(t)),{reload:n=>o.runBotInBackground.pipe(l.provideService(g,n),l.provideContext(t),l.runPromise),fiber:o.getFiber}});import*as V from"effect/Micro";var Pe=e=>z(e).pipe(V.runPromise),He=e=>(Object.keys(e).length==0&&console.warn("No handlers are defined for bot"),e);export{B as BatchUpdateResult,x as BotPollSettings,m as BotPollSettingsTag,_ as BotResponse,v as BotRunService,g as BotUpdateHandlersTag,M as HandleUpdateError,He as defineBot,J as extractUpdate,L as handleEntireBatch,q as handleOneByOne,Q as handleOneUpdate,N as handleUpdates,z as launchBot,Pe as runTgChatBot};
1
+ import*as C from"effect/Data";var _=class e extends C.TaggedClass("BotResponse"){static make(o){return new e({response:o})}static ignore=new e({})};import*as s from"effect/Micro";import*as E from"effect/Data";import*as S from"effect/Function";import*as D from"effect/String";import*as f from"effect/Micro";import*as A from"effect/Data";var u=class extends A.TaggedError("TgBotClientError"){};var F=e=>typeof e=="object"&&e!=null&&"file_content"in e&&e.file_content instanceof Uint8Array&&"file_name"in e&&typeof e.file_name=="string",I=e=>typeof e=="object"&&e!=null&&"ok"in e&&typeof e.ok=="boolean";import*as U from"effect/Context";var P="https://api.telegram.org",w={"\u{1F525}":"5104841245755180586","\u{1F44D}":"5107584321108051014","\u{1F44E}":"5104858069142078462","\u2764\uFE0F":"5159385139981059251","\u{1F389}":"5046509860389126442","\u{1F4A9}":"5046589136895476101"},ne=Object.keys(w);var b=class extends U.Reference()("TgBotApiBaseUrl",{defaultValue:()=>P}){},y=class extends U.Tag("TgBotApiToken")(){};var H=e=>{let o=Object.entries(e);if(o.length==0)return;let t=new FormData;for(let[r,n]of o)n&&(typeof n!="object"?t.append(r,`${n}`):F(n)?t.append(r,new Blob([n.file_content]),n.file_name):t.append(r,JSON.stringify(n)));return t};var h=(e,o)=>f.gen(function*(){let t=yield*f.service(y),r=yield*f.service(b),n=yield*f.tryPromise({try:()=>fetch(`${r}/bot${t}/${D.snakeToCamel(e)}`,{body:H(o)??null,method:"POST"}),catch:d=>new u({cause:{_tag:"ClientInternalError",cause:d}})}),i=yield*f.tryPromise({try:()=>n.json(),catch:()=>new u({cause:{_tag:"NotJsonResponse",response:n}})});return I(i)?n.ok?i.result:yield*f.fail(new u({cause:{_tag:"NotOkResponse",...i.error_code?{errorCode:i.error_code}:void 0,...i.description?{details:i.description}:void 0}})):yield*f.fail(new u({cause:{_tag:"UnexpectedResponse",response:i}}))});import*as T from"effect/Context";import*as $ from"effect/Data";var g=class extends T.Tag("BotUpdateHandlers")(){},x=class e extends $.Class{static make(o){let t=o.batch_size??10,r=o.poll_timeout??10,n=o.max_empty_responses,i=o.log_level??"info",d=o.on_error;(t<10||t>100)&&(console.warn("Wrong batch_size, must be in [10..100], using 10 instead"),t=10),(r<2||r>120)&&(console.warn("Wrong poll_timeout, must be in [2..120], using 20 instead"),r=20),n&&n<2&&(console.warn("Wrong max_empty_responses, must be in [2..infinity], using infinity"),n=void 0),i||(i="info"),d||(d="stop");let c=new e({batch_size:t,poll_timeout:r,max_empty_responses:n,log_level:i,on_error:d});return console.log("bot poll settings",c),c}},m=class extends T.Reference()("BotSettings",{defaultValue(){return x.make({})}}){};var J=e=>{for(let[o,t]of Object.entries(e))if(o!="update_id")return{type:o,...t}},B=class extends E.Class{},N=e=>s.gen(function*(){let o=yield*s.service(m),t=yield*s.service(g);return t.type=="single"?yield*q(e,t,o):yield*L(e,t)}),L=(e,o)=>s.try({try:()=>o.on_batch(e),catch:S.identity}).pipe(s.andThen(t=>t instanceof Promise?s.tryPromise({try:()=>t,catch:S.identity}):s.succeed(t)),s.andThen(t=>new B({hasErrors:!t,updates:e})),s.catchAll(t=>(console.warn("handle batch error",{errorMessage:t instanceof Error?t.message:void 0,updates:e.map(r=>Object.keys(r).at(1)),error:t}),s.succeed(new B({hasErrors:!0,updates:e}))))),M=class extends E.TaggedError("HandleUpdateError"){},q=(e,o,t)=>s.forEach(e,r=>Q(r,o).pipe(s.catchAll(n=>(console.log("update handle error",{updateId:r.update_id,updateKey:Object.keys(r).at(1),name:n._tag,...n.cause instanceof Error?{error:n.cause.message}:void 0}),s.succeed(n)))),{concurrency:10}).pipe(s.andThen(r=>(t.log_level=="debug"&&console.debug("handle batch result",r),new B({hasErrors:!r.every(n=>n==null),updates:e})))),Q=(e,o)=>s.gen(function*(){let t=J(e);if(!t)return yield*s.fail(new M({name:"UnknownUpdate",update:e}));let r=o[`on_${t.type}`];if(!r)return yield*s.fail(new M({name:"HandlerNotDefined",update:e}));t.type=="message"&&"text"in t&&console.info("Got a new text message",{chatId:t.chat.id,chatType:t.chat.type,message:`${t.text.slice(0,5)}...`});let n,i=yield*s.try({try:()=>r(t),catch:c=>new M({name:"BotHandlerError",update:e,cause:c})}).pipe(s.andThen(c=>c instanceof Promise?s.tryPromise({try:()=>c,catch:W=>new M({name:"BotHandlerError",update:e,cause:W})}):s.succeed(c)),s.catchAll(c=>(n=c,console.log("error",{updateId:e.update_id,updateKey:Object.keys(e).at(1),name:c._tag,...c.cause instanceof Error?{error:c.cause.message}:void 0}),s.succeed(_.make({type:"message",text:`Some internal error has happend(${c.name}) while handling this message`,message_effect_id:w["\u{1F4A9}"],...e.message?.message_id?{reply_parameters:{message_id:e.message?.message_id}}:void 0}))))),d=yield*s.service(m);if(!i&&d.log_level=="debug"){console.log(`Bot response is undefined for update with ID #${e.update_id}.`);return}if("chat"in t&&i.response){let c=yield*h(`send_${i.response.type}`,{...i.response,chat_id:t.chat.id});d.log_level=="debug"&&console.debug("bot response",c)}return n});import*as l from"effect/Micro";import*as j from"effect/Context";import*as K from"effect/Context";import*as a from"effect/Micro";import*as O from"effect/Context";import*as G from"effect/Data";import*as p from"effect/Micro";var k=class extends O.Reference()("BotFetchUpdatesService",{defaultValue:()=>{let o={lastUpdateId:void 0,emptyResponses:0},t=X(o).pipe(p.tap(n=>{let i=n.map(d=>d.update_id).sort().at(-1);console.log("updating last update id",i),o.lastUpdateId=i?i+1:void 0,console.log(o)})),r=Y(o);return{state:o,fetchUpdates:t,commit:r}}}){},R=class extends G.TaggedError("FetchUpdatesError"){},X=e=>p.gen(function*(){let o=yield*p.service(m);if(o.max_empty_responses&&e.emptyResponses==o.max_empty_responses)return yield*p.fail(new R({name:"TooManyEmptyResponses"}));let t=e.lastUpdateId;o.log_level=="debug"&&console.debug("getting updates",e);let r=yield*h("get_updates",{timeout:o.poll_timeout,...t?{offset:t}:void 0}).pipe(p.andThen(n=>n.sort(i=>i.update_id)));return r.length?(console.debug(`got a batch of updates (${r.length})`),e.emptyResponses=0,r):(e.emptyResponses+=1,[])}),Y=e=>p.gen(function*(){return console.log("commit",{pollState:e}),e.lastUpdateId?yield*h("get_updates",{offset:e.lastUpdateId,limit:0}).pipe(p.andThen(p.andThen(p.service(m),o=>{o.log_level=="debug"&&console.debug("committed offset",e)}))):yield*p.fail(new R({name:"NoUpdatesToCommit"}))});var v=class extends K.Reference()("BotRunService",{defaultValue:()=>{console.log("Initiating BotRunService");let o={fiber:void 0};return{runBotInBackground:Z(o),getFiber:()=>o.fiber}}}){},Z=e=>a.gen(function*(){console.log("running telegram chat bot");let o=yield*a.service(k),t=yield*a.service(m),r=i=>t.on_error=="continue"?!0:!i,n=a.delay(1e3)(o.fetchUpdates.pipe(a.andThen(N),a.tap(i=>i.updates.length>0&&r(i.hasErrors)?o.commit:a.void))).pipe(a.repeat({while:i=>r(i.hasErrors)}),a.forkDaemon,a.tap(i=>i.addObserver(d=>{console.log("bot's fiber has been closed",d)})));e.fiber&&(console.log("killing previous bot's fiber"),yield*a.fiberInterrupt(e.fiber)),e.fiber=yield*n,console.log("Fetching bot updates via long polling...")});var z=e=>l.gen(function*(){let o=yield*l.service(v),t=j.make(y,e.bot_token);return yield*o.runBotInBackground.pipe(l.provideService(g,e.mode),l.provideService(m,x.make(e.poll??{})),l.provideContext(t)),{reload:n=>o.runBotInBackground.pipe(l.provideService(g,n),l.provideContext(t),l.runPromise),fiber:o.getFiber}});import*as V from"effect/Micro";var Pe=e=>z(e).pipe(V.runPromise),He=e=>(Object.keys(e).length==0&&console.warn("No handlers are defined for bot"),e);export{B as BatchUpdateResult,x as BotPollSettings,m as BotPollSettingsTag,_ as BotResponse,v as BotRunService,g as BotUpdateHandlersTag,M as HandleUpdateError,He as defineBot,J as extractUpdate,L as handleEntireBatch,q as handleOneByOne,Q as handleOneUpdate,N as handleUpdates,z as launchBot,Pe as runTgChatBot};
@@ -1,5 +1,6 @@
1
1
  import * as effect_Cause from 'effect/Cause';
2
2
  import * as effect_Types from 'effect/Types';
3
+ import * as Data from 'effect/Data';
3
4
  import * as Context from 'effect/Context';
4
5
 
5
6
  type AllowedUpdateName = Exclude<keyof Update, "update_id">;
@@ -415,6 +416,29 @@ interface ChatShared {
415
416
  username?: string;
416
417
  photo?: PhotoSize[];
417
418
  }
419
+ interface Checklist {
420
+ title: string;
421
+ tasks: ChecklistTask[];
422
+ title_entities?: MessageEntity[];
423
+ others_can_add_tasks?: boolean;
424
+ others_can_mark_tasks_as_done?: boolean;
425
+ }
426
+ interface ChecklistTask {
427
+ id: number;
428
+ text: string;
429
+ text_entities?: MessageEntity[];
430
+ completed_by_user?: User;
431
+ completion_date?: number;
432
+ }
433
+ interface ChecklistTasksAdded {
434
+ tasks: ChecklistTask[];
435
+ checklist_message?: Message;
436
+ }
437
+ interface ChecklistTasksDone {
438
+ checklist_message?: Message;
439
+ marked_as_done_task_ids?: number[];
440
+ marked_as_not_done_task_ids?: number[];
441
+ }
418
442
  interface ChosenInlineResult {
419
443
  result_id: string;
420
444
  from: User;
@@ -436,6 +460,10 @@ interface Dice {
436
460
  emoji: string;
437
461
  value: number;
438
462
  }
463
+ interface DirectMessagePriceChanged {
464
+ are_direct_messages_enabled: boolean;
465
+ direct_message_star_count?: number;
466
+ }
439
467
  interface Document {
440
468
  file_id: string;
441
469
  file_unique_id: string;
@@ -477,6 +505,7 @@ interface ExternalReplyInfo {
477
505
  video_note?: VideoNote;
478
506
  voice?: Voice;
479
507
  has_media_spoiler?: boolean;
508
+ checklist?: Checklist;
480
509
  contact?: Contact;
481
510
  dice?: Dice;
482
511
  game?: Game;
@@ -883,6 +912,20 @@ interface InlineQueryResultVoice {
883
912
  reply_markup?: InlineKeyboardMarkup;
884
913
  input_message_content?: InputMessageContent;
885
914
  }
915
+ interface InputChecklist {
916
+ title: string;
917
+ tasks: InputChecklistTask[];
918
+ parse_mode?: "HTML" | "MarkdownV2";
919
+ title_entities?: MessageEntity[];
920
+ others_can_add_tasks?: boolean;
921
+ others_can_mark_tasks_as_done?: boolean;
922
+ }
923
+ interface InputChecklistTask {
924
+ id: number;
925
+ text: string;
926
+ parse_mode?: "HTML" | "MarkdownV2";
927
+ text_entities?: MessageEntity[];
928
+ }
886
929
  interface InputContactMessageContent {
887
930
  phone_number: string;
888
931
  first_name: string;
@@ -1182,6 +1225,7 @@ interface Message {
1182
1225
  caption_entities?: MessageEntity[];
1183
1226
  show_caption_above_media?: boolean;
1184
1227
  has_media_spoiler?: boolean;
1228
+ checklist?: Checklist;
1185
1229
  contact?: Contact;
1186
1230
  dice?: Dice;
1187
1231
  game?: Game;
@@ -1213,6 +1257,9 @@ interface Message {
1213
1257
  proximity_alert_triggered?: ProximityAlertTriggered;
1214
1258
  boost_added?: ChatBoostAdded;
1215
1259
  chat_background_set?: ChatBackground;
1260
+ checklist_tasks_done?: ChecklistTasksDone;
1261
+ checklist_tasks_added?: ChecklistTasksAdded;
1262
+ direct_message_price_changed?: DirectMessagePriceChanged;
1216
1263
  forum_topic_created?: ForumTopicCreated;
1217
1264
  forum_topic_edited?: ForumTopicEdited;
1218
1265
  forum_topic_closed?: ForumTopicClosed;
@@ -1321,6 +1368,7 @@ interface OwnedGiftUnique {
1321
1368
  is_saved?: boolean;
1322
1369
  can_be_transferred?: boolean;
1323
1370
  transfer_star_count?: number;
1371
+ next_transfer_date?: number;
1324
1372
  }
1325
1373
  type PaidMedia = PaidMediaPreview | PaidMediaPhoto | PaidMediaVideo;
1326
1374
  interface PaidMediaInfo {
@@ -1477,7 +1525,7 @@ interface ReactionTypeCustomEmoji {
1477
1525
  }
1478
1526
  interface ReactionTypeEmoji {
1479
1527
  type: "emoji";
1480
- emoji: "👍" | "👎" | "" | "🔥" | "🥰" | "👏" | "😁" | "🤔" | "🤯" | "😱" | "🤬" | "😢" | "🎉" | "🤩" | "🤮" | "💩" | "🙏" | "👌" | "🕊" | "🤡" | "🥱" | "🥴" | "😍" | "🐳" | "❤‍🔥" | "🌚" | "🌭" | "💯" | "🤣" | "⚡" | "🍌" | "🏆" | "💔" | "🤨" | "😐" | "🍓" | "🍾" | "💋" | "🖕" | "😈" | "😴" | "😭" | "🤓" | "👻" | "👨‍💻" | "👀" | "🎃" | "🙈" | "😇" | "😨" | "🤝" | "✍" | "🤗" | "🫡" | "🎅" | "🎄" | "☃" | "💅" | "🤪" | "🗿" | "🆒" | "💘" | "🙉" | "🦄" | "😘" | "💊" | "🙊" | "😎" | "👾" | "🤷‍♂" | "🤷" | "🤷‍♀" | "😡";
1528
+ emoji: "" | "👍" | "👎" | "🔥" | "🥰" | "👏" | "😁" | "🤔" | "🤯" | "😱" | "🤬" | "😢" | "🎉" | "🤩" | "🤮" | "💩" | "🙏" | "👌" | "🕊" | "🤡" | "🥱" | "🥴" | "😍" | "🐳" | "❤‍🔥" | "🌚" | "🌭" | "💯" | "🤣" | "⚡" | "🍌" | "🏆" | "💔" | "🤨" | "😐" | "🍓" | "🍾" | "💋" | "🖕" | "😈" | "😴" | "😭" | "🤓" | "👻" | "👨‍💻" | "👀" | "🎃" | "🙈" | "😇" | "😨" | "🤝" | "✍" | "🤗" | "🫡" | "🎅" | "🎄" | "☃" | "💅" | "🤪" | "🗿" | "🆒" | "💘" | "🙉" | "🦄" | "😘" | "💊" | "🙊" | "😎" | "👾" | "🤷‍♂" | "🤷" | "🤷‍♀" | "😡";
1481
1529
  }
1482
1530
  interface ReactionTypePaid {
1483
1531
  type: "paid";
@@ -1721,8 +1769,10 @@ interface UniqueGiftBackdropColors {
1721
1769
  interface UniqueGiftInfo {
1722
1770
  gift: UniqueGift;
1723
1771
  origin: string;
1772
+ last_resale_star_count?: number;
1724
1773
  owned_gift_id?: string;
1725
1774
  transfer_star_count?: number;
1775
+ next_transfer_date?: number;
1726
1776
  }
1727
1777
  interface UniqueGiftModel {
1728
1778
  name: string;
@@ -1895,6 +1945,7 @@ interface Api {
1895
1945
  edit_forum_topic(_: EditForumTopicInput): boolean;
1896
1946
  edit_general_forum_topic(_: EditGeneralForumTopicInput): boolean;
1897
1947
  edit_message_caption(_: EditMessageCaptionInput): Message | boolean;
1948
+ edit_message_checklist(_: EditMessageChecklistInput): Message;
1898
1949
  edit_message_live_location(_: EditMessageLiveLocationInput): Message | boolean;
1899
1950
  edit_message_media(_: EditMessageMediaInput): Message | boolean;
1900
1951
  edit_message_reply_markup(_: EditMessageReplyMarkupInput): Message | boolean;
@@ -1923,6 +1974,7 @@ interface Api {
1923
1974
  get_my_description(_: GetMyDescriptionInput): BotDescription;
1924
1975
  get_my_name(_: GetMyNameInput): BotName;
1925
1976
  get_my_short_description(_: GetMyShortDescriptionInput): BotShortDescription;
1977
+ get_my_star_balance(_: GetMyStarBalanceInput): StarAmount;
1926
1978
  get_star_transactions(_: GetStarTransactionsInput): StarTransactions;
1927
1979
  get_sticker_set(_: GetStickerSetInput): StickerSet;
1928
1980
  get_updates(_: GetUpdatesInput): Update[];
@@ -1950,6 +2002,7 @@ interface Api {
1950
2002
  send_animation(_: SendAnimationInput): Message;
1951
2003
  send_audio(_: SendAudioInput): Message;
1952
2004
  send_chat_action(_: SendChatActionInput): boolean;
2005
+ send_checklist(_: SendChecklistInput): Message;
1953
2006
  send_contact(_: SendContactInput): Message;
1954
2007
  send_dice(_: SendDiceInput): Message;
1955
2008
  send_document(_: SendDocumentInput): Message;
@@ -2227,6 +2280,13 @@ interface EditMessageCaptionInput {
2227
2280
  show_caption_above_media?: boolean;
2228
2281
  reply_markup?: InlineKeyboardMarkup;
2229
2282
  }
2283
+ interface EditMessageChecklistInput {
2284
+ business_connection_id: string;
2285
+ chat_id: number;
2286
+ message_id: number;
2287
+ checklist: InputChecklist;
2288
+ reply_markup?: InlineKeyboardMarkup;
2289
+ }
2230
2290
  interface EditMessageLiveLocationInput {
2231
2291
  latitude: number;
2232
2292
  longitude: number;
@@ -2367,6 +2427,8 @@ interface GetMyNameInput {
2367
2427
  interface GetMyShortDescriptionInput {
2368
2428
  language_code?: string;
2369
2429
  }
2430
+ interface GetMyStarBalanceInput {
2431
+ }
2370
2432
  interface GetStarTransactionsInput {
2371
2433
  offset?: number;
2372
2434
  limit?: number;
@@ -2540,6 +2602,16 @@ interface SendChatActionInput {
2540
2602
  business_connection_id?: string;
2541
2603
  message_thread_id?: number;
2542
2604
  }
2605
+ interface SendChecklistInput {
2606
+ business_connection_id: string;
2607
+ chat_id: number;
2608
+ checklist: InputChecklist;
2609
+ disable_notification?: boolean;
2610
+ protect_content?: boolean;
2611
+ message_effect_id?: string;
2612
+ reply_parameters?: ReplyParameters;
2613
+ reply_markup?: InlineKeyboardMarkup;
2614
+ }
2543
2615
  interface SendContactInput {
2544
2616
  chat_id: number | string;
2545
2617
  phone_number: string;
@@ -3031,25 +3103,26 @@ interface VerifyUserInput {
3031
3103
  custom_description?: string;
3032
3104
  }
3033
3105
 
3034
- type ErrorReason = Readonly<{
3035
- type: "NotOkResponse";
3036
- errorCode?: number;
3037
- details?: string;
3038
- } | {
3039
- type: "UnexpectedResponse";
3040
- response: unknown;
3041
- } | {
3042
- type: "ClientInternalError";
3043
- cause: unknown;
3044
- } | {
3045
- type: "UnableToGetFile";
3046
- cause: unknown;
3047
- } | {
3048
- type: "BotHandlerError";
3049
- cause: unknown;
3050
- } | {
3051
- type: "NotJsonResponse";
3052
- response: unknown;
3106
+ type ErrorReason = Data.TaggedEnum<{
3107
+ NotOkResponse: {
3108
+ errorCode?: number;
3109
+ details?: string;
3110
+ };
3111
+ UnexpectedResponse: {
3112
+ response: unknown;
3113
+ };
3114
+ ClientInternalError: {
3115
+ cause: unknown;
3116
+ };
3117
+ UnableToGetFile: {
3118
+ cause: unknown;
3119
+ };
3120
+ BotHandlerError: {
3121
+ cause: unknown;
3122
+ };
3123
+ NotJsonResponse: {
3124
+ response: unknown;
3125
+ };
3053
3126
  }>;
3054
3127
  declare const TgBotClientError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
3055
3128
  readonly _tag: "TgBotClientError";
@@ -3057,7 +3130,6 @@ declare const TgBotClientError_base: new <A extends Record<string, any> = {}>(ar
3057
3130
  declare class TgBotClientError extends TgBotClientError_base<{
3058
3131
  cause: ErrorReason;
3059
3132
  }> {
3060
- static readonly missingSuccess: TgBotClientError;
3061
3133
  }
3062
3134
 
3063
3135
  declare const TgBotApiBaseUrl_base: Context.ReferenceClass<TgBotApiBaseUrl, "TgBotApiBaseUrl", string>;
@@ -3067,4 +3139,4 @@ declare const TgBotApiToken_base: Context.TagClass<TgBotApiToken, "TgBotApiToken
3067
3139
  declare class TgBotApiToken extends TgBotApiToken_base {
3068
3140
  }
3069
3141
 
3070
- export { type GetBusinessAccountStarBalanceInput as $, type Api as A, type BanChatMemberInput as B, type CloseInput as C, type DeclineChatJoinRequestInput as D, type DeleteMyCommandsInput as E, type DeleteStickerFromSetInput as F, type DeleteStickerSetInput as G, type DeleteStoryInput as H, type DeleteWebhookInput as I, type EditChatInviteLinkInput as J, type EditChatSubscriptionInviteLinkInput as K, type EditForumTopicInput as L, type EditGeneralForumTopicInput as M, type EditMessageCaptionInput as N, type EditMessageLiveLocationInput as O, type EditMessageMediaInput as P, type EditMessageReplyMarkupInput as Q, type EditMessageTextInput as R, type EditStoryInput as S, TgBotClientError as T, type Update as U, type EditUserStarSubscriptionInput as V, type ExportChatInviteLinkInput as W, type ForwardMessageInput as X, type ForwardMessagesInput as Y, type GetAvailableGiftsInput as Z, type GetBusinessAccountGiftsInput as _, TgBotApiToken as a, type SetBusinessAccountProfilePhotoInput as a$, type GetBusinessConnectionInput as a0, type GetChatInput as a1, type GetChatAdministratorsInput as a2, type GetChatMemberInput as a3, type GetChatMemberCountInput as a4, type GetChatMenuButtonInput as a5, type GetCustomEmojiStickersInput as a6, type GetFileInput as a7, type GetForumTopicIconStickersInput as a8, type GetGameHighScoresInput as a9, type ReplaceStickerInSetInput as aA, type RestrictChatMemberInput as aB, type RevokeChatInviteLinkInput as aC, type SavePreparedInlineMessageInput as aD, type SendAnimationInput as aE, type SendAudioInput as aF, type SendChatActionInput as aG, type SendContactInput as aH, type SendDiceInput as aI, type SendDocumentInput as aJ, type SendGameInput as aK, type SendGiftInput as aL, type SendInvoiceInput as aM, type SendLocationInput as aN, type SendMediaGroupInput as aO, type SendMessageInput as aP, type SendPaidMediaInput as aQ, type SendPhotoInput as aR, type SendPollInput as aS, type SendStickerInput as aT, type SendVenueInput as aU, type SendVideoInput as aV, type SendVideoNoteInput as aW, type SendVoiceInput as aX, type SetBusinessAccountBioInput as aY, type SetBusinessAccountGiftSettingsInput as aZ, type SetBusinessAccountNameInput as a_, type GetMeInput as aa, type GetMyCommandsInput as ab, type GetMyDefaultAdministratorRightsInput as ac, type GetMyDescriptionInput as ad, type GetMyNameInput as ae, type GetMyShortDescriptionInput as af, type GetStarTransactionsInput as ag, type GetStickerSetInput as ah, type GetUpdatesInput as ai, type GetUserChatBoostsInput as aj, type GetUserProfilePhotosInput as ak, type GetWebhookInfoInput as al, type GiftPremiumSubscriptionInput as am, type HideGeneralForumTopicInput as an, type LeaveChatInput as ao, type LogOutInput as ap, type PinChatMessageInput as aq, type PostStoryInput as ar, type PromoteChatMemberInput as as, type ReadBusinessMessageInput as at, type RefundStarPaymentInput as au, type RemoveBusinessAccountProfilePhotoInput as av, type RemoveChatVerificationInput as aw, type RemoveUserVerificationInput as ax, type ReopenForumTopicInput as ay, type ReopenGeneralForumTopicInput as az, TgBotApiBaseUrl as b, type BotCommandScopeDefault as b$, type SetBusinessAccountUsernameInput as b0, type SetChatAdministratorCustomTitleInput as b1, type SetChatDescriptionInput as b2, type SetChatMenuButtonInput as b3, type SetChatPermissionsInput as b4, type SetChatPhotoInput as b5, type SetChatStickerSetInput as b6, type SetChatTitleInput as b7, type SetCustomEmojiStickerSetThumbnailInput as b8, type SetGameScoreInput as b9, type UpgradeGiftInput as bA, type UploadStickerFileInput as bB, type VerifyChatInput as bC, type VerifyUserInput as bD, type AllowedUpdateName as bE, type AcceptedGiftTypes as bF, type AffiliateInfo as bG, type Animation as bH, type Audio as bI, type BackgroundFill as bJ, type BackgroundFillFreeformGradient as bK, type BackgroundFillGradient as bL, type BackgroundFillSolid as bM, type BackgroundType as bN, type BackgroundTypeChatTheme as bO, type BackgroundTypeFill as bP, type BackgroundTypePattern as bQ, type BackgroundTypeWallpaper as bR, type Birthdate as bS, type BotCommand as bT, type BotCommandScope as bU, type BotCommandScopeAllChatAdministrators as bV, type BotCommandScopeAllGroupChats as bW, type BotCommandScopeAllPrivateChats as bX, type BotCommandScopeChat as bY, type BotCommandScopeChatAdministrators as bZ, type BotCommandScopeChatMember as b_, type SetMessageReactionInput as ba, type SetMyCommandsInput as bb, type SetMyDefaultAdministratorRightsInput as bc, type SetMyDescriptionInput as bd, type SetMyNameInput as be, type SetMyShortDescriptionInput as bf, type SetPassportDataErrorsInput as bg, type SetStickerEmojiListInput as bh, type SetStickerKeywordsInput as bi, type SetStickerMaskPositionInput as bj, type SetStickerPositionInSetInput as bk, type SetStickerSetThumbnailInput as bl, type SetStickerSetTitleInput as bm, type SetUserEmojiStatusInput as bn, type SetWebhookInput as bo, type StopMessageLiveLocationInput as bp, type StopPollInput as bq, type TransferBusinessAccountStarsInput as br, type TransferGiftInput as bs, type UnbanChatMemberInput as bt, type UnbanChatSenderChatInput as bu, type UnhideGeneralForumTopicInput as bv, type UnpinAllChatMessagesInput as bw, type UnpinAllForumTopicMessagesInput as bx, type UnpinAllGeneralForumTopicMessagesInput as by, type UnpinChatMessageInput as bz, type AddStickerToSetInput as c, type GiveawayWinners as c$, type BotDescription as c0, type BotName as c1, type BotShortDescription as c2, type BusinessBotRights as c3, type BusinessConnection as c4, type BusinessIntro as c5, type BusinessLocation as c6, type BusinessMessagesDeleted as c7, type BusinessOpeningHours as c8, type BusinessOpeningHoursInterval as c9, type ChatPhoto as cA, type ChatShared as cB, type ChosenInlineResult as cC, type Contact as cD, type CopyTextButton as cE, type Dice as cF, type Document as cG, type EncryptedCredentials as cH, type EncryptedPassportElement as cI, type ExternalReplyInfo as cJ, type File as cK, type ForceReply as cL, type ForumTopic as cM, type ForumTopicClosed as cN, type ForumTopicCreated as cO, type ForumTopicEdited as cP, type ForumTopicReopened as cQ, type Game as cR, type GameHighScore as cS, type GeneralForumTopicHidden as cT, type GeneralForumTopicUnhidden as cU, type Gift as cV, type GiftInfo as cW, type Gifts as cX, type Giveaway as cY, type GiveawayCompleted as cZ, type GiveawayCreated as c_, type CallbackGame as ca, type CallbackQuery as cb, type Chat as cc, type ChatAdministratorRights as cd, type ChatBackground as ce, type ChatBoost as cf, type ChatBoostAdded as cg, type ChatBoostRemoved as ch, type ChatBoostSource as ci, type ChatBoostSourceGiftCode as cj, type ChatBoostSourceGiveaway as ck, type ChatBoostSourcePremium as cl, type ChatBoostUpdated as cm, type ChatFullInfo as cn, type ChatInviteLink as co, type ChatJoinRequest as cp, type ChatLocation as cq, type ChatMember as cr, type ChatMemberAdministrator as cs, type ChatMemberBanned as ct, type ChatMemberLeft as cu, type ChatMemberMember as cv, type ChatMemberOwner as cw, type ChatMemberRestricted as cx, type ChatMemberUpdated as cy, type ChatPermissions as cz, type AnswerCallbackQueryInput as d, type MenuButton as d$, type InaccessibleMessage as d0, type InlineKeyboardButton as d1, type InlineKeyboardMarkup as d2, type InlineQuery as d3, type InlineQueryResult as d4, type InlineQueryResultArticle as d5, type InlineQueryResultAudio as d6, type InlineQueryResultCachedAudio as d7, type InlineQueryResultCachedDocument as d8, type InlineQueryResultCachedGif as d9, type InputMediaVideo as dA, type InputMessageContent as dB, type InputPaidMedia as dC, type InputPaidMediaPhoto as dD, type InputPaidMediaVideo as dE, type InputPollOption as dF, type InputProfilePhoto as dG, type InputProfilePhotoAnimated as dH, type InputProfilePhotoStatic as dI, type InputSticker as dJ, type InputStoryContent as dK, type InputStoryContentPhoto as dL, type InputStoryContentVideo as dM, type InputTextMessageContent as dN, type InputVenueMessageContent as dO, type Invoice as dP, type KeyboardButton as dQ, type KeyboardButtonPollType as dR, type KeyboardButtonRequestChat as dS, type KeyboardButtonRequestUsers as dT, type LabeledPrice as dU, type LinkPreviewOptions as dV, type Location as dW, type LocationAddress as dX, type LoginUrl as dY, type MaskPosition as dZ, type MaybeInaccessibleMessage as d_, type InlineQueryResultCachedMpeg4Gif as da, type InlineQueryResultCachedPhoto as db, type InlineQueryResultCachedSticker as dc, type InlineQueryResultCachedVideo as dd, type InlineQueryResultCachedVoice as de, type InlineQueryResultContact as df, type InlineQueryResultDocument as dg, type InlineQueryResultGame as dh, type InlineQueryResultGif as di, type InlineQueryResultLocation as dj, type InlineQueryResultMpeg4Gif as dk, type InlineQueryResultPhoto as dl, type InlineQueryResultsButton as dm, type InlineQueryResultVenue as dn, type InlineQueryResultVideo as dp, type InlineQueryResultVoice as dq, type InputContactMessageContent as dr, type InputFile as ds, type InputInvoiceMessageContent as dt, type InputLocationMessageContent as du, type InputMedia as dv, type InputMediaAnimation as dw, type InputMediaAudio as dx, type InputMediaDocument as dy, type InputMediaPhoto as dz, type AnswerInlineQueryInput as e, type ShippingQuery as e$, type MenuButtonCommands as e0, type MenuButtonDefault as e1, type MenuButtonWebApp as e2, type Message as e3, type MessageAutoDeleteTimerChanged as e4, type MessageEntity as e5, type MessageId as e6, type MessageOrigin as e7, type MessageOriginChannel as e8, type MessageOriginChat as e9, type PassportElementErrorUnspecified as eA, type PassportFile as eB, type PhotoSize as eC, type Poll as eD, type PollAnswer as eE, type PollOption as eF, type PreCheckoutQuery as eG, type PreparedInlineMessage as eH, type ProximityAlertTriggered as eI, type ReactionCount as eJ, type ReactionType as eK, type ReactionTypeCustomEmoji as eL, type ReactionTypeEmoji as eM, type ReactionTypePaid as eN, type RefundedPayment as eO, type ReplyKeyboardMarkup as eP, type ReplyKeyboardRemove as eQ, type ReplyParameters as eR, type ResponseParameters as eS, type RevenueWithdrawalState as eT, type RevenueWithdrawalStateFailed as eU, type RevenueWithdrawalStatePending as eV, type RevenueWithdrawalStateSucceeded as eW, type SentWebAppMessage as eX, type SharedUser as eY, type ShippingAddress as eZ, type ShippingOption as e_, type MessageOriginHiddenUser as ea, type MessageOriginUser as eb, type MessageReactionCountUpdated as ec, type MessageReactionUpdated as ed, type OrderInfo as ee, type OwnedGift as ef, type OwnedGiftRegular as eg, type OwnedGifts as eh, type OwnedGiftUnique as ei, type PaidMedia as ej, type PaidMediaInfo as ek, type PaidMediaPhoto as el, type PaidMediaPreview as em, type PaidMediaPurchased as en, type PaidMediaVideo as eo, type PaidMessagePriceChanged as ep, type PassportData as eq, type PassportElementError as er, type PassportElementErrorDataField as es, type PassportElementErrorFile as et, type PassportElementErrorFiles as eu, type PassportElementErrorFrontSide as ev, type PassportElementErrorReverseSide as ew, type PassportElementErrorSelfie as ex, type PassportElementErrorTranslationFile as ey, type PassportElementErrorTranslationFiles as ez, type AnswerPreCheckoutQueryInput as f, type StarAmount as f0, type StarTransaction as f1, type StarTransactions as f2, type Sticker as f3, type StickerSet as f4, type Story as f5, type StoryArea as f6, type StoryAreaPosition as f7, type StoryAreaType as f8, type StoryAreaTypeLink as f9, type Video as fA, type VideoChatEnded as fB, type VideoChatParticipantsInvited as fC, type VideoChatScheduled as fD, type VideoChatStarted as fE, type VideoNote as fF, type Voice as fG, type WebAppData as fH, type WebAppInfo as fI, type WebhookInfo as fJ, type WriteAccessAllowed as fK, type StoryAreaTypeLocation as fa, type StoryAreaTypeSuggestedReaction as fb, type StoryAreaTypeUniqueGift as fc, type StoryAreaTypeWeather as fd, type SuccessfulPayment as fe, type SwitchInlineQueryChosenChat as ff, type TextQuote as fg, type TransactionPartner as fh, type TransactionPartnerAffiliateProgram as fi, type TransactionPartnerChat as fj, type TransactionPartnerFragment as fk, type TransactionPartnerOther as fl, type TransactionPartnerTelegramAds as fm, type TransactionPartnerTelegramApi as fn, type TransactionPartnerUser as fo, type UniqueGift as fp, type UniqueGiftBackdrop as fq, type UniqueGiftBackdropColors as fr, type UniqueGiftInfo as fs, type UniqueGiftModel as ft, type UniqueGiftSymbol as fu, type User as fv, type UserChatBoosts as fw, type UserProfilePhotos as fx, type UsersShared as fy, type Venue as fz, type AnswerShippingQueryInput as g, type AnswerWebAppQueryInput as h, type ApproveChatJoinRequestInput as i, type BanChatSenderChatInput as j, type CloseForumTopicInput as k, type CloseGeneralForumTopicInput as l, type ConvertGiftToStarsInput as m, type CopyMessageInput as n, type CopyMessagesInput as o, type CreateChatInviteLinkInput as p, type CreateChatSubscriptionInviteLinkInput as q, type CreateForumTopicInput as r, type CreateInvoiceLinkInput as s, type CreateNewStickerSetInput as t, type DeleteBusinessMessagesInput as u, type DeleteChatPhotoInput as v, type DeleteChatStickerSetInput as w, type DeleteForumTopicInput as x, type DeleteMessageInput as y, type DeleteMessagesInput as z };
3142
+ export { type GetBusinessAccountGiftsInput as $, type Api as A, type BanChatMemberInput as B, type CloseInput as C, type DeclineChatJoinRequestInput as D, type DeleteMyCommandsInput as E, type DeleteStickerFromSetInput as F, type DeleteStickerSetInput as G, type DeleteStoryInput as H, type DeleteWebhookInput as I, type EditChatInviteLinkInput as J, type EditChatSubscriptionInviteLinkInput as K, type EditForumTopicInput as L, type EditGeneralForumTopicInput as M, type EditMessageCaptionInput as N, type EditMessageChecklistInput as O, type EditMessageLiveLocationInput as P, type EditMessageMediaInput as Q, type EditMessageReplyMarkupInput as R, type EditMessageTextInput as S, TgBotClientError as T, type Update as U, type EditStoryInput as V, type EditUserStarSubscriptionInput as W, type ExportChatInviteLinkInput as X, type ForwardMessageInput as Y, type ForwardMessagesInput as Z, type GetAvailableGiftsInput as _, TgBotApiToken as a, type SetBusinessAccountBioInput as a$, type GetBusinessAccountStarBalanceInput as a0, type GetBusinessConnectionInput as a1, type GetChatInput as a2, type GetChatAdministratorsInput as a3, type GetChatMemberInput as a4, type GetChatMemberCountInput as a5, type GetChatMenuButtonInput as a6, type GetCustomEmojiStickersInput as a7, type GetFileInput as a8, type GetForumTopicIconStickersInput as a9, type ReopenForumTopicInput as aA, type ReopenGeneralForumTopicInput as aB, type ReplaceStickerInSetInput as aC, type RestrictChatMemberInput as aD, type RevokeChatInviteLinkInput as aE, type SavePreparedInlineMessageInput as aF, type SendAnimationInput as aG, type SendAudioInput as aH, type SendChatActionInput as aI, type SendChecklistInput as aJ, type SendContactInput as aK, type SendDiceInput as aL, type SendDocumentInput as aM, type SendGameInput as aN, type SendGiftInput as aO, type SendInvoiceInput as aP, type SendLocationInput as aQ, type SendMediaGroupInput as aR, type SendMessageInput as aS, type SendPaidMediaInput as aT, type SendPhotoInput as aU, type SendPollInput as aV, type SendStickerInput as aW, type SendVenueInput as aX, type SendVideoInput as aY, type SendVideoNoteInput as aZ, type SendVoiceInput as a_, type GetGameHighScoresInput as aa, type GetMeInput as ab, type GetMyCommandsInput as ac, type GetMyDefaultAdministratorRightsInput as ad, type GetMyDescriptionInput as ae, type GetMyNameInput as af, type GetMyShortDescriptionInput as ag, type GetMyStarBalanceInput as ah, type GetStarTransactionsInput as ai, type GetStickerSetInput as aj, type GetUpdatesInput as ak, type GetUserChatBoostsInput as al, type GetUserProfilePhotosInput as am, type GetWebhookInfoInput as an, type GiftPremiumSubscriptionInput as ao, type HideGeneralForumTopicInput as ap, type LeaveChatInput as aq, type LogOutInput as ar, type PinChatMessageInput as as, type PostStoryInput as at, type PromoteChatMemberInput as au, type ReadBusinessMessageInput as av, type RefundStarPaymentInput as aw, type RemoveBusinessAccountProfilePhotoInput as ax, type RemoveChatVerificationInput as ay, type RemoveUserVerificationInput as az, TgBotApiBaseUrl as b, type BotCommandScopeChat as b$, type SetBusinessAccountGiftSettingsInput as b0, type SetBusinessAccountNameInput as b1, type SetBusinessAccountProfilePhotoInput as b2, type SetBusinessAccountUsernameInput as b3, type SetChatAdministratorCustomTitleInput as b4, type SetChatDescriptionInput as b5, type SetChatMenuButtonInput as b6, type SetChatPermissionsInput as b7, type SetChatPhotoInput as b8, type SetChatStickerSetInput as b9, type UnpinAllForumTopicMessagesInput as bA, type UnpinAllGeneralForumTopicMessagesInput as bB, type UnpinChatMessageInput as bC, type UpgradeGiftInput as bD, type UploadStickerFileInput as bE, type VerifyChatInput as bF, type VerifyUserInput as bG, type AllowedUpdateName as bH, type AcceptedGiftTypes as bI, type AffiliateInfo as bJ, type Animation as bK, type Audio as bL, type BackgroundFill as bM, type BackgroundFillFreeformGradient as bN, type BackgroundFillGradient as bO, type BackgroundFillSolid as bP, type BackgroundType as bQ, type BackgroundTypeChatTheme as bR, type BackgroundTypeFill as bS, type BackgroundTypePattern as bT, type BackgroundTypeWallpaper as bU, type Birthdate as bV, type BotCommand as bW, type BotCommandScope as bX, type BotCommandScopeAllChatAdministrators as bY, type BotCommandScopeAllGroupChats as bZ, type BotCommandScopeAllPrivateChats as b_, type SetChatTitleInput as ba, type SetCustomEmojiStickerSetThumbnailInput as bb, type SetGameScoreInput as bc, type SetMessageReactionInput as bd, type SetMyCommandsInput as be, type SetMyDefaultAdministratorRightsInput as bf, type SetMyDescriptionInput as bg, type SetMyNameInput as bh, type SetMyShortDescriptionInput as bi, type SetPassportDataErrorsInput as bj, type SetStickerEmojiListInput as bk, type SetStickerKeywordsInput as bl, type SetStickerMaskPositionInput as bm, type SetStickerPositionInSetInput as bn, type SetStickerSetThumbnailInput as bo, type SetStickerSetTitleInput as bp, type SetUserEmojiStatusInput as bq, type SetWebhookInput as br, type StopMessageLiveLocationInput as bs, type StopPollInput as bt, type TransferBusinessAccountStarsInput as bu, type TransferGiftInput as bv, type UnbanChatMemberInput as bw, type UnbanChatSenderChatInput as bx, type UnhideGeneralForumTopicInput as by, type UnpinAllChatMessagesInput as bz, type AddStickerToSetInput as c, type GeneralForumTopicHidden as c$, type BotCommandScopeChatAdministrators as c0, type BotCommandScopeChatMember as c1, type BotCommandScopeDefault as c2, type BotDescription as c3, type BotName as c4, type BotShortDescription as c5, type BusinessBotRights as c6, type BusinessConnection as c7, type BusinessIntro as c8, type BusinessLocation as c9, type ChatMemberRestricted as cA, type ChatMemberUpdated as cB, type ChatPermissions as cC, type ChatPhoto as cD, type ChatShared as cE, type Checklist as cF, type ChecklistTask as cG, type ChecklistTasksAdded as cH, type ChecklistTasksDone as cI, type ChosenInlineResult as cJ, type Contact as cK, type CopyTextButton as cL, type Dice as cM, type DirectMessagePriceChanged as cN, type Document as cO, type EncryptedCredentials as cP, type EncryptedPassportElement as cQ, type ExternalReplyInfo as cR, type File as cS, type ForceReply as cT, type ForumTopic as cU, type ForumTopicClosed as cV, type ForumTopicCreated as cW, type ForumTopicEdited as cX, type ForumTopicReopened as cY, type Game as cZ, type GameHighScore as c_, type BusinessMessagesDeleted as ca, type BusinessOpeningHours as cb, type BusinessOpeningHoursInterval as cc, type CallbackGame as cd, type CallbackQuery as ce, type Chat as cf, type ChatAdministratorRights as cg, type ChatBackground as ch, type ChatBoost as ci, type ChatBoostAdded as cj, type ChatBoostRemoved as ck, type ChatBoostSource as cl, type ChatBoostSourceGiftCode as cm, type ChatBoostSourceGiveaway as cn, type ChatBoostSourcePremium as co, type ChatBoostUpdated as cp, type ChatFullInfo as cq, type ChatInviteLink as cr, type ChatJoinRequest as cs, type ChatLocation as ct, type ChatMember as cu, type ChatMemberAdministrator as cv, type ChatMemberBanned as cw, type ChatMemberLeft as cx, type ChatMemberMember as cy, type ChatMemberOwner as cz, type AnswerCallbackQueryInput as d, type KeyboardButtonPollType as d$, type GeneralForumTopicUnhidden as d0, type Gift as d1, type GiftInfo as d2, type Gifts as d3, type Giveaway as d4, type GiveawayCompleted as d5, type GiveawayCreated as d6, type GiveawayWinners as d7, type InaccessibleMessage as d8, type InlineKeyboardButton as d9, type InputChecklistTask as dA, type InputContactMessageContent as dB, type InputFile as dC, type InputInvoiceMessageContent as dD, type InputLocationMessageContent as dE, type InputMedia as dF, type InputMediaAnimation as dG, type InputMediaAudio as dH, type InputMediaDocument as dI, type InputMediaPhoto as dJ, type InputMediaVideo as dK, type InputMessageContent as dL, type InputPaidMedia as dM, type InputPaidMediaPhoto as dN, type InputPaidMediaVideo as dO, type InputPollOption as dP, type InputProfilePhoto as dQ, type InputProfilePhotoAnimated as dR, type InputProfilePhotoStatic as dS, type InputSticker as dT, type InputStoryContent as dU, type InputStoryContentPhoto as dV, type InputStoryContentVideo as dW, type InputTextMessageContent as dX, type InputVenueMessageContent as dY, type Invoice as dZ, type KeyboardButton as d_, type InlineKeyboardMarkup as da, type InlineQuery as db, type InlineQueryResult as dc, type InlineQueryResultArticle as dd, type InlineQueryResultAudio as de, type InlineQueryResultCachedAudio as df, type InlineQueryResultCachedDocument as dg, type InlineQueryResultCachedGif as dh, type InlineQueryResultCachedMpeg4Gif as di, type InlineQueryResultCachedPhoto as dj, type InlineQueryResultCachedSticker as dk, type InlineQueryResultCachedVideo as dl, type InlineQueryResultCachedVoice as dm, type InlineQueryResultContact as dn, type InlineQueryResultDocument as dp, type InlineQueryResultGame as dq, type InlineQueryResultGif as dr, type InlineQueryResultLocation as ds, type InlineQueryResultMpeg4Gif as dt, type InlineQueryResultPhoto as du, type InlineQueryResultsButton as dv, type InlineQueryResultVenue as dw, type InlineQueryResultVideo as dx, type InlineQueryResultVoice as dy, type InputChecklist as dz, type AnswerInlineQueryInput as e, type ReplyParameters as e$, type KeyboardButtonRequestChat as e0, type KeyboardButtonRequestUsers as e1, type LabeledPrice as e2, type LinkPreviewOptions as e3, type Location as e4, type LocationAddress as e5, type LoginUrl as e6, type MaskPosition as e7, type MaybeInaccessibleMessage as e8, type MenuButton as e9, type PassportData as eA, type PassportElementError as eB, type PassportElementErrorDataField as eC, type PassportElementErrorFile as eD, type PassportElementErrorFiles as eE, type PassportElementErrorFrontSide as eF, type PassportElementErrorReverseSide as eG, type PassportElementErrorSelfie as eH, type PassportElementErrorTranslationFile as eI, type PassportElementErrorTranslationFiles as eJ, type PassportElementErrorUnspecified as eK, type PassportFile as eL, type PhotoSize as eM, type Poll as eN, type PollAnswer as eO, type PollOption as eP, type PreCheckoutQuery as eQ, type PreparedInlineMessage as eR, type ProximityAlertTriggered as eS, type ReactionCount as eT, type ReactionType as eU, type ReactionTypeCustomEmoji as eV, type ReactionTypeEmoji as eW, type ReactionTypePaid as eX, type RefundedPayment as eY, type ReplyKeyboardMarkup as eZ, type ReplyKeyboardRemove as e_, type MenuButtonCommands as ea, type MenuButtonDefault as eb, type MenuButtonWebApp as ec, type Message as ed, type MessageAutoDeleteTimerChanged as ee, type MessageEntity as ef, type MessageId as eg, type MessageOrigin as eh, type MessageOriginChannel as ei, type MessageOriginChat as ej, type MessageOriginHiddenUser as ek, type MessageOriginUser as el, type MessageReactionCountUpdated as em, type MessageReactionUpdated as en, type OrderInfo as eo, type OwnedGift as ep, type OwnedGiftRegular as eq, type OwnedGifts as er, type OwnedGiftUnique as es, type PaidMedia as et, type PaidMediaInfo as eu, type PaidMediaPhoto as ev, type PaidMediaPreview as ew, type PaidMediaPurchased as ex, type PaidMediaVideo as ey, type PaidMessagePriceChanged as ez, type AnswerPreCheckoutQueryInput as f, type ResponseParameters as f0, type RevenueWithdrawalState as f1, type RevenueWithdrawalStateFailed as f2, type RevenueWithdrawalStatePending as f3, type RevenueWithdrawalStateSucceeded as f4, type SentWebAppMessage as f5, type SharedUser as f6, type ShippingAddress as f7, type ShippingOption as f8, type ShippingQuery as f9, type UniqueGiftBackdrop as fA, type UniqueGiftBackdropColors as fB, type UniqueGiftInfo as fC, type UniqueGiftModel as fD, type UniqueGiftSymbol as fE, type User as fF, type UserChatBoosts as fG, type UserProfilePhotos as fH, type UsersShared as fI, type Venue as fJ, type Video as fK, type VideoChatEnded as fL, type VideoChatParticipantsInvited as fM, type VideoChatScheduled as fN, type VideoChatStarted as fO, type VideoNote as fP, type Voice as fQ, type WebAppData as fR, type WebAppInfo as fS, type WebhookInfo as fT, type WriteAccessAllowed as fU, type StarAmount as fa, type StarTransaction as fb, type StarTransactions as fc, type Sticker as fd, type StickerSet as fe, type Story as ff, type StoryArea as fg, type StoryAreaPosition as fh, type StoryAreaType as fi, type StoryAreaTypeLink as fj, type StoryAreaTypeLocation as fk, type StoryAreaTypeSuggestedReaction as fl, type StoryAreaTypeUniqueGift as fm, type StoryAreaTypeWeather as fn, type SuccessfulPayment as fo, type SwitchInlineQueryChosenChat as fp, type TextQuote as fq, type TransactionPartner as fr, type TransactionPartnerAffiliateProgram as fs, type TransactionPartnerChat as ft, type TransactionPartnerFragment as fu, type TransactionPartnerOther as fv, type TransactionPartnerTelegramAds as fw, type TransactionPartnerTelegramApi as fx, type TransactionPartnerUser as fy, type UniqueGift as fz, type AnswerShippingQueryInput as g, type AnswerWebAppQueryInput as h, type ApproveChatJoinRequestInput as i, type BanChatSenderChatInput as j, type CloseForumTopicInput as k, type CloseGeneralForumTopicInput as l, type ConvertGiftToStarsInput as m, type CopyMessageInput as n, type CopyMessagesInput as o, type CreateChatInviteLinkInput as p, type CreateChatSubscriptionInviteLinkInput as q, type CreateForumTopicInput as r, type CreateInvoiceLinkInput as s, type CreateNewStickerSetInput as t, type DeleteBusinessMessagesInput as u, type DeleteChatPhotoInput as v, type DeleteChatStickerSetInput as w, type DeleteForumTopicInput as x, type DeleteMessageInput as y, type DeleteMessagesInput as z };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as Micro from 'effect/Micro';
2
- import { A as Api, T as TgBotClientError, a as TgBotApiToken, U as Update } from './config-BZUAEyeb.js';
3
- export { bF as AcceptedGiftTypes, c as AddStickerToSetInput, bG as AffiliateInfo, bE as AllowedUpdateName, bH as Animation, d as AnswerCallbackQueryInput, e as AnswerInlineQueryInput, f as AnswerPreCheckoutQueryInput, g as AnswerShippingQueryInput, h as AnswerWebAppQueryInput, i as ApproveChatJoinRequestInput, bI as Audio, bJ as BackgroundFill, bK as BackgroundFillFreeformGradient, bL as BackgroundFillGradient, bM as BackgroundFillSolid, bN as BackgroundType, bO as BackgroundTypeChatTheme, bP as BackgroundTypeFill, bQ as BackgroundTypePattern, bR as BackgroundTypeWallpaper, B as BanChatMemberInput, j as BanChatSenderChatInput, bS as Birthdate, bT as BotCommand, bU as BotCommandScope, bV as BotCommandScopeAllChatAdministrators, bW as BotCommandScopeAllGroupChats, bX as BotCommandScopeAllPrivateChats, bY as BotCommandScopeChat, bZ as BotCommandScopeChatAdministrators, b_ as BotCommandScopeChatMember, b$ as BotCommandScopeDefault, c0 as BotDescription, c1 as BotName, c2 as BotShortDescription, c3 as BusinessBotRights, c4 as BusinessConnection, c5 as BusinessIntro, c6 as BusinessLocation, c7 as BusinessMessagesDeleted, c8 as BusinessOpeningHours, c9 as BusinessOpeningHoursInterval, ca as CallbackGame, cb as CallbackQuery, cc as Chat, cd as ChatAdministratorRights, ce as ChatBackground, cf as ChatBoost, cg as ChatBoostAdded, ch as ChatBoostRemoved, ci as ChatBoostSource, cj as ChatBoostSourceGiftCode, ck as ChatBoostSourceGiveaway, cl as ChatBoostSourcePremium, cm as ChatBoostUpdated, cn as ChatFullInfo, co as ChatInviteLink, cp as ChatJoinRequest, cq as ChatLocation, cr as ChatMember, cs as ChatMemberAdministrator, ct as ChatMemberBanned, cu as ChatMemberLeft, cv as ChatMemberMember, cw as ChatMemberOwner, cx as ChatMemberRestricted, cy as ChatMemberUpdated, cz as ChatPermissions, cA as ChatPhoto, cB as ChatShared, cC as ChosenInlineResult, k as CloseForumTopicInput, l as CloseGeneralForumTopicInput, C as CloseInput, cD as Contact, m as ConvertGiftToStarsInput, n as CopyMessageInput, o as CopyMessagesInput, cE as CopyTextButton, p as CreateChatInviteLinkInput, q as CreateChatSubscriptionInviteLinkInput, r as CreateForumTopicInput, s as CreateInvoiceLinkInput, t as CreateNewStickerSetInput, D as DeclineChatJoinRequestInput, u as DeleteBusinessMessagesInput, v as DeleteChatPhotoInput, w as DeleteChatStickerSetInput, x as DeleteForumTopicInput, y as DeleteMessageInput, z as DeleteMessagesInput, E as DeleteMyCommandsInput, F as DeleteStickerFromSetInput, G as DeleteStickerSetInput, H as DeleteStoryInput, I as DeleteWebhookInput, cF as Dice, cG as Document, J as EditChatInviteLinkInput, K as EditChatSubscriptionInviteLinkInput, L as EditForumTopicInput, M as EditGeneralForumTopicInput, N as EditMessageCaptionInput, O as EditMessageLiveLocationInput, P as EditMessageMediaInput, Q as EditMessageReplyMarkupInput, R as EditMessageTextInput, S as EditStoryInput, V as EditUserStarSubscriptionInput, cH as EncryptedCredentials, cI as EncryptedPassportElement, W as ExportChatInviteLinkInput, cJ as ExternalReplyInfo, cK as File, cL as ForceReply, cM as ForumTopic, cN as ForumTopicClosed, cO as ForumTopicCreated, cP as ForumTopicEdited, cQ as ForumTopicReopened, X as ForwardMessageInput, Y as ForwardMessagesInput, cR as Game, cS as GameHighScore, cT as GeneralForumTopicHidden, cU as GeneralForumTopicUnhidden, Z as GetAvailableGiftsInput, _ as GetBusinessAccountGiftsInput, $ as GetBusinessAccountStarBalanceInput, a0 as GetBusinessConnectionInput, a2 as GetChatAdministratorsInput, a1 as GetChatInput, a4 as GetChatMemberCountInput, a3 as GetChatMemberInput, a5 as GetChatMenuButtonInput, a6 as GetCustomEmojiStickersInput, a7 as GetFileInput, a8 as GetForumTopicIconStickersInput, a9 as GetGameHighScoresInput, aa as GetMeInput, ab as GetMyCommandsInput, ac as GetMyDefaultAdministratorRightsInput, ad as GetMyDescriptionInput, ae as GetMyNameInput, af as GetMyShortDescriptionInput, ag as GetStarTransactionsInput, ah as GetStickerSetInput, ai as GetUpdatesInput, aj as GetUserChatBoostsInput, ak as GetUserProfilePhotosInput, al as GetWebhookInfoInput, cV as Gift, cW as GiftInfo, am as GiftPremiumSubscriptionInput, cX as Gifts, cY as Giveaway, cZ as GiveawayCompleted, c_ as GiveawayCreated, c$ as GiveawayWinners, an as HideGeneralForumTopicInput, d0 as InaccessibleMessage, d1 as InlineKeyboardButton, d2 as InlineKeyboardMarkup, d3 as InlineQuery, d4 as InlineQueryResult, d5 as InlineQueryResultArticle, d6 as InlineQueryResultAudio, d7 as InlineQueryResultCachedAudio, d8 as InlineQueryResultCachedDocument, d9 as InlineQueryResultCachedGif, da as InlineQueryResultCachedMpeg4Gif, db as InlineQueryResultCachedPhoto, dc as InlineQueryResultCachedSticker, dd as InlineQueryResultCachedVideo, de as InlineQueryResultCachedVoice, df as InlineQueryResultContact, dg as InlineQueryResultDocument, dh as InlineQueryResultGame, di as InlineQueryResultGif, dj as InlineQueryResultLocation, dk as InlineQueryResultMpeg4Gif, dl as InlineQueryResultPhoto, dn as InlineQueryResultVenue, dp as InlineQueryResultVideo, dq as InlineQueryResultVoice, dm as InlineQueryResultsButton, dr as InputContactMessageContent, ds as InputFile, dt as InputInvoiceMessageContent, du as InputLocationMessageContent, dv as InputMedia, dw as InputMediaAnimation, dx as InputMediaAudio, dy as InputMediaDocument, dz as InputMediaPhoto, dA as InputMediaVideo, dB as InputMessageContent, dC as InputPaidMedia, dD as InputPaidMediaPhoto, dE as InputPaidMediaVideo, dF as InputPollOption, dG as InputProfilePhoto, dH as InputProfilePhotoAnimated, dI as InputProfilePhotoStatic, dJ as InputSticker, dK as InputStoryContent, dL as InputStoryContentPhoto, dM as InputStoryContentVideo, dN as InputTextMessageContent, dO as InputVenueMessageContent, dP as Invoice, dQ as KeyboardButton, dR as KeyboardButtonPollType, dS as KeyboardButtonRequestChat, dT as KeyboardButtonRequestUsers, dU as LabeledPrice, ao as LeaveChatInput, dV as LinkPreviewOptions, dW as Location, dX as LocationAddress, ap as LogOutInput, dY as LoginUrl, dZ as MaskPosition, d_ as MaybeInaccessibleMessage, d$ as MenuButton, e0 as MenuButtonCommands, e1 as MenuButtonDefault, e2 as MenuButtonWebApp, e3 as Message, e4 as MessageAutoDeleteTimerChanged, e5 as MessageEntity, e6 as MessageId, e7 as MessageOrigin, e8 as MessageOriginChannel, e9 as MessageOriginChat, ea as MessageOriginHiddenUser, eb as MessageOriginUser, ec as MessageReactionCountUpdated, ed as MessageReactionUpdated, ee as OrderInfo, ef as OwnedGift, eg as OwnedGiftRegular, ei as OwnedGiftUnique, eh as OwnedGifts, ej as PaidMedia, ek as PaidMediaInfo, el as PaidMediaPhoto, em as PaidMediaPreview, en as PaidMediaPurchased, eo as PaidMediaVideo, ep as PaidMessagePriceChanged, eq as PassportData, er as PassportElementError, es as PassportElementErrorDataField, et as PassportElementErrorFile, eu as PassportElementErrorFiles, ev as PassportElementErrorFrontSide, ew as PassportElementErrorReverseSide, ex as PassportElementErrorSelfie, ey as PassportElementErrorTranslationFile, ez as PassportElementErrorTranslationFiles, eA as PassportElementErrorUnspecified, eB as PassportFile, eC as PhotoSize, aq as PinChatMessageInput, eD as Poll, eE as PollAnswer, eF as PollOption, ar as PostStoryInput, eG as PreCheckoutQuery, eH as PreparedInlineMessage, as as PromoteChatMemberInput, eI as ProximityAlertTriggered, eJ as ReactionCount, eK as ReactionType, eL as ReactionTypeCustomEmoji, eM as ReactionTypeEmoji, eN as ReactionTypePaid, at as ReadBusinessMessageInput, au as RefundStarPaymentInput, eO as RefundedPayment, av as RemoveBusinessAccountProfilePhotoInput, aw as RemoveChatVerificationInput, ax as RemoveUserVerificationInput, ay as ReopenForumTopicInput, az as ReopenGeneralForumTopicInput, aA as ReplaceStickerInSetInput, eP as ReplyKeyboardMarkup, eQ as ReplyKeyboardRemove, eR as ReplyParameters, eS as ResponseParameters, aB as RestrictChatMemberInput, eT as RevenueWithdrawalState, eU as RevenueWithdrawalStateFailed, eV as RevenueWithdrawalStatePending, eW as RevenueWithdrawalStateSucceeded, aC as RevokeChatInviteLinkInput, aD as SavePreparedInlineMessageInput, aE as SendAnimationInput, aF as SendAudioInput, aG as SendChatActionInput, aH as SendContactInput, aI as SendDiceInput, aJ as SendDocumentInput, aK as SendGameInput, aL as SendGiftInput, aM as SendInvoiceInput, aN as SendLocationInput, aO as SendMediaGroupInput, aP as SendMessageInput, aQ as SendPaidMediaInput, aR as SendPhotoInput, aS as SendPollInput, aT as SendStickerInput, aU as SendVenueInput, aV as SendVideoInput, aW as SendVideoNoteInput, aX as SendVoiceInput, eX as SentWebAppMessage, aY as SetBusinessAccountBioInput, aZ as SetBusinessAccountGiftSettingsInput, a_ as SetBusinessAccountNameInput, a$ as SetBusinessAccountProfilePhotoInput, b0 as SetBusinessAccountUsernameInput, b1 as SetChatAdministratorCustomTitleInput, b2 as SetChatDescriptionInput, b3 as SetChatMenuButtonInput, b4 as SetChatPermissionsInput, b5 as SetChatPhotoInput, b6 as SetChatStickerSetInput, b7 as SetChatTitleInput, b8 as SetCustomEmojiStickerSetThumbnailInput, b9 as SetGameScoreInput, ba as SetMessageReactionInput, bb as SetMyCommandsInput, bc as SetMyDefaultAdministratorRightsInput, bd as SetMyDescriptionInput, be as SetMyNameInput, bf as SetMyShortDescriptionInput, bg as SetPassportDataErrorsInput, bh as SetStickerEmojiListInput, bi as SetStickerKeywordsInput, bj as SetStickerMaskPositionInput, bk as SetStickerPositionInSetInput, bl as SetStickerSetThumbnailInput, bm as SetStickerSetTitleInput, bn as SetUserEmojiStatusInput, bo as SetWebhookInput, eY as SharedUser, eZ as ShippingAddress, e_ as ShippingOption, e$ as ShippingQuery, f0 as StarAmount, f1 as StarTransaction, f2 as StarTransactions, f3 as Sticker, f4 as StickerSet, bp as StopMessageLiveLocationInput, bq as StopPollInput, f5 as Story, f6 as StoryArea, f7 as StoryAreaPosition, f8 as StoryAreaType, f9 as StoryAreaTypeLink, fa as StoryAreaTypeLocation, fb as StoryAreaTypeSuggestedReaction, fc as StoryAreaTypeUniqueGift, fd as StoryAreaTypeWeather, fe as SuccessfulPayment, ff as SwitchInlineQueryChosenChat, fg as TextQuote, b as TgBotApiBaseUrl, fh as TransactionPartner, fi as TransactionPartnerAffiliateProgram, fj as TransactionPartnerChat, fk as TransactionPartnerFragment, fl as TransactionPartnerOther, fm as TransactionPartnerTelegramAds, fn as TransactionPartnerTelegramApi, fo as TransactionPartnerUser, br as TransferBusinessAccountStarsInput, bs as TransferGiftInput, bt as UnbanChatMemberInput, bu as UnbanChatSenderChatInput, bv as UnhideGeneralForumTopicInput, fp as UniqueGift, fq as UniqueGiftBackdrop, fr as UniqueGiftBackdropColors, fs as UniqueGiftInfo, ft as UniqueGiftModel, fu as UniqueGiftSymbol, bw as UnpinAllChatMessagesInput, bx as UnpinAllForumTopicMessagesInput, by as UnpinAllGeneralForumTopicMessagesInput, bz as UnpinChatMessageInput, bA as UpgradeGiftInput, bB as UploadStickerFileInput, fv as User, fw as UserChatBoosts, fx as UserProfilePhotos, fy as UsersShared, fz as Venue, bC as VerifyChatInput, bD as VerifyUserInput, fA as Video, fB as VideoChatEnded, fC as VideoChatParticipantsInvited, fD as VideoChatScheduled, fE as VideoChatStarted, fF as VideoNote, fG as Voice, fH as WebAppData, fI as WebAppInfo, fJ as WebhookInfo, fK as WriteAccessAllowed } from './config-BZUAEyeb.js';
2
+ import { A as Api, T as TgBotClientError, a as TgBotApiToken, U as Update } from './config-DAcDINJv.js';
3
+ export { bI as AcceptedGiftTypes, c as AddStickerToSetInput, bJ as AffiliateInfo, bH as AllowedUpdateName, bK as Animation, d as AnswerCallbackQueryInput, e as AnswerInlineQueryInput, f as AnswerPreCheckoutQueryInput, g as AnswerShippingQueryInput, h as AnswerWebAppQueryInput, i as ApproveChatJoinRequestInput, bL as Audio, bM as BackgroundFill, bN as BackgroundFillFreeformGradient, bO as BackgroundFillGradient, bP as BackgroundFillSolid, bQ as BackgroundType, bR as BackgroundTypeChatTheme, bS as BackgroundTypeFill, bT as BackgroundTypePattern, bU as BackgroundTypeWallpaper, B as BanChatMemberInput, j as BanChatSenderChatInput, bV as Birthdate, bW as BotCommand, bX as BotCommandScope, bY as BotCommandScopeAllChatAdministrators, bZ as BotCommandScopeAllGroupChats, b_ as BotCommandScopeAllPrivateChats, b$ as BotCommandScopeChat, c0 as BotCommandScopeChatAdministrators, c1 as BotCommandScopeChatMember, c2 as BotCommandScopeDefault, c3 as BotDescription, c4 as BotName, c5 as BotShortDescription, c6 as BusinessBotRights, c7 as BusinessConnection, c8 as BusinessIntro, c9 as BusinessLocation, ca as BusinessMessagesDeleted, cb as BusinessOpeningHours, cc as BusinessOpeningHoursInterval, cd as CallbackGame, ce as CallbackQuery, cf as Chat, cg as ChatAdministratorRights, ch as ChatBackground, ci as ChatBoost, cj as ChatBoostAdded, ck as ChatBoostRemoved, cl as ChatBoostSource, cm as ChatBoostSourceGiftCode, cn as ChatBoostSourceGiveaway, co as ChatBoostSourcePremium, cp as ChatBoostUpdated, cq as ChatFullInfo, cr as ChatInviteLink, cs as ChatJoinRequest, ct as ChatLocation, cu as ChatMember, cv as ChatMemberAdministrator, cw as ChatMemberBanned, cx as ChatMemberLeft, cy as ChatMemberMember, cz as ChatMemberOwner, cA as ChatMemberRestricted, cB as ChatMemberUpdated, cC as ChatPermissions, cD as ChatPhoto, cE as ChatShared, cF as Checklist, cG as ChecklistTask, cH as ChecklistTasksAdded, cI as ChecklistTasksDone, cJ as ChosenInlineResult, k as CloseForumTopicInput, l as CloseGeneralForumTopicInput, C as CloseInput, cK as Contact, m as ConvertGiftToStarsInput, n as CopyMessageInput, o as CopyMessagesInput, cL as CopyTextButton, p as CreateChatInviteLinkInput, q as CreateChatSubscriptionInviteLinkInput, r as CreateForumTopicInput, s as CreateInvoiceLinkInput, t as CreateNewStickerSetInput, D as DeclineChatJoinRequestInput, u as DeleteBusinessMessagesInput, v as DeleteChatPhotoInput, w as DeleteChatStickerSetInput, x as DeleteForumTopicInput, y as DeleteMessageInput, z as DeleteMessagesInput, E as DeleteMyCommandsInput, F as DeleteStickerFromSetInput, G as DeleteStickerSetInput, H as DeleteStoryInput, I as DeleteWebhookInput, cM as Dice, cN as DirectMessagePriceChanged, cO as Document, J as EditChatInviteLinkInput, K as EditChatSubscriptionInviteLinkInput, L as EditForumTopicInput, M as EditGeneralForumTopicInput, N as EditMessageCaptionInput, O as EditMessageChecklistInput, P as EditMessageLiveLocationInput, Q as EditMessageMediaInput, R as EditMessageReplyMarkupInput, S as EditMessageTextInput, V as EditStoryInput, W as EditUserStarSubscriptionInput, cP as EncryptedCredentials, cQ as EncryptedPassportElement, X as ExportChatInviteLinkInput, cR as ExternalReplyInfo, cS as File, cT as ForceReply, cU as ForumTopic, cV as ForumTopicClosed, cW as ForumTopicCreated, cX as ForumTopicEdited, cY as ForumTopicReopened, Y as ForwardMessageInput, Z as ForwardMessagesInput, cZ as Game, c_ as GameHighScore, c$ as GeneralForumTopicHidden, d0 as GeneralForumTopicUnhidden, _ as GetAvailableGiftsInput, $ as GetBusinessAccountGiftsInput, a0 as GetBusinessAccountStarBalanceInput, a1 as GetBusinessConnectionInput, a3 as GetChatAdministratorsInput, a2 as GetChatInput, a5 as GetChatMemberCountInput, a4 as GetChatMemberInput, a6 as GetChatMenuButtonInput, a7 as GetCustomEmojiStickersInput, a8 as GetFileInput, a9 as GetForumTopicIconStickersInput, aa as GetGameHighScoresInput, ab as GetMeInput, ac as GetMyCommandsInput, ad as GetMyDefaultAdministratorRightsInput, ae as GetMyDescriptionInput, af as GetMyNameInput, ag as GetMyShortDescriptionInput, ah as GetMyStarBalanceInput, ai as GetStarTransactionsInput, aj as GetStickerSetInput, ak as GetUpdatesInput, al as GetUserChatBoostsInput, am as GetUserProfilePhotosInput, an as GetWebhookInfoInput, d1 as Gift, d2 as GiftInfo, ao as GiftPremiumSubscriptionInput, d3 as Gifts, d4 as Giveaway, d5 as GiveawayCompleted, d6 as GiveawayCreated, d7 as GiveawayWinners, ap as HideGeneralForumTopicInput, d8 as InaccessibleMessage, d9 as InlineKeyboardButton, da as InlineKeyboardMarkup, db as InlineQuery, dc as InlineQueryResult, dd as InlineQueryResultArticle, de as InlineQueryResultAudio, df as InlineQueryResultCachedAudio, dg as InlineQueryResultCachedDocument, dh as InlineQueryResultCachedGif, di as InlineQueryResultCachedMpeg4Gif, dj as InlineQueryResultCachedPhoto, dk as InlineQueryResultCachedSticker, dl as InlineQueryResultCachedVideo, dm as InlineQueryResultCachedVoice, dn as InlineQueryResultContact, dp as InlineQueryResultDocument, dq as InlineQueryResultGame, dr as InlineQueryResultGif, ds as InlineQueryResultLocation, dt as InlineQueryResultMpeg4Gif, du as InlineQueryResultPhoto, dw as InlineQueryResultVenue, dx as InlineQueryResultVideo, dy as InlineQueryResultVoice, dv as InlineQueryResultsButton, dz as InputChecklist, dA as InputChecklistTask, dB as InputContactMessageContent, dC as InputFile, dD as InputInvoiceMessageContent, dE as InputLocationMessageContent, dF as InputMedia, dG as InputMediaAnimation, dH as InputMediaAudio, dI as InputMediaDocument, dJ as InputMediaPhoto, dK as InputMediaVideo, dL as InputMessageContent, dM as InputPaidMedia, dN as InputPaidMediaPhoto, dO as InputPaidMediaVideo, dP as InputPollOption, dQ as InputProfilePhoto, dR as InputProfilePhotoAnimated, dS as InputProfilePhotoStatic, dT as InputSticker, dU as InputStoryContent, dV as InputStoryContentPhoto, dW as InputStoryContentVideo, dX as InputTextMessageContent, dY as InputVenueMessageContent, dZ as Invoice, d_ as KeyboardButton, d$ as KeyboardButtonPollType, e0 as KeyboardButtonRequestChat, e1 as KeyboardButtonRequestUsers, e2 as LabeledPrice, aq as LeaveChatInput, e3 as LinkPreviewOptions, e4 as Location, e5 as LocationAddress, ar as LogOutInput, e6 as LoginUrl, e7 as MaskPosition, e8 as MaybeInaccessibleMessage, e9 as MenuButton, ea as MenuButtonCommands, eb as MenuButtonDefault, ec as MenuButtonWebApp, ed as Message, ee as MessageAutoDeleteTimerChanged, ef as MessageEntity, eg as MessageId, eh as MessageOrigin, ei as MessageOriginChannel, ej as MessageOriginChat, ek as MessageOriginHiddenUser, el as MessageOriginUser, em as MessageReactionCountUpdated, en as MessageReactionUpdated, eo as OrderInfo, ep as OwnedGift, eq as OwnedGiftRegular, es as OwnedGiftUnique, er as OwnedGifts, et as PaidMedia, eu as PaidMediaInfo, ev as PaidMediaPhoto, ew as PaidMediaPreview, ex as PaidMediaPurchased, ey as PaidMediaVideo, ez as PaidMessagePriceChanged, eA as PassportData, eB as PassportElementError, eC as PassportElementErrorDataField, eD as PassportElementErrorFile, eE as PassportElementErrorFiles, eF as PassportElementErrorFrontSide, eG as PassportElementErrorReverseSide, eH as PassportElementErrorSelfie, eI as PassportElementErrorTranslationFile, eJ as PassportElementErrorTranslationFiles, eK as PassportElementErrorUnspecified, eL as PassportFile, eM as PhotoSize, as as PinChatMessageInput, eN as Poll, eO as PollAnswer, eP as PollOption, at as PostStoryInput, eQ as PreCheckoutQuery, eR as PreparedInlineMessage, au as PromoteChatMemberInput, eS as ProximityAlertTriggered, eT as ReactionCount, eU as ReactionType, eV as ReactionTypeCustomEmoji, eW as ReactionTypeEmoji, eX as ReactionTypePaid, av as ReadBusinessMessageInput, aw as RefundStarPaymentInput, eY as RefundedPayment, ax as RemoveBusinessAccountProfilePhotoInput, ay as RemoveChatVerificationInput, az as RemoveUserVerificationInput, aA as ReopenForumTopicInput, aB as ReopenGeneralForumTopicInput, aC as ReplaceStickerInSetInput, eZ as ReplyKeyboardMarkup, e_ as ReplyKeyboardRemove, e$ as ReplyParameters, f0 as ResponseParameters, aD as RestrictChatMemberInput, f1 as RevenueWithdrawalState, f2 as RevenueWithdrawalStateFailed, f3 as RevenueWithdrawalStatePending, f4 as RevenueWithdrawalStateSucceeded, aE as RevokeChatInviteLinkInput, aF as SavePreparedInlineMessageInput, aG as SendAnimationInput, aH as SendAudioInput, aI as SendChatActionInput, aJ as SendChecklistInput, aK as SendContactInput, aL as SendDiceInput, aM as SendDocumentInput, aN as SendGameInput, aO as SendGiftInput, aP as SendInvoiceInput, aQ as SendLocationInput, aR as SendMediaGroupInput, aS as SendMessageInput, aT as SendPaidMediaInput, aU as SendPhotoInput, aV as SendPollInput, aW as SendStickerInput, aX as SendVenueInput, aY as SendVideoInput, aZ as SendVideoNoteInput, a_ as SendVoiceInput, f5 as SentWebAppMessage, a$ as SetBusinessAccountBioInput, b0 as SetBusinessAccountGiftSettingsInput, b1 as SetBusinessAccountNameInput, b2 as SetBusinessAccountProfilePhotoInput, b3 as SetBusinessAccountUsernameInput, b4 as SetChatAdministratorCustomTitleInput, b5 as SetChatDescriptionInput, b6 as SetChatMenuButtonInput, b7 as SetChatPermissionsInput, b8 as SetChatPhotoInput, b9 as SetChatStickerSetInput, ba as SetChatTitleInput, bb as SetCustomEmojiStickerSetThumbnailInput, bc as SetGameScoreInput, bd as SetMessageReactionInput, be as SetMyCommandsInput, bf as SetMyDefaultAdministratorRightsInput, bg as SetMyDescriptionInput, bh as SetMyNameInput, bi as SetMyShortDescriptionInput, bj as SetPassportDataErrorsInput, bk as SetStickerEmojiListInput, bl as SetStickerKeywordsInput, bm as SetStickerMaskPositionInput, bn as SetStickerPositionInSetInput, bo as SetStickerSetThumbnailInput, bp as SetStickerSetTitleInput, bq as SetUserEmojiStatusInput, br as SetWebhookInput, f6 as SharedUser, f7 as ShippingAddress, f8 as ShippingOption, f9 as ShippingQuery, fa as StarAmount, fb as StarTransaction, fc as StarTransactions, fd as Sticker, fe as StickerSet, bs as StopMessageLiveLocationInput, bt as StopPollInput, ff as Story, fg as StoryArea, fh as StoryAreaPosition, fi as StoryAreaType, fj as StoryAreaTypeLink, fk as StoryAreaTypeLocation, fl as StoryAreaTypeSuggestedReaction, fm as StoryAreaTypeUniqueGift, fn as StoryAreaTypeWeather, fo as SuccessfulPayment, fp as SwitchInlineQueryChosenChat, fq as TextQuote, b as TgBotApiBaseUrl, fr as TransactionPartner, fs as TransactionPartnerAffiliateProgram, ft as TransactionPartnerChat, fu as TransactionPartnerFragment, fv as TransactionPartnerOther, fw as TransactionPartnerTelegramAds, fx as TransactionPartnerTelegramApi, fy as TransactionPartnerUser, bu as TransferBusinessAccountStarsInput, bv as TransferGiftInput, bw as UnbanChatMemberInput, bx as UnbanChatSenderChatInput, by as UnhideGeneralForumTopicInput, fz as UniqueGift, fA as UniqueGiftBackdrop, fB as UniqueGiftBackdropColors, fC as UniqueGiftInfo, fD as UniqueGiftModel, fE as UniqueGiftSymbol, bz as UnpinAllChatMessagesInput, bA as UnpinAllForumTopicMessagesInput, bB as UnpinAllGeneralForumTopicMessagesInput, bC as UnpinChatMessageInput, bD as UpgradeGiftInput, bE as UploadStickerFileInput, fF as User, fG as UserChatBoosts, fH as UserProfilePhotos, fI as UsersShared, fJ as Venue, bF as VerifyChatInput, bG as VerifyUserInput, fK as Video, fL as VideoChatEnded, fM as VideoChatParticipantsInvited, fN as VideoChatScheduled, fO as VideoChatStarted, fP as VideoNote, fQ as Voice, fR as WebAppData, fS as WebAppInfo, fT as WebhookInfo, fU as WriteAccessAllowed } from './config-DAcDINJv.js';
4
4
  import 'effect/Cause';
5
5
  import 'effect/Types';
6
+ import 'effect/Data';
6
7
  import 'effect/Context';
7
8
 
8
9
  declare const executeTgBotMethod: <M extends keyof Api>(method: M, input: Parameters<Api[M]>[0]) => Micro.Micro<ReturnType<Api[M]>, TgBotClientError, TgBotApiToken>;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var P=Object.create;var g=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var I=(e,o)=>{for(var t in o)g(e,t,{get:o[t],enumerable:!0})},_=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of $(o))!O.call(e,r)&&r!==t&&g(e,r,{get:()=>o[r],enumerable:!(n=v(o,r))||n.enumerable});return e};var l=(e,o,t)=>(t=e!=null?P(j(e)):{},_(o||!e||!e.__esModule?g(t,"default",{value:e,enumerable:!0}):t,e)),D=e=>_(g({},"__esModule",{value:!0}),e);var q={};I(q,{MESSAGE_EFFECTS:()=>C,TG_BOT_API_URL:()=>F,TgBotApiBaseUrl:()=>d,TgBotApiToken:()=>f,TgBotClientError:()=>p,executeTgBotMethod:()=>u,getFile:()=>B,getFileAsBase64String:()=>H,getFileBytes:()=>A,isFileContent:()=>T,isMessageEffect:()=>L,isTgBotApiResponse:()=>k,isTgBotApiUpdate:()=>N,makeTgBotClient:()=>V,messageEffectIdCodes:()=>J});module.exports=D(q);var R=l(require("effect/String")),c=l(require("effect/Micro"));var E=l(require("effect/Data")),p=class e extends E.TaggedError("TgBotClientError"){static missingSuccess=new e({cause:{type:"ClientInternalError",cause:"Expected 'success' to be defined"}})};var T=e=>typeof e=="object"&&e!=null&&"file_content"in e&&e.file_content instanceof Uint8Array&&"file_name"in e&&typeof e.file_name=="string",k=e=>typeof e=="object"&&e!=null&&"ok"in e&&typeof e.ok=="boolean",N=e=>typeof e=="object"&&e!=null&&"update_id"in e&&typeof e.update_id=="number";var x=l(require("effect/Context"));var F="https://api.telegram.org",C={"\u{1F525}":"5104841245755180586","\u{1F44D}":"5107584321108051014","\u{1F44E}":"5104858069142078462","\u2764\uFE0F":"5159385139981059251","\u{1F389}":"5046509860389126442","\u{1F4A9}":"5046589136895476101"},J=Object.keys(C),L=e=>typeof e=="string"&&e in C;var d=class extends x.Reference()("TgBotApiBaseUrl",{defaultValue:()=>F}){},f=class extends x.Tag("TgBotApiToken")(){};var h=e=>{let o=Object.entries(e);if(o.length==0)return;let t=new FormData;for(let[n,r]of o)r&&(typeof r!="object"?t.append(n,`${r}`):T(r)?t.append(n,new Blob([r.file_content]),r.file_name):t.append(n,JSON.stringify(r)));return t};var u=(e,o)=>c.gen(function*(){let t=yield*c.service(f),n=yield*c.service(d),r=yield*c.tryPromise({try:()=>fetch(`${n}/bot${t}/${R.snakeToCamel(e)}`,{body:h(o)??null,method:"POST"}),catch:m=>new p({cause:{type:"ClientInternalError",cause:m}})}),a=yield*c.tryPromise({try:()=>r.json(),catch:()=>new p({cause:{type:"NotJsonResponse",response:r}})});return k(a)?r.ok?a.result:yield*c.fail(new p({cause:{type:"NotOkResponse",...a.error_code?{errorCode:a.error_code}:void 0,...a.description?{details:a.description}:void 0}})):yield*c.fail(new p({cause:{type:"UnexpectedResponse",response:a}}))});var s=l(require("effect/Micro"));var B=({fileId:e,type:o})=>A(e).pipe(s.andThen(({content:t,file_name:n})=>new File([t],n,{...o?{type:o}:void 0}))),H=({fileId:e,type:o})=>A(e).pipe(s.andThen(({content:t,file_name:n})=>{let r=Buffer.from(t).toString("base64");return{encoded:`data:${o};base64,${r}`,file_name:n}})),A=e=>s.gen(function*(){let t=(yield*u("get_file",{file_id:e})).file_path;if(!t||t.length==0)return yield*s.fail(new p({cause:{type:"UnableToGetFile",cause:"File path not defined"}}));let n=t.replaceAll("/","-"),r=yield*s.service(d),a=yield*s.service(f),m=`${r}/file/bot${a}/${t}`;return{content:yield*s.tryPromise({try:()=>fetch(m).then(M=>M.arrayBuffer()),catch:M=>new p({cause:{type:"UnableToGetFile",cause:M}})}),file_name:n}});var i=l(require("effect/Micro")),G=l(require("effect/Context"));var S=l(require("effect/Micro")),w=l(require("effect/Context"));var y=class extends w.Tag("ClientFileService")(){},U=S.gen(function*(){return{getFile:B}});function V(e){return i.gen(function*(){let t=yield*i.service(y),n=G.make(f,e.bot_token);return{execute:(m,b)=>u(m,b).pipe(i.provideContext(n),i.runPromise),getFile:m=>t.getFile(m).pipe(i.provideContext(n),i.runPromise)}}).pipe(i.provideServiceEffect(y,U),i.runSync)}0&&(module.exports={MESSAGE_EFFECTS,TG_BOT_API_URL,TgBotApiBaseUrl,TgBotApiToken,TgBotClientError,executeTgBotMethod,getFile,getFileAsBase64String,getFileBytes,isFileContent,isMessageEffect,isTgBotApiResponse,isTgBotApiUpdate,makeTgBotClient,messageEffectIdCodes});
1
+ "use strict";var P=Object.create;var y=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var D=(e,o)=>{for(var t in o)y(e,t,{get:o[t],enumerable:!0})},b=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of $(o))!O.call(e,r)&&r!==t&&y(e,r,{get:()=>o[r],enumerable:!(n=v(o,r))||n.enumerable});return e};var l=(e,o,t)=>(t=e!=null?P(j(e)):{},b(o||!e||!e.__esModule?y(t,"default",{value:e,enumerable:!0}):t,e)),I=e=>b(y({},"__esModule",{value:!0}),e);var q={};D(q,{MESSAGE_EFFECTS:()=>_,TG_BOT_API_URL:()=>F,TgBotApiBaseUrl:()=>d,TgBotApiToken:()=>f,TgBotClientError:()=>p,executeTgBotMethod:()=>g,getFile:()=>B,getFileAsBase64String:()=>H,getFileBytes:()=>C,isFileContent:()=>T,isMessageEffect:()=>L,isTgBotApiResponse:()=>k,isTgBotApiUpdate:()=>N,makeTgBotClient:()=>V,messageEffectIdCodes:()=>J});module.exports=I(q);var R=l(require("effect/String")),c=l(require("effect/Micro"));var E=l(require("effect/Data")),p=class extends E.TaggedError("TgBotClientError"){};var T=e=>typeof e=="object"&&e!=null&&"file_content"in e&&e.file_content instanceof Uint8Array&&"file_name"in e&&typeof e.file_name=="string",k=e=>typeof e=="object"&&e!=null&&"ok"in e&&typeof e.ok=="boolean",N=e=>typeof e=="object"&&e!=null&&"update_id"in e&&typeof e.update_id=="number";var x=l(require("effect/Context"));var F="https://api.telegram.org",_={"\u{1F525}":"5104841245755180586","\u{1F44D}":"5107584321108051014","\u{1F44E}":"5104858069142078462","\u2764\uFE0F":"5159385139981059251","\u{1F389}":"5046509860389126442","\u{1F4A9}":"5046589136895476101"},J=Object.keys(_),L=e=>typeof e=="string"&&e in _;var d=class extends x.Reference()("TgBotApiBaseUrl",{defaultValue:()=>F}){},f=class extends x.Tag("TgBotApiToken")(){};var h=e=>{let o=Object.entries(e);if(o.length==0)return;let t=new FormData;for(let[n,r]of o)r&&(typeof r!="object"?t.append(n,`${r}`):T(r)?t.append(n,new Blob([r.file_content]),r.file_name):t.append(n,JSON.stringify(r)));return t};var g=(e,o)=>c.gen(function*(){let t=yield*c.service(f),n=yield*c.service(d),r=yield*c.tryPromise({try:()=>fetch(`${n}/bot${t}/${R.snakeToCamel(e)}`,{body:h(o)??null,method:"POST"}),catch:m=>new p({cause:{_tag:"ClientInternalError",cause:m}})}),a=yield*c.tryPromise({try:()=>r.json(),catch:()=>new p({cause:{_tag:"NotJsonResponse",response:r}})});return k(a)?r.ok?a.result:yield*c.fail(new p({cause:{_tag:"NotOkResponse",...a.error_code?{errorCode:a.error_code}:void 0,...a.description?{details:a.description}:void 0}})):yield*c.fail(new p({cause:{_tag:"UnexpectedResponse",response:a}}))});var s=l(require("effect/Micro"));var B=({fileId:e,type:o})=>C(e).pipe(s.andThen(({content:t,file_name:n})=>new File([t],n,{...o?{type:o}:void 0}))),H=({fileId:e,type:o})=>C(e).pipe(s.andThen(({content:t,file_name:n})=>{let r=Buffer.from(t).toString("base64");return{encoded:`data:${o};base64,${r}`,file_name:n}})),C=e=>s.gen(function*(){let t=(yield*g("get_file",{file_id:e})).file_path;if(!t||t.length==0)return yield*s.fail(new p({cause:{_tag:"UnableToGetFile",cause:"File path not defined"}}));let n=t.replaceAll("/","-"),r=yield*s.service(d),a=yield*s.service(f),m=`${r}/file/bot${a}/${t}`;return{content:yield*s.tryPromise({try:()=>fetch(m).then(M=>M.arrayBuffer()),catch:M=>new p({cause:{_tag:"UnableToGetFile",cause:M}})}),file_name:n}});var i=l(require("effect/Micro")),G=l(require("effect/Context"));var S=l(require("effect/Micro")),w=l(require("effect/Context"));var u=class extends w.Tag("ClientFileService")(){},U=S.gen(function*(){return{getFile:B}});function V(e){return i.gen(function*(){let t=yield*i.service(u),n=G.make(f,e.bot_token);return{execute:(m,A)=>g(m,A).pipe(i.provideContext(n),i.runPromise),getFile:m=>t.getFile(m).pipe(i.provideContext(n),i.runPromise)}}).pipe(i.provideServiceEffect(u,U),i.runSync)}0&&(module.exports={MESSAGE_EFFECTS,TG_BOT_API_URL,TgBotApiBaseUrl,TgBotApiToken,TgBotClientError,executeTgBotMethod,getFile,getFileAsBase64String,getFileBytes,isFileContent,isMessageEffect,isTgBotApiResponse,isTgBotApiUpdate,makeTgBotClient,messageEffectIdCodes});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import*as A from"effect/String";import*as p from"effect/Micro";import*as M from"effect/Data";var a=class e extends M.TaggedError("TgBotClientError"){static missingSuccess=new e({cause:{type:"ClientInternalError",cause:"Expected 'success' to be defined"}})};var T=e=>typeof e=="object"&&e!=null&&"file_content"in e&&e.file_content instanceof Uint8Array&&"file_name"in e&&typeof e.file_name=="string",k=e=>typeof e=="object"&&e!=null&&"ok"in e&&typeof e.ok=="boolean",U=e=>typeof e=="object"&&e!=null&&"update_id"in e&&typeof e.update_id=="number";import*as u from"effect/Context";var F="https://api.telegram.org",C={"\u{1F525}":"5104841245755180586","\u{1F44D}":"5107584321108051014","\u{1F44E}":"5104858069142078462","\u2764\uFE0F":"5159385139981059251","\u{1F389}":"5046509860389126442","\u{1F4A9}":"5046589136895476101"},P=Object.keys(C),v=e=>typeof e=="string"&&e in C;var m=class extends u.Reference()("TgBotApiBaseUrl",{defaultValue:()=>F}){},l=class extends u.Tag("TgBotApiToken")(){};var B=e=>{let s=Object.entries(e);if(s.length==0)return;let t=new FormData;for(let[r,o]of s)o&&(typeof o!="object"?t.append(r,`${o}`):T(o)?t.append(r,new Blob([o.file_content]),o.file_name):t.append(r,JSON.stringify(o)));return t};var y=(e,s)=>p.gen(function*(){let t=yield*p.service(l),r=yield*p.service(m),o=yield*p.tryPromise({try:()=>fetch(`${r}/bot${t}/${A.snakeToCamel(e)}`,{body:B(s)??null,method:"POST"}),catch:f=>new a({cause:{type:"ClientInternalError",cause:f}})}),c=yield*p.tryPromise({try:()=>o.json(),catch:()=>new a({cause:{type:"NotJsonResponse",response:o}})});return k(c)?o.ok?c.result:yield*p.fail(new a({cause:{type:"NotOkResponse",...c.error_code?{errorCode:c.error_code}:void 0,...c.description?{details:c.description}:void 0}})):yield*p.fail(new a({cause:{type:"UnexpectedResponse",response:c}}))});import*as i from"effect/Micro";var b=({fileId:e,type:s})=>_(e).pipe(i.andThen(({content:t,file_name:r})=>new File([t],r,{...s?{type:s}:void 0}))),Q=({fileId:e,type:s})=>_(e).pipe(i.andThen(({content:t,file_name:r})=>{let o=Buffer.from(t).toString("base64");return{encoded:`data:${s};base64,${o}`,file_name:r}})),_=e=>i.gen(function*(){let t=(yield*y("get_file",{file_id:e})).file_path;if(!t||t.length==0)return yield*i.fail(new a({cause:{type:"UnableToGetFile",cause:"File path not defined"}}));let r=t.replaceAll("/","-"),o=yield*i.service(m),c=yield*i.service(l),f=`${o}/file/bot${c}/${t}`;return{content:yield*i.tryPromise({try:()=>fetch(f).then(g=>g.arrayBuffer()),catch:g=>new a({cause:{type:"UnableToGetFile",cause:g}})}),file_name:r}});import*as n from"effect/Micro";import*as S from"effect/Context";import*as E from"effect/Micro";import*as h from"effect/Context";var d=class extends h.Tag("ClientFileService")(){},R=E.gen(function*(){return{getFile:b}});function re(e){return n.gen(function*(){let t=yield*n.service(d),r=S.make(l,e.bot_token);return{execute:(f,x)=>y(f,x).pipe(n.provideContext(r),n.runPromise),getFile:f=>t.getFile(f).pipe(n.provideContext(r),n.runPromise)}}).pipe(n.provideServiceEffect(d,R),n.runSync)}export{C as MESSAGE_EFFECTS,F as TG_BOT_API_URL,m as TgBotApiBaseUrl,l as TgBotApiToken,a as TgBotClientError,y as executeTgBotMethod,b as getFile,Q as getFileAsBase64String,_ as getFileBytes,T as isFileContent,v as isMessageEffect,k as isTgBotApiResponse,U as isTgBotApiUpdate,re as makeTgBotClient,P as messageEffectIdCodes};
1
+ import*as C from"effect/String";import*as p from"effect/Micro";import*as M from"effect/Data";var a=class extends M.TaggedError("TgBotClientError"){};var T=e=>typeof e=="object"&&e!=null&&"file_content"in e&&e.file_content instanceof Uint8Array&&"file_name"in e&&typeof e.file_name=="string",k=e=>typeof e=="object"&&e!=null&&"ok"in e&&typeof e.ok=="boolean",U=e=>typeof e=="object"&&e!=null&&"update_id"in e&&typeof e.update_id=="number";import*as g from"effect/Context";var F="https://api.telegram.org",_={"\u{1F525}":"5104841245755180586","\u{1F44D}":"5107584321108051014","\u{1F44E}":"5104858069142078462","\u2764\uFE0F":"5159385139981059251","\u{1F389}":"5046509860389126442","\u{1F4A9}":"5046589136895476101"},P=Object.keys(_),v=e=>typeof e=="string"&&e in _;var m=class extends g.Reference()("TgBotApiBaseUrl",{defaultValue:()=>F}){},l=class extends g.Tag("TgBotApiToken")(){};var B=e=>{let s=Object.entries(e);if(s.length==0)return;let t=new FormData;for(let[r,o]of s)o&&(typeof o!="object"?t.append(r,`${o}`):T(o)?t.append(r,new Blob([o.file_content]),o.file_name):t.append(r,JSON.stringify(o)));return t};var u=(e,s)=>p.gen(function*(){let t=yield*p.service(l),r=yield*p.service(m),o=yield*p.tryPromise({try:()=>fetch(`${r}/bot${t}/${C.snakeToCamel(e)}`,{body:B(s)??null,method:"POST"}),catch:f=>new a({cause:{_tag:"ClientInternalError",cause:f}})}),c=yield*p.tryPromise({try:()=>o.json(),catch:()=>new a({cause:{_tag:"NotJsonResponse",response:o}})});return k(c)?o.ok?c.result:yield*p.fail(new a({cause:{_tag:"NotOkResponse",...c.error_code?{errorCode:c.error_code}:void 0,...c.description?{details:c.description}:void 0}})):yield*p.fail(new a({cause:{_tag:"UnexpectedResponse",response:c}}))});import*as i from"effect/Micro";var A=({fileId:e,type:s})=>b(e).pipe(i.andThen(({content:t,file_name:r})=>new File([t],r,{...s?{type:s}:void 0}))),Q=({fileId:e,type:s})=>b(e).pipe(i.andThen(({content:t,file_name:r})=>{let o=Buffer.from(t).toString("base64");return{encoded:`data:${s};base64,${o}`,file_name:r}})),b=e=>i.gen(function*(){let t=(yield*u("get_file",{file_id:e})).file_path;if(!t||t.length==0)return yield*i.fail(new a({cause:{_tag:"UnableToGetFile",cause:"File path not defined"}}));let r=t.replaceAll("/","-"),o=yield*i.service(m),c=yield*i.service(l),f=`${o}/file/bot${c}/${t}`;return{content:yield*i.tryPromise({try:()=>fetch(f).then(y=>y.arrayBuffer()),catch:y=>new a({cause:{_tag:"UnableToGetFile",cause:y}})}),file_name:r}});import*as n from"effect/Micro";import*as S from"effect/Context";import*as E from"effect/Micro";import*as h from"effect/Context";var d=class extends h.Tag("ClientFileService")(){},R=E.gen(function*(){return{getFile:A}});function re(e){return n.gen(function*(){let t=yield*n.service(d),r=S.make(l,e.bot_token);return{execute:(f,x)=>u(f,x).pipe(n.provideContext(r),n.runPromise),getFile:f=>t.getFile(f).pipe(n.provideContext(r),n.runPromise)}}).pipe(n.provideServiceEffect(d,R),n.runSync)}export{_ as MESSAGE_EFFECTS,F as TG_BOT_API_URL,m as TgBotApiBaseUrl,l as TgBotApiToken,a as TgBotClientError,u as executeTgBotMethod,A as getFile,Q as getFileAsBase64String,b as getFileBytes,T as isFileContent,v as isMessageEffect,k as isTgBotApiResponse,U as isTgBotApiUpdate,re as makeTgBotClient,P as messageEffectIdCodes};
package/dist/webapp.d.ts CHANGED
@@ -143,6 +143,7 @@ interface WebApp {
143
143
  setEmojiStatus: (custom_emoj_id: string, params?: EmojiStatusParams, callback?: (isStatusSet: boolean) => void) => void;
144
144
  requestEmojiStatusAccess: (url: string, callback?: (invoiceStatus: unknown) => void) => void;
145
145
  downloadFile: (params: DownloadFileParams, callback?: (isAccepted: boolean) => void) => void;
146
+ hideKeyboard: () => void;
146
147
  showPopup: (params: PopupParams, callback?: (buttonId: string) => void) => void;
147
148
  showAlert: (message: string, callback?: () => void) => void;
148
149
  showConfirm: (message: string, callback?: (isOk: boolean) => void) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-ak/tg-bot-client",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "homepage": "https://effect-ak.github.io/telegram-bot-playground/",
5
5
  "author": {
6
6
  "name": "Aleksandr Kondaurov",
@@ -13,7 +13,9 @@
13
13
  "files": [
14
14
  "dist/*.js",
15
15
  "dist/*.mjs",
16
- "dist/*.d.ts"
16
+ "dist/*.d.ts",
17
+ "!dist/bot-bundle.d.ts",
18
+ "!dist/bot-bundle.d.mts"
17
19
  ],
18
20
  "keywords": [
19
21
  "telegram typescript types",
@@ -42,6 +44,11 @@
42
44
  "require": "./dist/bot.js",
43
45
  "import": "./dist/bot.mjs"
44
46
  },
47
+ "./bot-bundle": {
48
+ "types": "./dist/bot.d.ts",
49
+ "require": "./dist/bot-bundle.js",
50
+ "import": "./dist/bot-bundle.mjs"
51
+ },
45
52
  "./webapp": {
46
53
  "types": "./dist/webapp.d.ts",
47
54
  "require": "./dist/webapp.js",
@@ -59,7 +66,8 @@
59
66
  "typescript": "^5.8.3",
60
67
  "vite-tsconfig-paths": "^5.1.4",
61
68
  "vitest": "^3.1.1",
62
- "effect": "3.12.0"
69
+ "effect": "3.12.0",
70
+ "tsup": "^8.5.0"
63
71
  },
64
72
  "peerDependencies": {
65
73
  "effect": "^3.12.0"
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [![NPM Version](https://img.shields.io/npm/v/%40effect-ak%2Ftg-bot-client)](https://www.npmjs.com/package/@effect-ak/tg-bot-client)
2
- ![Telegram Bot API](https://img.shields.io/badge/BotApi-9.0-blue?link=)
3
- ![Telegram WebApp](https://img.shields.io/badge/Telegram.WebApp-9.0-blue?link=)
2
+ ![Telegram Bot API](https://img.shields.io/badge/BotApi-9.1-blue?link=)
3
+ ![Telegram WebApp](https://img.shields.io/badge/Telegram.WebApp-9.1-blue?link=)
4
4
  [![OpenAPI](https://img.shields.io/badge/OpenAPI-3.1-blue.svg)](https://effect-ak.github.io/telegram-bot-api/)
5
5
  ![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/%40effect-ak%2Ftg-bot-client?link=)
6
6
  ![NPM Downloads](https://img.shields.io/npm/dw/%40effect-ak%2Ftg-bot-client?link=)