mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-13 17:47:39 +01:00
3 lines
395 KiB
JavaScript
3 lines
395 KiB
JavaScript
|
/*! For license information please see 8a3a3c77b9c4b020ac88.worker.js.LICENSE.txt */
|
||
|
!function(e){var t={};function n(s){if(t[s])return t[s].exports;var i=t[s]={i:s,l:!1,exports:{}};return e[s].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(s,i,function(t){return e[t]}.bind(null,i));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=113)}([function(e,t,n){const s=n(6),i=n(83),a=n(60),r=n(24),o=n(101),c=n(102),u=n(21),d=n(16),l=n(106),f=n(43),p=n(8);e.exports={Api:s,TelegramClient:i,sessions:l,connection:a,extensions:f,tl:r,version:o,events:c,utils:u,errors:d,helpers:p}},function(e,t,n){"use strict";n.d(t,"f",(function(){return k})),n.d(t,"a",(function(){return E})),n.d(t,"b",(function(){return O})),n.d(t,"e",(function(){return R})),n.d(t,"g",(function(){return D})),n.d(t,"c",(function(){return B})),n.d(t,"i",(function(){return x})),n.d(t,"h",(function(){return j})),n.d(t,"d",(function(){return N}));var s={};n.r(s),n.d(s,"Type",(function(){return m})),n.d(s,"fetch",(function(){return b})),n.d(s,"save",(function(){return y})),n.d(s,"clear",(function(){return _}));var i=n(0),a=n(43),r=n(4),o=n(18),c=n(28),u=n(9),d=n(42),l=n(13),f=n(5),p=n(2),g=n(35);const h=self.caches;let m;async function b(e,t,n){if(h)try{const s=new Request(t.replace(/:/g,"_")),i=await h.open(e),a=await i.match(s);if(!a)return;switch(n){case m.Text:return await a.text();case m.Blob:{const e=await a.blob();if("sticker"===t.substr(0,7))return new Blob([e],{type:"image/webp"});if(!e.type){const t=a.headers.get("Content-Type");if(t)return new Blob([e],{type:t})}return e}case m.Json:return await a.json();default:return}}catch(e){return void console.warn(e)}}async function y(e,t,n){if(h)try{const s="string"==typeof n||n instanceof Blob?n:JSON.stringify(n),i=new Request(t.replace(/:/g,"_")),a=new Response(s),r=await h.open(e);return await r.put(i,a)}catch(e){return void console.warn(e)}}async function _(e){try{if(!h)return;return await h.delete(e)}catch(e){return void console.warn(e)}}!function(e){e[e.Text=0]="Text",e[e.Blob=1]="Blob",e[e.Json=2]="Json"}(m||(m={}));const w=new Set(["msg","sticker","gif","wallpaper","photo","webDocument"]);async function v({url:e,mediaFormat:t,start:n,end:a},o,c,u){const{data:h,mimeType:m,fullSize:b}=await async function(e,t,n,s,a,o,c){const u=e.startsWith("webDocument")?e.match(/(webDocument):(.+)/):e.match(/(avatar|profile|photo|msg|stickerSet|sticker|wallpaper|gif|file)([-\d\w./]+)(\?size=\w+)?/);if(!u)return;if("file"===u[1]){const e=await fetch(u[2]);return{data:await e.arrayBuffer()}}if(!n)return Promise.reject(new Error("ERROR: Client is not connected"));let d,g=u[2];const h=u[3]?u[3].replace("?size=",""):void 0;let m;"avatar"===u[1]||"profile"===u[1]?(d=Object(p.t)(Number(g)),g=Math.abs(Number(g))):d=u[1];switch(d){case"channel":case"chat":m=f.a.chats[g];break;case"user":m=f.a.users[g];break;case"msg":m=f.a.messages[g];break;case"sticker":case"gif":case"wallpaper":m=f.a.documents[g];break;case"photo":m=f.a.photos[g];break;case"stickerSet":m=f.a.stickerSets[g];break;case"webDocument":m=f.a.webDocuments[g]}if(!m)return;if(w.has(d)){c===l.ApiMediaFormat.Stream&&(s.acceptsBuffer=!0);const e=await t.downloadMedia(m,{sizeType:h,start:a,end:o,progressCallback:s,workers:r.k});let n,u;return m instanceof i.Api.Message?(n=function(e,t){if(!e||!e.media)return;if(e.media instanceof i.Api.MessageMediaPhoto)return"image/jpeg";if(e.media instanceof i.Api.MessageMediaDocument&&e.media.document instanceof i.Api.Document)return t?e.media.document.attributes.some(e=>e instanceo
|
||
|
//# sourceMappingURL=8a3a3c77b9c4b020ac88.worker.js.map
|