edge-core-js 2.47.0 → 2.48.0

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,2 @@
1
+ /*! For license information please see fbcba1e9b05cb4dd9870.js.LICENSE.txt */
2
+ !function(){"use strict";var e="undefined"!=typeof document?document.currentScript:null;function n(e,n,t,r){return new(t||(t=Promise))(function(i,o){function _(e){try{c(r.next(e))}catch(n){o(n)}}function s(e){try{c(r.throw(e))}catch(n){o(n)}}function c(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t(function(e){e(n)})).then(_,s)}c((r=r.apply(e,n||[])).next())})}function t(e,n,t,r){function i(e,n,t){var r=t?WebAssembly.instantiateStreaming:WebAssembly.instantiate,i=t?WebAssembly.compileStreaming:WebAssembly.compile;return n?r(e,n):i(e)}var o=null;if(n)return i(fetch(n),r,!0);var _=globalThis.atob(t),s=_.length;o=new Uint8Array(new ArrayBuffer(s));for(var c=0;c<s;c++)o[c]=_.charCodeAt(c);if(e){var a=new WebAssembly.Module(o);return r?new WebAssembly.Instance(a,r):a}return i(o,r,!1)}let r;"function"==typeof SuppressedError&&SuppressedError;let i=0,o=null;function _(){return null!==o&&0!==o.byteLength||(o=new Uint8Array(r.memory.buffer)),o}const s="undefined"!=typeof TextEncoder?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},c="function"==typeof s.encodeInto?function(e,n){return s.encodeInto(e,n)}:function(e,n){const t=s.encode(e);return n.set(t),{read:e.length,written:t.length}};function a(e,n,t){if(void 0===t){const t=s.encode(e),r=n(t.length,1)>>>0;return _().subarray(r,r+t.length).set(t),i=t.length,r}let r=e.length,o=n(r,1)>>>0;const a=_();let u=0;for(;u<r;u++){const n=e.charCodeAt(u);if(n>127)break;a[o+u]=n}if(u!==r){0!==u&&(e=e.slice(u)),o=t(o,r,r=u+3*e.length,1)>>>0;const n=_().subarray(o+u,o+r);u+=c(e,n).written,o=t(o,r,u,1)>>>0}return i=u,o}let u=null;function f(){return(null===u||!0===u.buffer.detached||void 0===u.buffer.detached&&u.buffer!==r.memory.buffer)&&(u=new DataView(r.memory.buffer)),u}function b(e){const n=r.__externref_table_alloc();return r.__wbindgen_export_4.set(n,e),n}function g(e,n){try{return e.apply(this,n)}catch(t){const e=b(t);r.__wbindgen_exn_store(e)}}const l="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};function w(e,n){return e>>>=0,l.decode(_().subarray(e,e+n))}function d(e){return null==e}function m(e,n){return e>>>=0,_().subarray(e/1,e/1+n)}"undefined"!=typeof TextDecoder&&l.decode();const h="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>{r.__wbindgen_export_6.get(e.dtor)(e.a,e.b)});function p(e,n,t,i){const o={a:e,b:n,cnt:1,dtor:t},_=(...e)=>{o.cnt++;const n=o.a;o.a=0;try{return i(n,o.b,...e)}finally{0===--o.cnt?(r.__wbindgen_export_6.get(o.dtor)(n,o.b),h.unregister(o)):o.a=n}};return _.original=o,h.register(_,o,o),_}function y(e){const n=typeof e;if("number"==n||"boolean"==n||null==e)return`${e}`;if("string"==n)return`"${e}"`;if("symbol"==n){const n=e.description;return null==n?"Symbol":`Symbol(${n})`}if("function"==n){const n=e.name;return"string"==typeof n&&n.length>0?`Function(${n})`:"Function"}if(Array.isArray(e)){const n=e.length;let t="[";n>0&&(t+=y(e[0]));for(let r=1;r<n;r++)t+=", "+y(e[r]);return t+="]",t}const t=/\[object ([^\]]+)\]/.exec(toString.call(e));let r;if(!(t&&t.length>1))return toString.call(e);if(r=t[1],"Object"==r)try{return"Object("+JSON.stringify(e)+")"}catch(i){return"Object"}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}function v(e,n){const t=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i,s=function(e,n){const t=n(1*e.length,1)>>>0;return _().set(e,t/1),i=e.length,t}(n,r.__wbindgen_malloc),c=i;return r.send_client_data(t,o,s,c)}function x(e){const n=r.__wbindgen_export_4.get(e);return r.__externref_table_dealloc(e),n}function R(){const e=r.mix_fetch_initialised();if(e[2])throw x(e[1]);return 0!==e[0]}function E(e){const n=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),t=i;return r.start_new_mixnet_connection(n,t)}function T(e){const n=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),t=i;return r.finish_mixnet_connection(n,t)}function S(e,n,t){const i=r.closure743_externref_shim_multivalue_shim(e,n,t);if(i[1])throw x(i[0])}function j(e,n,t){r.closure830_externref_shim(e,n,t)}function I(e,n){r._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h061f9c2866052d32(e,n)}function F(e,n){r._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h67f1322bcb5f40b5(e,n)}function A(e,n){r._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb7fef82722851829(e,n)}function k(e,n,t){r.closure2203_externref_shim(e,n,t)}function O(e,n){r._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7ea245616776fb08(e,n)}function U(e,n){r._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h75596235482477c3(e,n)}function W(e,n,t){r.closure2326_externref_shim(e,n,t)}const C=["blob","arraybuffer"],D=["pending","done"],z=["readonly","readwrite","versionchange","readwriteflush","cleanup"],M=["default","no-store","reload","no-cache","force-cache","only-if-cached"],L=["omit","same-origin","include"],B=["same-origin","no-cors","cors","navigate"];"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_acknowledgementswasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_anonymoussendertag_free(e>>>0,1));const P="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>r.__wbg_clientstorage_free(e>>>0,1));class N{static __wrap(e){e>>>=0;const n=Object.create(N.prototype);return n.__wbg_ptr=e,P.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,P.unregister(this),e}free(){const e=this.__destroy_into_raw();r.__wbg_clientstorage_free(e,0)}static new_unencrypted(e){const n=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),t=i;return r.clientstorage_new_unencrypted(n,t)}constructor(e,n){const t=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i,_=a(n,r.__wbindgen_malloc,r.__wbindgen_realloc),s=i;return r.clientstorage_new(t,o,_,s)}static new_async(e,n){const t=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;var _=d(n)?0:a(n,r.__wbindgen_malloc,r.__wbindgen_realloc),s=i;return r.clientstorage_new_async(t,o,_,s)}}"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_covertrafficwasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_debugwasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_forgetmewasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_gatewayconnectionwasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_mixfetch_free(e>>>0,1));const q="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>r.__wbg_mixfetchclient_free(e>>>0,1));class G{static __wrap(e){e>>>=0;const n=Object.create(G.prototype);return n.__wbg_ptr=e,q.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,q.unregister(this),e}free(){const e=this.__destroy_into_raw();r.__wbg_mixfetchclient_free(e,0)}disconnect(){return r.mixfetchclient_disconnect(this.__wbg_ptr)}self_address(){let e,n;try{const t=r.mixfetchclient_self_address(this.__wbg_ptr);return e=t[0],n=t[1],w(t[0],t[1])}finally{r.__wbindgen_free(e,n,1)}}constructor(e,n,t,o){!function(e,n){if(!(e instanceof n))throw new Error(`expected instance of ${n.name}`)}(e,$);var _=e.__destroy_into_raw(),s=d(t)?0:a(t,r.__wbindgen_malloc,r.__wbindgen_realloc),c=i,u=d(o)?0:a(o,r.__wbindgen_malloc,r.__wbindgen_realloc),f=i;return r.mixfetchclient_new(_,n,s,c,u,f)}active(){return 0!==r.mixfetchclient_active(this.__wbg_ptr)}}"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_mixfetchclientbuilder_free(e>>>0,1));const V="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>r.__wbg_mixfetchconfig_free(e>>>0,1));class ${static __wrap(e){e>>>=0;const n=Object.create($.prototype);return n.__wbg_ptr=e,V.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,V.unregister(this),e}free(){const e=this.__destroy_into_raw();r.__wbg_mixfetchconfig_free(e,0)}with_mix_fetch_timeout(e){const n=this.__destroy_into_raw(),t=r.mixfetchconfig_with_mix_fetch_timeout(n,e);return $.__wrap(t)}constructor(e,n){const t=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i,_=r.mixfetchconfig_new(t,o,d(n)?0:b(n));if(_[2])throw x(_[1]);return this.__wbg_ptr=_[0]>>>0,V.register(this,this.__wbg_ptr,this),this}}function H(){const e={wbg:{}};return e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(e,n){const t=a(String(n),r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbg_String_eecc4a11987127d6=function(e,n){const t=a(String(n),r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbg_Window_41559019033ede94=function(e){return e.Window},e.wbg.__wbg_WorkerGlobalScope_d324bffbeaef9f3a=function(e){return e.WorkerGlobalScope},e.wbg.__wbg_abort_410ec47a64ac6117=function(e,n){e.abort(n)},e.wbg.__wbg_abort_775ef1d17fc65868=function(e){e.abort()},e.wbg.__wbg_abort_99fc644e2c79c9fb=function(){return g(function(e){e.abort()},arguments)},e.wbg.__wbg_addEventListener_84ae3eac6e15480a=function(){return g(function(e,n,t,r,i){e.addEventListener(w(n,t),r,i)},arguments)},e.wbg.__wbg_addEventListener_90e553fdce254421=function(){return g(function(e,n,t,r){e.addEventListener(w(n,t),r)},arguments)},e.wbg.__wbg_append_8c7dd8d641a5f01b=function(){return g(function(e,n,t,r,i){e.append(w(n,t),w(r,i))},arguments)},e.wbg.__wbg_arrayBuffer_d1b44c4390db422f=function(){return g(function(e){return e.arrayBuffer()},arguments)},e.wbg.__wbg_bound_f2afc3766d4545cf=function(){return g(function(e,n,t,r){return IDBKeyRange.bound(e,n,0!==t,0!==r)},arguments)},e.wbg.__wbg_buffer_609cc3eee51ed158=function(e){return e.buffer},e.wbg.__wbg_call_672a4d21634d4a24=function(){return g(function(e,n){return e.call(n)},arguments)},e.wbg.__wbg_call_7cccdd69e0791ae2=function(){return g(function(e,n,t){return e.call(n,t)},arguments)},e.wbg.__wbg_clearInterval_dd1e598f425db353=function(e){return clearInterval(e)},e.wbg.__wbg_clearTimeout_3b5c565a5ec539dd=function(e){return clearTimeout(e)},e.wbg.__wbg_clientstorage_new=function(e){return N.__wrap(e)},e.wbg.__wbg_close_2893b7d056a0627d=function(){return g(function(e){e.close()},arguments)},e.wbg.__wbg_code_f4ec1e6e2e1b0417=function(e){return e.code},e.wbg.__wbg_commit_a54edce65f3858f2=function(){return g(function(e){e.commit()},arguments)},e.wbg.__wbg_count_9dbedee4d2474ff8=function(){return g(function(e,n){return e.count(n)},arguments)},e.wbg.__wbg_createObjectStore_e566459f7161f82f=function(){return g(function(e,n,t){return e.createObjectStore(w(n,t))},arguments)},e.wbg.__wbg_crypto_574e78ad8b13b65f=function(e){return e.crypto},e.wbg.__wbg_data_432d9c3df2630942=function(e){return e.data},e.wbg.__wbg_dispatchEvent_9e259d7c1d603dfb=function(){return g(function(e,n){return e.dispatchEvent(n)},arguments)},e.wbg.__wbg_done_769e5ede4b31c67b=function(e){return e.done},e.wbg.__wbg_entries_2a52db465d0421fb=function(e){return e.entries()},e.wbg.__wbg_entries_3265d4158b33e5dc=function(e){return Object.entries(e)},e.wbg.__wbg_error_3cfd4be637595be7=function(e,n){console.error(w(e,n))},e.wbg.__wbg_error_e98c298703cffa97=function(e,n){console.error(w(e,n))},e.wbg.__wbg_error_ff4ddaabdfc5dbb3=function(){return g(function(e){const n=e.error;return d(n)?0:b(n)},arguments)},e.wbg.__wbg_fetch_16dcf1cfbbc66b3c=function(e){return fetch(e)},e.wbg.__wbg_fetch_509096533071c657=function(e,n){return e.fetch(n)},e.wbg.__wbg_from_2a5d3e218e67aa85=function(e){return Array.from(e)},e.wbg.__wbg_getAllKeys_b11d8835dc4be0e8=function(){return g(function(e){return e.getAllKeys()},arguments)},e.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e=function(){return g(function(e,n){e.getRandomValues(n)},arguments)},e.wbg.__wbg_getTime_46267b1c24877e30=function(e){return e.getTime()},e.wbg.__wbg_get_67b2ba62fc30de12=function(){return g(function(e,n){return Reflect.get(e,n)},arguments)},e.wbg.__wbg_get_8da03f81f6a1111e=function(){return g(function(e,n){return e.get(n)},arguments)},e.wbg.__wbg_get_b9b93047fe3cf45b=function(e,n){return e[n>>>0]},e.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(e,n){return e[n]},e.wbg.__wbg_getwithrefkey_6550b2c093d2eb18=function(e,n){return e[n]},e.wbg.__wbg_global_f5c2926e57ba457f=function(e){return e.global},e.wbg.__wbg_goWasmCloseRemoteSocket_992b677524fcede8=function(e,n){let t,i;try{t=e,i=n,__go_rs_bridge__.goWasmCloseRemoteSocket(w(e,n))}finally{r.__wbindgen_free(t,i,1)}},e.wbg.__wbg_goWasmInjectConnError_b927894206725a9c=function(e,n,t,i){let o,_,s,c;try{o=e,_=n,s=t,c=i,__go_rs_bridge__.goWasmInjectConnError(w(e,n),w(t,i))}finally{r.__wbindgen_free(o,_,1),r.__wbindgen_free(s,c,1)}},e.wbg.__wbg_goWasmInjectServerData_40f1c53f7ca870d5=function(e,n,t,i){let o,_;try{o=e,_=n;var s=m(t,i).slice();r.__wbindgen_free(t,1*i,1),__go_rs_bridge__.goWasmInjectServerData(w(e,n),s)}finally{r.__wbindgen_free(o,_,1)}},e.wbg.__wbg_goWasmSetMixFetchRequestTimeout_74f591ac382a0775=function(e){__go_rs_bridge__.goWasmSetMixFetchRequestTimeout(e>>>0)},e.wbg.__wbg_has_a5ea9117f258a0ec=function(){return g(function(e,n){return Reflect.has(e,n)},arguments)},e.wbg.__wbg_headers_9cb51cfd2ac780a4=function(e){return e.headers},e.wbg.__wbg_indexedDB_54f01430b1e194e8=function(){return g(function(e){const n=e.indexedDB;return d(n)?0:b(n)},arguments)},e.wbg.__wbg_indexedDB_b1f49280282046f8=function(){return g(function(e){const n=e.indexedDB;return d(n)?0:b(n)},arguments)},e.wbg.__wbg_indexedDB_f6b47b0dc333fd2f=function(){return g(function(e){const n=e.indexedDB;return d(n)?0:b(n)},arguments)},e.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc=function(e){let n;try{n=e instanceof ArrayBuffer}catch(t){n=!1}return n},e.wbg.__wbg_instanceof_DomException_ed1ccb7aaf39034c=function(e){let n;try{n=e instanceof DOMException}catch(t){n=!1}return n},e.wbg.__wbg_instanceof_Error_4d54113b22d20306=function(e){let n;try{n=e instanceof Error}catch(t){n=!1}return n},e.wbg.__wbg_instanceof_IdbDatabase_a3ef009ca00059f9=function(e){let n;try{n=e instanceof IDBDatabase}catch(t){n=!1}return n},e.wbg.__wbg_instanceof_IdbRequest_4813c3f207666aa4=function(e){let n;try{n=e instanceof IDBRequest}catch(t){n=!1}return n},e.wbg.__wbg_instanceof_Response_f2cc20d9f7dfd644=function(e){let n;try{n=e instanceof Response}catch(t){n=!1}return n},e.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9=function(e){let n;try{n=e instanceof Uint8Array}catch(t){n=!1}return n},e.wbg.__wbg_isArray_a1eab7e0d067391b=function(e){return Array.isArray(e)},e.wbg.__wbg_isSafeInteger_343e2beeeece1bb0=function(e){return Number.isSafeInteger(e)},e.wbg.__wbg_iterator_9a24c88df860dc65=function(){return Symbol.iterator},e.wbg.__wbg_length_a446193dc22c12f8=function(e){return e.length},e.wbg.__wbg_length_e2d2a49132c1b256=function(e){return e.length},e.wbg.__wbg_log_72cb694afa6a0fe7=function(e,n){console.log(w(e,n))},e.wbg.__wbg_lowerBound_1872d19f5bcf83c6=function(){return g(function(e,n){return IDBKeyRange.lowerBound(e,0!==n)},arguments)},e.wbg.__wbg_message_5c5d919204d42400=function(e,n){const t=a(n.message,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbg_message_97a2af9b89d693a3=function(e){return e.message},e.wbg.__wbg_mixfetchclient_new=function(e){return G.__wrap(e)},e.wbg.__wbg_msCrypto_a61aeb35a24c1329=function(e){return e.msCrypto},e.wbg.__wbg_name_0b327d569f00ebee=function(e){return e.name},e.wbg.__wbg_name_f2d27098bfd843e7=function(e,n){const t=a(n.name,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbg_new0_f788a2397c7ca929=function(){return new Date},e.wbg.__wbg_new_018dcc2d6c8c2f6a=function(){return g(function(){return new Headers},arguments)},e.wbg.__wbg_new_23a2665fac83c611=function(e,n){try{var t={a:e,b:n};const i=new Promise((e,n)=>{const i=t.a;t.a=0;try{return function(e,n,t,i){r.closure2942_externref_shim(e,n,t,i)}(i,t.b,e,n)}finally{t.a=i}});return i}finally{t.a=t.b=0}},e.wbg.__wbg_new_405e22f390576ce2=function(){return new Object},e.wbg.__wbg_new_5e0be73521bc8c17=function(){return new Map},e.wbg.__wbg_new_78feb108b6472713=function(){return new Array},e.wbg.__wbg_new_92c54fc74574ef55=function(){return g(function(e,n){return new WebSocket(w(e,n))},arguments)},e.wbg.__wbg_new_a12002a7f91c75be=function(e){return new Uint8Array(e)},e.wbg.__wbg_new_c68d7209be747379=function(e,n){return new Error(w(e,n))},e.wbg.__wbg_new_e25e5aab09ff45db=function(){return g(function(){return new AbortController},arguments)},e.wbg.__wbg_newnoargs_105ed471475aaf50=function(e,n){return new Function(w(e,n))},e.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(e,n,t){return new Uint8Array(e,n>>>0,t>>>0)},e.wbg.__wbg_newwitheventinitdict_502dbfa1b3d2fcbc=function(){return g(function(e,n,t){return new CloseEvent(w(e,n),t)},arguments)},e.wbg.__wbg_newwithlength_a381634e90c276d4=function(e){return new Uint8Array(e>>>0)},e.wbg.__wbg_newwithstrandinit_06c535e0a867c635=function(){return g(function(e,n,t){return new Request(w(e,n),t)},arguments)},e.wbg.__wbg_next_25feadfc0913fea9=function(e){return e.next},e.wbg.__wbg_next_6574e1a8a62d1055=function(){return g(function(e){return e.next()},arguments)},e.wbg.__wbg_node_905d3e251edff8a2=function(e){return e.node},e.wbg.__wbg_now_e1163c67115ff874=function(e){return e.now()},e.wbg.__wbg_objectStore_21878d46d25b64b6=function(){return g(function(e,n,t){return e.objectStore(w(n,t))},arguments)},e.wbg.__wbg_oldVersion_e8337811e52861c6=function(e){return e.oldVersion},e.wbg.__wbg_open_e0c0b2993eb596e1=function(){return g(function(e,n,t,r){return e.open(w(n,t),r>>>0)},arguments)},e.wbg.__wbg_performance_7fe0928f3ab059e5=function(e){return e.performance},e.wbg.__wbg_postMessage_83a8d58d3fcb6c13=function(){return g(function(e,n){e.postMessage(n)},arguments)},e.wbg.__wbg_process_dc0fbacc7c1c06f7=function(e){return e.process},e.wbg.__wbg_put_066faa31a6a88f5b=function(){return g(function(e,n,t){return e.put(n,t)},arguments)},e.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5=function(e){queueMicrotask(e)},e.wbg.__wbg_queueMicrotask_d3219def82552485=function(e){return e.queueMicrotask},e.wbg.__wbg_randomFillSync_ac0988aba3254290=function(){return g(function(e,n){e.randomFillSync(n)},arguments)},e.wbg.__wbg_readyState_4013cfdf4f22afb0=function(e){const n=e.readyState;return(D.indexOf(n)+1||3)-1},e.wbg.__wbg_readyState_7ef6e63c349899ed=function(e){return e.readyState},e.wbg.__wbg_reason_49f1cede8bcf23dd=function(e,n){const t=a(n.reason,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbg_reject_b3fcf99063186ff7=function(e){return Promise.reject(e)},e.wbg.__wbg_removeEventListener_056dfe8c3d6c58f9=function(){return g(function(e,n,t,r){e.removeEventListener(w(n,t),r)},arguments)},e.wbg.__wbg_require_60cc747a6bc5215a=function(){return g(function(){return module.require},arguments)},e.wbg.__wbg_resolve_4851785c9c5f573d=function(e){return Promise.resolve(e)},e.wbg.__wbg_result_f29afabdf2c05826=function(){return g(function(e){return e.result},arguments)},e.wbg.__wbg_send_0293179ba074ffb4=function(){return g(function(e,n,t){e.send(w(n,t))},arguments)},e.wbg.__wbg_send_fc0c204e8a1757f4=function(){return g(function(e,n,t){e.send(m(n,t))},arguments)},e.wbg.__wbg_setInterval_ed3b5e3c3ebb8a6d=function(){return g(function(e,n){return setInterval(e,n)},arguments)},e.wbg.__wbg_setTimeout_42370cb3051b8c2c=function(){return g(function(e,n,t){return e.setTimeout(n,t)},arguments)},e.wbg.__wbg_setTimeout_8f06012fba12034e=function(e,n){globalThis.setTimeout(e,n)},e.wbg.__wbg_setTimeout_cb2a856ba8315e7a=function(e,n){return setTimeout(e,n)},e.wbg.__wbg_set_37837023f3d740e8=function(e,n,t){e[n>>>0]=t},e.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,t){e[n]=t},e.wbg.__wbg_set_65595bdd868b3009=function(e,n,t){e.set(n,t>>>0)},e.wbg.__wbg_set_8fc6bf8a5b1071d1=function(e,n,t){return e.set(n,t)},e.wbg.__wbg_setbinaryType_92fa1ffd873b327c=function(e,n){e.binaryType=C[n]},e.wbg.__wbg_setbody_5923b78a95eedf29=function(e,n){e.body=n},e.wbg.__wbg_setcache_12f17c3a980650e4=function(e,n){e.cache=M[n]},e.wbg.__wbg_setcode_156060465a2f8f79=function(e,n){e.code=n},e.wbg.__wbg_setcredentials_c3a22f1cd105a2c6=function(e,n){e.credentials=L[n]},e.wbg.__wbg_setheaders_834c0bdb6a8949ad=function(e,n){e.headers=n},e.wbg.__wbg_setmethod_3c5280fe5d890842=function(e,n,t){e.method=w(n,t)},e.wbg.__wbg_setmode_5dc300b865044b65=function(e,n){e.mode=B[n]},e.wbg.__wbg_setonabort_3bf4db6614fa98e9=function(e,n){e.onabort=n},e.wbg.__wbg_setonce_0cb80aea26303a35=function(e,n){e.once=0!==n},e.wbg.__wbg_setoncomplete_4d19df0dadb7c4d4=function(e,n){e.oncomplete=n},e.wbg.__wbg_setonerror_b0d9d723b8fddbbb=function(e,n){e.onerror=n},e.wbg.__wbg_setonerror_d7e3056cc6e56085=function(e,n){e.onerror=n},e.wbg.__wbg_setonsuccess_afa464ee777a396d=function(e,n){e.onsuccess=n},e.wbg.__wbg_setonupgradeneeded_fcf7ce4f2eb0cb5f=function(e,n){e.onupgradeneeded=n},e.wbg.__wbg_setreason_d29ac0402eeeb81a=function(e,n,t){e.reason=w(n,t)},e.wbg.__wbg_setsignal_75b21ef3a81de905=function(e,n){e.signal=n},e.wbg.__wbg_signal_aaf9ad74119f20a4=function(e){return e.signal},e.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){const e="undefined"==typeof global?null:global;return d(e)?0:b(e)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){const e="undefined"==typeof globalThis?null:globalThis;return d(e)?0:b(e)},e.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){const e="undefined"==typeof self?null:self;return d(e)?0:b(e)},e.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){const e="undefined"==typeof window?null:window;return d(e)?0:b(e)},e.wbg.__wbg_status_f6360336ca686bf0=function(e){return e.status},e.wbg.__wbg_subarray_aa9065fa9dc5df96=function(e,n,t){return e.subarray(n>>>0,t>>>0)},e.wbg.__wbg_target_0a62d9d79a2a1ede=function(e){const n=e.target;return d(n)?0:b(n)},e.wbg.__wbg_text_7805bea50de2af49=function(){return g(function(e){return e.text()},arguments)},e.wbg.__wbg_then_44b73946d2fb3e7d=function(e,n){return e.then(n)},e.wbg.__wbg_then_48b406749878a531=function(e,n,t){return e.then(n,t)},e.wbg.__wbg_toString_5285597960676b7b=function(e){return e.toString()},e.wbg.__wbg_toString_c813bbd34d063839=function(e){return e.toString()},e.wbg.__wbg_transaction_7d452475ef3c3c33=function(e){return e.transaction},e.wbg.__wbg_transaction_babc423936946a37=function(){return g(function(e,n,t,r){return e.transaction(w(n,t),z[r])},arguments)},e.wbg.__wbg_upperBound_76a00814e81f6891=function(){return g(function(e,n){return IDBKeyRange.upperBound(e,0!==n)},arguments)},e.wbg.__wbg_url_ae10c34ca209681d=function(e,n){const t=a(n.url,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbg_value_cd1ffa7b1ab794f1=function(e){return e.value},e.wbg.__wbg_versions_c01dfd4722a88165=function(e){return e.versions},e.wbg.__wbg_warn_a2e6ac466681f75e=function(e,n){console.warn(w(e,n))},e.wbg.__wbg_wasClean_605b4fd66d44354a=function(e){return e.wasClean},e.wbg.__wbindgen_as_number=function(e){return+e},e.wbg.__wbindgen_bigint_from_i64=function(e){return e},e.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},e.wbg.__wbindgen_bigint_get_as_i64=function(e,n){const t="bigint"==typeof n?n:void 0;f().setBigInt64(e+8,d(t)?BigInt(0):t,!0),f().setInt32(e+0,!d(t),!0)},e.wbg.__wbindgen_boolean_get=function(e){return"boolean"==typeof e?e?1:0:2},e.wbg.__wbindgen_cb_drop=function(e){const n=e.original;if(1==n.cnt--)return n.a=0,!0;return!1},e.wbg.__wbindgen_closure_wrapper3948=function(e,n,t){return p(e,n,744,S)},e.wbg.__wbindgen_closure_wrapper4932=function(e,n,t){return p(e,n,831,j)},e.wbg.__wbindgen_closure_wrapper4933=function(e,n,t){return p(e,n,829,I)},e.wbg.__wbindgen_closure_wrapper5925=function(e,n,t){return p(e,n,1132,F)},e.wbg.__wbindgen_closure_wrapper8465=function(e,n,t){return p(e,n,1996,A)},e.wbg.__wbindgen_closure_wrapper9290=function(e,n,t){return p(e,n,2202,k)},e.wbg.__wbindgen_closure_wrapper9292=function(e,n,t){return p(e,n,2202,O)},e.wbg.__wbindgen_closure_wrapper9294=function(e,n,t){return p(e,n,2202,k)},e.wbg.__wbindgen_closure_wrapper9296=function(e,n,t){return p(e,n,2202,k)},e.wbg.__wbindgen_closure_wrapper9742=function(e,n,t){return p(e,n,2316,U)},e.wbg.__wbindgen_closure_wrapper9780=function(e,n,t){return p(e,n,2327,W)},e.wbg.__wbindgen_debug_string=function(e,n){const t=a(y(n),r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbindgen_error_new=function(e,n){return new Error(w(e,n))},e.wbg.__wbindgen_in=function(e,n){return e in n},e.wbg.__wbindgen_init_externref_table=function(){const e=r.__wbindgen_export_4,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},e.wbg.__wbindgen_is_bigint=function(e){return"bigint"==typeof e},e.wbg.__wbindgen_is_function=function(e){return"function"==typeof e},e.wbg.__wbindgen_is_null=function(e){return null===e},e.wbg.__wbindgen_is_object=function(e){return"object"==typeof e&&null!==e},e.wbg.__wbindgen_is_string=function(e){return"string"==typeof e},e.wbg.__wbindgen_is_undefined=function(e){return void 0===e},e.wbg.__wbindgen_jsval_eq=function(e,n){return e===n},e.wbg.__wbindgen_jsval_loose_eq=function(e,n){return e==n},e.wbg.__wbindgen_memory=function(){return r.memory},e.wbg.__wbindgen_number_get=function(e,n){const t="number"==typeof n?n:void 0;f().setFloat64(e+8,d(t)?0:t,!0),f().setInt32(e+0,!d(t),!0)},e.wbg.__wbindgen_number_new=function(e){return e},e.wbg.__wbindgen_string_get=function(e,n){const t="string"==typeof n?n:void 0;var o=d(t)?0:a(t,r.__wbindgen_malloc,r.__wbindgen_realloc),_=i;f().setInt32(e+4,_,!0),f().setInt32(e+0,o,!0)},e.wbg.__wbindgen_string_new=function(e,n){return w(e,n)},e.wbg.__wbindgen_throw=function(e,n){throw new Error(w(e,n))},e}async function K(n){if(void 0!==r)return r;void 0!==n&&(Object.getPrototypeOf(n)===Object.prototype?({module_or_path:n}=n):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===n&&(n=new URL("mix_fetch_wasm_bg.wasm",e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("worker.js",document.baseURI).href));const t=H();("string"==typeof n||"function"==typeof Request&&n instanceof Request||"function"==typeof URL&&n instanceof URL)&&(n=fetch(n));const{instance:i,module:_}=await async function(e,n){if("function"==typeof Response&&e instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(e,n)}catch(t){if("application/wasm"==e.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const r=await e.arrayBuffer();return await WebAssembly.instantiate(r,n)}{const t=await WebAssembly.instantiate(e,n);return t instanceof WebAssembly.Instance?{instance:t,module:e}:t}}(await n,t);return function(e,n){return r=e.exports,K.__wbindgen_wasm_module=n,u=null,o=null,r.__wbindgen_start(),r}(i,_)}function Y(){return n(this,void 0,void 0,function*(){const e=yield t(0,new URL("go_conn.wasm",import.meta.url),null,n);var n;const r=new Go,i=yield WebAssembly.instantiate(e,r.importObject);r.run(i)})}function J(){return n(this,void 0,void 0,function*(){const e=yield t(0,new URL("mix_fetch_wasm_bg.wasm",import.meta.url),null,n);var n;yield K(e),console.log("Loaded RUST WASM"),yield Y(),console.log("Loaded GO WASM"),r.set_panic_hook(),function(){const e={send_client_data:v,start_new_mixnet_connection:E,mix_fetch_initialised:R,finish_mixnet_connection:T};self.__rs_go_bridge__=e}()})}"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_mixfetchdebug_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_remembermewasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_replysurbswasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_statsreportingwasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_topologywasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_trafficwasm_free(e>>>0,1)),(()=>{const e=()=>{const e=new Error("not implemented");return e.code="ENOSYS",e};if(!globalThis.fs){let n="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1,O_DIRECTORY:-1},writeSync(e,r){n+=t.decode(r);const i=n.lastIndexOf("\n");return-1!=i&&(console.log(n.substring(0,i)),n=n.substring(i+1)),r.length},write(n,t,r,i,o,_){if(0!==r||i!==t.length||null!==o)return void _(e());_(null,this.writeSync(n,t))},chmod(n,t,r){r(e())},chown(n,t,r,i){i(e())},close(n,t){t(e())},fchmod(n,t,r){r(e())},fchown(n,t,r,i){i(e())},fstat(n,t){t(e())},fsync(e,n){n(null)},ftruncate(n,t,r){r(e())},lchown(n,t,r,i){i(e())},link(n,t,r){r(e())},lstat(n,t){t(e())},mkdir(n,t,r){r(e())},open(n,t,r,i){i(e())},read(n,t,r,i,o,_){_(e())},readdir(n,t){t(e())},readlink(n,t){t(e())},rename(n,t,r){r(e())},rmdir(n,t){t(e())},stat(n,t){t(e())},symlink(n,t,r){r(e())},truncate(n,t,r){r(e())},unlink(n,t){t(e())},utimes(n,t,r,i){i(e())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw e()},pid:-1,ppid:-1,umask(){throw e()},cwd(){throw e()},chdir(){throw e()}}),globalThis.path||(globalThis.path={resolve(...e){return e.join("/")}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const n=new TextEncoder("utf-8"),t=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{0!==e&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const e=(e,n)=>{this.mem.setUint32(e+0,n,!0),this.mem.setUint32(e+4,Math.floor(n/4294967296),!0)},r=e=>this.mem.getUint32(e+0,!0)+4294967296*this.mem.getInt32(e+4,!0),i=e=>{const n=this.mem.getFloat64(e,!0);if(0===n)return;if(!isNaN(n))return n;const t=this.mem.getUint32(e,!0);return this._values[t]},o=(e,n)=>{const t=2146959360;if("number"==typeof n&&0!==n)return isNaN(n)?(this.mem.setUint32(e+4,t,!0),void this.mem.setUint32(e,0,!0)):void this.mem.setFloat64(e,n,!0);if(void 0===n)return void this.mem.setFloat64(e,0,!0);let r=this._ids.get(n);void 0===r&&(r=this._idPool.pop(),void 0===r&&(r=this._values.length),this._values[r]=n,this._goRefCounts[r]=0,this._ids.set(n,r)),this._goRefCounts[r]++;let i=0;switch(typeof n){case"object":null!==n&&(i=1);break;case"string":i=2;break;case"symbol":i=3;break;case"function":i=4}this.mem.setUint32(e+4,t|i,!0),this.mem.setUint32(e,r,!0)},_=e=>{const n=r(e+0),t=r(e+8);return new Uint8Array(this._inst.exports.mem.buffer,n,t)},s=e=>{const n=r(e+0),t=r(e+8),o=new Array(t);for(let r=0;r<t;r++)o[r]=i(n+8*r);return o},c=e=>{const n=r(e+0),i=r(e+8);return t.decode(new DataView(this._inst.exports.mem.buffer,n,i))},a=Date.now()-performance.now();this.importObject={_gotest:{add:(e,n)=>e+n,callExport:(e,n)=>(this._inst.exports.testExport0(),this._inst.exports.testExport(e,n))},gojs:{"runtime.wasmExit":e=>{e>>>=0;const n=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(n)},"runtime.wasmWrite":e=>{const n=r((e>>>=0)+8),t=r(e+16),i=this.mem.getInt32(e+24,!0);fs.writeSync(n,new Uint8Array(this._inst.exports.mem.buffer,t,i))},"runtime.resetMemoryDataView":e=>{this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":n=>{e((n>>>=0)+8,1e6*(a+performance.now()))},"runtime.walltime":n=>{n>>>=0;const t=(new Date).getTime();e(n+8,t/1e3),this.mem.setInt32(n+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const n=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(n,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(n);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},r(e+8))),this.mem.setInt32(e+16,n,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const n=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(n)),this._scheduledTimeouts.delete(n)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(_(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const n=this.mem.getUint32(e+8,!0);if(this._goRefCounts[n]--,0===this._goRefCounts[n]){const e=this._values[n];this._values[n]=null,this._ids.delete(e),this._idPool.push(n)}},"syscall/js.stringVal":e=>{o((e>>>=0)+24,c(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const n=Reflect.get(i(e+8),c(e+16));e=this._inst.exports.getsp()>>>0,o(e+32,n)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(i(e+8),c(e+16),i(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(i(e+8),c(e+16))},"syscall/js.valueIndex":e=>{o((e>>>=0)+24,Reflect.get(i(e+8),r(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(i(e+8),r(e+16),i(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const n=i(e+8),t=Reflect.get(n,c(e+16)),r=s(e+32),_=Reflect.apply(t,n,r);e=this._inst.exports.getsp()>>>0,o(e+56,_),this.mem.setUint8(e+64,1)}catch(n){e=this._inst.exports.getsp()>>>0,o(e+56,n),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const n=i(e+8),t=s(e+16),r=Reflect.apply(n,void 0,t);e=this._inst.exports.getsp()>>>0,o(e+40,r),this.mem.setUint8(e+48,1)}catch(n){e=this._inst.exports.getsp()>>>0,o(e+40,n),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const n=i(e+8),t=s(e+16),r=Reflect.construct(n,t);e=this._inst.exports.getsp()>>>0,o(e+40,r),this.mem.setUint8(e+48,1)}catch(n){e=this._inst.exports.getsp()>>>0,o(e+40,n),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":n=>{e((n>>>=0)+16,parseInt(i(n+8).length))},"syscall/js.valuePrepareString":t=>{t>>>=0;const r=n.encode(String(i(t+8)));o(t+16,r),e(t+24,r.length)},"syscall/js.valueLoadString":e=>{const n=i((e>>>=0)+8);_(e+16).set(n)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,i(e+8)instanceof i(e+16)?1:0)},"syscall/js.copyBytesToGo":n=>{const t=_((n>>>=0)+8),r=i(n+32);if(!(r instanceof Uint8Array||r instanceof Uint8ClampedArray))return void this.mem.setUint8(n+48,0);const o=r.subarray(0,t.length);t.set(o),e(n+40,o.length),this.mem.setUint8(n+48,1)},"syscall/js.copyBytesToJS":n=>{const t=i((n>>>=0)+8),r=_(n+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray))return void this.mem.setUint8(n+48,0);const o=r.subarray(0,t.length);t.set(o),e(n+40,o.length),this.mem.setUint8(n+48,1)},debug:e=>{console.log(e)}}}}async run(e){if(!(e instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=e,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let t=4096;const r=e=>{const r=t,i=n.encode(e+"\0");return new Uint8Array(this.mem.buffer,t,i.length).set(i),t+=i.length,t%8!=0&&(t+=8-t%8),r},i=this.argv.length,o=[];this.argv.forEach(e=>{o.push(r(e))}),o.push(0);Object.keys(this.env).sort().forEach(e=>{o.push(r(`${e}=${this.env[e]}`))}),o.push(0);const _=t;o.forEach(e=>{this.mem.setUint32(t,e,!0),this.mem.setUint32(t+4,0,!0),t+=8});if(t>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,_),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(e){const n=this;return function(){const t={id:e,this:this,args:arguments};return n._pendingEvent=t,n._resume(),t.result}}}})();const X=Symbol("Comlink.proxy"),Q=Symbol("Comlink.endpoint"),Z=Symbol("Comlink.releaseProxy"),ee=Symbol("Comlink.finalizer"),ne=Symbol("Comlink.thrown"),te=e=>"object"==typeof e&&null!==e||"function"==typeof e,re={canHandle:e=>te(e)&&e[X],serialize(e){const{port1:n,port2:t}=new MessageChannel;return oe(e,n),[t,[t]]},deserialize(e){return e.start(),function(e,n){const t=new Map;return e.addEventListener("message",function(e){const{data:n}=e;if(!n||!n.id)return;const r=t.get(n.id);if(r)try{r(n)}finally{t.delete(n.id)}}),fe(e,t,[],n)}(e)}},ie=new Map([["proxy",re],["throw",{canHandle:e=>te(e)&&ne in e,serialize({value:e}){let n;return n=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[n,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function oe(e,n=globalThis,t=["*"]){n.addEventListener("message",function r(i){if(!i||!i.data)return;if(!function(e,n){for(const t of e){if(n===t||"*"===t)return!0;if(t instanceof RegExp&&t.test(n))return!0}return!1}(t,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:o,type:_,path:s}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(we);let a;try{const n=s.slice(0,-1).reduce((e,n)=>e[n],e),t=s.reduce((e,n)=>e[n],e);switch(_){case"GET":a=t;break;case"SET":n[s.slice(-1)[0]]=we(i.data.value),a=!0;break;case"APPLY":a=t.apply(n,c);break;case"CONSTRUCT":a=function(e){return Object.assign(e,{[X]:!0})}(new t(...c));break;case"ENDPOINT":{const{port1:n,port2:t}=new MessageChannel;oe(e,t),a=function(e,n){return ge.set(e,n),e}(n,[n])}break;case"RELEASE":a=void 0;break;default:return}}catch(u){a={value:u,[ne]:0}}Promise.resolve(a).catch(e=>({value:e,[ne]:0})).then(t=>{const[i,s]=le(t);n.postMessage(Object.assign(Object.assign({},i),{id:o}),s),"RELEASE"===_&&(n.removeEventListener("message",r),_e(n),ee in e&&"function"==typeof e[ee]&&e[ee]())}).catch(e=>{const[t,r]=le({value:new TypeError("Unserializable return value"),[ne]:0});n.postMessage(Object.assign(Object.assign({},t),{id:o}),r)})}),n.start&&n.start()}function _e(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function se(e){if(e)throw new Error("Proxy has been released and is not useable")}function ce(e){return de(e,new Map,{type:"RELEASE"}).then(()=>{_e(e)})}const ae=new WeakMap,ue="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const n=(ae.get(e)||0)-1;ae.set(e,n),0===n&&ce(e)});function fe(e,n,t=[],r=function(){}){let i=!1;const o=new Proxy(r,{get(r,_){if(se(i),_===Z)return()=>{!function(e){ue&&ue.unregister(e)}(o),ce(e),n.clear(),i=!0};if("then"===_){if(0===t.length)return{then:()=>o};const r=de(e,n,{type:"GET",path:t.map(e=>e.toString())}).then(we);return r.then.bind(r)}return fe(e,n,[...t,_])},set(r,o,_){se(i);const[s,c]=le(_);return de(e,n,{type:"SET",path:[...t,o].map(e=>e.toString()),value:s},c).then(we)},apply(r,o,_){se(i);const s=t[t.length-1];if(s===Q)return de(e,n,{type:"ENDPOINT"}).then(we);if("bind"===s)return fe(e,n,t.slice(0,-1));const[c,a]=be(_);return de(e,n,{type:"APPLY",path:t.map(e=>e.toString()),argumentList:c},a).then(we)},construct(r,o){se(i);const[_,s]=be(o);return de(e,n,{type:"CONSTRUCT",path:t.map(e=>e.toString()),argumentList:_},s).then(we)}});return function(e,n){const t=(ae.get(n)||0)+1;ae.set(n,t),ue&&ue.register(e,n,e)}(o,e),o}function be(e){const n=e.map(le);return[n.map(e=>e[0]),(t=n.map(e=>e[1]),Array.prototype.concat.apply([],t))];var t}const ge=new WeakMap;function le(e){for(const[n,t]of ie)if(t.canHandle(e)){const[r,i]=t.serialize(e);return[{type:"HANDLER",name:n,value:r},i]}return[{type:"RAW",value:e},ge.get(e)||[]]}function we(e){switch(e.type){case"HANDLER":return ie.get(e.name).deserialize(e.value);case"RAW":return e.value}}function de(e,n,t,r){return new Promise(i=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");n.set(o,i),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),r)})}var me;!function(e){e.Loaded="Loaded"}(me||(me={}));const he={uint8array:["application/octet-stream"],json:["application/json","text/json",/application\/json.*/,/text\/json\+.*/],text:["text/plain",/text\/plain.*/,"text/html",/text\/html.*/],formData:["application/x-www-form-urlencoded","multipart/form-data"],blob:[/image\/.*/,/video\/.*/],fallback:"blob"},pe=(e,t)=>n(void 0,void 0,void 0,function*(){switch(t){case"uint8array":return{uint8array:new Uint8Array(yield e.arrayBuffer())};case"json":case"text":return{text:yield e.text()};case"blob":{const n=yield e.blob();return{blobUrl:URL.createObjectURL(n)}}case"formData":{const n={},t=yield e.formData();for(const e of t.entries()){const[t,r]=e;n[t]=r}return{formData:n}}default:return{}}}),ye=(e,n)=>{if(!n)return!1;if(!e)return!1;for(let t=0;t<n.length;t+=1){const r=n[t];if("string"==typeof r&&e===r)return!0;if(r.test&&r.test(e))return!0}return!1};function ve(){return n(this,void 0,void 0,function*(){const{mixFetch:e}=self;let t=he;var i;oe({mixFetch:(r,i)=>n(this,void 0,void 0,function*(){console.log("[Worker] --- mixFetch ---",{url:r,args:i});const o=yield e(r,i);console.log("[Worker]",{response:o,json:JSON.stringify(o,null,2)});const _=yield((e,t)=>n(void 0,void 0,void 0,function*(){const n=Object.assign(Object.assign({},he),t),r=(e=>{if(e)return e.headers.has("Content-Type")?e.headers.get("Content-Type"):e.headers.has("content-type")?e.headers.get("content-type"):void 0})(e);return r?ye(r,n.uint8array)?pe(e,"uint8array"):ye(r,n.json)?pe(e,"json"):ye(r,n.text)?pe(e,"text"):ye(r,n.formData)?pe(e,"formData"):ye(r,n.blob)?pe(e,"blob"):{}:e.body?pe(e,(null==t?void 0:t.fallback)||"blob"):{}}))(o,t);console.log("[Worker]",{bodyResponse:_});const s={};o.headers.forEach((e,n)=>{s[n]=e});const c={body:_,url:o.url,headers:s,status:o.status,statusText:o.statusText,type:o.type,ok:o.ok,redirected:o.redirected};return console.log("[Worker]",{output:c}),c}),setupMixFetch:e=>n(this,void 0,void 0,function*(){console.log("[Worker] --- setupMixFetch ---",{opts:e}),(null==e?void 0:e.responseBodyConfigMap)&&(t=e.responseBodyConfigMap),yield function(e){return r.setupMixFetch(e)}(e||{})}),disconnectMixFetch:()=>n(this,void 0,void 0,function*(){console.log("[Worker] --- disconnectMixFetch ---"),yield r.disconnectMixFetch()})}),i={kind:me.Loaded,args:{loaded:!0}},self.postMessage(i)})}(function(){return n(this,void 0,void 0,function*(){yield J(),yield ve()})})().catch(e=>console.error("Unhandled exception in mixFetch worker",e))}();
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
@@ -0,0 +1,2 @@
1
+ /*! For license information please see web-worker-0.js.LICENSE.txt */
2
+ !function(){"use strict";var e="undefined"!=typeof document?document.currentScript:null;function n(e,n,t,r){return new(t||(t=Promise))(function(i,o){function _(e){try{c(r.next(e))}catch(n){o(n)}}function s(e){try{c(r.throw(e))}catch(n){o(n)}}function c(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t(function(e){e(n)})).then(_,s)}c((r=r.apply(e,n||[])).next())})}function t(e,n,t,r){function i(e,n,t){var r=t?WebAssembly.instantiateStreaming:WebAssembly.instantiate,i=t?WebAssembly.compileStreaming:WebAssembly.compile;return n?r(e,n):i(e)}var o=null;if(n)return i(fetch(n),r,!0);var _=globalThis.atob(t),s=_.length;o=new Uint8Array(new ArrayBuffer(s));for(var c=0;c<s;c++)o[c]=_.charCodeAt(c);if(e){var a=new WebAssembly.Module(o);return r?new WebAssembly.Instance(a,r):a}return i(o,r,!1)}let r;"function"==typeof SuppressedError&&SuppressedError;let i=0,o=null;function _(){return null!==o&&0!==o.byteLength||(o=new Uint8Array(r.memory.buffer)),o}const s="undefined"!=typeof TextEncoder?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},c="function"==typeof s.encodeInto?function(e,n){return s.encodeInto(e,n)}:function(e,n){const t=s.encode(e);return n.set(t),{read:e.length,written:t.length}};function a(e,n,t){if(void 0===t){const t=s.encode(e),r=n(t.length,1)>>>0;return _().subarray(r,r+t.length).set(t),i=t.length,r}let r=e.length,o=n(r,1)>>>0;const a=_();let u=0;for(;u<r;u++){const n=e.charCodeAt(u);if(n>127)break;a[o+u]=n}if(u!==r){0!==u&&(e=e.slice(u)),o=t(o,r,r=u+3*e.length,1)>>>0;const n=_().subarray(o+u,o+r);u+=c(e,n).written,o=t(o,r,u,1)>>>0}return i=u,o}let u=null;function f(){return(null===u||!0===u.buffer.detached||void 0===u.buffer.detached&&u.buffer!==r.memory.buffer)&&(u=new DataView(r.memory.buffer)),u}function b(e){const n=r.__externref_table_alloc();return r.__wbindgen_export_4.set(n,e),n}function g(e,n){try{return e.apply(this,n)}catch(t){const e=b(t);r.__wbindgen_exn_store(e)}}const l="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};function w(e,n){return e>>>=0,l.decode(_().subarray(e,e+n))}function d(e){return null==e}function m(e,n){return e>>>=0,_().subarray(e/1,e/1+n)}"undefined"!=typeof TextDecoder&&l.decode();const h="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>{r.__wbindgen_export_6.get(e.dtor)(e.a,e.b)});function p(e,n,t,i){const o={a:e,b:n,cnt:1,dtor:t},_=(...e)=>{o.cnt++;const n=o.a;o.a=0;try{return i(n,o.b,...e)}finally{0===--o.cnt?(r.__wbindgen_export_6.get(o.dtor)(n,o.b),h.unregister(o)):o.a=n}};return _.original=o,h.register(_,o,o),_}function y(e){const n=typeof e;if("number"==n||"boolean"==n||null==e)return`${e}`;if("string"==n)return`"${e}"`;if("symbol"==n){const n=e.description;return null==n?"Symbol":`Symbol(${n})`}if("function"==n){const n=e.name;return"string"==typeof n&&n.length>0?`Function(${n})`:"Function"}if(Array.isArray(e)){const n=e.length;let t="[";n>0&&(t+=y(e[0]));for(let r=1;r<n;r++)t+=", "+y(e[r]);return t+="]",t}const t=/\[object ([^\]]+)\]/.exec(toString.call(e));let r;if(!(t&&t.length>1))return toString.call(e);if(r=t[1],"Object"==r)try{return"Object("+JSON.stringify(e)+")"}catch(i){return"Object"}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}function v(e,n){const t=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i,s=function(e,n){const t=n(1*e.length,1)>>>0;return _().set(e,t/1),i=e.length,t}(n,r.__wbindgen_malloc),c=i;return r.send_client_data(t,o,s,c)}function x(e){const n=r.__wbindgen_export_4.get(e);return r.__externref_table_dealloc(e),n}function R(){const e=r.mix_fetch_initialised();if(e[2])throw x(e[1]);return 0!==e[0]}function E(e){const n=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),t=i;return r.start_new_mixnet_connection(n,t)}function T(e){const n=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),t=i;return r.finish_mixnet_connection(n,t)}function S(e,n,t){const i=r.closure743_externref_shim_multivalue_shim(e,n,t);if(i[1])throw x(i[0])}function j(e,n,t){r.closure830_externref_shim(e,n,t)}function I(e,n){r._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h061f9c2866052d32(e,n)}function F(e,n){r._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h67f1322bcb5f40b5(e,n)}function A(e,n){r._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb7fef82722851829(e,n)}function k(e,n,t){r.closure2203_externref_shim(e,n,t)}function O(e,n){r._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7ea245616776fb08(e,n)}function U(e,n){r._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h75596235482477c3(e,n)}function W(e,n,t){r.closure2326_externref_shim(e,n,t)}const C=["blob","arraybuffer"],D=["pending","done"],z=["readonly","readwrite","versionchange","readwriteflush","cleanup"],M=["default","no-store","reload","no-cache","force-cache","only-if-cached"],L=["omit","same-origin","include"],B=["same-origin","no-cors","cors","navigate"];"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_acknowledgementswasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_anonymoussendertag_free(e>>>0,1));const P="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>r.__wbg_clientstorage_free(e>>>0,1));class N{static __wrap(e){e>>>=0;const n=Object.create(N.prototype);return n.__wbg_ptr=e,P.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,P.unregister(this),e}free(){const e=this.__destroy_into_raw();r.__wbg_clientstorage_free(e,0)}static new_unencrypted(e){const n=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),t=i;return r.clientstorage_new_unencrypted(n,t)}constructor(e,n){const t=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i,_=a(n,r.__wbindgen_malloc,r.__wbindgen_realloc),s=i;return r.clientstorage_new(t,o,_,s)}static new_async(e,n){const t=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;var _=d(n)?0:a(n,r.__wbindgen_malloc,r.__wbindgen_realloc),s=i;return r.clientstorage_new_async(t,o,_,s)}}"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_covertrafficwasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_debugwasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_forgetmewasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_gatewayconnectionwasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_mixfetch_free(e>>>0,1));const q="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>r.__wbg_mixfetchclient_free(e>>>0,1));class G{static __wrap(e){e>>>=0;const n=Object.create(G.prototype);return n.__wbg_ptr=e,q.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,q.unregister(this),e}free(){const e=this.__destroy_into_raw();r.__wbg_mixfetchclient_free(e,0)}disconnect(){return r.mixfetchclient_disconnect(this.__wbg_ptr)}self_address(){let e,n;try{const t=r.mixfetchclient_self_address(this.__wbg_ptr);return e=t[0],n=t[1],w(t[0],t[1])}finally{r.__wbindgen_free(e,n,1)}}constructor(e,n,t,o){!function(e,n){if(!(e instanceof n))throw new Error(`expected instance of ${n.name}`)}(e,$);var _=e.__destroy_into_raw(),s=d(t)?0:a(t,r.__wbindgen_malloc,r.__wbindgen_realloc),c=i,u=d(o)?0:a(o,r.__wbindgen_malloc,r.__wbindgen_realloc),f=i;return r.mixfetchclient_new(_,n,s,c,u,f)}active(){return 0!==r.mixfetchclient_active(this.__wbg_ptr)}}"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_mixfetchclientbuilder_free(e>>>0,1));const V="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>r.__wbg_mixfetchconfig_free(e>>>0,1));class ${static __wrap(e){e>>>=0;const n=Object.create($.prototype);return n.__wbg_ptr=e,V.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,V.unregister(this),e}free(){const e=this.__destroy_into_raw();r.__wbg_mixfetchconfig_free(e,0)}with_mix_fetch_timeout(e){const n=this.__destroy_into_raw(),t=r.mixfetchconfig_with_mix_fetch_timeout(n,e);return $.__wrap(t)}constructor(e,n){const t=a(e,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i,_=r.mixfetchconfig_new(t,o,d(n)?0:b(n));if(_[2])throw x(_[1]);return this.__wbg_ptr=_[0]>>>0,V.register(this,this.__wbg_ptr,this),this}}function H(){const e={wbg:{}};return e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(e,n){const t=a(String(n),r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbg_String_eecc4a11987127d6=function(e,n){const t=a(String(n),r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbg_Window_41559019033ede94=function(e){return e.Window},e.wbg.__wbg_WorkerGlobalScope_d324bffbeaef9f3a=function(e){return e.WorkerGlobalScope},e.wbg.__wbg_abort_410ec47a64ac6117=function(e,n){e.abort(n)},e.wbg.__wbg_abort_775ef1d17fc65868=function(e){e.abort()},e.wbg.__wbg_abort_99fc644e2c79c9fb=function(){return g(function(e){e.abort()},arguments)},e.wbg.__wbg_addEventListener_84ae3eac6e15480a=function(){return g(function(e,n,t,r,i){e.addEventListener(w(n,t),r,i)},arguments)},e.wbg.__wbg_addEventListener_90e553fdce254421=function(){return g(function(e,n,t,r){e.addEventListener(w(n,t),r)},arguments)},e.wbg.__wbg_append_8c7dd8d641a5f01b=function(){return g(function(e,n,t,r,i){e.append(w(n,t),w(r,i))},arguments)},e.wbg.__wbg_arrayBuffer_d1b44c4390db422f=function(){return g(function(e){return e.arrayBuffer()},arguments)},e.wbg.__wbg_bound_f2afc3766d4545cf=function(){return g(function(e,n,t,r){return IDBKeyRange.bound(e,n,0!==t,0!==r)},arguments)},e.wbg.__wbg_buffer_609cc3eee51ed158=function(e){return e.buffer},e.wbg.__wbg_call_672a4d21634d4a24=function(){return g(function(e,n){return e.call(n)},arguments)},e.wbg.__wbg_call_7cccdd69e0791ae2=function(){return g(function(e,n,t){return e.call(n,t)},arguments)},e.wbg.__wbg_clearInterval_dd1e598f425db353=function(e){return clearInterval(e)},e.wbg.__wbg_clearTimeout_3b5c565a5ec539dd=function(e){return clearTimeout(e)},e.wbg.__wbg_clientstorage_new=function(e){return N.__wrap(e)},e.wbg.__wbg_close_2893b7d056a0627d=function(){return g(function(e){e.close()},arguments)},e.wbg.__wbg_code_f4ec1e6e2e1b0417=function(e){return e.code},e.wbg.__wbg_commit_a54edce65f3858f2=function(){return g(function(e){e.commit()},arguments)},e.wbg.__wbg_count_9dbedee4d2474ff8=function(){return g(function(e,n){return e.count(n)},arguments)},e.wbg.__wbg_createObjectStore_e566459f7161f82f=function(){return g(function(e,n,t){return e.createObjectStore(w(n,t))},arguments)},e.wbg.__wbg_crypto_574e78ad8b13b65f=function(e){return e.crypto},e.wbg.__wbg_data_432d9c3df2630942=function(e){return e.data},e.wbg.__wbg_dispatchEvent_9e259d7c1d603dfb=function(){return g(function(e,n){return e.dispatchEvent(n)},arguments)},e.wbg.__wbg_done_769e5ede4b31c67b=function(e){return e.done},e.wbg.__wbg_entries_2a52db465d0421fb=function(e){return e.entries()},e.wbg.__wbg_entries_3265d4158b33e5dc=function(e){return Object.entries(e)},e.wbg.__wbg_error_3cfd4be637595be7=function(e,n){console.error(w(e,n))},e.wbg.__wbg_error_e98c298703cffa97=function(e,n){console.error(w(e,n))},e.wbg.__wbg_error_ff4ddaabdfc5dbb3=function(){return g(function(e){const n=e.error;return d(n)?0:b(n)},arguments)},e.wbg.__wbg_fetch_16dcf1cfbbc66b3c=function(e){return fetch(e)},e.wbg.__wbg_fetch_509096533071c657=function(e,n){return e.fetch(n)},e.wbg.__wbg_from_2a5d3e218e67aa85=function(e){return Array.from(e)},e.wbg.__wbg_getAllKeys_b11d8835dc4be0e8=function(){return g(function(e){return e.getAllKeys()},arguments)},e.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e=function(){return g(function(e,n){e.getRandomValues(n)},arguments)},e.wbg.__wbg_getTime_46267b1c24877e30=function(e){return e.getTime()},e.wbg.__wbg_get_67b2ba62fc30de12=function(){return g(function(e,n){return Reflect.get(e,n)},arguments)},e.wbg.__wbg_get_8da03f81f6a1111e=function(){return g(function(e,n){return e.get(n)},arguments)},e.wbg.__wbg_get_b9b93047fe3cf45b=function(e,n){return e[n>>>0]},e.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(e,n){return e[n]},e.wbg.__wbg_getwithrefkey_6550b2c093d2eb18=function(e,n){return e[n]},e.wbg.__wbg_global_f5c2926e57ba457f=function(e){return e.global},e.wbg.__wbg_goWasmCloseRemoteSocket_992b677524fcede8=function(e,n){let t,i;try{t=e,i=n,__go_rs_bridge__.goWasmCloseRemoteSocket(w(e,n))}finally{r.__wbindgen_free(t,i,1)}},e.wbg.__wbg_goWasmInjectConnError_b927894206725a9c=function(e,n,t,i){let o,_,s,c;try{o=e,_=n,s=t,c=i,__go_rs_bridge__.goWasmInjectConnError(w(e,n),w(t,i))}finally{r.__wbindgen_free(o,_,1),r.__wbindgen_free(s,c,1)}},e.wbg.__wbg_goWasmInjectServerData_40f1c53f7ca870d5=function(e,n,t,i){let o,_;try{o=e,_=n;var s=m(t,i).slice();r.__wbindgen_free(t,1*i,1),__go_rs_bridge__.goWasmInjectServerData(w(e,n),s)}finally{r.__wbindgen_free(o,_,1)}},e.wbg.__wbg_goWasmSetMixFetchRequestTimeout_74f591ac382a0775=function(e){__go_rs_bridge__.goWasmSetMixFetchRequestTimeout(e>>>0)},e.wbg.__wbg_has_a5ea9117f258a0ec=function(){return g(function(e,n){return Reflect.has(e,n)},arguments)},e.wbg.__wbg_headers_9cb51cfd2ac780a4=function(e){return e.headers},e.wbg.__wbg_indexedDB_54f01430b1e194e8=function(){return g(function(e){const n=e.indexedDB;return d(n)?0:b(n)},arguments)},e.wbg.__wbg_indexedDB_b1f49280282046f8=function(){return g(function(e){const n=e.indexedDB;return d(n)?0:b(n)},arguments)},e.wbg.__wbg_indexedDB_f6b47b0dc333fd2f=function(){return g(function(e){const n=e.indexedDB;return d(n)?0:b(n)},arguments)},e.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc=function(e){let n;try{n=e instanceof ArrayBuffer}catch(t){n=!1}return n},e.wbg.__wbg_instanceof_DomException_ed1ccb7aaf39034c=function(e){let n;try{n=e instanceof DOMException}catch(t){n=!1}return n},e.wbg.__wbg_instanceof_Error_4d54113b22d20306=function(e){let n;try{n=e instanceof Error}catch(t){n=!1}return n},e.wbg.__wbg_instanceof_IdbDatabase_a3ef009ca00059f9=function(e){let n;try{n=e instanceof IDBDatabase}catch(t){n=!1}return n},e.wbg.__wbg_instanceof_IdbRequest_4813c3f207666aa4=function(e){let n;try{n=e instanceof IDBRequest}catch(t){n=!1}return n},e.wbg.__wbg_instanceof_Response_f2cc20d9f7dfd644=function(e){let n;try{n=e instanceof Response}catch(t){n=!1}return n},e.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9=function(e){let n;try{n=e instanceof Uint8Array}catch(t){n=!1}return n},e.wbg.__wbg_isArray_a1eab7e0d067391b=function(e){return Array.isArray(e)},e.wbg.__wbg_isSafeInteger_343e2beeeece1bb0=function(e){return Number.isSafeInteger(e)},e.wbg.__wbg_iterator_9a24c88df860dc65=function(){return Symbol.iterator},e.wbg.__wbg_length_a446193dc22c12f8=function(e){return e.length},e.wbg.__wbg_length_e2d2a49132c1b256=function(e){return e.length},e.wbg.__wbg_log_72cb694afa6a0fe7=function(e,n){console.log(w(e,n))},e.wbg.__wbg_lowerBound_1872d19f5bcf83c6=function(){return g(function(e,n){return IDBKeyRange.lowerBound(e,0!==n)},arguments)},e.wbg.__wbg_message_5c5d919204d42400=function(e,n){const t=a(n.message,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbg_message_97a2af9b89d693a3=function(e){return e.message},e.wbg.__wbg_mixfetchclient_new=function(e){return G.__wrap(e)},e.wbg.__wbg_msCrypto_a61aeb35a24c1329=function(e){return e.msCrypto},e.wbg.__wbg_name_0b327d569f00ebee=function(e){return e.name},e.wbg.__wbg_name_f2d27098bfd843e7=function(e,n){const t=a(n.name,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbg_new0_f788a2397c7ca929=function(){return new Date},e.wbg.__wbg_new_018dcc2d6c8c2f6a=function(){return g(function(){return new Headers},arguments)},e.wbg.__wbg_new_23a2665fac83c611=function(e,n){try{var t={a:e,b:n};const i=new Promise((e,n)=>{const i=t.a;t.a=0;try{return function(e,n,t,i){r.closure2942_externref_shim(e,n,t,i)}(i,t.b,e,n)}finally{t.a=i}});return i}finally{t.a=t.b=0}},e.wbg.__wbg_new_405e22f390576ce2=function(){return new Object},e.wbg.__wbg_new_5e0be73521bc8c17=function(){return new Map},e.wbg.__wbg_new_78feb108b6472713=function(){return new Array},e.wbg.__wbg_new_92c54fc74574ef55=function(){return g(function(e,n){return new WebSocket(w(e,n))},arguments)},e.wbg.__wbg_new_a12002a7f91c75be=function(e){return new Uint8Array(e)},e.wbg.__wbg_new_c68d7209be747379=function(e,n){return new Error(w(e,n))},e.wbg.__wbg_new_e25e5aab09ff45db=function(){return g(function(){return new AbortController},arguments)},e.wbg.__wbg_newnoargs_105ed471475aaf50=function(e,n){return new Function(w(e,n))},e.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(e,n,t){return new Uint8Array(e,n>>>0,t>>>0)},e.wbg.__wbg_newwitheventinitdict_502dbfa1b3d2fcbc=function(){return g(function(e,n,t){return new CloseEvent(w(e,n),t)},arguments)},e.wbg.__wbg_newwithlength_a381634e90c276d4=function(e){return new Uint8Array(e>>>0)},e.wbg.__wbg_newwithstrandinit_06c535e0a867c635=function(){return g(function(e,n,t){return new Request(w(e,n),t)},arguments)},e.wbg.__wbg_next_25feadfc0913fea9=function(e){return e.next},e.wbg.__wbg_next_6574e1a8a62d1055=function(){return g(function(e){return e.next()},arguments)},e.wbg.__wbg_node_905d3e251edff8a2=function(e){return e.node},e.wbg.__wbg_now_e1163c67115ff874=function(e){return e.now()},e.wbg.__wbg_objectStore_21878d46d25b64b6=function(){return g(function(e,n,t){return e.objectStore(w(n,t))},arguments)},e.wbg.__wbg_oldVersion_e8337811e52861c6=function(e){return e.oldVersion},e.wbg.__wbg_open_e0c0b2993eb596e1=function(){return g(function(e,n,t,r){return e.open(w(n,t),r>>>0)},arguments)},e.wbg.__wbg_performance_7fe0928f3ab059e5=function(e){return e.performance},e.wbg.__wbg_postMessage_83a8d58d3fcb6c13=function(){return g(function(e,n){e.postMessage(n)},arguments)},e.wbg.__wbg_process_dc0fbacc7c1c06f7=function(e){return e.process},e.wbg.__wbg_put_066faa31a6a88f5b=function(){return g(function(e,n,t){return e.put(n,t)},arguments)},e.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5=function(e){queueMicrotask(e)},e.wbg.__wbg_queueMicrotask_d3219def82552485=function(e){return e.queueMicrotask},e.wbg.__wbg_randomFillSync_ac0988aba3254290=function(){return g(function(e,n){e.randomFillSync(n)},arguments)},e.wbg.__wbg_readyState_4013cfdf4f22afb0=function(e){const n=e.readyState;return(D.indexOf(n)+1||3)-1},e.wbg.__wbg_readyState_7ef6e63c349899ed=function(e){return e.readyState},e.wbg.__wbg_reason_49f1cede8bcf23dd=function(e,n){const t=a(n.reason,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbg_reject_b3fcf99063186ff7=function(e){return Promise.reject(e)},e.wbg.__wbg_removeEventListener_056dfe8c3d6c58f9=function(){return g(function(e,n,t,r){e.removeEventListener(w(n,t),r)},arguments)},e.wbg.__wbg_require_60cc747a6bc5215a=function(){return g(function(){return module.require},arguments)},e.wbg.__wbg_resolve_4851785c9c5f573d=function(e){return Promise.resolve(e)},e.wbg.__wbg_result_f29afabdf2c05826=function(){return g(function(e){return e.result},arguments)},e.wbg.__wbg_send_0293179ba074ffb4=function(){return g(function(e,n,t){e.send(w(n,t))},arguments)},e.wbg.__wbg_send_fc0c204e8a1757f4=function(){return g(function(e,n,t){e.send(m(n,t))},arguments)},e.wbg.__wbg_setInterval_ed3b5e3c3ebb8a6d=function(){return g(function(e,n){return setInterval(e,n)},arguments)},e.wbg.__wbg_setTimeout_42370cb3051b8c2c=function(){return g(function(e,n,t){return e.setTimeout(n,t)},arguments)},e.wbg.__wbg_setTimeout_8f06012fba12034e=function(e,n){globalThis.setTimeout(e,n)},e.wbg.__wbg_setTimeout_cb2a856ba8315e7a=function(e,n){return setTimeout(e,n)},e.wbg.__wbg_set_37837023f3d740e8=function(e,n,t){e[n>>>0]=t},e.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,t){e[n]=t},e.wbg.__wbg_set_65595bdd868b3009=function(e,n,t){e.set(n,t>>>0)},e.wbg.__wbg_set_8fc6bf8a5b1071d1=function(e,n,t){return e.set(n,t)},e.wbg.__wbg_setbinaryType_92fa1ffd873b327c=function(e,n){e.binaryType=C[n]},e.wbg.__wbg_setbody_5923b78a95eedf29=function(e,n){e.body=n},e.wbg.__wbg_setcache_12f17c3a980650e4=function(e,n){e.cache=M[n]},e.wbg.__wbg_setcode_156060465a2f8f79=function(e,n){e.code=n},e.wbg.__wbg_setcredentials_c3a22f1cd105a2c6=function(e,n){e.credentials=L[n]},e.wbg.__wbg_setheaders_834c0bdb6a8949ad=function(e,n){e.headers=n},e.wbg.__wbg_setmethod_3c5280fe5d890842=function(e,n,t){e.method=w(n,t)},e.wbg.__wbg_setmode_5dc300b865044b65=function(e,n){e.mode=B[n]},e.wbg.__wbg_setonabort_3bf4db6614fa98e9=function(e,n){e.onabort=n},e.wbg.__wbg_setonce_0cb80aea26303a35=function(e,n){e.once=0!==n},e.wbg.__wbg_setoncomplete_4d19df0dadb7c4d4=function(e,n){e.oncomplete=n},e.wbg.__wbg_setonerror_b0d9d723b8fddbbb=function(e,n){e.onerror=n},e.wbg.__wbg_setonerror_d7e3056cc6e56085=function(e,n){e.onerror=n},e.wbg.__wbg_setonsuccess_afa464ee777a396d=function(e,n){e.onsuccess=n},e.wbg.__wbg_setonupgradeneeded_fcf7ce4f2eb0cb5f=function(e,n){e.onupgradeneeded=n},e.wbg.__wbg_setreason_d29ac0402eeeb81a=function(e,n,t){e.reason=w(n,t)},e.wbg.__wbg_setsignal_75b21ef3a81de905=function(e,n){e.signal=n},e.wbg.__wbg_signal_aaf9ad74119f20a4=function(e){return e.signal},e.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){const e="undefined"==typeof global?null:global;return d(e)?0:b(e)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){const e="undefined"==typeof globalThis?null:globalThis;return d(e)?0:b(e)},e.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){const e="undefined"==typeof self?null:self;return d(e)?0:b(e)},e.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){const e="undefined"==typeof window?null:window;return d(e)?0:b(e)},e.wbg.__wbg_status_f6360336ca686bf0=function(e){return e.status},e.wbg.__wbg_subarray_aa9065fa9dc5df96=function(e,n,t){return e.subarray(n>>>0,t>>>0)},e.wbg.__wbg_target_0a62d9d79a2a1ede=function(e){const n=e.target;return d(n)?0:b(n)},e.wbg.__wbg_text_7805bea50de2af49=function(){return g(function(e){return e.text()},arguments)},e.wbg.__wbg_then_44b73946d2fb3e7d=function(e,n){return e.then(n)},e.wbg.__wbg_then_48b406749878a531=function(e,n,t){return e.then(n,t)},e.wbg.__wbg_toString_5285597960676b7b=function(e){return e.toString()},e.wbg.__wbg_toString_c813bbd34d063839=function(e){return e.toString()},e.wbg.__wbg_transaction_7d452475ef3c3c33=function(e){return e.transaction},e.wbg.__wbg_transaction_babc423936946a37=function(){return g(function(e,n,t,r){return e.transaction(w(n,t),z[r])},arguments)},e.wbg.__wbg_upperBound_76a00814e81f6891=function(){return g(function(e,n){return IDBKeyRange.upperBound(e,0!==n)},arguments)},e.wbg.__wbg_url_ae10c34ca209681d=function(e,n){const t=a(n.url,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbg_value_cd1ffa7b1ab794f1=function(e){return e.value},e.wbg.__wbg_versions_c01dfd4722a88165=function(e){return e.versions},e.wbg.__wbg_warn_a2e6ac466681f75e=function(e,n){console.warn(w(e,n))},e.wbg.__wbg_wasClean_605b4fd66d44354a=function(e){return e.wasClean},e.wbg.__wbindgen_as_number=function(e){return+e},e.wbg.__wbindgen_bigint_from_i64=function(e){return e},e.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},e.wbg.__wbindgen_bigint_get_as_i64=function(e,n){const t="bigint"==typeof n?n:void 0;f().setBigInt64(e+8,d(t)?BigInt(0):t,!0),f().setInt32(e+0,!d(t),!0)},e.wbg.__wbindgen_boolean_get=function(e){return"boolean"==typeof e?e?1:0:2},e.wbg.__wbindgen_cb_drop=function(e){const n=e.original;if(1==n.cnt--)return n.a=0,!0;return!1},e.wbg.__wbindgen_closure_wrapper3948=function(e,n,t){return p(e,n,744,S)},e.wbg.__wbindgen_closure_wrapper4932=function(e,n,t){return p(e,n,831,j)},e.wbg.__wbindgen_closure_wrapper4933=function(e,n,t){return p(e,n,829,I)},e.wbg.__wbindgen_closure_wrapper5925=function(e,n,t){return p(e,n,1132,F)},e.wbg.__wbindgen_closure_wrapper8465=function(e,n,t){return p(e,n,1996,A)},e.wbg.__wbindgen_closure_wrapper9290=function(e,n,t){return p(e,n,2202,k)},e.wbg.__wbindgen_closure_wrapper9292=function(e,n,t){return p(e,n,2202,O)},e.wbg.__wbindgen_closure_wrapper9294=function(e,n,t){return p(e,n,2202,k)},e.wbg.__wbindgen_closure_wrapper9296=function(e,n,t){return p(e,n,2202,k)},e.wbg.__wbindgen_closure_wrapper9742=function(e,n,t){return p(e,n,2316,U)},e.wbg.__wbindgen_closure_wrapper9780=function(e,n,t){return p(e,n,2327,W)},e.wbg.__wbindgen_debug_string=function(e,n){const t=a(y(n),r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;f().setInt32(e+4,o,!0),f().setInt32(e+0,t,!0)},e.wbg.__wbindgen_error_new=function(e,n){return new Error(w(e,n))},e.wbg.__wbindgen_in=function(e,n){return e in n},e.wbg.__wbindgen_init_externref_table=function(){const e=r.__wbindgen_export_4,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},e.wbg.__wbindgen_is_bigint=function(e){return"bigint"==typeof e},e.wbg.__wbindgen_is_function=function(e){return"function"==typeof e},e.wbg.__wbindgen_is_null=function(e){return null===e},e.wbg.__wbindgen_is_object=function(e){return"object"==typeof e&&null!==e},e.wbg.__wbindgen_is_string=function(e){return"string"==typeof e},e.wbg.__wbindgen_is_undefined=function(e){return void 0===e},e.wbg.__wbindgen_jsval_eq=function(e,n){return e===n},e.wbg.__wbindgen_jsval_loose_eq=function(e,n){return e==n},e.wbg.__wbindgen_memory=function(){return r.memory},e.wbg.__wbindgen_number_get=function(e,n){const t="number"==typeof n?n:void 0;f().setFloat64(e+8,d(t)?0:t,!0),f().setInt32(e+0,!d(t),!0)},e.wbg.__wbindgen_number_new=function(e){return e},e.wbg.__wbindgen_string_get=function(e,n){const t="string"==typeof n?n:void 0;var o=d(t)?0:a(t,r.__wbindgen_malloc,r.__wbindgen_realloc),_=i;f().setInt32(e+4,_,!0),f().setInt32(e+0,o,!0)},e.wbg.__wbindgen_string_new=function(e,n){return w(e,n)},e.wbg.__wbindgen_throw=function(e,n){throw new Error(w(e,n))},e}async function K(n){if(void 0!==r)return r;void 0!==n&&(Object.getPrototypeOf(n)===Object.prototype?({module_or_path:n}=n):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===n&&(n=new URL("mix_fetch_wasm_bg.wasm",e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("worker.js",document.baseURI).href));const t=H();("string"==typeof n||"function"==typeof Request&&n instanceof Request||"function"==typeof URL&&n instanceof URL)&&(n=fetch(n));const{instance:i,module:_}=await async function(e,n){if("function"==typeof Response&&e instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(e,n)}catch(t){if("application/wasm"==e.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const r=await e.arrayBuffer();return await WebAssembly.instantiate(r,n)}{const t=await WebAssembly.instantiate(e,n);return t instanceof WebAssembly.Instance?{instance:t,module:e}:t}}(await n,t);return function(e,n){return r=e.exports,K.__wbindgen_wasm_module=n,u=null,o=null,r.__wbindgen_start(),r}(i,_)}function Y(){return n(this,void 0,void 0,function*(){const e=yield t(0,new URL("go_conn.wasm",import.meta.url),null,n);var n;const r=new Go,i=yield WebAssembly.instantiate(e,r.importObject);r.run(i)})}function J(){return n(this,void 0,void 0,function*(){const e=yield t(0,new URL("mix_fetch_wasm_bg.wasm",import.meta.url),null,n);var n;yield K(e),console.log("Loaded RUST WASM"),yield Y(),console.log("Loaded GO WASM"),r.set_panic_hook(),function(){const e={send_client_data:v,start_new_mixnet_connection:E,mix_fetch_initialised:R,finish_mixnet_connection:T};self.__rs_go_bridge__=e}()})}"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_mixfetchdebug_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_remembermewasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_replysurbswasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_statsreportingwasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_topologywasm_free(e>>>0,1)),"undefined"==typeof FinalizationRegistry||new FinalizationRegistry(e=>r.__wbg_trafficwasm_free(e>>>0,1)),(()=>{const e=()=>{const e=new Error("not implemented");return e.code="ENOSYS",e};if(!globalThis.fs){let n="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1,O_DIRECTORY:-1},writeSync(e,r){n+=t.decode(r);const i=n.lastIndexOf("\n");return-1!=i&&(console.log(n.substring(0,i)),n=n.substring(i+1)),r.length},write(n,t,r,i,o,_){if(0!==r||i!==t.length||null!==o)return void _(e());_(null,this.writeSync(n,t))},chmod(n,t,r){r(e())},chown(n,t,r,i){i(e())},close(n,t){t(e())},fchmod(n,t,r){r(e())},fchown(n,t,r,i){i(e())},fstat(n,t){t(e())},fsync(e,n){n(null)},ftruncate(n,t,r){r(e())},lchown(n,t,r,i){i(e())},link(n,t,r){r(e())},lstat(n,t){t(e())},mkdir(n,t,r){r(e())},open(n,t,r,i){i(e())},read(n,t,r,i,o,_){_(e())},readdir(n,t){t(e())},readlink(n,t){t(e())},rename(n,t,r){r(e())},rmdir(n,t){t(e())},stat(n,t){t(e())},symlink(n,t,r){r(e())},truncate(n,t,r){r(e())},unlink(n,t){t(e())},utimes(n,t,r,i){i(e())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw e()},pid:-1,ppid:-1,umask(){throw e()},cwd(){throw e()},chdir(){throw e()}}),globalThis.path||(globalThis.path={resolve(...e){return e.join("/")}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const n=new TextEncoder("utf-8"),t=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{0!==e&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const e=(e,n)=>{this.mem.setUint32(e+0,n,!0),this.mem.setUint32(e+4,Math.floor(n/4294967296),!0)},r=e=>this.mem.getUint32(e+0,!0)+4294967296*this.mem.getInt32(e+4,!0),i=e=>{const n=this.mem.getFloat64(e,!0);if(0===n)return;if(!isNaN(n))return n;const t=this.mem.getUint32(e,!0);return this._values[t]},o=(e,n)=>{const t=2146959360;if("number"==typeof n&&0!==n)return isNaN(n)?(this.mem.setUint32(e+4,t,!0),void this.mem.setUint32(e,0,!0)):void this.mem.setFloat64(e,n,!0);if(void 0===n)return void this.mem.setFloat64(e,0,!0);let r=this._ids.get(n);void 0===r&&(r=this._idPool.pop(),void 0===r&&(r=this._values.length),this._values[r]=n,this._goRefCounts[r]=0,this._ids.set(n,r)),this._goRefCounts[r]++;let i=0;switch(typeof n){case"object":null!==n&&(i=1);break;case"string":i=2;break;case"symbol":i=3;break;case"function":i=4}this.mem.setUint32(e+4,t|i,!0),this.mem.setUint32(e,r,!0)},_=e=>{const n=r(e+0),t=r(e+8);return new Uint8Array(this._inst.exports.mem.buffer,n,t)},s=e=>{const n=r(e+0),t=r(e+8),o=new Array(t);for(let r=0;r<t;r++)o[r]=i(n+8*r);return o},c=e=>{const n=r(e+0),i=r(e+8);return t.decode(new DataView(this._inst.exports.mem.buffer,n,i))},a=Date.now()-performance.now();this.importObject={_gotest:{add:(e,n)=>e+n,callExport:(e,n)=>(this._inst.exports.testExport0(),this._inst.exports.testExport(e,n))},gojs:{"runtime.wasmExit":e=>{e>>>=0;const n=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(n)},"runtime.wasmWrite":e=>{const n=r((e>>>=0)+8),t=r(e+16),i=this.mem.getInt32(e+24,!0);fs.writeSync(n,new Uint8Array(this._inst.exports.mem.buffer,t,i))},"runtime.resetMemoryDataView":e=>{this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":n=>{e((n>>>=0)+8,1e6*(a+performance.now()))},"runtime.walltime":n=>{n>>>=0;const t=(new Date).getTime();e(n+8,t/1e3),this.mem.setInt32(n+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const n=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(n,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(n);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},r(e+8))),this.mem.setInt32(e+16,n,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const n=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(n)),this._scheduledTimeouts.delete(n)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(_(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const n=this.mem.getUint32(e+8,!0);if(this._goRefCounts[n]--,0===this._goRefCounts[n]){const e=this._values[n];this._values[n]=null,this._ids.delete(e),this._idPool.push(n)}},"syscall/js.stringVal":e=>{o((e>>>=0)+24,c(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const n=Reflect.get(i(e+8),c(e+16));e=this._inst.exports.getsp()>>>0,o(e+32,n)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(i(e+8),c(e+16),i(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(i(e+8),c(e+16))},"syscall/js.valueIndex":e=>{o((e>>>=0)+24,Reflect.get(i(e+8),r(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(i(e+8),r(e+16),i(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const n=i(e+8),t=Reflect.get(n,c(e+16)),r=s(e+32),_=Reflect.apply(t,n,r);e=this._inst.exports.getsp()>>>0,o(e+56,_),this.mem.setUint8(e+64,1)}catch(n){e=this._inst.exports.getsp()>>>0,o(e+56,n),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const n=i(e+8),t=s(e+16),r=Reflect.apply(n,void 0,t);e=this._inst.exports.getsp()>>>0,o(e+40,r),this.mem.setUint8(e+48,1)}catch(n){e=this._inst.exports.getsp()>>>0,o(e+40,n),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const n=i(e+8),t=s(e+16),r=Reflect.construct(n,t);e=this._inst.exports.getsp()>>>0,o(e+40,r),this.mem.setUint8(e+48,1)}catch(n){e=this._inst.exports.getsp()>>>0,o(e+40,n),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":n=>{e((n>>>=0)+16,parseInt(i(n+8).length))},"syscall/js.valuePrepareString":t=>{t>>>=0;const r=n.encode(String(i(t+8)));o(t+16,r),e(t+24,r.length)},"syscall/js.valueLoadString":e=>{const n=i((e>>>=0)+8);_(e+16).set(n)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,i(e+8)instanceof i(e+16)?1:0)},"syscall/js.copyBytesToGo":n=>{const t=_((n>>>=0)+8),r=i(n+32);if(!(r instanceof Uint8Array||r instanceof Uint8ClampedArray))return void this.mem.setUint8(n+48,0);const o=r.subarray(0,t.length);t.set(o),e(n+40,o.length),this.mem.setUint8(n+48,1)},"syscall/js.copyBytesToJS":n=>{const t=i((n>>>=0)+8),r=_(n+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray))return void this.mem.setUint8(n+48,0);const o=r.subarray(0,t.length);t.set(o),e(n+40,o.length),this.mem.setUint8(n+48,1)},debug:e=>{console.log(e)}}}}async run(e){if(!(e instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=e,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let t=4096;const r=e=>{const r=t,i=n.encode(e+"\0");return new Uint8Array(this.mem.buffer,t,i.length).set(i),t+=i.length,t%8!=0&&(t+=8-t%8),r},i=this.argv.length,o=[];this.argv.forEach(e=>{o.push(r(e))}),o.push(0);Object.keys(this.env).sort().forEach(e=>{o.push(r(`${e}=${this.env[e]}`))}),o.push(0);const _=t;o.forEach(e=>{this.mem.setUint32(t,e,!0),this.mem.setUint32(t+4,0,!0),t+=8});if(t>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,_),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(e){const n=this;return function(){const t={id:e,this:this,args:arguments};return n._pendingEvent=t,n._resume(),t.result}}}})();const X=Symbol("Comlink.proxy"),Q=Symbol("Comlink.endpoint"),Z=Symbol("Comlink.releaseProxy"),ee=Symbol("Comlink.finalizer"),ne=Symbol("Comlink.thrown"),te=e=>"object"==typeof e&&null!==e||"function"==typeof e,re={canHandle:e=>te(e)&&e[X],serialize(e){const{port1:n,port2:t}=new MessageChannel;return oe(e,n),[t,[t]]},deserialize(e){return e.start(),function(e,n){const t=new Map;return e.addEventListener("message",function(e){const{data:n}=e;if(!n||!n.id)return;const r=t.get(n.id);if(r)try{r(n)}finally{t.delete(n.id)}}),fe(e,t,[],n)}(e)}},ie=new Map([["proxy",re],["throw",{canHandle:e=>te(e)&&ne in e,serialize({value:e}){let n;return n=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[n,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function oe(e,n=globalThis,t=["*"]){n.addEventListener("message",function r(i){if(!i||!i.data)return;if(!function(e,n){for(const t of e){if(n===t||"*"===t)return!0;if(t instanceof RegExp&&t.test(n))return!0}return!1}(t,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:o,type:_,path:s}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(we);let a;try{const n=s.slice(0,-1).reduce((e,n)=>e[n],e),t=s.reduce((e,n)=>e[n],e);switch(_){case"GET":a=t;break;case"SET":n[s.slice(-1)[0]]=we(i.data.value),a=!0;break;case"APPLY":a=t.apply(n,c);break;case"CONSTRUCT":a=function(e){return Object.assign(e,{[X]:!0})}(new t(...c));break;case"ENDPOINT":{const{port1:n,port2:t}=new MessageChannel;oe(e,t),a=function(e,n){return ge.set(e,n),e}(n,[n])}break;case"RELEASE":a=void 0;break;default:return}}catch(u){a={value:u,[ne]:0}}Promise.resolve(a).catch(e=>({value:e,[ne]:0})).then(t=>{const[i,s]=le(t);n.postMessage(Object.assign(Object.assign({},i),{id:o}),s),"RELEASE"===_&&(n.removeEventListener("message",r),_e(n),ee in e&&"function"==typeof e[ee]&&e[ee]())}).catch(e=>{const[t,r]=le({value:new TypeError("Unserializable return value"),[ne]:0});n.postMessage(Object.assign(Object.assign({},t),{id:o}),r)})}),n.start&&n.start()}function _e(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function se(e){if(e)throw new Error("Proxy has been released and is not useable")}function ce(e){return de(e,new Map,{type:"RELEASE"}).then(()=>{_e(e)})}const ae=new WeakMap,ue="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const n=(ae.get(e)||0)-1;ae.set(e,n),0===n&&ce(e)});function fe(e,n,t=[],r=function(){}){let i=!1;const o=new Proxy(r,{get(r,_){if(se(i),_===Z)return()=>{!function(e){ue&&ue.unregister(e)}(o),ce(e),n.clear(),i=!0};if("then"===_){if(0===t.length)return{then:()=>o};const r=de(e,n,{type:"GET",path:t.map(e=>e.toString())}).then(we);return r.then.bind(r)}return fe(e,n,[...t,_])},set(r,o,_){se(i);const[s,c]=le(_);return de(e,n,{type:"SET",path:[...t,o].map(e=>e.toString()),value:s},c).then(we)},apply(r,o,_){se(i);const s=t[t.length-1];if(s===Q)return de(e,n,{type:"ENDPOINT"}).then(we);if("bind"===s)return fe(e,n,t.slice(0,-1));const[c,a]=be(_);return de(e,n,{type:"APPLY",path:t.map(e=>e.toString()),argumentList:c},a).then(we)},construct(r,o){se(i);const[_,s]=be(o);return de(e,n,{type:"CONSTRUCT",path:t.map(e=>e.toString()),argumentList:_},s).then(we)}});return function(e,n){const t=(ae.get(n)||0)+1;ae.set(n,t),ue&&ue.register(e,n,e)}(o,e),o}function be(e){const n=e.map(le);return[n.map(e=>e[0]),(t=n.map(e=>e[1]),Array.prototype.concat.apply([],t))];var t}const ge=new WeakMap;function le(e){for(const[n,t]of ie)if(t.canHandle(e)){const[r,i]=t.serialize(e);return[{type:"HANDLER",name:n,value:r},i]}return[{type:"RAW",value:e},ge.get(e)||[]]}function we(e){switch(e.type){case"HANDLER":return ie.get(e.name).deserialize(e.value);case"RAW":return e.value}}function de(e,n,t,r){return new Promise(i=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");n.set(o,i),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),r)})}var me;!function(e){e.Loaded="Loaded"}(me||(me={}));const he={uint8array:["application/octet-stream"],json:["application/json","text/json",/application\/json.*/,/text\/json\+.*/],text:["text/plain",/text\/plain.*/,"text/html",/text\/html.*/],formData:["application/x-www-form-urlencoded","multipart/form-data"],blob:[/image\/.*/,/video\/.*/],fallback:"blob"},pe=(e,t)=>n(void 0,void 0,void 0,function*(){switch(t){case"uint8array":return{uint8array:new Uint8Array(yield e.arrayBuffer())};case"json":case"text":return{text:yield e.text()};case"blob":{const n=yield e.blob();return{blobUrl:URL.createObjectURL(n)}}case"formData":{const n={},t=yield e.formData();for(const e of t.entries()){const[t,r]=e;n[t]=r}return{formData:n}}default:return{}}}),ye=(e,n)=>{if(!n)return!1;if(!e)return!1;for(let t=0;t<n.length;t+=1){const r=n[t];if("string"==typeof r&&e===r)return!0;if(r.test&&r.test(e))return!0}return!1};function ve(){return n(this,void 0,void 0,function*(){const{mixFetch:e}=self;let t=he;var i;oe({mixFetch:(r,i)=>n(this,void 0,void 0,function*(){console.log("[Worker] --- mixFetch ---",{url:r,args:i});const o=yield e(r,i);console.log("[Worker]",{response:o,json:JSON.stringify(o,null,2)});const _=yield((e,t)=>n(void 0,void 0,void 0,function*(){const n=Object.assign(Object.assign({},he),t),r=(e=>{if(e)return e.headers.has("Content-Type")?e.headers.get("Content-Type"):e.headers.has("content-type")?e.headers.get("content-type"):void 0})(e);return r?ye(r,n.uint8array)?pe(e,"uint8array"):ye(r,n.json)?pe(e,"json"):ye(r,n.text)?pe(e,"text"):ye(r,n.formData)?pe(e,"formData"):ye(r,n.blob)?pe(e,"blob"):{}:e.body?pe(e,(null==t?void 0:t.fallback)||"blob"):{}}))(o,t);console.log("[Worker]",{bodyResponse:_});const s={};o.headers.forEach((e,n)=>{s[n]=e});const c={body:_,url:o.url,headers:s,status:o.status,statusText:o.statusText,type:o.type,ok:o.ok,redirected:o.redirected};return console.log("[Worker]",{output:c}),c}),setupMixFetch:e=>n(this,void 0,void 0,function*(){console.log("[Worker] --- setupMixFetch ---",{opts:e}),(null==e?void 0:e.responseBodyConfigMap)&&(t=e.responseBodyConfigMap),yield function(e){return r.setupMixFetch(e)}(e||{})}),disconnectMixFetch:()=>n(this,void 0,void 0,function*(){console.log("[Worker] --- disconnectMixFetch ---"),yield r.disconnectMixFetch()})}),i={kind:me.Loaded,args:{loaded:!0}},self.postMessage(i)})}(function(){return n(this,void 0,void 0,function*(){yield J(),yield ve()})})().catch(e=>console.error("Unhandled exception in mixFetch worker",e))}();
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
@@ -512,6 +512,10 @@ export function makeContextApi(ai) {
512
512
  async changeLogSettings(settings) {
513
513
  const newSettings = { ...ai.props.state.logSettings, ...settings }
514
514
  ai.props.dispatch({ type: 'CHANGE_LOG_SETTINGS', payload: newSettings })
515
+ },
516
+
517
+ async setAttestationToken(token) {
518
+ ai.props.dispatch({ type: 'SET_ATTESTATION_TOKEN', payload: token })
515
519
  }
516
520
  }
517
521
  bridgifyObject(out)
@@ -22,7 +22,6 @@ import { asLoginPayload } from '../../types/server-cleaners'
22
22
 
23
23
 
24
24
  import { base58 } from '../../util/encoding'
25
- import { validateServer } from '../../util/validateServer'
26
25
 
27
26
  import { applyLoginPayload } from '../login/login'
28
27
  import { wasLoginStash } from '../login/login-stash'
@@ -32,6 +31,20 @@ import { makeRepoPaths, saveChanges } from '../storage/repo'
32
31
  import { FakeDb } from './fake-db'
33
32
  import { makeFakeServer } from './fake-server'
34
33
 
34
+ /**
35
+ * Account infrastructure hosts that stay on the in-memory fake server when
36
+ * `allowNetworkAccess` is enabled. Change servers and everything else use
37
+ * real `io.fetch`.
38
+ */
39
+ function isFakeAccountInfrastructure(uri) {
40
+ try {
41
+ const { hostname } = new URL(uri)
42
+ return /^(login|info|sync)[a-z0-9-]*\.edge(test)?\.app$/i.test(hostname)
43
+ } catch (e) {
44
+ return false
45
+ }
46
+ }
47
+
35
48
  async function saveLogin(io, user) {
36
49
  const { lastLogin, server } = user
37
50
  const loginId = base64.parse(user.loginId)
@@ -114,12 +127,10 @@ export function makeFakeWorld(
114
127
  const fetch = !allowNetworkAccess
115
128
  ? fakeFetch
116
129
  : (uri, opts) => {
117
- try {
118
- validateServer(uri) // Throws for non-Edge servers.
119
- } catch (error) {
120
- return io.fetch(uri, opts)
130
+ if (isFakeAccountInfrastructure(uri)) {
131
+ return fakeFetch(uri, opts)
121
132
  }
122
- return fakeFetch(uri, opts)
133
+ return io.fetch(uri, opts)
123
134
  }
124
135
 
125
136
  const fakeIo = {
@@ -117,7 +117,7 @@ export function loginFetchInner(
117
117
  body
118
118
  ) {
119
119
  const { state, io, log } = ai.props
120
- const { apiKey, apiSecret } = state.login
120
+ const { apiKey, apiSecret, attestationToken } = state.login
121
121
 
122
122
  const bodyText =
123
123
  method === 'GET' || body == null
@@ -138,7 +138,10 @@ export function loginFetchInner(
138
138
  headers: {
139
139
  'content-type': 'application/json',
140
140
  accept: 'application/json',
141
- authorization
141
+ authorization,
142
+ ...(attestationToken != null
143
+ ? { 'x-attestation-token': attestationToken }
144
+ : {})
142
145
  },
143
146
  corsBypass: 'never'
144
147
  }
@@ -28,6 +28,7 @@ import { findPin2Stash } from './pin2'
28
28
 
29
29
 
30
30
 
31
+
31
32
  export const login = buildReducer({
32
33
  apiKey(state = '', action) {
33
34
  return action.type === 'INIT' ? action.payload.apiKey : state
@@ -37,6 +38,13 @@ export const login = buildReducer({
37
38
  return action.type === 'INIT' ? _nullishCoalesce(action.payload.apiSecret, () => ( null)) : state
38
39
  },
39
40
 
41
+ attestationToken(state = null, action) {
42
+ if (action.type !== 'SET_ATTESTATION_TOKEN') return state
43
+ const token = action.payload
44
+ // Treat empty string like clear so we never send x-attestation-token: ''.
45
+ return token == null || token === '' ? null : token
46
+ },
47
+
40
48
  contextAppId(state = '', action) {
41
49
  return action.type === 'INIT' ? action.payload.appId : state
42
50
  },
@@ -3,7 +3,7 @@
3
3
  import { makeLog } from '../../core/log/log'
4
4
 
5
5
  import { scrypt } from '../../util/crypto/scrypt'
6
- import { initMixFetch } from '../../util/nym'
6
+ import { initMixFetch, mixFetchOptions } from '../../util/nym'
7
7
  import { fetchCorsProxy } from './fetch-cors-proxy'
8
8
 
9
9
  // Only try CORS proxy/bridge techniques up to 5 times
@@ -50,7 +50,14 @@ export function makeBrowserIo(logBackend) {
50
50
 
51
51
  if (privacy === 'nym') {
52
52
  const nymFetch = await initMixFetch(log)
53
- return await nymFetch(uri, opts)
53
+ return await nymFetch(
54
+ uri,
55
+ {
56
+ ...opts,
57
+ mode: 'unsafe-ignore-cors'
58
+ },
59
+ mixFetchOptions
60
+ )
54
61
  }
55
62
  if (corsBypass === 'always') {
56
63
  return await fetchCorsProxy(uri, opts)
@@ -17,7 +17,7 @@ import { makeLog } from '../../core/log/log'
17
17
 
18
18
 
19
19
 
20
- import { initMixFetch } from '../../util/nym'
20
+ import { initMixFetch, mixFetchOptions } from '../../util/nym'
21
21
  import { hideProperties } from '../hidden-properties'
22
22
  import { makeNativeBridge } from './native-bridge'
23
23
  import { YAOB_THROTTLE_MS } from './react-native-types'
@@ -177,7 +177,15 @@ async function makeIo(logBackend) {
177
177
 
178
178
  if (privacy === 'nym') {
179
179
  const nymFetch = await initMixFetch(log)
180
- return await nymFetch(uri, opts)
180
+ const response = await nymFetch(
181
+ uri,
182
+ {
183
+ ...opts,
184
+ mode: 'unsafe-ignore-cors'
185
+ },
186
+ mixFetchOptions
187
+ )
188
+ return response
181
189
  }
182
190
  if (corsBypass === 'always') {
183
191
  return await nativeFetch(uri, opts)
package/lib/node/index.js CHANGED
@@ -597,21 +597,6 @@ const utf8 = {
597
597
  }
598
598
  };
599
599
 
600
- /**
601
- * We only accept *.edge.app or localhost as valid domain names.
602
- */
603
- function validateServer(server) {
604
- const url = new URL(server);
605
- if (url.protocol === 'http:' || url.protocol === 'ws:') {
606
- if (url.hostname === 'localhost') return;
607
- }
608
- if (url.protocol === 'https:' || url.protocol === 'wss:') {
609
- if (url.hostname === 'localhost') return;
610
- if (/^([A-Za-z0-9_-]+\.)*edge(test)?\.app$/.test(url.hostname)) return;
611
- }
612
- throw new Error(`Only *.edge.app or localhost are valid login domain names, not ${url.hostname}`);
613
- }
614
-
615
600
  /*
616
601
  * These are errors the core knows about.
617
602
  *
@@ -1485,7 +1470,8 @@ function loginFetchInner(ai, serverUri, method, path, body) {
1485
1470
  } = ai.props;
1486
1471
  const {
1487
1472
  apiKey,
1488
- apiSecret
1473
+ apiSecret,
1474
+ attestationToken
1489
1475
  } = state.login;
1490
1476
  const bodyText = method === 'GET' || body == null ? undefined : JSON.stringify(wasLoginRequestBody(body));
1491
1477
 
@@ -1502,7 +1488,10 @@ function loginFetchInner(ai, serverUri, method, path, body) {
1502
1488
  headers: {
1503
1489
  'content-type': 'application/json',
1504
1490
  accept: 'application/json',
1505
- authorization
1491
+ authorization,
1492
+ ...(attestationToken != null ? {
1493
+ 'x-attestation-token': attestationToken
1494
+ } : {})
1506
1495
  },
1507
1496
  corsBypass: 'never'
1508
1497
  };
@@ -2447,6 +2436,49 @@ function makeAuthJson(stashTree, sessionKey) {
2447
2436
  throw new Error('No server authentication methods available');
2448
2437
  }
2449
2438
 
2439
+ /**
2440
+ * We only accept *.edge.app, localhost, or (for http/ws only) private LAN IPv4.
2441
+ * https/wss still require localhost or *.edge(test)?.app; private IPs are not
2442
+ * accepted on secure schemes.
2443
+ */
2444
+ function validateServer(server) {
2445
+ const url = new URL(server);
2446
+ if (url.protocol === 'http:' || url.protocol === 'ws:') {
2447
+ if (isPrivateHost(url.hostname)) return;
2448
+ }
2449
+ if (url.protocol === 'https:' || url.protocol === 'wss:') {
2450
+ if (url.hostname === 'localhost') return;
2451
+ if (/^([A-Za-z0-9_-]+\.)*edge(test)?\.app$/.test(url.hostname)) return;
2452
+ }
2453
+ throw new Error(`Only *.edge.app, localhost, or private LAN addresses (http/ws) are valid login domain names, not ${url.hostname}`);
2454
+ }
2455
+ function isPrivateHost(hostname) {
2456
+ if (hostname === 'localhost') return true;
2457
+ const octets = parseIpv4(hostname);
2458
+ if (octets == null) return false;
2459
+ const [a, b] = octets;
2460
+ if (a === 127) return true;
2461
+ if (a === 10) return true;
2462
+ if (a === 192 && b === 168) return true;
2463
+ if (a === 172 && b >= 16 && b <= 31) return true;
2464
+ return false;
2465
+ }
2466
+ function parseIpv4(hostname) {
2467
+ const parts = hostname.split('.');
2468
+ if (parts.length !== 4) return null;
2469
+ const octets = [];
2470
+ for (const part of parts) {
2471
+ if (!/^\d{1,3}$/.test(part)) return null;
2472
+ const n = Number(part);
2473
+ if (!Number.isInteger(n) || n < 0 || n > 255) return null;
2474
+ // Reject leading zeros like 010.0.0.1 which are not canonical dotted-quad
2475
+ // when they reach this helper (URL parsing may already rewrite some forms).
2476
+ if (part.length > 1 && part.startsWith('0')) return null;
2477
+ octets.push(n);
2478
+ }
2479
+ return octets;
2480
+ }
2481
+
2450
2482
  /**
2451
2483
  * A wrapper that knows how to load and save JSON files,
2452
2484
  * with parsing, stringifying, and cleaning.
@@ -11843,6 +11875,12 @@ function makeContextApi(ai) {
11843
11875
  type: 'CHANGE_LOG_SETTINGS',
11844
11876
  payload: newSettings
11845
11877
  });
11878
+ },
11879
+ async setAttestationToken(token) {
11880
+ ai.props.dispatch({
11881
+ type: 'SET_ATTESTATION_TOKEN',
11882
+ payload: token
11883
+ });
11846
11884
  }
11847
11885
  };
11848
11886
  yaob.bridgifyObject(out);
@@ -12815,6 +12853,12 @@ const login = reduxKeto.buildReducer({
12815
12853
  apiSecret(state = null, action) {
12816
12854
  return action.type === 'INIT' ? action.payload.apiSecret ?? null : state;
12817
12855
  },
12856
+ attestationToken(state = null, action) {
12857
+ if (action.type !== 'SET_ATTESTATION_TOKEN') return state;
12858
+ const token = action.payload;
12859
+ // Treat empty string like clear so we never send x-attestation-token: ''.
12860
+ return token == null || token === '' ? null : token;
12861
+ },
12818
12862
  contextAppId(state = '', action) {
12819
12863
  return action.type === 'INIT' ? action.payload.appId : state;
12820
12864
  },
@@ -14385,6 +14429,21 @@ function makeFakeServer(db) {
14385
14429
  return out;
14386
14430
  }
14387
14431
 
14432
+ /**
14433
+ * Account infrastructure hosts that stay on the in-memory fake server when
14434
+ * `allowNetworkAccess` is enabled. Change servers and everything else use
14435
+ * real `io.fetch`.
14436
+ */
14437
+ function isFakeAccountInfrastructure(uri) {
14438
+ try {
14439
+ const {
14440
+ hostname
14441
+ } = new URL(uri);
14442
+ return /^(login|info|sync)[a-z0-9-]*\.edge(test)?\.app$/i.test(hostname);
14443
+ } catch {
14444
+ return false;
14445
+ }
14446
+ }
14388
14447
  async function saveLogin(io, user) {
14389
14448
  const {
14390
14449
  lastLogin,
@@ -14452,12 +14511,10 @@ function makeFakeWorld(ios, logBackend, users) {
14452
14511
  } = opts;
14453
14512
  const fakeFetch = serverlet.makeFetchFunction(fakeServer);
14454
14513
  const fetch = !allowNetworkAccess ? fakeFetch : (uri, opts) => {
14455
- try {
14456
- validateServer(uri); // Throws for non-Edge servers.
14457
- } catch (error) {
14458
- return io.fetch(uri, opts);
14514
+ if (isFakeAccountInfrastructure(uri)) {
14515
+ return fakeFetch(uri, opts);
14459
14516
  }
14460
- return fakeFetch(uri, opts);
14517
+ return io.fetch(uri, opts);
14461
14518
  };
14462
14519
  const fakeIo = {
14463
14520
  ...io,
@@ -2239,6 +2239,13 @@ export * from './server-types'
2239
2239
 
2240
2240
 
2241
2241
 
2242
+
2243
+
2244
+
2245
+
2246
+
2247
+
2248
+
2242
2249
 
2243
2250
 
2244
2251