You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

193 lines
436 KiB

// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt Apache-2.0
// @source: https://gitlab.matrix.org/matrix-org/olm/-/tree/3.2.3
var Olm = (function() {
var olm_exports = {};
var onInitSuccess;
var onInitFail;
var Module = (function() {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(Module) {
Module = Module || {};
var a;a||(a=typeof Module !== 'undefined' ? Module : {});var aa;a.ready=new Promise(function(b){aa=b});var g;if("undefined"!==typeof window)g=function(b){window.crypto.getRandomValues(b)};else if(module.exports){var ba=require("crypto");g=function(b){var c=ba.randomBytes(b.length);b.set(c)};process=global.process}else throw Error("Cannot find global to attach library to");if("undefined"!==typeof OLM_OPTIONS)for(var ca in OLM_OPTIONS)OLM_OPTIONS.hasOwnProperty(ca)&&(a[ca]=OLM_OPTIONS[ca]);
a.onRuntimeInitialized=function(){h=a._olm_error();olm_exports.PRIVATE_KEY_LENGTH=a._olm_pk_private_key_length();onInitSuccess&&onInitSuccess()};a.onAbort=function(b){onInitFail&&onInitFail(b)};var da={},l;for(l in a)a.hasOwnProperty(l)&&(da[l]=a[l]);var ea=!1,m=!1,fa=!1,ha=!1;ea="object"===typeof window;m="function"===typeof importScripts;fa="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ha=!ea&&!fa&&!m;var p="",ia,ja,la,ma;
if(fa)p=m?require("path").dirname(p)+"/":__dirname+"/",ia=function(b,c){var d=q(b);if(d)return c?d:d.toString();la||(la=require("fs"));ma||(ma=require("path"));b=ma.normalize(b);return la.readFileSync(b,c?null:"utf8")},ja=function(b){b=ia(b,!0);b.buffer||(b=new Uint8Array(b));assert(b.buffer);return b},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(b){throw b;}),process.on("unhandledRejection",r),a.inspect=function(){return"[Emscripten Module object]"};
else if(ha)"undefined"!=typeof read&&(ia=function(b){var c=q(b);return c?na(c):read(b)}),ja=function(b){var c;if(c=q(b))return c;if("function"===typeof readbuffer)return new Uint8Array(readbuffer(b));c=read(b,"binary");assert("object"===typeof c);return c},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(ea||m)m?p=self.location.href:document.currentScript&&(p=document.currentScript.src),
_scriptDir&&(p=_scriptDir),0!==p.indexOf("blob:")?p=p.substr(0,p.lastIndexOf("/")+1):p="",ia=function(b){try{var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText}catch(d){if(b=q(b))return na(b);throw d;}},m&&(ja=function(b){try{var c=new XMLHttpRequest;c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}catch(d){if(b=q(b))return b;throw d;}});var oa=a.print||console.log.bind(console),pa=a.printErr||console.warn.bind(console);
for(l in da)da.hasOwnProperty(l)&&(a[l]=da[l]);da=null;var t;a.wasmBinary&&(t=a.wasmBinary);var noExitRuntime;a.noExitRuntime&&(noExitRuntime=a.noExitRuntime);function qa(){this.buffer=new ArrayBuffer(ra/65536*65536);this.grow=function(b){return sa(b)}}function ta(){this.exports=(
// EMSCRIPTEN_START_ASM
function a(asmLibraryArg,wasmMemory,wasmTable){var scratchBuffer=new ArrayBuffer(8);var b=new Int32Array(scratchBuffer);var c=new Float32Array(scratchBuffer);var d=new Float64Array(scratchBuffer);function e(index){return b[index]}function f(index,value){b[index]=value}function g(){return d[0]}function h(value){d[0]=value}function i(global,env,buffer){var j=env.memory;var k=wasmTable;var l=new global.Int8Array(buffer);var m=new global.Int16Array(buffer);var n=new global.Int32Array(buffer);var o=new global.Uint8Array(buffer);var p=new global.Uint16Array(buffer);var q=new global.Uint32Array(buffer);var r=new global.Float32Array(buffer);var s=new global.Float64Array(buffer);var t=global.Math.imul;var u=global.Math.fround;var v=global.Math.abs;var w=global.Math.clz32;var x=global.Math.min;var y=global.Math.max;var z=global.Math.floor;var A=global.Math.ceil;var B=global.Math.sqrt;var C=env.abort;var D=global.NaN;var E=global.Infinity;var F=env.emscripten_memcpy_big;var G=env.emscripten_resize_heap;var H=env.__assert_fail;var I=5281408;var J=0;
// EMSCRIPTEN_START_FUNCS
function ub(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,p=0,q=0,r=0,s=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,W=0,X=0,Z=0,_=0,$=0,ba=0,ca=0,da=0,ea=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0;d=I-2592|0;I=d;f=o[b+28|0]|o[b+29|0]<<8|(o[b+30|0]<<16|o[b+31|0]<<24);n[d+24>>2]=o[b+24|0]|o[b+25|0]<<8|(o[b+26|0]<<16|o[b+27|0]<<24);n[d+28>>2]=f;f=o[b+20|0]|o[b+21|0]<<8|(o[b+22|0]<<16|o[b+23|0]<<24);n[d+16>>2]=o[b+16|0]|o[b+17|0]<<8|(o[b+18|0]<<16|o[b+19|0]<<24);n[d+20>>2]=f;f=o[b+4|0]|o[b+5|0]<<8|(o[b+6|0]<<16|o[b+7|0]<<24);e=o[b|0]|o[b+1|0]<<8|(o[b+2|0]<<16|o[b+3|0]<<24);n[d>>2]=e;n[d+4>>2]=f;f=o[b+12|0]|o[b+13|0]<<8|(o[b+14|0]<<16|o[b+15|0]<<24);n[d+8>>2]=o[b+8|0]|o[b+9|0]<<8|(o[b+10|0]<<16|o[b+11|0]<<24);n[d+12>>2]=f;l[d|0]=e&248;l[d+31|0]=o[d+31|0]&63|64;h=o[c+3|0];f=h;b=f<<24&50331648;f=o[c+2|0];e=f>>>16|0;n[d+112>>2]=b|(o[c|0]|o[c+1|0]<<8|f<<16);n[d+116>>2]=e;f=o[c+4|0];e=f>>>24|0;b=f<<8|h;f=o[c+5|0];i=f>>>16|0;g=b|f<<16;h=e|i;q=o[c+6|0];f=q;e=f>>>8|0;u=f<<24;f=e|h;e=g|u;n[d+120>>2]=((f&3)<<30|e>>>2)&33554431;n[d+124>>2]=0;f=o[c+7|0];e=f>>>24|0;g=f<<8|q;f=e;b=g;g=o[c+8|0];e=g>>>16|0;g=b|g<<16;h=e|f;q=o[c+9|0];f=q;e=f>>>8|0;u=f<<24;f=e|h;e=g|u;n[d+128>>2]=((f&7)<<29|e>>>3)&67108863;n[d+132>>2]=0;f=o[c+10|0];e=f>>>24|0;b=f<<8|q;f=o[c+11|0];i=f>>>16|0;g=b|f<<16;h=e|i;q=o[c+12|0];f=q;e=f>>>8|0;u=f<<24;f=e|h;e=g|u;n[d+136>>2]=((f&31)<<27|e>>>5)&33554431;n[d+140>>2]=0;f=o[c+13|0];e=f>>>24|0;g=f<<8|q;f=e;b=g;g=o[c+14|0];e=g>>>16|0;g=b|g<<16;h=e|f;f=o[c+15|0];e=f>>>8|0;q=f<<24;f=e|h;e=g|q;n[d+144>>2]=(f&63)<<26|e>>>6;n[d+148>>2]=f>>>6;h=o[c+19|0];f=h;b=f<<24&16777216;f=o[c+18|0];e=f>>>16|0;n[d+152>>2]=b|(o[c+16|0]|o[c+17|0]<<8|f<<16);n[d+156>>2]=e;f=o[c+20|0];e=f>>>24|0;b=f<<8|h;f=o[c+21|0];i=f>>>16|0;g=b|f<<16;h=e|i;q=o[c+22|0];f=q;e=f>>>8|0;u=f<<24;f=e|h;e=g|u;n[d+160>>2]=((f&1)<<31|e>>>1)&67108863;n[d+164>>2]=0;f=o[c+23|0];e=f>>>24|0;g=f<<8|q;f=e;b=g;g=o[c+24|0];e=g>>>16|0;g=b|g<<16;h=e|f;q=o[c+25|0];f=q;e=f>>>8|0;u=f<<24;f=e|h;e=g|u;n[d+168>>2]=((f&7)<<29|e>>>3)&33554431;n[d+172>>2]=0;f=o[c+26|0];e=f>>>24|0;b=f<<8|q;f=o[c+27|0];i=f>>>16|0;g=b|f<<16;h=e|i;q=o[c+28|0];f=q;e=f>>>8|0;u=f<<24;f=e|h;e=g|u;n[d+176>>2]=((f&15)<<28|e>>>4)&67108863;n[d+180>>2]=0;f=o[c+29|0];e=f>>>24|0;g=f<<8|q;f=e;b=g;g=o[c+30|0];e=g>>>16|0;g=b|g<<16;f=e|f;c=o[c+31|0];e=c>>>8|0;h=c<<24;c=e|f;f=g|h;n[d+184>>2]=((c&63)<<26|f>>>6)&33554431;n[d+188>>2]=0;fa(d+1312|0,0,152);n[d+1312>>2]=1;n[d+1316>>2]=0;fa(d+1152|0,0,152);n[d+1152>>2]=1;n[d+1156>>2]=0;fa(d+992|0,0,152);fa(d+832|0,0,152);fa(d+672|0,0,152);n[d+672>>2]=1;n[d+676>>2]=0;fa(d+512|0,0,152);fa(d+352|0,0,152);n[d+352>>2]=1;n[d+356>>2]=0;fa(d+1552|0,0,72);Y(d+1472|0,d+112|0,80);qa=d+272|0;q=d+512|0;f=d+832|0;u=d+352|0;h=d+672|0;c=d+992|0;p=d+1472|0;b=d+1152|0;s=d+1312|0;while(1){oa=o[(d-na|0)+31|0];pa=0;while(1){M=f;w=b;f=p;ma=(oa&128)>>>7|0;Pa(b,f,ma);G=c;g=s;Pa(c,g,ma);e=b;v=e;R=n[c+4>>2];S=n[e+4>>2];k=R+S|0;s=n[c>>2];p=n[e>>2];m=p;r=s+m|0;if(r>>>0<m>>>0){k=k+1|0}n[v>>2]=r;n[e+4>>2]=k;v=b;T=n[c+12>>2];U=n[e+12>>2];j=T+U|0;m=n[c+8>>2];r=n[e+8>>2];y=m+r|0;if(y>>>0<r>>>0){j=j+1|0}n[v+8>>2]=y;n[e+12>>2]=j;W=n[c+20>>2];X=n[b+20>>2];e=W+X|0;y=n[c+16>>2];A=n[b+16>>2];z=y+A|0;if(z>>>0<A>>>0){e=e+1|0}n[b+16>>2]=z;n[b+20>>2]=e;e=b;v=e;Z=n[c+28>>2];_=n[e+28>>2];i=Z+_|0;x=n[c+24>>2];L=n[e+24>>2];z=L;H=x+z|0;if(H>>>0<z>>>0){i=i+1|0}n[v+24>>2]=H;n[e+28>>2]=i;$=n[c+36>>2];ba=n[b+36>>2];e=$+ba|0;H=n[c+32>>2];N=n[b+32>>2];E=N;B=H+E|0;if(B>>>0<E>>>0){e=e+1|0}n[b+32>>2]=B;n[b+36>>2]=e;e=b;v=e;ca=n[c+44>>2];da=n[e+44>>2];k=ca+da|0;z=n[c+40>>2];E=n[e+40>>2];B=E;K=z+B|0;if(K>>>0<B>>>0){k=k+1|0}n[v+40>>2]=K;n[e+44>>2]=k;v=b;ea=n[c+52>>2];O=n[e+52>>2];j=ea+O|0;B=n[c+48>>2];K=n[e+48>>2];k=K;F=B+k|0;if(F>>>0<k>>>0){j=j+1|0}n[v+48>>2]=F;n[e+52>>2]=j;ha=n[c+60>>2];ia=n[b+60>>2];e=ha+ia|0;F=n[c+56>>2];v=n[b+56>>2];D=v;i=F+D|0;if(i>>>0<D>>>0){e=e+1|0}n[b+56>>2]=i;n[b+60>>2]=e;e=b;Q=e;P=n[c+68>>2];ja=n[e+68>>2];i=P+ja|0;k=n[c+64>>2];D=n[e+64>>2];j=D;C=k+j|0;if(C>>>0<j>>>0){i=i+1|0}n[Q+64>>2]=C;n[e+68>>2]=i;la=n[c+76>>2];ka=n[b+76>>2];e=la+ka|0;j=n[c+72>>2];
function Fd(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0;f=I-16|0;I=f;g=-1;b=Ja(b,c,d,e,a+300|0);a:{if((b|0)==-1){break a}b=b+d|0;d=ba(d,b,f+12|0);if(n[f+12>>2]+ -1>>>0>=2){n[a+300>>2]=9;break a}c=a+296|0;d=Da(Xa(a+132|0,Xa(a,d,b),b),b,a+264|0);b:{if(n[f+12>>2]==1){n[c>>2]=1;break b}if((b|0)!=(d|0)){l[c|0]=o[d|0]!=0;d=d+1|0}}g=e;if((b|0)==(d|0)){break a}n[a+300>>2]=10;g=-1}I=f+16|0;return g|0}function ne(a){var b=0,c=0,d=0,e=0,f=0;b=a+48|0;d=n[a+44>>2];e=36;a:{if((b|0)==(d|0)){break a}c=4;while(1){c=c+100|0;b=b+100|0;if((d|0)!=(b|0)){continue}break}e=c+32|0}d=4;c=4;b=a+152|0;f=n[a+148>>2];if((b|0)!=(f|0)){while(1){c=c+68|0;b=b+68|0;if((f|0)!=(b|0)){continue}break}}b=a+496|0;a=n[a+492>>2];if((b|0)!=(a|0)){while(1){d=d+68|0;b=b+68|0;if((a|0)!=(b|0)){continue}break}}return(c+e|0)+d|0}function yc(a,b,c,d){var e=0,f=0;l[d+1|0]=10;l[d|0]=3;d=d+2|0;l[d|0]=32;d=d+1|0;n[a>>2]=d;d=d+32|0;l[d|0]=16;d=d+1|0;if(b>>>0>=128){e=b;while(1){l[d|0]=b|128;d=d+1|0;f=e>>>0>16383;b=e>>>7|0;e=b;if(f){continue}break}}l[d+1|0]=34;l[d|0]=b;d=d+2|0;if(c>>>0>=128){e=c;while(1){l[d|0]=c|128;d=d+1|0;b=e>>>0>16383;c=e>>>7|0;e=c;if(b){continue}break}}l[d|0]=c;n[a+4>>2]=d+1}function Ae(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0;h=I-16|0;I=h;a:{if(!(!f|43<=g>>>0)){n[a>>2]=2;g=-1;break a}g=-1;b=Ja(b,c,d,e,a);if((b|0)==-1){break a}b=b+d|0;c=b+1|0;d=ba(d,c,h+12|0);if(n[h+12>>2]!=1){n[a>>2]=9;break a}if((Ba(d,c,a+4|0)|0)!=(b|0)){if(n[a>>2]){break a}n[a>>2]=10;break a}if(f){ia(a+4|0,32,f)}g=e}I=h+16|0;return g|0}function We(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0;h=gb(a,c);i=h+2|0;j=(i>>>0)/3|0;if((j<<2|i-t(j,3))+ -2>>>0>g>>>0){n[a+3216>>2]=2;return-1}g=a;i=b;a=h+2|0;b=(a>>>0)/3|0;b=tc(g,i,c,d,e,(((b<<2|a-t(b,3))+ -2|0)+f|0)-h|0,h);X(d,e);a=-1;if((b|0)!=-1){a=h+2|0;b=(a>>>0)/3|0;a=(b<<2|a-t(b,3))+ -2|0;ia((f+a|0)-h|0,h,f)}return a|0}function Fc(a,b,c){var d=0,e=0,f=0;a:{d=n[c+16>>2];if(!d){if(Gc(c)){break a}d=n[c+16>>2]}f=n[c+20>>2];if(d-f>>>0<b>>>0){k[n[c+36>>2]](c,a,b)|0;return}b:{if(l[c+75|0]<0){break b}d=b;while(1){e=d;if(!e){break b}d=e+ -1|0;if(o[d+a|0]!=10){continue}break}if(k[n[c+36>>2]](c,a,e)>>>0<e>>>0){break a}b=b-e|0;a=a+e|0;f=n[c+20>>2]}Y(f,a,b);n[c+20>>2]=n[c+20>>2]+b}}function Mc(a,b){var c=0,d=0;c=Ca(Cb(_(a,3),b),b+96|0);a=b+164|0;c=_(c,(n[b+160>>2]-a|0)/72|0);d=n[b+160>>2];if((d|0)!=(a|0)){while(1){c=_(c,n[a>>2]);l[c|0]=o[a+4|0];c=Ca(c+1|0,a+5|0);a=a+72|0;if((d|0)!=(a|0)){continue}break}}a=_(c,n[b+7364>>2]);l[a|0]=o[b+7368|0];a=_(Ca(a+1|0,b+7369|0),n[b+7436>>2]);l[a|0]=o[b+7440|0];_(Ca(a+1|0,b+7441|0),n[b+7508>>2])}function wc(a,b,c,d){var e=0,f=0,g=0;l[c+1|0]=8;l[c|0]=3;e=c+2|0;if(a>>>0>=128){f=a;while(1){l[e|0]=a|128;e=e+1|0;g=f>>>0>16383;a=f>>>7|0;f=a;if(g){continue}break}}l[e+1|0]=18;l[e|0]=a;e=e+2|0;a:{if(b>>>0<128){a=b;break a}a=b;f=a;while(1){l[e|0]=a|128;e=e+1|0;g=f>>>0>16383;a=f>>>7|0;f=a;if(g){continue}break}}l[e|0]=a;a=e+1|0;n[d>>2]=a;return(a+b|0)-c|0}function xc(a,b,c){var d=0,e=0;l[c+1|0]=10;l[c|0]=3;c=c+2|0;l[c|0]=32;c=c+1|0;n[a+8>>2]=c;c=c+32|0;l[c|0]=18;c=c+1|0;l[c|0]=32;c=c+1|0;n[a+4>>2]=c;c=c+32|0;l[c|0]=26;c=c+1|0;l[c|0]=32;c=c+1|0;n[a>>2]=c;c=c+32|0;l[c|0]=34;c=c+1|0;if(b>>>0>=128){d=b;while(1){l[c|0]=b|128;c=c+1|0;e=d>>>0>16383;b=d>>>7|0;d=b;if(e){continue}break}}l[c|0]=b;n[a+12>>2]=c+1}function Pc(a,b,c,d){var e=0,f=0;e=I-160|0;I=e;Y(e+8|0,36424,144);a:{b:{if(b+ -1>>>0>=2147483647){if(b){break b}b=1;a=e+159|0}n[e+52>>2]=a;n[e+28>>2]=a;f=-2-a|0;b=b>>>0>f>>>0?f:b;n[e+56>>2]=b;a=a+b|0;n[e+36>>2]=a;n[e+24>>2]=a;a=Uc(e+8|0,c,d);if(!b){break a}b=n[e+28>>2];l[b-((b|0)==n[e+24>>2])|0]=0;break a}n[9448]=61;a=-1}I=e+160|0;return a}function Ed(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0;d=I-32|0;I=d;e=-1;c=ya(b,c,b);a:{if((c|0)==-1){n[a+300>>2]=7;break a}f=b;b=n[9388];lb(f,c,k[n[n[b>>2]>>2]](b)|0,d+8|0);if(o[d+8|0]!=3){n[a+300>>2]=3;break a}if(!n[d+20>>2]){n[a+300>>2]=4;break a}a=n[9388];e=k[n[n[a>>2]+12>>2]](a,n[d+24>>2])|0}I=d+32|0;return e|0}function de(a,b){var c=0,d=0;c=a+164|0;d=n[a+160>>2];a:{if((c|0)!=(d|0)){while(1){if(xa(c+5|0,b,32)){break a}c=c+72|0;if((d|0)!=(
function cf(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0;g=I-32|0;I=g;a:{if((da(d)|0)!=32){n[a+3216>>2]=7;d=-1;break a}ea(c,d,g);d=-1;c=da(f);if((c|0)==-1){n[a+3216>>2]=7;break a}ea(e,f,e);d=jb(a,b,g,e,c)}I=g+32|0;return d|0}function Se(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0;h=I-32|0;I=h;a:{if((da(c)|0)!=32){n[a>>2]=7;c=-1;break a}ea(b,c,h);c=-1;b=da(g);if((b|0)==-1){n[a>>2]=7;break a}ea(f,g,f);c=ee(a,h,d,e,f,b)}I=h+32|0;return c|0}function ob(a,b,c){var d=0,e=0,f=0;e=1;if(a>>>0>=128){while(1){e=e+1|0;d=a>>>0>16383;a=a>>>7|0;if(d){continue}break}}d=1;if(b>>>0>=128){a=b;while(1){d=d+1|0;f=a>>>0>16383;a=a>>>7|0;if(f){continue}break}}return(((b+c|0)+e|0)+d|0)+37|0}function mb(a,b,c){var d=0,e=0,f=0;d=1;e=1;if(a>>>0>=128){while(1){e=e+1|0;f=a>>>0>16383;a=a>>>7|0;if(f){continue}break}}if(b>>>0>=128){a=b;while(1){d=d+1|0;f=a>>>0>16383;a=a>>>7|0;if(f){continue}break}}return(((b+c|0)+e|0)+d|0)+67|0}function _e(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0;f=I-32|0;I=f;a:{if((da(c)|0)!=32){n[a+3216>>2]=7;c=-1;break a}ea(b,c,f);c=-1;b=da(e);if((b|0)==-1){n[a+3216>>2]=7;break a}ea(d,e,d);c=ib(a,f,d,b)}I=f+32|0;return c|0}function Ja(a,b,c,d,e){var f=0,g=0;f=-1;g=da(d);a:{if((g|0)==-1){if(!e){break a}n[e>>2]=7;return-1}ya(c,d,c);d=a;a=g-(k[n[372]](33480)|0)|0;f=k[n[376]](33480,d,b,c,g,c,a,c,a)|0;if(!e|(f|0)!=-1){break a}n[e>>2]=8;f=-1}return f}function ef(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;e=c>>>16|0;f=a>>>16|0;j=t(e,f);g=c&65535;h=a&65535;i=t(g,h);f=(i>>>16|0)+t(f,g)|0;e=(f&65535)+t(e,h)|0;a=(t(b,c)+j|0)+t(a,d)+(f>>>16)+(e>>>16)|0;b=i&65535|e<<16;J=a;return b}function Ka(a,b,c,d){var e=0,f=0,g=0,h=0;g=a;h=b;f=k[n[373]](33480,d)|0;a=f+(k[n[372]](33480)|0)|0;b=a+2|0;e=(b>>>0)/3|0;e=(e<<2|b-t(e,3))+ -2|0;b=(e+c|0)-a|0;k[n[374]](33480,g,h,b,d,b,f,b,a)|0;pa(b,a,c);return e}function Wb(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0;f=b;b=a+7512|0;c=Ja(f,c,d,e,b);a:{b:{if((c|0)==-1){break b}c=c+d|0;if((Ec(d,c+1|0,a)|0)==(c|0)){break a}if(n[b>>2]){break b}n[b>>2]=10}e=-1}return e|0}function Vb(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0;f=b;b=a+3216|0;c=Ja(f,c,d,e,b);a:{b:{if((c|0)==-1){break b}c=c+d|0;if((oc(d,c+1|0,a)|0)==(c|0)){break a}if(n[b>>2]){break b}n[b>>2]=10}e=-1}return e|0}function ge(a,b,c){var d=0,e=0;d=I-32|0;I=d;e=b;b=n[a+4>>2];Ua(d,e,c,k[n[n[b>>2]>>2]](b)|0);a:{if(!n[d+24>>2]){n[a+8>>2]=4;a=-1;break a}a=n[a+4>>2];a=k[n[n[a>>2]+12>>2]](a,n[d+28>>2])|0}I=d+32|0;return a}function ja(a,b,c,d,e){var f=0;f=I-256|0;I=f;if(!(e&73728|(c|0)<=(d|0))){c=c-d|0;d=c>>>0<256;fa(f,b&255,d?c:256);if(!d){while(1){$(a,f,256);c=c+ -256|0;if(c>>>0>255){continue}break}}$(a,f,c)}I=f+256|0}function Kd(a){var b=0,c=0,d=0;b=a+164|0;c=n[a+160>>2];a:{if((b|0)!=(c|0)){a=1;while(1){if(!o[b+4|0]){d=d+55|0;a=0}b=b+72|0;if((c|0)!=(b|0)){continue}break}b=16;if(!a){break a}}b=17}return b+d|0}function Gc(a){var b=0;b=o[a+74|0];l[a+74|0]=b+ -1|b;b=n[a>>2];if(b&8){n[a>>2]=b|32;return-1}n[a+4>>2]=0;n[a+8>>2]=0;b=n[a+44>>2];n[a+28>>2]=b;n[a+20>>2]=b;n[a+16>>2]=b+n[a+48>>2];return 0}function ba(a,b,c){var d=0;n[c>>2]=0;d=a+4|0;if(d>>>0<=b>>>0){n[c>>2]=0;b=o[a|0]<<8;n[c>>2]=b;b=(b|o[a+1|0])<<8;n[c>>2]=b;b=(b|o[a+2|0])<<8;n[c>>2]=b;n[c>>2]=b|o[a+3|0];b=d}return b}function bd(a,b){a=a|0;b=b|0;var c=0;c=n[9388];b=k[n[n[c>>2]+4>>2]](c,b)|0;c=n[9388];c=k[n[n[c>>2]>>2]](c)|0;a=mb(n[a+128>>2],b,c)+2|0;b=(a>>>0)/3|0;return(b<<2|a-t(b,3))+ -2|0}function va(a){var b=0,c=0;b=n[9592];c=a+3&-4;a=b+c|0;a:{if(a>>>0<=b>>>0?(c|0)>=1:0){break a}if(a>>>0>K()<<16>>>0){if(!G(a|0)){break a}}n[9592]=a;return b}n[9448]=48;return-1}function rb(a){var b=0,c=0,d=0;if(l[n[a>>2]]+ -48>>>0<10){while(1){b=n[a>>2];d=l[b|0];n[a>>2]=b+1;c=(t(c,10)+d|0)+ -48|0;if(l[b+1|0]+ -48>>>0<10){continue}break}}return c}function Yc(a,b,c){if(c>>>0<=31){n[a+7512>>2]=1;return-1}Y(a+7436|0,a+7364|0,72);l[a+7368|0]=1;c=n[a+7508>>2]+1|0;n[a+7364>>2]=c;n[a+7508>>2]=c;ra(b,a+7369|0);return 1}function gd(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0;f=a+132|0;if(qa(232)>>>0>e>>>0){n[a+228>>2]=2;return-1}Cb(Ya(a,_(La(d,232),1)),f);return Ka(b,c,d,232)|0}function ab(
// EMSCRIPTEN_END_FUNCS
k[1]=Re;k[2]=Qe;k[3]=Pe;k[4]=Oe;k[5]=Ne;k[6]=Rc;k[7]=Qc;k[8]=Oc;function K(){return buffer.byteLength/65536|0}return{"__wasm_call_ctors":df,"olm_get_library_version":lc,"olm_error":kc,"olm_account_last_error":jc,"olm_session_last_error":ic,"olm_utility_last_error":Ha,"olm_account_size":hc,"olm_session_size":gc,"olm_utility_size":fc,"olm_account":ec,"olm_session":dc,"olm_utility":cc,"olm_clear_account":bc,"olm_clear_session":ac,"olm_clear_utility":$b,"olm_pickle_account_length":_b,"olm_pickle_session_length":Zb,"olm_pickle_account":Yb,"olm_pickle_session":Xb,"olm_unpickle_account":Wb,"olm_unpickle_session":Vb,"olm_create_account_random_length":db,"olm_create_account":Ub,"olm_account_identity_keys_length":Tb,"olm_account_identity_keys":Sb,"olm_account_signature_length":Rb,"olm_account_sign":Qb,"olm_account_one_time_keys_length":Pb,"olm_account_one_time_keys":Ob,"olm_account_mark_keys_as_published":Nb,"olm_account_max_number_of_one_time_keys":Mb,"olm_account_generate_one_time_keys_random_length":Lb,"olm_account_generate_one_time_keys":Kb,"olm_account_generate_fallback_key_random_length":cb,"olm_account_generate_fallback_key":Jb,"olm_account_fallback_key_length":Ib,"olm_account_fallback_key":Hb,"olm_create_outbound_session_random_length":db,"olm_create_outbound_session":Gb,"olm_create_inbound_session":Fb,"olm_create_inbound_session_from":cf,"olm_session_id_length":Ea,"olm_session_id":bf,"olm_session_has_received_message":hb,"olm_session_describe":af,"olm_matches_inbound_session":$e,"olm_matches_inbound_session_from":_e,"olm_remove_one_time_keys":Ze,"olm_encrypt_message_type":hb,"olm_encrypt_random_length":Ye,"olm_encrypt_message_length":Xe,"olm_encrypt":We,"olm_decrypt_max_plaintext_length":Ve,"olm_decrypt":Ue,"olm_sha256_length":Ea,"olm_sha256":Te,"olm_ed25519_verify":Se,"olm_pk_encryption_last_error":Ha,"olm_pk_encryption_size":Me,"olm_pk_encryption":Le,"olm_clear_pk_encryption":Ke,"olm_pk_encryption_set_recipient_key":Je,"olm_pk_key_length":Eb,"olm_pk_ciphertext_length":Ie,"olm_pk_mac_length":He,"olm_pk_encrypt_random_length":cb,"olm_pk_encrypt":Ge,"olm_pk_decryption_last_error":Ha,"olm_pk_decryption_size":Fe,"olm_pk_decryption":Ee,"olm_clear_pk_decryption":De,"olm_pk_private_key_length":bb,"olm_pk_generate_key_random_length":bb,"olm_pk_key_from_private":Db,"olm_pk_generate_key":Db,"olm_pickle_pk_decryption_length":Ce,"olm_pickle_pk_decryption":Be,"olm_unpickle_pk_decryption":Ae,"olm_pk_max_plaintext_length":ze,"olm_pk_decrypt":ye,"olm_pk_get_private_key":xe,"olm_pk_signing_size":we,"olm_pk_signing":ve,"olm_pk_signing_last_error":Ha,"olm_clear_pk_signing":ue,"olm_pk_signing_seed_length":bb,"olm_pk_signing_public_key_length":Eb,"olm_pk_signing_key_from_seed":te,"olm_pk_signature_length":se,"olm_pk_sign":re,"olm_inbound_group_session_size":Od,"olm_inbound_group_session":Nd,"olm_clear_inbound_group_session":Md,"olm_inbound_group_session_last_error":Ld,"olm_init_inbound_group_session":Jd,"olm_import_inbound_group_session":Id,"olm_pickle_inbound_group_session_length":Hd,"olm_pickle_inbound_group_session":Gd,"olm_unpickle_inbound_group_session":Fd,"olm_group_decrypt_max_plaintext_length":Ed,"olm_group_decrypt":Dd,"olm_inbound_group_session_id_length":Ea,"olm_inbound_group_session_id":Cd,"olm_inbound_group_session_first_known_index":xb,"olm_inbound_group_session_is_verified":Bd,"olm_export_inbound_group_session_length":zd,"olm_export_inbound_group_session":yd,"olm_sas_last_error":Ha,"olm_sas_size":xd,"olm_sas":wd,"olm_clear_sas":vd,"olm_create_sas_random_length":cb,"olm_create_sas":ud,"olm_sas_pubkey_length":Ea,"olm_sas_get_pubkey":td,"olm_sas_set_their_key":sd,"olm_sas_is_their_key_set":rd,"olm_sas_generate_bytes":qd,"olm_sas_mac_length":Ea,"olm_sas_calculate_mac_fixed_base64":od,"olm_sas_calculate_mac":nd,"olm_sas_calculate_mac_long_kdf":md,"olm_outbound_group_session_size":ld,"olm_outbound_group_session":kd,"olm_clear_outbound_group_session":jd,"olm_outbound_group_session_last_error":id,"olm_pickle_outbound_group_session_length":hd,"olm_pickle_outbound_group_session":gd,"olm_unpickle_outbound_group_session":fd,"olm_init_outb
// EMSCRIPTEN_END_ASM
)(ua,u,va)}function wa(){return{then:function(b){b({instance:new ta})}}}var xa=Error,WebAssembly={};t=[];"object"!==typeof WebAssembly&&r("no native wasm support detected");
function w(b){var c="i8";"*"===c.charAt(c.length-1)&&(c="i32");switch(c){case "i1":x[b>>0]=0;break;case "i8":x[b>>0]=0;break;case "i16":ya[b>>1]=0;break;case "i32":y[b>>2]=0;break;case "i64":za=[0,(Aa=0,1<=+Ba(Aa)?0<Aa?(Ca(+Da(Aa/4294967296),4294967295)|0)>>>0:~~+Ea((Aa-+(~~Aa>>>0))/4294967296)>>>0:0)];y[b>>2]=za[0];y[b+4>>2]=za[1];break;case "float":Fa[b>>2]=0;break;case "double":Ga[b>>3]=0;break;default:r("invalid type for setValue: "+c)}}
function Ia(b,c){c=c||"i8";"*"===c.charAt(c.length-1)&&(c="i32");switch(c){case "i1":return x[b>>0];case "i8":return x[b>>0];case "i16":return ya[b>>1];case "i32":return y[b>>2];case "i64":return y[b>>2];case "float":return Fa[b>>2];case "double":return Ga[b>>3];default:r("invalid type for getValue: "+c)}return null}
var u,va=new function(b){var c=Array(b.initial);c.grow=function(){9<=c.length&&r("Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH.");c.push(null)};c.set=function(d,e){c[d]=e};c.get=function(d){return c[d]};return c}({initial:9,maximum:9,element:"anyfunc"}),Ja=!1;function assert(b,c){b||r("Assertion failed: "+c)}var Ka="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
function z(b,c){if(b){var d=A,e=b+c;for(c=b;d[c]&&!(c>=e);)++c;if(16<c-b&&d.subarray&&Ka)b=Ka.decode(d.subarray(b,c));else{for(e="";b<c;){var f=d[b++];if(f&128){var k=d[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|k);else{var n=d[b++]&63;f=224==(f&240)?(f&15)<<12|k<<6|n:(f&7)<<18|k<<12|n<<6|d[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}b=e}}else b="";return b}
function La(b,c,d,e){if(!(0<e))return 0;var f=d;e=d+e-1;for(var k=0;k<b.length;++k){var n=b.charCodeAt(k);if(55296<=n&&57343>=n){var v=b.charCodeAt(++k);n=65536+((n&1023)<<10)|v&1023}if(127>=n){if(d>=e)break;c[d++]=n}else{if(2047>=n){if(d+1>=e)break;c[d++]=192|n>>6}else{if(65535>=n){if(d+2>=e)break;c[d++]=224|n>>12}else{if(d+3>=e)break;c[d++]=240|n>>18;c[d++]=128|n>>12&63}c[d++]=128|n>>6&63}c[d++]=128|n&63}}c[d]=0;return d-f}
function Ma(b){for(var c=0,d=0;d<b.length;++d){var e=b.charCodeAt(d);55296<=e&&57343>=e&&(e=65536+((e&1023)<<10)|b.charCodeAt(++d)&1023);127>=e?++c:c=2047>=e?c+2:65535>=e?c+3:c+4}return c}function Na(b,c){for(var d=0;d<b.length;++d)x[c++>>0]=b.charCodeAt(d)}var Oa,x,A,ya,y,Fa,Ga,ra=a.INITIAL_MEMORY||16777216;a.wasmMemory?u=a.wasmMemory:u=new qa;u&&(Oa=u.buffer);ra=Oa.byteLength;var B=Oa;Oa=B;a.HEAP8=x=new Int8Array(B);a.HEAP16=ya=new Int16Array(B);a.HEAP32=y=new Int32Array(B);a.HEAPU8=A=new Uint8Array(B);
a.HEAPU16=new Uint16Array(B);a.HEAPU32=new Uint32Array(B);a.HEAPF32=Fa=new Float32Array(B);a.HEAPF64=Ga=new Float64Array(B);y[9592]=5281408;function Pa(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var d=c.f;"number"===typeof d?void 0===c.c?a.dynCall_v(d):a.dynCall_vi(d,c.c):d(void 0===c.c?null:c.c)}}}var Qa=[],Ra=[],Sa=[],Ta=[];function Ua(){var b=a.preRun.shift();Qa.unshift(b)}var Ba=Math.abs,Ea=Math.ceil,Da=Math.floor,Ca=Math.min,C=0,Va=null,Wa=null;a.preloadedImages={};
a.preloadedAudios={};function r(b){if(a.onAbort)a.onAbort(b);oa(b);pa(b);Ja=!0;throw new xa("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");}function Xa(b,c){return String.prototype.startsWith?b.startsWith(c):0===b.indexOf(c)}var Ya="data:application/octet-stream;base64,",D="olm_legacy.wasm";if(!Xa(D,Ya)){var Za=D;D=a.locateFile?a.locateFile(Za,p):p+Za}
function $a(){try{if(t)return new Uint8Array(t);var b=q(D);if(b)return b;if(ja)return ja(D);throw"both async and sync fetching of the wasm failed";}catch(c){r(c)}}function ab(){return t||!ea&&!m||"function"!==typeof fetch||Xa(D,"file://")?new Promise(function(b){b($a())}):fetch(D,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+D+"'";return b.arrayBuffer()}).catch(function(){return $a()})}var Aa,za;Ra.push({f:function(){bb()}});var cb=!1;
function na(b){for(var c=[],d=0;d<b.length;d++){var e=b[d];255<e&&(cb&&assert(!1,"Character code "+e+" ("+String.fromCharCode(e)+") at offset "+d+" not in 0x00-0xFF."),e&=255);c.push(String.fromCharCode(e))}return c.join("")}
var db="function"===typeof atob?atob:function(b){var c="",d=0;b=b.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(d++));var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(d++));var k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(d++));var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(d++));e=e<<2|f>>4;
f=(f&15)<<4|k>>2;var v=(k&3)<<6|n;c+=String.fromCharCode(e);64!==k&&(c+=String.fromCharCode(f));64!==n&&(c+=String.fromCharCode(v))}while(d<b.length);return c};
function q(b){if(Xa(b,Ya)){b=b.slice(Ya.length);if("boolean"===typeof fa&&fa){try{var c=Buffer.from(b,"base64")}catch(k){c=new Buffer(b,"base64")}var d=new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}else try{var e=db(b),f=new Uint8Array(e.length);for(c=0;c<e.length;++c)f[c]=e.charCodeAt(c);d=f}catch(k){throw Error("Converting base64 string to bytes failed.");}return d}}
var ua={__assert_fail:function(b,c,d,e){r("Assertion failed: "+z(b)+", at: "+[c?z(c):"unknown filename",d,e?z(e):"unknown function"])},emscripten_memcpy_big:function(b,c,d){A.copyWithin(b,c,c+d)},emscripten_resize_heap:function(){r("OOM")},memory:u,table:va};
(function(){function b(f){a.asm=f.exports;C--;a.monitorRunDependencies&&a.monitorRunDependencies(C);0==C&&(null!==Va&&(clearInterval(Va),Va=null),Wa&&(f=Wa,Wa=null,f()))}function c(f){b(f.instance)}function d(f){return ab().then(function(){return wa()}).then(f,function(k){pa("failed to asynchronously prepare wasm: "+k);r(k)})}var e={env:ua,wasi_snapshot_preview1:ua};C++;a.monitorRunDependencies&&a.monitorRunDependencies(C);if(a.instantiateWasm)try{return a.instantiateWasm(e,b)}catch(f){return pa("Module.instantiateWasm callback failed with error: "+
f),!1}(function(){if(t||"function"!==typeof WebAssembly.instantiateStreaming||Xa(D,Ya)||Xa(D,"file://")||"function"!==typeof fetch)return d(c);fetch(D,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(c,function(k){pa("wasm streaming compile failed: "+k);pa("falling back to ArrayBuffer instantiation");return d(c)})})})();return{}})();var bb=a.___wasm_call_ctors=function(){return(bb=a.___wasm_call_ctors=a.asm.__wasm_call_ctors).apply(null,arguments)};
a._olm_get_library_version=function(){return(a._olm_get_library_version=a.asm.olm_get_library_version).apply(null,arguments)};a._olm_error=function(){return(a._olm_error=a.asm.olm_error).apply(null,arguments)};a._olm_account_last_error=function(){return(a._olm_account_last_error=a.asm.olm_account_last_error).apply(null,arguments)};a._olm_session_last_error=function(){return(a._olm_session_last_error=a.asm.olm_session_last_error).apply(null,arguments)};
a._olm_utility_last_error=function(){return(a._olm_utility_last_error=a.asm.olm_utility_last_error).apply(null,arguments)};a._olm_account_size=function(){return(a._olm_account_size=a.asm.olm_account_size).apply(null,arguments)};a._olm_session_size=function(){return(a._olm_session_size=a.asm.olm_session_size).apply(null,arguments)};a._olm_utility_size=function(){return(a._olm_utility_size=a.asm.olm_utility_size).apply(null,arguments)};
a._olm_account=function(){return(a._olm_account=a.asm.olm_account).apply(null,arguments)};a._olm_session=function(){return(a._olm_session=a.asm.olm_session).apply(null,arguments)};a._olm_utility=function(){return(a._olm_utility=a.asm.olm_utility).apply(null,arguments)};a._olm_clear_account=function(){return(a._olm_clear_account=a.asm.olm_clear_account).apply(null,arguments)};a._olm_clear_session=function(){return(a._olm_clear_session=a.asm.olm_clear_session).apply(null,arguments)};
a._olm_clear_utility=function(){return(a._olm_clear_utility=a.asm.olm_clear_utility).apply(null,arguments)};a._olm_pickle_account_length=function(){return(a._olm_pickle_account_length=a.asm.olm_pickle_account_length).apply(null,arguments)};a._olm_pickle_session_length=function(){return(a._olm_pickle_session_length=a.asm.olm_pickle_session_length).apply(null,arguments)};a._olm_pickle_account=function(){return(a._olm_pickle_account=a.asm.olm_pickle_account).apply(null,arguments)};
a._olm_pickle_session=function(){return(a._olm_pickle_session=a.asm.olm_pickle_session).apply(null,arguments)};a._olm_unpickle_account=function(){return(a._olm_unpickle_account=a.asm.olm_unpickle_account).apply(null,arguments)};a._olm_unpickle_session=function(){return(a._olm_unpickle_session=a.asm.olm_unpickle_session).apply(null,arguments)};a._olm_create_account_random_length=function(){return(a._olm_create_account_random_length=a.asm.olm_create_account_random_length).apply(null,arguments)};
a._olm_create_account=function(){return(a._olm_create_account=a.asm.olm_create_account).apply(null,arguments)};a._olm_account_identity_keys_length=function(){return(a._olm_account_identity_keys_length=a.asm.olm_account_identity_keys_length).apply(null,arguments)};a._olm_account_identity_keys=function(){return(a._olm_account_identity_keys=a.asm.olm_account_identity_keys).apply(null,arguments)};
a._olm_account_signature_length=function(){return(a._olm_account_signature_length=a.asm.olm_account_signature_length).apply(null,arguments)};a._olm_account_sign=function(){return(a._olm_account_sign=a.asm.olm_account_sign).apply(null,arguments)};a._olm_account_one_time_keys_length=function(){return(a._olm_account_one_time_keys_length=a.asm.olm_account_one_time_keys_length).apply(null,arguments)};
a._olm_account_one_time_keys=function(){return(a._olm_account_one_time_keys=a.asm.olm_account_one_time_keys).apply(null,arguments)};a._olm_account_mark_keys_as_published=function(){return(a._olm_account_mark_keys_as_published=a.asm.olm_account_mark_keys_as_published).apply(null,arguments)};a._olm_account_max_number_of_one_time_keys=function(){return(a._olm_account_max_number_of_one_time_keys=a.asm.olm_account_max_number_of_one_time_keys).apply(null,arguments)};
a._olm_account_generate_one_time_keys_random_length=function(){return(a._olm_account_generate_one_time_keys_random_length=a.asm.olm_account_generate_one_time_keys_random_length).apply(null,arguments)};a._olm_account_generate_one_time_keys=function(){return(a._olm_account_generate_one_time_keys=a.asm.olm_account_generate_one_time_keys).apply(null,arguments)};
a._olm_account_generate_fallback_key_random_length=function(){return(a._olm_account_generate_fallback_key_random_length=a.asm.olm_account_generate_fallback_key_random_length).apply(null,arguments)};a._olm_account_generate_fallback_key=function(){return(a._olm_account_generate_fallback_key=a.asm.olm_account_generate_fallback_key).apply(null,arguments)};a._olm_account_fallback_key_length=function(){return(a._olm_account_fallback_key_length=a.asm.olm_account_fallback_key_length).apply(null,arguments)};
a._olm_account_fallback_key=function(){return(a._olm_account_fallback_key=a.asm.olm_account_fallback_key).apply(null,arguments)};a._olm_create_outbound_session_random_length=function(){return(a._olm_create_outbound_session_random_length=a.asm.olm_create_outbound_session_random_length).apply(null,arguments)};a._olm_create_outbound_session=function(){return(a._olm_create_outbound_session=a.asm.olm_create_outbound_session).apply(null,arguments)};
a._olm_create_inbound_session=function(){return(a._olm_create_inbound_session=a.asm.olm_create_inbound_session).apply(null,arguments)};a._olm_create_inbound_session_from=function(){return(a._olm_create_inbound_session_from=a.asm.olm_create_inbound_session_from).apply(null,arguments)};a._olm_session_id_length=function(){return(a._olm_session_id_length=a.asm.olm_session_id_length).apply(null,arguments)};a._olm_session_id=function(){return(a._olm_session_id=a.asm.olm_session_id).apply(null,arguments)};
a._olm_session_has_received_message=function(){return(a._olm_session_has_received_message=a.asm.olm_session_has_received_message).apply(null,arguments)};a._olm_session_describe=function(){return(a._olm_session_describe=a.asm.olm_session_describe).apply(null,arguments)};a._olm_matches_inbound_session=function(){return(a._olm_matches_inbound_session=a.asm.olm_matches_inbound_session).apply(null,arguments)};
a._olm_matches_inbound_session_from=function(){return(a._olm_matches_inbound_session_from=a.asm.olm_matches_inbound_session_from).apply(null,arguments)};a._olm_remove_one_time_keys=function(){return(a._olm_remove_one_time_keys=a.asm.olm_remove_one_time_keys).apply(null,arguments)};a._olm_encrypt_message_type=function(){return(a._olm_encrypt_message_type=a.asm.olm_encrypt_message_type).apply(null,arguments)};
a._olm_encrypt_random_length=function(){return(a._olm_encrypt_random_length=a.asm.olm_encrypt_random_length).apply(null,arguments)};a._olm_encrypt_message_length=function(){return(a._olm_encrypt_message_length=a.asm.olm_encrypt_message_length).apply(null,arguments)};a._olm_encrypt=function(){return(a._olm_encrypt=a.asm.olm_encrypt).apply(null,arguments)};a._olm_decrypt_max_plaintext_length=function(){return(a._olm_decrypt_max_plaintext_length=a.asm.olm_decrypt_max_plaintext_length).apply(null,arguments)};
a._olm_decrypt=function(){return(a._olm_decrypt=a.asm.olm_decrypt).apply(null,arguments)};a._olm_sha256_length=function(){return(a._olm_sha256_length=a.asm.olm_sha256_length).apply(null,arguments)};a._olm_sha256=function(){return(a._olm_sha256=a.asm.olm_sha256).apply(null,arguments)};a._olm_ed25519_verify=function(){return(a._olm_ed25519_verify=a.asm.olm_ed25519_verify).apply(null,arguments)};
a._olm_pk_encryption_last_error=function(){return(a._olm_pk_encryption_last_error=a.asm.olm_pk_encryption_last_error).apply(null,arguments)};a._olm_pk_encryption_size=function(){return(a._olm_pk_encryption_size=a.asm.olm_pk_encryption_size).apply(null,arguments)};a._olm_pk_encryption=function(){return(a._olm_pk_encryption=a.asm.olm_pk_encryption).apply(null,arguments)};a._olm_clear_pk_encryption=function(){return(a._olm_clear_pk_encryption=a.asm.olm_clear_pk_encryption).apply(null,arguments)};
a._olm_pk_encryption_set_recipient_key=function(){return(a._olm_pk_encryption_set_recipient_key=a.asm.olm_pk_encryption_set_recipient_key).apply(null,arguments)};a._olm_pk_key_length=function(){return(a._olm_pk_key_length=a.asm.olm_pk_key_length).apply(null,arguments)};a._olm_pk_ciphertext_length=function(){return(a._olm_pk_ciphertext_length=a.asm.olm_pk_ciphertext_length).apply(null,arguments)};a._olm_pk_mac_length=function(){return(a._olm_pk_mac_length=a.asm.olm_pk_mac_length).apply(null,arguments)};
a._olm_pk_encrypt_random_length=function(){return(a._olm_pk_encrypt_random_length=a.asm.olm_pk_encrypt_random_length).apply(null,arguments)};a._olm_pk_encrypt=function(){return(a._olm_pk_encrypt=a.asm.olm_pk_encrypt).apply(null,arguments)};a._olm_pk_decryption_last_error=function(){return(a._olm_pk_decryption_last_error=a.asm.olm_pk_decryption_last_error).apply(null,arguments)};a._olm_pk_decryption_size=function(){return(a._olm_pk_decryption_size=a.asm.olm_pk_decryption_size).apply(null,arguments)};
a._olm_pk_decryption=function(){return(a._olm_pk_decryption=a.asm.olm_pk_decryption).apply(null,arguments)};a._olm_clear_pk_decryption=function(){return(a._olm_clear_pk_decryption=a.asm.olm_clear_pk_decryption).apply(null,arguments)};a._olm_pk_private_key_length=function(){return(a._olm_pk_private_key_length=a.asm.olm_pk_private_key_length).apply(null,arguments)};
a._olm_pk_generate_key_random_length=function(){return(a._olm_pk_generate_key_random_length=a.asm.olm_pk_generate_key_random_length).apply(null,arguments)};a._olm_pk_key_from_private=function(){return(a._olm_pk_key_from_private=a.asm.olm_pk_key_from_private).apply(null,arguments)};a._olm_pk_generate_key=function(){return(a._olm_pk_generate_key=a.asm.olm_pk_generate_key).apply(null,arguments)};
a._olm_pickle_pk_decryption_length=function(){return(a._olm_pickle_pk_decryption_length=a.asm.olm_pickle_pk_decryption_length).apply(null,arguments)};a._olm_pickle_pk_decryption=function(){return(a._olm_pickle_pk_decryption=a.asm.olm_pickle_pk_decryption).apply(null,arguments)};a._olm_unpickle_pk_decryption=function(){return(a._olm_unpickle_pk_decryption=a.asm.olm_unpickle_pk_decryption).apply(null,arguments)};
a._olm_pk_max_plaintext_length=function(){return(a._olm_pk_max_plaintext_length=a.asm.olm_pk_max_plaintext_length).apply(null,arguments)};a._olm_pk_decrypt=function(){return(a._olm_pk_decrypt=a.asm.olm_pk_decrypt).apply(null,arguments)};a._olm_pk_get_private_key=function(){return(a._olm_pk_get_private_key=a.asm.olm_pk_get_private_key).apply(null,arguments)};a._olm_pk_signing_size=function(){return(a._olm_pk_signing_size=a.asm.olm_pk_signing_size).apply(null,arguments)};
a._olm_pk_signing=function(){return(a._olm_pk_signing=a.asm.olm_pk_signing).apply(null,arguments)};a._olm_pk_signing_last_error=function(){return(a._olm_pk_signing_last_error=a.asm.olm_pk_signing_last_error).apply(null,arguments)};a._olm_clear_pk_signing=function(){return(a._olm_clear_pk_signing=a.asm.olm_clear_pk_signing).apply(null,arguments)};a._olm_pk_signing_seed_length=function(){return(a._olm_pk_signing_seed_length=a.asm.olm_pk_signing_seed_length).apply(null,arguments)};
a._olm_pk_signing_public_key_length=function(){return(a._olm_pk_signing_public_key_length=a.asm.olm_pk_signing_public_key_length).apply(null,arguments)};a._olm_pk_signing_key_from_seed=function(){return(a._olm_pk_signing_key_from_seed=a.asm.olm_pk_signing_key_from_seed).apply(null,arguments)};a._olm_pk_signature_length=function(){return(a._olm_pk_signature_length=a.asm.olm_pk_signature_length).apply(null,arguments)};a._olm_pk_sign=function(){return(a._olm_pk_sign=a.asm.olm_pk_sign).apply(null,arguments)};
a._olm_inbound_group_session_size=function(){return(a._olm_inbound_group_session_size=a.asm.olm_inbound_group_session_size).apply(null,arguments)};a._olm_inbound_group_session=function(){return(a._olm_inbound_group_session=a.asm.olm_inbound_group_session).apply(null,arguments)};a._olm_clear_inbound_group_session=function(){return(a._olm_clear_inbound_group_session=a.asm.olm_clear_inbound_group_session).apply(null,arguments)};
a._olm_inbound_group_session_last_error=function(){return(a._olm_inbound_group_session_last_error=a.asm.olm_inbound_group_session_last_error).apply(null,arguments)};a._olm_init_inbound_group_session=function(){return(a._olm_init_inbound_group_session=a.asm.olm_init_inbound_group_session).apply(null,arguments)};a._olm_import_inbound_group_session=function(){return(a._olm_import_inbound_group_session=a.asm.olm_import_inbound_group_session).apply(null,arguments)};
a._olm_pickle_inbound_group_session_length=function(){return(a._olm_pickle_inbound_group_session_length=a.asm.olm_pickle_inbound_group_session_length).apply(null,arguments)};a._olm_pickle_inbound_group_session=function(){return(a._olm_pickle_inbound_group_session=a.asm.olm_pickle_inbound_group_session).apply(null,arguments)};a._olm_unpickle_inbound_group_session=function(){return(a._olm_unpickle_inbound_group_session=a.asm.olm_unpickle_inbound_group_session).apply(null,arguments)};
a._olm_group_decrypt_max_plaintext_length=function(){return(a._olm_group_decrypt_max_plaintext_length=a.asm.olm_group_decrypt_max_plaintext_length).apply(null,arguments)};a._olm_group_decrypt=function(){return(a._olm_group_decrypt=a.asm.olm_group_decrypt).apply(null,arguments)};a._olm_inbound_group_session_id_length=function(){return(a._olm_inbound_group_session_id_length=a.asm.olm_inbound_group_session_id_length).apply(null,arguments)};
a._olm_inbound_group_session_id=function(){return(a._olm_inbound_group_session_id=a.asm.olm_inbound_group_session_id).apply(null,arguments)};a._olm_inbound_group_session_first_known_index=function(){return(a._olm_inbound_group_session_first_known_index=a.asm.olm_inbound_group_session_first_known_index).apply(null,arguments)};a._olm_inbound_group_session_is_verified=function(){return(a._olm_inbound_group_session_is_verified=a.asm.olm_inbound_group_session_is_verified).apply(null,arguments)};
a._olm_export_inbound_group_session_length=function(){return(a._olm_export_inbound_group_session_length=a.asm.olm_export_inbound_group_session_length).apply(null,arguments)};a._olm_export_inbound_group_session=function(){return(a._olm_export_inbound_group_session=a.asm.olm_export_inbound_group_session).apply(null,arguments)};a._olm_sas_last_error=function(){return(a._olm_sas_last_error=a.asm.olm_sas_last_error).apply(null,arguments)};
a._olm_sas_size=function(){return(a._olm_sas_size=a.asm.olm_sas_size).apply(null,arguments)};a._olm_sas=function(){return(a._olm_sas=a.asm.olm_sas).apply(null,arguments)};a._olm_clear_sas=function(){return(a._olm_clear_sas=a.asm.olm_clear_sas).apply(null,arguments)};a._olm_create_sas_random_length=function(){return(a._olm_create_sas_random_length=a.asm.olm_create_sas_random_length).apply(null,arguments)};a._olm_create_sas=function(){return(a._olm_create_sas=a.asm.olm_create_sas).apply(null,arguments)};
a._olm_sas_pubkey_length=function(){return(a._olm_sas_pubkey_length=a.asm.olm_sas_pubkey_length).apply(null,arguments)};a._olm_sas_get_pubkey=function(){return(a._olm_sas_get_pubkey=a.asm.olm_sas_get_pubkey).apply(null,arguments)};a._olm_sas_set_their_key=function(){return(a._olm_sas_set_their_key=a.asm.olm_sas_set_their_key).apply(null,arguments)};a._olm_sas_is_their_key_set=function(){return(a._olm_sas_is_their_key_set=a.asm.olm_sas_is_their_key_set).apply(null,arguments)};
a._olm_sas_generate_bytes=function(){return(a._olm_sas_generate_bytes=a.asm.olm_sas_generate_bytes).apply(null,arguments)};a._olm_sas_mac_length=function(){return(a._olm_sas_mac_length=a.asm.olm_sas_mac_length).apply(null,arguments)};a._olm_sas_calculate_mac_fixed_base64=function(){return(a._olm_sas_calculate_mac_fixed_base64=a.asm.olm_sas_calculate_mac_fixed_base64).apply(null,arguments)};
a._olm_sas_calculate_mac=function(){return(a._olm_sas_calculate_mac=a.asm.olm_sas_calculate_mac).apply(null,arguments)};a._olm_sas_calculate_mac_long_kdf=function(){return(a._olm_sas_calculate_mac_long_kdf=a.asm.olm_sas_calculate_mac_long_kdf).apply(null,arguments)};a._olm_outbound_group_session_size=function(){return(a._olm_outbound_group_session_size=a.asm.olm_outbound_group_session_size).apply(null,arguments)};
a._olm_outbound_group_session=function(){return(a._olm_outbound_group_session=a.asm.olm_outbound_group_session).apply(null,arguments)};a._olm_clear_outbound_group_session=function(){return(a._olm_clear_outbound_group_session=a.asm.olm_clear_outbound_group_session).apply(null,arguments)};a._olm_outbound_group_session_last_error=function(){return(a._olm_outbound_group_session_last_error=a.asm.olm_outbound_group_session_last_error).apply(null,arguments)};
a._olm_pickle_outbound_group_session_length=function(){return(a._olm_pickle_outbound_group_session_length=a.asm.olm_pickle_outbound_group_session_length).apply(null,arguments)};a._olm_pickle_outbound_group_session=function(){return(a._olm_pickle_outbound_group_session=a.asm.olm_pickle_outbound_group_session).apply(null,arguments)};a._olm_unpickle_outbound_group_session=function(){return(a._olm_unpickle_outbound_group_session=a.asm.olm_unpickle_outbound_group_session).apply(null,arguments)};
a._olm_init_outbound_group_session_random_length=function(){return(a._olm_init_outbound_group_session_random_length=a.asm.olm_init_outbound_group_session_random_length).apply(null,arguments)};a._olm_init_outbound_group_session=function(){return(a._olm_init_outbound_group_session=a.asm.olm_init_outbound_group_session).apply(null,arguments)};a._olm_group_encrypt_message_length=function(){return(a._olm_group_encrypt_message_length=a.asm.olm_group_encrypt_message_length).apply(null,arguments)};
a._olm_group_encrypt=function(){return(a._olm_group_encrypt=a.asm.olm_group_encrypt).apply(null,arguments)};a._olm_outbound_group_session_id_length=function(){return(a._olm_outbound_group_session_id_length=a.asm.olm_outbound_group_session_id_length).apply(null,arguments)};a._olm_outbound_group_session_id=function(){return(a._olm_outbound_group_session_id=a.asm.olm_outbound_group_session_id).apply(null,arguments)};
a._olm_outbound_group_session_message_index=function(){return(a._olm_outbound_group_session_message_index=a.asm.olm_outbound_group_session_message_index).apply(null,arguments)};a._olm_outbound_group_session_key_length=function(){return(a._olm_outbound_group_session_key_length=a.asm.olm_outbound_group_session_key_length).apply(null,arguments)};a._olm_outbound_group_session_key=function(){return(a._olm_outbound_group_session_key=a.asm.olm_outbound_group_session_key).apply(null,arguments)};
a._malloc=function(){return(a._malloc=a.asm.malloc).apply(null,arguments)};a._free=function(){return(a._free=a.asm.free).apply(null,arguments)};
var eb=a.stackSave=function(){return(eb=a.stackSave=a.asm.stackSave).apply(null,arguments)},fb=a.stackRestore=function(){return(fb=a.stackRestore=a.asm.stackRestore).apply(null,arguments)},gb=a.stackAlloc=function(){return(gb=a.stackAlloc=a.asm.stackAlloc).apply(null,arguments)},sa=a.__growWasmMemory=function(){return(sa=a.__growWasmMemory=a.asm.__growWasmMemory).apply(null,arguments)};a.ALLOC_STACK=1;var hb;Wa=function ib(){hb||jb();hb||(Wa=ib)};
function jb(){function b(){if(!hb&&(hb=!0,a.calledRun=!0,!Ja)){Pa(Ra);Pa(Sa);aa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();Ta.unshift(c)}Pa(Ta)}}if(!(0<C)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)Ua();Pa(Qa);0<C||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}
a.run=jb;if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();noExitRuntime=!0;jb();function E(){var b=a._olm_outbound_group_session_size();this.b=F(b);this.a=a._olm_outbound_group_session(this.b)}function G(b){return function(){var c=b.apply(this,arguments);if(c===h)throw c=z(a._olm_outbound_group_session_last_error(arguments[0])),Error("OLM."+c);return c}}E.prototype.free=function(){a._olm_clear_outbound_group_session(this.a);H(this.a)};
E.prototype.pickle=J(function(b){b=K(b);var c=G(a._olm_pickle_outbound_group_session_length)(this.a),d=L(b),e=L(c+1);try{G(a._olm_pickle_outbound_group_session)(this.a,d,b.length,e,c)}finally{for(M(d,b.length),d=0;d<b.length;d++)b[d]=0}return z(e,c)});E.prototype.unpickle=J(function(b,c){b=K(b);var d=L(b);c=K(c);var e=L(c);try{G(a._olm_unpickle_outbound_group_session)(this.a,d,b.length,e,c.length)}finally{for(M(d,b.length),d=0;d<b.length;d++)b[d]=0}});
E.prototype.create=J(function(){var b=G(a._olm_init_outbound_group_session_random_length)(this.a),c=N(b,g);G(a._olm_init_outbound_group_session)(this.a,c,b)});E.prototype.encrypt=function(b){try{var c=Ma(b);var d=G(a._olm_group_encrypt_message_length)(this.a,c);var e=F(c+1);La(b,A,e,c+1);var f=F(d+1);G(a._olm_group_encrypt)(this.a,e,c,f,d);w(f+d);return z(f,d)}finally{void 0!==e&&(M(e,c+1),H(e)),void 0!==f&&H(f)}};
E.prototype.session_id=J(function(){var b=G(a._olm_outbound_group_session_id_length)(this.a),c=L(b+1);G(a._olm_outbound_group_session_id)(this.a,c,b);return z(c,b)});E.prototype.session_key=J(function(){var b=G(a._olm_outbound_group_session_key_length)(this.a),c=L(b+1);G(a._olm_outbound_group_session_key)(this.a,c,b);var d=z(c,b);M(c,b);return d});E.prototype.message_index=function(){return G(a._olm_outbound_group_session_message_index)(this.a)};olm_exports.OutboundGroupSession=E;
function O(){var b=a._olm_inbound_group_session_size();this.b=F(b);this.a=a._olm_inbound_group_session(this.b)}function P(b){return function(){var c=b.apply(this,arguments);if(c===h)throw c=z(a._olm_inbound_group_session_last_error(arguments[0])),Error("OLM."+c);return c}}O.prototype.free=function(){a._olm_clear_inbound_group_session(this.a);H(this.a)};
O.prototype.pickle=J(function(b){b=K(b);var c=P(a._olm_pickle_inbound_group_session_length)(this.a),d=L(b),e=L(c+1);try{P(a._olm_pickle_inbound_group_session)(this.a,d,b.length,e,c)}finally{for(M(d,b.length),d=0;d<b.length;d++)b[d]=0}return z(e,c)});O.prototype.unpickle=J(function(b,c){b=K(b);var d=L(b);c=K(c);var e=L(c);try{P(a._olm_unpickle_inbound_group_session)(this.a,d,b.length,e,c.length)}finally{for(M(d,b.length),d=0;d<b.length;d++)b[d]=0}});
O.prototype.create=J(function(b){b=K(b);var c=L(b);try{P(a._olm_init_inbound_group_session)(this.a,c,b.length)}finally{for(M(c,b.length),c=0;c<b.length;c++)b[c]=0}});O.prototype.import_session=J(function(b){b=K(b);var c=L(b);try{P(a._olm_import_inbound_group_session)(this.a,c,b.length)}finally{for(M(c,b.length),c=0;c<b.length;c++)b[c]=0}});
O.prototype.decrypt=J(function(b){try{var c=F(b.length);Na(b,c);var d=P(a._olm_group_decrypt_max_plaintext_length)(this.a,c,b.length);Na(b,c);var e=F(d+1);var f=L(4);var k=P(a._olm_group_decrypt)(this.a,c,b.length,e,d,f);w(e+k);return{plaintext:z(e,k),message_index:Ia(f,"i32")}}finally{void 0!==c&&H(c),void 0!==e&&(M(e,k),H(e))}});O.prototype.session_id=J(function(){var b=P(a._olm_inbound_group_session_id_length)(this.a),c=L(b+1);P(a._olm_inbound_group_session_id)(this.a,c,b);return z(c,b)});
O.prototype.first_known_index=J(function(){return P(a._olm_inbound_group_session_first_known_index)(this.a)});O.prototype.export_session=J(function(b){var c=P(a._olm_export_inbound_group_session_length)(this.a),d=L(c+1);G(a._olm_export_inbound_group_session)(this.a,d,c,b);b=z(d,c);M(d,c);return b});olm_exports.InboundGroupSession=O;function kb(){var b=a._olm_pk_encryption_size();this.b=F(b);this.a=a._olm_pk_encryption(this.b)}
function Q(b){return function(){var c=b.apply(this,arguments);if(c===h)throw c=z(a._olm_pk_encryption_last_error(arguments[0])),Error("OLM."+c);return c}}kb.prototype.free=function(){a._olm_clear_pk_encryption(this.a);H(this.a)};kb.prototype.set_recipient_key=J(function(b){b=K(b);var c=L(b);Q(a._olm_pk_encryption_set_recipient_key)(this.a,c,b.length)});
kb.prototype.encrypt=J(function(b){try{var c=Ma(b);var d=F(c+1);La(b,A,d,c+1);var e=Q(a._olm_pk_encrypt_random_length)();var f=N(e,g);var k=Q(a._olm_pk_ciphertext_length)(this.a,c);var n=F(k+1);var v=Q(a._olm_pk_mac_length)(this.a),ka=L(v+1);w(ka+v);var V=Q(a._olm_pk_key_length)(),I=L(V+1);w(I+V);Q(a._olm_pk_encrypt)(this.a,d,c,n,k,ka,v,I,V,f,e);w(n+k);return{ciphertext:z(n,k),mac:z(ka,v),ephemeral:z(I,V)}}finally{void 0!==f&&M(f,e),void 0!==d&&(M(d,c+1),H(d)),void 0!==n&&H(n)}});
function R(){var b=a._olm_pk_decryption_size();this.b=F(b);this.a=a._olm_pk_decryption(this.b)}function S(b){return function(){var c=b.apply(this,arguments);if(c===h)throw c=z(a._olm_pk_decryption_last_error(arguments[0])),Error("OLM."+c);return c}}R.prototype.free=function(){a._olm_clear_pk_decryption(this.a);H(this.a)};
R.prototype.init_with_private_key=J(function(b){var c=L(b.length);a.HEAPU8.set(b,c);var d=S(a._olm_pk_key_length)(),e=L(d+1);try{S(a._olm_pk_key_from_private)(this.a,e,d,c,b.length)}finally{M(c,b.length)}return z(e,d)});R.prototype.generate_key=J(function(){var b=S(a._olm_pk_private_key_length)(),c=N(b,g),d=S(a._olm_pk_key_length)(),e=L(d+1);try{S(a._olm_pk_key_from_private)(this.a,e,d,c,b)}finally{M(c,b)}return z(e,d)});
R.prototype.get_private_key=J(function(){var b=Q(a._olm_pk_private_key_length)(),c=L(b);S(a._olm_pk_get_private_key)(this.a,c,b);var d=new Uint8Array(new Uint8Array(a.HEAPU8.buffer,c,b));M(c,b);return d});R.prototype.pickle=J(function(b){b=K(b);var c=S(a._olm_pickle_pk_decryption_length)(this.a),d=L(b),e=L(c+1);try{S(a._olm_pickle_pk_decryption)(this.a,d,b.length,e,c)}finally{for(M(d,b.length),d=0;d<b.length;d++)b[d]=0}return z(e,c)});
R.prototype.unpickle=J(function(b,c){b=K(b);var d=L(b),e=K(c),f=L(e);c=S(a._olm_pk_key_length)();var k=L(c+1);try{S(a._olm_unpickle_pk_decryption)(this.a,d,b.length,f,e.length,k,c)}finally{for(M(d,b.length),d=0;d<b.length;d++)b[d]=0}return z(k,c)});
R.prototype.decrypt=J(function(b,c,d){try{var e=Ma(d);var f=F(e+1);La(d,A,f,e+1);var k=K(b),n=L(k),v=K(c),ka=L(v);var V=S(a._olm_pk_max_plaintext_length)(this.a,e);var I=F(V+1);var Ha=S(a._olm_pk_decrypt)(this.a,n,k.length,ka,v.length,f,e,I,V);w(I+Ha);return z(I,Ha)}finally{void 0!==I&&(M(I,Ha+1),H(I)),void 0!==f&&H(f)}});function lb(){var b=a._olm_pk_signing_size();this.b=F(b);this.a=a._olm_pk_signing(this.b)}
function mb(b){return function(){var c=b.apply(this,arguments);if(c===h)throw c=z(a._olm_pk_signing_last_error(arguments[0])),Error("OLM."+c);return c}}lb.prototype.free=function(){a._olm_clear_pk_signing(this.a);H(this.a)};lb.prototype.init_with_seed=J(function(b){var c=L(b.length);a.HEAPU8.set(b,c);var d=mb(a._olm_pk_signing_public_key_length)(),e=L(d+1);try{mb(a._olm_pk_signing_key_from_seed)(this.a,e,d,c,b.length)}finally{M(c,b.length)}return z(e,d)});
lb.prototype.generate_seed=J(function(){var b=mb(a._olm_pk_signing_seed_length)(),c=N(b,g),d=new Uint8Array(new Uint8Array(a.HEAPU8.buffer,c,b));M(c,b);return d});lb.prototype.sign=J(function(b){try{var c=Ma(b);var d=F(c+1);La(b,A,d,c+1);var e=mb(a._olm_pk_signature_length)(),f=L(e+1);mb(a._olm_pk_sign)(this.a,d,c,f,e);return z(f,e)}finally{void 0!==d&&(M(d,c+1),H(d))}});
function T(){var b=a._olm_sas_size(),c=a._olm_create_sas_random_length(),d=N(c,g);this.b=F(b);this.a=a._olm_sas(this.b);a._olm_create_sas(this.a,d,c);M(d,c)}function U(b){return function(){var c=b.apply(this,arguments);if(c===h)throw c=z(a._olm_sas_last_error(arguments[0])),Error("OLM."+c);return c}}T.prototype.free=function(){a._olm_clear_sas(this.a);H(this.a)};T.prototype.get_pubkey=J(function(){var b=U(a._olm_sas_pubkey_length)(this.a),c=L(b+1);U(a._olm_sas_get_pubkey)(this.a,c,b);return z(c,b)});
T.prototype.set_their_key=J(function(b){b=K(b);var c=L(b);U(a._olm_sas_set_their_key)(this.a,c,b.length)});T.prototype.is_their_key_set=J(function(){return U(a._olm_sas_is_their_key_set)(this.a)?!0:!1});T.prototype.generate_bytes=J(function(b,c){b=K(b);var d=L(b),e=L(c);U(a._olm_sas_generate_bytes)(this.a,d,b.length,e,c);return new Uint8Array(new Uint8Array(a.HEAPU8.buffer,e,c))});
T.prototype.calculate_mac=J(function(b,c){b=K(b);var d=L(b);c=K(c);var e=L(c),f=U(a._olm_sas_mac_length)(this.a),k=L(f+1);U(a._olm_sas_calculate_mac)(this.a,d,b.length,e,c.length,k,f);return z(k,f)});T.prototype.calculate_mac_long_kdf=J(function(b,c){b=K(b);var d=L(b);c=K(c);var e=L(c),f=U(a._olm_sas_mac_length)(this.a),k=L(f+1);U(a._olm_sas_calculate_mac_long_kdf)(this.a,d,b.length,e,c.length,k,f);return z(k,f)});var F=a._malloc,H=a._free,h;
function N(b,c){var d=gb(b);c(new Uint8Array(a.HEAPU8.buffer,d,b));return d}function L(b){return"number"==typeof b?N(b,function(c){c.fill(0)}):N(b.length,function(c){c.set(b)})}function K(b){if(b instanceof Uint8Array)var c=b;else c=Array(Ma(b)+1),b=La(b,c,0,c.length),c.length=b;return c}function J(b){return function(){var c=eb();try{return b.apply(this,arguments)}finally{fb(c)}}}function M(b,c){for(;0<c--;)a.HEAP8[b++]=0}
function W(){var b=a._olm_account_size();this.b=F(b);this.a=a._olm_account(this.b)}function X(b){return function(){var c=b.apply(this,arguments);if(c===h)throw c=z(a._olm_account_last_error(arguments[0])),Error("OLM."+c);return c}}W.prototype.free=function(){a._olm_clear_account(this.a);H(this.a)};W.prototype.create=J(function(){var b=X(a._olm_create_account_random_length)(this.a),c=N(b,g);X(a._olm_create_account)(this.a,c,b)});
W.prototype.identity_keys=J(function(){var b=X(a._olm_account_identity_keys_length)(this.a),c=L(b+1);X(a._olm_account_identity_keys)(this.a,c,b);return z(c,b)});W.prototype.sign=J(function(b){var c=X(a._olm_account_signature_length)(this.a);b=K(b);var d=L(b),e=L(c+1);try{X(a._olm_account_sign)(this.a,d,b.length,e,c)}finally{for(M(d,b.length),d=0;d<b.length;d++)b[d]=0}return z(e,c)});
W.prototype.one_time_keys=J(function(){var b=X(a._olm_account_one_time_keys_length)(this.a),c=L(b+1);X(a._olm_account_one_time_keys)(this.a,c,b);return z(c,b)});W.prototype.mark_keys_as_published=J(function(){X(a._olm_account_mark_keys_as_published)(this.a)});W.prototype.max_number_of_one_time_keys=J(function(){return X(a._olm_account_max_number_of_one_time_keys)(this.a)});
W.prototype.generate_one_time_keys=J(function(b){var c=X(a._olm_account_generate_one_time_keys_random_length)(this.a,b),d=N(c,g);X(a._olm_account_generate_one_time_keys)(this.a,b,d,c)});W.prototype.remove_one_time_keys=J(function(b){X(a._olm_remove_one_time_keys)(this.a,b.a)});W.prototype.generate_fallback_key=J(function(){var b=X(a._olm_account_generate_fallback_key_random_length)(this.a),c=N(b,g);X(a._olm_account_generate_fallback_key)(this.a,c,b)});
W.prototype.fallback_key=J(function(){var b=X(a._olm_account_fallback_key_length)(this.a),c=L(b+1);X(a._olm_account_fallback_key)(this.a,c,b);return z(c,b)});W.prototype.pickle=J(function(b){b=K(b);var c=X(a._olm_pickle_account_length)(this.a),d=L(b),e=L(c+1);try{X(a._olm_pickle_account)(this.a,d,b.length,e,c)}finally{for(M(d,b.length),d=0;d<b.length;d++)b[d]=0}return z(e,c)});
W.prototype.unpickle=J(function(b,c){b=K(b);var d=L(b);c=K(c);var e=L(c);try{X(a._olm_unpickle_account)(this.a,d,b.length,e,c.length)}finally{for(M(d,b.length),d=0;d<b.length;d++)b[d]=0}});function Y(){var b=a._olm_session_size();this.b=F(b);this.a=a._olm_session(this.b)}function Z(b){return function(){var c=b.apply(this,arguments);if(c===h)throw c=z(a._olm_session_last_error(arguments[0])),Error("OLM."+c);return c}}Y.prototype.free=function(){a._olm_clear_session(this.a);H(this.a)};
Y.prototype.pickle=J(function(b){b=K(b);var c=Z(a._olm_pickle_session_length)(this.a),d=L(b),e=L(c+1);try{Z(a._olm_pickle_session)(this.a,d,b.length,e,c)}finally{for(M(d,b.length),d=0;d<b.length;d++)b[d]=0}return z(e,c)});Y.prototype.unpickle=J(function(b,c){b=K(b);var d=L(b);c=K(c);var e=L(c);try{Z(a._olm_unpickle_session)(this.a,d,b.length,e,c.length)}finally{for(M(d,b.length),d=0;d<b.length;d++)b[d]=0}});
Y.prototype.create_outbound=J(function(b,c,d){var e=Z(a._olm_create_outbound_session_random_length)(this.a),f=N(e,g);c=K(c);d=K(d);var k=L(c),n=L(d);try{Z(a._olm_create_outbound_session)(this.a,b.a,k,c.length,n,d.length,f,e)}finally{M(f,e)}});Y.prototype.create_inbound=J(function(b,c){c=K(c);var d=L(c);try{Z(a._olm_create_inbound_session)(this.a,b.a,d,c.length)}finally{for(M(d,c.length),b=0;b<c.length;b++)c[b]=0}});
Y.prototype.create_inbound_from=J(function(b,c,d){c=K(c);var e=L(c);d=K(d);var f=L(d);try{Z(a._olm_create_inbound_session_from)(this.a,b.a,e,c.length,f,d.length)}finally{for(M(f,d.length),b=0;b<d.length;b++)d[b]=0}});Y.prototype.session_id=J(function(){var b=Z(a._olm_session_id_length)(this.a),c=L(b+1);Z(a._olm_session_id)(this.a,c,b);return z(c,b)});Y.prototype.has_received_message=function(){return Z(a._olm_session_has_received_message)(this.a)?!0:!1};
Y.prototype.matches_inbound=J(function(b){b=K(b);var c=L(b);return Z(a._olm_matches_inbound_session)(this.a,c,b.length)?!0:!1});Y.prototype.matches_inbound_from=J(function(b,c){b=K(b);var d=L(b);c=K(c);var e=L(c);return Z(a._olm_matches_inbound_session_from)(this.a,d,b.length,e,c.length)?!0:!1});
Y.prototype.encrypt=J(function(b){try{var c=Z(a._olm_encrypt_random_length)(this.a);var d=Z(a._olm_encrypt_message_type)(this.a);var e=Ma(b);var f=Z(a._olm_encrypt_message_length)(this.a,e);var k=N(c,g);var n=F(e+1);La(b,A,n,e+1);var v=F(f+1);Z(a._olm_encrypt)(this.a,n,e,k,c,v,f);w(v+f);return{type:d,body:z(v,f)}}finally{void 0!==k&&M(k,c),void 0!==n&&(M(n,e+1),H(n)),void 0!==v&&H(v)}});
Y.prototype.decrypt=J(function(b,c){try{var d=F(c.length);Na(c,d);var e=Z(a._olm_decrypt_max_plaintext_length)(this.a,b,d,c.length);Na(c,d);var f=F(e+1);var k=Z(a._olm_decrypt)(this.a,b,d,c.length,f,e);w(f+k);return z(f,k)}finally{void 0!==d&&H(d),void 0!==f&&(M(f,e),H(f))}});Y.prototype.describe=J(function(){try{var b=F(256);Z(a._olm_session_describe)(this.a,b,256);return z(b)}finally{void 0!==b&&H(b)}});function nb(){var b=a._olm_utility_size();this.b=F(b);this.a=a._olm_utility(this.b)}
function ob(b){return function(){var c=b.apply(this,arguments);if(c===h)throw c=z(a._olm_utility_last_error(arguments[0])),Error("OLM."+c);return c}}nb.prototype.free=function(){a._olm_clear_utility(this.a);H(this.a)};nb.prototype.sha256=J(function(b){var c=ob(a._olm_sha256_length)(this.a);b=K(b);var d=L(b),e=L(c+1);try{ob(a._olm_sha256)(this.a,d,b.length,e,c)}finally{for(M(d,b.length),d=0;d<b.length;d++)b[d]=0}return z(e,c)});
nb.prototype.ed25519_verify=J(function(b,c,d){b=K(b);var e=L(b);c=K(c);var f=L(c);d=K(d);var k=L(d);try{ob(a._olm_ed25519_verify)(this.a,e,b.length,f,c.length,k,d.length)}finally{for(M(f,c.length),b=0;b<c.length;b++)c[b]=0}});olm_exports.Account=W;olm_exports.Session=Y;olm_exports.Utility=nb;olm_exports.PkEncryption=kb;olm_exports.PkDecryption=R;olm_exports.PkSigning=lb;olm_exports.SAS=T;
olm_exports.get_library_version=J(function(){var b=L(3);a._olm_get_library_version(b,b+1,b+2);return[Ia(b,"i8"),Ia(b+1,"i8"),Ia(b+2,"i8")]});
return Module.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = Module;
else if (typeof define === 'function' && define['amd'])
define([], function() { return Module; });
else if (typeof exports === 'object')
exports["Module"] = Module;
var olmInitPromise;
olm_exports['init'] = function(opts) {
if (olmInitPromise) return olmInitPromise;
if (opts) OLM_OPTIONS = opts;
olmInitPromise = new Promise(function(resolve, reject) {
onInitSuccess = function() {
resolve();
};
onInitFail = function(err) {
reject(err);
};
Module();
});
return olmInitPromise;
};
return olm_exports;
})();
if (typeof(window) !== 'undefined') {
// We've been imported directly into a browser. Define the global 'Olm' object.
// (we do this even if module.exports was defined, because it's useful to have
// Olm in the global scope for browserified and webpacked apps.)
window["Olm"] = Olm;
}
if (typeof module === 'object') {
// Emscripten sets the module exports to be its module
// with wrapped c functions. Clobber it with our higher
// level wrapper class.
module.exports = Olm;
}
// @license-end