telegram-tt/dist/e7fc72da7550fedbc80d.worker.js

3 lines
380 KiB
JavaScript
Raw Normal View History

2021-05-21 15:21:37 +02:00
/*! For license information please see e7fc72da7550fedbc80d.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=109)}([function(e,t,n){const s=n(6),i=n(80),a=n(59),r=n(20),o=n(98),c=n(99),u=n(21),d=n(27),l=n(103),f=n(42),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 M})),n.d(t,"a",(function(){return k})),n.d(t,"b",(function(){return E})),n.d(t,"e",(function(){return R})),n.d(t,"g",(function(){return U})),n.d(t,"c",(function(){return T})),n.d(t,"i",(function(){return B})),n.d(t,"h",(function(){return D})),n.d(t,"d",(function(){return x}));var s={};n.r(s),n.d(s,"Type",(function(){return m})),n.d(s,"fetch",(function(){return y})),n.d(s,"save",(function(){return b})),n.d(s,"clear",(function(){return _}));var i=n(0),a=n(42),r=n(4),o=n(17),c=n(26),u=n(9),d=n(41),l=n(11),f=n(5),p=n(2),g=n(34);const h=self.caches;let m;async function y(e,t,n){if(h)try{const s=new Request(t),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 b(e,t,n){if(h)try{const s="string"==typeof n||n instanceof Blob?n:JSON.stringify(n),i=new Request(t),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)}}async function w({url:e,mediaFormat:t,start:n,end:a},o,c,u){const{data:h,mimeType:m,fullSize:y}=await async function(e,t,n,s,a,o,c){const u=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.s)(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]}if(!m)return;if(["msg","sticker","gif","wallpaper","photo"].includes(d)){c===l.ApiMediaFormat.Stream&&(s.acceptsBuffer=!0);const e=await t.downloadMedia(m,{sizeType:h,start:a,end:o,progressCallback:s,workers:r.j});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 instanceof i.Api.DocumentAttributeSticker)?"image/webp":"image/jpeg":e.media.document.mimeType;return}(m,h),m.media instanceof i.Api.MessageMediaDocument&&m.media.document instanceof i.Api.Document&&(u=m.media.document.size)):m instanceof i.Api.Photo?n="image/j
//# sourceMappingURL=e7fc72da7550fedbc80d.worker.js.map