jazz-tools 2.0.0-beta.0 → 2.0.0-beta.1
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.
- package/README.md +73 -73
- package/dist/backend/inspector-ui/11.js +2 -2
- package/dist/backend/inspector-ui/12.js +2 -2
- package/dist/backend/inspector-ui/13.js +2 -2
- package/dist/backend/inspector-ui/14.js +2 -2
- package/dist/backend/inspector-ui/20.js +1 -1
- package/dist/backend/inspector-ui-files.js +4 -4
- package/dist/backend/vercel-store.d.ts.map +1 -1
- package/dist/backend/vercel-store.js +2 -1
- package/dist/backend/vercel-store.js.map +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{index-DUKUt96e.js → index-hYDvY1xo.js} +3 -3
- package/dist/dev/inspector-overlay/embedded/assets/{jazz-broker-worker-C_mr9Omd.js → jazz-broker-worker-Ul47m6zU.js} +2 -2
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm-BOvbCHn3.js → jazz_wasm-zkCtl8wp.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm_bg-BG8gazqt.wasm → jazz_wasm_bg-xKxGDG9o.wasm} +0 -0
- package/dist/dev/inspector-overlay/embedded/embedded.html +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.d.ts +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.js +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.d.ts +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.js +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprints.d.ts +2 -2
- package/dist/worker/jazz-broker-worker.js +2 -2
- package/dist/worker/jazz_wasm_bg.wasm +0 -0
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=Object.getOwnPropertyNames,n=(e,n)=>function(){return e&&(n=(0,e[t(e)[0]])(e=0)),n},r=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},i={};r(i,{PendingNativeRead:()=>ve,StreamingMutation:()=>ye,UpstreamLink:()=>be,WasmDb:()=>xe,WasmPendingSubscription:()=>Se,WasmPermissionAdviceRequest:()=>Ce,WasmTransport:()=>M,WasmWrite:()=>N,__testBindingCodecGoldenFixture:()=>a,__testValidateWireFrameBatchCorpus:()=>o,__testWireFrameCorpusFeatures:()=>s,captureTextAnchor:()=>c,captureTextRange:()=>l,currentTimestamp:()=>u,default:()=>_e,deriveUserId:()=>d,drainTraceEntries:()=>f,generateId:()=>p,init:()=>m,initSync:()=>ge,mintAnonymousToken:()=>h,mintLocalFirstToken:()=>g,nativeArtifactFingerprint:()=>_,resolveTextAnchor:()=>ee,resolveTextRange:()=>v,setJsonSchemaValidator:()=>y,setTraceEntryCollectionEnabled:()=>te,subscribeTraceEntries:()=>ne,validateSchema:()=>re});function a(){let e,t;try{let n=F.__testBindingCodecGoldenFixture();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function o(e,t,n){let r=k(e,F.__wbindgen_malloc),i=P,a=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=F.__testValidateWireFrameBatchCorpus(r,i,a,o,s,c);if(l[1])throw j(l[0])}function s(){let e,t;try{let n=F.__testWireFrameCorpusFeatures();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function c(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=F.captureTextAnchor(i,a,!D(t),D(t)?0:t,n,r);if(o[2])throw j(o[1]);return j(o[0])}function l(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=F.captureTextRange(i,a,!D(t),D(t)?0:t,n,r);if(o[2])throw j(o[1]);return j(o[0])}function u(){let e=F.currentTimestamp();return BigInt.asUintN(64,e)}function d(e){let t,n;try{let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=F.deriveUserId(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,j(s[2]);return t=r,n=i,T(r,i)}finally{F.__wbindgen_free(t,n,1)}}function f(){return F.drainTraceEntries()}function p(){let e,t;try{let n=F.generateId();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function m(){F.init()}function h(e,t,n,r){let i,a;try{let c=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P,u=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),d=P,f=F.mintAnonymousToken(c,l,u,d,n,r);var o=f[0],s=f[1];if(f[3])throw o=0,s=0,j(f[2]);return i=o,a=s,T(o,s)}finally{F.__wbindgen_free(i,a,1)}}function g(e,t,n,r){let i,a;try{let c=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P,u=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),d=P,f=F.mintLocalFirstToken(c,l,u,d,n,r);var o=f[0],s=f[1];if(f[3])throw o=0,s=0,j(f[2]);return i=o,a=s,T(o,s)}finally{F.__wbindgen_free(i,a,1)}}function _(){let e,t;try{let n=F.nativeArtifactFingerprint();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function ee(e,t,n){let r=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=F.resolveTextAnchor(e,r,i,!D(n),D(n)?0:n);if(a[2])throw j(a[1]);return j(a[0])}function v(e,t,n){let r=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=F.resolveTextRange(e,r,i,!D(n),D(n)?0:n);if(a[2])throw j(a[1]);return j(a[0])}function y(e){F.setJsonSchemaValidator(e)}function te(e){F.setTraceEntryCollectionEnabled(e)}function ne(e){return F.subscribeTraceEntries(e)}function re(e){let t=k(e,F.__wbindgen_malloc),n=P,r=F.validateSchema(t,n);if(r[1])throw j(r[0])}function b(){return{__proto__:null,"./jazz_wasm_bg.js":{__proto__:null,__wbg_Error_2e59b1b37a9a34c3:function(e,t){return Error(T(e,t))},__wbg_Number_e6ffdb596c888833:function(e){return Number(e)},__wbg_String_8564e559799eccda:function(e,t){let n=A(String(t),F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;w().setInt32(e+4,r,!0),w().setInt32(e+0,n,!0)},__wbg_Window_70131fc0c91e4b3c:function(e){return e.Window},__wbg_WorkerGlobalScope_601c48015b8cc78e:function(e){return e.WorkerGlobalScope},__wbg___wbindgen_bigint_get_as_i64_2c5082002e4826e2:function(e,t){let n=t,r=typeof n==`bigint`?n:void 0;w().setBigInt64(e+8,D(r)?BigInt(0):r,!0),w().setInt32(e+0,!D(r),!0)},__wbg___wbindgen_boolean_get_a86c216575a75c30:function(e){let t=e,n=typeof t==`boolean`?t:void 0;return D(n)?16777215:+!!n},__wbg___wbindgen_debug_string_dd5d2d07ce9e6c57:function(e,t){let n=A(ue(t),F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;w().setInt32(e+4,r,!0),w().setInt32(e+0,n,!0)},__wbg___wbindgen_in_4bd7a57e54337366:function(e,t){return e in t},__wbg___wbindgen_is_bigint_6c98f7e945dacdde:function(e){return typeof e==`bigint`},__wbg___wbindgen_is_function_49868bde5eb1e745:function(e){return typeof e==`function`},__wbg___wbindgen_is_null_344c8750a8525473:function(e){return e===null},__wbg___wbindgen_is_object_40c5a80572e8f9d3:function(e){let t=e;return typeof t==`object`&&!!t},__wbg___wbindgen_is_string_b29b5c5a8065ba1a:function(e){return typeof e==`string`},__wbg___wbindgen_is_undefined_c0cca72b82b86f4d:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_7d430e744a913d26:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944:function(e,t){return e==t},__wbg___wbindgen_number_get_7579aab02a8a620c:function(e,t){let n=t,r=typeof n==`number`?n:void 0;w().setFloat64(e+8,D(r)?0:r,!0),w().setInt32(e+0,!D(r),!0)},__wbg___wbindgen_string_get_914df97fcfa788f2:function(e,t){let n=t,r=typeof n==`string`?n:void 0;var i=D(r)?0:A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P;w().setInt32(e+4,a,!0),w().setInt32(e+0,i,!0)},__wbg___wbindgen_throw_81fc77679af83bc6:function(e,t){throw Error(T(e,t))},__wbg__wbg_cb_unref_3c3b4f651835fbcb:function(e){e._wbg_cb_unref()},__wbg_abort_cfab06d16d2d33a6:function(){return E(function(e){e.abort()},arguments)},__wbg_bound_88db1072ea68e901:function(){return E(function(e,t,n,r){return IDBKeyRange.bound(e,t,n!==0,r!==0)},arguments)},__wbg_call_368fa9c372d473ba:function(){return E(function(e,t,n,r){return e.call(t,n,r)},arguments)},__wbg_call_7f2987183bb62793:function(){return E(function(e,t){return e.call(t)},arguments)},__wbg_call_d578befcc3145dee:function(){return E(function(e,t,n){return e.call(t,n)},arguments)},__wbg_commit_e9c1332714c53826:function(){return E(function(e){e.commit()},arguments)},__wbg_construct_adeb3d5948c3d19a:function(){return E(function(e,t){return Reflect.construct(e,t)},arguments)},__wbg_createObjectStore_6e567b25160be2fa:function(){return E(function(e,t,n,r){return e.createObjectStore(T(t,n),r)},arguments)},__wbg_delete_fc24bd7dfa57938e:function(){return E(function(e,t){return e.delete(t)},arguments)},__wbg_done_547d467e97529006:function(e){return e.done},__wbg_entries_616b1a459b85be0b:function(e){return Object.entries(e)},__wbg_error_58469b8474e13592:function(){return E(function(e){let t=e.error;return D(t)?0:S(t)},arguments)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(T(e,t))}finally{F.__wbindgen_free(n,r,1)}},__wbg_getAll_93336699ea033b51:function(){return E(function(e,t){return e.getAll(t)},arguments)},__wbg_getDate_bafac038eaae076e:function(e){return e.getDate()},__wbg_getDay_6eebc8fe9cb183f5:function(e){return e.getDay()},__wbg_getFullYear_8f83597f7403c865:function(e){return e.getFullYear()},__wbg_getHours_81348c8e800060e7:function(e){return e.getHours()},__wbg_getMinutes_bd1ccf17dab913bf:function(e){return e.getMinutes()},__wbg_getMonth_288607689622719c:function(e){return e.getMonth()},__wbg_getRandomValues_15134f5c0ae6b0d0:function(){return E(function(e,t){globalThis.crypto.getRandomValues(C(e,t))},arguments)},__wbg_getRandomValues_d49329ff89a07af1:function(){return E(function(e,t){globalThis.crypto.getRandomValues(C(e,t))},arguments)},__wbg_getSeconds_edef7266627a185f:function(e){return e.getSeconds()},__wbg_getTime_f6ac312467f7cf09:function(e){return e.getTime()},__wbg_getTimezoneOffset_ac5be603b21a5797:function(e){return e.getTimezoneOffset()},__wbg_get_4848e350b40afc16:function(e,t){return e[t>>>0]},__wbg_get_ed0642c4b9d31ddf:function(){return E(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_f96702c6245e4ef9:function(){return E(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_unchecked_7d7babe32e9e6a54:function(e,t){return e[t>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(e,t){return e[t]},__wbg_global_e30ac0b7684506d0:function(e){return e.global},__wbg_has_3ec5c22db2e5237a:function(){return E(function(e,t){return Reflect.has(e,t)},arguments)},__wbg_indexedDB_065ce3ad400579e3:function(){return E(function(e){let t=e.indexedDB;return D(t)?0:S(t)},arguments)},__wbg_indexedDB_a2139150e2ea2a08:function(){return E(function(e){let t=e.indexedDB;return D(t)?0:S(t)},arguments)},__wbg_indexedDB_af74cb6df65fa636:function(){return E(function(e){let t=e.indexedDB;return D(t)?0:S(t)},arguments)},__wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_DomException_37f96d3fb69189bd:function(e){let t;try{t=e instanceof DOMException}catch{t=!1}return t},__wbg_instanceof_Error_e3390d6805733dad:function(e){let t;try{t=e instanceof Error}catch{t=!1}return t},__wbg_instanceof_IdbDatabase_0af111edb4be95f4:function(e){let t;try{t=e instanceof IDBDatabase}catch{t=!1}return t},__wbg_instanceof_IdbRequest_fc5918c726448f04:function(e){let t;try{t=e instanceof IDBRequest}catch{t=!1}return t},__wbg_instanceof_Map_a10a2795ef4bfe97:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_Uint8Array_4b8da683deb25d72:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_db61795ad004c139:function(e){return Array.isArray(e)},__wbg_isSafeInteger_ea83862ba994770c:function(e){return Number.isSafeInteger(e)},__wbg_iterator_de403ef31815a3e6:function(){return Symbol.iterator},__wbg_length_0c32cb8543c8e4c8:function(e){return e.length},__wbg_length_6e821edde497a532:function(e){return e.length},__wbg_log_6a8b55ee2e172f54:function(e,t,n,r,i,a,o,s){let c,l;try{c=e,l=t,console.log(T(e,t),T(n,r),T(i,a),T(o,s))}finally{F.__wbindgen_free(c,l,1)}},__wbg_lowerBound_279c232a69ac0f79:function(){return E(function(e,t){return IDBKeyRange.lowerBound(e,t!==0)},arguments)},__wbg_message_52a9425f28c45ebc:function(e,t){let n=t.message,r=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;w().setInt32(e+4,i,!0),w().setInt32(e+0,r,!0)},__wbg_message_7367f8c7d0fa1589:function(e){return e.message},__wbg_name_d7bb38b41d6d953e:function(e,t){let n=t.name,r=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;w().setInt32(e+4,i,!0),w().setInt32(e+0,r,!0)},__wbg_new_0_bfa2ef4bc447daa2:function(){return/* @__PURE__ */ new Date},__wbg_new_0f6d2ddfe083319b:function(e){return new Date(e)},__wbg_new_227d7c05414eb861:function(){return/* @__PURE__ */ Error()},__wbg_new_40792555590ec35c:function(e,t){try{var n={a:e,b:t};return new Promise((e,t)=>{let r=n.a;n.a=0;try{return le(r,n.b,e,t)}finally{n.a=r}})}finally{n.a=0}},__wbg_new_4f9fafbb3909af72:function(){return{}},__wbg_new_99cabae501c0a8a0:function(){return/* @__PURE__ */ new Map},__wbg_new_a560378ea1240b14:function(e){return new Uint8Array(e)},__wbg_new_e3b04b4d53d1b593:function(e,t){return Error(T(e,t))},__wbg_new_f3c9df4f38f3f798:function(){return[]},__wbg_new_from_slice_2580ff33d0d10520:function(e,t){return new Uint8Array(C(e,t))},__wbg_new_typed_14d7cc391ce53d2c:function(e,t){try{var n={a:e,b:t};return new Promise((e,t)=>{let r=n.a;n.a=0;try{return le(r,n.b,e,t)}finally{n.a=r}})}finally{n.a=0}},__wbg_new_with_length_9cedd08484b73942:function(e){return new Uint8Array(e>>>0)},__wbg_new_with_year_month_day_d7dc1e63a7b42902:function(e,t,n){return new Date(e>>>0,t,n)},__wbg_next_01132ed6134b8ef5:function(e){return e.next},__wbg_next_b3713ec761a9dbfd:function(){return E(function(e){return e.next()},arguments)},__wbg_now_6798946be0e6fe2b:function(){return E(function(){return Date.now()},arguments)},__wbg_now_88621c9c9a4f3ffc:function(){return Date.now()},__wbg_now_e7c6795a7f81e10f:function(e){return e.now()},__wbg_objectStore_3d4cade4416cd432:function(){return E(function(e,t,n){return e.objectStore(T(t,n))},arguments)},__wbg_open_ac04ec9d75d0eeaf:function(){return E(function(e,t,n,r){return e.open(T(t,n),r>>>0)},arguments)},__wbg_pendingnativeread_new:function(e){return ve.__wrap(e)},__wbg_performance_3fcf6e32a7e1ed0a:function(e){return e.performance},__wbg_prototypesetcall_3e05eb9545565046:function(e,t,n){Uint8Array.prototype.set.call(C(e,t),n)},__wbg_push_6bdbc990be5ac37b:function(e,t){return e.push(t)},__wbg_put_015a7e88e46a2502:function(){return E(function(e,t){return e.put(t)},arguments)},__wbg_queueMicrotask_abaf92f0bd4e80a4:function(e){return e.queueMicrotask},__wbg_queueMicrotask_df5a6dac26d818f3:function(e){queueMicrotask(e)},__wbg_random_a72d453e63c9558c:function(){return Math.random()},__wbg_readyState_accbdf425c074d9c:function(e){let t=e.readyState;return(we.indexOf(t)+1||3)-1},__wbg_reject_1340e1211c01825b:function(e){return Promise.reject(e)},__wbg_resolve_0a79de24e9d2267b:function(e){return Promise.resolve(e)},__wbg_result_452c1006fc727317:function(){return E(function(e){return e.result},arguments)},__wbg_set_08463b1df38a7e29:function(e,t,n){return e.set(t,n)},__wbg_set_16a9c1a07b3d38ec:function(e,t,n){e.set(C(t,n))},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_6c60b2e8ad0e9383:function(e,t,n){e[t>>>0]=n},__wbg_set_8ee2d34facb8466e:function(){return E(function(e,t,n){return Reflect.set(e,t,n)},arguments)},__wbg_set_key_path_6edd6ee0e8d75af3:function(e,t){e.keyPath=t},__wbg_set_onabort_6b6df7a41aa97c23:function(e,t){e.onabort=t},__wbg_set_oncomplete_20fb27150b4ee0d4:function(e,t){e.oncomplete=t},__wbg_set_onerror_2b7dfa4e6dea4159:function(e,t){e.onerror=t},__wbg_set_onerror_3c4b5087146b11b6:function(e,t){e.onerror=t},__wbg_set_onsuccess_f7e5b5cbed5008b1:function(e,t){e.onsuccess=t},__wbg_set_onupgradeneeded_d7e8e03a1999bf5d:function(e,t){e.onupgradeneeded=t},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;w().setInt32(e+4,i,!0),w().setInt32(e+0,r,!0)},__wbg_static_accessor_GLOBAL_THIS_a1248013d790bf5f:function(){let e=typeof globalThis>`u`?null:globalThis;return D(e)?0:S(e)},__wbg_static_accessor_GLOBAL_f2e0f995a21329ff:function(){let e=typeof global>`u`?null:global;return D(e)?0:S(e)},__wbg_static_accessor_SELF_24f78b6d23f286ea:function(){let e=typeof self>`u`?null:self;return D(e)?0:S(e)},__wbg_static_accessor_WINDOW_59fd959c540fe405:function(){let e=typeof window>`u`?null:window;return D(e)?0:S(e)},__wbg_subarray_0f98d3fb634508ad:function(e,t,n){return e.subarray(t>>>0,n>>>0)},__wbg_target_732d56b173b7e87c:function(e){let t=e.target;return D(t)?0:S(t)},__wbg_then_00eed3ac0b8e82cb:function(e,t,n){return e.then(t,n)},__wbg_then_a0c8db0381c8994c:function(e,t){return e.then(t)},__wbg_toString_891d991e862e1d44:function(e){return e.toString()},__wbg_transaction_cc65dcef07fabb06:function(e){return e.transaction},__wbg_transaction_f909284bfed41115:function(){return E(function(e,t,n,r){return e.transaction(T(t,n),Te[r])},arguments)},__wbg_upperBound_2f3c07fb628c7a3c:function(){return E(function(e,t){return IDBKeyRange.upperBound(e,t!==0)},arguments)},__wbg_value_7f6052747ccf940f:function(e){return e.value},__wbg_wasmdb_new:function(e){return xe.__wrap(e)},__wbg_wasmtransport_new:function(e){return M.__wrap(e)},__wbg_wasmwrite_new:function(e){return N.__wrap(e)},__wbindgen_cast_0000000000000001:function(e,t){return O(e,t,se)},__wbindgen_cast_0000000000000002:function(e,t){return O(e,t,oe)},__wbindgen_cast_0000000000000003:function(e,t){return O(e,t,ae)},__wbindgen_cast_0000000000000004:function(e,t){return O(e,t,ce)},__wbindgen_cast_0000000000000005:function(e,t){return O(e,t,x)},__wbindgen_cast_0000000000000006:function(e,t){return O(e,t,ie)},__wbindgen_cast_0000000000000007:function(e){return e},__wbindgen_cast_0000000000000008:function(e){return e},__wbindgen_cast_0000000000000009:function(e,t){return T(e,t)},__wbindgen_cast_000000000000000a:function(e){return BigInt.asUintN(64,e)},__wbindgen_init_externref_table:function(){let e=F.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function x(e,t){F.wasm_bindgen__convert__closures_____invoke__h69610db431037c77(e,t)}function ie(e,t){F.wasm_bindgen__convert__closures_____invoke__h492b14c1fd17d971(e,t)}function ae(e,t,n){F.wasm_bindgen__convert__closures_____invoke__hf83e1094fac4ab4c(e,t,n)}function oe(e,t,n){return F.wasm_bindgen__convert__closures_____invoke__hca039eb9596f114b(e,t,n)}function se(e,t,n){let r=F.wasm_bindgen__convert__closures_____invoke__hf2d3ca0c7acb67d9(e,t,n);if(r[1])throw j(r[0])}function ce(e,t,n){let r=F.wasm_bindgen__convert__closures_____invoke__h98d9c920d59de331(e,t,n);if(r[1])throw j(r[0])}function le(e,t,n,r){F.wasm_bindgen__convert__closures_____invoke__h0c5680e9ed94b2e6(e,t,n,r)}function S(e){let t=F.__externref_table_alloc();return F.__wbindgen_externrefs.set(t,e),t}function ue(e){let t=typeof e;if(t==`number`||t==`boolean`||e==null)return`${e}`;if(t==`string`)return`"${e}"`;if(t==`symbol`){let t=e.description;return t==null?`Symbol`:`Symbol(${t})`}if(t==`function`){let t=e.name;return typeof t==`string`&&t.length>0?`Function(${t})`:`Function`}if(Array.isArray(e)){let t=e.length,n=`[`;t>0&&(n+=ue(e[0]));for(let r=1;r<t;r++)n+=`, `+ue(e[r]);return n+=`]`,n}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r==`Object`)try{return`Object(`+JSON.stringify(e)+`)`}catch{return`Object`}return e instanceof Error?`${e.name}: ${e.message}
|
|
2
|
-
${e.stack}`:r}function de(e,t){e>>>=0;let n=w(),r=[];for(let i=e;i<e+4*t;i+=4)r.push(F.__wbindgen_externrefs.get(n.getUint32(i,!0)));return F.__externref_drop_slice(e,t),r}function C(e,t){return e>>>=0,fe().subarray(e/1,e/1+t)}function w(){return(Fe===null||Fe.buffer.detached===!0||Fe.buffer.detached===void 0&&Fe.buffer!==F.memory.buffer)&&(Fe=new DataView(F.memory.buffer)),Fe}function T(e,t){return e>>>=0,pe(e,t)}function fe(){return(Ie===null||Ie.byteLength===0)&&(Ie=new Uint8Array(F.memory.buffer)),Ie}function E(e,t){try{return e.apply(this,t)}catch(e){let t=S(e);F.__wbindgen_exn_store(t)}}function D(e){return e==null}function O(e,t,n){let r={a:e,b:t,cnt:1},i=(...e)=>{r.cnt++;let t=r.a;r.a=0;try{return n(t,r.b,...e)}finally{r.a=t,i._wbg_cb_unref()}};return i._wbg_cb_unref=()=>{--r.cnt===0&&(F.__wbindgen_destroy_closure(r.a,r.b),r.a=0,Pe.unregister(r))},Pe.register(i,r,r),i}function k(e,t){let n=t(e.length*1,1)>>>0;return fe().set(e,n/1),P=e.length,n}function A(e,t,n){if(n===void 0){let n=Be.encode(e),r=t(n.length,1)>>>0;return fe().subarray(r,r+n.length).set(n),P=n.length,r}let r=e.length,i=t(r,1)>>>0,a=fe(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=fe().subarray(i+o,i+r),a=Be.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return P=o,i}function j(e){let t=F.__wbindgen_externrefs.get(e);return F.__externref_table_dealloc(e),t}function pe(e,t){return ze+=t,ze>=Re&&(Le=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),Le.decode(),ze=t),Le.decode(fe().subarray(e,e+t))}function me(e,t){return F=e.exports,Ve=t,Fe=null,Ie=null,F.__wbindgen_start(),F}async function he(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)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);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}function ge(e){if(F!==void 0)return F;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=b();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),me(new WebAssembly.Instance(e,t),e)}async function _e(e){if(F!==void 0)return F;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`)),e===void 0&&(e=new URL(new URL(`jazz_wasm_bg-BG8gazqt.wasm`,import.meta.url).href,``+import.meta.url));let t=b();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await he(await e,t);return me(n,r)}var ve,ye,be,xe,Se,Ce,M,N,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,P,Ve,F,He=n({"../../crates/jazz-wasm/pkg/jazz_wasm.js"(){ve=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,De.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,De.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_pendingnativeread_free(e,0)}cancel(){F.pendingnativeread_cancel(this.__wbg_ptr)}poll(){let e=F.pendingnativeread_poll(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}},Symbol.dispose&&(ve.prototype[Symbol.dispose]=ve.prototype.free),ye=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ae.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ae.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_streamingmutation_free(e,0)}abort(){return F.wasmstreamingmutation_abort(this.__wbg_ptr)}finish(){return F.wasmstreamingmutation_finish(this.__wbg_ptr)}finishInTransaction(){let e=F.wasmstreamingmutation_finishInTransaction(this.__wbg_ptr);if(e[1])throw j(e[0])}push(e){let t=k(e,F.__wbindgen_malloc),n=P;return F.wasmstreamingmutation_push(this.__wbg_ptr,t,n)}},Symbol.dispose&&(ye.prototype[Symbol.dispose]=ye.prototype.free),be=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Me.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Me.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_upstreamlink_free(e,0)}handle(e,t){let n,r;try{let o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=F.upstreamlink_handle(this.__wbg_ptr,e,o,s);var i=c[0],a=c[1];if(c[3])throw i=0,a=0,j(c[2]);return n=i,r=a,T(i,a)}finally{F.__wbindgen_free(n,r,1)}}constructor(e){let t=F.upstreamlink_new(e);return this.__wbg_ptr=t>>>0,Me.register(this,this.__wbg_ptr,this),this}},Symbol.dispose&&(be.prototype[Symbol.dispose]=be.prototype.free),xe=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ee.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ee.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmdb_free(e,0)}acceptSubscriber(e,t,n){let r=k(e,F.__wbindgen_malloc),i=P,a=F.wasmdb_acceptSubscriber(this.__wbg_ptr,r,i,t,!D(n),D(n)?BigInt(0):n);if(a[2])throw j(a[1]);return j(a[0])}acceptSubscriberWithSelfSignedProof(e,t,n,r,i){let a=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),u=P,d=F.wasmdb_acceptSubscriberWithSelfSignedProof(this.__wbg_ptr,e,a,o,s,c,l,u,!D(i),D(i)?BigInt(0):i);if(d[2])throw j(d[1]);return j(d[0])}all(e,t,n,r,i){let a=k(e,F.__wbindgen_malloc),o=P;var s=D(n)?0:A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=D(r)?0:k(r,F.__wbindgen_malloc),u=P;let d=F.wasmdb_all(this.__wbg_ptr,a,o,t,s,c,l,u,i);if(d[2])throw j(d[1]);return j(d[0])}beginStreamingMutation(e,t,n,r,i,a,o,s,c,l,u){let d=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),f=P,p=k(t,F.__wbindgen_malloc),m=P,h=k(n,F.__wbindgen_malloc),g=P,_=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),ee=P;var v=D(i)?0:A(i,F.__wbindgen_malloc,F.__wbindgen_realloc),y=P,te=D(a)?0:k(a,F.__wbindgen_malloc),ne=P,re=D(o)?0:k(o,F.__wbindgen_malloc),b=P,x=D(u)?0:A(u,F.__wbindgen_malloc,F.__wbindgen_realloc),ie=P;let ae=F.wasmdb_beginStreamingMutation(this.__wbg_ptr,d,f,p,m,h,g,_,ee,v,y,te,ne,re,b,!D(s),D(s)?0:s,D(c)?0:S(c),D(l)?0:S(l),x,ie);if(ae[2])throw j(ae[1]);return ye.__wrap(ae[0])}beginTransaction(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P;var c=D(n)?0:k(n,F.__wbindgen_malloc),l=P,u=D(r)?0:k(r,F.__wbindgen_malloc),d=P;let f=F.wasmdb_beginTransaction(this.__wbg_ptr,i,a,o,s,c,l,u,d);if(f[1])throw j(f[0])}canInsert(e,t){let n,r;try{let o=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=k(t,F.__wbindgen_malloc),l=P,u=F.wasmdb_canInsert(this.__wbg_ptr,o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,j(u[2]);return n=i,r=a,T(i,a)}finally{F.__wbindgen_free(n,r,1)}}captureSnapshot(){let e=F.wasmdb_captureSnapshot(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}close(){return F.wasmdb_close(this.__wbg_ptr)}commitTransaction(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;var i=D(t)?0:A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P;let o=F.wasmdb_commitTransaction(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return N.__wrap(o[0])}connectUpstream(){let e=F.wasmdb_connectUpstream(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}connectUpstreamWithSession(e,t,n,r,i,a){let o=k(n,F.__wbindgen_malloc),s=P,c=k(i,F.__wbindgen_malloc),l=P,u=F.wasmdb_connectUpstreamWithSession(this.__wbg_ptr,e,t,o,s,r,c,l,a);if(u[2])throw j(u[1]);return j(u[0])}createUpstreamLink(e){let t=F.wasmdb_createUpstreamLink(this.__wbg_ptr,e);return be.__wrap(t)}delete(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=k(t,F.__wbindgen_malloc),o=P,s=F.wasmdb_delete(this.__wbg_ptr,r,i,a,o,n);if(s[2])throw j(s[1]);return N.__wrap(s[0])}deleteInTransaction(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_deleteInTransaction(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[1])throw j(u[0])}static destroyBrowserStorage(e,t){let n=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;return F.wasmdb_destroyBrowserStorage(e,n,r)}evictExpiredStagedLargeValues(){return F.wasmdb_evictExpiredStagedLargeValues(this.__wbg_ptr)}flush(){return F.wasmdb_flush(this.__wbg_ptr)}foregroundTxTimeHighWater(){let e=F.wasmdb_foregroundTxTimeHighWater(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}insert(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=k(t,F.__wbindgen_malloc),o=P,s=F.wasmdb_insert(this.__wbg_ptr,r,i,a,o,n);if(s[2])throw j(s[1]);return N.__wrap(s[0])}insertInTransaction(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_insertInTransaction(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[3])throw j(u[2]);var d=C(u[0],u[1]).slice();return F.__wbindgen_free(u[0],u[1]*1,1),d}localCurrentRow(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_localCurrentRow(this.__wbg_ptr,n,r,i,a);if(o[3])throw j(o[2]);var s=C(o[0],o[1]).slice();return F.__wbindgen_free(o[0],o[1]*1,1),s}onMutationError(e){F.wasmdb_onMutationError(this.__wbg_ptr,e)}onStorageFailure(e){F.wasmdb_onStorageFailure(this.__wbg_ptr,e)}static openBrowser(e,t,n,r){let i=k(t,F.__wbindgen_malloc),a=P,o=k(n,F.__wbindgen_malloc),s=P,c=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P;return F.wasmdb_openBrowser(e,i,a,o,s,c,l)}static openBrowserWithSelfSignedProof(e,t,n,r,i,a,o){let s=k(t,F.__wbindgen_malloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),f=P,p=A(i,F.__wbindgen_malloc,F.__wbindgen_realloc),m=P,h=A(a,F.__wbindgen_malloc,F.__wbindgen_realloc),g=P,_=A(o,F.__wbindgen_malloc,F.__wbindgen_realloc),ee=P;return F.wasmdb_openBrowserWithSelfSignedProof(e,s,c,l,u,d,f,p,m,h,g,_,ee)}static openMemory(t,n){let r=k(t,F.__wbindgen_malloc),i=P,a=k(n,F.__wbindgen_malloc),o=P,s=F.wasmdb_openMemory(r,i,a,o);if(s[2])throw j(s[1]);return e.__wrap(s[0])}static openMemoryAsBackend(t,n){let r=k(t,F.__wbindgen_malloc),i=P,a=k(n,F.__wbindgen_malloc),o=P,s=F.wasmdb_openMemoryAsBackend(r,i,a,o);if(s[2])throw j(s[1]);return e.__wrap(s[0])}static openMemoryWithSelfSignedProof(t,n,r,i,a){let o=k(t,F.__wbindgen_malloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),d=P,f=A(i,F.__wbindgen_malloc,F.__wbindgen_realloc),p=P,m=A(a,F.__wbindgen_malloc,F.__wbindgen_realloc),h=P,g=F.wasmdb_openMemoryWithSelfSignedProof(o,s,c,l,u,d,f,p,m,h);if(g[2])throw j(g[1]);return e.__wrap(g[0])}pendingUploadRows(e){let t=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P,r=F.wasmdb_pendingUploadRows(this.__wbg_ptr,t,n);if(r[3])throw j(r[2]);var i=de(r[0],r[1]).slice();return F.__wbindgen_free(r[0],r[1]*4,4),i}registerSchema(t,n){let r=k(t,F.__wbindgen_malloc),i=P;var a=D(n)?0:k(n,F.__wbindgen_malloc),o=P;let s=F.wasmdb_registerSchema(this.__wbg_ptr,r,i,a,o);if(s[2])throw j(s[1]);return e.__wrap(s[0])}requestDeletePermissionAdvice(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_requestDeletePermissionAdvice(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return Ce.__wrap(o[0])}requestInsertPermissionAdvice(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_requestInsertPermissionAdvice(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return Ce.__wrap(o[0])}requestReadPermissionAdvice(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_requestReadPermissionAdvice(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return Ce.__wrap(o[0])}requestUpdatePermissionAdvice(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=k(t,F.__wbindgen_malloc),o=P,s=k(n,F.__wbindgen_malloc),c=P,l=F.wasmdb_requestUpdatePermissionAdvice(this.__wbg_ptr,r,i,a,o,s,c);if(l[2])throw j(l[1]);return Ce.__wrap(l[0])}restore(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=k(t,F.__wbindgen_malloc),s=P;var c=D(n)?0:k(n,F.__wbindgen_malloc),l=P;let u=F.wasmdb_restore(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[2])throw j(u[1]);return N.__wrap(u[0])}restoreInTransaction(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=k(n,F.__wbindgen_malloc),u=P;var d=D(r)?0:k(r,F.__wbindgen_malloc),f=P;let p=F.wasmdb_restoreInTransaction(this.__wbg_ptr,a,o,s,c,l,u,d,f,i);if(p[1])throw j(p[0])}rollbackTransaction(e){let t=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P,r=F.wasmdb_rollbackTransaction(this.__wbg_ptr,t,n);if(r[1])throw j(r[0])}seedForegroundTxTimeHighWater(e){let t=F.wasmdb_seedForegroundTxTimeHighWater(this.__wbg_ptr,e);if(t[1])throw j(t[0])}setIdentityClaims(e,t){let n=k(e,F.__wbindgen_malloc),r=P,i=F.wasmdb_setIdentityClaims(this.__wbg_ptr,n,r,t);if(i[1])throw j(i[0])}setLargeValueStagingPolicy(e,t,n){let r=F.wasmdb_setLargeValueStagingPolicy(this.__wbg_ptr,e,t,!D(n),D(n)?0:n);if(r[1])throw j(r[0])}setNonDurableClient(){let e=F.wasmdb_setNonDurableClient(this.__wbg_ptr);if(e[1])throw j(e[0])}setRemoteLinkHint(e){let t=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P,r=F.wasmdb_setRemoteLinkHint(this.__wbg_ptr,t,n);if(r[1])throw j(r[0])}setSessionClaims(e){let t=F.wasmdb_setSessionClaims(this.__wbg_ptr,e);if(t[2])throw j(t[1]);return j(t[0])}setSlowQueryThresholdMs(e){let t=F.wasmdb_setSlowQueryThresholdMs(this.__wbg_ptr,e);if(t[1])throw j(t[0])}setSubscriptionBacklogRows(e){let t=F.wasmdb_setSubscriptionBacklogRows(this.__wbg_ptr,e);if(t[1])throw j(t[0])}setTickScheduler(e){F.wasmdb_setTickScheduler(this.__wbg_ptr,e)}subscribe(e,t,n,r){let i=k(e,F.__wbindgen_malloc),a=P;var o=D(n)?0:k(n,F.__wbindgen_malloc),s=P;let c=F.wasmdb_subscribe(this.__wbg_ptr,i,a,t,o,s,r);if(c[2])throw j(c[1]);return j(c[0])}takeSlowQueryReport(e){var t=D(e)?0:A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P;let r=F.wasmdb_takeSlowQueryReport(this.__wbg_ptr,t,n);if(r[3])throw j(r[2]);var i=de(r[0],r[1]).slice();return F.__wbindgen_free(r[0],r[1]*4,4),i}tick(){return F.wasmdb_tick(this.__wbg_ptr)}update(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=k(t,F.__wbindgen_malloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_update(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[2])throw j(u[1]);return N.__wrap(u[0])}updateInTransaction(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=k(r,F.__wbindgen_malloc),f=P,p=F.wasmdb_updateInTransaction(this.__wbg_ptr,a,o,s,c,l,u,d,f,i);if(p[1])throw j(p[0])}updateLargeValues(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=k(t,F.__wbindgen_malloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=F.wasmdb_updateLargeValues(this.__wbg_ptr,a,o,s,c,l,u,r,!D(i),D(i)?0:i);if(d[2])throw j(d[1]);return N.__wrap(d[0])}updateLargeValuesInTransaction(e,t,n,r,i,a){let o=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P,u=k(n,F.__wbindgen_malloc),d=P,f=k(r,F.__wbindgen_malloc),p=P,m=F.wasmdb_updateLargeValuesInTransaction(this.__wbg_ptr,o,s,c,l,u,d,f,p,i,!D(a),D(a)?0:a);if(m[1])throw j(m[0])}uploadStatus(){let e=F.wasmdb_uploadStatus(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}upsert(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=k(t,F.__wbindgen_malloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_upsert(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[2])throw j(u[1]);return N.__wrap(u[0])}upsertInTransaction(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=k(r,F.__wbindgen_malloc),f=P,p=F.wasmdb_upsertInTransaction(this.__wbg_ptr,a,o,s,c,l,u,d,f,i);if(p[1])throw j(p[0])}waitForPendingWrites(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;return F.wasmdb_waitForPendingWrites(this.__wbg_ptr,r,i,D(t)?0:S(t),D(n)?16777215:+!!n)}wireFeatures(){return F.wasmdb_wireFeatures(this.__wbg_ptr)>>>0}},Symbol.dispose&&(xe.prototype[Symbol.dispose]=xe.prototype.free),Se=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Oe.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmpendingsubscription_free(e,0)}cancel(){F.wasmpendingsubscription_cancel(this.__wbg_ptr)}poll(){let e=F.wasmpendingsubscription_poll(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}setWake(e){F.wasmpendingsubscription_setWake(this.__wbg_ptr,e)}},Symbol.dispose&&(Se.prototype[Symbol.dispose]=Se.prototype.free),Ce=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,ke.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ke.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmpermissionadvicerequest_free(e,0)}cancel(){F.wasmpermissionadvicerequest_cancel(this.__wbg_ptr)}get promise(){return F.wasmpermissionadvicerequest_promise(this.__wbg_ptr)}},Symbol.dispose&&(Ce.prototype[Symbol.dispose]=Ce.prototype.free),M=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,je.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,je.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmtransport_free(e,0)}auxiliaryOutboundReady(){return F.wasmtransport_auxiliaryOutboundReady(this.__wbg_ptr)}auxiliaryReceiveTimeoutMs(){let e=F.wasmtransport_auxiliaryReceiveTimeoutMs(this.__wbg_ptr);return e===4294967297?void 0:e}clearOutboundScheduler(){F.wasmtransport_clearOutboundScheduler(this.__wbg_ptr)}close(){return F.wasmtransport_close(this.__wbg_ptr)!==0}expireAuxiliaryReceive(){F.wasmtransport_expireAuxiliaryReceive(this.__wbg_ptr)}recvAuxiliaryWireFrames(e,t){return F.wasmtransport_recvAuxiliaryWireFrames(this.__wbg_ptr,D(e)?4294967297:e>>>0,D(t)?4294967297:t>>>0)}recvWireFrames(){return F.wasmtransport_recvWireFrames(this.__wbg_ptr)}routeAuxiliaryWireFrame(e){let t=k(e,F.__wbindgen_malloc),n=P;return F.wasmtransport_routeAuxiliaryWireFrame(this.__wbg_ptr,t,n)}sendWireFrame(e){let t=k(e,F.__wbindgen_malloc),n=P;F.wasmtransport_sendWireFrame(this.__wbg_ptr,t,n)}sendWireFrames(e){F.wasmtransport_sendWireFrames(this.__wbg_ptr,e)}setAuxiliaryTraceEnabled(e){F.wasmtransport_setAuxiliaryTraceEnabled(this.__wbg_ptr,e)}setOutboundScheduler(e){F.wasmtransport_setOutboundScheduler(this.__wbg_ptr,e)}takeAuxiliaryTrace(){return F.wasmtransport_takeAuxiliaryTrace(this.__wbg_ptr)}tick(){return F.wasmtransport_tick(this.__wbg_ptr)}updateAuthenticatedClaims(e){let t=F.wasmtransport_updateAuthenticatedClaims(this.__wbg_ptr,e);if(t[2])throw j(t[1]);return j(t[0])}upstreamRefusal(){return F.wasmtransport_upstreamRefusal(this.__wbg_ptr)}},Symbol.dispose&&(M.prototype[Symbol.dispose]=M.prototype.free),N=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ne.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ne.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmwrite_free(e,0)}close(){return F.wasmwrite_close(this.__wbg_ptr)!==0}get payload(){let e=F.wasmwrite_payload(this.__wbg_ptr);var t=C(e[0],e[1]).slice();return F.__wbindgen_free(e[0],e[1]*1,1),t}get rowId(){let e=F.wasmwrite_rowId(this.__wbg_ptr);var t=C(e[0],e[1]).slice();return F.__wbindgen_free(e[0],e[1]*1,1),t}get txId(){let e,t;try{let n=F.wasmwrite_txId(this.__wbg_ptr);return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}wait(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=F.wasmwrite_wait(this.__wbg_ptr,n,r,D(t)?16777215:+!!t);if(i[2])throw j(i[1]);return j(i[0])}writeState(){let e=F.wasmwrite_writeState(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}},Symbol.dispose&&(N.prototype[Symbol.dispose]=N.prototype.free),we=[`pending`,`done`],Te=[`readonly`,`readwrite`,`versionchange`,`readwriteflush`,`cleanup`],Ee=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmdb_free(e>>>0,1)),De=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_pendingnativeread_free(e>>>0,1)),Oe=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmpendingsubscription_free(e>>>0,1)),ke=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmpermissionadvicerequest_free(e>>>0,1)),Ae=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_streamingmutation_free(e>>>0,1)),je=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmtransport_free(e>>>0,1)),Me=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_upstreamlink_free(e>>>0,1)),Ne=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmwrite_free(e>>>0,1)),Pe=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbindgen_destroy_closure(e.a,e.b)),Fe=null,Ie=null,Le=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),Le.decode(),Re=2146435072,ze=0,Be=new TextEncoder,`encodeInto`in Be||(Be.encodeInto=function(e,t){let n=Be.encode(e);return t.set(n),{read:e.length,written:n.length}}),P=0}}),Ue,We=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/OTLPExporterBase.js"(){Ue=class{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}}}),Ge,Ke=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/types.js"(){Ge=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}}}});function qe(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function Je(e){if(e!=null)return async()=>e}function Ye(e,t,n){return{timeoutMillis:qe(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function Xe(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var Ze=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/shared-configuration.js"(){}});function Qe(e){return new $e(e.concurrencyLimit)}var $e,et=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/bounded-queue-export-promise-handler.js"(){$e=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}}}),tt,nt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/version.js"(){tt=`1.9.1`}});function rt(e){let t=/* @__PURE__ */ new Set([e]),n=/* @__PURE__ */ new Set,r=e.match(it);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(it);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var it,at,ot=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js"(){nt(),it=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,at=rt(tt)}});function st(e,t,n,r=!1){let i=ft[dt]=ft[dt]??{version:tt};if(!r&&i[e]){let t=/* @__PURE__ */ Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==tt){let t=/* @__PURE__ */ Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${tt}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${tt}.`),!0}function ct(e){let t=ft[dt]?.version;if(t&&at(t))return ft[dt]?.[e]}function lt(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${tt}.`);let n=ft[dt];n&&delete n[e]}var ut,dt,ft,pt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js"(){nt(),ot(),ut=tt.split(`.`)[0],dt=Symbol.for(`opentelemetry.js.api.${ut}`),ft=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}});function mt(e,t,n){let r=ct(`diag`);if(r)return r[e](t,...n)}var ht,gt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js"(){pt(),ht=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return mt(`debug`,this._namespace,e)}error(...e){return mt(`error`,this._namespace,e)}info(...e){return mt(`info`,this._namespace,e)}warn(...e){return mt(`warn`,this._namespace,e)}verbose(...e){return mt(`verbose`,this._namespace,e)}}}}),I,_t=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/types.js"(){(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(I||={})}});function vt(e,t){e<I.NONE?e=I.NONE:e>I.ALL&&(e=I.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,I.ERROR),warn:n(`warn`,I.WARN),info:n(`info`,I.INFO),debug:n(`debug`,I.DEBUG),verbose:n(`verbose`,I.VERBOSE)}}var yt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js"(){_t()}}),bt,xt,St=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js"(){gt(),yt(),_t(),pt(),bt=`diag`,xt=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=ct(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:I.INFO})=>{if(e===t){let e=/* @__PURE__ */ Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=ct(`diag`),i=vt(n.logLevel??I.INFO,e);if(r&&!n.suppressOverrideMessage){let e=(/* @__PURE__ */ Error()).stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return st(`diag`,i,t,!0)},t.disable=()=>{lt(bt,t)},t.createComponentLogger=e=>new ht(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}}});function Ct(e){return Symbol.for(e)}var wt,Tt,Et=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js"(){wt=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):/* @__PURE__ */ new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Tt=new wt}});function Dt(){return Rt}var Ot,kt,At,jt,Mt,Nt,Pt,Ft,It,Lt,Rt,zt,Bt,Vt,Ht,Ut,Wt,Gt,Kt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js"(){Ot=class{constructor(){}createGauge(e,t){return Bt}createHistogram(e,t){return Vt}createCounter(e,t){return zt}createUpDownCounter(e,t){return Ht}createObservableGauge(e,t){return Wt}createObservableCounter(e,t){return Ut}createObservableUpDownCounter(e,t){return Gt}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},kt=class{},At=class extends kt{add(e,t){}},jt=class extends kt{add(e,t){}},Mt=class extends kt{record(e,t){}},Nt=class extends kt{record(e,t){}},Pt=class{addCallback(e){}removeCallback(e){}},Ft=class extends Pt{},It=class extends Pt{},Lt=class extends Pt{},Rt=new Ot,zt=new At,Bt=new Mt,Vt=new Nt,Ht=new jt,Ut=new Ft,Wt=new It,Gt=new Lt}}),qt,Jt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js"(){Et(),qt=class{active(){return Tt}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}}}),Yt,Xt,Zt,Qt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/context.js"(){Jt(),pt(),St(),Yt=`context`,Xt=new qt,Zt=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return st(Yt,e,xt.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return ct(Yt)||Xt}disable(){this._getContextManager().disable(),lt(Yt,xt.instance())}}}}),L,$t=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js"(){(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(L||={})}}),en,tn,nn,rn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js"(){$t(),en=`0000000000000000`,tn=`00000000000000000000000000000000`,nn={traceId:tn,spanId:en,traceFlags:L.NONE}}}),an,on=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js"(){rn(),an=class{constructor(e=nn){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}});function sn(e){return e.getValue(pn)||void 0}function cn(){return sn(Zt.getInstance().active())}function ln(e,t){return e.setValue(pn,t)}function un(e){return e.deleteValue(pn)}function dn(e,t){return ln(e,new an(t))}function fn(e){return sn(e)?.spanContext()}var pn,mn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js"(){Et(),on(),Qt(),pn=Ct(`OpenTelemetry Context Key SPAN`)}});function hn(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(bn[e.charCodeAt(t)]|0)+(bn[e.charCodeAt(t+1)]|0)+(bn[e.charCodeAt(t+2)]|0)+(bn[e.charCodeAt(t+3)]|0);return n===t}function gn(e){return hn(e,32)&&e!==tn}function _n(e){return hn(e,16)&&e!==en}function vn(e){return gn(e.traceId)&&_n(e.spanId)}function yn(e){return new an(e)}var bn,xn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js"(){rn(),on(),bn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}});function Sn(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var Cn,wn,Tn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js"(){Qt(),mn(),on(),xn(),Cn=Zt.getInstance(),wn=class{startSpan(e,t,n=Cn.active()){if(t?.root)return new an;let r=n&&fn(n);return Sn(r)&&vn(r)?new an(r):new an}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??Cn.active(),c=this.startSpan(e,i,s),l=ln(s,c);return Cn.with(l,o,void 0,c)}}}}),En,Dn,On=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js"(){Tn(),En=new wn,Dn=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):En}}}}),kn,An=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js"(){Tn(),kn=class{getTracer(e,t,n){return new wn}}}}),jn,Mn,Nn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js"(){On(),An(),jn=new kn,Mn=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new Dn(this,e,t,n)}getDelegate(){return this._delegate??jn}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}}}),Pn,Fn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.js"(){(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Pn||={})}}),In,Ln=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js"(){(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(In||={})}}),Rn,zn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/status.js"(){(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Rn||={})}}),R,Bn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context-api.js"(){Qt(),R=Zt.getInstance()}}),z,Vn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag-api.js"(){St(),z=xt.instance()}}),Hn,Un,Wn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js"(){pt(),Nn(),xn(),mn(),St(),Hn=`trace`,Un=class e{constructor(){this._proxyTracerProvider=new Mn,this.wrapSpanContext=yn,this.isSpanContextValid=vn,this.deleteSpan=un,this.getSpan=sn,this.getActiveSpan=cn,this.getSpanContext=fn,this.setSpan=ln,this.setSpanContext=dn}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=st(Hn,this._proxyTracerProvider,xt.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return ct(Hn)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){lt(Hn,xt.instance()),this._proxyTracerProvider=new Mn}}}}),Gn,Kn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js"(){Wn(),Gn=Un.getInstance()}}),B=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/index.js"(){Et(),Kt(),Fn(),Ln(),zn(),$t(),xn(),rn(),Bn(),Vn(),Kn()}});function qn(e){return e.setValue(Yn,!0)}function Jn(e){return e.getValue(Yn)===!0}var Yn,Xn=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js"(){B(),Yn=Ct(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)}});function Zn(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Qn(n)){z.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];$n(r)?t[n]=Array.isArray(r)?r.slice():r:z.warn(`Invalid attribute value set for key: ${n}`)}return t}function Qn(e){return typeof e==`string`&&e!==``}function $n(e){return e==null?!0:Array.isArray(e)?er(e):tr(typeof e)}function er(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(tr(e)){t=e;continue}return!1}return!1}}return!0}function tr(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var nr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/attributes.js"(){B()}});function rr(){return e=>{z.error(ir(e))}}function ir(e){return typeof e==`string`?e:JSON.stringify(ar(e))}function ar(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var or=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/logging-error-handler.js"(){B()}});function V(e){try{sr(e)}catch{}}var sr,cr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/global-error-handler.js"(){or(),sr=rr()}}),lr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/environment.js"(){}}),ur,dr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/version.js"(){ur=`2.7.1`}}),fr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"(){}}),pr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"(){fr()}}),mr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"(){}}),hr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"(){mr()}}),gr,_r,vr,yr,br=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"(){gr=`telemetry.sdk.language`,_r=`webjs`,vr=`telemetry.sdk.name`,yr=`telemetry.sdk.version`}}),xr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"(){}}),Sr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js"(){}}),Cr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"(){pr(),hr(),br(),xr(),Sr()}}),wr,Tr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/semconv.js"(){wr=`process.runtime.name`}}),Er,Dr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/sdk-info.js"(){dr(),Cr(),Tr(),Er={[vr]:`opentelemetry`,[wr]:`browser`,[gr]:_r,[yr]:ur}}}),Or,kr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/index.js"(){lr(),Dr(),Or=performance}});function Ar(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Vr)]}function jr(e){return Rr(Ar(Or.timeOrigin),Ar(typeof e==`number`?e:Or.now()))}function Mr(e){if(Ir(e))return e;if(typeof e==`number`)return e<Or.timeOrigin?jr(e):Ar(e);if(e instanceof Date)return Ar(e.getTime());throw TypeError(`Invalid input type`)}function Nr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=Hr),[n,r]}function Pr(e){return e[0]*Hr+e[1]}function Fr(e){return e[0]*1e6+e[1]/1e3}function Ir(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Lr(e){return Ir(e)||typeof e==`number`||e instanceof Date}function Rr(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Hr&&(n[1]-=Hr,n[0]+=1),n}var zr,Br,Vr,Hr,Ur=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/time.js"(){kr(),zr=9,Br=6,Vr=10**Br,Hr=10**zr}}),H,Wr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/ExportResult.js"(){(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(H||={})}});function Gr(e){if(!Kr(e)||qr(e)!==Xr)return!1;let t=ni(e);if(t===null)return!0;let n=ii.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&ei.call(n)===ti}function Kr(e){return typeof e==`object`&&!!e}function qr(e){return e==null?e===void 0?Qr:Zr:ai&&ai in Object(e)?Jr(e):Yr(e)}function Jr(e){let t=ii.call(e,ai),n=e[ai],r=!1;try{e[ai]=void 0,r=!0}catch{}let i=oi.call(e);return r&&(t?e[ai]=n:delete e[ai]),i}function Yr(e){return oi.call(e)}var Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/lodash.merge.js"(){Xr=`[object Object]`,Zr=`[object Null]`,Qr=`[object Undefined]`,$r=Function.prototype,ei=$r.toString,ti=ei.call(Object),ni=Object.getPrototypeOf,ri=Object.prototype,ii=ri.hasOwnProperty,ai=Symbol?Symbol.toStringTag:void 0,oi=ri.toString}});function ci(...e){let t=e.shift(),n=/* @__PURE__ */ new WeakMap;for(;e.length>0;)t=ui(t,e.shift(),0,n);return t}function li(e){return fi(e)?e.slice():e}function ui(e,t,n=0,r){let i;if(!(n>_i)){if(n++,hi(e)||hi(t)||pi(t))i=li(t);else if(fi(e)){if(i=e.slice(),fi(t))for(let e=0,n=t.length;e<n;e++)i.push(li(t[e]));else if(mi(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=li(t[r]))}}}else if(mi(e)){if(mi(t)){if(!gi(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(hi(c))typeof c>`u`?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(di(e,s,r)||di(t,s,r))delete i[s];else{if(mi(a)&&mi(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=ui(i[s],c,n,r)}}}}else i=t}return i}}function di(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function fi(e){return Array.isArray(e)}function pi(e){return typeof e==`function`}function mi(e){return!hi(e)&&!fi(e)&&!pi(e)&&typeof e==`object`}function hi(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e>`u`||e instanceof Date||e instanceof RegExp||e===null}function gi(e,t){return!(!Gr(e)||!Gr(t))}var _i,vi=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/merge.js"(){si(),_i=20}});function yi(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new bi(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var bi,xi=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/timeout.js"(){bi=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}}}),Si,Ci=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/promise.js"(){Si=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}}}),wi,Ti=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/callback.js"(){Ci(),wi=class{_isCalled=!1;_deferred=new Si;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}});function Ei(e,t){return new Promise(n=>{R.with(qn(R.active()),()=>{e.export(t,n)})})}var Di=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/internal/exporter.js"(){B(),Xn()}}),Oi,U=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/index.js"(){nr(),cr(),Ur(),Wr(),kr(),Xn(),vi(),xi(),Ti(),Di(),Oi={_export:Ei}}});function ki(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function Ai(){return{handleResponse(e){e==null||!ki(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||z.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var ji=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/logging-response-handler.js"(){B()}});function Mi(e,t){return new Ni(e.transport,e.serializer,Ai(),e.promiseHandler,t.timeout)}var Ni,Pi=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-export-delegate.js"(){U(),Ke(),ji(),B(),Ni=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=z.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:H.FAILED,error:/* @__PURE__ */ Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);n==null?t({code:H.FAILED,error:/* @__PURE__ */ Error(`Nothing to send`)}):this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:H.SUCCESS})}else e.status===`failure`&&e.error?t({code:H.FAILED,error:e.error}):e.status===`retryable`?t({code:H.FAILED,error:e.error??new Ge(`Export failed with retryable status`)}):t({code:H.FAILED,error:new Ge(`Export failed with unknown error`)})},e=>t({code:H.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}}}});function Fi(e,t,n){return Mi({transport:n,serializer:t,promiseHandler:Qe(e)},{timeout:e.timeoutMillis})}var Ii=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-network-export-delegate.js"(){et(),Pi()}}),Li=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/index.js"(){We()}}),Ri,zi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/types/LogRecord.js"(){(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(Ri||={})}}),Bi,Vi,Hi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLogger.js"(){Bi=class{emit(e){}enabled(){return!1}},Vi=new Bi}});function Ui(e,t,n){return r=>r===e?t:n}var Wi,Gi,Ki,qi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/internal/global-utils.js"(){Wi=Symbol.for(`io.opentelemetry.js.api.logs`),Gi=globalThis,Ki=1}}),Ji,Yi,Xi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLoggerProvider.js"(){Hi(),Ji=class{getLogger(e,t,n){return new Bi}},Yi=new Ji}}),Zi,Qi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLogger.js"(){Hi(),Zi=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Vi}}}}),$i,ea=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLoggerProvider.js"(){Xi(),Qi(),$i=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new Zi(this,e,t,n)}_getDelegate(){return this._delegate??Yi}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}}}}),ta,na=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/api/logs.js"(){qi(),Xi(),ea(),ta=class e{constructor(){this._proxyLoggerProvider=new $i}static getInstance(){return this._instance||=new e,this._instance}setGlobalLoggerProvider(e){return Gi[Wi]?this.getLoggerProvider():(Gi[Wi]=Ui(Ki,e,Yi),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return Gi[Wi]?.call(Gi,Ki)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete Gi[Wi],this._proxyLoggerProvider=new $i}}}}),ra=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/index.js"(){zi(),Hi(),na(),ta.getInstance()}}),ia=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"(){}}),aa=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"(){ia()}}),oa=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"(){}}),sa=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"(){oa()}}),ca,la,ua,da,fa,pa,ma,ha=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"(){ca=`exception.message`,la=`exception.stacktrace`,ua=`exception.type`,da=`service.name`,fa=`telemetry.sdk.language`,pa=`telemetry.sdk.name`,ma=`telemetry.sdk.version`}}),ga=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"(){}}),_a=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js"(){}}),va=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"(){aa(),sa(),ha(),ga(),_a()}});function ya(){if(ba===void 0)try{let e=globalThis.process.argv0;ba=e?`unknown_service:${e}`:`unknown_service`}catch{ba=`unknown_service`}return ba}var ba,xa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/default-service-name.js"(){}}),Sa,Ca=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/utils.js"(){Sa=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}});function wa(e,t){return ja.FromAttributeList(Object.entries(e),t)}function Ta(e,t){return new ja(e,t)}function Ea(){return wa({})}function Da(){return wa({[da]:ya(),[fa]:Er[fa],[pa]:Er[pa],[ma]:Er[ma]})}function Oa(e){return e.map(([e,t])=>Sa(t)?[e,t.catch(t=>{z.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function ka(e){if(typeof e==`string`||e===void 0)return e;z.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Aa(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;z.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var ja,Ma=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js"(){B(),U(),va(),xa(),Ca(),ja=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Oa(t),r._asyncAttributesPending=t.filter(([e,t])=>Sa(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Sa(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Oa(this._rawAttributes),this._schemaUrl=ka(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,Sa(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&z.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes)Sa(n)?z.debug(`Unsettled resource attribute ${t} skipped`):n!=null&&(e[t]??=n);return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Aa(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}}}),Na,Pa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detect-resources.js"(){B(),Ma(),Na=(e={})=>(e.detectors||[]).map(t=>{try{let n=Ta(t.detect(e));return z.debug(`${t.constructor.name} found resource.`,n),n}catch(e){return z.debug(`${t.constructor.name} failed: ${e.message}`),Ea()}}).reduce((e,t)=>e.merge(t),Ea())}}),Fa,Ia,La=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/EnvDetector.js"(){B(),va(),U(),Fa=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=`,`;_LABEL_KEY_VALUE_SPLITTER=`=`;detect(e){return{attributes:{}}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR).filter(e=>e.trim()!==``);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER);if(n.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${e}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[r,i]=n,a=r.trim(),o=i.trim();if(a.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${e}".`);let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch(t){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${e}": ${t instanceof Error?t.message:t}`)}if(s.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${s}".`);if(c.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${s}".`);t[s]=c}return t}},Ia=new Fa}}),Ra,za,Ba=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/NoopDetector.js"(){Ra=class{detect(){return{attributes:{}}}},za=new Ra}}),Va,Ha=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/HostDetector.js"(){Ba(),Va=za}}),Ua,Wa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/OSDetector.js"(){Ba(),Ua=za}}),Ga,Ka=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/ProcessDetector.js"(){Ba(),Ga=za}}),qa,Ja=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/ServiceInstanceIdDetector.js"(){Ba(),qa=za}}),Ya=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/index.js"(){Ha(),Wa(),Ka(),Ja()}}),Xa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/index.js"(){La(),Ya()}}),Za={};r(Za,{defaultResource:()=>Da,defaultServiceName:()=>ya,detectResources:()=>Na,emptyResource:()=>Ea,envDetector:()=>Ia,hostDetector:()=>Va,osDetector:()=>Ua,processDetector:()=>Ga,resourceFromAttributes:()=>wa,serviceInstanceIdDetector:()=>qa});var Qa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/index.js"(){Pa(),Xa(),Ma(),xa()}});function $a(e,t){let n={attributes:to(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function eo(e){return{name:e.name,version:e.version}}function to(e,t){return Object.keys(e).map(n=>no(n,e[n],t))}function no(e,t,n){return{key:e,value:ro(t,n)}}function ro(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=ro(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:ro(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}var io=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/internal.js"(){}});function ao(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function oo(e){return ao(e).toString()}function so(e){return e}var co,lo,uo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js"(){U(),co=typeof BigInt<`u`?oo:Pr,lo={encodeHrTime:co,encodeSpanContext:so,encodeOptionalSpanContext:so,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}}}});function fo(e,t){let n=e&255|yo;return t&&(n|=bo),n}function po(e,t){let n=e.spanContext(),r=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:to(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>ho(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>mo(e,t)),droppedLinksCount:e.droppedLinksCount,flags:fo(n.traceFlags,e.parentSpanContext?.isRemote)}}function mo(e,t){return{attributes:e.attributes?to(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:fo(e.context.traceFlags,e.context.isRemote)}}function ho(e,t){return{attributes:e.attributes?to(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function go(e,t){return{resourceSpans:vo(e,t)}}function _o(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=t.get(n.resource);e||(e=/* @__PURE__ */ new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function vo(e,t){let n=_o(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>po(e,t));o.push({scope:eo(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=$a(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var yo,bo,xo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js"(){io(),yo=256,bo=512}});function So(e,t){return{resourceLogs:wo(e,t)}}function Co(e){let t=/* @__PURE__ */ new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=/* @__PURE__ */ new Map,t.set(e,o));let s=`${r}@${i}:${a}`,c=o.get(s);c||(c=[],o.set(s,c)),c.push(n)}return t}function wo(e,t){let n=Co(e);return Array.from(n,([e,n])=>{let r=$a(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:eo(e[0].instrumentationScope),logRecords:e.map(e=>To(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function To(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:ro(e.body,t),eventName:e.eventName,attributes:Eo(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function Eo(e,t){return Object.keys(e).map(n=>no(n,e[n],t))}var Do=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/internal.js"(){io()}}),Oo,ko=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/json/logs.js"(){Do(),uo(),B(),Oo={serializeRequest:e=>{let t=So(e,lo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return z.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}}}}),Ao=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/json/index.js"(){ko()}}),jo,Mo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/trace.js"(){xo(),uo(),B(),jo={serializeRequest:e=>{let t=go(e,lo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return z.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}}}}),No=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/index.js"(){Mo()}}),Po=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/index.js"(){Ao(),No()}});function Fo(){return 2*Vo*Math.random()-Vo}function Io(e){return new Ho(e.transport)}var Lo,Ro,zo,Bo,Vo,Ho,Uo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/retrying-transport.js"(){B(),Lo=5,Ro=1e3,zo=5e3,Bo=1.5,Vo=.2,Ho=class{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=Lo,r=Ro,i=Date.now()+t,a=await this._transport.send(e,t);for(;a.status===`retryable`&&n>0;){n--;let t=Math.max(Math.min(r*(1+Fo()),zo),0);r*=Bo;let o=a.retryInMillis??t,s=i-Date.now();if(o>s)return z.info(`Export retry time ${Math.round(o)}ms exceeds remaining timeout ${Math.round(s)}ms, not retrying further.`),a;z.verbose(`Scheduling export retry in ${Math.round(o)}ms`),a=await this.retry(e,s,o)}return a.status===`success`?z.verbose(`Export succeeded after ${Lo-n} retry attempts.`):a.status===`retryable`?z.info(`Export failed after maximum retry attempts (${Lo}).`):z.info(`Export failed with non-retryable error: ${a.error}`),a}shutdown(){return this._transport.shutdown()}}}});function Wo(e){return e===429||e===502||e===503||e===504}function Go(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var Ko=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/is-export-retryable.js"(){}});function qo(e){return new $o(e)}function Jo(e){return e instanceof TypeError&&!e.cause}var Yo,Xo,Zo,Qo,$o,es=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/fetch-transport.js"(){B(),Ko(),Yo=61440,Xo=9,Zo=0,Qo=0,$o=class{_parameters;constructor(e){this._parameters=e}async send(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),t),i=globalThis.fetch;typeof i.__original==`function`&&(i=i.__original);let a=e.byteLength,o=Zo+a>Yo,s=!o&&!(Qo>=Xo);if(s)Zo+=a,Qo++;else{let e=o?`size limit`:`count limit`;z.debug(`keepalive disabled: ${(a/1024).toFixed(1)}KB payload, ${Qo} pending (${e})`)}try{let t=new URL(this._parameters.url),r=await i(t.href,{method:`POST`,headers:await this._parameters.headers(),body:e,signal:n.signal,keepalive:s,mode:globalThis.location?globalThis.location.origin===t.origin?`same-origin`:`cors`:`no-cors`});return r.status>=200&&r.status<=299?(z.debug(`export response success (status: ${r.status})`),{status:`success`}):Wo(r.status)?(z.warn(`export response retryable (status: ${r.status})`),{status:`retryable`,retryInMillis:Go(r.headers.get(`Retry-After`))}):(z.error(`export response failure (status: ${r.status})`),{status:`failure`,error:/* @__PURE__ */ Error(`Fetch request failed with non-retryable status ${r.status}`)})}catch(e){return Jo(e)?(z.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(z.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{clearTimeout(r),s&&(Zo-=a,Qo--)}}shutdown(){}}}});function ts(e,t){return Fi(e,t,Io({transport:qo(e)}))}var ns=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-browser-http-export-delegate.js"(){Uo(),Ii(),es()}});function rs(e){let t={};return Object.entries(e??{}).forEach(([e,n])=>{typeof n<`u`?t[e]=String(n):z.warn(`Header "${e}" has invalid value (${n}) and will be ignored`)}),t}var is=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/util.js"(){B()}});function as(e,t,n){return async()=>{let r={...await n()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,rs(await e())),Object.assign(i,r)}}function os(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function ss(e,t,n){return{...Ye(e,t,n),headers:as(e.headers,t.headers,n.headers),url:os(e.url)??t.url??n.url}}function cs(e,t){return{...Xe(),headers:async()=>e,url:`http://localhost:4318/`+t}}var ls=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-http-configuration.js"(){Ze(),is()}});function us(e){return typeof e.headers==`function`?e.headers:Je(e.headers)}var ds=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-http-options.js"(){Ze()}});function fs(e,t,n){return ss({url:e.url,timeoutMillis:e.timeoutMillis,headers:us(e),concurrencyLimit:e.concurrencyLimit},{},cs(n,t))}var ps=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-browser-http-options.js"(){ls(),ds()}});function ms(e,t,n,r){return ts(fs(e,n,r),t)}var hs=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/create-legacy-browser-delegate.js"(){ns(),ps()}}),gs=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/index-browser-http.js"(){hs()}}),_s,vs=n({"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/browser/OTLPTraceExporter.js"(){Li(),Po(),gs(),_s=class extends Ue{constructor(e={}){super(ms(e,jo,`v1/traces`,{"Content-Type":`application/json`}))}}}}),ys=n({"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/browser/index.js"(){vs()}}),bs={};r(bs,{OTLPTraceExporter:()=>_s});var xs=n({"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/index.js"(){ys()}}),Ss,Cs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/enums.js"(){Ss=`exception`}}),ws,Ts=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Span.js"(){B(),U(),va(),Cs(),ws=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Rn.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Or.now(),this._performanceOffset=t-(this._performanceStartTime+Or.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return z.warn(`Invalid attribute key: ${e}`),this;if(!$n(t))return z.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return z.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&z.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),Lr(t)&&(Lr(n)||(n=t),t=void 0);let i=Zn(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];a!==void 0&&c>=a?s++:(o[e]=this._truncateToSize(t),c++)}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&z.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=Zn(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];n!==void 0&&o>=n?a++:(i[e]=this._truncateToSize(t),o++)}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===Rn.UNSET||this.status.code===Rn.OK)return this;let t={code:e.code};return e.code===Rn.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&z.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){this._isSpanEnded()?z.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this.endTime=this._getTime(e),this._duration=Nr(this.startTime,this.endTime),this._duration[0]<0&&(z.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&z.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&z.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this))}_getTime(e){if(typeof e==`number`&&e<=Or.now())return jr(e+this._performanceOffset);if(typeof e==`number`)return Ar(e);if(e instanceof Date)return Ar(e.getTime());if(Ir(e))return e;if(this._startTimeProvided)return Ar(Date.now());let t=Or.now()-this._performanceStartTime;return Rr(this.startTime,Ar(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[ca]=e:e&&(e.code?n[ua]=e.code.toString():e.name&&(n[ua]=e.name),e.message&&(n[ca]=e.message),e.stack&&(n[la]=e.stack)),n[ua]||n[ca]?this.addEvent(Ss,n,t):z.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=/* @__PURE__ */ Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);z.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(z.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}}}}),Es,Ds=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Sampler.js"(){(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Es||={})}}),Os,ks=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOffSampler.js"(){Ds(),Os=class{shouldSample(){return{decision:Es.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}}}),As,js=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOnSampler.js"(){Ds(),As=class{shouldSample(){return{decision:Es.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}}}),Ms,Ns=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/ParentBasedSampler.js"(){B(),U(),ks(),js(),Ms=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(V(/* @__PURE__ */ Error(`ParentBasedSampler must have a root sampler configured`)),new As),this._remoteParentSampled=e.remoteParentSampled??new As,this._remoteParentNotSampled=e.remoteParentNotSampled??new Os,this._localParentSampled=e.localParentSampled??new As,this._localParentNotSampled=e.localParentNotSampled??new Os}shouldSample(e,t,n,r,i,a){let o=Gn.getSpanContext(e);return!o||!vn(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&L.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&L.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}}}),Ps,Fs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/TraceIdRatioBasedSampler.js"(){B(),Ds(),Ps=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:gn(t)&&this._accumulate(t)<this._upperBound?Es.RECORD_AND_SAMPLED:Es.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}}}});function Is(){return{sampler:Ls(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function Ls(){let e=zs.ParentBasedAlwaysOn;switch(e){case zs.AlwaysOn:return new As;case zs.AlwaysOff:return new Os;case zs.ParentBasedAlwaysOn:return new Ms({root:new As});case zs.ParentBasedAlwaysOff:return new Ms({root:new Os});case zs.TraceIdRatio:return new Ps(Rs());case zs.ParentBasedTraceIdRatio:return new Ms({root:new Ps(Rs())});default:return z.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${zs.ParentBasedAlwaysOn}".`),new Ms({root:new As})}}function Rs(){return z.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Bs}.`),Bs}var zs,Bs,Vs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/config.js"(){B(),U(),ks(),js(),Ns(),Fs(),(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(zs||={}),Bs=1}});function Hs(e){let t={sampler:Ls()},n=Is(),r=Object.assign({},n,t,e);return r.generalLimits=Object.assign({},n.generalLimits,e.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,e.spanLimits||{}),r}function Us(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??Ws,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??Gs,Object.assign({},e,{spanLimits:t})}var Ws,Gs,Ks=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/utility.js"(){Vs(),U(),Ws=128,Gs=1/0}}),qs,Js=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/BatchSpanProcessorBase.js"(){B(),U(),qs=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,t){this._exporter=e,this._maxExportBatchSize=typeof t?.maxExportBatchSize==`number`?t.maxExportBatchSize:512,this._maxQueueSize=typeof t?.maxQueueSize==`number`?t.maxQueueSize:2048,this._scheduledDelayMillis=typeof t?.scheduledDelayMillis==`number`?t.scheduledDelayMillis:5e3,this._exportTimeoutMillis=typeof t?.exportTimeoutMillis==`number`?t.exportTimeoutMillis:3e4,this._shutdownOnce=new wi(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(z.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&L.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){this._finishedSpans.length>=this._maxQueueSize?(this._droppedSpansCount===0&&z.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++):(this._droppedSpansCount>0&&(z.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(/* @__PURE__ */ Error(`Timeout`))},this._exportTimeoutMillis);R.with(qn(R.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,r=>{clearTimeout(n),r.code===H.SUCCESS?e():t(r.error??/* @__PURE__ */ Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??=[],a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{V(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,V(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}}}),Ys,Xs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/export/BatchSpanProcessor.js"(){Js(),U(),Ys=class extends qs{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this.onInit(t)}onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{V(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{V(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}}}});function Zs(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function Qs(e){let t=``;for(let n=0;n<e.length;n++)t+=rc[e[n]];return t}var $s,ec,tc,nc,rc,ic,ac=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/RandomIdGenerator.js"(){$s=16,ec=8,tc=new Uint8Array($s),nc=new Uint8Array(ec),rc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),ic=class{generateTraceId(){return Zs(tc),Qs(tc)}generateSpanId(){return Zs(nc),Qs(nc)}}}}),oc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/index.js"(){Xs(),ac()}}),sc,cc,lc,uc,dc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/semconv.js"(){sc=`otel.span.parent.origin`,cc=`otel.span.sampling_result`,lc=`otel.sdk.span.live`,uc=`otel.sdk.span.started`}});function fc(e){return e?e.isRemote?`remote`:`local`:`none`}function pc(e){switch(e){case Es.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case Es.RECORD:return`RECORD_ONLY`;case Es.NOT_RECORD:return`DROP`}}var mc,hc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/TracerMetrics.js"(){Ds(),dc(),mc=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(uc,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(lc,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=pc(t);if(this.startedSpans.add(1,{[sc]:fc(e),[cc]:n}),t===Es.NOT_RECORD)return()=>{};let r={[cc]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}}}}),gc,_c=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js"(){gc=`2.7.1`}}),vc,yc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js"(){B(),U(),Ts(),Ks(),oc(),hc(),_c(),vc=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,n,r){let i=Hs(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new ic,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e;let a=i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,gc):Dt();this._tracerMetrics=new mc(a)}startSpan(e,t={},n=R.active()){t.root&&(n=Gn.deleteSpan(n));let r=Gn.getSpan(n);if(Jn(n))return z.debug(`Instrumentation suppressed, returning Noop Span`),Gn.wrapSpanContext(nn);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,s,c;!i||!Gn.isSpanContextValid(i)?s=this._idGenerator.generateTraceId():(s=i.traceId,c=i.traceState,o=i);let l=t.kind??In.INTERNAL,u=(t.links??[]).map(e=>({context:e.context,attributes:Zn(e.attributes)})),d=Zn(t.attributes),f=this._sampler.shouldSample(n,s,e,l,d,u),p=this._tracerMetrics.startSpan(i,f.decision);c=f.traceState??c;let m=f.decision===Pn.RECORD_AND_SAMPLED?L.SAMPLED:L.NONE,h={traceId:s,spanId:a,traceFlags:m,traceState:c};if(f.decision===Pn.NOT_RECORD)return z.debug(`Recording is off, propagating context in a non-recording span`),Gn.wrapSpanContext(h);let g=Zn(Object.assign(d,f.attributes));return new ws({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:h,name:e,kind:l,links:u,parentSpanContext:o,attributes:g,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:p})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??R.active(),c=this.startSpan(e,i,s),l=Gn.setSpan(s,c);return R.with(l,o,void 0,c)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}}}),bc,xc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/MultiSpanProcessor.js"(){U(),bc=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{V(e||/* @__PURE__ */ Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}}}}),Sc,Cc,wc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/BasicTracerProvider.js"(){U(),Qa(),yc(),Vs(),xc(),Ks(),(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Sc||={}),Cc=class{_config;_tracers=/* @__PURE__ */ new Map;_resource;_activeSpanProcessor;constructor(e={}){let t=ci({},Is(),Us(e));this._resource=t.resource??Da(),this._config=Object.assign({},t,{resource:this._resource});let n=[];e.spanProcessors?.length&&n.push(...e.spanProcessors),this._activeSpanProcessor=new bc(n)}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new vc({name:e,version:t,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(/* @__PURE__ */ Error(`Span processor did not completed within timeout period of ${e} ms`)),r=Sc.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Sc.timeout&&(r=Sc.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Sc.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Sc.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}}}),Tc,Ec=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/ConsoleSpanExporter.js"(){U(),Tc=class{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:Fr(e.startTime),duration:Fr(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});if(t)return t({code:H.SUCCESS})}}}}),Dc,Oc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/InMemorySpanExporter.js"(){U(),Dc=class{_finishedSpans=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:H.FAILED,error:/* @__PURE__ */ Error(`Exporter has been stopped`)});this._finishedSpans.push(...e),setTimeout(()=>t({code:H.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}}}),kc,Ac=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/SimpleSpanProcessor.js"(){B(),U(),kc=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new wi(this._shutdown,this),this._pendingExports=/* @__PURE__ */ new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,t){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&L.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>V(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let t=await Oi._export(this._exporter,[e]);if(t.code!==H.SUCCESS)throw t.error??/* @__PURE__ */ Error(`SimpleSpanProcessor: span export failed (status ${t})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}}}),jc,Mc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/NoopSpanProcessor.js"(){jc=class{onStart(e,t){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}}}),Nc={};r(Nc,{AlwaysOffSampler:()=>Os,AlwaysOnSampler:()=>As,BasicTracerProvider:()=>Cc,BatchSpanProcessor:()=>Ys,ConsoleSpanExporter:()=>Tc,InMemorySpanExporter:()=>Dc,NoopSpanProcessor:()=>jc,ParentBasedSampler:()=>Ms,RandomIdGenerator:()=>ic,SamplingDecision:()=>Es,SimpleSpanProcessor:()=>kc,TraceIdRatioBasedSampler:()=>Ps});var Pc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/index.js"(){wc(),oc(),Ec(),Oc(),Ac(),Mc(),ks(),js(),Ns(),Fs(),Ds()}}),Fc,Ic=n({"../../node_modules/.pnpm/@opentelemetry+exporter-logs-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/platform/browser/OTLPLogExporter.js"(){Li(),Po(),gs(),Fc=class extends Ue{constructor(e={}){super(ms(e,Oo,`v1/logs`,{"Content-Type":`application/json`}))}}}}),Lc=n({"../../node_modules/.pnpm/@opentelemetry+exporter-logs-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/platform/browser/index.js"(){Ic()}}),Rc={};r(Rc,{OTLPLogExporter:()=>Fc});var zc=n({"../../node_modules/.pnpm/@opentelemetry+exporter-logs-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/index.js"(){Lc()}});function Bc(e){return Vc(e,/* @__PURE__ */ new WeakSet)}function Vc(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Vc(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Vc(e,t))}return!1}var Hc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/utils/validation.js"(){}}),Uc,Wc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LogRecordImpl.js"(){B(),U(),va(),Hc(),Uc=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=Mr(r??f),this.hrTimeObserved=Mr(i??f),d){let e=Gn.getSpanContext(d);e&&vn(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return z.warn(`Invalid attribute key: ${e}`),this;if(!Bc(t))return z.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&z.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return z.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,ca)||this.setAttribute(ca,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,ua)||this.setAttribute(ua,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,ua)||this.setAttribute(ua,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,ca)||this.setAttribute(ca,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,la)||this.setAttribute(la,n.stack),t=!0)}t||z.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&z.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}}}),Gc,Kc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/Logger.js"(){ra(),B(),Wc(),Gc=class{instrumentationScope;_sharedState;_loggerConfig;constructor(e,t){this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||R.active(),r=e.severityNumber??Ri.UNSPECIFIED;if(r!==Ri.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=Gn.getSpanContext(n);if(e&&vn(e)&&(e.traceFlags&L.SAMPLED)!==L.SAMPLED)return}let i=new Uc(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==Ri.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||R.active();if(t.traceBased){let e=Gn.getSpanContext(r);if(e&&vn(e)&&(e.traceFlags&L.SAMPLED)!==L.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}}}}),qc,Jc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/NoopLogRecordProcessor.js"(){qc=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}}}),Yc,Xc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/MultiLogRecordProcessor.js"(){U(),Yc=class{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>yi(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}});function Zc(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var Qc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/utils.js"(){}}),$c,el=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/semconv.js"(){$c=`otel.sdk.log.created`}}),tl,nl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerMetrics.js"(){el(),tl=class{createdLogs;constructor(e){this.createdLogs=e.createCounter($c,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}}}),rl,il=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/version.js"(){rl=`0.216.0`}}),al,ol,sl,cl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/LoggerProviderSharedState.js"(){B(),ra(),Jc(),Xc(),Qc(),nl(),il(),al={disabled:!1,minimumSeverity:Ri.UNSPECIFIED,traceBased:!1},ol=()=>({...al}),sl=class{loggers=/* @__PURE__ */ new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=/* @__PURE__ */ new Map;constructor(e,t,n,r,i,a){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new Yc(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new qc,this._loggerConfigurator=i??ol;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,rl):Dt();this.loggerMetrics=new tl(o)}getLoggerConfig(e){let t=Zc(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}}}),ll,ul,dl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerProvider.js"(){B(),ra(),Qa(),U(),Kc(),cl(),ll=`unknown`,ul=class{_shutdownOnce;_sharedState;constructor(e={}){let t={resource:e.resource??Da(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??ol,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new sl(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new wi(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return z.warn(`A shutdown LoggerProvider cannot provide a Logger`),Vi;e||z.warn(`Logger requested without instrumentation scope name.`);let r=e||ll,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Gc({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(z.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(z.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}}}),fl,pl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/ConsoleLogRecordExporter.js"(){U(),fl=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:Fr(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:H.SUCCESS})}}}}),ml,hl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/SimpleLogRecordProcessor.js"(){U(),ml=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new wi(this._shutdown,this),this._unresolvedExports=/* @__PURE__ */ new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let t=()=>Oi._export(this._exporter,[e]).then(e=>{e.code!==H.SUCCESS&&V(e.error??/* @__PURE__ */ Error(`SimpleLogRecordProcessor: log record export failed (status ${e})`))}).catch(V);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),t()),V);n!=null&&this._unresolvedExports.add(n)}else t()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}}}),gl,_l=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/InMemoryLogRecordExporter.js"(){U(),gl=class{_finishedLogRecords=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:H.FAILED,error:/* @__PURE__ */ Error(`Exporter has been stopped`)});this._finishedLogRecords.push(...e),t({code:H.SUCCESS})}async shutdown(){this._stopped=!0,this.reset()}async forceFlush(){}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}}}});async function vl(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var yl,bl,xl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/BatchLogRecordProcessorBase.js"(){B(),U(),yl=class{_exportCompleted;_exportScheduledPromise;_exportScheduledResolve;constructor(e,t,n){this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await vl(t),await R.with(qn(R.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){V(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(/* @__PURE__ */ Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===H.SUCCESS?r():i(e.error??/* @__PURE__ */ Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},bl=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_currentExport=null;_finishedLogRecords=[];_timer;_shutdownOnce;_flushing=!1;constructor(e,t){this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new wi(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(z.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new yl(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){V(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new yl(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,V(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}}}),Sl,Cl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/platform/browser/export/BatchLogRecordProcessor.js"(){xl(),Sl=class extends bl{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this._onInit(t)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){e?.disableAutoFlushOnDocumentHide===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}}}}),wl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/platform/browser/index.js"(){Cl()}});function Tl(e){return t=>{let n=t.name;for(let{pattern:t,config:r}of e)if(El(n,t))return{disabled:r.disabled??Dl.disabled,minimumSeverity:r.minimumSeverity??Dl.minimumSeverity,traceBased:r.traceBased??Dl.traceBased};return{...Dl}}}function El(e,t){if(t===e)return!0;if(t.includes(`*`)){let n=t.split(`*`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`.*`);return RegExp(`^${n}$`).test(e)}return!1}var Dl,Ol=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/config/LoggerConfigurators.js"(){ra(),Dl={disabled:!1,minimumSeverity:Ri.UNSPECIFIED,traceBased:!1}}}),kl={};r(kl,{BatchLogRecordProcessor:()=>Sl,ConsoleLogRecordExporter:()=>fl,InMemoryLogRecordExporter:()=>gl,LoggerProvider:()=>ul,SimpleLogRecordProcessor:()=>ml,createLoggerConfigurator:()=>Tl});var Al=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/index.js"(){dl(),pl(),hl(),_l(),wl(),Ol()}});function jl(e){if(globalThis.crypto?.getRandomValues)return globalThis.crypto.getRandomValues(new Uint8Array(e));throw Error(`Jazz requires a cryptographically secure runtime entropy source`)}function Ml(e=jl(16)){let t=e.slice(0,16);return t[6]=t[6]&15|64,t[8]=t[8]&63|128,t}function Nl(e=()=>jl(16)){for(;;){let t=e(),n=new DataView(t.buffer,t.byteOffset,t.byteLength).getBigUint64(0,!0);if(n!==0n)return n}}var Pl=`jazz-snapshot-v1:`,Fl=72,Il=48,Ll=class extends Error{name=`SnapshotRefFormatError`;code=`invalid_snapshot_ref`;constructor(){super(`Invalid or unsupported snapshot reference`)}};function Rl(e){if(typeof e!=`string`||!e.startsWith(Pl))throw new Ll;let t=e.slice(Pl.length);if(t.length<Fl||!/^[0-9a-f]+$/.test(t))throw new Ll;let n=0;for(let e=0;e<4;e++)n+=parseInt(t.slice(64+e*2,66+e*2),16)*2**(e*8);if(t.length!==Fl+n*Il)throw new Ll;return e}var zl=class extends Error{name=`UnsupportedSnapshotError`;code=`unsupported_snapshot`;constructor(e=`Capturing snapshots is not supported by this runtime yet`){super(e)}},Bl=class{native;fatal;constructor(e={}){this.fatal=e.fatal??!1,this.native=typeof globalThis.TextDecoder==`function`?new globalThis.TextDecoder(`utf-8`,e):void 0}decode(e=/* @__PURE__ */ new Uint8Array){if(this.native)return this.native.decode(e);let t=e instanceof Uint8Array?e:new Uint8Array(e),n=[],r=[],i=!1,a=e=>{!i&&(i=!0,e===``)||(r.push(e),r.length===4096&&(n.push(r.join(``)),r=[]))},o=()=>{if(this.fatal)throw TypeError(`The encoded data was not valid UTF-8`);a(`�`)},s=0,c=0,l=128,u=191;for(let e=0;e<t.length;e++){let n=t[e];c===0?n<=127?a(String.fromCharCode(n)):n>=194&&n<=223?(c=1,s=n&31):n>=224&&n<=239?(c=2,s=n&15,n===224&&(l=160),n===237&&(u=159)):n>=240&&n<=244?(c=3,s=n&7,n===240&&(l=144),n===244&&(u=143)):o():n<l||n>u?(c=0,l=128,u=191,o(),e--):(l=128,u=191,s=s<<6|n&63,--c===0&&a(String.fromCodePoint(s)))}return c!==0&&o(),r.length&&n.push(r.join(``)),n.join(``)}};function Vl(e){return e instanceof Error?e:Error(String(e))}function Hl(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ul(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}var Wl=new Bl({fatal:!0});function Gl(e){try{return Wl.decode(e),!0}catch{return!1}}function Kl(e,t){if(t instanceof Uint8Array)return Array.from(t);if(typeof t==`bigint`)return t.toString();if(typeof t==`number`&&!Number.isFinite(t))throw Error(`Cannot serialize non-finite number in schema JSON (key "${e}"): ${t}.`);return t}function ql(e){return Object.fromEntries(Object.keys(e).sort().map(t=>[t,e[t]]))}function Jl(e,t){return JSON.stringify({tables:ql(e),...t?{migrations:t}:{}},Kl)}function Yl(e,t){let n={__jazzRuntimeSchema:1,schema:ql(e),loadedPolicyBundle:t?.loadedPolicyBundle??!1};return JSON.stringify(n,Kl)}new Bl({fatal:!0});function Xl(e){let t=!1;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>=55296&&r<=56319){let r=e.charCodeAt(n+1);if(Number.isNaN(r)||r<56320||r>57343)return!1;t=!0,n+=1}else{if(r>=56320&&r<=57343)return!1;r!==32&&(r<9||r>13)&&(t=!0)}}return t}function Zl(e){return Xl(e)}function Ql(e,t,n){if(typeof e!=`string`)throw Error(`Author identity is missing an issuer`);if(typeof t!=`string`)throw Error(`Author identity is missing a subject`);if(!Xl(e)||!Xl(t))throw Error(`Author issuer and subject must be portable and nonempty`);if(n!==void 0&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(n))throw Error(`Author account must be a canonical UUID`);return JSON.stringify(n===void 0?[e,t]:[n,e,t])}function $l(e){try{let t=JSON.parse(e);if(!Array.isArray(t)||t.length!==2&&t.length!==3)return null;let n=t.length===3?t[0]:void 0;if(n!==void 0&&typeof n!=`string`)return null;let[r,i]=t.slice(+(t.length===3));if(typeof r!=`string`||typeof i!=`string`)return null;let a=Ql(r,i,n);return e===a?{...n===void 0?{}:{account_id:n},issuer:r,user_id:i,canonical:a}:null}catch{return null}}function eu(e){return new TextEncoder().encode(Ql(e.issuer,e.user_id,e.account_id))}function tu(e){if(e.type!==`Row`||e.value.values.length!==2)throw Error(`invalid structured author record`);let[t,n]=e.value.values;if(t?.type!==`Uuid`||n?.type!==`Row`||n.value.values.length!==2)throw Error(`invalid structured author record`);let[r,i]=n.value.values;if(r?.type!==`Text`||i?.type!==`Text`)throw Error(`invalid structured author identity`);Ql(r.value,i.value,t.value)}var nu=`urn:jazz:local-first`,ru=`urn:jazz:anonymous`,iu=`urn:jazz:system`,au=[iu,nu,`urn:jazz:static-bearer`,ru];function ou(e){return au.includes(e)}var su=`__jazz_trusted_reserved_session`,cu=/* @__PURE__ */ new WeakSet,lu=/* @__PURE__ */ new WeakMap,uu=/* @__PURE__ */ new Map;function du(){let e=jl(16);return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function fu(e){return ou(e.issuer)&&cu.add(e),e}function pu(e){if(!cu.has(e)||!ou(e.issuer))return;let t=lu.get(e);return t||(t=du(),lu.set(e,t)),uu.set(t,{account_id:e.account_id,issuer:e.issuer,user_id:e.user_id,authMode:e.authMode}),t}function mu(e,t){if(!ou(e.issuer)||typeof t!=`string`)return!1;let n=uu.get(t);return n?.issuer===e.issuer&&n.account_id===e.account_id&&n.user_id===e.user_id&&n.authMode===e.authMode}var hu=/* @__PURE__ */ new Set([`sub`,`exp`,`nbf`,`iat`,`iss`,`aud`,`jti`]);function gu(e){return e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?Number.isFinite(e):Array.isArray(e)?e.every(gu):Hl(e)&&Object.values(e).every(gu)}function _u(e){let t=Object.create(null);for(let[n,r]of Object.entries(e).sort(vu))!hu.has(n)&&gu(r)&&(t[n]=r);return t}function vu([e],[t]){let n=new TextEncoder().encode(e),r=new TextEncoder().encode(t);for(let e=0;e<Math.min(n.length,r.length);e+=1){let t=n[e]-r[e];if(t!==0)return t}return n.length-r.length}function yu(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function bu(){return globalThis.Buffer}function xu(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;return n===0?t:t+`=`.repeat(4-n)}function Su(e){let t=bu();if(t)try{return t.from(e,`base64`).toString(`utf8`)}catch{return null}if(typeof atob==`function`)try{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return new Bl().decode(n)}catch{return null}return null}function Cu(e){let t=yu(e);if(!t)return null;let n=t.split(`.`);if(n.length<2)return null;let r=n[1];if(r===void 0)return null;let i=Su(xu(r));if(!i)return null;try{let e=JSON.parse(i);return Hl(e)?e:null}catch{return null}}function wu(e){return e!==`disabled`&&e!==`revoked`}var Tu=/* @__PURE__ */ new Set([`expired`,`missing`,`invalid`,`disabled`,`revoked`]);function Eu(e){if(Tu.has(e))return e;let t=e.toLowerCase();return t.includes(`expired`)?`expired`:t.includes(`missing`)?`missing`:t.includes(`disabled`)?`disabled`:t.includes(`revoked`)?`revoked`:`invalid`}var W=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Du(e){let t=``;for(let n=0;n<e.length;n++)t+=W[e[n]&255];return t}function Ou(e,t){return W[e[t]&255]+W[e[t+1]&255]+W[e[t+2]&255]+W[e[t+3]&255]+`-`+W[e[t+4]&255]+W[e[t+5]&255]+`-`+W[e[t+6]&255]+W[e[t+7]&255]+`-`+W[e[t+8]&255]+W[e[t+9]&255]+`-`+W[e[t+10]&255]+W[e[t+11]&255]+W[e[t+12]&255]+W[e[t+13]&255]+W[e[t+14]&255]+W[e[t+15]&255]}var ku=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,Au=/^[0-9a-fA-F]{32}$/;function ju(e){if(!ku.test(e)&&!Au.test(e))return;let t=e.replaceAll(`-`,``),n=/* @__PURE__ */ new Uint8Array(16);for(let e=0;e<16;e+=1)n[e]=Number.parseInt(t.slice(e*2,e*2+2),16);return n}function Mu(e){return Ou(e,0)}var Nu=/* @__PURE__ */ new Map;function Pu(e){if(Nu.size!==0)try{return Nu.get(new URL(e).host)}catch{return}}function Fu(e){return Pu(e)?.fetch??globalThis.fetch}function Iu(e){return Pu(e)?.WebSocket}function Lu(){let e=jl(16),t=Date.now();return e[0]=Math.floor(t/2**40)&255,e[1]=Math.floor(t/2**32)&255,e[2]=Math.floor(t/2**24)&255,e[3]=Math.floor(t/2**16)&255,e[4]=Math.floor(t/256)&255,e[5]=t&255,e[6]=e[6]&15|112,e[8]=e[8]&63|128,[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function Ru(e){let t=new URL(e).protocol;return t===`http:`||t===`https:`}function zu(e){let t=new URL(e).protocol;return t===`http:`||t===`https:`||t===`blob:`}function Bu(e){return new URL(`/`,e).href}function Vu(e,t){try{return new URL(e).href}catch{}if(t)try{return new URL(e,t).href}catch{}return e}function Hu(e,t){if(!t?.wasmVersion)return e;try{let n=new URL(e);return n.searchParams.set(`jazz-runtime-version`,t.wasmVersion),n.href}catch{return e}}function Uu(e,t){try{return new URL(e).href}catch{}return t?new URL(e,t).href:null}function Wu(e,t,n){return!t||Ru(e)||!n&&zu(t)?null:new URL(`jazz_wasm_bg.wasm`,Bu(t)).href}function Gu(e){return e?.wasmModule?{module:e.wasmModule}:e?.wasmSource?{module:e.wasmSource}:null}function Ku(e,t,n){if(n?.wasmUrl)return Hu(Vu(n.wasmUrl,t),n);if(n?.baseUrl){let e=Uu(n.baseUrl,t);if(e)return Hu(new URL(`jazz_wasm_bg.wasm`,e).href,n)}return Wu(typeof e==`function`?e():e,t,!1)}var qu={napi:`2cfa240f13ba55959d2723add8049c60d5d69bea2f5d6dc93d458912b8aaaff2`,wasm:`bde0b4f806aadc6d6864c014b53311739bb921aeb9855eb6b18f26dd14babc04`},Ju=`JAZZ_NATIVE_ARTIFACT_MISMATCH`,Yu=class extends Error{constructor(e,t,n,r,i){super(e),this.kind=t,this.expected=n,this.actual=r,this.missingExport=i}name=`NativeArtifactMismatchError`;code=Ju};function Xu(e,t,n=[]){let r=qu[t.toLowerCase()];if(typeof e.nativeArtifactFingerprint!=`function`)throw new Yu(`Jazz ${t} artifact is stale or incompatible: missing nativeArtifactFingerprint (expected ${r}). In this monorepo rebuild generated bindings; for installed packages reinstall matching Jazz package versions.`,t,r,void 0);let i=e.nativeArtifactFingerprint();if(i!==r)throw new Yu(`Jazz ${t} artifact ABI mismatch: expected ${r}, got ${String(i)}. In this monorepo rebuild generated bindings; for installed packages reinstall matching Jazz package versions.`,t,r,String(i));for(let i of n)if(typeof e[i]!=`function`)throw new Yu(`Jazz ${t} artifact is incomplete despite matching fingerprint: missing ${i}.`,t,r,r,i)}var Zu=class extends Error{},Qu=class extends Error{},$u=/* @__PURE__ */ new Set(`\\.+*?()|[]{}^$#&-~`),ed=/* @__PURE__ */ new Set(`imsUuRx`),td=/* @__PURE__ */ new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]);function nd(e){return $u.has(e)?!0:e.codePointAt(0)>127?!1:!/[0-9A-Za-z<>]/.test(e)}var rd=class{constructor(e){this.pattern=e,this.chars=[...e]}chars;index=0;flags={multiLine:!1,dotAll:!1,swapGreed:!1};fancy=!1;caseInsensitive=!1;captures=0;names=/* @__PURE__ */ new Set;unsupported=[];fancyInvalid=[];bellOutsideClass=!1;parse(){let e;try{e=this.parseAlternation(0),this.eof()||this.fail(`unopened group`)}catch(e){throw e instanceof Zu&&this.fancy?new Qu(e.message):e}return!this.fancy&&this.bellOutsideClass&&this.fail("`\\a` is not supported"),{node:e,fancy:this.fancy,caseInsensitive:this.caseInsensitive,captures:this.captures,unsupported:this.unsupported,fancyInvalid:this.fancyInvalid}}eof(){return this.index>=this.chars.length}char(){return this.chars[this.index]}peek(e=1){return this.chars[this.index+e]}startsWith(e){return this.chars.slice(this.index,this.index+e.length).join(``)===e}fail(e){throw new Zu(e)}parseAlternation(e){let t=[this.parseConcat(e)];for(;!this.eof()&&this.char()===`|`;)this.index++,t.push(this.parseConcat(e));return t.length===1?t[0]:{kind:`alternation`,items:t}}parseConcat(e){let t=[],n=0;for(;!this.eof();){let r=this.char();if(r===`|`||r===`)`)break;if(r===`?`||r===`*`||r===`+`||r===`{`?(n++,n===2&&r===`+`?this.unsupported.push(`possessive quantifiers`):n===2&&r===`{`?this.unsupported.push(`a counted repetition right after another quantifier`):n>=2&&this.fancyInvalid.push(`a quantifier right after another quantifier`)):n=0,r===`(`)t.push(this.parseGroup(e));else if(r===`[`)t.push({kind:`class`,item:this.parseBracketed()});else if(r===`?`||r===`*`||r===`+`){this.index++;let[e,n]=r===`?`?[0,1]:r===`*`?[0,1/0]:[1,1/0],i=!0;!this.eof()&&this.char()===`?`&&(i=!1,this.index++),this.repeatLast(t,e,n,i)}else r===`{`?this.parseCountedRepetition(t):t.push(this.parsePrimitive())}return t.length===1?t[0]:{kind:`concat`,items:t}}repeatLast(e,t,n,r){let i=e.pop();(i===void 0||i.kind===`flags`)&&this.fail(`repetition operator missing expression`),i.kind===`look`&&this.fancyInvalid.push(`a quantifier on a lookaround`),e.push({kind:`repeat`,body:i,min:t,max:n,greedy:r!==this.flags.swapGreed})}skipWhitespaceInRepetition(){let e=!1;for(;!this.eof()&&/\p{White_Space}/u.test(this.char());)this.index++,e=!0;e&&this.unsupported.push(`spaces inside a counted repetition`)}parseDecimal(){this.skipWhitespaceInRepetition();let e=``;for(;!this.eof()&&/[0-9]/.test(this.char());)e+=this.chars[this.index++];if(this.skipWhitespaceInRepetition(),e===``)return;let t=Number(e);return t>4294967295&&this.fail(`repetition count is too large`),t}parseCountedRepetition(e){let t=e[e.length-1];(t===void 0||t.kind===`flags`)&&this.fail(`repetition operator missing expression`),this.index++,this.eof()&&this.fail(`unclosed counted repetition`);let n=this.parseDecimal();this.eof()&&this.fail(`unclosed counted repetition`);let r;if(this.char()===`,`){if(this.index++,this.eof()&&this.fail(`unclosed counted repetition`),this.char()!==`}`){let e=this.parseDecimal();(n===void 0||e===void 0)&&this.fail(`repetition count is empty`),r=e}else n===void 0&&this.fail(`repetition count is empty`),r=1/0}else n===void 0&&this.fail(`repetition count is empty`),r=n;(this.eof()||this.char()!==`}`)&&this.fail(`unclosed counted repetition`),this.index++;let i=!0;!this.eof()&&this.char()===`?`&&(i=!1,this.index++),n>r&&this.fail(`invalid repetition range`),this.repeatLast(e,n,r,i)}parseGroup(e){let t=this.index===0;this.index++;for(let t of[`=`,`!`,`<=`,`<!`])if(this.startsWith(`?${t}`))return this.fancy=!0,this.index+=t.length+1,{kind:`look`,op:t,body:this.parseGroupBody(e)};if(this.startsWith(`?P<`)||this.startsWith(`?<`))return this.index+=this.startsWith(`?P<`)?3:2,this.captures++,this.parseCaptureName(),{kind:`group`,capture:!0,body:this.parseGroupBody(e)};if(!this.eof()&&this.char()===`?`){this.index++,this.eof()&&this.fail(`unclosed group`);let n=this.flags,r=this.parseFlags(),i=this.char();if(this.index++,i===`)`)return r!==void 0&&(r&&t?this.caseInsensitive=!0:this.unsupported.push("`(?i)` anywhere but at the start of the pattern")),{kind:`flags`};r!==void 0&&this.unsupported.push("`(?i)` anywhere but at the start of the pattern");let a=this.parseGroupBody(e);return this.flags=n,{kind:`group`,capture:!1,body:a}}return this.captures++,{kind:`group`,capture:!0,body:this.parseGroupBody(e)}}parseGroupBody(e){let t=this.flags,n=this.parseAlternation(e+1);return this.eof()&&this.fail(`unclosed group`),this.index++,this.flags=t,n}parseCaptureName(){this.eof()&&this.fail(`unexpected end of group name`);let e=``;for(;!this.eof()&&this.char()!==`>`;){let t=this.char();(e===``?t===`_`||/\p{Alphabetic}/u.test(t):t===`_`||t===`.`||t===`[`||t===`]`||/[\p{Alphabetic}\p{N}]/u.test(t))||this.fail(`invalid group name`),e+=t,this.index++}this.eof()&&this.fail(`unexpected end of group name`),this.index++,e===``&&this.fail(`empty group name`),this.names.has(e)&&this.fail(`duplicate group name "${e}"`),this.names.add(e)}parseFlags(){let e=/* @__PURE__ */ new Set,t=!1,n=!1,r,i={...this.flags};for(;this.char()!==`:`&&this.char()!==`)`;){let a=this.char();if(a===`-`)t&&this.fail(`repeated negation in flags`),t=!0,n=!0;else{n=!1,ed.has(a)||this.fail(`unrecognized flag "${a}"`),e.has(a)&&this.fail(`duplicate flag "${a}"`),e.add(a);let o=!t;a===`i`?r=o:a===`m`?i.multiLine=o:a===`s`?i.dotAll=o:a===`U`?i.swapGreed=o:a===`x`?this.unsupported.push("the `x` flag"):a===`R`?this.unsupported.push("the `R` flag"):a===`u`&&!o&&this.unsupported.push("turning off the `u` flag")}this.index++,this.eof()&&this.fail(`unexpected end of flags`)}return n&&this.fail(`dangling flag negation`),e.size===0&&this.char()===`)`&&this.fail(`repetition operator missing expression`),this.flags=i,r}parsePrimitive(){let e=this.char();return e===`\\`?this.parseEscape(!1):(this.index++,e===`.`?{kind:`dot`,dotAll:this.flags.dotAll}:e===`^`?this.assertion(`start`):e===`$`?this.assertion(`end`):{kind:`literal`,char:e})}assertion(e){return{kind:`assertion`,assertion:e,multiLine:this.flags.multiLine}}parseEscape(e){this.index++,this.eof()&&this.fail(`incomplete escape`);let t=this.char();if(/[0-9]/.test(t)){this.fancy=!0;let t=``;for(;!this.eof()&&/[0-9]/.test(this.char());)t+=this.chars[this.index++];return(e||t.startsWith(`0`))&&this.unsupported.push(`\`\\${t}\``),{kind:`backref`,index:Number(t)}}if(t===`x`||t===`u`||t===`U`)return{kind:`literal`,char:this.parseHex(t)};if(t===`p`||t===`P`)return{kind:`class`,item:this.parseUnicodeClass(t===`P`)};if(`dswDSW`.includes(t)){this.index++;let e=t.toLowerCase();return{kind:`class`,item:{kind:`perl`,perl:e,negated:t!==e}}}if(this.index++,nd(t))return{kind:`literal`,char:t};let n={f:`\f`,t:` `,n:`
|
|
1
|
+
var e=Object.defineProperty,t=Object.getOwnPropertyNames,n=(e,n)=>function(){return e&&(n=(0,e[t(e)[0]])(e=0)),n},r=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},i={};r(i,{PendingNativeRead:()=>ve,StreamingMutation:()=>ye,UpstreamLink:()=>be,WasmDb:()=>xe,WasmPendingSubscription:()=>Se,WasmPermissionAdviceRequest:()=>Ce,WasmTransport:()=>M,WasmWrite:()=>N,__testBindingCodecGoldenFixture:()=>a,__testValidateWireFrameBatchCorpus:()=>o,__testWireFrameCorpusFeatures:()=>s,captureTextAnchor:()=>c,captureTextRange:()=>l,currentTimestamp:()=>u,default:()=>_e,deriveUserId:()=>d,drainTraceEntries:()=>f,generateId:()=>p,init:()=>m,initSync:()=>ge,mintAnonymousToken:()=>h,mintLocalFirstToken:()=>g,nativeArtifactFingerprint:()=>_,resolveTextAnchor:()=>ee,resolveTextRange:()=>v,setJsonSchemaValidator:()=>y,setTraceEntryCollectionEnabled:()=>te,subscribeTraceEntries:()=>ne,validateSchema:()=>re});function a(){let e,t;try{let n=F.__testBindingCodecGoldenFixture();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function o(e,t,n){let r=k(e,F.__wbindgen_malloc),i=P,a=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=F.__testValidateWireFrameBatchCorpus(r,i,a,o,s,c);if(l[1])throw j(l[0])}function s(){let e,t;try{let n=F.__testWireFrameCorpusFeatures();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function c(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=F.captureTextAnchor(i,a,!D(t),D(t)?0:t,n,r);if(o[2])throw j(o[1]);return j(o[0])}function l(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=F.captureTextRange(i,a,!D(t),D(t)?0:t,n,r);if(o[2])throw j(o[1]);return j(o[0])}function u(){let e=F.currentTimestamp();return BigInt.asUintN(64,e)}function d(e){let t,n;try{let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=F.deriveUserId(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,j(s[2]);return t=r,n=i,T(r,i)}finally{F.__wbindgen_free(t,n,1)}}function f(){return F.drainTraceEntries()}function p(){let e,t;try{let n=F.generateId();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function m(){F.init()}function h(e,t,n,r){let i,a;try{let c=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P,u=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),d=P,f=F.mintAnonymousToken(c,l,u,d,n,r);var o=f[0],s=f[1];if(f[3])throw o=0,s=0,j(f[2]);return i=o,a=s,T(o,s)}finally{F.__wbindgen_free(i,a,1)}}function g(e,t,n,r){let i,a;try{let c=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P,u=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),d=P,f=F.mintLocalFirstToken(c,l,u,d,n,r);var o=f[0],s=f[1];if(f[3])throw o=0,s=0,j(f[2]);return i=o,a=s,T(o,s)}finally{F.__wbindgen_free(i,a,1)}}function _(){let e,t;try{let n=F.nativeArtifactFingerprint();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function ee(e,t,n){let r=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=F.resolveTextAnchor(e,r,i,!D(n),D(n)?0:n);if(a[2])throw j(a[1]);return j(a[0])}function v(e,t,n){let r=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=F.resolveTextRange(e,r,i,!D(n),D(n)?0:n);if(a[2])throw j(a[1]);return j(a[0])}function y(e){F.setJsonSchemaValidator(e)}function te(e){F.setTraceEntryCollectionEnabled(e)}function ne(e){return F.subscribeTraceEntries(e)}function re(e){let t=k(e,F.__wbindgen_malloc),n=P,r=F.validateSchema(t,n);if(r[1])throw j(r[0])}function b(){return{__proto__:null,"./jazz_wasm_bg.js":{__proto__:null,__wbg_Error_2e59b1b37a9a34c3:function(e,t){return Error(T(e,t))},__wbg_Number_e6ffdb596c888833:function(e){return Number(e)},__wbg_String_8564e559799eccda:function(e,t){let n=A(String(t),F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;w().setInt32(e+4,r,!0),w().setInt32(e+0,n,!0)},__wbg_Window_70131fc0c91e4b3c:function(e){return e.Window},__wbg_WorkerGlobalScope_601c48015b8cc78e:function(e){return e.WorkerGlobalScope},__wbg___wbindgen_bigint_get_as_i64_2c5082002e4826e2:function(e,t){let n=t,r=typeof n==`bigint`?n:void 0;w().setBigInt64(e+8,D(r)?BigInt(0):r,!0),w().setInt32(e+0,!D(r),!0)},__wbg___wbindgen_boolean_get_a86c216575a75c30:function(e){let t=e,n=typeof t==`boolean`?t:void 0;return D(n)?16777215:+!!n},__wbg___wbindgen_debug_string_dd5d2d07ce9e6c57:function(e,t){let n=A(ue(t),F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;w().setInt32(e+4,r,!0),w().setInt32(e+0,n,!0)},__wbg___wbindgen_in_4bd7a57e54337366:function(e,t){return e in t},__wbg___wbindgen_is_bigint_6c98f7e945dacdde:function(e){return typeof e==`bigint`},__wbg___wbindgen_is_function_49868bde5eb1e745:function(e){return typeof e==`function`},__wbg___wbindgen_is_null_344c8750a8525473:function(e){return e===null},__wbg___wbindgen_is_object_40c5a80572e8f9d3:function(e){let t=e;return typeof t==`object`&&!!t},__wbg___wbindgen_is_string_b29b5c5a8065ba1a:function(e){return typeof e==`string`},__wbg___wbindgen_is_undefined_c0cca72b82b86f4d:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_7d430e744a913d26:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944:function(e,t){return e==t},__wbg___wbindgen_number_get_7579aab02a8a620c:function(e,t){let n=t,r=typeof n==`number`?n:void 0;w().setFloat64(e+8,D(r)?0:r,!0),w().setInt32(e+0,!D(r),!0)},__wbg___wbindgen_string_get_914df97fcfa788f2:function(e,t){let n=t,r=typeof n==`string`?n:void 0;var i=D(r)?0:A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P;w().setInt32(e+4,a,!0),w().setInt32(e+0,i,!0)},__wbg___wbindgen_throw_81fc77679af83bc6:function(e,t){throw Error(T(e,t))},__wbg__wbg_cb_unref_3c3b4f651835fbcb:function(e){e._wbg_cb_unref()},__wbg_abort_cfab06d16d2d33a6:function(){return E(function(e){e.abort()},arguments)},__wbg_bound_88db1072ea68e901:function(){return E(function(e,t,n,r){return IDBKeyRange.bound(e,t,n!==0,r!==0)},arguments)},__wbg_call_368fa9c372d473ba:function(){return E(function(e,t,n,r){return e.call(t,n,r)},arguments)},__wbg_call_7f2987183bb62793:function(){return E(function(e,t){return e.call(t)},arguments)},__wbg_call_d578befcc3145dee:function(){return E(function(e,t,n){return e.call(t,n)},arguments)},__wbg_commit_e9c1332714c53826:function(){return E(function(e){e.commit()},arguments)},__wbg_construct_adeb3d5948c3d19a:function(){return E(function(e,t){return Reflect.construct(e,t)},arguments)},__wbg_createObjectStore_6e567b25160be2fa:function(){return E(function(e,t,n,r){return e.createObjectStore(T(t,n),r)},arguments)},__wbg_delete_fc24bd7dfa57938e:function(){return E(function(e,t){return e.delete(t)},arguments)},__wbg_done_547d467e97529006:function(e){return e.done},__wbg_entries_616b1a459b85be0b:function(e){return Object.entries(e)},__wbg_error_58469b8474e13592:function(){return E(function(e){let t=e.error;return D(t)?0:S(t)},arguments)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(T(e,t))}finally{F.__wbindgen_free(n,r,1)}},__wbg_getAll_93336699ea033b51:function(){return E(function(e,t){return e.getAll(t)},arguments)},__wbg_getDate_bafac038eaae076e:function(e){return e.getDate()},__wbg_getDay_6eebc8fe9cb183f5:function(e){return e.getDay()},__wbg_getFullYear_8f83597f7403c865:function(e){return e.getFullYear()},__wbg_getHours_81348c8e800060e7:function(e){return e.getHours()},__wbg_getMinutes_bd1ccf17dab913bf:function(e){return e.getMinutes()},__wbg_getMonth_288607689622719c:function(e){return e.getMonth()},__wbg_getRandomValues_15134f5c0ae6b0d0:function(){return E(function(e,t){globalThis.crypto.getRandomValues(C(e,t))},arguments)},__wbg_getRandomValues_d49329ff89a07af1:function(){return E(function(e,t){globalThis.crypto.getRandomValues(C(e,t))},arguments)},__wbg_getSeconds_edef7266627a185f:function(e){return e.getSeconds()},__wbg_getTime_f6ac312467f7cf09:function(e){return e.getTime()},__wbg_getTimezoneOffset_ac5be603b21a5797:function(e){return e.getTimezoneOffset()},__wbg_get_4848e350b40afc16:function(e,t){return e[t>>>0]},__wbg_get_ed0642c4b9d31ddf:function(){return E(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_f96702c6245e4ef9:function(){return E(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_unchecked_7d7babe32e9e6a54:function(e,t){return e[t>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(e,t){return e[t]},__wbg_global_e30ac0b7684506d0:function(e){return e.global},__wbg_has_3ec5c22db2e5237a:function(){return E(function(e,t){return Reflect.has(e,t)},arguments)},__wbg_indexedDB_065ce3ad400579e3:function(){return E(function(e){let t=e.indexedDB;return D(t)?0:S(t)},arguments)},__wbg_indexedDB_a2139150e2ea2a08:function(){return E(function(e){let t=e.indexedDB;return D(t)?0:S(t)},arguments)},__wbg_indexedDB_af74cb6df65fa636:function(){return E(function(e){let t=e.indexedDB;return D(t)?0:S(t)},arguments)},__wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_DomException_37f96d3fb69189bd:function(e){let t;try{t=e instanceof DOMException}catch{t=!1}return t},__wbg_instanceof_Error_e3390d6805733dad:function(e){let t;try{t=e instanceof Error}catch{t=!1}return t},__wbg_instanceof_IdbDatabase_0af111edb4be95f4:function(e){let t;try{t=e instanceof IDBDatabase}catch{t=!1}return t},__wbg_instanceof_IdbRequest_fc5918c726448f04:function(e){let t;try{t=e instanceof IDBRequest}catch{t=!1}return t},__wbg_instanceof_Map_a10a2795ef4bfe97:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_Uint8Array_4b8da683deb25d72:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_db61795ad004c139:function(e){return Array.isArray(e)},__wbg_isSafeInteger_ea83862ba994770c:function(e){return Number.isSafeInteger(e)},__wbg_iterator_de403ef31815a3e6:function(){return Symbol.iterator},__wbg_length_0c32cb8543c8e4c8:function(e){return e.length},__wbg_length_6e821edde497a532:function(e){return e.length},__wbg_log_6a8b55ee2e172f54:function(e,t,n,r,i,a,o,s){let c,l;try{c=e,l=t,console.log(T(e,t),T(n,r),T(i,a),T(o,s))}finally{F.__wbindgen_free(c,l,1)}},__wbg_lowerBound_279c232a69ac0f79:function(){return E(function(e,t){return IDBKeyRange.lowerBound(e,t!==0)},arguments)},__wbg_message_52a9425f28c45ebc:function(e,t){let n=t.message,r=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;w().setInt32(e+4,i,!0),w().setInt32(e+0,r,!0)},__wbg_message_7367f8c7d0fa1589:function(e){return e.message},__wbg_name_d7bb38b41d6d953e:function(e,t){let n=t.name,r=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;w().setInt32(e+4,i,!0),w().setInt32(e+0,r,!0)},__wbg_new_0_bfa2ef4bc447daa2:function(){return/* @__PURE__ */ new Date},__wbg_new_0f6d2ddfe083319b:function(e){return new Date(e)},__wbg_new_227d7c05414eb861:function(){return/* @__PURE__ */ Error()},__wbg_new_40792555590ec35c:function(e,t){try{var n={a:e,b:t};return new Promise((e,t)=>{let r=n.a;n.a=0;try{return le(r,n.b,e,t)}finally{n.a=r}})}finally{n.a=0}},__wbg_new_4f9fafbb3909af72:function(){return{}},__wbg_new_99cabae501c0a8a0:function(){return/* @__PURE__ */ new Map},__wbg_new_a560378ea1240b14:function(e){return new Uint8Array(e)},__wbg_new_e3b04b4d53d1b593:function(e,t){return Error(T(e,t))},__wbg_new_f3c9df4f38f3f798:function(){return[]},__wbg_new_from_slice_2580ff33d0d10520:function(e,t){return new Uint8Array(C(e,t))},__wbg_new_typed_14d7cc391ce53d2c:function(e,t){try{var n={a:e,b:t};return new Promise((e,t)=>{let r=n.a;n.a=0;try{return le(r,n.b,e,t)}finally{n.a=r}})}finally{n.a=0}},__wbg_new_with_length_9cedd08484b73942:function(e){return new Uint8Array(e>>>0)},__wbg_new_with_year_month_day_d7dc1e63a7b42902:function(e,t,n){return new Date(e>>>0,t,n)},__wbg_next_01132ed6134b8ef5:function(e){return e.next},__wbg_next_b3713ec761a9dbfd:function(){return E(function(e){return e.next()},arguments)},__wbg_now_6798946be0e6fe2b:function(){return E(function(){return Date.now()},arguments)},__wbg_now_88621c9c9a4f3ffc:function(){return Date.now()},__wbg_now_e7c6795a7f81e10f:function(e){return e.now()},__wbg_objectStore_3d4cade4416cd432:function(){return E(function(e,t,n){return e.objectStore(T(t,n))},arguments)},__wbg_open_ac04ec9d75d0eeaf:function(){return E(function(e,t,n,r){return e.open(T(t,n),r>>>0)},arguments)},__wbg_pendingnativeread_new:function(e){return ve.__wrap(e)},__wbg_performance_3fcf6e32a7e1ed0a:function(e){return e.performance},__wbg_prototypesetcall_3e05eb9545565046:function(e,t,n){Uint8Array.prototype.set.call(C(e,t),n)},__wbg_push_6bdbc990be5ac37b:function(e,t){return e.push(t)},__wbg_put_015a7e88e46a2502:function(){return E(function(e,t){return e.put(t)},arguments)},__wbg_queueMicrotask_abaf92f0bd4e80a4:function(e){return e.queueMicrotask},__wbg_queueMicrotask_df5a6dac26d818f3:function(e){queueMicrotask(e)},__wbg_random_a72d453e63c9558c:function(){return Math.random()},__wbg_readyState_accbdf425c074d9c:function(e){let t=e.readyState;return(we.indexOf(t)+1||3)-1},__wbg_reject_1340e1211c01825b:function(e){return Promise.reject(e)},__wbg_resolve_0a79de24e9d2267b:function(e){return Promise.resolve(e)},__wbg_result_452c1006fc727317:function(){return E(function(e){return e.result},arguments)},__wbg_set_08463b1df38a7e29:function(e,t,n){return e.set(t,n)},__wbg_set_16a9c1a07b3d38ec:function(e,t,n){e.set(C(t,n))},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_6c60b2e8ad0e9383:function(e,t,n){e[t>>>0]=n},__wbg_set_8ee2d34facb8466e:function(){return E(function(e,t,n){return Reflect.set(e,t,n)},arguments)},__wbg_set_key_path_6edd6ee0e8d75af3:function(e,t){e.keyPath=t},__wbg_set_onabort_6b6df7a41aa97c23:function(e,t){e.onabort=t},__wbg_set_oncomplete_20fb27150b4ee0d4:function(e,t){e.oncomplete=t},__wbg_set_onerror_2b7dfa4e6dea4159:function(e,t){e.onerror=t},__wbg_set_onerror_3c4b5087146b11b6:function(e,t){e.onerror=t},__wbg_set_onsuccess_f7e5b5cbed5008b1:function(e,t){e.onsuccess=t},__wbg_set_onupgradeneeded_d7e8e03a1999bf5d:function(e,t){e.onupgradeneeded=t},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;w().setInt32(e+4,i,!0),w().setInt32(e+0,r,!0)},__wbg_static_accessor_GLOBAL_THIS_a1248013d790bf5f:function(){let e=typeof globalThis>`u`?null:globalThis;return D(e)?0:S(e)},__wbg_static_accessor_GLOBAL_f2e0f995a21329ff:function(){let e=typeof global>`u`?null:global;return D(e)?0:S(e)},__wbg_static_accessor_SELF_24f78b6d23f286ea:function(){let e=typeof self>`u`?null:self;return D(e)?0:S(e)},__wbg_static_accessor_WINDOW_59fd959c540fe405:function(){let e=typeof window>`u`?null:window;return D(e)?0:S(e)},__wbg_subarray_0f98d3fb634508ad:function(e,t,n){return e.subarray(t>>>0,n>>>0)},__wbg_target_732d56b173b7e87c:function(e){let t=e.target;return D(t)?0:S(t)},__wbg_then_00eed3ac0b8e82cb:function(e,t,n){return e.then(t,n)},__wbg_then_a0c8db0381c8994c:function(e,t){return e.then(t)},__wbg_toString_891d991e862e1d44:function(e){return e.toString()},__wbg_transaction_cc65dcef07fabb06:function(e){return e.transaction},__wbg_transaction_f909284bfed41115:function(){return E(function(e,t,n,r){return e.transaction(T(t,n),Te[r])},arguments)},__wbg_upperBound_2f3c07fb628c7a3c:function(){return E(function(e,t){return IDBKeyRange.upperBound(e,t!==0)},arguments)},__wbg_value_7f6052747ccf940f:function(e){return e.value},__wbg_wasmdb_new:function(e){return xe.__wrap(e)},__wbg_wasmtransport_new:function(e){return M.__wrap(e)},__wbg_wasmwrite_new:function(e){return N.__wrap(e)},__wbindgen_cast_0000000000000001:function(e,t){return O(e,t,se)},__wbindgen_cast_0000000000000002:function(e,t){return O(e,t,oe)},__wbindgen_cast_0000000000000003:function(e,t){return O(e,t,ae)},__wbindgen_cast_0000000000000004:function(e,t){return O(e,t,ce)},__wbindgen_cast_0000000000000005:function(e,t){return O(e,t,x)},__wbindgen_cast_0000000000000006:function(e,t){return O(e,t,ie)},__wbindgen_cast_0000000000000007:function(e){return e},__wbindgen_cast_0000000000000008:function(e){return e},__wbindgen_cast_0000000000000009:function(e,t){return T(e,t)},__wbindgen_cast_000000000000000a:function(e){return BigInt.asUintN(64,e)},__wbindgen_init_externref_table:function(){let e=F.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function x(e,t){F.wasm_bindgen__convert__closures_____invoke__h69610db431037c77(e,t)}function ie(e,t){F.wasm_bindgen__convert__closures_____invoke__h492b14c1fd17d971(e,t)}function ae(e,t,n){F.wasm_bindgen__convert__closures_____invoke__hf83e1094fac4ab4c(e,t,n)}function oe(e,t,n){return F.wasm_bindgen__convert__closures_____invoke__ha1caaa086e6618f0(e,t,n)}function se(e,t,n){let r=F.wasm_bindgen__convert__closures_____invoke__hf2d3ca0c7acb67d9(e,t,n);if(r[1])throw j(r[0])}function ce(e,t,n){let r=F.wasm_bindgen__convert__closures_____invoke__h4803b85f90ea5372(e,t,n);if(r[1])throw j(r[0])}function le(e,t,n,r){F.wasm_bindgen__convert__closures_____invoke__h0c5680e9ed94b2e6(e,t,n,r)}function S(e){let t=F.__externref_table_alloc();return F.__wbindgen_externrefs.set(t,e),t}function ue(e){let t=typeof e;if(t==`number`||t==`boolean`||e==null)return`${e}`;if(t==`string`)return`"${e}"`;if(t==`symbol`){let t=e.description;return t==null?`Symbol`:`Symbol(${t})`}if(t==`function`){let t=e.name;return typeof t==`string`&&t.length>0?`Function(${t})`:`Function`}if(Array.isArray(e)){let t=e.length,n=`[`;t>0&&(n+=ue(e[0]));for(let r=1;r<t;r++)n+=`, `+ue(e[r]);return n+=`]`,n}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r==`Object`)try{return`Object(`+JSON.stringify(e)+`)`}catch{return`Object`}return e instanceof Error?`${e.name}: ${e.message}
|
|
2
|
+
${e.stack}`:r}function de(e,t){e>>>=0;let n=w(),r=[];for(let i=e;i<e+4*t;i+=4)r.push(F.__wbindgen_externrefs.get(n.getUint32(i,!0)));return F.__externref_drop_slice(e,t),r}function C(e,t){return e>>>=0,fe().subarray(e/1,e/1+t)}function w(){return(Fe===null||Fe.buffer.detached===!0||Fe.buffer.detached===void 0&&Fe.buffer!==F.memory.buffer)&&(Fe=new DataView(F.memory.buffer)),Fe}function T(e,t){return e>>>=0,pe(e,t)}function fe(){return(Ie===null||Ie.byteLength===0)&&(Ie=new Uint8Array(F.memory.buffer)),Ie}function E(e,t){try{return e.apply(this,t)}catch(e){let t=S(e);F.__wbindgen_exn_store(t)}}function D(e){return e==null}function O(e,t,n){let r={a:e,b:t,cnt:1},i=(...e)=>{r.cnt++;let t=r.a;r.a=0;try{return n(t,r.b,...e)}finally{r.a=t,i._wbg_cb_unref()}};return i._wbg_cb_unref=()=>{--r.cnt===0&&(F.__wbindgen_destroy_closure(r.a,r.b),r.a=0,Pe.unregister(r))},Pe.register(i,r,r),i}function k(e,t){let n=t(e.length*1,1)>>>0;return fe().set(e,n/1),P=e.length,n}function A(e,t,n){if(n===void 0){let n=Be.encode(e),r=t(n.length,1)>>>0;return fe().subarray(r,r+n.length).set(n),P=n.length,r}let r=e.length,i=t(r,1)>>>0,a=fe(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=fe().subarray(i+o,i+r),a=Be.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return P=o,i}function j(e){let t=F.__wbindgen_externrefs.get(e);return F.__externref_table_dealloc(e),t}function pe(e,t){return ze+=t,ze>=Re&&(Le=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),Le.decode(),ze=t),Le.decode(fe().subarray(e,e+t))}function me(e,t){return F=e.exports,Ve=t,Fe=null,Ie=null,F.__wbindgen_start(),F}async function he(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)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);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}function ge(e){if(F!==void 0)return F;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=b();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),me(new WebAssembly.Instance(e,t),e)}async function _e(e){if(F!==void 0)return F;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`)),e===void 0&&(e=new URL(new URL(`jazz_wasm_bg-xKxGDG9o.wasm`,import.meta.url).href,``+import.meta.url));let t=b();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await he(await e,t);return me(n,r)}var ve,ye,be,xe,Se,Ce,M,N,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,P,Ve,F,He=n({"../../crates/jazz-wasm/pkg/jazz_wasm.js"(){ve=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,De.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,De.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_pendingnativeread_free(e,0)}cancel(){F.pendingnativeread_cancel(this.__wbg_ptr)}poll(){let e=F.pendingnativeread_poll(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}},Symbol.dispose&&(ve.prototype[Symbol.dispose]=ve.prototype.free),ye=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ae.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ae.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_streamingmutation_free(e,0)}abort(){return F.wasmstreamingmutation_abort(this.__wbg_ptr)}finish(){return F.wasmstreamingmutation_finish(this.__wbg_ptr)}finishInTransaction(){let e=F.wasmstreamingmutation_finishInTransaction(this.__wbg_ptr);if(e[1])throw j(e[0])}push(e){let t=k(e,F.__wbindgen_malloc),n=P;return F.wasmstreamingmutation_push(this.__wbg_ptr,t,n)}},Symbol.dispose&&(ye.prototype[Symbol.dispose]=ye.prototype.free),be=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Me.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Me.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_upstreamlink_free(e,0)}handle(e,t){let n,r;try{let o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=F.upstreamlink_handle(this.__wbg_ptr,e,o,s);var i=c[0],a=c[1];if(c[3])throw i=0,a=0,j(c[2]);return n=i,r=a,T(i,a)}finally{F.__wbindgen_free(n,r,1)}}constructor(e){let t=F.upstreamlink_new(e);return this.__wbg_ptr=t>>>0,Me.register(this,this.__wbg_ptr,this),this}},Symbol.dispose&&(be.prototype[Symbol.dispose]=be.prototype.free),xe=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ee.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ee.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmdb_free(e,0)}acceptSubscriber(e,t,n){let r=k(e,F.__wbindgen_malloc),i=P,a=F.wasmdb_acceptSubscriber(this.__wbg_ptr,r,i,t,!D(n),D(n)?BigInt(0):n);if(a[2])throw j(a[1]);return j(a[0])}acceptSubscriberWithSelfSignedProof(e,t,n,r,i){let a=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),u=P,d=F.wasmdb_acceptSubscriberWithSelfSignedProof(this.__wbg_ptr,e,a,o,s,c,l,u,!D(i),D(i)?BigInt(0):i);if(d[2])throw j(d[1]);return j(d[0])}all(e,t,n,r,i){let a=k(e,F.__wbindgen_malloc),o=P;var s=D(n)?0:A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=D(r)?0:k(r,F.__wbindgen_malloc),u=P;let d=F.wasmdb_all(this.__wbg_ptr,a,o,t,s,c,l,u,i);if(d[2])throw j(d[1]);return j(d[0])}beginStreamingMutation(e,t,n,r,i,a,o,s,c,l,u){let d=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),f=P,p=k(t,F.__wbindgen_malloc),m=P,h=k(n,F.__wbindgen_malloc),g=P,_=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),ee=P;var v=D(i)?0:A(i,F.__wbindgen_malloc,F.__wbindgen_realloc),y=P,te=D(a)?0:k(a,F.__wbindgen_malloc),ne=P,re=D(o)?0:k(o,F.__wbindgen_malloc),b=P,x=D(u)?0:A(u,F.__wbindgen_malloc,F.__wbindgen_realloc),ie=P;let ae=F.wasmdb_beginStreamingMutation(this.__wbg_ptr,d,f,p,m,h,g,_,ee,v,y,te,ne,re,b,!D(s),D(s)?0:s,D(c)?0:S(c),D(l)?0:S(l),x,ie);if(ae[2])throw j(ae[1]);return ye.__wrap(ae[0])}beginTransaction(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P;var c=D(n)?0:k(n,F.__wbindgen_malloc),l=P,u=D(r)?0:k(r,F.__wbindgen_malloc),d=P;let f=F.wasmdb_beginTransaction(this.__wbg_ptr,i,a,o,s,c,l,u,d);if(f[1])throw j(f[0])}canInsert(e,t){let n,r;try{let o=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=k(t,F.__wbindgen_malloc),l=P,u=F.wasmdb_canInsert(this.__wbg_ptr,o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,j(u[2]);return n=i,r=a,T(i,a)}finally{F.__wbindgen_free(n,r,1)}}captureSnapshot(){let e=F.wasmdb_captureSnapshot(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}close(){return F.wasmdb_close(this.__wbg_ptr)}commitTransaction(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;var i=D(t)?0:A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P;let o=F.wasmdb_commitTransaction(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return N.__wrap(o[0])}connectUpstream(){let e=F.wasmdb_connectUpstream(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}connectUpstreamWithSession(e,t,n,r,i,a){let o=k(n,F.__wbindgen_malloc),s=P,c=k(i,F.__wbindgen_malloc),l=P,u=F.wasmdb_connectUpstreamWithSession(this.__wbg_ptr,e,t,o,s,r,c,l,a);if(u[2])throw j(u[1]);return j(u[0])}createUpstreamLink(e){let t=F.wasmdb_createUpstreamLink(this.__wbg_ptr,e);return be.__wrap(t)}delete(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=k(t,F.__wbindgen_malloc),o=P,s=F.wasmdb_delete(this.__wbg_ptr,r,i,a,o,n);if(s[2])throw j(s[1]);return N.__wrap(s[0])}deleteInTransaction(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_deleteInTransaction(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[1])throw j(u[0])}static destroyBrowserStorage(e,t){let n=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;return F.wasmdb_destroyBrowserStorage(e,n,r)}evictExpiredStagedLargeValues(){return F.wasmdb_evictExpiredStagedLargeValues(this.__wbg_ptr)}flush(){return F.wasmdb_flush(this.__wbg_ptr)}foregroundTxTimeHighWater(){let e=F.wasmdb_foregroundTxTimeHighWater(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}insert(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=k(t,F.__wbindgen_malloc),o=P,s=F.wasmdb_insert(this.__wbg_ptr,r,i,a,o,n);if(s[2])throw j(s[1]);return N.__wrap(s[0])}insertInTransaction(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_insertInTransaction(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[3])throw j(u[2]);var d=C(u[0],u[1]).slice();return F.__wbindgen_free(u[0],u[1]*1,1),d}localCurrentRow(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_localCurrentRow(this.__wbg_ptr,n,r,i,a);if(o[3])throw j(o[2]);var s=C(o[0],o[1]).slice();return F.__wbindgen_free(o[0],o[1]*1,1),s}onMutationError(e){F.wasmdb_onMutationError(this.__wbg_ptr,e)}onStorageFailure(e){F.wasmdb_onStorageFailure(this.__wbg_ptr,e)}static openBrowser(e,t,n,r){let i=k(t,F.__wbindgen_malloc),a=P,o=k(n,F.__wbindgen_malloc),s=P,c=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P;return F.wasmdb_openBrowser(e,i,a,o,s,c,l)}static openBrowserWithSelfSignedProof(e,t,n,r,i,a,o){let s=k(t,F.__wbindgen_malloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),f=P,p=A(i,F.__wbindgen_malloc,F.__wbindgen_realloc),m=P,h=A(a,F.__wbindgen_malloc,F.__wbindgen_realloc),g=P,_=A(o,F.__wbindgen_malloc,F.__wbindgen_realloc),ee=P;return F.wasmdb_openBrowserWithSelfSignedProof(e,s,c,l,u,d,f,p,m,h,g,_,ee)}static openMemory(t,n){let r=k(t,F.__wbindgen_malloc),i=P,a=k(n,F.__wbindgen_malloc),o=P,s=F.wasmdb_openMemory(r,i,a,o);if(s[2])throw j(s[1]);return e.__wrap(s[0])}static openMemoryAsBackend(t,n){let r=k(t,F.__wbindgen_malloc),i=P,a=k(n,F.__wbindgen_malloc),o=P,s=F.wasmdb_openMemoryAsBackend(r,i,a,o);if(s[2])throw j(s[1]);return e.__wrap(s[0])}static openMemoryWithSelfSignedProof(t,n,r,i,a){let o=k(t,F.__wbindgen_malloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),d=P,f=A(i,F.__wbindgen_malloc,F.__wbindgen_realloc),p=P,m=A(a,F.__wbindgen_malloc,F.__wbindgen_realloc),h=P,g=F.wasmdb_openMemoryWithSelfSignedProof(o,s,c,l,u,d,f,p,m,h);if(g[2])throw j(g[1]);return e.__wrap(g[0])}pendingUploadRows(e){let t=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P,r=F.wasmdb_pendingUploadRows(this.__wbg_ptr,t,n);if(r[3])throw j(r[2]);var i=de(r[0],r[1]).slice();return F.__wbindgen_free(r[0],r[1]*4,4),i}registerSchema(t,n){let r=k(t,F.__wbindgen_malloc),i=P;var a=D(n)?0:k(n,F.__wbindgen_malloc),o=P;let s=F.wasmdb_registerSchema(this.__wbg_ptr,r,i,a,o);if(s[2])throw j(s[1]);return e.__wrap(s[0])}requestDeletePermissionAdvice(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_requestDeletePermissionAdvice(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return Ce.__wrap(o[0])}requestInsertPermissionAdvice(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_requestInsertPermissionAdvice(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return Ce.__wrap(o[0])}requestReadPermissionAdvice(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_requestReadPermissionAdvice(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return Ce.__wrap(o[0])}requestUpdatePermissionAdvice(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=k(t,F.__wbindgen_malloc),o=P,s=k(n,F.__wbindgen_malloc),c=P,l=F.wasmdb_requestUpdatePermissionAdvice(this.__wbg_ptr,r,i,a,o,s,c);if(l[2])throw j(l[1]);return Ce.__wrap(l[0])}restore(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=k(t,F.__wbindgen_malloc),s=P;var c=D(n)?0:k(n,F.__wbindgen_malloc),l=P;let u=F.wasmdb_restore(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[2])throw j(u[1]);return N.__wrap(u[0])}restoreInTransaction(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=k(n,F.__wbindgen_malloc),u=P;var d=D(r)?0:k(r,F.__wbindgen_malloc),f=P;let p=F.wasmdb_restoreInTransaction(this.__wbg_ptr,a,o,s,c,l,u,d,f,i);if(p[1])throw j(p[0])}rollbackTransaction(e){let t=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P,r=F.wasmdb_rollbackTransaction(this.__wbg_ptr,t,n);if(r[1])throw j(r[0])}seedForegroundTxTimeHighWater(e){let t=F.wasmdb_seedForegroundTxTimeHighWater(this.__wbg_ptr,e);if(t[1])throw j(t[0])}setIdentityClaims(e,t){let n=k(e,F.__wbindgen_malloc),r=P,i=F.wasmdb_setIdentityClaims(this.__wbg_ptr,n,r,t);if(i[1])throw j(i[0])}setLargeValueStagingPolicy(e,t,n){let r=F.wasmdb_setLargeValueStagingPolicy(this.__wbg_ptr,e,t,!D(n),D(n)?0:n);if(r[1])throw j(r[0])}setNonDurableClient(){let e=F.wasmdb_setNonDurableClient(this.__wbg_ptr);if(e[1])throw j(e[0])}setRemoteLinkHint(e){let t=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P,r=F.wasmdb_setRemoteLinkHint(this.__wbg_ptr,t,n);if(r[1])throw j(r[0])}setSessionClaims(e){let t=F.wasmdb_setSessionClaims(this.__wbg_ptr,e);if(t[2])throw j(t[1]);return j(t[0])}setSlowQueryThresholdMs(e){let t=F.wasmdb_setSlowQueryThresholdMs(this.__wbg_ptr,e);if(t[1])throw j(t[0])}setSubscriptionBacklogRows(e){let t=F.wasmdb_setSubscriptionBacklogRows(this.__wbg_ptr,e);if(t[1])throw j(t[0])}setTickScheduler(e){F.wasmdb_setTickScheduler(this.__wbg_ptr,e)}subscribe(e,t,n,r){let i=k(e,F.__wbindgen_malloc),a=P;var o=D(n)?0:k(n,F.__wbindgen_malloc),s=P;let c=F.wasmdb_subscribe(this.__wbg_ptr,i,a,t,o,s,r);if(c[2])throw j(c[1]);return j(c[0])}takeSlowQueryReport(e){var t=D(e)?0:A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P;let r=F.wasmdb_takeSlowQueryReport(this.__wbg_ptr,t,n);if(r[3])throw j(r[2]);var i=de(r[0],r[1]).slice();return F.__wbindgen_free(r[0],r[1]*4,4),i}tick(){return F.wasmdb_tick(this.__wbg_ptr)}update(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=k(t,F.__wbindgen_malloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_update(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[2])throw j(u[1]);return N.__wrap(u[0])}updateInTransaction(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=k(r,F.__wbindgen_malloc),f=P,p=F.wasmdb_updateInTransaction(this.__wbg_ptr,a,o,s,c,l,u,d,f,i);if(p[1])throw j(p[0])}updateLargeValues(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=k(t,F.__wbindgen_malloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=F.wasmdb_updateLargeValues(this.__wbg_ptr,a,o,s,c,l,u,r,!D(i),D(i)?0:i);if(d[2])throw j(d[1]);return N.__wrap(d[0])}updateLargeValuesInTransaction(e,t,n,r,i,a){let o=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P,u=k(n,F.__wbindgen_malloc),d=P,f=k(r,F.__wbindgen_malloc),p=P,m=F.wasmdb_updateLargeValuesInTransaction(this.__wbg_ptr,o,s,c,l,u,d,f,p,i,!D(a),D(a)?0:a);if(m[1])throw j(m[0])}uploadStatus(){let e=F.wasmdb_uploadStatus(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}upsert(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=k(t,F.__wbindgen_malloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_upsert(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[2])throw j(u[1]);return N.__wrap(u[0])}upsertInTransaction(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=k(r,F.__wbindgen_malloc),f=P,p=F.wasmdb_upsertInTransaction(this.__wbg_ptr,a,o,s,c,l,u,d,f,i);if(p[1])throw j(p[0])}waitForPendingWrites(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;return F.wasmdb_waitForPendingWrites(this.__wbg_ptr,r,i,D(t)?0:S(t),D(n)?16777215:+!!n)}wireFeatures(){return F.wasmdb_wireFeatures(this.__wbg_ptr)>>>0}},Symbol.dispose&&(xe.prototype[Symbol.dispose]=xe.prototype.free),Se=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Oe.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmpendingsubscription_free(e,0)}cancel(){F.wasmpendingsubscription_cancel(this.__wbg_ptr)}poll(){let e=F.wasmpendingsubscription_poll(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}setWake(e){F.wasmpendingsubscription_setWake(this.__wbg_ptr,e)}},Symbol.dispose&&(Se.prototype[Symbol.dispose]=Se.prototype.free),Ce=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,ke.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ke.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmpermissionadvicerequest_free(e,0)}cancel(){F.wasmpermissionadvicerequest_cancel(this.__wbg_ptr)}get promise(){return F.wasmpermissionadvicerequest_promise(this.__wbg_ptr)}},Symbol.dispose&&(Ce.prototype[Symbol.dispose]=Ce.prototype.free),M=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,je.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,je.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmtransport_free(e,0)}auxiliaryOutboundReady(){return F.wasmtransport_auxiliaryOutboundReady(this.__wbg_ptr)}auxiliaryReceiveTimeoutMs(){let e=F.wasmtransport_auxiliaryReceiveTimeoutMs(this.__wbg_ptr);return e===4294967297?void 0:e}clearOutboundScheduler(){F.wasmtransport_clearOutboundScheduler(this.__wbg_ptr)}close(){return F.wasmtransport_close(this.__wbg_ptr)!==0}expireAuxiliaryReceive(){F.wasmtransport_expireAuxiliaryReceive(this.__wbg_ptr)}recvAuxiliaryWireFrames(e,t){return F.wasmtransport_recvAuxiliaryWireFrames(this.__wbg_ptr,D(e)?4294967297:e>>>0,D(t)?4294967297:t>>>0)}recvWireFrames(){return F.wasmtransport_recvWireFrames(this.__wbg_ptr)}routeAuxiliaryWireFrame(e){let t=k(e,F.__wbindgen_malloc),n=P;return F.wasmtransport_routeAuxiliaryWireFrame(this.__wbg_ptr,t,n)}sendWireFrame(e){let t=k(e,F.__wbindgen_malloc),n=P;F.wasmtransport_sendWireFrame(this.__wbg_ptr,t,n)}sendWireFrames(e){F.wasmtransport_sendWireFrames(this.__wbg_ptr,e)}setAuxiliaryTraceEnabled(e){F.wasmtransport_setAuxiliaryTraceEnabled(this.__wbg_ptr,e)}setOutboundScheduler(e){F.wasmtransport_setOutboundScheduler(this.__wbg_ptr,e)}takeAuxiliaryTrace(){return F.wasmtransport_takeAuxiliaryTrace(this.__wbg_ptr)}tick(){return F.wasmtransport_tick(this.__wbg_ptr)}updateAuthenticatedClaims(e){let t=F.wasmtransport_updateAuthenticatedClaims(this.__wbg_ptr,e);if(t[2])throw j(t[1]);return j(t[0])}upstreamRefusal(){return F.wasmtransport_upstreamRefusal(this.__wbg_ptr)}},Symbol.dispose&&(M.prototype[Symbol.dispose]=M.prototype.free),N=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ne.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ne.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmwrite_free(e,0)}close(){return F.wasmwrite_close(this.__wbg_ptr)!==0}get payload(){let e=F.wasmwrite_payload(this.__wbg_ptr);var t=C(e[0],e[1]).slice();return F.__wbindgen_free(e[0],e[1]*1,1),t}get rowId(){let e=F.wasmwrite_rowId(this.__wbg_ptr);var t=C(e[0],e[1]).slice();return F.__wbindgen_free(e[0],e[1]*1,1),t}get txId(){let e,t;try{let n=F.wasmwrite_txId(this.__wbg_ptr);return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}wait(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=F.wasmwrite_wait(this.__wbg_ptr,n,r,D(t)?16777215:+!!t);if(i[2])throw j(i[1]);return j(i[0])}writeState(){let e=F.wasmwrite_writeState(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}},Symbol.dispose&&(N.prototype[Symbol.dispose]=N.prototype.free),we=[`pending`,`done`],Te=[`readonly`,`readwrite`,`versionchange`,`readwriteflush`,`cleanup`],Ee=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmdb_free(e>>>0,1)),De=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_pendingnativeread_free(e>>>0,1)),Oe=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmpendingsubscription_free(e>>>0,1)),ke=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmpermissionadvicerequest_free(e>>>0,1)),Ae=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_streamingmutation_free(e>>>0,1)),je=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmtransport_free(e>>>0,1)),Me=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_upstreamlink_free(e>>>0,1)),Ne=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmwrite_free(e>>>0,1)),Pe=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbindgen_destroy_closure(e.a,e.b)),Fe=null,Ie=null,Le=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),Le.decode(),Re=2146435072,ze=0,Be=new TextEncoder,`encodeInto`in Be||(Be.encodeInto=function(e,t){let n=Be.encode(e);return t.set(n),{read:e.length,written:n.length}}),P=0}}),Ue,We=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/OTLPExporterBase.js"(){Ue=class{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}}}),Ge,Ke=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/types.js"(){Ge=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}}}});function qe(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function Je(e){if(e!=null)return async()=>e}function Ye(e,t,n){return{timeoutMillis:qe(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function Xe(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var Ze=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/shared-configuration.js"(){}});function Qe(e){return new $e(e.concurrencyLimit)}var $e,et=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/bounded-queue-export-promise-handler.js"(){$e=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}}}),tt,nt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/version.js"(){tt=`1.9.1`}});function rt(e){let t=/* @__PURE__ */ new Set([e]),n=/* @__PURE__ */ new Set,r=e.match(it);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(it);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var it,at,ot=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js"(){nt(),it=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,at=rt(tt)}});function st(e,t,n,r=!1){let i=ft[dt]=ft[dt]??{version:tt};if(!r&&i[e]){let t=/* @__PURE__ */ Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==tt){let t=/* @__PURE__ */ Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${tt}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${tt}.`),!0}function ct(e){let t=ft[dt]?.version;if(t&&at(t))return ft[dt]?.[e]}function lt(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${tt}.`);let n=ft[dt];n&&delete n[e]}var ut,dt,ft,pt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js"(){nt(),ot(),ut=tt.split(`.`)[0],dt=Symbol.for(`opentelemetry.js.api.${ut}`),ft=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}});function mt(e,t,n){let r=ct(`diag`);if(r)return r[e](t,...n)}var ht,gt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js"(){pt(),ht=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return mt(`debug`,this._namespace,e)}error(...e){return mt(`error`,this._namespace,e)}info(...e){return mt(`info`,this._namespace,e)}warn(...e){return mt(`warn`,this._namespace,e)}verbose(...e){return mt(`verbose`,this._namespace,e)}}}}),I,_t=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/types.js"(){(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(I||={})}});function vt(e,t){e<I.NONE?e=I.NONE:e>I.ALL&&(e=I.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,I.ERROR),warn:n(`warn`,I.WARN),info:n(`info`,I.INFO),debug:n(`debug`,I.DEBUG),verbose:n(`verbose`,I.VERBOSE)}}var yt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js"(){_t()}}),bt,xt,St=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js"(){gt(),yt(),_t(),pt(),bt=`diag`,xt=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=ct(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:I.INFO})=>{if(e===t){let e=/* @__PURE__ */ Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=ct(`diag`),i=vt(n.logLevel??I.INFO,e);if(r&&!n.suppressOverrideMessage){let e=(/* @__PURE__ */ Error()).stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return st(`diag`,i,t,!0)},t.disable=()=>{lt(bt,t)},t.createComponentLogger=e=>new ht(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}}});function Ct(e){return Symbol.for(e)}var wt,Tt,Et=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js"(){wt=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):/* @__PURE__ */ new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Tt=new wt}});function Dt(){return Rt}var Ot,kt,At,jt,Mt,Nt,Pt,Ft,It,Lt,Rt,zt,Bt,Vt,Ht,Ut,Wt,Gt,Kt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js"(){Ot=class{constructor(){}createGauge(e,t){return Bt}createHistogram(e,t){return Vt}createCounter(e,t){return zt}createUpDownCounter(e,t){return Ht}createObservableGauge(e,t){return Wt}createObservableCounter(e,t){return Ut}createObservableUpDownCounter(e,t){return Gt}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},kt=class{},At=class extends kt{add(e,t){}},jt=class extends kt{add(e,t){}},Mt=class extends kt{record(e,t){}},Nt=class extends kt{record(e,t){}},Pt=class{addCallback(e){}removeCallback(e){}},Ft=class extends Pt{},It=class extends Pt{},Lt=class extends Pt{},Rt=new Ot,zt=new At,Bt=new Mt,Vt=new Nt,Ht=new jt,Ut=new Ft,Wt=new It,Gt=new Lt}}),qt,Jt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js"(){Et(),qt=class{active(){return Tt}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}}}),Yt,Xt,Zt,Qt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/context.js"(){Jt(),pt(),St(),Yt=`context`,Xt=new qt,Zt=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return st(Yt,e,xt.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return ct(Yt)||Xt}disable(){this._getContextManager().disable(),lt(Yt,xt.instance())}}}}),L,$t=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js"(){(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(L||={})}}),en,tn,nn,rn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js"(){$t(),en=`0000000000000000`,tn=`00000000000000000000000000000000`,nn={traceId:tn,spanId:en,traceFlags:L.NONE}}}),an,on=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js"(){rn(),an=class{constructor(e=nn){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}});function sn(e){return e.getValue(pn)||void 0}function cn(){return sn(Zt.getInstance().active())}function ln(e,t){return e.setValue(pn,t)}function un(e){return e.deleteValue(pn)}function dn(e,t){return ln(e,new an(t))}function fn(e){return sn(e)?.spanContext()}var pn,mn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js"(){Et(),on(),Qt(),pn=Ct(`OpenTelemetry Context Key SPAN`)}});function hn(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(bn[e.charCodeAt(t)]|0)+(bn[e.charCodeAt(t+1)]|0)+(bn[e.charCodeAt(t+2)]|0)+(bn[e.charCodeAt(t+3)]|0);return n===t}function gn(e){return hn(e,32)&&e!==tn}function _n(e){return hn(e,16)&&e!==en}function vn(e){return gn(e.traceId)&&_n(e.spanId)}function yn(e){return new an(e)}var bn,xn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js"(){rn(),on(),bn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}});function Sn(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var Cn,wn,Tn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js"(){Qt(),mn(),on(),xn(),Cn=Zt.getInstance(),wn=class{startSpan(e,t,n=Cn.active()){if(t?.root)return new an;let r=n&&fn(n);return Sn(r)&&vn(r)?new an(r):new an}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??Cn.active(),c=this.startSpan(e,i,s),l=ln(s,c);return Cn.with(l,o,void 0,c)}}}}),En,Dn,On=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js"(){Tn(),En=new wn,Dn=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):En}}}}),kn,An=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js"(){Tn(),kn=class{getTracer(e,t,n){return new wn}}}}),jn,Mn,Nn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js"(){On(),An(),jn=new kn,Mn=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new Dn(this,e,t,n)}getDelegate(){return this._delegate??jn}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}}}),Pn,Fn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.js"(){(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Pn||={})}}),In,Ln=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js"(){(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(In||={})}}),Rn,zn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/status.js"(){(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Rn||={})}}),R,Bn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context-api.js"(){Qt(),R=Zt.getInstance()}}),z,Vn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag-api.js"(){St(),z=xt.instance()}}),Hn,Un,Wn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js"(){pt(),Nn(),xn(),mn(),St(),Hn=`trace`,Un=class e{constructor(){this._proxyTracerProvider=new Mn,this.wrapSpanContext=yn,this.isSpanContextValid=vn,this.deleteSpan=un,this.getSpan=sn,this.getActiveSpan=cn,this.getSpanContext=fn,this.setSpan=ln,this.setSpanContext=dn}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=st(Hn,this._proxyTracerProvider,xt.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return ct(Hn)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){lt(Hn,xt.instance()),this._proxyTracerProvider=new Mn}}}}),Gn,Kn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js"(){Wn(),Gn=Un.getInstance()}}),B=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/index.js"(){Et(),Kt(),Fn(),Ln(),zn(),$t(),xn(),rn(),Bn(),Vn(),Kn()}});function qn(e){return e.setValue(Yn,!0)}function Jn(e){return e.getValue(Yn)===!0}var Yn,Xn=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js"(){B(),Yn=Ct(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)}});function Zn(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Qn(n)){z.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];$n(r)?t[n]=Array.isArray(r)?r.slice():r:z.warn(`Invalid attribute value set for key: ${n}`)}return t}function Qn(e){return typeof e==`string`&&e!==``}function $n(e){return e==null?!0:Array.isArray(e)?er(e):tr(typeof e)}function er(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(tr(e)){t=e;continue}return!1}return!1}}return!0}function tr(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var nr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/attributes.js"(){B()}});function rr(){return e=>{z.error(ir(e))}}function ir(e){return typeof e==`string`?e:JSON.stringify(ar(e))}function ar(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var or=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/logging-error-handler.js"(){B()}});function V(e){try{sr(e)}catch{}}var sr,cr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/global-error-handler.js"(){or(),sr=rr()}}),lr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/environment.js"(){}}),ur,dr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/version.js"(){ur=`2.7.1`}}),fr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"(){}}),pr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"(){fr()}}),mr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"(){}}),hr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"(){mr()}}),gr,_r,vr,yr,br=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"(){gr=`telemetry.sdk.language`,_r=`webjs`,vr=`telemetry.sdk.name`,yr=`telemetry.sdk.version`}}),xr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"(){}}),Sr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js"(){}}),Cr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"(){pr(),hr(),br(),xr(),Sr()}}),wr,Tr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/semconv.js"(){wr=`process.runtime.name`}}),Er,Dr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/sdk-info.js"(){dr(),Cr(),Tr(),Er={[vr]:`opentelemetry`,[wr]:`browser`,[gr]:_r,[yr]:ur}}}),Or,kr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/index.js"(){lr(),Dr(),Or=performance}});function Ar(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Vr)]}function jr(e){return Rr(Ar(Or.timeOrigin),Ar(typeof e==`number`?e:Or.now()))}function Mr(e){if(Ir(e))return e;if(typeof e==`number`)return e<Or.timeOrigin?jr(e):Ar(e);if(e instanceof Date)return Ar(e.getTime());throw TypeError(`Invalid input type`)}function Nr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=Hr),[n,r]}function Pr(e){return e[0]*Hr+e[1]}function Fr(e){return e[0]*1e6+e[1]/1e3}function Ir(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Lr(e){return Ir(e)||typeof e==`number`||e instanceof Date}function Rr(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Hr&&(n[1]-=Hr,n[0]+=1),n}var zr,Br,Vr,Hr,Ur=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/time.js"(){kr(),zr=9,Br=6,Vr=10**Br,Hr=10**zr}}),H,Wr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/ExportResult.js"(){(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(H||={})}});function Gr(e){if(!Kr(e)||qr(e)!==Xr)return!1;let t=ni(e);if(t===null)return!0;let n=ii.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&ei.call(n)===ti}function Kr(e){return typeof e==`object`&&!!e}function qr(e){return e==null?e===void 0?Qr:Zr:ai&&ai in Object(e)?Jr(e):Yr(e)}function Jr(e){let t=ii.call(e,ai),n=e[ai],r=!1;try{e[ai]=void 0,r=!0}catch{}let i=oi.call(e);return r&&(t?e[ai]=n:delete e[ai]),i}function Yr(e){return oi.call(e)}var Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/lodash.merge.js"(){Xr=`[object Object]`,Zr=`[object Null]`,Qr=`[object Undefined]`,$r=Function.prototype,ei=$r.toString,ti=ei.call(Object),ni=Object.getPrototypeOf,ri=Object.prototype,ii=ri.hasOwnProperty,ai=Symbol?Symbol.toStringTag:void 0,oi=ri.toString}});function ci(...e){let t=e.shift(),n=/* @__PURE__ */ new WeakMap;for(;e.length>0;)t=ui(t,e.shift(),0,n);return t}function li(e){return fi(e)?e.slice():e}function ui(e,t,n=0,r){let i;if(!(n>_i)){if(n++,hi(e)||hi(t)||pi(t))i=li(t);else if(fi(e)){if(i=e.slice(),fi(t))for(let e=0,n=t.length;e<n;e++)i.push(li(t[e]));else if(mi(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=li(t[r]))}}}else if(mi(e)){if(mi(t)){if(!gi(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(hi(c))typeof c>`u`?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(di(e,s,r)||di(t,s,r))delete i[s];else{if(mi(a)&&mi(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=ui(i[s],c,n,r)}}}}else i=t}return i}}function di(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function fi(e){return Array.isArray(e)}function pi(e){return typeof e==`function`}function mi(e){return!hi(e)&&!fi(e)&&!pi(e)&&typeof e==`object`}function hi(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e>`u`||e instanceof Date||e instanceof RegExp||e===null}function gi(e,t){return!(!Gr(e)||!Gr(t))}var _i,vi=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/merge.js"(){si(),_i=20}});function yi(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new bi(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var bi,xi=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/timeout.js"(){bi=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}}}),Si,Ci=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/promise.js"(){Si=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}}}),wi,Ti=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/callback.js"(){Ci(),wi=class{_isCalled=!1;_deferred=new Si;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}});function Ei(e,t){return new Promise(n=>{R.with(qn(R.active()),()=>{e.export(t,n)})})}var Di=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/internal/exporter.js"(){B(),Xn()}}),Oi,U=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/index.js"(){nr(),cr(),Ur(),Wr(),kr(),Xn(),vi(),xi(),Ti(),Di(),Oi={_export:Ei}}});function ki(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function Ai(){return{handleResponse(e){e==null||!ki(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||z.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var ji=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/logging-response-handler.js"(){B()}});function Mi(e,t){return new Ni(e.transport,e.serializer,Ai(),e.promiseHandler,t.timeout)}var Ni,Pi=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-export-delegate.js"(){U(),Ke(),ji(),B(),Ni=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=z.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:H.FAILED,error:/* @__PURE__ */ Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);n==null?t({code:H.FAILED,error:/* @__PURE__ */ Error(`Nothing to send`)}):this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:H.SUCCESS})}else e.status===`failure`&&e.error?t({code:H.FAILED,error:e.error}):e.status===`retryable`?t({code:H.FAILED,error:e.error??new Ge(`Export failed with retryable status`)}):t({code:H.FAILED,error:new Ge(`Export failed with unknown error`)})},e=>t({code:H.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}}}});function Fi(e,t,n){return Mi({transport:n,serializer:t,promiseHandler:Qe(e)},{timeout:e.timeoutMillis})}var Ii=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-network-export-delegate.js"(){et(),Pi()}}),Li=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/index.js"(){We()}}),Ri,zi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/types/LogRecord.js"(){(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(Ri||={})}}),Bi,Vi,Hi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLogger.js"(){Bi=class{emit(e){}enabled(){return!1}},Vi=new Bi}});function Ui(e,t,n){return r=>r===e?t:n}var Wi,Gi,Ki,qi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/internal/global-utils.js"(){Wi=Symbol.for(`io.opentelemetry.js.api.logs`),Gi=globalThis,Ki=1}}),Ji,Yi,Xi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLoggerProvider.js"(){Hi(),Ji=class{getLogger(e,t,n){return new Bi}},Yi=new Ji}}),Zi,Qi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLogger.js"(){Hi(),Zi=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Vi}}}}),$i,ea=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLoggerProvider.js"(){Xi(),Qi(),$i=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new Zi(this,e,t,n)}_getDelegate(){return this._delegate??Yi}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}}}}),ta,na=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/api/logs.js"(){qi(),Xi(),ea(),ta=class e{constructor(){this._proxyLoggerProvider=new $i}static getInstance(){return this._instance||=new e,this._instance}setGlobalLoggerProvider(e){return Gi[Wi]?this.getLoggerProvider():(Gi[Wi]=Ui(Ki,e,Yi),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return Gi[Wi]?.call(Gi,Ki)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete Gi[Wi],this._proxyLoggerProvider=new $i}}}}),ra=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/index.js"(){zi(),Hi(),na(),ta.getInstance()}}),ia=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"(){}}),aa=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"(){ia()}}),oa=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"(){}}),sa=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"(){oa()}}),ca,la,ua,da,fa,pa,ma,ha=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"(){ca=`exception.message`,la=`exception.stacktrace`,ua=`exception.type`,da=`service.name`,fa=`telemetry.sdk.language`,pa=`telemetry.sdk.name`,ma=`telemetry.sdk.version`}}),ga=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"(){}}),_a=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js"(){}}),va=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"(){aa(),sa(),ha(),ga(),_a()}});function ya(){if(ba===void 0)try{let e=globalThis.process.argv0;ba=e?`unknown_service:${e}`:`unknown_service`}catch{ba=`unknown_service`}return ba}var ba,xa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/default-service-name.js"(){}}),Sa,Ca=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/utils.js"(){Sa=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}});function wa(e,t){return ja.FromAttributeList(Object.entries(e),t)}function Ta(e,t){return new ja(e,t)}function Ea(){return wa({})}function Da(){return wa({[da]:ya(),[fa]:Er[fa],[pa]:Er[pa],[ma]:Er[ma]})}function Oa(e){return e.map(([e,t])=>Sa(t)?[e,t.catch(t=>{z.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function ka(e){if(typeof e==`string`||e===void 0)return e;z.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Aa(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;z.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var ja,Ma=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js"(){B(),U(),va(),xa(),Ca(),ja=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Oa(t),r._asyncAttributesPending=t.filter(([e,t])=>Sa(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Sa(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Oa(this._rawAttributes),this._schemaUrl=ka(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,Sa(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&z.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes)Sa(n)?z.debug(`Unsettled resource attribute ${t} skipped`):n!=null&&(e[t]??=n);return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Aa(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}}}),Na,Pa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detect-resources.js"(){B(),Ma(),Na=(e={})=>(e.detectors||[]).map(t=>{try{let n=Ta(t.detect(e));return z.debug(`${t.constructor.name} found resource.`,n),n}catch(e){return z.debug(`${t.constructor.name} failed: ${e.message}`),Ea()}}).reduce((e,t)=>e.merge(t),Ea())}}),Fa,Ia,La=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/EnvDetector.js"(){B(),va(),U(),Fa=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=`,`;_LABEL_KEY_VALUE_SPLITTER=`=`;detect(e){return{attributes:{}}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR).filter(e=>e.trim()!==``);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER);if(n.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${e}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[r,i]=n,a=r.trim(),o=i.trim();if(a.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${e}".`);let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch(t){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${e}": ${t instanceof Error?t.message:t}`)}if(s.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${s}".`);if(c.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${s}".`);t[s]=c}return t}},Ia=new Fa}}),Ra,za,Ba=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/NoopDetector.js"(){Ra=class{detect(){return{attributes:{}}}},za=new Ra}}),Va,Ha=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/HostDetector.js"(){Ba(),Va=za}}),Ua,Wa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/OSDetector.js"(){Ba(),Ua=za}}),Ga,Ka=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/ProcessDetector.js"(){Ba(),Ga=za}}),qa,Ja=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/ServiceInstanceIdDetector.js"(){Ba(),qa=za}}),Ya=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/index.js"(){Ha(),Wa(),Ka(),Ja()}}),Xa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/index.js"(){La(),Ya()}}),Za={};r(Za,{defaultResource:()=>Da,defaultServiceName:()=>ya,detectResources:()=>Na,emptyResource:()=>Ea,envDetector:()=>Ia,hostDetector:()=>Va,osDetector:()=>Ua,processDetector:()=>Ga,resourceFromAttributes:()=>wa,serviceInstanceIdDetector:()=>qa});var Qa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/index.js"(){Pa(),Xa(),Ma(),xa()}});function $a(e,t){let n={attributes:to(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function eo(e){return{name:e.name,version:e.version}}function to(e,t){return Object.keys(e).map(n=>no(n,e[n],t))}function no(e,t,n){return{key:e,value:ro(t,n)}}function ro(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=ro(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:ro(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}var io=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/internal.js"(){}});function ao(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function oo(e){return ao(e).toString()}function so(e){return e}var co,lo,uo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js"(){U(),co=typeof BigInt<`u`?oo:Pr,lo={encodeHrTime:co,encodeSpanContext:so,encodeOptionalSpanContext:so,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}}}});function fo(e,t){let n=e&255|yo;return t&&(n|=bo),n}function po(e,t){let n=e.spanContext(),r=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:to(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>ho(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>mo(e,t)),droppedLinksCount:e.droppedLinksCount,flags:fo(n.traceFlags,e.parentSpanContext?.isRemote)}}function mo(e,t){return{attributes:e.attributes?to(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:fo(e.context.traceFlags,e.context.isRemote)}}function ho(e,t){return{attributes:e.attributes?to(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function go(e,t){return{resourceSpans:vo(e,t)}}function _o(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=t.get(n.resource);e||(e=/* @__PURE__ */ new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function vo(e,t){let n=_o(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>po(e,t));o.push({scope:eo(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=$a(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var yo,bo,xo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js"(){io(),yo=256,bo=512}});function So(e,t){return{resourceLogs:wo(e,t)}}function Co(e){let t=/* @__PURE__ */ new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=/* @__PURE__ */ new Map,t.set(e,o));let s=`${r}@${i}:${a}`,c=o.get(s);c||(c=[],o.set(s,c)),c.push(n)}return t}function wo(e,t){let n=Co(e);return Array.from(n,([e,n])=>{let r=$a(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:eo(e[0].instrumentationScope),logRecords:e.map(e=>To(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function To(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:ro(e.body,t),eventName:e.eventName,attributes:Eo(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function Eo(e,t){return Object.keys(e).map(n=>no(n,e[n],t))}var Do=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/internal.js"(){io()}}),Oo,ko=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/json/logs.js"(){Do(),uo(),B(),Oo={serializeRequest:e=>{let t=So(e,lo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return z.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}}}}),Ao=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/json/index.js"(){ko()}}),jo,Mo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/trace.js"(){xo(),uo(),B(),jo={serializeRequest:e=>{let t=go(e,lo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return z.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}}}}),No=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/index.js"(){Mo()}}),Po=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/index.js"(){Ao(),No()}});function Fo(){return 2*Vo*Math.random()-Vo}function Io(e){return new Ho(e.transport)}var Lo,Ro,zo,Bo,Vo,Ho,Uo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/retrying-transport.js"(){B(),Lo=5,Ro=1e3,zo=5e3,Bo=1.5,Vo=.2,Ho=class{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=Lo,r=Ro,i=Date.now()+t,a=await this._transport.send(e,t);for(;a.status===`retryable`&&n>0;){n--;let t=Math.max(Math.min(r*(1+Fo()),zo),0);r*=Bo;let o=a.retryInMillis??t,s=i-Date.now();if(o>s)return z.info(`Export retry time ${Math.round(o)}ms exceeds remaining timeout ${Math.round(s)}ms, not retrying further.`),a;z.verbose(`Scheduling export retry in ${Math.round(o)}ms`),a=await this.retry(e,s,o)}return a.status===`success`?z.verbose(`Export succeeded after ${Lo-n} retry attempts.`):a.status===`retryable`?z.info(`Export failed after maximum retry attempts (${Lo}).`):z.info(`Export failed with non-retryable error: ${a.error}`),a}shutdown(){return this._transport.shutdown()}}}});function Wo(e){return e===429||e===502||e===503||e===504}function Go(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var Ko=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/is-export-retryable.js"(){}});function qo(e){return new $o(e)}function Jo(e){return e instanceof TypeError&&!e.cause}var Yo,Xo,Zo,Qo,$o,es=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/fetch-transport.js"(){B(),Ko(),Yo=61440,Xo=9,Zo=0,Qo=0,$o=class{_parameters;constructor(e){this._parameters=e}async send(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),t),i=globalThis.fetch;typeof i.__original==`function`&&(i=i.__original);let a=e.byteLength,o=Zo+a>Yo,s=!o&&!(Qo>=Xo);if(s)Zo+=a,Qo++;else{let e=o?`size limit`:`count limit`;z.debug(`keepalive disabled: ${(a/1024).toFixed(1)}KB payload, ${Qo} pending (${e})`)}try{let t=new URL(this._parameters.url),r=await i(t.href,{method:`POST`,headers:await this._parameters.headers(),body:e,signal:n.signal,keepalive:s,mode:globalThis.location?globalThis.location.origin===t.origin?`same-origin`:`cors`:`no-cors`});return r.status>=200&&r.status<=299?(z.debug(`export response success (status: ${r.status})`),{status:`success`}):Wo(r.status)?(z.warn(`export response retryable (status: ${r.status})`),{status:`retryable`,retryInMillis:Go(r.headers.get(`Retry-After`))}):(z.error(`export response failure (status: ${r.status})`),{status:`failure`,error:/* @__PURE__ */ Error(`Fetch request failed with non-retryable status ${r.status}`)})}catch(e){return Jo(e)?(z.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(z.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{clearTimeout(r),s&&(Zo-=a,Qo--)}}shutdown(){}}}});function ts(e,t){return Fi(e,t,Io({transport:qo(e)}))}var ns=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-browser-http-export-delegate.js"(){Uo(),Ii(),es()}});function rs(e){let t={};return Object.entries(e??{}).forEach(([e,n])=>{typeof n<`u`?t[e]=String(n):z.warn(`Header "${e}" has invalid value (${n}) and will be ignored`)}),t}var is=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/util.js"(){B()}});function as(e,t,n){return async()=>{let r={...await n()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,rs(await e())),Object.assign(i,r)}}function os(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function ss(e,t,n){return{...Ye(e,t,n),headers:as(e.headers,t.headers,n.headers),url:os(e.url)??t.url??n.url}}function cs(e,t){return{...Xe(),headers:async()=>e,url:`http://localhost:4318/`+t}}var ls=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-http-configuration.js"(){Ze(),is()}});function us(e){return typeof e.headers==`function`?e.headers:Je(e.headers)}var ds=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-http-options.js"(){Ze()}});function fs(e,t,n){return ss({url:e.url,timeoutMillis:e.timeoutMillis,headers:us(e),concurrencyLimit:e.concurrencyLimit},{},cs(n,t))}var ps=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-browser-http-options.js"(){ls(),ds()}});function ms(e,t,n,r){return ts(fs(e,n,r),t)}var hs=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/create-legacy-browser-delegate.js"(){ns(),ps()}}),gs=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/index-browser-http.js"(){hs()}}),_s,vs=n({"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/browser/OTLPTraceExporter.js"(){Li(),Po(),gs(),_s=class extends Ue{constructor(e={}){super(ms(e,jo,`v1/traces`,{"Content-Type":`application/json`}))}}}}),ys=n({"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/browser/index.js"(){vs()}}),bs={};r(bs,{OTLPTraceExporter:()=>_s});var xs=n({"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/index.js"(){ys()}}),Ss,Cs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/enums.js"(){Ss=`exception`}}),ws,Ts=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Span.js"(){B(),U(),va(),Cs(),ws=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Rn.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Or.now(),this._performanceOffset=t-(this._performanceStartTime+Or.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return z.warn(`Invalid attribute key: ${e}`),this;if(!$n(t))return z.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return z.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&z.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),Lr(t)&&(Lr(n)||(n=t),t=void 0);let i=Zn(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];a!==void 0&&c>=a?s++:(o[e]=this._truncateToSize(t),c++)}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&z.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=Zn(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];n!==void 0&&o>=n?a++:(i[e]=this._truncateToSize(t),o++)}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===Rn.UNSET||this.status.code===Rn.OK)return this;let t={code:e.code};return e.code===Rn.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&z.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){this._isSpanEnded()?z.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this.endTime=this._getTime(e),this._duration=Nr(this.startTime,this.endTime),this._duration[0]<0&&(z.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&z.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&z.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this))}_getTime(e){if(typeof e==`number`&&e<=Or.now())return jr(e+this._performanceOffset);if(typeof e==`number`)return Ar(e);if(e instanceof Date)return Ar(e.getTime());if(Ir(e))return e;if(this._startTimeProvided)return Ar(Date.now());let t=Or.now()-this._performanceStartTime;return Rr(this.startTime,Ar(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[ca]=e:e&&(e.code?n[ua]=e.code.toString():e.name&&(n[ua]=e.name),e.message&&(n[ca]=e.message),e.stack&&(n[la]=e.stack)),n[ua]||n[ca]?this.addEvent(Ss,n,t):z.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=/* @__PURE__ */ Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);z.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(z.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}}}}),Es,Ds=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Sampler.js"(){(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Es||={})}}),Os,ks=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOffSampler.js"(){Ds(),Os=class{shouldSample(){return{decision:Es.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}}}),As,js=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOnSampler.js"(){Ds(),As=class{shouldSample(){return{decision:Es.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}}}),Ms,Ns=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/ParentBasedSampler.js"(){B(),U(),ks(),js(),Ms=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(V(/* @__PURE__ */ Error(`ParentBasedSampler must have a root sampler configured`)),new As),this._remoteParentSampled=e.remoteParentSampled??new As,this._remoteParentNotSampled=e.remoteParentNotSampled??new Os,this._localParentSampled=e.localParentSampled??new As,this._localParentNotSampled=e.localParentNotSampled??new Os}shouldSample(e,t,n,r,i,a){let o=Gn.getSpanContext(e);return!o||!vn(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&L.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&L.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}}}),Ps,Fs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/TraceIdRatioBasedSampler.js"(){B(),Ds(),Ps=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:gn(t)&&this._accumulate(t)<this._upperBound?Es.RECORD_AND_SAMPLED:Es.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}}}});function Is(){return{sampler:Ls(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function Ls(){let e=zs.ParentBasedAlwaysOn;switch(e){case zs.AlwaysOn:return new As;case zs.AlwaysOff:return new Os;case zs.ParentBasedAlwaysOn:return new Ms({root:new As});case zs.ParentBasedAlwaysOff:return new Ms({root:new Os});case zs.TraceIdRatio:return new Ps(Rs());case zs.ParentBasedTraceIdRatio:return new Ms({root:new Ps(Rs())});default:return z.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${zs.ParentBasedAlwaysOn}".`),new Ms({root:new As})}}function Rs(){return z.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Bs}.`),Bs}var zs,Bs,Vs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/config.js"(){B(),U(),ks(),js(),Ns(),Fs(),(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(zs||={}),Bs=1}});function Hs(e){let t={sampler:Ls()},n=Is(),r=Object.assign({},n,t,e);return r.generalLimits=Object.assign({},n.generalLimits,e.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,e.spanLimits||{}),r}function Us(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??Ws,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??Gs,Object.assign({},e,{spanLimits:t})}var Ws,Gs,Ks=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/utility.js"(){Vs(),U(),Ws=128,Gs=1/0}}),qs,Js=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/BatchSpanProcessorBase.js"(){B(),U(),qs=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,t){this._exporter=e,this._maxExportBatchSize=typeof t?.maxExportBatchSize==`number`?t.maxExportBatchSize:512,this._maxQueueSize=typeof t?.maxQueueSize==`number`?t.maxQueueSize:2048,this._scheduledDelayMillis=typeof t?.scheduledDelayMillis==`number`?t.scheduledDelayMillis:5e3,this._exportTimeoutMillis=typeof t?.exportTimeoutMillis==`number`?t.exportTimeoutMillis:3e4,this._shutdownOnce=new wi(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(z.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&L.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){this._finishedSpans.length>=this._maxQueueSize?(this._droppedSpansCount===0&&z.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++):(this._droppedSpansCount>0&&(z.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(/* @__PURE__ */ Error(`Timeout`))},this._exportTimeoutMillis);R.with(qn(R.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,r=>{clearTimeout(n),r.code===H.SUCCESS?e():t(r.error??/* @__PURE__ */ Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??=[],a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{V(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,V(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}}}),Ys,Xs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/export/BatchSpanProcessor.js"(){Js(),U(),Ys=class extends qs{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this.onInit(t)}onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{V(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{V(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}}}});function Zs(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function Qs(e){let t=``;for(let n=0;n<e.length;n++)t+=rc[e[n]];return t}var $s,ec,tc,nc,rc,ic,ac=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/RandomIdGenerator.js"(){$s=16,ec=8,tc=new Uint8Array($s),nc=new Uint8Array(ec),rc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),ic=class{generateTraceId(){return Zs(tc),Qs(tc)}generateSpanId(){return Zs(nc),Qs(nc)}}}}),oc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/index.js"(){Xs(),ac()}}),sc,cc,lc,uc,dc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/semconv.js"(){sc=`otel.span.parent.origin`,cc=`otel.span.sampling_result`,lc=`otel.sdk.span.live`,uc=`otel.sdk.span.started`}});function fc(e){return e?e.isRemote?`remote`:`local`:`none`}function pc(e){switch(e){case Es.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case Es.RECORD:return`RECORD_ONLY`;case Es.NOT_RECORD:return`DROP`}}var mc,hc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/TracerMetrics.js"(){Ds(),dc(),mc=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(uc,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(lc,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=pc(t);if(this.startedSpans.add(1,{[sc]:fc(e),[cc]:n}),t===Es.NOT_RECORD)return()=>{};let r={[cc]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}}}}),gc,_c=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js"(){gc=`2.7.1`}}),vc,yc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js"(){B(),U(),Ts(),Ks(),oc(),hc(),_c(),vc=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,n,r){let i=Hs(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new ic,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e;let a=i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,gc):Dt();this._tracerMetrics=new mc(a)}startSpan(e,t={},n=R.active()){t.root&&(n=Gn.deleteSpan(n));let r=Gn.getSpan(n);if(Jn(n))return z.debug(`Instrumentation suppressed, returning Noop Span`),Gn.wrapSpanContext(nn);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,s,c;!i||!Gn.isSpanContextValid(i)?s=this._idGenerator.generateTraceId():(s=i.traceId,c=i.traceState,o=i);let l=t.kind??In.INTERNAL,u=(t.links??[]).map(e=>({context:e.context,attributes:Zn(e.attributes)})),d=Zn(t.attributes),f=this._sampler.shouldSample(n,s,e,l,d,u),p=this._tracerMetrics.startSpan(i,f.decision);c=f.traceState??c;let m=f.decision===Pn.RECORD_AND_SAMPLED?L.SAMPLED:L.NONE,h={traceId:s,spanId:a,traceFlags:m,traceState:c};if(f.decision===Pn.NOT_RECORD)return z.debug(`Recording is off, propagating context in a non-recording span`),Gn.wrapSpanContext(h);let g=Zn(Object.assign(d,f.attributes));return new ws({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:h,name:e,kind:l,links:u,parentSpanContext:o,attributes:g,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:p})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??R.active(),c=this.startSpan(e,i,s),l=Gn.setSpan(s,c);return R.with(l,o,void 0,c)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}}}),bc,xc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/MultiSpanProcessor.js"(){U(),bc=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{V(e||/* @__PURE__ */ Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}}}}),Sc,Cc,wc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/BasicTracerProvider.js"(){U(),Qa(),yc(),Vs(),xc(),Ks(),(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Sc||={}),Cc=class{_config;_tracers=/* @__PURE__ */ new Map;_resource;_activeSpanProcessor;constructor(e={}){let t=ci({},Is(),Us(e));this._resource=t.resource??Da(),this._config=Object.assign({},t,{resource:this._resource});let n=[];e.spanProcessors?.length&&n.push(...e.spanProcessors),this._activeSpanProcessor=new bc(n)}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new vc({name:e,version:t,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(/* @__PURE__ */ Error(`Span processor did not completed within timeout period of ${e} ms`)),r=Sc.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Sc.timeout&&(r=Sc.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Sc.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Sc.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}}}),Tc,Ec=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/ConsoleSpanExporter.js"(){U(),Tc=class{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:Fr(e.startTime),duration:Fr(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});if(t)return t({code:H.SUCCESS})}}}}),Dc,Oc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/InMemorySpanExporter.js"(){U(),Dc=class{_finishedSpans=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:H.FAILED,error:/* @__PURE__ */ Error(`Exporter has been stopped`)});this._finishedSpans.push(...e),setTimeout(()=>t({code:H.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}}}),kc,Ac=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/SimpleSpanProcessor.js"(){B(),U(),kc=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new wi(this._shutdown,this),this._pendingExports=/* @__PURE__ */ new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,t){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&L.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>V(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let t=await Oi._export(this._exporter,[e]);if(t.code!==H.SUCCESS)throw t.error??/* @__PURE__ */ Error(`SimpleSpanProcessor: span export failed (status ${t})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}}}),jc,Mc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/NoopSpanProcessor.js"(){jc=class{onStart(e,t){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}}}),Nc={};r(Nc,{AlwaysOffSampler:()=>Os,AlwaysOnSampler:()=>As,BasicTracerProvider:()=>Cc,BatchSpanProcessor:()=>Ys,ConsoleSpanExporter:()=>Tc,InMemorySpanExporter:()=>Dc,NoopSpanProcessor:()=>jc,ParentBasedSampler:()=>Ms,RandomIdGenerator:()=>ic,SamplingDecision:()=>Es,SimpleSpanProcessor:()=>kc,TraceIdRatioBasedSampler:()=>Ps});var Pc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/index.js"(){wc(),oc(),Ec(),Oc(),Ac(),Mc(),ks(),js(),Ns(),Fs(),Ds()}}),Fc,Ic=n({"../../node_modules/.pnpm/@opentelemetry+exporter-logs-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/platform/browser/OTLPLogExporter.js"(){Li(),Po(),gs(),Fc=class extends Ue{constructor(e={}){super(ms(e,Oo,`v1/logs`,{"Content-Type":`application/json`}))}}}}),Lc=n({"../../node_modules/.pnpm/@opentelemetry+exporter-logs-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/platform/browser/index.js"(){Ic()}}),Rc={};r(Rc,{OTLPLogExporter:()=>Fc});var zc=n({"../../node_modules/.pnpm/@opentelemetry+exporter-logs-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/index.js"(){Lc()}});function Bc(e){return Vc(e,/* @__PURE__ */ new WeakSet)}function Vc(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Vc(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Vc(e,t))}return!1}var Hc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/utils/validation.js"(){}}),Uc,Wc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LogRecordImpl.js"(){B(),U(),va(),Hc(),Uc=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=Mr(r??f),this.hrTimeObserved=Mr(i??f),d){let e=Gn.getSpanContext(d);e&&vn(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return z.warn(`Invalid attribute key: ${e}`),this;if(!Bc(t))return z.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&z.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return z.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,ca)||this.setAttribute(ca,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,ua)||this.setAttribute(ua,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,ua)||this.setAttribute(ua,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,ca)||this.setAttribute(ca,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,la)||this.setAttribute(la,n.stack),t=!0)}t||z.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&z.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}}}),Gc,Kc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/Logger.js"(){ra(),B(),Wc(),Gc=class{instrumentationScope;_sharedState;_loggerConfig;constructor(e,t){this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||R.active(),r=e.severityNumber??Ri.UNSPECIFIED;if(r!==Ri.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=Gn.getSpanContext(n);if(e&&vn(e)&&(e.traceFlags&L.SAMPLED)!==L.SAMPLED)return}let i=new Uc(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==Ri.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||R.active();if(t.traceBased){let e=Gn.getSpanContext(r);if(e&&vn(e)&&(e.traceFlags&L.SAMPLED)!==L.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}}}}),qc,Jc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/NoopLogRecordProcessor.js"(){qc=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}}}),Yc,Xc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/MultiLogRecordProcessor.js"(){U(),Yc=class{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>yi(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}});function Zc(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var Qc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/utils.js"(){}}),$c,el=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/semconv.js"(){$c=`otel.sdk.log.created`}}),tl,nl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerMetrics.js"(){el(),tl=class{createdLogs;constructor(e){this.createdLogs=e.createCounter($c,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}}}),rl,il=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/version.js"(){rl=`0.216.0`}}),al,ol,sl,cl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/LoggerProviderSharedState.js"(){B(),ra(),Jc(),Xc(),Qc(),nl(),il(),al={disabled:!1,minimumSeverity:Ri.UNSPECIFIED,traceBased:!1},ol=()=>({...al}),sl=class{loggers=/* @__PURE__ */ new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=/* @__PURE__ */ new Map;constructor(e,t,n,r,i,a){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new Yc(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new qc,this._loggerConfigurator=i??ol;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,rl):Dt();this.loggerMetrics=new tl(o)}getLoggerConfig(e){let t=Zc(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}}}),ll,ul,dl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerProvider.js"(){B(),ra(),Qa(),U(),Kc(),cl(),ll=`unknown`,ul=class{_shutdownOnce;_sharedState;constructor(e={}){let t={resource:e.resource??Da(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??ol,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new sl(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new wi(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return z.warn(`A shutdown LoggerProvider cannot provide a Logger`),Vi;e||z.warn(`Logger requested without instrumentation scope name.`);let r=e||ll,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Gc({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(z.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(z.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}}}),fl,pl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/ConsoleLogRecordExporter.js"(){U(),fl=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:Fr(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:H.SUCCESS})}}}}),ml,hl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/SimpleLogRecordProcessor.js"(){U(),ml=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new wi(this._shutdown,this),this._unresolvedExports=/* @__PURE__ */ new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let t=()=>Oi._export(this._exporter,[e]).then(e=>{e.code!==H.SUCCESS&&V(e.error??/* @__PURE__ */ Error(`SimpleLogRecordProcessor: log record export failed (status ${e})`))}).catch(V);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),t()),V);n!=null&&this._unresolvedExports.add(n)}else t()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}}}),gl,_l=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/InMemoryLogRecordExporter.js"(){U(),gl=class{_finishedLogRecords=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:H.FAILED,error:/* @__PURE__ */ Error(`Exporter has been stopped`)});this._finishedLogRecords.push(...e),t({code:H.SUCCESS})}async shutdown(){this._stopped=!0,this.reset()}async forceFlush(){}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}}}});async function vl(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var yl,bl,xl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/BatchLogRecordProcessorBase.js"(){B(),U(),yl=class{_exportCompleted;_exportScheduledPromise;_exportScheduledResolve;constructor(e,t,n){this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await vl(t),await R.with(qn(R.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){V(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(/* @__PURE__ */ Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===H.SUCCESS?r():i(e.error??/* @__PURE__ */ Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},bl=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_currentExport=null;_finishedLogRecords=[];_timer;_shutdownOnce;_flushing=!1;constructor(e,t){this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new wi(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(z.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new yl(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){V(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new yl(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,V(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}}}),Sl,Cl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/platform/browser/export/BatchLogRecordProcessor.js"(){xl(),Sl=class extends bl{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this._onInit(t)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){e?.disableAutoFlushOnDocumentHide===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}}}}),wl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/platform/browser/index.js"(){Cl()}});function Tl(e){return t=>{let n=t.name;for(let{pattern:t,config:r}of e)if(El(n,t))return{disabled:r.disabled??Dl.disabled,minimumSeverity:r.minimumSeverity??Dl.minimumSeverity,traceBased:r.traceBased??Dl.traceBased};return{...Dl}}}function El(e,t){if(t===e)return!0;if(t.includes(`*`)){let n=t.split(`*`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`.*`);return RegExp(`^${n}$`).test(e)}return!1}var Dl,Ol=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/config/LoggerConfigurators.js"(){ra(),Dl={disabled:!1,minimumSeverity:Ri.UNSPECIFIED,traceBased:!1}}}),kl={};r(kl,{BatchLogRecordProcessor:()=>Sl,ConsoleLogRecordExporter:()=>fl,InMemoryLogRecordExporter:()=>gl,LoggerProvider:()=>ul,SimpleLogRecordProcessor:()=>ml,createLoggerConfigurator:()=>Tl});var Al=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/index.js"(){dl(),pl(),hl(),_l(),wl(),Ol()}});function jl(e){if(globalThis.crypto?.getRandomValues)return globalThis.crypto.getRandomValues(new Uint8Array(e));throw Error(`Jazz requires a cryptographically secure runtime entropy source`)}function Ml(e=jl(16)){let t=e.slice(0,16);return t[6]=t[6]&15|64,t[8]=t[8]&63|128,t}function Nl(e=()=>jl(16)){for(;;){let t=e(),n=new DataView(t.buffer,t.byteOffset,t.byteLength).getBigUint64(0,!0);if(n!==0n)return n}}var Pl=`jazz-snapshot-v1:`,Fl=72,Il=48,Ll=class extends Error{name=`SnapshotRefFormatError`;code=`invalid_snapshot_ref`;constructor(){super(`Invalid or unsupported snapshot reference`)}};function Rl(e){if(typeof e!=`string`||!e.startsWith(Pl))throw new Ll;let t=e.slice(Pl.length);if(t.length<Fl||!/^[0-9a-f]+$/.test(t))throw new Ll;let n=0;for(let e=0;e<4;e++)n+=parseInt(t.slice(64+e*2,66+e*2),16)*2**(e*8);if(t.length!==Fl+n*Il)throw new Ll;return e}var zl=class extends Error{name=`UnsupportedSnapshotError`;code=`unsupported_snapshot`;constructor(e=`Capturing snapshots is not supported by this runtime yet`){super(e)}},Bl=class{native;fatal;constructor(e={}){this.fatal=e.fatal??!1,this.native=typeof globalThis.TextDecoder==`function`?new globalThis.TextDecoder(`utf-8`,e):void 0}decode(e=/* @__PURE__ */ new Uint8Array){if(this.native)return this.native.decode(e);let t=e instanceof Uint8Array?e:new Uint8Array(e),n=[],r=[],i=!1,a=e=>{!i&&(i=!0,e===``)||(r.push(e),r.length===4096&&(n.push(r.join(``)),r=[]))},o=()=>{if(this.fatal)throw TypeError(`The encoded data was not valid UTF-8`);a(`�`)},s=0,c=0,l=128,u=191;for(let e=0;e<t.length;e++){let n=t[e];c===0?n<=127?a(String.fromCharCode(n)):n>=194&&n<=223?(c=1,s=n&31):n>=224&&n<=239?(c=2,s=n&15,n===224&&(l=160),n===237&&(u=159)):n>=240&&n<=244?(c=3,s=n&7,n===240&&(l=144),n===244&&(u=143)):o():n<l||n>u?(c=0,l=128,u=191,o(),e--):(l=128,u=191,s=s<<6|n&63,--c===0&&a(String.fromCodePoint(s)))}return c!==0&&o(),r.length&&n.push(r.join(``)),n.join(``)}};function Vl(e){return e instanceof Error?e:Error(String(e))}function Hl(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ul(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}var Wl=new Bl({fatal:!0});function Gl(e){try{return Wl.decode(e),!0}catch{return!1}}function Kl(e,t){if(t instanceof Uint8Array)return Array.from(t);if(typeof t==`bigint`)return t.toString();if(typeof t==`number`&&!Number.isFinite(t))throw Error(`Cannot serialize non-finite number in schema JSON (key "${e}"): ${t}.`);return t}function ql(e){return Object.fromEntries(Object.keys(e).sort().map(t=>[t,e[t]]))}function Jl(e,t){return JSON.stringify({tables:ql(e),...t?{migrations:t}:{}},Kl)}function Yl(e,t){let n={__jazzRuntimeSchema:1,schema:ql(e),loadedPolicyBundle:t?.loadedPolicyBundle??!1};return JSON.stringify(n,Kl)}new Bl({fatal:!0});function Xl(e){let t=!1;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>=55296&&r<=56319){let r=e.charCodeAt(n+1);if(Number.isNaN(r)||r<56320||r>57343)return!1;t=!0,n+=1}else{if(r>=56320&&r<=57343)return!1;r!==32&&(r<9||r>13)&&(t=!0)}}return t}function Zl(e){return Xl(e)}function Ql(e,t,n){if(typeof e!=`string`)throw Error(`Author identity is missing an issuer`);if(typeof t!=`string`)throw Error(`Author identity is missing a subject`);if(!Xl(e)||!Xl(t))throw Error(`Author issuer and subject must be portable and nonempty`);if(n!==void 0&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(n))throw Error(`Author account must be a canonical UUID`);return JSON.stringify(n===void 0?[e,t]:[n,e,t])}function $l(e){try{let t=JSON.parse(e);if(!Array.isArray(t)||t.length!==2&&t.length!==3)return null;let n=t.length===3?t[0]:void 0;if(n!==void 0&&typeof n!=`string`)return null;let[r,i]=t.slice(+(t.length===3));if(typeof r!=`string`||typeof i!=`string`)return null;let a=Ql(r,i,n);return e===a?{...n===void 0?{}:{account_id:n},issuer:r,user_id:i,canonical:a}:null}catch{return null}}function eu(e){return new TextEncoder().encode(Ql(e.issuer,e.user_id,e.account_id))}function tu(e){if(e.type!==`Row`||e.value.values.length!==2)throw Error(`invalid structured author record`);let[t,n]=e.value.values;if(t?.type!==`Uuid`||n?.type!==`Row`||n.value.values.length!==2)throw Error(`invalid structured author record`);let[r,i]=n.value.values;if(r?.type!==`Text`||i?.type!==`Text`)throw Error(`invalid structured author identity`);Ql(r.value,i.value,t.value)}var nu=`urn:jazz:local-first`,ru=`urn:jazz:anonymous`,iu=`urn:jazz:system`,au=[iu,nu,`urn:jazz:static-bearer`,ru];function ou(e){return au.includes(e)}var su=`__jazz_trusted_reserved_session`,cu=/* @__PURE__ */ new WeakSet,lu=/* @__PURE__ */ new WeakMap,uu=/* @__PURE__ */ new Map;function du(){let e=jl(16);return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function fu(e){return ou(e.issuer)&&cu.add(e),e}function pu(e){if(!cu.has(e)||!ou(e.issuer))return;let t=lu.get(e);return t||(t=du(),lu.set(e,t)),uu.set(t,{account_id:e.account_id,issuer:e.issuer,user_id:e.user_id,authMode:e.authMode}),t}function mu(e,t){if(!ou(e.issuer)||typeof t!=`string`)return!1;let n=uu.get(t);return n?.issuer===e.issuer&&n.account_id===e.account_id&&n.user_id===e.user_id&&n.authMode===e.authMode}var hu=/* @__PURE__ */ new Set([`sub`,`exp`,`nbf`,`iat`,`iss`,`aud`,`jti`]);function gu(e){return e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?Number.isFinite(e):Array.isArray(e)?e.every(gu):Hl(e)&&Object.values(e).every(gu)}function _u(e){let t=Object.create(null);for(let[n,r]of Object.entries(e).sort(vu))!hu.has(n)&&gu(r)&&(t[n]=r);return t}function vu([e],[t]){let n=new TextEncoder().encode(e),r=new TextEncoder().encode(t);for(let e=0;e<Math.min(n.length,r.length);e+=1){let t=n[e]-r[e];if(t!==0)return t}return n.length-r.length}function yu(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function bu(){return globalThis.Buffer}function xu(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;return n===0?t:t+`=`.repeat(4-n)}function Su(e){let t=bu();if(t)try{return t.from(e,`base64`).toString(`utf8`)}catch{return null}if(typeof atob==`function`)try{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return new Bl().decode(n)}catch{return null}return null}function Cu(e){let t=yu(e);if(!t)return null;let n=t.split(`.`);if(n.length<2)return null;let r=n[1];if(r===void 0)return null;let i=Su(xu(r));if(!i)return null;try{let e=JSON.parse(i);return Hl(e)?e:null}catch{return null}}function wu(e){return e!==`disabled`&&e!==`revoked`}var Tu=/* @__PURE__ */ new Set([`expired`,`missing`,`invalid`,`disabled`,`revoked`]);function Eu(e){if(Tu.has(e))return e;let t=e.toLowerCase();return t.includes(`expired`)?`expired`:t.includes(`missing`)?`missing`:t.includes(`disabled`)?`disabled`:t.includes(`revoked`)?`revoked`:`invalid`}var W=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Du(e){let t=``;for(let n=0;n<e.length;n++)t+=W[e[n]&255];return t}function Ou(e,t){return W[e[t]&255]+W[e[t+1]&255]+W[e[t+2]&255]+W[e[t+3]&255]+`-`+W[e[t+4]&255]+W[e[t+5]&255]+`-`+W[e[t+6]&255]+W[e[t+7]&255]+`-`+W[e[t+8]&255]+W[e[t+9]&255]+`-`+W[e[t+10]&255]+W[e[t+11]&255]+W[e[t+12]&255]+W[e[t+13]&255]+W[e[t+14]&255]+W[e[t+15]&255]}var ku=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,Au=/^[0-9a-fA-F]{32}$/;function ju(e){if(!ku.test(e)&&!Au.test(e))return;let t=e.replaceAll(`-`,``),n=/* @__PURE__ */ new Uint8Array(16);for(let e=0;e<16;e+=1)n[e]=Number.parseInt(t.slice(e*2,e*2+2),16);return n}function Mu(e){return Ou(e,0)}var Nu=/* @__PURE__ */ new Map;function Pu(e){if(Nu.size!==0)try{return Nu.get(new URL(e).host)}catch{return}}function Fu(e){return Pu(e)?.fetch??globalThis.fetch}function Iu(e){return Pu(e)?.WebSocket}function Lu(){let e=jl(16),t=Date.now();return e[0]=Math.floor(t/2**40)&255,e[1]=Math.floor(t/2**32)&255,e[2]=Math.floor(t/2**24)&255,e[3]=Math.floor(t/2**16)&255,e[4]=Math.floor(t/256)&255,e[5]=t&255,e[6]=e[6]&15|112,e[8]=e[8]&63|128,[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function Ru(e){let t=new URL(e).protocol;return t===`http:`||t===`https:`}function zu(e){let t=new URL(e).protocol;return t===`http:`||t===`https:`||t===`blob:`}function Bu(e){return new URL(`/`,e).href}function Vu(e,t){try{return new URL(e).href}catch{}if(t)try{return new URL(e,t).href}catch{}return e}function Hu(e,t){if(!t?.wasmVersion)return e;try{let n=new URL(e);return n.searchParams.set(`jazz-runtime-version`,t.wasmVersion),n.href}catch{return e}}function Uu(e,t){try{return new URL(e).href}catch{}return t?new URL(e,t).href:null}function Wu(e,t,n){return!t||Ru(e)||!n&&zu(t)?null:new URL(`jazz_wasm_bg.wasm`,Bu(t)).href}function Gu(e){return e?.wasmModule?{module:e.wasmModule}:e?.wasmSource?{module:e.wasmSource}:null}function Ku(e,t,n){if(n?.wasmUrl)return Hu(Vu(n.wasmUrl,t),n);if(n?.baseUrl){let e=Uu(n.baseUrl,t);if(e)return Hu(new URL(`jazz_wasm_bg.wasm`,e).href,n)}return Wu(typeof e==`function`?e():e,t,!1)}var qu={napi:`d3aaba19fad564d7b9fd7bb48069ba1108f14a3abc380657acfcc34541371055`,wasm:`272cb61e2685cf57a27656463d3647d1fb2d2a713bd565c6fe908c5e11311321`},Ju=`JAZZ_NATIVE_ARTIFACT_MISMATCH`,Yu=class extends Error{constructor(e,t,n,r,i){super(e),this.kind=t,this.expected=n,this.actual=r,this.missingExport=i}name=`NativeArtifactMismatchError`;code=Ju};function Xu(e,t,n=[]){let r=qu[t.toLowerCase()];if(typeof e.nativeArtifactFingerprint!=`function`)throw new Yu(`Jazz ${t} artifact is stale or incompatible: missing nativeArtifactFingerprint (expected ${r}). In this monorepo rebuild generated bindings; for installed packages reinstall matching Jazz package versions.`,t,r,void 0);let i=e.nativeArtifactFingerprint();if(i!==r)throw new Yu(`Jazz ${t} artifact ABI mismatch: expected ${r}, got ${String(i)}. In this monorepo rebuild generated bindings; for installed packages reinstall matching Jazz package versions.`,t,r,String(i));for(let i of n)if(typeof e[i]!=`function`)throw new Yu(`Jazz ${t} artifact is incomplete despite matching fingerprint: missing ${i}.`,t,r,r,i)}var Zu=class extends Error{},Qu=class extends Error{},$u=/* @__PURE__ */ new Set(`\\.+*?()|[]{}^$#&-~`),ed=/* @__PURE__ */ new Set(`imsUuRx`),td=/* @__PURE__ */ new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]);function nd(e){return $u.has(e)?!0:e.codePointAt(0)>127?!1:!/[0-9A-Za-z<>]/.test(e)}var rd=class{constructor(e){this.pattern=e,this.chars=[...e]}chars;index=0;flags={multiLine:!1,dotAll:!1,swapGreed:!1};fancy=!1;caseInsensitive=!1;captures=0;names=/* @__PURE__ */ new Set;unsupported=[];fancyInvalid=[];bellOutsideClass=!1;parse(){let e;try{e=this.parseAlternation(0),this.eof()||this.fail(`unopened group`)}catch(e){throw e instanceof Zu&&this.fancy?new Qu(e.message):e}return!this.fancy&&this.bellOutsideClass&&this.fail("`\\a` is not supported"),{node:e,fancy:this.fancy,caseInsensitive:this.caseInsensitive,captures:this.captures,unsupported:this.unsupported,fancyInvalid:this.fancyInvalid}}eof(){return this.index>=this.chars.length}char(){return this.chars[this.index]}peek(e=1){return this.chars[this.index+e]}startsWith(e){return this.chars.slice(this.index,this.index+e.length).join(``)===e}fail(e){throw new Zu(e)}parseAlternation(e){let t=[this.parseConcat(e)];for(;!this.eof()&&this.char()===`|`;)this.index++,t.push(this.parseConcat(e));return t.length===1?t[0]:{kind:`alternation`,items:t}}parseConcat(e){let t=[],n=0;for(;!this.eof();){let r=this.char();if(r===`|`||r===`)`)break;if(r===`?`||r===`*`||r===`+`||r===`{`?(n++,n===2&&r===`+`?this.unsupported.push(`possessive quantifiers`):n===2&&r===`{`?this.unsupported.push(`a counted repetition right after another quantifier`):n>=2&&this.fancyInvalid.push(`a quantifier right after another quantifier`)):n=0,r===`(`)t.push(this.parseGroup(e));else if(r===`[`)t.push({kind:`class`,item:this.parseBracketed()});else if(r===`?`||r===`*`||r===`+`){this.index++;let[e,n]=r===`?`?[0,1]:r===`*`?[0,1/0]:[1,1/0],i=!0;!this.eof()&&this.char()===`?`&&(i=!1,this.index++),this.repeatLast(t,e,n,i)}else r===`{`?this.parseCountedRepetition(t):t.push(this.parsePrimitive())}return t.length===1?t[0]:{kind:`concat`,items:t}}repeatLast(e,t,n,r){let i=e.pop();(i===void 0||i.kind===`flags`)&&this.fail(`repetition operator missing expression`),i.kind===`look`&&this.fancyInvalid.push(`a quantifier on a lookaround`),e.push({kind:`repeat`,body:i,min:t,max:n,greedy:r!==this.flags.swapGreed})}skipWhitespaceInRepetition(){let e=!1;for(;!this.eof()&&/\p{White_Space}/u.test(this.char());)this.index++,e=!0;e&&this.unsupported.push(`spaces inside a counted repetition`)}parseDecimal(){this.skipWhitespaceInRepetition();let e=``;for(;!this.eof()&&/[0-9]/.test(this.char());)e+=this.chars[this.index++];if(this.skipWhitespaceInRepetition(),e===``)return;let t=Number(e);return t>4294967295&&this.fail(`repetition count is too large`),t}parseCountedRepetition(e){let t=e[e.length-1];(t===void 0||t.kind===`flags`)&&this.fail(`repetition operator missing expression`),this.index++,this.eof()&&this.fail(`unclosed counted repetition`);let n=this.parseDecimal();this.eof()&&this.fail(`unclosed counted repetition`);let r;if(this.char()===`,`){if(this.index++,this.eof()&&this.fail(`unclosed counted repetition`),this.char()!==`}`){let e=this.parseDecimal();(n===void 0||e===void 0)&&this.fail(`repetition count is empty`),r=e}else n===void 0&&this.fail(`repetition count is empty`),r=1/0}else n===void 0&&this.fail(`repetition count is empty`),r=n;(this.eof()||this.char()!==`}`)&&this.fail(`unclosed counted repetition`),this.index++;let i=!0;!this.eof()&&this.char()===`?`&&(i=!1,this.index++),n>r&&this.fail(`invalid repetition range`),this.repeatLast(e,n,r,i)}parseGroup(e){let t=this.index===0;this.index++;for(let t of[`=`,`!`,`<=`,`<!`])if(this.startsWith(`?${t}`))return this.fancy=!0,this.index+=t.length+1,{kind:`look`,op:t,body:this.parseGroupBody(e)};if(this.startsWith(`?P<`)||this.startsWith(`?<`))return this.index+=this.startsWith(`?P<`)?3:2,this.captures++,this.parseCaptureName(),{kind:`group`,capture:!0,body:this.parseGroupBody(e)};if(!this.eof()&&this.char()===`?`){this.index++,this.eof()&&this.fail(`unclosed group`);let n=this.flags,r=this.parseFlags(),i=this.char();if(this.index++,i===`)`)return r!==void 0&&(r&&t?this.caseInsensitive=!0:this.unsupported.push("`(?i)` anywhere but at the start of the pattern")),{kind:`flags`};r!==void 0&&this.unsupported.push("`(?i)` anywhere but at the start of the pattern");let a=this.parseGroupBody(e);return this.flags=n,{kind:`group`,capture:!1,body:a}}return this.captures++,{kind:`group`,capture:!0,body:this.parseGroupBody(e)}}parseGroupBody(e){let t=this.flags,n=this.parseAlternation(e+1);return this.eof()&&this.fail(`unclosed group`),this.index++,this.flags=t,n}parseCaptureName(){this.eof()&&this.fail(`unexpected end of group name`);let e=``;for(;!this.eof()&&this.char()!==`>`;){let t=this.char();(e===``?t===`_`||/\p{Alphabetic}/u.test(t):t===`_`||t===`.`||t===`[`||t===`]`||/[\p{Alphabetic}\p{N}]/u.test(t))||this.fail(`invalid group name`),e+=t,this.index++}this.eof()&&this.fail(`unexpected end of group name`),this.index++,e===``&&this.fail(`empty group name`),this.names.has(e)&&this.fail(`duplicate group name "${e}"`),this.names.add(e)}parseFlags(){let e=/* @__PURE__ */ new Set,t=!1,n=!1,r,i={...this.flags};for(;this.char()!==`:`&&this.char()!==`)`;){let a=this.char();if(a===`-`)t&&this.fail(`repeated negation in flags`),t=!0,n=!0;else{n=!1,ed.has(a)||this.fail(`unrecognized flag "${a}"`),e.has(a)&&this.fail(`duplicate flag "${a}"`),e.add(a);let o=!t;a===`i`?r=o:a===`m`?i.multiLine=o:a===`s`?i.dotAll=o:a===`U`?i.swapGreed=o:a===`x`?this.unsupported.push("the `x` flag"):a===`R`?this.unsupported.push("the `R` flag"):a===`u`&&!o&&this.unsupported.push("turning off the `u` flag")}this.index++,this.eof()&&this.fail(`unexpected end of flags`)}return n&&this.fail(`dangling flag negation`),e.size===0&&this.char()===`)`&&this.fail(`repetition operator missing expression`),this.flags=i,r}parsePrimitive(){let e=this.char();return e===`\\`?this.parseEscape(!1):(this.index++,e===`.`?{kind:`dot`,dotAll:this.flags.dotAll}:e===`^`?this.assertion(`start`):e===`$`?this.assertion(`end`):{kind:`literal`,char:e})}assertion(e){return{kind:`assertion`,assertion:e,multiLine:this.flags.multiLine}}parseEscape(e){this.index++,this.eof()&&this.fail(`incomplete escape`);let t=this.char();if(/[0-9]/.test(t)){this.fancy=!0;let t=``;for(;!this.eof()&&/[0-9]/.test(this.char());)t+=this.chars[this.index++];return(e||t.startsWith(`0`))&&this.unsupported.push(`\`\\${t}\``),{kind:`backref`,index:Number(t)}}if(t===`x`||t===`u`||t===`U`)return{kind:`literal`,char:this.parseHex(t)};if(t===`p`||t===`P`)return{kind:`class`,item:this.parseUnicodeClass(t===`P`)};if(`dswDSW`.includes(t)){this.index++;let e=t.toLowerCase();return{kind:`class`,item:{kind:`perl`,perl:e,negated:t!==e}}}if(this.index++,nd(t))return{kind:`literal`,char:t};let n={f:`\f`,t:` `,n:`
|
|
3
3
|
`,r:`\r`,v:`\v`};if(n[t]!==void 0)return{kind:`literal`,char:n[t]};if(t===`a`)return e||(this.bellOutsideClass=!0),{kind:`literal`,char:`\x07`};if(t===`c`){let e=this.eof()?void 0:this.char();return e!==void 0&&/[A-Za-z]/.test(e)||this.fail("invalid `\\c` escape"),this.index++,{kind:`literal`,char:String.fromCharCode(e.charCodeAt(0)%32)}}return e&&`AzbB<>`.includes(t)&&this.fail(`\`\\${t}\` is not allowed in a class`),t===`A`?this.assertion(`startText`):t===`z`?this.assertion(`endText`):t===`B`?this.assertion(`notWordBoundary`):t===`<`?this.assertion(`wordStart`):t===`>`?this.assertion(`wordEnd`):t===`b`?this.assertion(this.parseSpecialWordBoundary()):this.fail(`unrecognized escape \`\\${t}\``)}parseSpecialWordBoundary(){if(this.eof()||this.char()!==`{`)return`wordBoundary`;let e=this.index;if(this.index++,this.eof()&&this.fail(`unexpected end of special word boundary`),!/[A-Za-z-]/.test(this.char()))return this.index=e,`wordBoundary`;let t=``;for(;!this.eof()&&/[A-Za-z-]/.test(this.char());)t+=this.chars[this.index++];return(this.eof()||this.char()!==`}`)&&this.fail(`unclosed special word boundary`),this.index++,{start:`wordStart`,end:`wordEnd`,"start-half":`wordStartHalf`,"end-half":`wordEndHalf`}[t]??this.fail(`unrecognized special word boundary "${t}"`)}parseHex(e){this.index++,this.eof()&&this.fail(`incomplete hex escape`);let t=``;if(this.char()===`{`){for(this.index++;!this.eof()&&this.char()!==`}`;)/[0-9A-Fa-f]/.test(this.char())||this.fail(`invalid hex digit`),t+=this.chars[this.index++];this.eof()&&this.fail(`incomplete hex escape`),this.index++,t===``&&this.fail(`empty hex escape`)}else{let n=e===`x`?2:e===`u`?4:8;for(let e=0;e<n;e++)this.eof()&&this.fail(`incomplete hex escape`),/[0-9A-Fa-f]/.test(this.char())||this.fail(`invalid hex digit`),t+=this.chars[this.index++]}let n=parseInt(t,16);return(t.length>8||n>1114111||n>=55296&&n<=57343)&&this.fail(`invalid Unicode scalar value`),String.fromCodePoint(n)}parseUnicodeClass(e){if(this.index++,this.eof()&&this.fail(`incomplete Unicode class`),this.char()===`{`){this.index++;let t=``;for(;!this.eof()&&this.char()!==`}`;)t+=this.chars[this.index++];this.eof()&&this.fail(`incomplete Unicode class`),this.index++;let n=t.indexOf(`!=`);return n>=0?{kind:`unicode`,name:`${t.slice(0,n)}=${t.slice(n+2)}`,negated:!e}:{kind:`unicode`,name:t.replace(`:`,`=`),negated:e}}let t=this.char();return t===`\\`&&this.fail(`invalid Unicode class`),this.index++,{kind:`unicode`,name:t,negated:e}}parseBracketed(){this.index++,this.eof()&&this.fail(`unclosed class`);let e=!1;this.char()===`^`&&(e=!0,this.index++,this.eof()&&this.fail(`unclosed class`));let t=[];for(;this.char()===`-`;)t.push({kind:`literal`,char:`-`}),this.index++,this.eof()&&this.fail(`unclosed class`);t.length===0&&this.char()===`]`&&(t.push({kind:`literal`,char:`]`}),this.index++,this.eof()&&this.fail(`unclosed class`));let n,r,i=()=>{let e={kind:`union`,items:t};return n===void 0?e:{kind:`op`,op:r,lhs:n,rhs:e}};for(;;){this.eof()&&this.fail(`unclosed class`);let a=this.char();if(a===`[`){let e=this.maybeParseAsciiClass();t.push(e??this.parseBracketed())}else{if(a===`]`)return this.index++,{kind:`bracket`,negated:e,set:i()};(a===`&`||a===`-`||a===`~`)&&this.peek()===a?(n=i(),r=`${a}${a}`,t=[],this.index+=2):t.push(this.parseClassRange())}}}maybeParseAsciiClass(){let e=/^\[:(\^?)([^:]*):\]/.exec(this.chars.slice(this.index).join(``));if(e&&td.has(e[2]))return this.index+=[...e[0]].length,{kind:`ascii`,ascii:e[2],negated:e[1]===`^`}}parseClassItem(){return this.char()===`\\`?this.parseEscape(!0):{kind:`literal`,char:this.chars[this.index++]}}parseClassRange(){let e=this.parseClassItem();if(this.eof()&&this.fail(`unclosed class`),this.char()!==`-`||this.peek()===`]`||this.peek()===`-`)return this.toClassItem(e);this.index++,this.eof()&&this.fail(`unclosed class`);let t=this.parseClassItem();return(e.kind!==`literal`||t.kind!==`literal`)&&this.fail(`class ranges need literal endpoints`),e.char.codePointAt(0)>t.char.codePointAt(0)&&this.fail(`invalid class range`),{kind:`range`,start:e.char,end:t.char}}toClassItem(e){return e.kind===`literal`?{kind:`literal`,char:e.char}:e.kind===`class`?e.item:{kind:`literal`,char:`\0`}}},id={alnum:[[48,57],[65,90],[97,122]],alpha:[[65,90],[97,122]],ascii:[[0,127]],blank:[[9,9],[32,32]],cntrl:[[0,31],[127,127]],digit:[[48,57]],graph:[[33,126]],lower:[[97,122]],print:[[32,126]],punct:[[33,47],[58,64],[91,96],[123,126]],space:[[9,13],[32,32]],upper:[[65,90]],word:[[48,57],[65,90],[95,95],[97,122]],xdigit:[[48,57],[65,70],[97,102]],d:[[48,57]],w:[[48,57],[65,90],[95,95],[97,122]],s:[[9,13],[32,32],[160,160],[8195,8195],[8233,8233],[65279,65279]]},ad=`\\p{Alphabetic}\\p{M}\\p{Nd}\\p{Pc}\\p{Join_Control}`,od={d:`\\p{Nd}`,s:`\\p{White_Space}`,w:ad};function sd(e){return/^[A-Za-z0-9]$/.test(e)?e:`\\u{${e.codePointAt(0).toString(16)}}`}function cd(e){return e.map(([e,t])=>{let n=sd(String.fromCodePoint(e));return e===t?n:`${n}-${sd(String.fromCodePoint(t))}`}).join(``)}var ld=class{constructor(e){this.parsed=e}emit(e){switch(e.kind){case`flags`:return``;case`literal`:return sd(e.char);case`dot`:return e.dotAll?`[^]`:`[^\\n]`;case`assertion`:return this.assertion(e.assertion,e.multiLine);case`class`:return this.item(e.item).atom;case`group`:return`(${e.capture&&this.parsed.fancy?``:`?:`}${this.emit(e.body)})`;case`look`:return`(?${e.op}${this.emit(e.body)})`;case`backref`:if(e.index===0||e.index>this.parsed.captures)throw new Qu(`backreference \`\\${e.index}\``);return`\\${e.index}(?:)`;case`repeat`:{let{min:t,max:n}=e,r=n===1/0?t===0?`*`:t===1?`+`:`{${t},}`:t===0&&n===1?`?`:t===n?`{${t}}`:`{${t},${n}}`;return`(?:${this.emit(e.body)})${r}${e.greedy?``:`?`}`}case`concat`:return e.items.map(e=>this.emit(e)).join(``);case`alternation`:return e.items.map(e=>this.emit(e)).join(`|`)}}assertion(e,t){let n=`[${ad}]`;switch(e){case`start`:return t?`(?<![^\\n])`:`^`;case`end`:return t?`(?![^\\n])`:`$`;case`startText`:return`^`;case`endText`:return`$`;case`wordBoundary`:return`(?:(?<=${n})(?!${n})|(?<!${n})(?=${n}))`;case`notWordBoundary`:return`(?:(?<=${n})(?=${n})|(?<!${n})(?!${n}))`;case`wordStart`:return`(?<!${n})(?=${n})`;case`wordEnd`:return`(?<=${n})(?!${n})`;case`wordStartHalf`:return`(?<!${n})`;case`wordEndHalf`:return`(?!${n})`}}item(e){switch(e.kind){case`literal`:{let t=sd(e.char);return{fragment:t,atom:`[${t}]`}}case`range`:{let t=`${sd(e.start)}-${sd(e.end)}`;return{fragment:t,atom:`[${t}]`}}case`perl`:return ud(this.parsed.fancy?od[e.perl]:cd(id[e.perl]),e.negated);case`ascii`:return ud(cd(id[e.ascii]),e.negated);case`unicode`:return ud(dd(e.name),e.negated);case`bracket`:{let t=this.set(e.set);return e.negated?t.fragment===void 0?{atom:`(?:(?!${t.atom})[^])`}:{atom:`[^${t.fragment}]`}:t}}}set(e){if(e.kind===`union`){let t=e.items.map(e=>this.item(e));if(t.every(e=>e.fragment!==void 0)){let e=t.map(e=>e.fragment).join(``);return{fragment:e,atom:`[${e}]`}}return{atom:`(?:${t.map(e=>e.atom).join(`|`)})`}}let t=this.set(e.lhs).atom,n=this.set(e.rhs).atom;switch(e.op){case`&&`:return{atom:`(?:(?=${t})${n})`};case`--`:return{atom:`(?:(?!${n})${t})`};case`~~`:return{atom:`(?:(?!${n})${t}|(?!${t})${n})`}}}};function ud(e,t){return t?{atom:`[^${e}]`}:{fragment:e,atom:`[${e}]`}}function dd(e){for(let t of[e,`Script=${e}`])try{return RegExp(`\\p{${t}}`,`u`),`\\p{${t}}`}catch{}throw new Qu(`the Unicode class \`${e}\``)}function fd(e){try{return new rd(e).parse(),!0}catch(e){return e instanceof Qu}}var pd=/* @__PURE__ */ new Map,md=1024;function hd(e){let t=pd.get(e);if(t)return t;let n=new rd(e).parse();if(n.fancyInvalid.length>0)throw new Zu(n.fancyInvalid[0]);if(n.unsupported.length>0)throw new Qu(n.unsupported[0]);let r=new ld(n).emit(n.node);return t=new RegExp(r,n.caseInsensitive?`iu`:`u`),pd.size>=md&&pd.clear(),pd.set(e,t),t}function gd(e,t){let n=e.charCodeAt(t)-48,r=e.charCodeAt(t+1)-48;if(!(n<0||n>9||r<0||r>9))return n*10+r}function _d(e){return e%4==0&&e%100!=0||e%400==0}function vd(e){if(e.length!==10||e[4]!==`-`||e[7]!==`-`||!/^[0-9]{4}$/.test(e.slice(0,4)))return!1;let t=Number(e.slice(0,4)),n=gd(e,5),r=gd(e,8);return n===void 0||n<1||n>12||r===void 0||r===0?!1:n===2?r<=(_d(t)?29:28):r<=([4,6,9,11].includes(n)?30:31)}function yd(e){if(e.length<9||e[2]!==`:`||e[5]!==`:`)return!1;let t=gd(e,0),n=gd(e,3),r=gd(e,6);if(t===void 0||n===void 0||r===void 0||t>23||n>59||r>60)return!1;let i=8;if(e[i]===`.`){i++;let t=i;for(;i<e.length&&e.charCodeAt(i)>=48&&e.charCodeAt(i)<=57;)i++;if(i===t)return!1}if(i===e.length)return!1;let a=e[i];if(a===`Z`||a===`z`)return i===e.length-1&&(r!==60||t===23&&n===59);if(a!==`+`&&a!==`-`||e.length-i!==6||e[i+3]!==`:`)return!1;let o=gd(e,i+1),s=gd(e,i+4);if(o===void 0||s===void 0||o>23||s>59)return!1;if(r!==60)return!0;let c=a===`+`?-1:1,l=t+c*o,u=n+c*s;return l+=Math.trunc(u/60),u%=60,u<0&&(u+=60,--l),l=(l+24)%24,l===23&&u===59}function bd(e){let t=e.search(/[Tt]/);return t<0?!1:vd(e.slice(0,t))&&yd(e.slice(t+1))}var xd=`(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])`,Sd=`${xd}(?:\\.${xd}){3}`,G=`[0-9A-Fa-f]{1,4}`,Cd=`(?:${G}:${G}|${Sd})`,wd=[`(?:${G}:){6}${Cd}`,`::(?:${G}:){5}${Cd}`,`(?:${G})?::(?:${G}:){4}${Cd}`,`(?:(?:${G}:){0,1}${G})?::(?:${G}:){3}${Cd}`,`(?:(?:${G}:){0,2}${G})?::(?:${G}:){2}${Cd}`,`(?:(?:${G}:){0,3}${G})?::${G}:${Cd}`,`(?:(?:${G}:){0,4}${G})?::${Cd}`,`(?:(?:${G}:){0,5}${G})?::${G}`,`(?:(?:${G}:){0,6}${G})?::`].map(e=>`(?:${e})`).join(`|`),Td=RegExp(`^${Sd}$`),Ed=RegExp(`^(?:${wd})$`),Dd=e=>Td.test(e),Od=e=>Ed.test(e);function kd(e){if(e.length===0||e.length>253||e.endsWith(`.`)||!/^[A-Za-z0-9.-]*$/.test(e))return!1;let t=e.split(`.`);for(let e of t){if(e.length===0||e.length>63||e.startsWith(`-`)||e.endsWith(`-`))return!1;let t=e.startsWith(`xn--`);if(e.slice(2,4)===`--`&&!t)return!1;if(t){let t=Fd(e.slice(4));if(t===void 0||!zd(t))return!1}}return!0}var Ad=36,jd=1,Md=26,Nd=4294967295;function Pd(e,t,n){let r=Math.trunc(e/(n?700:2));r+=Math.trunc(r/t);let i=0;for(;r>(Ad-jd)*Md>>1;)r=Math.trunc(r/(Ad-jd)),i+=Ad;return i+Math.trunc((Ad-jd+1)*r/(r+38))}function Fd(e){let t=e.lastIndexOf(`-`),n=t>0?e.slice(0,t):``,r=t>0?e.slice(t+1):e,i=[...n].map(e=>e.charCodeAt(0)),a=128,o=72,s=0,c=0;for(;c<r.length;){let e=s,t=1;for(let e=Ad;;e+=Ad){if(c>=r.length)return;let n=Id(r.charCodeAt(c++));if(n===void 0||(s+=n*t,n*t>Nd||s>Nd))return;let i=e<=o?jd:e>=o+Md?Md:e-o;if(n<i)break;if(t*=Ad-i,t>Nd)return}let n=i.length+1;if(o=Pd(s-e,n,e===0),a+=Math.trunc(s/n),a>Nd||(s%=n,a>1114111||a>=55296&&a<=57343))return;i.splice(s,0,a),s++}return String.fromCodePoint(...i)}function Id(e){if(e>=48&&e<=57)return e-48+26;if(e>=65&&e<=90)return e-65;if(e>=97&&e<=122)return e-97}var Ld=new Set([2381,2509,2637,2765,2893,3021,3149,3277,3405,3530,3642,3972,4153,5908,5940,6098,6752,6980,7082,7154,7155,11647,43014,43204,43347,44013,68159,69702,69759,69817,69939,70080,70197,70378,70477,70722,70850,71103,71231,71350,71467,71737,72160,72244,72263,72345,72767,73028,73029,73111].map(e=>String.fromCodePoint(e))),Rd=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347].map(e=>String.fromCodePoint(e)));function zd(e){let t=[...e];if(t.length>0&&/^\p{M}/u.test(t[0]))return!1;let n=!1,r=!1,i=!1,a=!1;for(let e=0;e<t.length;e++){let o=t[e],s=t[e-1],c=t[e+1],l=o.codePointAt(0);if(o===``){if(s===void 0||!Ld.has(s))return!1}else if(o===`·`){if(s!==`l`||c!==`l`)return!1}else if(o===`͵`){let e=c?.codePointAt(0);if(e===void 0||e<880||e>1023)return!1}else if(o===`׳`||o===`״`){let e=s?.codePointAt(0);if(e===void 0||e<1424||e>1535)return!1}else if(o===`・`)n=!0;else if(l>=12352&&l<=12447||l>=12448&&l<=12543||l>=19968&&l<=40959)r=!0;else if(l>=1632&&l<=1641)i=!0;else if(l>=1776&&l<=1785)a=!0;else if(Rd.has(o))return!1}return!(n&&!r||i&&a)}var Bd=new TextEncoder;function Vd(e){return Bd.encode(e).length}function Hd(e){let t=e.codePointAt(0),n=t>>>24,r=t>>>16&255,i=t>>>8&255,a=t&255,o=e=>e>=128&&e<=191;return n===0&&r===0?i>=194&&i<=223&&o(a):n===0?r===224?i>=160&&i<=191&&o(a):r>=225&&r<=236?o(i)&&o(a):r===237?i>=128&&i<=159&&o(a):r===238||r===239?o(i)&&o(a):!1:n===240?r>=144&&r<=191&&o(i)&&o(a):n>=241&&n<=243?o(r)&&o(i)&&o(a):n===244&&r>=128&&r<=143&&o(i)&&o(a)}var Ud=/^[\p{Alphabetic}\p{N}]$/u,Wd=/* @__PURE__ */ new Set("!#$%&'*+-/=?^_`{|}~");function Gd(e){return Ud.test(e)||Wd.has(e)||Hd(e)}function Kd(e){return e.length>0&&[...e].every(Gd)}function qd(e){let t=[...e];for(let e=0;e<t.length;e++){let n=t[e],r=n.codePointAt(0);if(n===`\\`){let n=t[++e]?.codePointAt(0);if(n===void 0||n<33||n>126)return!1}else if(!(n===` `||n===` `||r===33||r>=35&&r<=91||r>=93&&r<=126||Hd(n)))return!1}return!0}function Jd(e){let t=e.codePointAt(0);return t>=33&&t<=90||t>=94&&t<=126||Hd(e)}function Yd(e){return e.replace(/^\p{White_Space}+|\p{White_Space}+$/gu,``)}function Xd(e){let t=e,n=``,r=e.lastIndexOf(` <`);if(r>=0){let i=Yd(e.slice(r+2));if(!i.endsWith(`>`))return!1;t=i.slice(0,-1),n=Yd(e.slice(0,r))}let i=t.lastIndexOf(`@`);if(i<0)return!1;let a=t.slice(0,i),o=t.slice(i+1);if(n===``&&a.startsWith(`<`)||a.length===0||Vd(a)>64)return!1;if(a.startsWith(`"`)&&a.endsWith(`"`)){if(a.length<=2||!qd(a.slice(1,-1)))return!1}else if(!a.split(`.`).every(Kd))return!1;if(o.length===0||Vd(o)>254)return!1;if(o.startsWith(`[`)&&o.endsWith(`]`)){let e=o.slice(1,-1);return[...e].every(Jd)?e.startsWith(`IPv6:`)?Od(e.slice(5)):Dd(e):!1}for(let e of o.split(`.`)){let t=[...e];if(t.length===0||!Ud.test(t[0])||!Ud.test(t[t.length-1])||Vd(e)>63||!Kd(e))return!1}return kd(o)}var Zd=`A-Za-z0-9\\-._~`,Qd=`!$&'()*+,;=`,$d=`%[0-9A-Fa-f]{2}`,ef=`(?:[${Zd}${Qd}:@]|${$d})`,tf=`${ef}*`,nf=`${ef}+`,rf=`(?:[${Zd}${Qd}@]|${$d})+`,af=`\\[(?:${wd}|[vV][0-9A-Fa-f]+\\.[${Zd}${Qd}:]+)\\]`,of=`(?:[${Zd}${Qd}]|${$d})*`,sf=`(?:${`(?:[${Zd}${Qd}:]|${$d})*`}@)?(?:${af}|${of})(?::[0-9]*)?`,cf=`(?:/${tf})*`,lf=`/(?:${nf}(?:/${tf})*)?`,uf=`${nf}(?:/${tf})*`,df=`${rf}(?:/${tf})*`,ff=`(?:${ef}|[/?])*`,pf=`[A-Za-z][A-Za-z0-9+\\-.]*`,mf=`(?://${sf}${cf}|${lf}|${uf}|)`,hf=`(?://${sf}${cf}|${lf}|${df}|)`,gf=`(?:\\?${ff})?(?:#${ff})?`,_f=RegExp(`^${pf}:${mf}${gf}$`),vf=RegExp(`^(?:${pf}:${mf}|${hf})${gf}$`);function yf(e){return e===``||/^(?:\/(?:[^~/]|~[01])*)+$/.test(e)}function bf(e){let t=/^(0|[1-9][0-9]*)(.*)$/s.exec(e);if(!t)return!1;let n=t[2];return n===``||n===`#`||n.startsWith(`/`)&&yf(n)}var xf=/* @__PURE__ */ new Set(`+#./;?&=,!@|`),Sf=/* @__PURE__ */ new Set(`"'<>%\\^\`{|}`);function Cf(e){let t=0,n=t=>/^[0-9A-Fa-f]$/.test(e[t]??``),r=t=>/^[A-Za-z0-9_]$/.test(e[t]??``),i=()=>{let i=t;for(;t<e.length;)if(r(t))t++;else if(e[t]===`%`){if(t+2>=e.length||!n(t+1)||!n(t+2))return!1;t+=3}else break;return t>i},a=()=>{if(!i())return!1;for(;t<e.length;)if(e[t]===`.`){if(t++,!i())return!1}else if(r(t)||e[t]===`%`){if(!i())return!1}else break;return!0},o=()=>{if(!a())return!1;if(e[t]===`:`){if(t++,!/^[1-9]$/.test(e[t]??``))return!1;t++;for(let n=1;n<4&&/^[0-9]$/.test(e[t]??``);n++)t++}else e[t]===`*`&&t++;return!0};for(;t<e.length;){let r=e[t];if(r===`{`){if(t++,t>=e.length||xf.has(e[t])&&(t++,t>=e.length)||!o())return!1;for(;e[t]===`,`;)if(t++,!o())return!1;if(e[t]!==`}`)return!1;t++}else{if(r===`}`)return!1;if(r===`%`){if(t+2>=e.length||!n(t+1)||!n(t+2))return!1;t+=3}else{let n=e.charCodeAt(t);if(n<=32||n===127||Sf.has(r))return!1;t++}}}return!0}var wf={date:vd,"date-time":bd,email:Xd,hostname:kd,ipv4:Dd,ipv6:Od,"json-pointer":yf,regex:fd,"relative-json-pointer":bf,time:yd,uri:e=>_f.test(e),"uri-reference":e=>vf.test(e),"uri-template":Cf},Tf=class{constructor(e){this.value=e}},Ef=2n**64n-1n,Df=-(2n**63n),Of=/-?(?:0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/y,kf=/[ \t\n\r]*/y;function Af(e){let t=0,n=()=>{throw SyntaxError(`invalid JSON at position ${t}`)},r=()=>{kf.lastIndex=t,kf.test(e),t=kf.lastIndex},i=()=>{let r=t;t++;let i=!1;for(;t<e.length;){let a=e.charCodeAt(t);if(a===34){t++;let n=e.slice(r,t);return i?JSON.parse(n):n.slice(1,-1)}a===92?(i=!0,t++):a<32&&n(),t++}return n()},a=()=>{Of.lastIndex=t;let r=Of.exec(e);if(!r)return n();t=Of.lastIndex;let i=r[0],a=Number(i);if(r[1]!==void 0||r[2]!==void 0)return Number.isInteger(a)?new Tf(a):a;if(Object.is(a,-0))return new Tf(a);if(Number.isSafeInteger(a))return a;let o=BigInt(i);return o<Df||o>Ef?new Tf(a):BigInt(a)===o?a:o},o=()=>{r();let s=e[t];if(s===`{`){t++;let a=Object.create(null);if(r(),e[t]===`}`)return t++,a;for(;;){r(),e[t]!==`"`&&n();let s=i();if(r(),e[t]!==`:`&&n(),t++,a[s]=o(),r(),e[t]===`,`)t++;else{if(e[t]===`}`)return t++,a;n()}}}if(s===`[`){t++;let i=[];if(r(),e[t]===`]`)return t++,i;for(;;)if(i.push(o()),r(),e[t]===`,`)t++;else{if(e[t]===`]`)return t++,i;n()}}return s===`"`?i():e.startsWith(`true`,t)?(t+=4,!0):e.startsWith(`false`,t)?(t+=5,!1):e.startsWith(`null`,t)?(t+=4,null):a()},s=o();return r(),t!==e.length&&n(),s}function jf(e){return typeof e==`number`||typeof e==`bigint`||e instanceof Tf}function Mf(e){return e instanceof Tf?e.value:e}function Nf(e,t){return typeof e==`bigint`?!0:e instanceof Tf?!t:Number.isInteger(e)}function Pf(e){if(typeof e==`bigint`)return e.toString();if(e instanceof Tf){if(Object.is(e.value,-0))return`-0.0`;let t=Number.isSafeInteger(e.value)?String(e.value):Ff(e.value);return/[.e]/.test(t)?t:`${t}.0`}return typeof e==`number`&&Number.isInteger(e)?Ff(e):Array.isArray(e)?`[${e.map(Pf).join(`,`)}]`:typeof e==`object`&&e?`{${Object.entries(e).map(([e,t])=>`${JSON.stringify(e)}:${Pf(t)}`).join(`,`)}}`:JSON.stringify(e)}function Ff(e){return Number.isFinite(e)&&Math.abs(e)<1e21?BigInt(e).toString():String(e)}function If(e){if(e instanceof Tf)return e.value;if(Array.isArray(e))return e.map(If);if(typeof e!=`object`||!e)return e;let t=Object.create(null);for(let[n,r]of Object.entries(e))t[n]=If(r);return t}function Lf(e,t){if(jf(e))return jf(t)?Mf(e)==Mf(t):!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>Lf(e,t[n]));if(typeof e==`object`&&e){if(typeof t!=`object`||!t||Array.isArray(t)||jf(t))return!1;let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&Lf(e[n],t[n]))}return e===t}function Rf(e,t){let n=Number(Mf(e)),r=Number(Mf(t));if(Number.isInteger(r))return Number.isInteger(n)&&n%r===0;if(n===0)return!0;if(n<r)return!1;let[i,a]=zf(n),[o,s]=zf(r);if(o===0n)return!0;let c=a*o;return i*s%c===0n}function zf(e){let t=0,n=e;for(;!(Math.abs(Math.floor(n)-n)<2**-52);)if(t++,n=e*Bf(10,t),!Number.isFinite(n))return Vf(e);let r=BigInt(Math.trunc(Math.abs(n)));return[e<0?-r:r,BigInt(Bf(10,t))]}function Bf(e,t){let n=1,r=e;for(let e=t;e&1&&(n*=r),e=Math.trunc(e/2),e!==0;)r*=r;return n}function Vf(e){let[t,n]=Math.abs(e).toExponential().split(`e`),[r,i=``]=t.split(`.`),a=Number(n)-i.length,o=BigInt(r+i),s=1n;return a>=0?o*=10n**BigInt(a):s=10n**BigInt(-a),[e<0?-o:o,s]}var Hf={additionalItems:!0,unevaluatedItems:!0,items:!0,contains:!0,additionalProperties:!0,unevaluatedProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Uf={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Wf={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Gf=new URL(`json-schema:///`);function Kf(e){return encodeURI(e.replace(/~/g,`~0`).replace(/\//g,`~1`))}function qf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Jf(e,t=Object.create(null),n=[],r=Gf,i=!0){let a=(e,n)=>{t[e]===void 0&&(t[e]=n)};if(typeof e==`boolean`)return i&&a(r.href,e),t;if(!qf(e))return t;let o=e.$id??e.id;if(typeof o==`string`){let t=new URL(o,r.href);t.hash.length>1||(t.hash=``,r=t),a(t.href,e)}if(i&&a(r.href,e),typeof e.$ref==`string`&&e.__absolute_ref__===void 0){let t=new URL(e.$ref,r.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:t.href}),n.push(t.href)}if(typeof e.$recursiveRef==`string`&&e.__absolute_recursive_ref__===void 0){let t=new URL(e.$recursiveRef,r.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:t.href})}typeof e.$anchor==`string`&&a(new URL(`#`+e.$anchor,r.href).href,e);for(let i in e){let a=e[i];if(Uf[i]&&Array.isArray(a))for(let e of a)Jf(e,t,n,r,!1);else if(Hf[i])Jf(a,t,n,r,!1);else if((Wf[i]||i===`dependencies`)&&qf(a))for(let e in a)Jf(a[e],t,n,r,!1)}return t}function Yf(e,t){let n=e[t];if(n!==void 0)return n;let r=t.indexOf(`#`);if(r<0)return;let i=e[t.slice(0,r)],a=t.slice(r+1);if(i!==void 0&&a.startsWith(`/`)){for(let e of a.slice(1).split(`/`)){let t;try{t=decodeURIComponent(e).replace(/~1/g,`/`).replace(/~0/g,`~`)}catch{return}if(Array.isArray(i)){if(!/^(?:0|[1-9][0-9]*)$/.test(t))return;i=i[Number(t)]}else if(qf(i)&&Object.prototype.hasOwnProperty.call(i,t))i=i[t];else return}return typeof i==`boolean`||qf(i)?i:void 0}}function Xf(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r>=55296&&r<=56319&&n+1<e.length&&(e.charCodeAt(n+1)&64512)==56320&&n++,t++}return t}function Zf(e){if(e===null)return`null`;if(jf(e))return`number`;if(Array.isArray(e))return`array`;switch(typeof e){case`boolean`:case`string`:return typeof e;case`object`:return`object`;default:throw Error(`Instances of "${typeof e}" type are not supported.`)}}function Qf(e,t,n,r,i){return K(e,t,{draft:n,lookup:r,shortCircuit:i},null,`#`,`#`)}function K(e,t,n,r,i,a,o=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:i,keyword:`false`,keywordLocation:i,error:`False boolean schema.`}]};let{draft:s,lookup:c,shortCircuit:l}=n,u=Zf(e),{$ref:d,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:g,required:_,not:ee,anyOf:v,allOf:y,oneOf:te,if:ne,then:re,else:b,format:x,properties:ie,patternProperties:ae,additionalProperties:oe,unevaluatedProperties:se,minProperties:ce,maxProperties:le,propertyNames:S,dependentRequired:ue,dependentSchemas:de,dependencies:C,prefixItems:w,items:T,additionalItems:fe,unevaluatedItems:E,contains:D,minContains:O,maxContains:k,minItems:A,maxItems:j,uniqueItems:pe,minimum:me,maximum:he,exclusiveMinimum:ge,exclusiveMaximum:_e,multipleOf:ve,minLength:ye,maxLength:be,pattern:xe,__absolute_ref__:Se,__absolute_recursive_ref__:Ce}=t,M=[];if(p===!0&&r===null&&(r=t),f===`#`){let s=r===null?Yf(c,Ce):r,l=`${a}/$recursiveRef`,u=K(e,r===null?t:r,n,s,i,l,o);u.valid||M.push({instanceLocation:i,keyword:`$recursiveRef`,keywordLocation:l,error:`A subschema had errors.`},...u.errors)}if(d!==void 0){let t=Yf(c,Se??d);if(t===void 0)throw Error(`Unresolved $ref "${d}".`);let l=`${a}/$ref`,u=K(e,t,n,r,i,l,o);if(u.valid||M.push({instanceLocation:i,keyword:`$ref`,keywordLocation:l,error:`A subschema had errors.`},...u.errors),s===`4`||s===`6`||s===`7`)return{valid:M.length===0,errors:M}}let N=u===`number`&&Nf(e,s===`4`);if(Array.isArray(m)?m.some(e=>e===u||e===`integer`&&N)||M.push({instanceLocation:i,keyword:`type`,keywordLocation:`${a}/type`,error:`Instance type "${u}" is invalid. Expected "${m.join(`", "`)}".`}):m===`integer`?N||M.push({instanceLocation:i,keyword:`type`,keywordLocation:`${a}/type`,error:`Instance type "${u}" is invalid. Expected "${m}".`}):m!==void 0&&u!==m&&M.push({instanceLocation:i,keyword:`type`,keywordLocation:`${a}/type`,error:`Instance type "${u}" is invalid. Expected "${m}".`}),h!==void 0&&!Lf(e,h)&&M.push({instanceLocation:i,keyword:`const`,keywordLocation:`${a}/const`,error:`Instance does not match ${Pf(h)}.`}),g!==void 0&&!g.some(t=>Lf(e,t))&&M.push({instanceLocation:i,keyword:`enum`,keywordLocation:`${a}/enum`,error:`Instance does not match any of ${Pf(g)}.`}),ee!==void 0){let t=`${a}/not`;K(e,ee,n,r,i,t).valid&&M.push({instanceLocation:i,keyword:`not`,keywordLocation:t,error:`Instance matched "not" schema.`})}let we=[];if(v!==void 0){let t=`${a}/anyOf`,s=M.length,c=!1;for(let a=0;a<v.length;a++){let s=Object.create(o),l=K(e,v[a],n,p===!0?r:null,i,`${t}/${a}`,s);M.push(...l.errors),c||=l.valid,l.valid&&we.push(s)}c?M.length=s:M.splice(s,0,{instanceLocation:i,keyword:`anyOf`,keywordLocation:t,error:`Instance does not match any subschemas.`})}if(y!==void 0){let t=`${a}/allOf`,s=M.length,c=!0;for(let a=0;a<y.length;a++){let s=Object.create(o),l=K(e,y[a],n,p===!0?r:null,i,`${t}/${a}`,s);M.push(...l.errors),c&&=l.valid,l.valid&&we.push(s)}c?M.length=s:M.splice(s,0,{instanceLocation:i,keyword:`allOf`,keywordLocation:t,error:`Instance does not match every subschema.`})}if(te!==void 0){let t=`${a}/oneOf`,s=M.length,c=te.filter((a,s)=>{let c=Object.create(o),l=K(e,a,n,p===!0?r:null,i,`${t}/${s}`,c);return M.push(...l.errors),l.valid&&we.push(c),l.valid}).length;c===1?M.length=s:M.splice(s,0,{instanceLocation:i,keyword:`oneOf`,keywordLocation:t,error:`Instance does not match exactly one subschema (${c} matches).`})}if((u===`object`||u===`array`)&&Object.assign(o,...we),ne!==void 0){let t=`${a}/if`,s=Object.create(o);if(K(e,ne,n,r,i,t,s).valid){if(Object.assign(o,s),re!==void 0){let s=K(e,re,n,r,i,`${a}/then`,o);s.valid||M.push({instanceLocation:i,keyword:`if`,keywordLocation:t,error:`Instance does not match "then" schema.`},...s.errors)}}else if(b!==void 0){let s=K(e,b,n,r,i,`${a}/else`,o);s.valid||M.push({instanceLocation:i,keyword:`if`,keywordLocation:t,error:`Instance does not match "else" schema.`},...s.errors)}}if(u===`object`){let t=e;if(_!==void 0)for(let e of _)e in t||M.push({instanceLocation:i,keyword:`required`,keywordLocation:`${a}/required`,error:`Instance does not have required property "${e}".`});let s=Object.keys(t);if(ce!==void 0&&s.length<ce&&M.push({instanceLocation:i,keyword:`minProperties`,keywordLocation:`${a}/minProperties`,error:`Instance does not have at least ${ce} properties.`}),le!==void 0&&s.length>le&&M.push({instanceLocation:i,keyword:`maxProperties`,keywordLocation:`${a}/maxProperties`,error:`Instance has more than ${le} properties.`}),S!==void 0){let e=`${a}/propertyNames`;for(let a in t){let t=`${i}/${Kf(a)}`,o=K(a,S,n,r,t,e);o.valid||M.push({instanceLocation:i,keyword:`propertyNames`,keywordLocation:e,error:`Property name "${a}" does not match schema.`},...o.errors)}}if(ue!==void 0){let e=`${a}/dependentRequired`;for(let n in ue)if(n in t)for(let r of ue[n])r in t||M.push({instanceLocation:i,keyword:`dependentRequired`,keywordLocation:e,error:`Instance has "${n}" but does not have "${r}".`})}if(de!==void 0)for(let s in de){let c=`${a}/dependentSchemas`;if(s in t){let t=K(e,de[s],n,r,i,`${c}/${Kf(s)}`,o);t.valid||M.push({instanceLocation:i,keyword:`dependentSchemas`,keywordLocation:c,error:`Instance has "${s}" but does not match dependant schema.`},...t.errors)}}if(C!==void 0){let o=`${a}/dependencies`;for(let a in C)if(a in t){let s=C[a];if(Array.isArray(s))for(let e of s)e in t||M.push({instanceLocation:i,keyword:`dependencies`,keywordLocation:o,error:`Instance has "${a}" but does not have "${e}".`});else{let t=K(e,s,n,r,i,`${o}/${Kf(a)}`);t.valid||M.push({instanceLocation:i,keyword:`dependencies`,keywordLocation:o,error:`Instance has "${a}" but does not match dependant schema.`},...t.errors)}}}let c=Object.create(null),u=!1;if(ie!==void 0){let e=`${a}/properties`;for(let a in ie){if(!(a in t))continue;let s=`${i}/${Kf(a)}`,d=K(t[a],ie[a],n,r,s,`${e}/${Kf(a)}`);if(d.valid)o[a]=c[a]=!0;else if(u=l,M.push({instanceLocation:i,keyword:`properties`,keywordLocation:e,error:`Property "${a}" does not match schema.`},...d.errors),u)break}}if(!u&&ae!==void 0){let e=`${a}/patternProperties`;for(let a in ae){let s=hd(a),d=ae[a];for(let f in t){if(!s.test(f))continue;let p=`${i}/${Kf(f)}`,m=K(t[f],d,n,r,p,`${e}/${Kf(a)}`);m.valid?o[f]=c[f]=!0:(u=l,M.push({instanceLocation:i,keyword:`patternProperties`,keywordLocation:e,error:`Property "${f}" matches pattern "${a}" but does not match associated schema.`},...m.errors))}}}if(!u&&oe!==void 0){let e=`${a}/additionalProperties`;for(let a in t){if(c[a])continue;let s=`${i}/${Kf(a)}`,d=K(t[a],oe,n,r,s,e);d.valid?o[a]=!0:(u=l,M.push({instanceLocation:i,keyword:`additionalProperties`,keywordLocation:e,error:`Property "${a}" does not match additional properties schema.`},...d.errors))}}else if(!u&&se!==void 0){let e=`${a}/unevaluatedProperties`;for(let a in t)if(!o[a]){let s=`${i}/${Kf(a)}`,c=K(t[a],se,n,r,s,e);c.valid?o[a]=!0:M.push({instanceLocation:i,keyword:`unevaluatedProperties`,keywordLocation:e,error:`Property "${a}" does not match unevaluated properties schema.`},...c.errors)}}}else if(u===`array`){let t=e,s=t.length;j!==void 0&&s>j&&M.push({instanceLocation:i,keyword:`maxItems`,keywordLocation:`${a}/maxItems`,error:`Array has too many items (${s} > ${j}).`}),A!==void 0&&s<A&&M.push({instanceLocation:i,keyword:`minItems`,keywordLocation:`${a}/minItems`,error:`Array has too few items (${s} < ${A}).`});let c=0,u=!1;if(w!==void 0){let e=`${a}/prefixItems`,d=Math.min(w.length,s);for(;c<d;c++){let a=K(t[c],w[c],n,r,`${i}/${c}`,`${e}/${c}`);if(o[c]=!0,!a.valid&&(u=l,M.push({instanceLocation:i,keyword:`prefixItems`,keywordLocation:e,error:`Items did not match schema.`},...a.errors),u))break}}if(T!==void 0){let e=`${a}/items`;if(Array.isArray(T)){let a=Math.min(T.length,s);for(;c<a;c++){let a=K(t[c],T[c],n,r,`${i}/${c}`,`${e}/${c}`);if(o[c]=!0,!a.valid&&(u=l,M.push({instanceLocation:i,keyword:`items`,keywordLocation:e,error:`Items did not match schema.`},...a.errors),u))break}}else for(;c<s;c++){let a=K(t[c],T,n,r,`${i}/${c}`,e);if(o[c]=!0,!a.valid&&(u=l,M.push({instanceLocation:i,keyword:`items`,keywordLocation:e,error:`Items did not match schema.`},...a.errors),u))break}if(!u&&fe!==void 0){let e=`${a}/additionalItems`;for(;c<s;c++){let a=K(t[c],fe,n,r,`${i}/${c}`,e);o[c]=!0,a.valid||(u=l,M.push({instanceLocation:i,keyword:`additionalItems`,keywordLocation:e,error:`Items did not match additional items schema.`},...a.errors))}}}if(D!==void 0){if(s===0&&O===void 0)M.push({instanceLocation:i,keyword:`contains`,keywordLocation:`${a}/contains`,error:`Array is empty. It must contain at least one item matching the schema.`});else if(O!==void 0&&s<O)M.push({instanceLocation:i,keyword:`minContains`,keywordLocation:`${a}/minContains`,error:`Array has less items (${s}) than minContains (${O}).`});else{let e=`${a}/contains`,c=M.length,l=0;for(let a=0;a<s;a++){let s=K(t[a],D,n,r,`${i}/${a}`,e);s.valid?(o[a]=!0,l++):M.push(...s.errors)}l>=(O||0)&&(M.length=c),O===void 0&&k===void 0&&l===0?M.splice(c,0,{instanceLocation:i,keyword:`contains`,keywordLocation:e,error:`Array does not contain item matching schema.`}):O!==void 0&&l<O?M.push({instanceLocation:i,keyword:`minContains`,keywordLocation:`${a}/minContains`,error:`Array must contain at least ${O} items matching schema. Only ${l} items were found.`}):k!==void 0&&l>k&&M.push({instanceLocation:i,keyword:`maxContains`,keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${k} items matching schema. ${l} items were found.`})}}if(!u&&E!==void 0){let e=`${a}/unevaluatedItems`;for(;c<s;c++){if(o[c])continue;let a=K(t[c],E,n,r,`${i}/${c}`,e);o[c]=!0,a.valid||M.push({instanceLocation:i,keyword:`unevaluatedItems`,keywordLocation:e,error:`Items did not match unevaluated items schema.`},...a.errors)}}if(pe){e:for(let e=0;e<s;e++)for(let n=e+1;n<s;n++)if(Lf(t[e],t[n])){M.push({instanceLocation:i,keyword:`uniqueItems`,keywordLocation:`${a}/uniqueItems`,error:`Duplicate items at indexes ${e} and ${n}.`});break e}}}else if(u===`number`){let t=Mf(e);s===`4`?(me!==void 0&&(ge===!0&&t<=me||t<me)&&M.push({instanceLocation:i,keyword:`minimum`,keywordLocation:`${a}/minimum`,error:`${t} is less than ${ge?`or equal to `:``}${me}.`}),he!==void 0&&(_e===!0&&t>=he||t>he)&&M.push({instanceLocation:i,keyword:`maximum`,keywordLocation:`${a}/maximum`,error:`${t} is greater than ${_e?`or equal to `:``}${he}.`})):(me!==void 0&&t<me&&M.push({instanceLocation:i,keyword:`minimum`,keywordLocation:`${a}/minimum`,error:`${t} is less than ${me}.`}),he!==void 0&&t>he&&M.push({instanceLocation:i,keyword:`maximum`,keywordLocation:`${a}/maximum`,error:`${t} is greater than ${he}.`}),ge!==void 0&&t<=ge&&M.push({instanceLocation:i,keyword:`exclusiveMinimum`,keywordLocation:`${a}/exclusiveMinimum`,error:`${t} is less than or equal to ${ge}.`}),_e!==void 0&&t>=_e&&M.push({instanceLocation:i,keyword:`exclusiveMaximum`,keywordLocation:`${a}/exclusiveMaximum`,error:`${t} is greater than or equal to ${_e}.`})),ve!==void 0&&!Rf(e,ve)&&M.push({instanceLocation:i,keyword:`multipleOf`,keywordLocation:`${a}/multipleOf`,error:`${t} is not a multiple of ${ve}.`})}else if(u===`string`){let t=e,n=ye===void 0&&be===void 0?0:Xf(t);ye!==void 0&&n<ye&&M.push({instanceLocation:i,keyword:`minLength`,keywordLocation:`${a}/minLength`,error:`String is too short (${n} < ${ye}).`}),be!==void 0&&n>be&&M.push({instanceLocation:i,keyword:`maxLength`,keywordLocation:`${a}/maxLength`,error:`String is too long (${n} > ${be}).`}),xe!==void 0&&!hd(xe).test(t)&&M.push({instanceLocation:i,keyword:`pattern`,keywordLocation:`${a}/pattern`,error:`String does not match pattern.`});let r=x===void 0?void 0:wf[x];r&&!r(t)&&M.push({instanceLocation:i,keyword:`format`,keywordLocation:`${a}/format`,error:`String does not match format "${x}".`})}return{valid:M.length===0,errors:M}}var $f={draft4:[{id:`http://json-schema.org/draft-04/schema#`,$schema:`http://json-schema.org/draft-04/schema#`,description:`Core schema meta-schema`,definitions:{schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},positiveInteger:{type:`integer`,minimum:0},positiveIntegerDefault0:{allOf:[{$ref:`#/definitions/positiveInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},minItems:1,uniqueItems:!0}},type:`object`,properties:{id:{type:`string`},$schema:{type:`string`},title:{type:`string`},description:{type:`string`},default:{},multipleOf:{type:`number`,minimum:0,exclusiveMinimum:!0},maximum:{type:`number`},exclusiveMaximum:{type:`boolean`,default:!1},minimum:{type:`number`},exclusiveMinimum:{type:`boolean`,default:!1},maxLength:{$ref:`#/definitions/positiveInteger`},minLength:{$ref:`#/definitions/positiveIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{anyOf:[{type:`boolean`},{$ref:`#`}],default:{}},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:{}},maxItems:{$ref:`#/definitions/positiveInteger`},minItems:{$ref:`#/definitions/positiveIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},maxProperties:{$ref:`#/definitions/positiveInteger`},minProperties:{$ref:`#/definitions/positiveIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{anyOf:[{type:`boolean`},{$ref:`#`}],default:{}},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},enum:{type:`array`},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},dependencies:{exclusiveMaximum:[`maximum`],exclusiveMinimum:[`minimum`]},default:{}}],draft6:[{$schema:`http://json-schema.org/draft-06/schema#`,$id:`http://json-schema.org/draft-06/schema#`,title:`Core schema meta-schema`,definitions:{schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},type:[`object`,`boolean`],properties:{$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},title:{type:`string`},description:{type:`string`},default:{},examples:{type:`array`,items:{}},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:{}},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:{},enum:{type:`array`},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},default:{}}],draft7:[{$schema:`http://json-schema.org/draft-07/schema#`,$id:`http://json-schema.org/draft-07/schema#`,title:`Core schema meta-schema`,definitions:{schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},type:[`object`,`boolean`],properties:{$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},writeOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},default:!0}],draft201909:[{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/schema`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:`Core and Validation specifications meta-schema`,allOf:[{$ref:`meta/core`},{$ref:`meta/applicator`},{$ref:`meta/validation`},{$ref:`meta/meta-data`},{$ref:`meta/format`},{$ref:`meta/content`}],type:[`object`,`boolean`],properties:{definitions:{$comment:`While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.`,type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}},dependencies:{$comment:`"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"`,type:`object`,additionalProperties:{anyOf:[{$recursiveRef:`#`},{$ref:`meta/validation#/$defs/stringArray`}]}}}},{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/core`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:`Core vocabulary meta-schema`,type:[`object`,`boolean`],properties:{$id:{type:`string`,format:`uri-reference`,$comment:`Non-empty fragments not allowed.`,pattern:`^[^#]*#?$`},$schema:{type:`string`,format:`uri`},$anchor:{type:`string`,pattern:`^[A-Za-z][-A-Za-z0-9.:_]*$`},$ref:{type:`string`,format:`uri-reference`},$recursiveRef:{type:`string`,format:`uri-reference`},$recursiveAnchor:{type:`boolean`,default:!1},$vocabulary:{type:`object`,propertyNames:{type:`string`,format:`uri`},additionalProperties:{type:`boolean`}},$comment:{type:`string`},$defs:{type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}}}},{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/applicator`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:`Applicator vocabulary meta-schema`,type:[`object`,`boolean`],properties:{additionalItems:{$recursiveRef:`#`},unevaluatedItems:{$recursiveRef:`#`},items:{anyOf:[{$recursiveRef:`#`},{$ref:`#/$defs/schemaArray`}]},contains:{$recursiveRef:`#`},additionalProperties:{$recursiveRef:`#`},unevaluatedProperties:{$recursiveRef:`#`},properties:{type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$recursiveRef:`#`},propertyNames:{format:`regex`},default:{}},dependentSchemas:{type:`object`,additionalProperties:{$recursiveRef:`#`}},propertyNames:{$recursiveRef:`#`},if:{$recursiveRef:`#`},then:{$recursiveRef:`#`},else:{$recursiveRef:`#`},allOf:{$ref:`#/$defs/schemaArray`},anyOf:{$ref:`#/$defs/schemaArray`},oneOf:{$ref:`#/$defs/schemaArray`},not:{$recursiveRef:`#`}},$defs:{schemaArray:{type:`array`,minItems:1,items:{$recursiveRef:`#`}}}},{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/validation`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:`Validation vocabulary meta-schema`,type:[`object`,`boolean`],properties:{multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/$defs/nonNegativeInteger`},minLength:{$ref:`#/$defs/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},maxItems:{$ref:`#/$defs/nonNegativeInteger`},minItems:{$ref:`#/$defs/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},maxContains:{$ref:`#/$defs/nonNegativeInteger`},minContains:{$ref:`#/$defs/nonNegativeInteger`,default:1},maxProperties:{$ref:`#/$defs/nonNegativeInteger`},minProperties:{$ref:`#/$defs/nonNegativeIntegerDefault0`},required:{$ref:`#/$defs/stringArray`},dependentRequired:{type:`object`,additionalProperties:{$ref:`#/$defs/stringArray`}},const:!0,enum:{type:`array`,items:!0},type:{anyOf:[{$ref:`#/$defs/simpleTypes`},{type:`array`,items:{$ref:`#/$defs/simpleTypes`},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{$ref:`#/$defs/nonNegativeInteger`,default:0},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}}},{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/meta-data`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:`Meta-data vocabulary meta-schema`,type:[`object`,`boolean`],properties:{title:{type:`string`},description:{type:`string`},default:!0,deprecated:{type:`boolean`,default:!1},readOnly:{type:`boolean`,default:!1},writeOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0}}},{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/format`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:`Format vocabulary meta-schema`,type:[`object`,`boolean`],properties:{format:{type:`string`}}},{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/content`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:`Content vocabulary meta-schema`,type:[`object`,`boolean`],properties:{contentMediaType:{type:`string`},contentEncoding:{type:`string`},contentSchema:{$recursiveRef:`#`}}}],draft202012:[{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/schema`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:`meta`,title:`Core and Validation specifications meta-schema`,allOf:[{$ref:`meta/core`},{$ref:`meta/applicator`},{$ref:`meta/unevaluated`},{$ref:`meta/validation`},{$ref:`meta/meta-data`},{$ref:`meta/format-annotation`},{$ref:`meta/content`}],type:[`object`,`boolean`],$comment:`This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.`,properties:{definitions:{$comment:`"definitions" has been replaced by "$defs".`,type:`object`,additionalProperties:{$dynamicRef:`#meta`},deprecated:!0,default:{}},dependencies:{$comment:`"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.`,type:`object`,additionalProperties:{anyOf:[{$dynamicRef:`#meta`},{$ref:`meta/validation#/$defs/stringArray`}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:`"$recursiveAnchor" has been replaced by "$dynamicAnchor".`,$ref:`meta/core#/$defs/anchorString`,deprecated:!0},$recursiveRef:{$comment:`"$recursiveRef" has been replaced by "$dynamicRef".`,$ref:`meta/core#/$defs/uriReferenceString`,deprecated:!0}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/core`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:`meta`,title:`Core vocabulary meta-schema`,type:[`object`,`boolean`],properties:{$id:{$ref:`#/$defs/uriReferenceString`,$comment:`Non-empty fragments not allowed.`,pattern:`^[^#]*#?$`},$schema:{$ref:`#/$defs/uriString`},$ref:{$ref:`#/$defs/uriReferenceString`},$anchor:{$ref:`#/$defs/anchorString`},$dynamicRef:{$ref:`#/$defs/uriReferenceString`},$dynamicAnchor:{$ref:`#/$defs/anchorString`},$vocabulary:{type:`object`,propertyNames:{$ref:`#/$defs/uriString`},additionalProperties:{type:`boolean`}},$comment:{type:`string`},$defs:{type:`object`,additionalProperties:{$dynamicRef:`#meta`}}},$defs:{anchorString:{type:`string`,pattern:`^[A-Za-z_][-A-Za-z0-9._]*$`},uriString:{type:`string`,format:`uri`},uriReferenceString:{type:`string`,format:`uri-reference`}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/applicator`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:`meta`,title:`Applicator vocabulary meta-schema`,type:[`object`,`boolean`],properties:{prefixItems:{$ref:`#/$defs/schemaArray`},items:{$dynamicRef:`#meta`},contains:{$dynamicRef:`#meta`},additionalProperties:{$dynamicRef:`#meta`},properties:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},default:{}},patternProperties:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},propertyNames:{format:`regex`},default:{}},dependentSchemas:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},default:{}},propertyNames:{$dynamicRef:`#meta`},if:{$dynamicRef:`#meta`},then:{$dynamicRef:`#meta`},else:{$dynamicRef:`#meta`},allOf:{$ref:`#/$defs/schemaArray`},anyOf:{$ref:`#/$defs/schemaArray`},oneOf:{$ref:`#/$defs/schemaArray`},not:{$dynamicRef:`#meta`}},$defs:{schemaArray:{type:`array`,minItems:1,items:{$dynamicRef:`#meta`}}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/unevaluated`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:`meta`,title:`Unevaluated applicator vocabulary meta-schema`,type:[`object`,`boolean`],properties:{unevaluatedItems:{$dynamicRef:`#meta`},unevaluatedProperties:{$dynamicRef:`#meta`}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/validation`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:`meta`,title:`Validation vocabulary meta-schema`,type:[`object`,`boolean`],properties:{type:{anyOf:[{$ref:`#/$defs/simpleTypes`},{type:`array`,items:{$ref:`#/$defs/simpleTypes`},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/$defs/nonNegativeInteger`},minLength:{$ref:`#/$defs/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},maxItems:{$ref:`#/$defs/nonNegativeInteger`},minItems:{$ref:`#/$defs/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},maxContains:{$ref:`#/$defs/nonNegativeInteger`},minContains:{$ref:`#/$defs/nonNegativeInteger`,default:1},maxProperties:{$ref:`#/$defs/nonNegativeInteger`},minProperties:{$ref:`#/$defs/nonNegativeIntegerDefault0`},required:{$ref:`#/$defs/stringArray`},dependentRequired:{type:`object`,additionalProperties:{$ref:`#/$defs/stringArray`}}},$defs:{nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{$ref:`#/$defs/nonNegativeInteger`,default:0},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/meta-data`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:`meta`,title:`Meta-data vocabulary meta-schema`,type:[`object`,`boolean`],properties:{title:{type:`string`},description:{type:`string`},default:!0,deprecated:{type:`boolean`,default:!1},readOnly:{type:`boolean`,default:!1},writeOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/format-annotation`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:`meta`,title:`Format vocabulary meta-schema for annotation results`,type:[`object`,`boolean`],properties:{format:{type:`string`}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/content`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:`meta`,title:`Content vocabulary meta-schema`,type:[`object`,`boolean`],properties:{contentEncoding:{type:`string`},contentMediaType:{type:`string`},contentSchema:{$dynamicRef:`#meta`}}}]},ep={"json-schema.org/draft/2020-12/schema":`2020-12`,"json-schema.org/draft/2019-09/schema":`2019-09`,"json-schema.org/draft-07/schema":`7`,"json-schema.org/draft-06/schema":`6`,"json-schema.org/draft-04/schema":`4`},tp=/* @__PURE__ */ new Set(/* @__PURE__ */ `$anchor.$id.$recursiveAnchor.$recursiveRef.$ref.additionalItems.additionalProperties.allOf.anyOf.const.contains.dependencies.dependentRequired.dependentSchemas.else.enum.exclusiveMaximum.exclusiveMinimum.format.id.if.items.maxContains.maxItems.maxLength.maxProperties.maximum.minContains.minItems.minLength.minProperties.minimum.multipleOf.not.oneOf.pattern.patternProperties.prefixItems.properties.propertyNames.required.then.type.unevaluatedItems.unevaluatedProperties.uniqueItems`.split(`.`)),np={single:[`additionalItems`,`additionalProperties`,`items`,`not`],array:[`allOf`,`anyOf`,`items`,`oneOf`],map:[`definitions`,`dependencies`,`patternProperties`,`properties`],plain:[`$ref`,`enum`,`exclusiveMaximum`,`exclusiveMinimum`,`format`,`id`,`maxItems`,`maxLength`,`maxProperties`,`maximum`,`minItems`,`minLength`,`minProperties`,`minimum`,`multipleOf`,`pattern`,`required`,`type`,`uniqueItems`]},rp={...np,single:[...np.single,`contains`,`propertyNames`],plain:[...np.plain.filter(e=>e!==`id`),`$id`,`const`]},ip={...rp,single:[...rp.single,`if`,`then`,`else`]},ap={single:[...ip.single,`unevaluatedItems`,`unevaluatedProperties`],array:ip.array,map:[...ip.map,`$defs`,`dependentSchemas`],plain:[...ip.plain.filter(e=>e!==`format`),`$anchor`,`$recursiveAnchor`,`$recursiveRef`,`dependentRequired`,`maxContains`,`minContains`]},op={4:np,6:rp,7:ip,"2019-09":ap,"2020-12":{single:ap.single.filter(e=>e!==`additionalItems`),array:[`allOf`,`anyOf`,`oneOf`,`prefixItems`],map:ap.map,plain:ap.plain.filter(e=>e!==`$recursiveAnchor`&&e!==`$recursiveRef`)}},sp={4:[],6:[`contentMediaType`],7:[`contentMediaType`],"2019-09":[],"2020-12":[`$dynamicAnchor`,`$dynamicRef`]},cp=[`date`,`date-time`,`email`,`hostname`,`idn-email`,`ipv4`,`ipv6`,`regex`,`time`,`uri`],lp=[...cp,`json-pointer`,`uri-reference`,`uri-template`],up={4:cp,6:lp,7:[...lp,`idn-hostname`,`iri`,`iri-reference`,`relative-json-pointer`]},dp=[`idn-email`,`idn-hostname`,`iri`,`iri-reference`],fp={base64:pp(`A-Za-z0-9+/`),base64url:pp(`A-Za-z0-9\\-_`),base32:mp(`A-Z2-7`,`AEIMQUY4`,`AQ`,`ACEGIKMOQSUWY246`,`AIQY`),base32hex:mp(`0-9A-V`,`048CGKOS`,`0G`,`02468ACEGIKMOQSU`,`08GO`),base16:`^(?:[0-9A-Fa-f]{2})*$`};function pp(e){let t=`[${e}]`;return`^(?:${t}{4})*(?:${t}[AQgw]==|${t}{2}[AEIMQUYcgkosw048]=)?$`}function mp(e,t,n,r,i){let a=`[${e}]`;return`^(?:${a}{8})*(?:${a}[${t}]={6}|${a}{3}[${n}]={4}|${a}{4}[${r}]={3}|${a}{6}[${i}]=)?$`}var hp=class extends Error{};function gp(e){if(!Hl(e))return`2020-12`;let t=e.$schema;if(typeof t!=`string`)return`2020-12`;let n=ep[t.replace(/#+$/,``).replace(/^https?:\/\//,``)];if(!n)throw new hp(`unknown JSON Schema dialect "${t}"`);return n}function _p(e,t,n=[]){if(typeof e==`boolean`)return e;if(!Hl(e))return{};let r=op[t],i=/* @__PURE__ */ new Set([...r.single,...r.array,...r.map,...r.plain,...n]),a=typeof e.$ref==`string`&&[`4`,`6`,`7`].includes(t),o=[];for(let[s,c]of Object.entries(e)){if(sp[t].includes(s)&&!n.includes(s))throw new hp(`the \`${s}\` keyword is not supported by the browser runtime yet`);if(!(tp.has(s)&&(!i.has(s)||a&&s!==`$ref`))){if(s===`pattern`&&typeof c==`string`&&yp(c),s===`patternProperties`&&Hl(c))for(let e of Object.keys(c))yp(e);if(s===`format`&&typeof c==`string`){if(!up[t]?.includes(c))continue;if(dp.includes(c))throw new hp(`the "${c}" format is not supported by the browser runtime yet`)}r.array.includes(s)&&Array.isArray(c)?o.push([s,c.map(e=>_p(e,t,n))]):r.single.includes(s)?o.push([s,_p(c,t,n)]):r.map.includes(s)&&Hl(c)?o.push([s,vp(c,t,n)]):o.push([s,c])}}let s=e.contentEncoding;if(!a&&(t===`6`||t===`7`)&&typeof s==`string`){let e=fp[s];if(e){let t=o.find(([e])=>e===`allOf`);t?t[1]=[...t[1],{pattern:e}]:o.push([`allOf`,[{pattern:e}]])}}return Object.fromEntries(o)}function vp(e,t,n){return Object.fromEntries(Object.entries(e).map(([e,r])=>[e,Array.isArray(r)?r:_p(r,t,n)]))}function yp(e){try{hd(e)}catch(t){throw t instanceof Zu?new hp(`"${e}" is not a valid regular expression: ${t.message}`):t instanceof Qu?new hp(`the regular expression "${e}" is not supported by the browser runtime yet: ${t.message}`):t}}function bp(e){for(let t of e.references)if(Yf(e.lookup,t)===void 0)throw new hp(`unresolvable reference "${decodeURI(t.replace(/^json-schema:\/\/\//,``))}"`)}function xp(e){if(Array.isArray(e))return e.map(xp);if(!Hl(e))return e;let t=[];for(let[n,r]of Object.entries(e))n===`$dynamicAnchor`?t.push([`$recursiveAnchor`,!0]):n===`$dynamicRef`?t.push([`$recursiveRef`,`#`]):t.push([n,xp(r)]);return Object.fromEntries(t)}var Sp={4:$f.draft4,6:$f.draft6,7:$f.draft7,"2019-09":$f.draft201909,"2020-12":$f.draft202012};function Cp(e){return Sp[e].map(t=>e===`2020-12`?xp(_p(t,e,[`$dynamicAnchor`,`$dynamicRef`])):_p(t,e))}var wp=class{constructor(e,t,n,r){this.schema=e,this.dialect=t,this.shortCircuit=n,this.lookup=Jf(e,void 0,this.references);for(let e of r)Jf(e,this.lookup)}lookup;references=[];validate(e){return Qf(e,this.schema,this.dialect,this.lookup,this.shortCircuit)}},Tp=/* @__PURE__ */ new Map;function Ep(e){let t=Tp.get(e);if(!t){let[n,...r]=Cp(e);t=new wp(n,e,!1,r),Tp.set(e,t)}return t}function Dp(e){let t=e[e.length-1];if(!t)return`value does not match the schema`;let n=t.instanceLocation.replace(/^#/,``);return n?`${t.error} (at ${n})`:t.error}function Op(e){let t=gp(e);if(typeof e==`boolean`){if(t===`4`)throw new hp(`boolean schemas need draft 6 or later`)}else{let n=Ep(t).validate(e);if(!n.valid)throw new hp(Dp(n.errors))}let n=new wp(_p(If(e),t),t,!0,Cp(t));return bp(n),e=>{let t=n.validate(Af(e));return t.valid?void 0:Dp(t.errors)}}function kp(e){return Op(Af(e))}function Ap(e){e.setJsonSchemaValidator(kp)}function jp(){return import.meta.url}function Mp(){return null}var Np=`Jazz's local-first client needs its Metro setup on Expo web: wrap your Metro config in withJazz from jazz-tools/expo/metro (module.exports = withJazz(getDefaultConfig(__dirname))) and restart Metro with --clear.`;function Pp(){return`__METRO_GLOBAL_PREFIX__`in globalThis}async function Fp(){let e=process.getBuiltinModule?.(`module`),t=process.getBuiltinModule?.(`fs`),n=process.getBuiltinModule?.(`path`);if(!e||!t||!n)return null;let{createRequire:r}=e,{existsSync:i,readFileSync:a}=t,{dirname:o,resolve:s}=n,c={}.JAZZ_CORRECTNESS_WASM_PACKAGE;if({}.JAZZ_CORRECTNESS_ARTIFACT_RUN===`1`&&!c)throw Error(`sealed correctness consumer is missing its admitted WASM package`);if(c){let e=s(c,`jazz_wasm_bg.wasm`);return i(e)?a(e):null}let l=s(o(r(import.meta.url).resolve(`jazz-wasm/package.json`)),`pkg/jazz_wasm_bg.wasm`);return i(l)?a(l):null}var Ip=Promise.resolve(),Lp;function Rp(e){let t=Ip.then(()=>zp(e));return Ip=t.then(()=>{},()=>{}),t}async function zp(e){let t=await Promise.resolve().then(()=>(He(),i)),n=Gu(e);if(n)return t.initSync(n),Bp(t);let r=!1;if(typeof process<`u`&&process.versions?.node)try{let e=await Fp();e&&(t.initSync({module:e}),r=!0)}catch{}if(!r&&typeof t.default==`function`){let n=typeof location<`u`?Ku(jp,location.href,e)??Mp():null;if(n)await Vp(t,n);else{if(typeof location<`u`&&Pp())throw Error(Np);await t.default()}}return Bp(t)}function Bp(e){return Xu(e,`WASM`,[`initSync`,`WasmDb`,`setJsonSchemaValidator`]),Ap(e),e}async function Vp(e,t){if(Lp===t)return;let n=await fetch(t);if(!n.ok)throw Error(`WASM asset request failed (${n.status} ${n.statusText}) for ${t}`);let r=n.headers.get(`content-type`);if(Hp(r)){let i;try{i=await WebAssembly.compileStreaming(n)}catch(e){throw e instanceof WebAssembly.CompileError?/* @__PURE__ */ Error(`WASM asset response is not a WebAssembly binary for ${t} (${r}): ${e.message}`):e}await e.default({module_or_path:i}),Lp=t;return}let i=new Uint8Array(await n.arrayBuffer());if(i.length<4||i[0]!==0||i[1]!==97||i[2]!==115||i[3]!==109)throw Error(`WASM asset response is not a WebAssembly binary for ${t} (${r??`unknown content type`})`);await e.default({module_or_path:i}),Lp=t}function Hp(e){return typeof WebAssembly.compileStreaming==`function`&&e?.trim()===`application/wasm`}var Up=class extends Error{constructor(e){super(`IndexedDB database ${e} is active in another Jazz SharedWorker realm; wait for that worker to close before retrying`),this.databaseName=e,this.name=`BrowserPhysicalDatabaseBusyError`}},Wp=/* @__PURE__ */ new WeakMap;function Gp(e,t){let n=Wp.get(e);if(!n||n.databaseName!==t||!n.active()||n.claimed)throw Error(`IndexedDB reclamation requires an unclaimed live database Web Lock`);return n.claimed=!0,n.active}async function Kp(e,t=globalThis.navigator?.locks){if(!t)throw Error(`Persistent browser storage requires the Web Locks API`);let n,r,i=new Promise((e,t)=>{n=e,r=t}),a=!1,o,s=new Promise(e=>{o=e}),c,l=new Promise(e=>{c=e}),u=crypto.randomUUID();return t.request(`jazz:browser-physical-database:${e}`,{mode:`exclusive`,ifAvailable:!0},async t=>{if(!t){r(new Up(e));return}let i={id:u,release:()=>(a||(a=!0,o()),l)};Wp.set(i,{databaseName:e,active:()=>!a,claimed:!1}),n(i),await s}).then(()=>{a=!0,c()},e=>{a=!0,c(),r(Vl(e))}),await i}var qp=`unsupported_storage_codecs`,Jp=class extends Error{name=`UnsupportedStorageCodecsError`;code=qp;missing;unknown;format;constructor(e,t,n=`Unsupported storage format: this store lacks codec families ${JSON.stringify(e)} required by this build and declares ${JSON.stringify(t)} that this build does not read`,r){super(n,r),this.missing=e,this.unknown=t,r?.format!==void 0&&(this.format=r.format)}};function Yp(e){return!e||typeof e!=`object`?!1:e.code===qp}function Xp(e){if(e instanceof Jp||!Yp(e))return e;let{missing:t,unknown:n,format:r}=e;return r!==void 0&&(typeof r!=`string`||r.length===0)||(t!==void 0||n!==void 0)&&(!Zp(t)||!Zp(n))?e:new Jp([...t??[]],[...n??[]],e.message,{cause:e,...r===void 0?{}:{format:r}})}function Zp(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}var Qp=1,$p=`jazz-idb-tree`,em=3,tm=`pages`,nm=`metadata`,q=`storage-manifest`,rm=`epoch`,im=`browser-runtime-owner`,am=`browser-worker-epoch-v1`,om=`jazz-browser-worker-epoch-v1`,sm=`replica-node-v1`,cm=16,lm=`foreground-node-leases-v1`,um=`jazz-foreground-node-leases-v1`,dm=(1n<<64n)-1n,fm=`current`,pm=1024,mm=2147483648,hm=16384,gm=1,_m={storageEpoch:gm,adapterId:`jazz-idb-tree`,adapterFormatVersion:Qp,requiredCodecIds:[`jazz.sqlite-storage.v1`],pageSize:hm,pageChecksum:`xxh3-64-le`,pageFormatMagic:`IDBTREE\0`,pageFormatVersion:Qp},vm=class extends Error{constructor(e){super(`IndexedDB storage was invalidated: ${e}`),this.databaseName=e,this.name=`IndexedDbStorageInvalidatedError`}},ym=class extends Error{code=`storage`;constructor(e){super(`browser storage: could not write to IndexedDB (QuotaExceededError); the browser may be out of storage space for this site`,{cause:e}),this.name=`IndexedDbStorageFullError`}};function bm(e,t){return e?.name===`QuotaExceededError`?new ym(e):e??Error(t)}var xm=class e{constructor(e,t,n){this.db=e,this.name=t,n&&this.invalidationListeners.add(n),e.addEventListener(`versionchange`,this.handleVersionChange),e.addEventListener(`close`,this.handleUnexpectedClose)}invalidated=!1;reclamationOwnership=null;treeClaims=/* @__PURE__ */ new Set;nextTreeToken=0;treeTransactions=/* @__PURE__ */ new Set;ownershipRevision=0;claimTreeOwnership(){if(this.assertValid(),this.reclamationOwnership&&(this.treeClaims.size>0||this.treeTransactions.size>0))throw Error(`IndexedDB reclamation owner already has a tree or pending transaction`);if(this.nextTreeToken===2**53-1)throw Error(`IndexedDB tree token space exhausted`);let e=++this.nextTreeToken;return this.treeClaims.add(e),e}releaseTreeOwnership(e){this.treeClaims.delete(e)}isTreeOwnershipActive(e){return!this.invalidated&&this.treeClaims.has(e)&&(this.reclamationOwnership===null||this.reclamationOwnership())}async retireTreeOwnership(){this.treeClaims.clear(),await Promise.allSettled(this.treeTransactions)}get canReclaimObsoletePages(){return!this.invalidated&&this.treeClaims.size===1&&this.reclamationOwnership?.()===!0}replicaNodeBytes=null;invalidationListeners=/* @__PURE__ */ new Set;onInvalidated(e){return this.invalidationListeners.add(e),()=>this.invalidationListeners.delete(e)}static async open(t,n={}){let r=indexedDB.open(t,em),i=!1;r.onupgradeneeded=e=>{if(e.oldVersion!==0){i=!0,r.result.close(),r.transaction?.abort();return}let t=r.result;if(t.objectStoreNames.contains(tm)||t.createObjectStore(tm),t.objectStoreNames.contains(nm)||t.createObjectStore(nm),!t.objectStoreNames.contains(q)){let e=t.createObjectStore(q);r.transaction&&(e.put(_m,rm),e.put(Cm().buffer,sm))}};let a;try{a=await Rm(r)}catch(e){throw i?/* @__PURE__ */ Error(`Missing or invalid IndexedDB storage epoch manifest`):e}let o=new e(a,t,n.onInvalidated);try{return await o.assertStorageManifest(),n.owner&&await o.claimBrowserRuntimeOwner(n.owner),o.replicaNodeBytes=await o.readReplicaNodeBytes(),o}catch(e){throw o.close(),e}}get replicaNode(){if(!this.replicaNodeBytes)throw Error(`IndexedDB replica node is unavailable before storage admission`);return this.replicaNodeBytes.slice()}async acquireForegroundNodeLease(e=!1){return await this.updateForegroundNodeLeasePool(t=>{if(e){for(let e of t.active)t.retired.push(e.node);t.active=[]}let n=t.reusable.pop(),r={leaseId:crypto.randomUUID(),node:n?.node??wm(Cm()),confirmedTxTime:n?.confirmedTxTime??`0`};return t.active.push(r),Em(r)})}async returnForegroundNodeLease(e,t){if(!Mm(e)||!Fm(t))throw Error(`Invalid IndexedDB foreground node lease handoff`);await this.updateForegroundNodeLeasePool(n=>{let r=n.active.findIndex(t=>t.leaseId===e);if(r<0)throw Error(`Unknown IndexedDB foreground node lease`);let[i]=n.active.splice(r,1);if(!i)throw Error(`Unknown IndexedDB foreground node lease`);let a=BigInt(i.confirmedTxTime);n.reusable.push({...i,confirmedTxTime:(t>a?t:a).toString()})})}async retireForegroundNodeLease(e){if(!Mm(e))throw Error(`Invalid IndexedDB foreground node lease`);await this.updateForegroundNodeLeasePool(t=>{let n=t.active.findIndex(t=>t.leaseId===e);if(n<0)return;let[r]=t.active.splice(n,1);r&&t.retired.push(r.node)})}async foregroundNodeLeaseNodeState(e){if(e.byteLength!==cm)throw Error(`Invalid IndexedDB foreground node identity`);this.assertValid();let t=this.db.transaction(q,`readonly`),n=zm(t);try{let r=await Rm(t.objectStore(q).get(lm));if(await n,r===void 0)return`missing`;let i=Dm(r),a=Im(wm(e));return i.active.some(e=>Im(e.node)===a)?`active`:i.reusable.some(e=>Im(e.node)===a)?`reusable`:i.retired.some(e=>Im(e)===a)?`retired`:`missing`}catch(e){throw await n.catch(()=>{}),e}}async claimBrowserWorkerEpoch(e,t){if(!Nm(e))throw Error(`Invalid browser worker epoch`);if(this.assertValid(),t&&(t.id!==e||this.treeClaims.size>0))throw Error(`IndexedDB reclamation ownership must precede tree construction`);let n=this.ownershipRevision,r=t?Gp(t,this.name):null,i=this.db.transaction(q,`readwrite`),a=zm(i);if(i.objectStore(q).put({format:om,epoch:e},am),await a,this.assertValid(),n!==this.ownershipRevision)throw Error(`IndexedDB worker ownership was released while claiming`);this.reclamationOwnership=r}async releaseBrowserWorkerEpoch(e){if(this.treeClaims.clear(),this.ownershipRevision++,this.reclamationOwnership=null,!Nm(e))throw Error(`Invalid browser worker epoch`);this.assertValid();let t=this.db.transaction(q,`readwrite`),n=zm(t),r=t.objectStore(q),i=await Rm(r.get(am));i&&typeof i==`object`&&i.format===om&&i.epoch===e&&r.delete(am),await n}async metadata(){this.assertValid();let e=this.db.transaction(nm,`readonly`),t=zm(e),n=await Rm(e.objectStore(nm).get(fm));return await t,n===void 0?null:(Vm(n),n)}async assertStorageManifest(){let e=this.db.transaction(q,`readonly`),t=zm(e),n=await Rm(e.objectStore(q).get(rm));await t,Um(n)}async claimBrowserRuntimeOwner(e){if(typeof e!=`string`||e.length===0)throw Error(`Invalid browser IndexedDB runtime owner`);let t=this.db.transaction(q,`readwrite`),n=zm(t),r=t.objectStore(q),i=await Rm(r.get(im));if(i===void 0)r.put(e,im),await n;else if(i===e)await n;else throw t.abort(),await n.catch(()=>{}),/* @__PURE__ */ Error(`IndexedDB database ${this.name} is already owned by a different Jazz browser session; this indicates a wrong physical root or namespace derivation error. Reset this scoped database only if you intend to discard its cache`)}async readReplicaNodeBytes(){let e=this.db.transaction(q,`readonly`),t=zm(e),n=await Rm(e.objectStore(q).get(sm));if(await t,!(n instanceof ArrayBuffer)&&!ArrayBuffer.isView(n))throw Error(`Missing or invalid IndexedDB replica node identity`);let r=n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength);if(r.byteLength!==cm)throw Error(`Missing or invalid IndexedDB replica node identity`);return r.slice()}async updateForegroundNodeLeasePool(e){this.assertValid();let t=Sm(this.db,[q]),n=zm(t),r=t.objectStore(q);try{let t=await Rm(r.get(lm)),i=t===void 0?Tm():Dm(t),a=e(i);return km(i),r.put(i,lm),await n,a}catch(e){try{t.abort()}catch{}throw await n.catch(()=>{}),e}}async readPage(e){return(await this.readPages([e]))[0]}async readPages(e){this.assertValid();for(let t of e)Gm(t);if(e.length===0)return[];let t=this.db.transaction(tm,`readonly`),n=zm(t),r=t.objectStore(tm),i;try{i=await Promise.all(e.map(e=>Rm(r.get(e))))}catch(e){throw await n.catch(()=>{}),e}return await n,i.map((t,n)=>Lm(e[n],t))}async commit(e,t){if(this.assertValid(),Hm(e),t!==void 0&&!this.isTreeOwnershipActive(t))throw Error(`IndexedDB tree ownership has expired`);let n=(e.deletedPageIds?.length??0)>0;if(n&&!this.canReclaimObsoletePages)throw Error(`IndexedDB page reclamation ownership is not active`);let r=Sm(this.db,[tm,nm]),i=zm(r),a=r.objectStore(tm),o=r.objectStore(nm),s=await Rm(o.get(fm)),c=s===void 0?0:Bm(s);if(c!==e.expectedGeneration)throw r.abort(),await i.catch(()=>{}),/* @__PURE__ */ Error(`IndexedDB B-tree generation changed: expected ${e.expectedGeneration}, found ${c}`);let l={...e.metadata,formatMagic:$p,formatVersion:Qp,generation:c+1};Vm(l);try{if(l.rootPageId!==null&&!e.pages.has(l.rootPageId)&&await Rm(a.get(l.rootPageId))===void 0)throw Error(`IndexedDB B-tree root page ${l.rootPageId} is missing`);if(t!==void 0&&!this.isTreeOwnershipActive(t))throw Error(`IndexedDB tree ownership expired before publication`);if(n&&!this.canReclaimObsoletePages)throw Error(`IndexedDB page reclamation ownership expired before publication`);for(let[t,n]of e.pages){if(n.byteLength>l.pageSize)throw Error(`IndexedDB B-tree page ${t} exceeds configured page size`);a.put(n.slice().buffer,t)}for(let t of e.deletedPageIds??[])a.delete(t);return o.put(l,fm),await i,l}catch(e){try{r.abort()}catch{}throw await i.catch(()=>{}),e}}commitPages(e,t,n,r,i,a,o,s){if(i.length!==a.length)return Promise.reject(/* @__PURE__ */ Error(`IDBTree page ids and page bytes have different lengths`));let c=this.commit({expectedGeneration:e,metadata:{pageSize:t,rootPageId:n<0?null:n,nextPageId:r},pages:new Map(i.map((e,t)=>[e,a[t]])),deletedPageIds:o},s);return s!==void 0&&(this.treeTransactions.add(c),c.then(()=>this.treeTransactions.delete(c),()=>this.treeTransactions.delete(c))),c}close(){this.treeClaims.clear(),this.invalidated=!0,this.ownershipRevision++,this.reclamationOwnership=null,this.removeInvalidationListeners(),this.db.close()}async clear(){this.assertValid();let e=Sm(this.db,[tm,nm]),t=zm(e);e.objectStore(tm).clear(),e.objectStore(nm).clear(),await t}static async destroy(e){let t=indexedDB.deleteDatabase(e);await new Promise((n,r)=>{t.onsuccess=()=>n(),t.onerror=()=>r(t.error??/* @__PURE__ */ Error(`IndexedDB deletion failed`)),t.onblocked=()=>r(/* @__PURE__ */ Error(`IndexedDB deletion was blocked by an open connection: ${e}`))})}handleVersionChange=()=>{this.db.close(),this.invalidate()};handleUnexpectedClose=()=>{this.invalidate()};invalidate(){if(this.invalidated)return;this.invalidated=!0,this.treeClaims.clear(),this.reclamationOwnership=null,this.removeInvalidationListeners();let e=new vm(this.name);for(let t of this.invalidationListeners)t(e)}assertValid(){if(this.invalidated)throw new vm(this.name)}removeInvalidationListeners(){this.db.removeEventListener(`versionchange`,this.handleVersionChange),this.db.removeEventListener(`close`,this.handleUnexpectedClose)}};function Sm(e,t){return e.transaction(t,`readwrite`,{durability:`relaxed`})}function Cm(){if(!globalThis.crypto?.getRandomValues)throw Error(`Browser storage requires cryptographic random values for its replica identity`);return Ml(globalThis.crypto.getRandomValues(new Uint8Array(cm)))}function wm(e){return e.slice().buffer}function Tm(){return{format:um,active:[],reusable:[],retired:[]}}function Em(e){return{leaseId:e.leaseId,node:new Uint8Array(e.node).slice(),confirmedTxTime:BigInt(e.confirmedTxTime)}}function Dm(e){return km(e),{format:e.format,active:e.active.map(Om),reusable:e.reusable.map(Om),retired:e.retired.map(e=>e.slice(0))}}function Om(e){return{leaseId:e.leaseId,node:e.node.slice(0),confirmedTxTime:e.confirmedTxTime}}function km(e){if(!e||typeof e!=`object`)throw Error(`Invalid IndexedDB foreground node lease pool`);let t=e;if(t.format!==um||!Array.isArray(t.active)||!Array.isArray(t.reusable)||!Array.isArray(t.retired))throw Error(`Invalid IndexedDB foreground node lease pool`);let n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Set;for(let e of[...t.active,...t.reusable]){Am(e);let t=Im(e.node);if(r.has(e.leaseId)||n.has(t))throw Error(`Invalid IndexedDB foreground node lease pool`);r.add(e.leaseId),n.add(t)}for(let e of t.retired){let t=jm(e)?Im(e):null;if(!t||n.has(t))throw Error(`Invalid IndexedDB foreground node lease pool`);n.add(t)}}function Am(e){if(!e||typeof e!=`object`)throw Error(`Invalid IndexedDB foreground node lease`);let t=e;if(!Mm(t.leaseId)||!jm(t.node)||!Pm(t.confirmedTxTime)||!Fm(BigInt(t.confirmedTxTime)))throw Error(`Invalid IndexedDB foreground node lease`)}function jm(e){return e instanceof ArrayBuffer&&e.byteLength===cm}function Mm(e){return typeof e==`string`&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function Nm(e){return typeof e==`string`&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function Pm(e){return typeof e==`string`&&/^(0|[1-9][0-9]*)$/.test(e)}function Fm(e){return e>=0n&&e<=dm}function Im(e){return Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}function Lm(e,t){if(t===void 0)return null;if(!(t instanceof ArrayBuffer)&&!ArrayBuffer.isView(t))throw Error(`IndexedDB B-tree page ${e} is not binary data`);return(t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)).slice()}function Rm(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(bm(e.error,`IndexedDB request failed`))})}function zm(e){return new Promise((t,n)=>{e.oncomplete=()=>t(),e.onabort=()=>n(bm(e.error,`IndexedDB transaction aborted`)),e.onerror=t=>{let r=t.target===e?null:t.target;n(bm(e.error??r?.error??null,`IndexedDB transaction failed`))}})}function Bm(e){return Vm(e),e.generation}function Vm(e){if(!e||typeof e!=`object`)throw Error(`Invalid IndexedDB B-tree metadata`);let t=e;if(t.formatMagic!==$p||t.formatVersion!==Qp||!Wm(t.pageSize)||t.pageSize!==hm||!Number.isSafeInteger(t.generation)||Number(t.generation)<1||t.rootPageId!==null&&!Km(t.rootPageId)||!Number.isSafeInteger(t.nextPageId)||Number(t.nextPageId)<0||t.rootPageId!==null&&Number(t.rootPageId)>=Number(t.nextPageId))throw Error(`Invalid IndexedDB B-tree metadata`)}function Hm(e){if(!Number.isSafeInteger(e.expectedGeneration)||e.expectedGeneration<0)throw Error(`Invalid IndexedDB B-tree expected generation`);let{pageSize:t,rootPageId:n,nextPageId:r}=e.metadata;if(!Wm(t)||t!==hm||!Km(r))throw Error(`Invalid IndexedDB B-tree commit metadata`);if(n!==null&&(!Km(n)||n>=r))throw Error(`Invalid IndexedDB B-tree commit root page id`);let i=/* @__PURE__ */ new Set;for(let[n,a]of e.pages){if(!Km(n)||n>=r||a.byteLength>t)throw Error(`Invalid IndexedDB B-tree page commit`);i.add(n)}for(let t of e.deletedPageIds??[])if(!Km(t)||t>=r||t===n||i.has(t))throw Error(`Invalid IndexedDB B-tree deleted page commit`)}function Um(e){if(!e||typeof e!=`object`)throw Error(`Missing or invalid IndexedDB storage epoch manifest`);let t=e,n=Object.keys(t).sort(),r=Object.keys(_m).sort();if(n.length!==r.length||n.some((e,t)=>e!==r[t])||t.storageEpoch!==_m.storageEpoch||t.adapterId!==_m.adapterId||t.adapterFormatVersion!==_m.adapterFormatVersion||t.pageSize!==_m.pageSize||t.pageChecksum!==_m.pageChecksum||t.pageFormatMagic!==_m.pageFormatMagic||t.pageFormatVersion!==_m.pageFormatVersion||!Array.isArray(t.requiredCodecIds)||!t.requiredCodecIds.every(e=>typeof e==`string`))throw Error(`Missing or invalid IndexedDB storage epoch manifest`);let i=t.requiredCodecIds,a=_m.requiredCodecIds;if(i.length!==a.length||i.some((e,t)=>e!==a[t])){let e=a.filter(e=>!i.includes(e)),t=i.filter(e=>!a.includes(e));throw new Jp(e,t,`Missing or invalid IndexedDB storage epoch manifest: unsupported storage format: this epoch-${gm} root lacks codec families ${JSON.stringify(e)} required by this build and declares ${JSON.stringify(t)} that this build does not read`)}}function Wm(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=pm&&e<=mm&&Number.isInteger(Math.log2(e))}function Gm(e){if(!Km(e))throw Error(`Invalid IndexedDB B-tree page id: ${e}`)}function Km(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}var qm=/* @__PURE__ */ new WeakMap,Jm=256,Ym=5e3,Xm=1,Zm={TRACE:1,DEBUG:5,INFO:9,WARN:13,ERROR:17};function Qm(e,t){let n=e.trim().replace(/\/+$/,``),r=`/v1/${t}`;return n.endsWith(`/v1/logs`)?`${n.slice(0,-8)}${r}`:n.endsWith(`/v1/traces`)?`${n.slice(0,-10)}${r}`:`${n}${r}`}function $m(e){if(!e.collectorUrl)return()=>{};let t={traceUrl:Qm(e.collectorUrl,`traces`),logUrl:Qm(e.collectorUrl,`logs`)},{runtimeThread:n,wasmModule:r}=e;if(!rh(r))return console.warn(`[jazz] WASM telemetry unavailable: trace entry hooks are missing.`),()=>{};let i=qm.get(r);if(i){if(i.closing)throw Error(`WASM telemetry collector is closing`);if(i.runtimeThread!==n)throw Error(`incompatible WASM telemetry runtime thread`);if(i.identity.traceUrl!==t.traceUrl||i.identity.logUrl!==t.logUrl)throw Error(`incompatible WASM telemetry collector`);return eh(r,i)}i={identity:t,runtimeThread:n,leases:/* @__PURE__ */ new Set,nextLeaseId:0,closing:!1,unsubscribe:null,exporter:null,exportTail:Promise.resolve(),shutdownScheduled:!1,drainMicrotaskPending:!1},qm.set(r,i);let a=()=>{let e=r.drainTraceEntries();!Array.isArray(e)||e.length===0||th(i,e)},o=()=>{i.closing||i.drainMicrotaskPending||(i.drainMicrotaskPending=!0,queueMicrotask(()=>{i.drainMicrotaskPending=!1,!i.closing&&a()}))},s=!1;try{return i.unsubscribe=r.subscribeTraceEntries(o),s=!0,r.setTraceEntryCollectionEnabled(!0),eh(r,i)}catch(e){if(s)try{r.setTraceEntryCollectionEnabled(!1)}catch{}try{i.unsubscribe?.()}catch{}throw i.unsubscribe=null,qm.get(r)===i&&qm.delete(r),e}}function eh(e,t){let n=t.nextLeaseId++;t.leases.add(n);let r=!1;return()=>{if(r||(r=!0,t.leases.delete(n),t.leases.size>0||t.closing))return;t.closing=!0;let i;try{t.unsubscribe?.()}catch(e){i=e}finally{try{let n=e.drainTraceEntries();Array.isArray(n)&&n.length>0&&th(t,n)}catch(e){i??=e}finally{try{e.setTraceEntryCollectionEnabled(!1)}catch(e){i??=e}finally{t.unsubscribe=null,nh(t),!i&&qm.get(e)===t&&qm.delete(e)}}}if(i)throw i}}function th(e,t){e.exportTail=e.exportTail.catch(()=>{}).then(async()=>{e.exporter||=ah(e.identity.traceUrl,e.identity.logUrl);try{let n=await e.exporter;for(let r of t)try{ih(n,e.runtimeThread,r)}catch(e){console.warn(`[jazz] WASM telemetry export failed:`,e)}}catch(t){e.exporter=null,console.warn(`[jazz] WASM telemetry export failed:`,t)}})}function nh(e){e.shutdownScheduled||(e.shutdownScheduled=!0,e.exportTail.catch(()=>{}).then(async()=>{try{await(e.exporter?await e.exporter:void 0)?.shutdown()}catch(e){console.warn(`[jazz] WASM telemetry shutdown failed:`,e)}}))}function rh(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.subscribeTraceEntries==`function`&&typeof t.drainTraceEntries==`function`&&typeof t.setTraceEntryCollectionEnabled==`function`}function ih(e,t,n){if(n.kind===`span`){let r={"jazz.runtime_thread":t,"jazz.span.sequence":n.sequence,"jazz.span.level":n.level,"jazz.span.target":n.target,"jazz.span.fields":lh(n.fields)};e.tracer.startSpan(n.name||`wasm span`,{kind:Xm,startTime:n.startUnixNano,attributes:ch(n.fields)?{...oh(n.fields),...r}:r}).end(n.endUnixNano)}else if(n.kind===`log`){let r={"jazz.runtime_thread":t,"jazz.log.sequence":n.sequence,"jazz.log.target":n.target,"jazz.log.fields":lh(n.fields)};e.logger.emit({timestamp:n.timestampUnixNano,severityNumber:sh(n.level),severityText:n.level,body:n.message,attributes:ch(n.fields)?{...oh(n.fields),...r}:r})}else e.logger.emit({severityNumber:Zm.WARN,severityText:`WARN`,body:`Dropped ${n.count} WASM telemetry records`,attributes:{"jazz.runtime_thread":t,"jazz.telemetry.dropped_count":n.count}})}async function ah(e,t){let[{OTLPTraceExporter:n},{BasicTracerProvider:r,BatchSpanProcessor:i},{OTLPLogExporter:a},{LoggerProvider:o,BatchLogRecordProcessor:s},{resourceFromAttributes:c}]=await Promise.all([Promise.resolve().then(()=>(xs(),bs)),Promise.resolve().then(()=>(Pc(),Nc)),Promise.resolve().then(()=>(zc(),Rc)),Promise.resolve().then(()=>(Al(),kl)),Promise.resolve().then(()=>(Qa(),Za))]),l=c({"service.name":`jazz-browser`,"telemetry.sdk.language":`webjs`}),u={maxExportBatchSize:Jm,maxQueueSize:Ym,scheduledDelayMillis:1e3},d=new r({resource:l,spanProcessors:[new i(new n({url:e}),u)]}),f=new o({resource:l,processors:[new s(new a({url:t}),u)]});return{tracer:d.getTracer(`jazz-wasm.tracing`),logger:f.getLogger(`jazz-wasm.tracing`),shutdown:async()=>{await Promise.all([typeof d.shutdown==`function`?d.shutdown():void 0,typeof f.shutdown==`function`?f.shutdown():void 0])}}}function oh(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e))n.startsWith(`jazz.`)||r!=null&&(t[n]=typeof r==`string`||typeof r==`number`||typeof r==`boolean`?r:JSON.stringify(r));return t}function sh(e){switch(e.toUpperCase()){case`TRACE`:return Zm.TRACE;case`DEBUG`:return Zm.DEBUG;case`INFO`:return Zm.INFO;case`WARN`:case`WARNING`:return Zm.WARN;case`ERROR`:return Zm.ERROR;default:return 0}}function ch(e){if(!e)return!1;for(let t in e)return!0;return!1}function lh(e){return ch(e)?JSON.stringify(e):`{}`}var uh=class{constructor(e,t){this.transport=e,this.onError=t}timer;deadline;closed=!1;refresh(){if(!this.closed)try{let e=this.transport.auxiliaryReceiveTimeoutMs?.();if(e==null){this.clear();return}if(!Number.isFinite(e)||e<0||!this.transport.expireAuxiliaryReceive)throw Error(`Invalid auxiliary receive deadline capability`);let t=performance.now()+e;if(this.deadline!==void 0&&this.deadline<=t)return;this.clear(),this.deadline=t,this.timer=setTimeout(()=>{if(this.timer=void 0,this.deadline=void 0,!this.closed)try{this.transport.expireAuxiliaryReceive(),this.refresh()}catch(e){this.fail(e)}},e)}catch(e){this.fail(e)}}close(){this.closed=!0,this.clear()}clear(){this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0,this.deadline=void 0}fail(e){this.close(),this.onError(e)}},dh=8,fh=1048576,ph=class{constructor(e,t,n,r,i){this.runtime=e,this.transport=t,this.sendFrames=n,this.onError=r,this.onAuxiliaryTrace=i,this.receiveDeadline=new uh(t,e=>{this.close(),this.onError(e)}),this.removeWorkListener=e.onPeerTransportWork(this.handleRuntimeWork);try{this.transport.setAuxiliaryTraceEnabled?.(i!==void 0),this.transport.setOutboundScheduler?.(()=>this.scheduleOutboundDrain())}catch(e){this.closed=!0;try{this.removeWorkListener()}finally{try{this.transport.clearOutboundScheduler?.()}finally{this.transport.setAuxiliaryTraceEnabled?.(!1)}}throw e}this.watchAuxiliaryOutbound().catch(e=>{this.closed||this.onError(e)}),this.schedule(!0)}receiveDeadline;scheduled=!1;running=!1;runAgain=!1;closed=!1;outboundDrainScheduled=!1;syncPostAwaitingTimer=!1;inboundRouting=Promise.resolve();requestedGeneration=0;completedGeneration=0;flushWaiters=/* @__PURE__ */ new Set;removeWorkListener;handleRuntimeWork=e=>this.schedule(e??!1);receive(e){if(this.closed||e.length===0)return;let t=this.inboundRouting.then(()=>this.routeInboundFrames(e));this.inboundRouting=t.catch(e=>{this.closed||this.onError(e)})}schedule(e=!0){if(!this.closed){if(this.requestedGeneration+=1,this.running){this.runAgain||=e;return}this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,this.pump().catch(e=>{this.closed||this.onError(e)})}))}}close(){if(!this.closed){this.closed=!0,this.receiveDeadline.close(),this.removeWorkListener(),this.transport.clearOutboundScheduler?.(),this.transport.setAuxiliaryTraceEnabled?.(!1),this.runtime.retirePeerTransport(this.transport).catch(this.onError);for(let e of this.flushWaiters)e.resolve();this.flushWaiters.clear()}}async settleInbound(){this.closed||(await this.inboundRouting,await this.flush())}async flush(){if(this.closed)return;this.schedule();let e=this.requestedGeneration;this.completedGeneration>=e||await new Promise(t=>this.flushWaiters.add({target:e,resolve:t}))}drainOutboundFrames(){if(this.closed)return!1;let e=hh(this.transport.recvWireFrames());e.length>0&&this.sendFrames(e);let t=this.transport.recvAuxiliaryWireFrames;if(!t)return!1;let n=hh(t.call(this.transport,dh,fh));return n.length>0&&this.sendFrames(n),this.publishAuxiliaryTrace(),n.length>0}scheduleOutboundDrain(){if(!(this.closed||this.outboundDrainScheduled)){if(!this.syncPostAwaitingTimer){this.syncPostAwaitingTimer=!0,setTimeout(()=>{this.syncPostAwaitingTimer=!1},0);try{let e=hh(this.transport.recvWireFrames());e.length>0&&this.sendFrames(e);return}catch(e){queueMicrotask(()=>{this.closed||this.onError(e)});return}}this.outboundDrainScheduled=!0,queueMicrotask(()=>{this.outboundDrainScheduled=!1,this.closed||this.drainOutboundFrames()})}}async pump(){if(this.closed||this.running)return;this.running=!0;let e=this.requestedGeneration;try{if(this.drainOutboundFrames(),await this.runtime.progressPeerTransport(),this.closed)return;this.drainOutboundFrames()}finally{this.running=!1,this.completedGeneration=Math.max(this.completedGeneration,e);for(let e of this.flushWaiters)e.target>this.completedGeneration||(this.flushWaiters.delete(e),e.resolve())}this.closed||this.runAgain&&(this.runAgain=!1,this.schedule())}async routeInboundFrames(e){if(this.closed)return;let t=[];for(let n of e){let e=this.transport.routeAuxiliaryWireFrame?await this.transport.routeAuxiliaryWireFrame(n):n;if(this.receiveDeadline.refresh(),this.closed)return;e!=null&&t.push(gh(e))}if(!this.closed){if(t.length>0){if(this.transport.sendWireFrames)this.transport.sendWireFrames(t);else for(let e of t)this.transport.sendWireFrame(e)}this.runtime.notifyPeerTransportActivity?.(),this.publishAuxiliaryTrace(),this.schedule()}}publishAuxiliaryTrace(){if(!this.onAuxiliaryTrace)return;let e=this.transport.takeAuxiliaryTrace?.();!e||e.length===0||this.onAuxiliaryTrace(e)}async watchAuxiliaryOutbound(){for(;!this.closed;){let e=this.transport.auxiliaryOutboundReady?.();if(!e||typeof e==`boolean`||(await e,this.closed))return;this.drainOutboundFrames()&&await _h()}}};function mh(e){return e.map(e=>e.slice())}function hh(e){return e.map(gh)}function gh(e){if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error(`Browser worker transport received a non-binary wire frame`)}function _h(){return new Promise(e=>setTimeout(e,0))}var vh=`this account's store is open under another sign-in in another tab`,yh=`this account's store is open with another build's schema in another tab`,bh=`this account's store is open with a newer build of this app in another tab`,xh=5e3,Sh=32,Ch=65536,wh=128,Th=64,Eh=128,Dh=256,Oh=8192,kh=16384,Ah=2048;function J(e){let t={remaining:Ch},n=jh(e,t),r=e,i=n,a=/* @__PURE__ */ new WeakSet;for(let e=0;e<Sh;e+=1){if(r&&typeof r==`object`){if(a.has(r))break;a.add(r)}let n=Ih(r,`cause`);if(n===void 0)break;if(!Mh(n)){let e=Bh(n,t);e!==void 0&&(i.cause=e);break}if(e+1>Sh||t.remaining===0||a.has(n))break;let o=jh(n,t);i.cause=o,i=o,r=n}return n}function jh(e,t){let n=Lh(e,`stack`),r=Nh(Ih(e,`code`)),i={name:zh(Lh(e,`name`)??`Error`,Dh,t),message:zh(Lh(e,`message`)??Rh(e),Oh,t),...n===void 0?{}:{stack:zh(n,kh,t)}};if(r!==void 0&&r.length<=t.remaining&&(i.code=zh(r,wh,t)),i.code===qp){let n=Ph(Ih(e,`missing`)),r=Ph(Ih(e,`unknown`));n!==void 0&&r!==void 0&&Fh(n)+Fh(r)<=t.remaining&&(t.remaining-=Fh(n)+Fh(r),i.missing=[...n],i.unknown=[...r])}return i}function Mh(e){return typeof e==`object`&&!!e&&typeof Ih(e,`message`)==`string`}function Nh(e){return typeof e==`string`&&e.length>0&&e.length<=wh?e:void 0}function Ph(e){return Array.isArray(e)&&e.length<=Th&&e.every(e=>typeof e==`string`&&e.length>0&&e.length<=Eh)?e:void 0}function Fh(e){return e.reduce((e,t)=>e+t.length,0)}function Ih(e,t){if(!(e===null||typeof e!=`object`&&typeof e!=`function`))try{return e[t]}catch{return}}function Lh(e,t){let n=Ih(e,t);return typeof n==`string`?n:void 0}function Rh(e){try{return String(e)}catch{return`Unstringifiable relay error`}}function zh(e,t,n){let r=Math.min(e.length,t,n.remaining);return n.remaining-=r,e.slice(0,r)}function Bh(e,t){if(e===null||typeof e==`boolean`||typeof e==`number`)return e;if(typeof e==`string`)return zh(e,Ah,t);if(e!==void 0)return zh(`[non-error relay cause omitted]`,Ah,t)}var Vh=-(1n<<63n),Hh=(1n<<63n)-1n;function Uh(e,t){if(typeof e==`number`&&!Number.isSafeInteger(e))throw Error(`${t} must be a safe integer when passed as a number, got ${e}`);let n=BigInt(e);if(n<Vh||n>Hh)throw Error(`${t} must be a signed 64-bit integer`);return n}var Wh=new Bl({fatal:!0});function Gh(e){if(e.kind!==`hidden-metadata`)return e.kind===`stored-column`?e.outputName:e.name}function Kh(e){return{table:e.string(),descriptor:Jh(e),rows:e.readVec(e=>({rowId:e.bytes(),deleted:e.bool(),raw:e.bytes()}))}}function qh(e,t){e.vec((e,n)=>{let r=t[n];e.u64(r.kind===`stored-column`?0:r.kind===`result-field`?1:2),r.kind===`stored-column`?(e.u64(r.id),e.string(r.outputName)):e.string(r.name),ig(e,r.valueType)},t.length)}function Jh(e){return e.readVec(e=>{let t=e.u64();return t===0?{kind:`stored-column`,id:e.u64(),outputName:e.string(),valueType:ag(e)}:t===1?{kind:`result-field`,name:e.string(),valueType:ag(e)}:t===2?{kind:`hidden-metadata`,name:e.string(),valueType:ag(e)}:Yh(t)})}function Yh(e){throw Error(`unknown native row descriptor field kind ${e}`)}function Xh(e){let t={added:e.readVec(Kh),updated:e.readVec(Kh),removed:e.readVec(tg),addedOccurrenceKeys:e.readVec(e=>Zh(e)),updatedOccurrenceKeys:e.readVec(e=>Zh(e)),removedOccurrenceKeys:e.readVec(e=>Zh(e)),addedIndices:e.readVec(e=>e.u64()),updatedPreviousIndices:e.readVec(e=>e.u64()),updatedIndices:e.readVec(e=>e.u64()),removedIndices:e.readVec(e=>e.u64()),updatedSplices:e.readVec(e=>e.readVec(e=>({column:e.string(),splices:e.readVec(e=>({at:e.u64(),delete:e.u64(),insert:e.bytes(),atUtf16:e.u64(),deleteUtf16:e.u64()}))})))},n=e=>e.reduce((e,t)=>e+t.rows.length,0);if(t.addedOccurrenceKeys.length!==n(t.added)||t.updatedOccurrenceKeys.length!==n(t.updated)||t.removedOccurrenceKeys.length!==t.removed.length||t.addedIndices.length!==n(t.added)||t.updatedPreviousIndices.length!==n(t.updated)||t.updatedIndices.length!==n(t.updated)||t.removedIndices.length!==t.removed.length||t.updatedSplices.length!==n(t.updated))throw Error(`subscription occurrence sidecar length mismatch`);return eg(e,`subscription delta`),t}function Zh(e){let t=e.bytes();if(t[0]!==2||!Qh(t.subarray(1)))throw Error(`malformed ResultKey`);return t}function Qh(e){let t=t=>(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0;if(e.length<25)return!1;let n=16,r=t(n);if(n+=4,r>256||n+r*16+4>e.length)return!1;n+=r*16;let i=t(n);if(n+=4,i>r+1)return!1;let a=-1;for(let o=0;o<i;o++){if(n+8>e.length)return!1;let i=t(n),o=t(n+4);if(n+=8,i>r||i<=a||o===0||o>4096||n+o>e.length||!Gl(e.subarray(n,n+o)))return!1;a=i,n+=o}for(let t=0;t<=r;t++){let t=e[n++];if(t===1)n+=24;else if(t!==0)return!1}return n===e.length}function $h(e){let t=e.u64(),n=e.readVec(Kh);return eg(e,`relation snapshot`),{rootCount:t,rows:n}}function eg(e,t){if(!e.done())throw Error(`${t} has trailing postcard bytes`)}function tg(e){return{table:e.string(),rowId:e.bytes()}}function ng(e,t){e.vec((e,n)=>{e.some(e=>e.string(t[n].name??``)),ig(e,t[n].valueType)},t.length)}function rg(e){return e.readVec(e=>({name:e.option(e=>e.string()),valueType:ag(e)}))}function ig(e,t){if(e.enumUnit(t.tag),t.tag===10){if(!t.internal)throw Error(`missing physical type for ValueType::Internal`);if(e.enumUnit(t.internal.tag),t.internal.tag===2){if(t.internal.kind==null)throw Error(`missing stored-scalar kind`);e.enumUnit(t.internal.kind)}}else if(t.tag===12){let n=t.enumSchema,r=n?.variants;if(!n||!r)throw Error(`missing enum schema for ValueType::Enum`);e.u64(n.registryId??0),e.string(n.name),e.vec((e,t)=>e.string(r[t]),r.length)}else if(t.tag===13){let n=t.members??(t.inner?[t.inner]:[]);e.vec((e,t)=>ig(e,n[t]),n.length)}else if(t.tag===14||t.tag===15){if(!t.inner)throw Error(`missing inner value type for tag ${t.tag}`);ig(e,t.inner)}else if(t.tag===16){if(!t.record)throw Error(`missing inline record descriptor for tag 16`);ng(e,t.record)}else if(t.tag===17){let n=t.enumSchema,r=n?.cases;if(!n||!r)throw Error(`missing cases for ValueType::Enum`);e.u64(n.registryId??0),e.string(n.name),e.vec((e,t)=>{let n=r[t];e.string(n.name),ng(e,n.payload)},r.length)}}function ag(e){let t=e.u64();if(t===10){let n=e.u64();return{tag:t,internal:{tag:n,kind:n===2?e.u64():void 0}}}if(t===12)return{tag:t,enumSchema:{registryId:e.u64(),name:e.string(),variants:e.readVec(e=>e.string())}};if(t===14||t===15)return{tag:t,inner:ag(e)};if(t===13){let n=e.readVec(ag);return{tag:t,members:n,inner:n[0]}}return t===16?{tag:t,record:rg(e)}:t===17?{tag:t,enumSchema:{registryId:e.u64(),name:e.string(),cases:e.readVec(e=>({name:e.string(),payload:rg(e)}))}}:{tag:t}}function og(e,t){let n=Hg(e),r=n.fixed.map(e=>t[e.logicalIndex]),i=n.variable.map(e=>t[e.logicalIndex]),a=Ul(r),o=new Kg,s=a.length+Math.max(0,i.length-1)*4;for(let e of i.slice(0,-1))s+=e.length,o.u32Le(s);return Ul([a,o.finish(),...i])}function sg(e,t){let n=gg(Sg(e));return e.map((e,r)=>{let i=n(t,r);return i==null?{type:`Null`}:Pg(e.column_type,i)})}function cg(e,t){return Object.defineProperty(e,"valuesByColumn",{value:t,enumerable:!1,configurable:!0}),e}function lg(e,t){let n=/* @__PURE__ */ new Map;for(let r=0;r<e.length;r++){let i=e[r];i&&n.set(i.name,t[r])}return n}var ug={name:`__jazz_terminal_row_key`,column_type:{type:`Uuid`},nullable:!1};function dg(e,t,n){let r=fg([ug,...t],n),i=r[0];if(i?.type!==`Uuid`||i.value!==e)throw Error(`terminal record key ${i?.type===`Uuid`?i.value:`<non-uuid>`} does not match addressed key ${e}`);let a=r.slice(1);return cg({id:e,values:a},lg(t,a))}function fg(e,t){let n=gg(Sg(e));return e.map((e,r)=>{let i=n(t,r);return i==null?{type:`Null`}:pg(e.column_type,i,e.name)})}function pg(e,t,n){switch(e.type){case`Timestamp`:return{type:`Timestamp`,value:zg(t,n)};case`Array`:return{type:`Array`,value:mg(e.element,t)};case`Row`:if(t.byteLength<16)throw Error(`terminal nested row is missing its physical key`);return{type:`Row`,value:dg(Bg(t.subarray(0,16)),e.columns,t)};default:return Pg(e,t)}}function mg(e,t){return Rg(e,t,t=>pg(e,t))}function hg(e,t){return og(Sg(e),e.map((e,n)=>Cg(e,t[n])))}function gg(e){let t=Hg(e);return(n,r)=>_g(e,t,n,r)}function _g(e,t,n,r){let i=t.fields[r];if(!i)throw Error(`field is not present`);let a=e[r].valueType;if(i.kind===`fixed`){if(i.offset+i.size>n.length)throw Error(`unexpected end of record`);return vg(n.subarray(i.offset,i.offset+i.size),a)}let o=t.fixedSize,s=t.fixedSize+Math.max(0,t.variable.length-1)*4,c=i.variableIndex===0?s:Ug(n,o+(i.variableIndex-1)*4),l=i.variableIndex===t.variable.length-1?n.length:Ug(n,o+i.variableIndex*4);if(c>l||l>n.length){let t=e[r],i=l-c,o=Math.max(0,n.length-c);throw Error(`invalid offset for ${t?.name??`<field ${r}>`}: declared type ${yg(a)}, tag ${a.tag}, claimed width ${i}, remaining buffer ${o}, current offset ${c}, end offset ${l}, record length ${n.length}`)}return vg(n.subarray(c,l),a)}function vg(e,t){if(t.tag!==15)return e;let n=xg(e);return n==null?null:t.inner?vg(n,t.inner):n}function yg(e){return e.tag===14||e.tag===15?`${e.tag===14?`Array`:`Nullable`}<${e.inner?yg(e.inner):`?`}>`:bg(e.tag)}function bg(e){switch(e){case 0:return`U8`;case 1:return`U16`;case 2:return`U32`;case 3:return`U64`;case 4:return`I32`;case 5:return`I64`;case 6:return`F64`;case 7:return`Bool`;case 8:return`String`;case 9:return`Bytes`;case 10:return`Internal`;case 11:return`Uuid`;case 12:return`EnumTag`;case 13:return`Tuple`;case 14:return`Array`;case 15:return`Nullable`;case 16:return`Record`;case 17:return`Enum`;default:return`unknown(${e})`}}function xg(e){return e[0]===0?null:e[0]===1?e.subarray(1):e}function Sg(e){return e.map(e=>({name:e.name,valueType:jg(e)}))}function Cg(e,t){let n=Ng(e.column_type),r=e.nullable?{tag:15,inner:n}:n;if(!t){if(e.sparse)return Tg({tag:15,inner:r});if(!e.nullable)throw Error(`missing non-nullable value for ${e.name}`);return Tg(r)}if(t.type===`Null`){if(!e.nullable)throw Error(`missing non-nullable value for ${e.name}`);let t=Tg(r);return e.sparse?wg(t,r):t}let i=Eg(e.column_type,t);return e.nullable&&(i=wg(i,n)),e.sparse?wg(i,r):i}function wg(e,t){if(Vg(t)==null)return Ul([Uint8Array.of(1),e]);let n=new Uint8Array(1+e.length);return n[0]=1,n.set(e,1),n}function Tg(e){let t=Vg(e);return t==null?Uint8Array.of(0):new Uint8Array(t)}function Eg(e,t){switch(e.type){case`Boolean`:if(t.type!==`Boolean`)throw Error(`expected Boolean value`);return Uint8Array.of(+!!t.value);case`Integer`:{let e=Wg(t),n=/* @__PURE__ */ new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),n}case`Timestamp`:{if(t.type!==`Timestamp`||!Number.isSafeInteger(t.value))throw Error(`expected ${e.type} value`);if(t.value<0)throw Error(`Timestamp value must be a non-negative safe integer (dates before 1970 are not supported), got ${t.value}`);let n=/* @__PURE__ */ new Uint8Array(8);return new DataView(n.buffer).setBigUint64(0,BigInt(t.value),!0),n}case`BigInt`:{let e=Gg(t),n=/* @__PURE__ */ new Uint8Array(8);return new DataView(n.buffer).setBigInt64(0,e,!0),n}case`Double`:{if(t.type!==`Double`)throw Error(`expected Double value`);let e=/* @__PURE__ */ new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,t.value,!0),e}case`Text`:case`Json`:case`Enum`:if(t.type!==`Text`)throw Error(`expected ${e.type} value`);return Ul([Uint8Array.of(0),new TextEncoder().encode(t.value)]);case`Uuid`:if(t.type!==`Uuid`)throw Error(`expected Uuid value`);return Ag(t.value);case`Bytea`:if(t.type!==`Bytea`)throw Error(`expected Bytea value`);return Ul([Uint8Array.of(0),t.value]);case`Array`:if(t.type!==`Array`)throw Error(`expected Array value`);return Og(e.element,t.value);case`Row`:if(t.type!==`Row`)throw Error(`expected Row value`);return Dg(e.columns,t.value)}}function Dg(e,t){let n=hg(e,t.valuesByColumn?e.map(e=>t.valuesByColumn?.get(e.name)??(e.column_type.type===`Array`?{type:`Array`,value:[]}:{type:`Null`})):t.values),r=t.id?Ag(t.id):/* @__PURE__ */ new Uint8Array;return Ul([Uint8Array.of(+!!t.id),r,kg(n.byteLength),n])}function Og(e,t){let n=t.map(t=>Eg(e,t));if(Vg(Ng(e))!=null)return Ul(n);let r=new Uint8Array(Math.max(0,t.length-1)*4),i=new DataView(r.buffer),a=4+r.byteLength;return n.slice(0,-1).forEach((e,t)=>{a+=e.length,i.setUint32(t*4,a,!0)}),Ul([kg(t.length),r,...n])}function kg(e){let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),t}function Ag(e){let t=ju(e);if(!t)throw Error(`invalid UUID value ${e}`);return t}function jg(e){let t=Ng(e.column_type);return e.nullable&&(t={tag:15,inner:t}),e.sparse?{tag:15,inner:t}:t}function Mg(e){return e.map(e=>({...e,sparse:void 0,column_type:e.column_type.type===`Row`?{...e.column_type,columns:[...Mg(e.column_type.columns)]}:e.column_type.type===`Array`&&e.column_type.element.type===`Row`?{...e.column_type,element:{...e.column_type.element,columns:[...Mg(e.column_type.element.columns)]}}:e.column_type}))}function Ng(e){switch(e.type){case`Boolean`:return{tag:7};case`Integer`:return{tag:4};case`BigInt`:return{tag:5};case`Timestamp`:return{tag:3};case`Double`:return{tag:6};case`Text`:case`Json`:case`Enum`:return{tag:8};case`Bytea`:return{tag:9};case`Uuid`:return{tag:11};case`Array`:return{tag:14,inner:Ng(e.element)};case`Row`:return{tag:9}}}function Pg(e,t){let n=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(e.type){case`Boolean`:return{type:`Boolean`,value:t[0]!==0};case`Integer`:return{type:`Integer`,value:n.getInt32(0,!0)};case`BigInt`:return{type:`BigInt`,value:n.getBigInt64(0,!0)};case`Double`:return{type:`Double`,value:n.getFloat64(0,!0)};case`Timestamp`:return{type:`Timestamp`,value:Number(n.getBigUint64(0,!0))};case`Text`:case`Json`:case`Enum`:return{type:`Text`,value:Wh.decode(Fg(t))};case`Uuid`:return{type:`Uuid`,value:Bg(t)};case`Bytea`:return{type:`Bytea`,value:Fg(t).slice()};case`Array`:return{type:`Array`,value:Lg(e.element,t)};case`Row`:return{type:`Row`,value:Ig(e.columns,t)}}}function Fg(e){if(e[0]!==0)throw Error(`indirect scalar crossed a logical binding boundary`);return e.subarray(1)}function Ig(e,t){if(t.byteLength<5)throw Error(`invalid nested row value`);let n=t[0]===1,r=1,i;n&&(i=Bg(t.subarray(r,r+16)),r+=16);let a=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(r,!0);r+=4;let o=t.subarray(r,r+a);if(o.byteLength!==a)throw Error(`invalid nested row value length`);let s=sg(e,o);return cg({id:i,values:s},lg(e,s))}function Lg(e,t){return Rg(e,t,t=>Pg(e,t))}function Rg(e,t,n){let r=Vg(Ng(e));if(r!=null){if(r===0)return[];if(t.length%r!==0)throw Error(`invalid fixed-width array byte length ${t.length}`);let e=[];for(let i=0;i<t.length;i+=r)e.push(n(t.subarray(i,i+r)));return e}if(t.length<4)throw Error(`invalid variable-width array byte length`);let i=Ug(t,0),a=4+Math.max(0,i-1)*4;if(a>t.length)throw Error(`invalid variable-width array offset table`);let o=[];for(let e=0;e<i;e+=1){let r=e===0?a:Ug(t,4+(e-1)*4),s=e===i-1?t.length:Ug(t,4+e*4);if(r>s||s>t.length)throw Error(`invalid variable-width array element offset`);o.push(n(t.subarray(r,s)))}return o}function zg(e,t){let n=new DataView(e.buffer,e.byteOffset,e.byteLength).getBigUint64(0,!0);return Number(n)}function Bg(e){if(e.length>=16)return Ou(e,0);let t=Du(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Vg(e){switch(e.tag){case 0:case 7:case 12:return 1;case 1:return 2;case 2:case 4:return 4;case 3:case 5:case 6:return 8;case 11:return 16;case 13:return(e.members??(e.inner?[e.inner]:[])).reduce((e,t)=>{if(e==null)return;let n=Vg(t);return n==null?void 0:e+n},0);case 10:case 14:return;case 15:{let t=e.inner?Vg(e.inner):void 0;return t==null?void 0:t+1}default:return}}function Hg(e){let t=[];t.length=e.length;let n=[],r=[],i=0;for(let r=0;r<e.length;r+=1){let a=Vg(e[r].valueType);if(a==null)continue;let o={kind:`fixed`,logicalIndex:r,offset:i,size:a};t[r]=o,n.push(o),i+=a}for(let n=0;n<e.length;n+=1){if(Vg(e[n].valueType)!=null)continue;let i={kind:`variable`,logicalIndex:n,variableIndex:r.length};t[n]=i,r.push(i)}return{fields:t,fixed:n,variable:r,fixedSize:i}}function Ug(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Wg(e){if(e.type!==`Integer`||!Number.isSafeInteger(e.value)||e.value<-2147483648||e.value>2147483647)throw Error(`Integer value must be a signed 32-bit integer`);return e.value}function Gg(e){if(e.type!==`BigInt`)throw Error(`expected BigInt value`);return Uh(e.value,`BigInt value`)}var Kg=class{#e=[];u32Le(e){if(!Number.isInteger(e)||e<0||e>4294967295)throw Error(`offset must be an unsigned 32-bit integer, got ${e}`);this.#e.push(e&255,e>>>8&255,e>>>16&255,e>>>24&255)}finish(){return new Uint8Array(this.#e)}},qg=class{constructor(e){this.text=e}};function Jg(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){if(++t>=e.length||e.charCodeAt(t)<56320||e.charCodeAt(t)>57343)throw Error(`invalid relation query: unpaired surrogate`)}else if(n>=56320&&n<=57343)throw Error(`invalid relation query: unpaired surrogate`)}}function Yg(e){let t=JSON.parse(e),n=(e,t)=>typeof e==`string`?(Jg(e),e.includes(t)):Array.isArray(e)?e.some(e=>n(e,t)):e&&typeof e==`object`?Object.entries(e).some(([e,r])=>(Jg(e),e.includes(t)||n(r,t))):!1,r=`__jrq_raw_number_`;for(;e.includes(r)||n(t,r);)r=`_${r}`;let i=[],a=``,o=!1,s=!1;for(let t=0;t<e.length;t++){let n=e[t];if(o)a+=n,s?s=!1:n===`\\`?s=!0:n===`"`&&(o=!1);else if(n===`"`)o=!0,a+=n;else{if(n===`-`||n>=`0`&&n<=`9`){let n=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(e.slice(t));if(n){i.push(n[0]),a+=JSON.stringify(`${r}${i.length-1}__`),t+=n[0].length-1;continue}}a+=n}}let c=e=>{if(typeof e==`string`){let t=RegExp(`^${r}(\\d+)__$`).exec(e);return t?new qg(i[Number(t[1])]):e}return Array.isArray(e)?e.map(c):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,c(t)])):e};return c(JSON.parse(a))}function Xg(e){let t=[],n=0,r=0,i=new TextEncoder,a=e=>{throw Error(`invalid relation Postcard: ${e}`)},o=(...e)=>{e.some(e=>!Number.isInteger(e)||e<0||e>255)&&a(`byte`),t.length>1048576-e.length&&a(`byte limit`),t.push(...e)},s=e=>{(!Number.isSafeInteger(e)||e<0||e>4096)&&a(`collection`),u(e)},c=()=>{++r>4096&&a(`node limit`)},l=e=>{++n>128&&a(`depth limit`);try{e()}finally{n--}},u=e=>{let t=typeof e==`bigint`?e:BigInt(e);(t<0n||t>18446744073709551615n)&&a(`integer range`);do{let e=Number(t&127n);t>>=7n,t&&(e|=128),o(e)}while(t)},d=e=>u(e<0n?(-e<<1n)-1n:e<<1n),f=e=>{typeof e!=`string`&&a(`string`),Jg(e);let t=i.encode(e);t.length>65536&&a(`string limit`),u(t.length),o(...t)},p=(e,t)=>{e==null?o(0):(o(1),t())},m=(e,t,n)=>{let r=Object.keys(e);r.length===1&&t.includes(r[0])||a(n)},h=(e,t,n)=>{Object.keys(e).some(e=>!t.includes(e))&&a(n)},g=e=>{e instanceof qg&&(/^(?:0|[1-9]\d*)$/.test(e.text)||a(`dimension`),e=Number(e.text));let t=typeof e==`number`?e:a(`dimension`);(!Number.isSafeInteger(t)||t<0||t>4294967295)&&a(`dimension`),u(t)},_=e=>{e&&typeof e==`object`||a(`column`),h(e,[`scope`,`column`],`column`),(typeof e.column!=`string`||e.scope!==void 0&&typeof e.scope!=`string`)&&a(`column`),p(e.scope,()=>f(e.scope)),f(e.column)},ee=e=>u(e===`Current`?0:e===`Outer`?1:e===`Frontier`?2:a(`row id`)),v=e=>{if(c(),e instanceof qg){if(/^(?:0|[1-9]\d*|-[1-9]\d*)$/.test(e.text)){let t=BigInt(e.text);if(t>=-9223372036854775808n&&t<=9223372036854775807n){u(2),d(t);return}if(t>=0n&&t<=18446744073709551615n){u(3),u(t);return}}let t=Number(e.text);Number.isFinite(t)||a(`number`),u(4);let n=/* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));n.setFloat64(0,t,!0),u(n.getBigUint64(0,!0));return}if(e===null){u(0);return}if(typeof e==`boolean`){u(1),o(+!!e);return}if(typeof e==`number`){if(Number.isFinite(e)||a(`number`),Number.isInteger(e)&&!Object.is(e,-0)){let t=JSON.stringify(e);if(/^(?:0|[1-9]\d*|-[1-9]\d*)$/.test(t)){let e=BigInt(t);if(e>=-9223372036854775808n&&e<=9223372036854775807n){u(2),d(e);return}if(e>=0n&&e<=18446744073709551615n){u(3),u(e);return}}}u(4);let t=/* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));t.setFloat64(0,e,!0),u(t.getBigUint64(0,!0));return}if(typeof e==`string`){u(5),f(e);return}if(Array.isArray(e)){u(6),s(e.length),e.forEach(e=>l(()=>v(e)));return}e&&typeof e==`object`||a(`literal`),u(7);let t=Object.entries(e).sort(([e],[t])=>{let n=i.encode(e),r=i.encode(t);for(let e=0;e<Math.min(n.length,r.length);e++)if(n[e]!==r[e])return n[e]-r[e];return n.length-r.length});s(t.length);for(let[e,n]of t)f(e),l(()=>v(n))},y=e=>{c(),m(e,[`Column`,`RowId`],`key`),`Column`in e?(u(0),_(e.Column)):(u(1),ee(e.RowId))},te=e=>{c(),m(e,[`Column`,`RowId`],`project`),`Column`in e?(u(0),_(e.Column)):(u(1),ee(e.RowId))},ne=e=>{c(),m(e,[`Literal`,`Param`,`SessionRef`,`OuterColumn`,`FrontierColumn`,`RowId`],`value`),`Literal`in e?(u(0),v(e.Literal)):`Param`in e?(u(1),f(e.Param)):`SessionRef`in e?(u(2),s(e.SessionRef.length),e.SessionRef.forEach(f)):`OuterColumn`in e?(u(3),_(e.OuterColumn)):`FrontierColumn`in e?(u(4),_(e.FrontierColumn)):(u(5),ee(e.RowId))},re=e=>{if(c(),e===`True`)u(9);else if(e===`False`)u(10);else if(m(e,[`Cmp`,`IsNull`,`IsNotNull`,`In`,`Contains`,`And`,`Or`,`Not`,`StartsWith`,`EndsWith`],`predicate`),`Cmp`in e){u(0),_(e.Cmp.left);let t=[`Eq`,`Ne`,`Lt`,`Le`,`Gt`,`Ge`].indexOf(e.Cmp.op);t<0&&a(`comparison operator`),u(t),l(()=>ne(e.Cmp.right))}else if(`IsNull`in e)u(1),_(e.IsNull.column);else if(`IsNotNull`in e)u(2),_(e.IsNotNull.column);else if(`In`in e)u(3),_(e.In.left),s(e.In.values.length),e.In.values.forEach(e=>l(()=>ne(e)));else if(`Contains`in e)u(4),_(e.Contains.left),l(()=>ne(e.Contains.right));else if(`StartsWith`in e||`EndsWith`in e){let t=`StartsWith`in e?e.StartsWith:e.EndsWith;u(`StartsWith`in e?11:12),_(t.left),l(()=>ne(t.right))}else`And`in e?(u(6),s(e.And.length),e.And.forEach(e=>l(()=>re(e)))):`Or`in e?(u(7),s(e.Or.length),e.Or.forEach(e=>l(()=>re(e)))):(u(8),l(()=>re(e.Not)))},b=e=>{c(),m(e,[`TableScan`,`Filter`,`Union`,`Join`,`Project`,`Gather`,`Distinct`,`OrderBy`,`Offset`,`Limit`],`expression`),`TableScan`in e?(h(e.TableScan,[`table`,`alias`],`table scan`),u(0),f(e.TableScan.table),p(e.TableScan.alias,()=>f(e.TableScan.alias))):`Filter`in e?(u(1),l(()=>b(e.Filter.input)),l(()=>re(e.Filter.predicate))):`Union`in e?(u(2),s(e.Union.inputs.length),e.Union.inputs.forEach(e=>{f(e.label),l(()=>b(e.input))})):`Join`in e?(h(e.Join,[`left`,`right`,`on`,`join_kind`],`join`),u(3),l(()=>b(e.Join.left)),l(()=>b(e.Join.right)),s(e.Join.on.length),e.Join.on.forEach(e=>{c(),_(e.left),_(e.right)}),e.Join.join_kind!==`Inner`&&e.Join.join_kind!==`Left`&&a(`join kind`),u(e.Join.join_kind===`Inner`?0:1)):`Project`in e?(u(4),l(()=>b(e.Project.input)),s(e.Project.columns.length),e.Project.columns.forEach(e=>{f(e.alias),te(e.expr)})):`Gather`in e?(u(5),l(()=>b(e.Gather.seed)),l(()=>b(e.Gather.step)),y(e.Gather.frontier_key),e.Gather.bound===`Fixpoint`?u(0):(u(1),g(e.Gather.bound.MaxDepth)),s(e.Gather.dedupe_key.length),e.Gather.dedupe_key.forEach(y)):`Distinct`in e?(u(6),l(()=>b(e.Distinct.input)),s(e.Distinct.key.length),e.Distinct.key.forEach(y)):`OrderBy`in e?(u(7),l(()=>b(e.OrderBy.input)),s(e.OrderBy.terms.length),e.OrderBy.terms.forEach(e=>{c(),h(e,[`column`,`direction`],`order term`),_(e.column),e.direction!==`Asc`&&e.direction!==`Desc`&&a(`order direction`),u(e.direction===`Asc`?0:1)})):`Offset`in e?(u(8),l(()=>b(e.Offset.input)),g(e.Offset.offset)):(u(9),l(()=>b(e.Limit.input)),g(e.Limit.limit))};return b(e),Uint8Array.from(t)}var Zg=new Bl({fatal:!0}),Qg=new TextEncoder().encode(`["https://jazz.invalid","self-signed-open"]`);function $g(e,t){return t?Qg:e}function e_(e,t,n,r=!1,i,a,o,s){let c=new h_;return c.bytes(e),c.string(t_($g(t,a))),n==null?c.none():c.some(e=>e.u64(n)),c.bool(r),i==null?c.none():c.some(e=>e.u64(i)),o==null?c.none():c.some(e=>e.bytes(__(o))),s==null?c.none():c.some(e=>e.bytes(s)),c.finish()}function t_(e){try{let t=Zg.decode(e);if($l(t))return t}catch{}throw Error(`native open config author must be a canonical UTF-8 author identity`)}function n_(e,t,n={}){let{limit:r,offset:i=0,orderBy:a=[],select:o,arraySubqueries:s=[],relation:c,partial:l=[]}=typeof n==`number`?{limit:n}:n;r!=null&&a_(`query limit`,r),a_(`query offset`,i);let u=new h_;return u.string(e),u.vec((e,n)=>{let r=t[n];s_(e,r)},t.length),u.vec(()=>{},0),u.none(),u.vec(()=>{},0),u.vec(()=>{},0),u.vec(()=>{},0),u.vec(()=>{},0),u.vec((e,t)=>{i_(e,s[t])},s.length),o==null?u.none():u.some(e=>{e.vec((e,t)=>{e.string(o[t])},o.length)}),u.vec((e,t)=>{let n=a[t];e.string(n.column),e.u64(n.direction===`Asc`?0:1)},a.length),u.none(),r==null?u.none():u.some(e=>e.u64(r)),u.u64(i),c==null?u.none():u.some(e=>e.bytes(Xg(c),!1)),r_(u,l),u.finish()}function r_(e,t){e.vec((e,n)=>{let r=t[n];e.string(r.column),r.kind===`json_pointer`?(e.u64(3),e.string(r.at)):(a_(`partial selection ${r.column} start`,r.from),a_(`partial selection ${r.column} end`,r.to),e.u64(r.kind===`bytes`?0:r.kind===`text_utf16`?1:2),e.u64(r.from),e.u64(r.to))},t.length)}function i_(e,t){let{filters:n=[],select:r,orderBy:i=[],limit:a=null,offset:o=0,requirement:s=`Optional`,nestedArrays:c=[]}=t;a!=null&&a_(`array subquery ${t.columnName} limit`,a),a_(`array subquery ${t.columnName} offset`,o),e.string(t.columnName),e.string(t.table),e.string(t.innerColumn),e.string(t.outerColumn),e.vec((e,t)=>{s_(e,n[t])},n.length),r==null?e.none():e.some(e=>{e.vec((e,t)=>{e.string(r[t])},r.length)}),e.vec((e,t)=>{let n=i[t];e.string(n.column),e.u64(n.direction===`Asc`?0:1)},i.length),a==null?e.none():e.some(e=>e.u64(a)),e.u64(o),e.u64(o_(s)),e.vec((e,t)=>{i_(e,c[t])},c.length),r_(e,[])}function a_(e,t){if(!Number.isSafeInteger(t)||t<0)throw Error(`${e} must be a non-negative safe integer`)}function o_(e){switch(e){case`Optional`:return 0;case`AtLeastOne`:return 1;case`MatchCorrelationCardinality`:return 2}}function s_(e,t){if(t.op===`All`||t.op===`Any`)e.u64(t.op===`All`?0:1),e.vec((e,n)=>s_(e,t.predicates[n]),t.predicates.length);else if(t.op===`Not`)e.u64(2),s_(e,t.predicate);else if(t.op===`In`)e.u64(5),u_(e,t.column),e.vec((e,n)=>{e.u64(3),p_(e,t.values[n])},t.values.length);else if(t.op===`Contains`)e.u64(10),u_(e,t.column),d_(e,t.value);else if(t.op===`StartsWith`||t.op===`EndsWith`)e.u64(t.op===`StartsWith`?13:14),u_(e,t.column),d_(e,t.value);else if(t.op===`IsNull`||t.op===`IsNotNull`)t.op===`IsNotNull`&&e.u64(2),e.u64(12),u_(e,t.column);else if(c_(t))l_(e,t.column,t.op,t.value);else throw Error(`unsupported query predicate ${JSON.stringify(t)}`)}function c_(e){return e.op===`Eq`||e.op===`Ne`||e.op===`Gt`||e.op===`Gte`||e.op===`Lt`||e.op===`Lte`}function l_(e,t,n,r){e.u64(f_(n)),u_(e,t),d_(e,r)}function u_(e,t){e.u64(0),e.string(t)}function d_(e,t){e.u64(3),p_(e,t)}function f_(e){switch(e){case`Eq`:return 3;case`Ne`:return 4;case`Gt`:return 6;case`Gte`:return 7;case`Lt`:return 8;case`Lte`:return 9}}function p_(e,t){if(t.type===`U64`){if(t.value<0n||t.value>(1n<<64n)-1n)throw Error(`U64 value must be an unsigned 64-bit integer`);e.u64(3),e.u64(t.value)}else if(t.type===`Nullable`)e.u64(13),t.value==null?e.none():e.some(e=>p_(e,t.value));else if(t.type===`Boolean`)e.u64(5),e.bool(t.value);else if(t.type===`Integer`){if(!Number.isSafeInteger(t.value)||t.value<-2147483648||t.value>2147483647)throw Error(`Integer value must be a signed 32-bit integer`);e.u64(15),e.i64(t.value)}else if(t.type===`BigInt`){if(t.value<-(1n<<63n)||t.value>(1n<<63n)-1n)throw Error(`BigInt value must be a signed 64-bit integer`);e.u64(14),e.i64(t.value)}else if(t.type===`Timestamp`){if(!Number.isSafeInteger(t.value)||t.value<0)throw Error(`${t.type} value must be a non-negative safe integer`);e.u64(3),e.u64(t.value)}else if(t.type===`Double`){if(!Number.isFinite(t.value))throw Error(`Double value must be finite`);e.u64(4),e.f64Le(t.value)}else if(t.type===`Uuid`){e.u64(9);let n=ju(t.value);if(!n)throw Error(`invalid uuid ${t.value}`);e.bytes(n)}else t.type===`Bytea`?(e.u64(7),e.bytes(t.value)):t.type===`Array`?(e.u64(12),e.vec((e,n)=>p_(e,t.value[n]),t.value.length)):(e.u64(6),e.string(t.value))}var m_=64,h_=class{chunks=[];parts=[];partsBytes=0;finish(){if(this.parts.length===0)return Uint8Array.from(this.chunks);this.flushChunks();let e=new Uint8Array(this.partsBytes),t=0;for(let n of this.parts)e.set(n,t),t+=n.byteLength;return e}flushChunks(){this.chunks.length!==0&&(this.pushPart(Uint8Array.from(this.chunks)),this.chunks=[])}pushPart(e){this.parts.push(e),this.partsBytes+=e.byteLength}u64(e){if(typeof e==`bigint`){if(e<0n||e>18446744073709551615n)throw Error(`u64 out of range: ${e}`);this.u64Big(e);return}if(!Number.isSafeInteger(e)||e<0)throw Error(`u64 must be a non-negative safe integer, got ${e}`);let t=e;do{let e=t&127;t=Math.floor(t/128),t!==0&&(e|=128),this.chunks.push(e)}while(t!==0)}i64(e){let t=Uh(e,`i64`),n=t<0n?(-t<<1n)-1n:t<<1n;this.u64Big(n)}u64Big(e){let t=e;do{let e=Number(t&127n);t>>=7n,t!==0n&&(e|=128),this.chunks.push(e)}while(t!==0n)}u32Le(e){if(!Number.isInteger(e)||e<0||e>4294967295)throw Error(`u32Le must be an unsigned 32-bit integer, got ${e}`);this.chunks.push(e&255,e>>>8&255,e>>>16&255,e>>>24&255)}f64Le(e){let t=/* @__PURE__ */ new Uint8Array(8);new DataView(t.buffer).setFloat64(0,e,!0),this.bytes(t,!1)}bool(e){this.chunks.push(+!!e)}string(e){this.bytes(v_(e))}bytes(e,t=!0){if(t&&this.u64(e.length),e.length<m_)for(let t of e)this.chunks.push(t);else this.flushChunks(),this.pushPart(new Uint8Array(e))}vec(e,t){this.u64(t);for(let n=0;n<t;n+=1)e(this,n)}map(e){this.u64(e)}set(e){this.u64(e)}none(){this.chunks.push(0)}some(e){this.chunks.push(1),e(this)}enumUnit(e){this.u64(e)}},g_=class{constructor(e){this.bytesValue=e}offset=0;u64(){let e=this.readCanonicalU64();if(e>BigInt(2**53-1))throw Error(`postcard u64 exceeds Number.MAX_SAFE_INTEGER: ${e}`);return Number(e)}u64BigInt(){return this.readCanonicalU64()}i64(){let e=this.readCanonicalU64();return(e&1n)==0n?e>>1n:-(e+1n>>1n)}readCanonicalU64(){let e=0n;for(let t=0;t<10;t+=1){let n=this.readByte(),r=BigInt(n&127);if(t===9&&r>1n)throw Error(`postcard u64 overflow`);if(e|=r<<BigInt(t*7),!(n&128)){if(t!==0&&e<1n<<BigInt(t*7))throw Error(`postcard u64 is not minimally encoded`);return e}}throw Error(`postcard u64 overflow`)}string(){return Zg.decode(this.bytes())}bool(){let e=this.readByte();if(e===0)return!1;if(e===1)return!0;throw Error(`invalid bool tag ${e}`)}f64Le(){let e=this.bytesOfLength(8);return new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(0,!0)}bytes(e=!0){let t=e?this.u64():16;return this.bytesOfLength(t)}bytesAtMost(e,t){let n=this.u64();if(n>e)throw Error(`${t} exceeds maximum length of ${e} bytes`);return this.bytesOfLength(n)}bytesOfLength(e){let t=this.offset+e;if(t>this.bytesValue.length)throw Error(`postcard bytes overflow`);let n=this.bytesValue.subarray(this.offset,t);return this.offset=t,n}option(e){let t=this.readByte();if(t!==0){if(t!==1)throw Error(`invalid option tag ${t}`);return e(this)}}readVec(e){let t=this.u64();return Array.from({length:t},()=>e(this))}done(){return this.offset===this.bytesValue.length}readByte(){if(this.offset>=this.bytesValue.length)throw Error(`postcard eof`);return this.bytesValue[this.offset++]}};function __(e){return v_(JSON.stringify(e,Kl))}function v_(e){return new TextEncoder().encode(e)}async function*y_(e){let t=e;if(typeof t.getReader!=`function`){let t=e[Symbol.asyncIterator](),n=!1;try{for(;;){let e=await t.next();if(e.done){n=!0;return}yield e.value}}finally{if(!n)try{Promise.resolve(t.return?.()).catch(()=>{})}catch{}}}let n=t.getReader(),r=!1;try{for(;;){let e=await n.read();if(e.done){r=!0;return}yield e.value}}finally{if(!r)try{Promise.resolve(n.cancel()).catch(()=>{})}catch{}n.releaseLock()}}var b_=`history.`;function x_(e){return S_(e)!==void 0}function S_(e){return e.startsWith(b_)?e.slice(b_.length):void 0}var C_=[{name:`$transactionId`,column_type:{type:`Text`},nullable:!1},{name:`$acceptedAt`,column_type:{type:`Timestamp`},nullable:!1}],w_=/* @__PURE__ */ new WeakMap;function T_(e,t){let n=S_(t);if(n===void 0)return e[t];if(x_(n)||!Object.hasOwn(e,n))return;let r=w_.get(e);r||w_.set(e,r=/* @__PURE__ */ new Map);let i=r.get(t);if(!i){let a=e[n];i={columns:[...a.columns,...C_],...a.branchBy?{branchBy:a.branchBy}:{}},r.set(t,i)}return i}var E_=`authority_changed`,D_=class extends Error{name=`AuthorityChangedError`;code=E_;constructor(e,t){super(e,t)}};function O_(e){return!e||typeof e!=`object`?!1:e.code===E_}function k_(e){if(e==null)return null;let t=typeof e==`object`&&typeof e.message==`string`?e.message:String(e);if(O_(e))return new D_(t,{cause:e});if(e instanceof Error)return e;let n=Error(t),r=typeof e==`object`?e.code:void 0;return typeof r==`string`&&Object.assign(n,{code:r}),n}var A_=`core_tick_failed`,j_=class extends Error{name=`CoreTickFailedError`;code=A_;constructor(e){super(`core tick failed: ${N_(e)}`,{cause:e})}};function M_(e){return!e||typeof e!=`object`?!1:e.code===A_}function N_(e){if(e instanceof Error)return e.message;if(e&&typeof e==`object`){let t=e.message;if(typeof t==`string`)return t}return String(e)}function P_(e){if(e.startsWith(`$`))return e;let t=e.indexOf(`.$`);return t>=0?e.slice(t+1):e.split(`.`).at(-1)??e}function F_(){return{type:`Row`,columns:[{name:`account`,column_type:{type:`Uuid`},nullable:!1},{name:`identity`,nullable:!1,column_type:{type:`Row`,columns:[{name:`issuer`,column_type:{type:`Text`},nullable:!1},{name:`subject`,column_type:{type:`Text`},nullable:!1}]}}]}}var I_=[`$canRead`],L_=[`$createdBy`,`$createdAt`,`$updatedBy`,`$updatedAt`,`$createdBy.account`,`$createdBy.identity`,`$createdBy.identity.issuer`,`$createdBy.identity.subject`,`$updatedBy.account`,`$updatedBy.identity`,`$updatedBy.identity.issuer`,`$updatedBy.identity.subject`];function R_(e){return I_.includes(e)}function z_(e){return L_.includes(e)}function B_(e){if(e===`$createdBy`||e===`$updatedBy`||e===`$deletedBy`)return F_();if(e===`$createdAt`||e===`$updatedAt`||e===`$deletedAt`)return{type:`Timestamp`};let[t,...n]=e.split(`.`);if((t===`$createdBy`||t===`$updatedBy`||t===`$deletedBy`)&&n.length){let e=F_();for(let t of n){if(e.type!==`Row`)return;let n=e.columns.find(e=>e.name===t);if(!n)return;e=n.column_type}return e}}var V_=`__jazz_include_`;function H_(e,t,n,r){let i=n.filter(e=>!e.name.startsWith(V_)),a=/* @__PURE__ */ new Map;for(let e of i)a.set(e.name,r[e.name]??e.default??{type:`Null`});return Object.defineProperty({table:e,id:t,values:i.filter(e=>!z_(e.name)).map(e=>a.get(e.name))},"valuesByColumn",{value:a,configurable:!0})}function U_(e,t){if(typeof e!=`number`||!Number.isSafeInteger(e)||e<1)throw Error(`${t} must be a whole number of rows, at least 1: a subscription's backlog cannot be unbounded.`)}var W_=Object.freeze({pending:0,oldestPendingAt:null,rejected:0,lastRejection:null,pendingRevision:0});function G_(e,t){if(e.state!==`offline`||e.reason===`disconnected`)return null;let n={network:`The server is unreachable; retrying.`,auth:`The server refused this client's credential.`,stopped:`The link stopped for good; only db.reconnect() tries again.`,"authority-changed":`The server serves another history than this client's local store.`,"held-by-another-tab":`Another tab holds this account's local store, under another sign-in or with another build of the app.`}[e.reason];return{kind:e.reason,message:t||n,at:Date.now()}}var K_=Object.freeze({state:`local-only`}),q_=Object.freeze({state:`connecting`}),J_=Object.freeze({state:`connected`});function Y_(e,t=e===`network`){return{state:`offline`,reason:e,retrying:t}}function X_(e){switch(e?.phase??`noServer`){case`noServer`:return K_;case`offline`:return Y_(`disconnected`);case`live`:return J_;case`connecting`:case`backoff`:return e.outagePublished?Y_(`network`):q_;case`awaitingCredential`:return Y_(`auth`);case`stopped`:return Y_(`stopped`)}}function Z_(e,t){return e.state===t.state?e.state!==`offline`||t.state!==`offline`||e.reason===t.reason&&e.retrying===t.retrying&&e.authReason===t.authReason:!1}function Q_(e,t){return e.pending===t.pending&&e.oldestPendingAt===t.oldestPendingAt&&e.rejected===t.rejected&&(e.pendingRevision??0)===(t.pendingRevision??0)&&e.lastRejection?.at===t.lastRejection?.at&&e.lastRejection?.code===t.lastRejection?.code}var $_=class{constructor(e,t=Object.is){this.read=e,this.same=t}listeners=/* @__PURE__ */ new Set;published;scheduled=!1;subscribe(e,t){t.aborted||(this.listeners.size===0&&(this.published=this.read()),this.listeners.add(e),t.addEventListener(`abort`,()=>this.listeners.delete(e),{once:!0}))}get hasListeners(){return this.listeners.size>0}changed(){this.scheduled||this.listeners.size===0||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1;let e=this.read();if(!(this.published!==void 0&&this.same(e,this.published))){this.published=e;for(let t of[...this.listeners])t(e)}}))}},ev=class extends $_{},tv=`system`;fu({issuer:iu,user_id:tv,claims:{},authMode:`external`});var nv=new TextEncoder;function rv(e){return nv.encode(Jl(e))}function iv(e){let t=new h_;return t.string(e.table),qh(t,[...e.descriptor]),Du(t.finish())}function av(e){if(!e||typeof e!=`object`)return;let t=e.code;return typeof t==`string`?t:void 0}var ov=/* @__PURE__ */ new Set([`schema`,`query`,`write_rejected`,`transaction_conflict`,`storage`,`protocol`,`backpressure`,`not_observed`,`historical_read_requires_server`,`unsupported_storage_codecs`,`authority_changed`,`store_opened_without_migrations`]);function sv(e){let t=av(e);return t!==void 0&&ov.has(t)?t:void 0}var cv=/* @__PURE__ */ new Set([`authorization_denied`,`client_clock_too_far_ahead`,`serialization_conflict`,`row_already_deleted`,`row_already_exists`,`row_not_deleted`,`missing_required`,`branch_move`,`missing_chunks`,`predecessor_rejected`,`schema_version_not_deployed`,`identity_mismatch`,`schema_version_unsupported`]);function lv(e){if(!e||typeof e!=`object`)return;let t=e.reason;return typeof t==`string`&&cv.has(t)?t:void 0}var uv=36e5,dv=500,fv=`jazz-http-stream-endpoints`,pv=`endpoints`;function mv(){return globalThis.indexedDB!==void 0}function hv(){let e=globalThis.indexedDB;if(e)return new Promise((t,n)=>{let r=e.open(fv,1);r.onupgradeneeded=()=>r.result.createObjectStore(pv),r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error),r.onblocked=()=>n(/* @__PURE__ */ Error(`blocked`))})}async function gv(e,t){let n=hv();if(!n)return;let r=await n;try{return await new Promise((n,i)=>{let a=t(r.transaction(pv,e).objectStore(pv));a.onsuccess=()=>n(a.result),a.onerror=()=>i(a.error)})}finally{r.close()}}var _v=`jazz-stream-endpoint:`,vv=6e5;function yv(){if(typeof document<`u`)try{return globalThis.localStorage??void 0}catch{return}}function bv(e,t=Date.now()){let n=yv();if(n)try{let r=n.getItem(_v+e);if(r===null)return;let[i,a]=r.split(`:`);if(i!==`stream`&&i!==`none`||!(Number(a)>t)){n.removeItem(_v+e);return}return i===`stream`}catch{return}}function xv(e,t,n){let r=yv();if(r)try{r.setItem(_v+e,`${t}:${n}`)}catch{try{r.removeItem(_v+e)}catch{}}}async function Sv(e,t=Date.now()){let n,r=await Promise.race([gv(`readonly`,t=>t.get(e)).then(e=>({until:e}),()=>{}),new Promise(e=>{n=setTimeout(()=>e(void 0),dv)})]).finally(()=>clearTimeout(n));if(!r)return!1;let i=typeof r.until==`number`&&r.until>t;return i?xv(e,`stream`,r.until):xv(e,`none`,t+vv),i}function Cv(e,t=Date.now()){return xv(e,`stream`,t+uv),gv(`readwrite`,n=>n.put(t+uv,e)).then(()=>{},()=>{})}function wv(e){return xv(e,`none`,Date.now()+vv),gv(`readwrite`,t=>t.delete(e)).then(()=>{},()=>{})}var Tv=0,Ev=`x-jazz-stream-key`,Dv=1,Ov=2;function kv(e,t){let n=new Uint8Array(5+t.byteLength);return n[0]=e,new DataView(n.buffer).setUint32(1,t.byteLength,!1),n.set(t,5),n}function Av(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n}var jv=class{buffered=/* @__PURE__ */ new Uint8Array;push(e){this.buffered=this.buffered.byteLength?Av([this.buffered,e]):e;let t=[],n=0;for(;this.buffered.byteLength-n>=5;){let e=new DataView(this.buffered.buffer,this.buffered.byteOffset+n).getUint32(1,!1);if(this.buffered.byteLength-n<5+e)break;t.push({kind:this.buffered[n],payload:this.buffered.slice(n+5,n+5+e)}),n+=5+e}return this.buffered=this.buffered.slice(n),t}get pending(){return this.buffered.byteLength}},Mv=new TextEncoder,Nv=new TextDecoder;function Pv(e){let t=new URL(e);return t.protocol===`ws:`&&(t.protocol=`http:`),t.protocol===`wss:`&&(t.protocol=`https:`),t.pathname=t.pathname.replace(/\/ws\/?$/,`/stream`),t.toString()}var Fv=class{listeners=/* @__PURE__ */ new Map;addEventListener(e,t){let n=this.listeners.get(e)??[];n.push(t),this.listeners.set(e,n)}emit(e,t){for(let n of this.listeners.get(e)??[])n(t)}},Iv=4194304,Lv=(e,t)=>fetch(e,t),Rv=class extends Fv{constructor(e,t=Lv){super(),this.request=t,this.streamUrl=Pv(e),this.run()}binaryType=`arraybuffer`;readyState=0;streamUrl;abort=new AbortController;session;queued=[];sending=!1;send(e){if(this.readyState!==1)throw Error(`HTTP stream session is not open`);let t=typeof e==`string`?Mv.encode(e):e;this.queued.push(kv(Dv,t)),this.flush()}close(){if(this.readyState>=2)return;let e=this.session;if(!e)return this.finish(1e3,`client closed`);this.finish(1e3,`client closed`,!1),this.request(`${this.streamUrl}/${encodeURIComponent(e.id)}`,{method:`DELETE`,credentials:`same-origin`,headers:{[Ev]:e.key},signal:AbortSignal.timeout?.(Hv)}).catch(()=>{}).finally(()=>this.abort.abort())}async run(){try{let e=await this.request(this.streamUrl,{method:`POST`,credentials:`same-origin`,signal:this.abort.signal});if(!e.ok||!e.body)throw Error(`HTTP stream refused (${e.status})`);let t=e.body.getReader(),n=new jv;for(;;){let{done:e,value:r}=await t.read();if(e)break;for(let e of n.push(r)){if(this.readyState>=2)return;this.receive(e.kind,e.payload)}}this.fail(1006,`HTTP stream ended`)}catch(e){if(this.readyState>=2)return;this.emit(`error`,e),this.fail(1006,e instanceof Error?e.message:String(e))}}receive(e,t){if(e===Tv)this.session=JSON.parse(Nv.decode(t)),this.readyState=1,this.emit(`open`);else if(e===Dv){let e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);this.emit(`message`,{data:e})}else if(e===Ov){let{code:e,reason:n}=JSON.parse(Nv.decode(t));this.finish(e,n)}}async flush(){if(!this.sending&&this.session){this.sending=!0;try{for(;this.queued.length>0&&this.readyState===1;){let e=0,t=0;for(;e<this.queued.length&&(e===0||t+this.queued[e].byteLength<=Iv);)t+=this.queued[e].byteLength,e+=1;let n=Av(this.queued.splice(0,e)),r=await this.request(`${this.streamUrl}/${encodeURIComponent(this.session.id)}`,{method:`POST`,credentials:`same-origin`,headers:{"Content-Type":`application/octet-stream`,[Ev]:this.session.key},body:n,signal:this.abort.signal});if(!r.ok)throw Error(`HTTP stream send refused (${r.status})`)}}catch(e){if(this.readyState>=2)return;this.emit(`error`,e),this.close()}finally{this.sending=!1}}}fail(e,t){this.finish(e,t)}finish(e,t,n=!0){this.readyState>=2||(this.readyState=3,this.queued.length=0,n&&this.abort.abort(),this.emit(`close`,{code:e,reason:t}))}},zv=/* @__PURE__ */ new Set,Bv=/* @__PURE__ */ new Map,Vv=3,Hv=1e4,Uv=2,Wv=/* @__PURE__ */ new Map,Gv=`x-jazz-stream`,Kv=/* @__PURE__ */ new Set,qv=`x-jazz-store-error`,Jv=/* @__PURE__ */ new Set;async function Yv(e,t){try{let n=await t(e.replace(/^ws/,`http`),{method:`POST`,credentials:`same-origin`,signal:AbortSignal.timeout?.(Hv)});if(n.status===503&&n.headers.get(qv)===`1`){let t=await n.text().catch(()=>``);return t&&!Jv.has(`${e}
|
|
4
4
|
${t}`)&&(Jv.add(`${e}
|
|
5
5
|
${t}`),console.error(`jazz: the backend at ${e} can't serve: ${t}`)),`other`}return n.body?.cancel().catch(()=>{}),n.status===403?`refused`:n.status===426?n.headers.get(Gv)===`1`?`stream`:`upgrades`:`other`}catch{return`silent`}}async function Xv(e,t,n){let r=await Yv(e,n);if(r===`stream`)return r;if(r!==`upgrades`)return Bv.delete(e),Wv.delete(e),r===`refused`&&!Kv.has(e)&&(Kv.add(e),console.warn(`jazz: the backend at ${e} refuses this page's origin (403). If a proxy rewrites the Host header, set the backend's publicUrl or allowedOrigins.`)),r;let i=(Bv.get(e)??0)+1;Bv.set(e,i);let a=t?(Wv.get(e)??0)+1:0;t?Wv.set(e,a):Wv.delete(e);let o=a>=Uv;return i<Vv&&!o?r:(Bv.delete(e),Wv.delete(e),o?(console.warn(`jazz: ${a} WebSockets in a row to ${e} got no answer in ${Hv/1e3} s, although the backend answers and upgrades them: something in between (a proxy or dev server) doesn't pass WebSocket upgrades on. Syncing over the HTTP stream instead, for as long as this client runs.`),`stream-in-between`):(console.warn(`jazz: ${i} WebSockets in a row to ${e} failed, although the backend answers and upgrades them: something in between (a proxy or dev server) doesn't pass WebSocket upgrades on. Syncing over the HTTP stream instead, for as long as this client runs.`),`stream-in-between`))}function Zv(e,t={}){let n=t.fetch??Lv,r=t.describeFailedUpgrade;return class extends Fv{constructor(e){if(super(),this.url=e,zv.has(e)){this.openStream();return}if(!mv()){this.inner=this.openNative();return}let t=bv(e);t===!0?(zv.add(e),this.openStream()):t===!1?this.inner=this.openNative():Sv(e).then(t=>{this.closedEarly||(t?(zv.add(e),this.openStream()):this.inner=this.openNative())})}binaryType=`arraybuffer`;inner;closedEarly=!1;closedByClient=!1;settled=!1;probing=!1;openDeadline;abort=new AbortController;get readyState(){return this.inner?this.probing?0:this.inner.readyState:this.closedEarly?3:0}send(e){if(!this.inner)throw Error(`WebSocket is not open`);this.inner.send(e)}close(){if(this.closedByClient=!0,this.settled=!0,this.probing=!1,clearTimeout(this.openDeadline),this.abort.abort(),this.inner)return this.inner.close();this.closedEarly||(this.closedEarly=!0,queueMicrotask(()=>this.emit(`close`,{code:1e3,reason:``})))}openStream(){let e=new Rv(this.url,n),t=!1;e.addEventListener(`open`,()=>{t=!0}),e.addEventListener(`close`,()=>{!t&&!this.closedByClient&&(zv.delete(this.url),wv(this.url))}),this.inner=e,this.forward(e)}openNative(){let t=new e(this.url);t.binaryType=`arraybuffer`;let i=!1,a,o=(e,t,i=!1)=>{if(clearTimeout(this.openDeadline),!this.settled){if(a){a[e]??=t;return}a={[e]:t},this.probing=!0,Xv(this.url,i,n).then(async e=>{let t=e===`stream`||e===`stream-in-between`,n=i||e!==`upgrades`&&e!==`other`||this.settled?void 0:await r?.(this.url,this.abort.signal).catch(()=>{});if(this.probing=!1,!this.settled){if(this.settled=!0,t){zv.add(this.url),e===`stream`&&Cv(this.url),this.openStream();return}if(n){this.emit(`error`,Error(n)),this.emit(`close`,{code:1006,reason:n});return}a?.error!==void 0&&this.emit(`error`,a.error),this.emit(`close`,a?.close??{code:1006,reason:``})}})}};return this.openDeadline=setTimeout(()=>{o(`close`,{code:1006,reason:`the WebSocket upgrade got no answer`},!0),t.close()},Hv),t.addEventListener(`open`,()=>{a||(clearTimeout(this.openDeadline),i=!0,Bv.delete(this.url),Wv.delete(this.url),this.settled=!0,this.emit(`open`))}),t.addEventListener(`message`,e=>{a||this.emit(`message`,e)}),t.addEventListener(`error`,e=>{i?this.emit(`error`,e):o(`error`,e)}),t.addEventListener(`close`,e=>{i?this.emit(`close`,e):o(`close`,e)}),t}forward(e){e.addEventListener(`open`,()=>this.emit(`open`)),e.addEventListener(`message`,e=>this.emit(`message`,e)),e.addEventListener(`error`,e=>this.emit(`error`,e)),e.addEventListener(`close`,e=>this.emit(`close`,e))}}}var Qv=`jazz_renewal`,$v=`X-Jazz-Renew`,ey=64,ty=65,ny=2048;function ry(e){let t=new g_(e);if(t.u64()!==ey)throw Error(`not a renew-soon frame`);let n=t.string(),r=t.u64();if(!t.done()||!n||n.length>ny)throw Error(`malformed renew-soon frame`);return{session:n,renewInMs:r}}function iy(e){let t=new h_;return t.u64(ty),t.string(e),t.finish()}function ay(e){return e[0]===ey}function oy(e){try{let t=new URL(e);return/\/ws\/?$/.test(t.pathname)?(t.protocol=t.protocol===`wss:`?`https:`:t.protocol===`ws:`?`http:`:t.protocol,t.pathname=t.pathname.replace(/\/ws\/?$/,`/accounts/backend-user`),t.search=``,t.hash=``,t.toString()):null}catch{return null}}function sy(e){try{return`jazz-session-refresh:${new URL(e.replace(/^ws/,`http`)).origin}`}catch{return`jazz-session-refresh:${e}`}}var cy=class extends Error{wireError;constructor(e){super(`websocket ${e.code} before server hello: ${e.message}`),this.name=`PreHelloWireError`,this.wireError=e}};function ly(e){return e.retry===`later`&&(e.code===`not_ready`||e.code===`backpressure`)}function uy(e){return e.retry===`later`&&(e.code===`websocket_closed`||e.code===`websocket_error`||e.code===`websocket_silent`)}function dy(e){return e.code===`protocol_error`||(e.code===`websocket_closed`||e.code===`websocket_error`||e.code===`websocket_silent`)&&!uy(e)}var fy=6,py=fy,my=fy,hy=16,gy=128,_y=256,vy=2048,yy=12e4,by=16384,xy=1e4,Sy=1e3,Cy=7,wy=hy|gy|_y|12288,Ty=1<<20,Ey=5,Dy=5,Oy=2097152,ky=4096;function Ay(e){My(e);let t=new h_;t.vec((t,n)=>t.bytes(e[n]),e.length);let n=t.finish();if(n.byteLength>Oy)throw Error(`websocket frame batch exceeds maximum length of ${Oy} bytes`);return n}function jy(e){if(e.byteLength>Oy)throw Error(`websocket frame batch exceeds maximum length of ${Oy} bytes`);let t=new g_(e),n=t.u64();if(n===0||n>ky)throw Error(`websocket frame batch exceeds frame-count limit of ${ky}`);let r=[];for(let e=0;e<n;e+=1)r.push(t.bytesAtMost(Oy,`websocket frame`));return Gy(t,`websocket frame batch`),r}function My(e){if(e.length===0||e.length>ky)throw Error(`websocket frame batch exceeds frame-count limit of ${ky}`);for(let t of e)if(t.byteLength>Oy)throw Error(`websocket frame exceeds maximum length of ${Oy} bytes`)}function Ny(e=wy){Hy(e,`client wire features`);let t=new h_;return t.u64(0),t.u64(py),t.u64(my),t.u64(e),t.u64(0),t.none(),t.finish()}var Py=0,Fy=1;function Iy(e){if(e[0]!==Py)return!1;let t=new g_(e);t.u64();let{min:n,max:r}=Uy(t);return n===fy&&r===fy&&Wy(t),!0}function Ly(e){return e[0]===Fy&&(Ry(e),!0)}function Ry(e){let t=new g_(e),n=t.u64();if(n!==Fy)throw Error(`expected WireFrame::Error, got tag ${n}`);let r={code:ub(t.u64()),retry:fb(t.u64()),message:t.string()};return t.done()||(r.reason=db(t.u64())),Gy(t,`WireFrame::Error`),r}function zy(e){return e.code===`auth_failed`?e.reason===`reauthenticate`?`invalid`:Eu(e.reason!==void 0&&!e.reason.startsWith(`unknown:`)?e.reason:e.message):null}var By=class{url;socket;onFrame;onError;onTerminal;localFeatures;opened;resolveNegotiation;rejectNegotiation;negotiated=!1;helloSent=!1;ahead=[];closing=!1;terminated=!1;lastInbound=performance.now();handlingMessages=0;afterMessages=[];silenceTimer;handshakeTimer;renewalUrl;renewalTimer;constructor(e){this.url=e.endpointUrl;let t=e.WebSocket??Iu(this.url)??sb(this.url);this.onFrame=e.onFrame,this.onError=e.onError,this.onTerminal=e.onTerminal,this.localFeatures=(e.features??wy)|vy|by,this.renewalUrl=Jy(e.authJson)?oy(this.url):null,Hy(this.localFeatures,`client wire features`),this.socket=new t(this.url),this.socket.binaryType=`arraybuffer`,this.watchHandshake(e.handshakeTimeoutMs??xy),this.opened=new Promise((e,t)=>{this.resolveNegotiation=e,this.rejectNegotiation=t}),pb(this.socket).then(()=>{if(!this.closing){this.socket.send(qy(e.authJson??`{}`,e.peerIdentity,e.requestedLink,this.renewalUrl!==null)),this.socket.send(Ay([Ny(this.localFeatures)])),this.helloSent=!0;for(let e of this.ahead.splice(0))this.write(e)}},e=>{this.reportTerminal({code:`websocket_error`,retry:`later`,message:e instanceof Error?e.message:String(e)}),this.close()});let n=e=>{this.handlingMessages===0?e():this.afterMessages.push(e)};this.socket.addEventListener(`message`,e=>{this.lastInbound=performance.now(),this.handlingMessages+=1,this.handleMessage(e.data).catch(e=>{this.reportTerminal({code:`protocol_error`,retry:`never`,message:e instanceof Error?e.message:String(e)},void 0,!1),this.close()}).finally(()=>{if(--this.handlingMessages,!(this.handlingMessages>0))for(let e of this.afterMessages.splice(0))e()})}),this.socket.addEventListener(`error`,e=>n(()=>this.reportTerminal({code:`websocket_error`,retry:`later`,message:e instanceof Error?e.message:`websocket transport error`}))),this.socket.addEventListener(`close`,e=>{let t=Ky(e);n(()=>this.reportTerminal({code:`websocket_closed`,retry:`later`,message:`websocket closed (code=${t.code??`unknown`}, reason=${t.reason??`none`})`}))})}async send(e){await this.sendBatch([e])}async sendBatch(e){await this.ready(),this.write(e)}sendAhead(e){this.closing||this.terminated||(this.helloSent?this.write(e):this.ahead.push(e))}write(e){let t=[],n=Dy;for(let r of e){let e=r.byteLength+Ey;t.length>0&&(t.length>=ky||n+e>Ty)&&(this.socket.send(Ay(t)),t=[],n=Dy),t.push(r),n+=e}t.length>0&&this.socket.send(Ay(t))}ready(){return this.opened}get hasNegotiated(){return this.negotiated}close(){if(!this.closing){this.closing=!0,this.ahead=[],clearTimeout(this.silenceTimer),clearTimeout(this.handshakeTimer),clearTimeout(this.renewalTimer),this.reportTerminal({code:`websocket_closed`,retry:`never`,message:`websocket closed before server hello`},/* @__PURE__ */ Error(`websocket closed before server hello`),!1,!1);try{this.socket.close()}catch{}}}reportTerminal(e,t=Error(e.message),n=!0,r=!0){this.terminated||(this.terminated=!0,clearTimeout(this.silenceTimer),clearTimeout(this.handshakeTimer),clearTimeout(this.renewalTimer),this.rejectNegotiation(t),n&&this.onError?.(e),r&&this.onTerminal?.(e))}watchHandshake(e){this.handshakeTimer=setTimeout(()=>{this.handshakeTimer=setTimeout(()=>{this.negotiated||this.terminated||(this.reportTerminal({code:`websocket_silent`,retry:`later`,message:`the server did not answer the connection within ${Math.round(e/1e3)} s`}),this.close())},Sy)},e)}scheduleRenewal({session:e,renewInMs:t}){clearTimeout(this.renewalTimer);let n=this.renewalUrl;n&&(this.renewalTimer=setTimeout(()=>{this.renewalTimer=void 0,!(this.closing||this.terminated)&&Xy(n,e).then(e=>{if(!(!e||this.closing||this.terminated))return this.send(iy(e))}).catch(()=>{})},Math.min(t,2**31-1)))}watchSilence(e=!1){if(clearTimeout(this.silenceTimer),this.closing||this.terminated)return;let t=performance.now()-this.lastInbound;t>=yy&&!e?this.silenceTimer=setTimeout(()=>this.watchSilence(!0),Sy):t>=yy?(this.reportTerminal({code:`websocket_silent`,retry:`later`,message:`the server sent nothing for ${Math.round(t/1e3)} s, not even a heartbeat`}),this.close()):this.silenceTimer=setTimeout(()=>this.watchSilence(),yy-t)}async handleMessage(e){for(let t of jy(await ob(e))){if(this.closing)return;if(Iy(t)){if(this.negotiated)continue;this.negotiated=!0,clearTimeout(this.handshakeTimer);let e=Vy(t,this.localFeatures);(e.features&vy)!==0&&this.watchSilence(),this.resolveNegotiation({...e,features:e.features&~vy&~by})}else if(!(this.negotiated&&t.byteLength===1&&t[0]===Cy)){if(this.negotiated&&this.renewalUrl&&ay(t)){this.scheduleRenewal(ry(t));continue}if(!this.negotiated){if(Ly(t)){let e=Ry(t);if(zy(e)){this.reportTerminal(e,/* @__PURE__ */ Error(`websocket authentication failed before server hello: ${e.message}`)),this.close();return}this.reportTerminal(e,new cy(e)),this.close();return}this.reportTerminal({code:`protocol_error`,retry:`never`,message:`websocket received semantic frame before server hello`},void 0,!1),this.close();return}if(Ly(t)){let e=Ry(t);if(ly(e)){this.reportTerminal(e),this.close();return}this.onError?.(e);continue}this.onFrame(t)}}}};function Vy(e,t=wy){let n=new g_(e);if(n.u64()!==0)throw Error(`expected WireFrame::Hello`);let{min:r,max:i}=Uy(n);if(r!==fy||i!==fy)throw Error(`server must advertise exactly wire protocol ${fy}, got ${r}..=${i}`);let{features:a,role:o,authority:s}=Wy(n),c=a&~BigInt(t);if(c!==0n)throw Error(`server accepted unsupported wire features 0x${c.toString(16)}`);if(o!==1)throw Error(`expected WirePeerRole::Core server hello`);return{protocolVersion:fy,features:Number(a),authority:s}}function Hy(e,t){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw Error(`${t} must be an unsigned 32-bit integer, got ${e}`)}function Uy(e){return{min:e.u64(),max:e.u64()}}function Wy(e){let t=e.u64BigInt(),n=e.u64(),r=e.option(e=>{let t=e.bytes();if(t.byteLength!==16)throw Error(`WireHello.authority.node must be exactly 16 bytes, got ${t.byteLength}`);return{node:t,epoch:e.u64BigInt()}});return Gy(e,`WireFrame::Hello`),{features:t,role:n,authority:r}}function Gy(e,t){if(!e.done())throw Error(`${t} has trailing postcard bytes`)}function Ky(e){if(!e||typeof e!=`object`)return{};let t=e;return{code:typeof t.code==`number`?t.code:void 0,reason:typeof t.reason==`string`?t.reason:void 0}}function qy(e,t,n,r=!1){let i=JSON.parse(e),a=new Bl().decode(t),o=mb(i)??ab(a)??a;return JSON.stringify({peer_identity:a,...i,auth:{...i,sub:o},sub:o,...n?{requested_link:n}:{},...r?{[Qv]:1}:{}})}function Jy(e){if(!e)return!1;try{let t=JSON.parse(e);return t.backend_session!=null&&t.jwt_token==null&&t.admin_secret==null&&t.backend_secret==null}catch{return!1}}var Yy=3e4;async function Xy(e,t){return Zy(sy(e),()=>Qy(e,t))}async function Zy(e,t){let n=globalThis.navigator?.locks;if(!n)return t();let r,i=()=>r??=t();try{await n.request(e,()=>{let e;return Promise.race([i().catch(()=>{}),new Promise(t=>{e=setTimeout(t,Yy)})]).finally(()=>clearTimeout(e))})}catch{}return i()}async function Qy(e,t){try{let n=await Fu(e)(e,{method:`POST`,credentials:`same-origin`,redirect:`error`,headers:{[$v]:t}});if(!n.ok)return null;let r=await n.json();return typeof r.renewal==`string`?r.renewal:null}catch{return null}}function $y(e){let t=JSON.parse(e);if(t.admin_secret)return{};if(typeof t.backend_secret==`string`){let e=t.backend_session,n=e&&typeof e==`object`?e.claims:void 0;return n&&typeof n==`object`&&!Array.isArray(n)?n:{}}if(typeof t.jwt_token!=`string`)return{};let n=Cu(t.jwt_token);if(!n)return{};if(n.iss===`urn:jazz:local-first`||n.iss===`urn:jazz:anonymous`){let{jazz_pub_key:e,...t}=n;return _u(t)}return _u(n)}function eb(e,t){let n=JSON.parse(e);if(typeof n.admin_secret==`string`||typeof n.backend_secret==`string`&&!nb(n))return new TextEncoder().encode(Ql(`urn:jazz:system`,`system`));let r=ib(n),i=null;try{i=$l(new Bl({fatal:!0}).decode(t))}catch{}if(i?.account_id&&r){let e=$l(r);if(e.issuer!==i.issuer||e.user_id!==i.user_id||e.account_id!==void 0&&e.account_id!==i.account_id)throw Error(`WebSocket credential must match the context account identity`);return t}return r?new TextEncoder().encode(r):t}function tb(e){let t=JSON.parse(e);return typeof t.backend_secret==`string`&&!t.admin_secret&&!nb(t)&&delete t.jwt_token,JSON.stringify(t)}function nb(e){let t=e.backend_session;return typeof t==`object`&&!!t&&!Array.isArray(t)&&typeof t.issuer==`string`&&typeof t.user_id==`string`&&Zl(t.issuer)&&Zl(t.user_id)}function rb(e){let t=JSON.parse(e);return typeof t.admin_secret==`string`||typeof t.backend_secret==`string`||ib(t)!==null}function ib(e){if(typeof e.admin_secret==`string`)return null;if(typeof e.backend_secret==`string`&&nb(e)){let t=e.backend_session;return Ql(t.issuer,t.user_id,t.account_id)}if(typeof e.jwt_token==`string`){let t=Cu(e.jwt_token),n=typeof t?.iss==`string`?t.iss:void 0,r=t?.sub;if(typeof n==`string`&&typeof r==`string`&&Zl(n)&&Zl(r))return Ql(n,r)}return null}function ab(e){return $l(e)?.user_id??null}async function ob(e){if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(typeof Blob<`u`&&e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw Error(`expected binary websocket message, got ${typeof e}`)}function sb(e){let t=lb();return cb(e)?Zv(t):t}function cb(e){let t=globalThis.location;if(!t?.host)return!1;try{return new URL(e).host===t.host}catch{return!1}}function lb(){let e=globalThis.WebSocket;if(!e)throw Error(`browser WebSocket is not available`);return e}function ub(e){switch(e){case 0:return`unsupported_protocol_version`;case 1:return`unsupported_feature`;case 2:return`malformed_frame`;case 3:return`auth_failed`;case 4:return`backpressure`;case 5:return`internal`;case 6:return`not_ready`;default:return`unknown:${e}`}}function db(e){switch(e){case 0:return`expired`;case 1:return`missing`;case 2:return`invalid`;case 3:return`disabled`;case 4:return`revoked`;case 5:return`reauthenticate`;default:return`unknown:${e}`}}function fb(e){switch(e){case 0:return`never`;case 1:return`after_auth`;case 2:return`after_resume`;case 3:return`later`;default:return`unknown:${e}`}}function pb(e){return e.readyState===1?Promise.resolve():new Promise((t,n)=>{let r=!1,i=e=>{r||(r=!0,e())};e.addEventListener(`open`,()=>i(t)),e.addEventListener(`error`,e=>i(()=>n(e))),e.addEventListener(`close`,()=>i(()=>n(/* @__PURE__ */ Error(`websocket closed before open`))))})}function mb(e){let t=e.sub;if(typeof t==`string`&&Zl(t))return t;let n=e.jwt_token;if(typeof n==`string`){let e=hb(n);if(e)return e}let r=e.backend_session;if(r&&typeof r==`object`){let e=r.user_id;if(typeof e==`string`&&Zl(e))return e}return null}function hb(e){let t=e.split(`.`);if(t.length<2)return null;try{let e=JSON.parse(gb(t[1]));return typeof e.sub==`string`&&Zl(e.sub)?e.sub:null}catch{return null}}function gb(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.padEnd(Math.ceil(t.length/4)*4,`=`);return typeof atob==`function`?atob(n):Buffer.from(n,`base64`).toString(`binary`)}var _b=20,vb=/^(?:0|[1-9][0-9]*|-[1-9][0-9]*)$/,yb=16,bb={none:`none`,connecting:`attempting`,connected:`live`,unavailable:`failed`},xb=250,Sb=4;function Cb(e){return typeof e?.poll==`function`}function wb(e){if(!e||e instanceof Uint8Array)throw Error(`Native runtime direct mutation did not return a write receipt`);return e}function Tb(e){let t=e;return typeof t?.poll==`function`&&typeof t.cancel==`function`}function Eb(e,t){return uy(e)?{kind:`network`,message:e.message}:dy(e)?{kind:`fatal`,message:e.message}:{kind:`wire`,...e,admitted:t}}function Db(e,t){return e?Promise.allSettled([e,t]).then(e=>{for(let t of e)if(t.status===`rejected`)throw t.reason}):t}function Ob(e){let t=e;return typeof t?.poll==`function`&&typeof t.cancel==`function`&&typeof t.setWake==`function`}var kb=new Bl({fatal:!0}),Ab=/* @__PURE__ */ new WeakMap;function jb(e,t,n,r,i,a=!1){try{return Mb(e,t,n,r,i,a)}catch(e){throw Xp(e)}}function Mb(e,t,n,r,i,a){if(i&&a)throw Error(`A native runtime cannot be both self-signed and backend-scoped`);if(a){if(!e.openPersistentAsBackend)throw Error(`Native runtime does not support explicit backend opens; rebuild the matching Jazz native artifact`);return e.openPersistentAsBackend(t,n,r)}if(i){if(!e.openPersistentWithSelfSignedProof)throw Error(`Native runtime does not support self-signed client opens; rebuild the matching Jazz native artifact`);return e.openPersistentWithSelfSignedProof(t,n,r,i.token,i.appId,i.claimedAuthor)}if(!e.openPersistent)throw Error(`Native runtime does not expose persistent storage`);return e.openPersistent(t,n,r)}function Nb(e,t,n,r,i=!1){if(r&&i)throw Error(`A native runtime cannot be both self-signed and backend-scoped`);if(i){if(!e.openMemoryAsBackend)throw Error(`Native runtime does not support explicit backend opens; rebuild the matching Jazz native artifact`);return e.openMemoryAsBackend(t,n)}if(!r)return e.openMemory(t,n);if(!e.openMemoryWithSelfSignedProof)throw Error(`Native runtime does not support self-signed client opens; rebuild the matching Jazz native artifact`);return e.openMemoryWithSelfSignedProof(t,n,r.token,r.appId,r.claimedAuthor)}function Pb(e){let t=e.indexOf(`. Plan: `);return t===-1?e:e.slice(0,t)}var Fb={open:0,quiesced:1,storageCleared:1,closing:2,closed:3},Ib=class e{constructor(e,t,n,r,i,a,o){if(this.schema=t,this.node=n,this.ownerRuntime=o?.owner?.ownerRuntime??this,this.readAuthorizationHost=o?.owner?.readAuthorizationHost??o?.readAuthorizationHost??`client-local`,this.transactionOwner=o?.owner?.transactionOwner??{pendingTxs:/* @__PURE__ */ new Map,completedTxs:/* @__PURE__ */ new Map,writes:/* @__PURE__ */ new Map},this.pendingTxs=this.transactionOwner.pendingTxs,this.completedTxs=this.transactionOwner.completedTxs,this.writes=this.transactionOwner.writes,this.schemaBytes=rv(t),this.trustedBackend=(o?.owner?.trustedBackend??o?.backendMode)===!0,this.selfSignedClientProof=o?.selfSignedClientProof,this.scopeIsolatedRelay=o?.scopeIsolatedRelay===!0,this.webSocket=o?.webSocket,this.configBytes=e_(n,r,void 0,a,o?.initialSyncFlushEvery,o?.selfSignedClientProof,o?.migrations,o?.systemNode),this.peerIdentity=r,this.migrations=o?.owner?.migrations??o?.migrations,this.schemaHash=Yl(t),o?.db)this.db=o.db;else if(o?.persistentPath){if(!e)throw Error(`Native runtime constructor required for persistent storage`);this.db=jb(e,o.persistentPath,this.schemaBytes,this.configBytes,o?.selfSignedClientProof,o?.backendMode)}else{if(!e)throw Error(`Native runtime constructor required for memory storage`);this.db=Nb(e,this.schemaBytes,this.configBytes,o?.selfSignedClientProof,o?.backendMode)}if(o?.owner)return;this.slowQueryApp=o?.slowQueryLog?.appId,this.slowQueryConsoleDetail=o?.slowQueryLog?.consoleDetail;let s=o?.slowQueryLog?.thresholdMs;if(s!==void 0){if(!Number.isFinite(s)||s<0)throw Error(`slowQueryThresholdMs must be a non-negative number of milliseconds`);this.db.setSlowQueryThresholdMs?.(s)}let c=o?.subscriptionBacklogRows;if(c!==void 0&&(U_(c,`subscriptionBacklogRows`),this.db.setSubscriptionBacklogRows?.(c)),typeof this.db.setTickScheduler!=`function`)throw Error(`Native runtime requires db.setTickScheduler`);this.db.setTickScheduler(((e,t)=>{let n=typeof e==`string`?e:t;(n===`immediate`||n===`deferred`||n===`after-current-turn`||typeof n==`string`&&n.startsWith(`after:`))&&this.scheduleCoreWake(n)})),this.db.onUpstreamFailure?.(e=>{if(this.noteNativeAuthRestored(),!e)return this.nativeAuthRefusalRenewable=!1,this.clearRemoteServerTransportError();let t=e.code?k_({code:e.code,message:e.reason}):Error(e.reason);this.handleServerTransportError(t,this.serverConnectionGeneration,e.retrying||this.nativeAuthRefusalRenewable)})}auxiliaryReceiveDeadlines=/* @__PURE__ */ new Map;pendingNativeAdmissionCancels=/* @__PURE__ */ new Set;pendingNativeReadCancels=/* @__PURE__ */ new Set;db;schemaBytes;configBytes;peerIdentity;upstreamPrincipal=null;selfSignedClientProof;scopeIsolatedRelay;schemaHash;trustedBackend;transactionOwner;pendingTxs;completedTxs;writes;pendingLocalSettlements=/* @__PURE__ */ new Set;localSettlementListeners=/* @__PURE__ */ new Set;pendingStreamingMutations=/* @__PURE__ */ new Set;streamingFinalization=Promise.resolve();ownerRuntime;slowQueryApp;slowQueryConsoleDetail;get preparationOwner(){return this.ownerRuntime}readAuthorizationHost;subscriptions=/* @__PURE__ */ new Map;subscriptionPool;pooledSubscriptions=/* @__PURE__ */ new Map;drainingSubscriptionPool=!1;subscriptionPoolDirty=!1;authFailureCallback=null;authRestoredCallback=null;mutationErrorCallback=null;serverTransportErrorCallback=null;deliveredMutationErrors=/* @__PURE__ */ new Set;serverTransport=null;peerUpstreamAttached=!1;nonDurableClient=!1;serverCarrier=null;webSocket;serverCarrierPromise=null;serverConnectionAttempt=null;serverReplacementRetirement=null;serverTransportError=null;serverTransportErrorWaiters=[];localStorageFailure=null;localStorageFailureWaiters=/* @__PURE__ */ new Set;serverTransportWorkEpoch=0;serverTransportWorkWaiters=[];serverEndpointUrl=null;serverAuthJson=null;link=null;linkStatus=null;linkInputs=[];linkStepping=!1;linkAttemptId=null;linkTimer=null;linkConnection=null;linkFailure=null;upstreamRefusal=null;linkCloseReason=`server transport replaced`;serverTransportErrorRetrying=!1;serverTransportErrorAwaitsAuth=!1;nativeAuthRefusalRenewable=!1;nativeAuthRefused=!1;nativeLinkEverConnected=!1;nativeLinkPoll=null;firstLoadWaitSeen=!1;remoteLink=new ev(()=>this.readRemoteLinkState());linkStatusPublisher=new $_(()=>this.upstreamLinkStatus(),Z_);syncStatusPublisher=new $_(()=>this.readSyncStatus(),(e,t)=>Q_(e.uploads,t.uploads)&&Z_(e.link,t.link));lastFailure=null;failingAs=null;pendingInboundServerFrames=[];serverInboundRouting=Promise.resolve();serverInboundProcessed=!1;peerTransportWorkListeners=/* @__PURE__ */ new Set;auxiliaryTraceListeners=/* @__PURE__ */ new Set;queryCoverageTraceListeners=/* @__PURE__ */ new Set;peerTransportActivityEpoch=0;peerTransportProcessedActivityEpoch=0;coreTickScheduled=!1;coreDeadlineTimer;coreDeadlineAt;coreTickAgain=!1;coreOperation=null;pendingTransportRetirements=/* @__PURE__ */ new Map;serverPumpScheduled=!1;serverPumpRunning=!1;serverPumpAgain=!1;serverConnectionGeneration=0;phase=`open`;foregroundLeaseCapture=null;foregroundLeaseDraining=!1;nextSubscriptionId=1;static fromDb(t,n,r,i,a,o,s){return new e(null,n,r,i,a,o,{db:t,selfSignedClientProof:s?.selfSignedClientProof,scopeIsolatedRelay:s?.scopeIsolatedRelay,slowQueryLog:s?.slowQueryLog,subscriptionBacklogRows:s?.subscriptionBacklogRows})}migrations;registerSchemaView(t,n){return new e(null,t,this.node,this.peerIdentity,1,!0,{db:this.db.registerSchema(rv(t),n?__(n):void 0),backendMode:this.trustedBackend,owner:this})}createPeerAuthority(){return{node:this.node,epoch:Nl(),features:this.nativeWireFeatures()}}async connectUpstreamPeer(e){return this===this.ownerRuntime?(this.peerUpstreamAttached=!0,e?this.connectNegotiatedUpstream({protocolVersion:fy,features:e.features,authority:e}):await this.db.connectUpstream()):await this.ownerRuntime.connectUpstreamPeer(e)}onPeerTransportWork(e){return this===this.ownerRuntime?(this.peerTransportWorkListeners.add(e),()=>{this.peerTransportWorkListeners.delete(e)}):this.ownerRuntime.onPeerTransportWork(e)}onAuxiliaryTrace(e){return this===this.ownerRuntime?(this.auxiliaryTraceListeners.add(e),this.serverTransport?.setAuxiliaryTraceEnabled?.(!0),()=>{this.auxiliaryTraceListeners.delete(e),this.auxiliaryTraceListeners.size===0&&this.serverTransport?.setAuxiliaryTraceEnabled?.(!1)}):this.ownerRuntime.onAuxiliaryTrace(e)}onQueryCoverageTrace(e){return this===this.ownerRuntime?(this.queryCoverageTraceListeners.add(e),()=>this.queryCoverageTraceListeners.delete(e)):this.ownerRuntime.onQueryCoverageTrace(e)}emitQueryCoverageTrace(e){if(this!==this.ownerRuntime){this.ownerRuntime.emitQueryCoverageTrace(e);return}let t={stage:e,peerActivityEpoch:this.peerTransportActivityEpoch,peerProcessedActivityEpoch:this.peerTransportProcessedActivityEpoch};for(let e of this.queryCoverageTraceListeners)e(t)}notifyPeerTransportActivity(){if(this!==this.ownerRuntime)return this.ownerRuntime.notifyPeerTransportActivity();this.peerTransportActivityEpoch+=1,this.notifyPeerTransportWork(!0)}async progressPeerTransport(){if(this!==this.ownerRuntime)return this.ownerRuntime.progressPeerTransport();let e=this.peerTransportActivityEpoch;await this.runCoreTick(),!this.closed&&(this.peerTransportProcessedActivityEpoch=Math.max(this.peerTransportProcessedActivityEpoch,e))}retirePeerTransport(e){return this===this.ownerRuntime?(this.auxiliaryReceiveDeadlines.get(e)?.close(),this.auxiliaryReceiveDeadlines.delete(e),this.coreOperation?new Promise((t,n)=>{let r=this.pendingTransportRetirements.get(e)??[];r.push({resolve:t,reject:n}),this.pendingTransportRetirements.set(e,r)}):(e.close(),Promise.resolve())):this.ownerRuntime.retirePeerTransport(e)}setNonDurableClient(){if(this!==this.ownerRuntime)return this.ownerRuntime.setNonDurableClient();if(!this.db.setNonDurableClient)throw Error(`Native runtime does not expose non-durable client mode`);this.db.setNonDurableClient(),this.nonDurableClient=!0}foregroundTxTimeHighWater(){if(this!==this.ownerRuntime)return this.ownerRuntime.foregroundTxTimeHighWater();if(!this.db.foregroundTxTimeHighWater)throw Error(`Native runtime does not expose foreground transaction high-water`);return this.db.foregroundTxTimeHighWater()}quiesceForegroundTxTimeHighWater(){if(this!==this.ownerRuntime)return this.ownerRuntime.quiesceForegroundTxTimeHighWater();if(this.foregroundLeaseCapture)return this.foregroundLeaseCapture;if(this.closed)throw Error(`Native runtime is already ${this.phase}`);this.advancePhase(`quiesced`),this.clearCoreDeadline(),this.foregroundLeaseDraining=!0;let e=this.captureForegroundTxTimeHighWater().finally(()=>{this.foregroundLeaseDraining=!1,this.clearCoreDeadline()});return this.foregroundLeaseCapture=e,e}coreProgressAllowed(){return!this.closed||this.foregroundLeaseDraining}async captureForegroundTxTimeHighWater(){return await Promise.all(this.pendingStreamingMutations),await Promise.all(this.pendingLocalSettlements),await this.coreOperation?.completion.catch(()=>{}),await this.foregroundTxTimeHighWater()}seedForegroundTxTimeHighWater(e){if(this!==this.ownerRuntime)return this.ownerRuntime.seedForegroundTxTimeHighWater(e);if(!this.db.seedForegroundTxTimeHighWater)throw Error(`Native runtime does not expose foreground transaction high-water seeding`);this.db.seedForegroundTxTimeHighWater(e)}setLargeValueStagingPolicy(e,t,n){if(this!==this.ownerRuntime)return this.ownerRuntime.setLargeValueStagingPolicy(e,t,n);if(!this.db.setLargeValueStagingPolicy)throw Error(`Native runtime does not expose large-value staging policy`);this.db.setLargeValueStagingPolicy(e,t,n)}async evictExpiredStagedLargeValues(){if(this!==this.ownerRuntime)return await this.ownerRuntime.evictExpiredStagedLargeValues();if(!this.db.evictExpiredStagedLargeValues)throw Error(`Native runtime does not expose large-value staging maintenance`);return await this.db.evictExpiredStagedLargeValues()}async acceptPeer(e={},t,n=this.peerIdentity){if(this!==this.ownerRuntime)return this.ownerRuntime.acceptPeer(e,t,n);if(this.closed)throw Error(`Native runtime is closed`);return this.runWhenCoreIdle(async()=>{if(this.closed)throw Error(`Native runtime is closed`);let r;this.coreOperation={kind:`admission`,completion:new Promise(e=>{r=e})};try{let r=this.selfSignedClientProof,i;if(r){if(!rC(n,this.peerIdentity))throw Bx();if(!this.db.acceptSubscriberWithSelfSignedProof)throw Error(`Native runtime does not support self-signed subscriber admission; rebuild the matching Jazz WASM artifact`);i=await this.db.acceptSubscriberWithSelfSignedProof(e,r.token,r.appId,r.claimedAuthor,t)}else{if(!this.db.acceptSubscriber)throw Error(`Native runtime does not expose subscriber links`);i=await this.db.acceptSubscriber(n,e,t)}if(this.closed)throw i.close(),/* @__PURE__ */ Error(`Native runtime closed during subscriber admission`);return i}finally{this.drainTransportRetirements(),this.coreOperation=null,r(),this.coreTickAgain&&!this.closed&&this.scheduleCoreTick()}})}async runWhenCoreIdle(e){let t=this.ownerRuntime;for(;t.coreOperation;)await t.coreOperation.completion;return e()}setRemoteLinkHint(e){if(this!==this.ownerRuntime)return this.ownerRuntime.setRemoteLinkHint(e);this.closed||this.db.setRemoteLinkHint?.(bb[e])}remoteLinkState(){return this===this.ownerRuntime?this.readRemoteLinkState():this.ownerRuntime.remoteLinkState()}onRemoteLinkStateChange(e,t){this===this.ownerRuntime?(this.remoteLink.subscribe(e,t),this.startNativeLinkPoll()):this.ownerRuntime.onRemoteLinkStateChange(e,t)}startNativeLinkPoll(){!this.db?.nativeConnectionStatus||this.nativeLinkPoll||this.closed||!this.linkHasListeners()||(this.nativeLinkPoll=setInterval(()=>{this.linkHasListeners()?this.linkChanged():this.stopNativeLinkPoll()},xb))}noteFirstLoadWait(e){if(!tx(e))return;let t=this.ownerRuntime;t.firstLoadWaitSeen||(t.firstLoadWaitSeen=!0,t.startNativeLinkPoll())}stopNativeLinkPoll(){this.nativeLinkPoll&&clearInterval(this.nativeLinkPoll),this.nativeLinkPoll=null}linkHasListeners(){return this.syncStatusPublisher.hasListeners||this.linkStatusPublisher.hasListeners||this.firstLoadWaitSeen&&this.remoteLink.hasListeners}linkChanged(){this===this.ownerRuntime&&(this.noteNativeAuthRestored(),this.noteLinkFailure()),this.remoteLink.changed(),this.linkStatusPublisher.changed(),this.syncStatusPublisher.changed()}upstreamLinkStatus(){if(this!==this.ownerRuntime)return this.ownerRuntime.upstreamLinkStatus();if(this.closed)return Y_(`stopped`,!1);let e=this.db?.nativeConnectionStatus?.();return e?e.configured?e.explicitlyOffline?Y_(`disconnected`):e.authRejected?Y_(`auth`):e.connected?J_:this.serverTransportError?this.serverTransportErrorRetrying?Y_(`network`):O_(this.serverTransportError)?Y_(`authority-changed`,!1):Y_(`stopped`):q_:K_:this.linkStatus?.phase===`stopped`&&O_(this.upstreamRefusal)?Y_(`authority-changed`,!1):X_(this.linkStatus)}canClearClientStorage(){return this===this.ownerRuntime?typeof this.db?.deleteNativeStore==`function`:this.ownerRuntime.canClearClientStorage()}async clearClientStorage(){if(this!==this.ownerRuntime)return this.ownerRuntime.clearClientStorage();if(!this.db?.deleteNativeStore)throw Error(`Runtime does not support client storage reset.`);if(this.closed)throw Error(`Cannot clear client storage: native runtime is ${this.phase}`);let e=this.db.deleteNativeStore();return this.advancePhase(`storageCleared`),e}uploadStatus(){return this===this.ownerRuntime?this.closed?W_:this.db?.uploadStatus?.()??W_:this.ownerRuntime.uploadStatus()}pendingUploadRows(e){return this===this.ownerRuntime?this.closed?null:this.db?.pendingUploadRows?.(e)??null:this.ownerRuntime.pendingUploadRows(e)}lastLinkFailure(){return this===this.ownerRuntime?(this.noteLinkFailure(),this.lastFailure):this.ownerRuntime.lastLinkFailure()}noteLinkFailure(){let e=this.upstreamLinkStatus(),t=e.state===`offline`?e.reason:null;if(t===this.failingAs)return;this.failingAs=t;let n=G_(e,(this.linkFailure??this.serverTransportError)?.message);n&&(this.lastFailure=n)}onUpstreamLinkStatusChange(e,t){this===this.ownerRuntime?(this.linkStatusPublisher.subscribe(e,t),this.startNativeLinkPoll()):this.ownerRuntime.onUpstreamLinkStatusChange(e,t)}onSyncStatusChange(e,t){this===this.ownerRuntime?(this.syncStatusPublisher.subscribe(e,t),this.startNativeLinkPoll()):this.ownerRuntime.onSyncStatusChange(e,t)}readSyncStatus(){return{link:this.upstreamLinkStatus(),uploads:this.uploadStatus()}}readRemoteLinkState(){if(this.closed)return`unavailable`;let e=this.db?.nativeConnectionStatus?.();if(e)return e.configured?e.explicitlyOffline||e.authRejected?`unavailable`:e.connected?(this.nativeLinkEverConnected=!0,`connected`):this.serverTransportError||this.nativeLinkEverConnected?`unavailable`:`connecting`:`none`;switch(this.linkStatus?.phase??`noServer`){case`noServer`:return`none`;case`live`:return`connected`;case`connecting`:return this.serverTransportError?`unavailable`:`connecting`;default:return`unavailable`}}async waitForUpstreamServerConnection(){if(this!==this.ownerRuntime)return await this.ownerRuntime.waitForUpstreamServerConnection();if(!this.serverCarrierPromise){if(this.serverTransportError)throw this.serverTransportError;return}if(this.linkStatus?.outagePublished&&this.serverTransportError)throw this.serverTransportError;let e=this.linkStatus?.consecutiveFailures?this.waitForServerTransportError(`global`):null;try{await(e?Promise.race([this.serverCarrierPromise,e.promise]):this.serverCarrierPromise)}finally{e?.cancel()}}isClosed(){return this.ownerRuntime.closed}get closed(){return this.phase!==`open`}advancePhase(e){if(Fb[e]<=Fb[this.phase])throw Error(`Native runtime cannot move from ${this.phase} back to ${e}`);this.phase=e}async close(){if(this!==this.ownerRuntime){if(this.phase===`closed`)return;this.advancePhase(`closed`),this.closeRuntimeState()}else if(this.phase!==`closing`&&this.phase!==`closed`){this.advancePhase(`closing`),this.clearCoreDeadline();for(let e of this.pendingNativeAdmissionCancels)e();for(let e of this.pendingNativeReadCancels)e();await this.foregroundLeaseCapture?.catch(()=>{}),this.pendingStreamingMutations.size>0&&await Promise.all(this.pendingStreamingMutations),this.pendingLocalSettlements.size>0&&await Promise.all(this.pendingLocalSettlements),await this.coreOperation?.completion.catch(()=>{});try{this.closeRuntimeState(),await this.db.close?.()}finally{this.advancePhase(`closed`)}}}discard(){this.phase===`open`&&(this.advancePhase(`closed`),this.closeRuntimeState())}closeRuntimeState(){this.clearCoreDeadline();for(let e of this.pendingNativeAdmissionCancels)e();for(let e of this.pendingNativeReadCancels)e();for(let[e,t]of this.subscriptions)this.terminateSubscription(e,t);if(this!==this.ownerRuntime){this.subscriptions.clear();return}for(let e of this.writes.values())e.close?.();this.subscriptions.clear(),this.pendingTxs.clear(),this.completedTxs.clear(),this.writes.clear(),this.serverConnectionGeneration+=1,this.clearLinkTimer(),this.linkAttemptId=null,this.settleLinkConnection(/* @__PURE__ */ Error(`server transport disconnected`)),this.stopNativeLinkPoll(),this.linkChanged();let e=this.serverConnectionAttempt;this.serverConnectionAttempt=null,e&&this.finishServerConnectionAttempt(e,/* @__PURE__ */ Error(`runtime closed`)),this.serverCarrierPromise=null,this.clearServerTransportErrorWaiters(),this.resolveServerTransportWorkWaiters(),this.peerTransportWorkListeners.clear(),this.localSettlementListeners.clear(),this.pendingInboundServerFrames.length=0;let t=this.serverTransport;this.serverTransport=null,t&&this.retirePeerTransport(t).catch(oC),this.peerUpstreamAttached=!1,this.serverCarrier?.close(),this.serverCarrier=null}previewInsert(e,t,n){let r=this.rowStateFromValues(e,n?tC(n):jl(16),t);return{id:r.id,values:r.values}}insert(e,t,n,r){this.assertMutationAdmission(`Insert`);let i=r?tC(r):void 0,a=Wb(n);this.applySessionClaims(a);let o=this.trustedWriteIdentity(a),s=this.backendAttribution(n),c=qb(n),l=Vb(n);Ub(s,l);let u=this.currentTx(n,`Insert`);u&&this.assertTransactionAttribution(u,s);let d=SS(this.table(e),t);if(u){this.assertTransactionWriteIdentity(u,s?void 0:o);let r=this.db.insertInTransaction(u.id,e,d,{rowId:i,branch:l?.head,updatedAtMs:c??void 0});if(!(r instanceof Uint8Array))throw Error(`Native runtime transaction insert did not return a row id`);let a=this.rowStateFromValues(e,r,t);return u.hasStagedMutations=!0,{id:a.id,values:a.values,kind:`staged`,openTransactionId:Bb(n)}}let f=Ix(`Insert`,()=>wb(this.db.insert(e,d,{rowId:i,author:s?void 0:o,attribution:s,branch:l?.head,updatedAtMs:c??void 0})));return this.finishInsert(e,i??f.rowId,t,f)}async streamingMutation(e,t,n,r,i,a,o){let s=this.db.beginStreamingMutation,c=e===`insert`?`Insert`:e===`update`?`Update`:`Upsert`;this.assertMutationAdmission(c);let l=this.currentTx(a,c),u=Wb(a);this.applySessionClaims(u);let d=this.trustedWriteIdentity(u),f=this.backendAttribution(a),p=Vb(a),m=qb(a);if(Ub(f,p),l&&(this.assertTransactionAttribution(l,f),this.assertTransactionWriteIdentity(l,f?void 0:d)),!s)throw Error(`Native runtime does not expose streaming mutations`);let h=this.table(t),g=h.columns.find(e=>e.name===r)?.column_type.type;if(g!==`Text`&&g!==`Json`&&g!==`Bytea`)throw Error(`Streaming insert requires a Text, Json, or Bytea column: ${t}.${r}`);let _=o?tC(o):jl(16),ee=e===`insert`?CS(h,n,r,t):wS(h,n,r),v=s.call(this.db,t,_,ee,r,e,f?void 0:d,f,m??void 0,p?.head,p?.base,l?.id);if(l&&!v.finishInTransaction)throw await v.abort(),/* @__PURE__ */ Error(`This native runtime does not support streaming inside a transaction yet`);let y=this.ownerRuntime,te,ne=new Promise(e=>{te=e});y.pendingStreamingMutations.add(ne);let re=new TextEncoder,b=async e=>{for(let t=0;t<e.byteLength;t+=65536)await v.push(e.subarray(t,t+65536))},x=``;try{for await(let e of y_(i))if(typeof e==`string`){if(g===`Bytea`)throw Error(`Bytea streams require Uint8Array chunks`);let t=x+e;x=``;let n=t.charCodeAt(t.length-1);n>=55296&&n<=56319&&(x=t.slice(-1),t=t.slice(0,-1)),t.length>0&&await b(re.encode(t))}else if(e instanceof Uint8Array)x&&=(await b(re.encode(x)),``),await b(e);else throw Error(`Streaming insert chunks must be strings or Uint8Array values`);x&&await b(re.encode(x));let e=y.streamingFinalization,t,n=new Promise(e=>{t=e});y.streamingFinalization=e.then(()=>n),await e;let r;try{l?(await v.finishInTransaction(),l.hasStagedMutations=!0,r={kind:`staged`,openTransactionId:l.id}):r=this.finishMutation(await v.finish())}finally{t()}return{id:Mu(_),...r}}catch(e){throw await v.abort(),e}finally{te(),y.pendingStreamingMutations.delete(ne)}}restore(e,t,n,r){this.assertMutationAdmission(`Restore`);let i=tC(t),a=Wb(r);this.applySessionClaims(a);let o=this.trustedWriteIdentity(a),s=this.backendAttribution(r),c=qb(r),l=Vb(r);Ub(s,l);let u=this.currentTx(r,`Restore`);u&&this.assertTransactionAttribution(u,s);let d=SS(this.table(e),n);if(u){this.assertTransactionWriteIdentity(u,s?void 0:o),this.db.restoreInTransaction(u.id,e,i,d,{branch:l?.head,updatedAtMs:c??void 0});let t=this.rowStateFromValues(e,i,n);return u.hasStagedMutations=!0,{id:t.id,values:t.values,kind:`staged`,openTransactionId:Bb(r)}}let f=Ix(`Restore`,()=>wb(this.db.restore(e,i,d,{author:s?void 0:o,attribution:s,branch:l?.head,updatedAtMs:c??void 0})));return this.finishInsert(e,i,n,f)}update(e,t,n,r){this.assertMutationAdmission(`Update`);let i=tC(t),a=Wb(r);this.applySessionClaims(a);let o=this.trustedWriteIdentity(a),s=this.backendAttribution(r),c=qb(r),l=Vb(r);Ub(s,l);let u=this.currentTx(r,`Update`);u&&this.assertTransactionAttribution(u,s);let d=TS(this.table(e),n);if(u)return this.assertTransactionWriteIdentity(u,s?void 0:o),this.db.updateInTransaction(u.id,e,i,d,{head:l?.head,base:l?.base,updatedAtMs:c??void 0}),u.hasStagedMutations=!0,{kind:`staged`,openTransactionId:Bb(r)};let f=Ix(`Update`,()=>wb(this.db.update(e,i,d,{author:s?void 0:o,attribution:s,head:l?.head,base:l?.base,updatedAtMs:c??void 0})));return this.finishMutation(f)}updateLargeValues(e,t,n,r,i){this.assertMutationAdmission(`Update`);let a=tC(t),o=qb(i),s=Vb(i),c=this.currentTx(i,`Update`);if(s)throw Error(`Partial-value updates (applyDiffs, editedFrom) are not yet supported in branch views.`);if(c){let t=Wb(i);this.applySessionClaims(t);let s=this.trustedWriteIdentity(t),l=this.backendAttribution(i);this.assertTransactionAttribution(c,l),this.assertTransactionWriteIdentity(c,l?void 0:s);let u=this.db.updateLargeValuesInTransaction;if(!u)throw Lx(`Update`,`typed partial-value updates in transactions are not supported by this runtime`);let d=TS(this.table(e),n);return u.call(this.db,c.id,e,a,d,r,o??void 0),c.hasStagedMutations=!0,{kind:`staged`,openTransactionId:Bb(i)}}if(Hb(i,this.peerIdentity))throw Error(`Partial-value updates (applyDiffs, editedFrom) do not yet support a session or attributed identity outside a transaction.`);let l=this.db.updateLargeValues;if(!l)throw Error(`Native runtime does not support typed partial-value updates.`);let u=TS(this.table(e),n),d=Ix(`Update`,()=>l.call(this.db,e,a,u,r,o??void 0));return this.finishMutation(d)}upsert(e,t,n,r){this.assertMutationAdmission(`Upsert`);let i=tC(t),a=this.table(e),o=Wb(r);this.applySessionClaims(o);let s=this.trustedWriteIdentity(o),c=this.backendAttribution(r),l=qb(r),u=Vb(r);Ub(c,u);let d=this.currentTx(r,`Upsert`);d&&this.assertTransactionAttribution(d,c);let f;try{f=TS(a,n)}catch(e){throw Lx(`Upsert`,Rx(zx(e)))}if(d)return this.assertTransactionWriteIdentity(d,c?void 0:s),this.db.upsertInTransaction(d.id,e,i,f,{head:u?.head,base:u?.base,updatedAtMs:l??void 0}),d.hasStagedMutations=!0,{kind:`staged`,openTransactionId:Bb(r)};let p=Ix(`Upsert`,()=>wb(this.db.upsert(e,i,f,{author:c?void 0:s,attribution:c,head:u?.head,base:u?.base,updatedAtMs:l??void 0})));return this.finishMutation(p)}delete(e,t,n){this.assertMutationAdmission(`Delete`),this.table(e);let r=tC(t),i=Wb(n);this.applySessionClaims(i);let a=this.trustedWriteIdentity(i),o=this.backendAttribution(n),s=qb(n),c=Vb(n);Ub(o,c);let l=this.currentTx(n,`Delete`);if(l&&this.assertTransactionAttribution(l,o),l)return this.assertTransactionWriteIdentity(l,o?void 0:a),this.db.deleteInTransaction(l.id,e,r,{head:c?.head,base:c?.base,updatedAtMs:s??void 0}),l.hasStagedMutations=!0,{kind:`staged`,openTransactionId:Bb(n)};let u=Ix(`Delete`,()=>wb(this.db.delete(e,r,{author:o?void 0:a,attribution:o,head:c?.head,base:c?.base,updatedAtMs:s??void 0})));return this.finishMutation(u)}canInsertLocally(e,t,n){return`unknown`}canReadLocally(e,t,n){return`unknown`}canUpdateLocally(e,t,n,r){return`unknown`}canDeleteLocally(e,t,n){return`unknown`}isScopedPermissionAdvice(e){return this.readAuthorizationHost!==`trusted-serving`||!e?!1:!(this.trustedBackend&&e.issuer===iu&&e.user_id===tv&&mu(e,pu(e)))}delegatedPermissionAdviceSession(e){if(!this.trustedBackend||!e||!this.isScopedPermissionAdvice(e))return null;try{return ix(JSON.stringify(e))}catch{return null}}explainReadClauses(e,t,n){if(!this.trustedBackend)throw Error(`explain runs only on a trusted backend`);let r=this.db.explainReadClauses;if(!r)throw Error(`explain is not supported yet by this runtime`);let i=ix(JSON.stringify(n));if(!i?.identity)throw Error(`explain needs a user to explain for`);return r.call(this.db,e,t,i.identity,i.claims)}requestInsertPermissionAdvice(e,t,n){if(this.isScopedPermissionAdvice(n)&&!this.trustedBackend)return Promise.resolve(`unknown`);let r=this.delegatedPermissionAdviceSession(n);if(this.isScopedPermissionAdvice(n)&&!r)return Promise.resolve(`unknown`);let i=this.db.requestInsertPermissionAdvice;if(!i)return Promise.resolve(`unknown`);let a=SS(this.table(e),t,e);return this.withPermissionAdviceTimeout(()=>i.call(this.db,e,a,r?.identity,r?.claims))}requestReadPermissionAdvice(e,t,n){if(this.isScopedPermissionAdvice(n)&&!this.trustedBackend)return Promise.resolve(`unknown`);let r=this.delegatedPermissionAdviceSession(n);if(this.isScopedPermissionAdvice(n)&&!r)return Promise.resolve(`unknown`);let i=this.db.requestReadPermissionAdvice;return i?this.withPermissionAdviceTimeout(()=>i.call(this.db,e,tC(t),r?.identity,r?.claims)):Promise.resolve(`unknown`)}requestUpdatePermissionAdvice(e,t,n,r){if(this.isScopedPermissionAdvice(r)&&!this.trustedBackend)return Promise.resolve(`unknown`);let i=this.delegatedPermissionAdviceSession(r);if(this.isScopedPermissionAdvice(r)&&!i)return Promise.resolve(`unknown`);let a=this.db.requestUpdatePermissionAdvice;if(!a)return Promise.resolve(`unknown`);let o=TS(this.table(e),n);return this.withPermissionAdviceTimeout(()=>a.call(this.db,e,tC(t),o,i?.identity,i?.claims))}requestDeletePermissionAdvice(e,t,n){if(this.isScopedPermissionAdvice(n)&&!this.trustedBackend)return Promise.resolve(`unknown`);let r=this.delegatedPermissionAdviceSession(n);if(this.isScopedPermissionAdvice(n)&&!r)return Promise.resolve(`unknown`);let i=this.db.requestDeletePermissionAdvice;return i?this.withPermissionAdviceTimeout(()=>i.call(this.db,e,tC(t),r?.identity,r?.claims)):Promise.resolve(`unknown`)}serveThinTransaction(e){if(this!==this.ownerRuntime)return this.ownerRuntime.serveThinTransaction(e);if(this.closed)return Promise.reject(/* @__PURE__ */ Error(`the native runtime is closed`));if(!this.db.serveThinTransaction)return Promise.reject(/* @__PURE__ */ Error(`this native binding serves no thin transactions`));let t=this.db.serveThinTransaction(e);return this.scheduleCoreTick(),this.awaitNativeRead(t)}async releaseThinTransactions(){if(this!==this.ownerRuntime)return this.ownerRuntime.releaseThinTransactions();if(this.closed||!this.db.releaseThinTransactions)return;let e=this.db.releaseThinTransactions();this.scheduleCoreTick(),await this.awaitNativeRead(e)}captureSnapshot(){if(this!==this.ownerRuntime)return this.ownerRuntime.captureSnapshot();if(this.closed)return Promise.reject(/* @__PURE__ */ Error(`Cannot capture a snapshot: native runtime is closed`));if(!this.db.captureSnapshot)return Promise.reject(new zl);let e=this.db.captureSnapshot();return this.scheduleCoreTick(),this.awaitNativeRead(e).then(e=>Rl(kb.decode(e)))}beginTransaction(e,t,n){if(this!==this.ownerRuntime)return this.ownerRuntime.beginTransaction(e,t,n);if(this.closed)throw Error(`Begin transaction failed: native runtime is closed`);if(this.pendingTxs.has(t)||this.completedTxs.has(t))throw Error(`Begin transaction failed: transaction ${t} has already been opened`);let r=Wb(n);this.applySessionClaims(r);let i=this.trustedWriteIdentity(r),a=this.backendAttribution(n),o=a?void 0:i;return this.db.beginTransaction(t,e,o,a),this.pendingTxs.set(t,{id:t,kind:e,identity:o,requestSession:o?r??void 0:void 0,attribution:a,hasStagedMutations:!1}),t}hasStagedTransactionWrites(e){return this===this.ownerRuntime?this.pendingTxs.get(e)?.hasStagedMutations:this.ownerRuntime.hasStagedTransactionWrites(e)}commitTransaction(e){if(this!==this.ownerRuntime)return this.ownerRuntime.commitTransaction(e);if(this.closed)throw Error(`Commit transaction failed: native runtime is closed`);let t=this.pendingTxs.get(e);if(!t)throw Error(Yb(e,this.completedTxs));if(!t.hasStagedMutations&&t.kind===`mergeable`)throw Error(`Commit transaction failed: empty mergeable transaction has no committed unit; roll it back instead`);let n=this.db.commitTransaction(e,t.kind);this.pendingTxs.delete(e),this.completedTxs.set(e,{kind:t.kind,state:`committed`}),this.pumpSubscriptions(),this.scheduleServerPump(),this.notifyPeerTransportWork();let r=zb(n,this.writes);return this.nonDurableClient&&this.trackLocalSettlement(r),r}async waitForTransaction(e,t,n={}){if(this!==this.ownerRuntime)return this.ownerRuntime.waitForTransaction(e,t,n);typeof e!=`string`&&(e=await e);let r=this.writes.get(e);if(!r)throw Error(`Wait for transaction failed: unknown transaction ${e}`);let{signal:i}=n,a=n.observeOnly?r.wait(t,!0):r.wait(t);if(a.catch(()=>{}),n.ready){if(i){let e,t=new Promise(t=>{e=()=>t(),i.addEventListener(`abort`,e,{once:!0})});try{await Promise.race([n.ready,t])}finally{i.removeEventListener(`abort`,e)}}else await n.ready}let o=a.then(()=>`settled`);for(o.catch(()=>{});;){if(this.closed)throw Error(`Wait for transaction failed: native runtime is closed`);i?.throwIfAborted(),this.throwServerTransportErrorForTier(t,!0);let n=this.serverTransportWorkEpoch;this.startServerPump(),this.throwServerTransportErrorForTier(t,!0);let r=this.waitForServerTransportError(t,!0),a=this.waitForServerTransportWork(t,n),s=this.waitForLocalStorageFailure(t),c;try{let e=[o];if(r&&e.push(r.promise),s&&e.push(s.promise),a&&e.push(a.promise.then(()=>`work`)),i&&e.push(new Promise(e=>{let t=()=>e(`work`);i.addEventListener(`abort`,t,{once:!0}),c=()=>i.removeEventListener(`abort`,t)})),await Promise.race(e)===`settled`){this.pumpSubscriptions();return}}catch(t){throw Nx(e,t)||t}finally{c?.(),r?.cancel(),a?.cancel(),s?.cancel()}}}rollbackTransaction(e){if(this!==this.ownerRuntime)return this.ownerRuntime.rollbackTransaction(e);let t=this.pendingTxs.get(e);if(!t)throw Error(Xb(e,this.completedTxs));try{this.db.rollbackTransaction(e)}finally{this.pendingTxs.delete(e)}return this.completedTxs.set(e,{kind:t.kind,state:`rolled_back`}),Promise.resolve(!0)}async query(e,t,n,r){if(this.closed||this.ownerRuntime.closed)throw Error(`Native runtime is closed`);nx(n,r),this.noteFirstLoadWait(r),Zb(r,this.pendingTxs,this.completedTxs);let i=ix(t);fx(e);let a=Ax(e),o=Qb(r,this.pendingTxs),s=ex(n,lx(a),r),c=this.nativeReadContext(i,o),l=dx(a,this.schema);if(await this.ensureClientSessionClaims(i),await this.waitForStrictRemoteQueryTransport(n),await this.processPendingPeerActivityBeforeRead(),this.closed||this.ownerRuntime.closed)return[];if(o||this.attachLocalReadCoverageInBackground(n,l,i),this.emitQueryCoverageTrace(`attach`),ux(a)){if(o){let e=await this.readRowsForContextAsync(l,s,c,o.id);return this.emitQueryCoverageTrace(`covered`),NS(AS(e),this.schema,wx(a,this.schema).rootColumns)}let e=await this.readRowsForContextAsync(l,s,c);return this.emitQueryCoverageTrace(`covered`),NS(AS(e),this.schema,wx(a,this.schema).rootColumns)}let u=wx(a,this.schema).rootColumns,d=await this.readPlainRows(l,s,i??void 0,o);return this.emitQueryCoverageTrace(`covered`),jS(kS(d),this.schema,u)}createSubscription(e,t,n,r){nx(n,r),this.noteFirstLoadWait(r);let i=ix(t),a=this.nativeReadContext(i);fx(e);let o=this.nextSubscriptionId++,s=ex(n,lx(e),r);this.subscriptions.set(o,{openingAbort:new AbortController,reading:!1,outputColumns:wx(e,this.schema),tier:n??`local-first`,cancelled:!1});let c=this.subscriptions.get(o),l=dx(e,this.schema),u=e=>{let t=YS(e);c.cancelled||this.closed||this.ownerRuntime.closed?cx(t):(c.source=t,c.callback&&this.startSubscriptionReader(o,c))},d=e=>{c.cancelled||this.failSubscription(c,e instanceof Error?e:Error(String(e)))},f=()=>{if(this.closed||this.ownerRuntime.closed)throw Error(`Native runtime is closed`);if(c.cancelled)throw Error(`native operation was cancelled`);let e=this.subscribeForContext(l,s,a);return Ob(e)?this.awaitNativeOperation(e,c.openingAbort.signal):e};try{let e=this.ensureClientSessionClaims(i),t=e instanceof Promise?e.then(f):f();t instanceof Promise?t.then(u).catch(d):u(t)}catch(e){d(e)}return o}executeSubscription(e,t){let n=this.subscriptions.get(e);if(n){if(n.callback)throw Error(`Subscription has already been activated`);if(n.callback=t,n.terminalError){this.deliverSubscriptionFailure(n);return}this.startSubscriptionReader(e,n)}}unsubscribe(e){let t=this.subscriptions.get(e);t&&this.terminateSubscription(e,t)}connect(e,t){if(this!==this.ownerRuntime)return this.ownerRuntime.connect(e,t);if(this.db?.reconnectNativeUpstream){this.db.reconnectNativeUpstream(),this.nativeLinkEverConnected=!1,this.linkChanged();return}let n=tb(t);this.assertCredentialKeepsPrincipal(n),this.nativeWireFeatures(),this.link??=this.createUpstreamLink(),this.serverEndpointUrl=e,this.serverAuthJson=n,this.linkCloseReason=`server transport replaced`,this.stepLink(this.linkStatus&&this.linkStatus.phase!==`noServer`?{type:`setOffline`,offline:!1}:{type:`serverConfigured`,configured:!0})}createUpstreamLink(){if(!this.db.createUpstreamLink)throw Error(`native runtime binding does not expose the upstream link machine; install the matching Jazz native runtime package`);return this.db.createUpstreamLink(Math.floor(Math.random()*(2**53-1)))}stepLink(e){if(this.linkInputs.push(e),!this.linkStepping){this.linkStepping=!0;try{for(let e=this.linkInputs.shift();e;e=this.linkInputs.shift()){if(this.closed||!this.link)continue;let t=JSON.parse(this.link.handle(Date.now(),JSON.stringify(e))),n=this.linkStatus;this.linkStatus=t.status;for(let e of t.actions)this.runLinkAction(e);this.applyLinkStatus(n,t.status);for(let e of t.events)e.type===`authFailed`&&this.authFailureCallback?.(e.reason);this.linkChanged()}}catch(e){throw this.linkInputs.length=0,e}finally{this.linkStepping=!1}}}runLinkAction(e){switch(e.type){case`connect`:this.runLinkAttempt(e.attempt);return;case`close`:{this.linkAttemptId===e.attempt&&(this.linkAttemptId=null);let t=this.serverConnectionAttempt;t?.id===e.attempt&&this.finishServerConnectionAttempt(t,Error(this.linkCloseReason),!1),this.pendingInboundServerFrames.length=0,this.serverPumpScheduled=!1,this.serverPumpAgain=!1;return}case`armTimer`:{this.clearLinkTimer();let t=e.token,n=setTimeout(()=>{this.linkTimer?.token===t&&(this.linkTimer=null,this.stepLink({type:`timerFired`,token:t}))},e.afterMs);this.linkTimer={token:t,handle:n};return}case`cancelTimer`:this.linkTimer?.token===e.token&&this.clearLinkTimer();return}}applyLinkStatus(e,t){let n=this.linkFailure??Error(t.reason??`server transport failed`);switch(t.phase){case`live`:e?.outagePublished&&this.forgetServerTransportError(),e?.phase!==`live`&&this.authRestoredCallback?.();return;case`connecting`:case`backoff`:this.linkConnection||this.awaitLinkConnection(),t.outagePublished&&!e?.outagePublished&&this.handleServerTransportError(Error(n.message),void 0,!0);return;case`awaitingCredential`:case`stopped`:if(e?.phase!==t.phase){let e=t.phase===`awaitingCredential`&&!t.terminal;this.handleServerTransportError(n,void 0,e),this.serverTransportErrorAwaitsAuth=e,this.settleLinkConnection(n)}return;case`offline`:case`noServer`:this.settleLinkConnection(/* @__PURE__ */ Error(`server transport disconnected`));return}}awaitLinkConnection(){let e=new Promise((e,t)=>{this.linkConnection={resolve:e,reject:t}});e.catch(()=>{}),this.serverCarrierPromise=e}settleLinkConnection(e){let t=this.linkConnection;this.linkConnection=null,e instanceof Error?(this.serverCarrierPromise=null,t?.reject(e)):(this.serverCarrierPromise=Promise.resolve(e),t?.resolve(e))}clearLinkTimer(){this.linkTimer&&clearTimeout(this.linkTimer.handle),this.linkTimer=null}endLinkAttempt(e,t,n){if(e.finished)return;let r=e.id===this.linkAttemptId;if(this.finishServerConnectionAttempt(e,t,!1),r&&!this.closed){this.linkAttemptId=null,this.pendingInboundServerFrames.length=0,this.linkFailure=t;try{this.stepLink({type:`ended`,attempt:e.id,failure:n})}finally{this.linkFailure=null}}}runLinkAttempt(e){this.linkAttemptId=e,this.linkConnection||this.awaitLinkConnection();let t=this.serverEndpointUrl,n=this.serverAuthJson;(async()=>{for(let e=this.serverReplacementRetirement;e;e=this.serverReplacementRetirement)await e,this.serverReplacementRetirement===e&&(this.serverReplacementRetirement=null);this.closed||this.linkAttemptId!==e||t===null||n===null||this.startServerConnection(e,t,n)})().catch(t=>{if(this.closed||this.linkAttemptId!==e)return;this.linkAttemptId=null;let n=t instanceof Error?t:Error(zx(t));this.linkFailure=n;try{this.stepLink({type:`ended`,attempt:e,failure:{kind:`fatal`,message:n.message}})}finally{this.linkFailure=null}})}startServerConnection(e,t,n){this.serverConnectionGeneration+=1;let r=this.serverConnectionGeneration,i=this.nativeWireFeatures(),a=eb(n,this.peerIdentity);this.linkStatus?.outagePublished||this.forgetServerTransportError(),this.upstreamRefusal=null,this.linkChanged();let o,s=new Promise(e=>{o=e}),c=null,l=e=>{if(!c)return;let t=this.serverTransportError&&!this.linkStatus?.outagePublished?{kind:`fatal`,message:e.message}:Eb(e,c.carrier.hasNegotiated);this.endLinkAttempt(c,Error(e.message),t)},u=new By({WebSocket:this.webSocket,endpointUrl:t,peerIdentity:a,features:i,authJson:n,requestedLink:this.scopeIsolatedRelay?`scope_isolated_client_relay`:void 0,onFrame:e=>{r===this.serverConnectionGeneration&&(this.pendingInboundServerFrames.push(e),this.notifyServerTransportWork(),this.scheduleServerPump(),this.serverPumpRunning&&queueMicrotask(()=>{!this.serverPumpRunning||this.pendingInboundServerFrames.length===0||this.routePendingInboundServerFrames().catch(e=>this.handleServerTransportError(e,r))}))},onError:e=>{ly(e)||e.code===`websocket_closed`||e.code===`websocket_error`||e.code===`websocket_silent`||l(e)},onTerminal:l});c={id:e,generation:r,carrier:u,terminal:s,resolveTerminal:o,finished:!1,outcome:null,transport:null,retirement:null,admission:null},this.serverConnectionAttempt=c,this.serverCarrier=u;let d=()=>!this.closed&&r===this.serverConnectionGeneration&&u===this.serverCarrier&&c===this.serverConnectionAttempt;Promise.race([u.ready(),s.then(e=>{throw e})]).then(async t=>{if(!d()||!this.trustedBackend&&(await this.runWhenCoreIdle(()=>{if(d())return this.installClientSessionClaims($y(n))}),!d())){u.close();return}let i=this.connectNegotiatedUpstream(t).catch(e=>{throw Vx(`connecting the negotiated upstream transport`,e)});c.admission=i;let a=await Promise.race([i.then(e=>({type:`admitted`,transport:e})),s.then(e=>({type:`terminal`,error:e}))]);if(a.type===`terminal`)return;c.admission=null;let o=a.transport;if(!d()){u.close(),c.finished?await c.retirement:await this.retirePeerTransport(o);return}c.transport=o,this.serverTransport=o,o.setAuxiliaryTraceEnabled?.(this.auxiliaryTraceListeners.size>0),this.watchAuxiliaryOutbound(o,u,r).catch(e=>this.handleServerTransportError(e,r));let l=this.pumpServerTransport();l.catch(e=>this.handleServerTransportError(e,r)),this.pumpSubscriptions(),this.pinUpstreamPrincipal(n),this.stepLink({type:`admitted`,attempt:e}),await Promise.race([l.catch(()=>{}),new Promise(e=>setTimeout(e,0))]),d()&&this.settleLinkConnection(u)}).catch(e=>{let t=e instanceof Error?e:Error(zx(e));this.endLinkAttempt(c,t,{kind:`fatal`,message:t.message})})}async connectNegotiatedUpstream(e){let t=e.authority,n=this.db.connectUpstreamWithSession;if(!t||!n)return await this.db.connectUpstream();let r=Nl();return await n.call(this.db,e.protocolVersion,e.features,t.node,t.epoch,this.node,r)}nativeWireFeatures(){if(!this.db.wireFeatures)throw Error(`native runtime binding does not expose its wire feature mask; install the matching Jazz native runtime package`);let e=this.db.wireFeatures();if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw Error(`native binding returned invalid wire feature mask ${e}`);return e}nativeUpstreamConfigured(){return this===this.ownerRuntime?this.db.nativeConnectionStatus?.().configured===!0:this.ownerRuntime.nativeUpstreamConfigured()}async disconnect(e={}){if(this!==this.ownerRuntime)return this.ownerRuntime.disconnect(e);if(this.db?.disconnectNativeUpstream){this.db.disconnectNativeUpstream(),this.linkChanged();return}let t=this.serverTransport,n=this.serverConnectionAttempt,r=n?.transport;this.linkCloseReason=`server transport disconnected`,this.stepLink({type:`setOffline`,offline:!0}),this.linkCloseReason=`server transport replaced`,this.serverEndpointUrl=null,this.serverAuthJson=null,this.serverReplacementRetirement||this.forgetServerTransportError(),e.rejectWaiters??!0?this.resolveServerTransportErrorWaiters(/* @__PURE__ */ Error(`server transport disconnected`)):this.clearServerTransportErrorWaiters(),this.resolveServerTransportWorkWaiters(),this.serverTransport=null;let i=[];n?.retirement&&i.push(n.retirement),t&&t!==r&&i.push(Promise.resolve().then(()=>this.retirePeerTransport(t))),this.linkChanged(),await Promise.all(i)}updateAuth(e){if(this!==this.ownerRuntime)return this.ownerRuntime.updateAuth(e);if(this.nativeAuthRefusalRenewable=!1,this.db?.rejectAuthUpdate)return this.db.rejectAuthUpdate();let t=tb(e);this.assertCredentialKeepsPrincipal(t),this.serverEndpointUrl&&(this.serverAuthJson=t,this.stepLink({type:`credentialUpdated`}))}assertCredentialKeepsPrincipal(e){if(this!==this.ownerRuntime)return this.ownerRuntime.assertCredentialKeepsPrincipal(e);if(!this.upstreamPrincipal)return;let t=tb(e);if(!rb(t))return;let n;try{n=eb(t,this.peerIdentity)}catch{n=null}if(!n||!rC(n,this.upstreamPrincipal))throw Bx(`a credential refresh must keep the principal this store connects upstream as`)}pinUpstreamPrincipal(e){this.upstreamPrincipal||!rb(e)||(this.upstreamPrincipal=eb(e,this.peerIdentity))}onAuthFailure(e){if(this!==this.ownerRuntime)return this.ownerRuntime.onAuthFailure(e);this.authFailureCallback=e,this.db.onAuthRejected?.(e=>{this.nativeAuthRefusalRenewable=wu(Eu(e)),this.nativeAuthRefused=!0,this.authFailureCallback?.(e)})}noteNativeAuthRestored(){if(!this.nativeAuthRefused||this.closed)return;let e=!1;try{let t=this.db?.nativeConnectionStatus?.();e=!(!t?.connected||t.authRejected)}catch{return}e&&(this.nativeAuthRefused=!1,this.authRestoredCallback?.())}onAuthRestored(e){if(this!==this.ownerRuntime)return this.ownerRuntime.onAuthRestored(e);this.authRestoredCallback=e}onMutationError(e){if(this!==this.ownerRuntime)return this.ownerRuntime.onMutationError(e);this.mutationErrorCallback=e,this.db.onMutationError(e=>this.deliverMutationError(e))}onStorageFailure(e){if(this!==this.ownerRuntime)return this.ownerRuntime.onStorageFailure(e);this.db.onStorageFailure?.(e)}onServerTransportError(e){if(this!==this.ownerRuntime)return this.ownerRuntime.onServerTransportError(e);this.serverTransportErrorCallback=e}upstreamFailure(){if(this!==this.ownerRuntime)return this.ownerRuntime.upstreamFailure();let e=this.serverTransportError;return e?{error:e,retrying:this.serverTransportErrorRetrying}:null}endCredentialWait(){if(this!==this.ownerRuntime)return this.ownerRuntime.endCredentialWait();this.nativeAuthRefusalRenewable=!1;let e=this.serverTransportError;!e||!this.serverTransportErrorRetrying||(this.serverTransportErrorAwaitsAuth=!1,this.handleServerTransportError(e,this.serverConnectionGeneration,!1))}reportRemoteServerTransportError(e,t=!1){if(this!==this.ownerRuntime)return this.ownerRuntime.reportRemoteServerTransportError(e,t);this.handleServerTransportError(e,this.serverConnectionGeneration,t)}clearRemoteServerTransportError(){if(this!==this.ownerRuntime)return this.ownerRuntime.clearRemoteServerTransportError();this.serverTransportError&&(this.forgetServerTransportError(),this.linkChanged())}reportLocalStorageFailure(e){if(this!==this.ownerRuntime)return this.ownerRuntime.reportLocalStorageFailure(e);if(e===null){this.localStorageFailure=null;return}let t=Object.assign(Error(e),{code:`storage`});this.localStorageFailure=t;for(let e of this.localStorageFailureWaiters)e(t);this.localStorageFailureWaiters.clear()}waitForLocalStorageFailure(e){if(e!==`local`||!this.nonDurableClient)return null;if(this.localStorageFailure)return{promise:Promise.reject(this.localStorageFailure),cancel:()=>{}};let t,n=new Promise((e,n)=>{t=n});return this.localStorageFailureWaiters.add(t),{promise:n,cancel:()=>this.localStorageFailureWaiters.delete(t)}}reportRemoteMutationError(e){if(this!==this.ownerRuntime)return this.ownerRuntime.reportRemoteMutationError(e);this.deliverMutationError(e)}async waitForPendingWrites(e=`global`,t={}){if(this!==this.ownerRuntime)return this.ownerRuntime.waitForPendingWrites(e,t);if(!this.db.waitForPendingWrites)throw Error(`Native runtime lacks graceful sync shutdown; rebuild its bindings`);let{throughOutage:n=!1,signal:r}=t;r?.throwIfAborted(),await this.flushLocalSettlements(),this.throwServerTransportErrorForTier(e,n),this.startServerPump();let i=this.waitForServerTransportError(e,n),a=new AbortController,o=new Promise((e,t)=>{a.signal.addEventListener(`abort`,()=>t(a.signal.reason),{once:!0})});o.catch(()=>{});let s=new Promise(e=>{a.signal.addEventListener(`abort`,()=>e(),{once:!0})}),c=()=>a.abort(r?.reason);r?.addEventListener(`abort`,c,{once:!0});try{let{sync:n}=t,r=n?this.db.waitForSync?this.db.waitForSync(e,this.trustedWriteIdentity(Wb(n.writeContext))??null,s):this.db.waitForPendingWrites(e,s,!0):this.db.waitForPendingWrites(e,s),c=this.awaitNativeRead(Promise.resolve(r).then(e=>e??/* @__PURE__ */ new Uint8Array),void 0,a.signal);c.catch(()=>{});let l=[c,o];i&&l.push(i.promise),await Promise.race(l)}finally{i?.cancel(),r?.removeEventListener(`abort`,c),a.abort(/* @__PURE__ */ Error(`waitForPendingWrites ended`))}}async flushLocalSettlements(){if(this!==this.ownerRuntime)return this.ownerRuntime.flushLocalSettlements();this.pendingLocalSettlements.size>0&&await Promise.all(this.pendingLocalSettlements)}onLocalSettlementChange(e){return this===this.ownerRuntime?(this.localSettlementListeners.add(e),e(this.pendingLocalSettlements.size>0),()=>this.localSettlementListeners.delete(e)):this.ownerRuntime.onLocalSettlementChange(e)}deliverMutationError(e){let t=e.transaction.transactionId;this.deliveredMutationErrors.has(t)||(this.deliveredMutationErrors.add(t),this.mutationErrorCallback?.(e))}trackLocalSettlement(e){if(this!==this.ownerRuntime)return this.ownerRuntime.trackLocalSettlement(e);let t;t=this.waitForTransaction(e,`local`,{observeOnly:!0}).catch(()=>{}).finally(()=>{if(this.pendingLocalSettlements.delete(t),this.pendingLocalSettlements.size===0)for(let e of this.localSettlementListeners)e(!1)});let n=this.pendingLocalSettlements.size===0;if(this.pendingLocalSettlements.add(t),n)for(let e of this.localSettlementListeners)e(!0)}finishInsert(e,t,n,r){let i=zb(r,this.writes);this.nonDurableClient&&this.trackLocalSettlement(i),this.pumpSubscriptions(),this.scheduleServerPump(),this.notifyPeerTransportWork();let a=this.rowStateFromValues(e,t,n);return{id:a.id,values:a.values,kind:`committed`,txId:i}}finishMutation(e){let t=zb(e,this.writes);return this.nonDurableClient&&this.trackLocalSettlement(t),this.pumpSubscriptions(),this.scheduleServerPump(),this.notifyPeerTransportWork(),{kind:`committed`,txId:t}}assertMutationAdmission(e){if(this.ownerRuntime.closed)throw Error(`${e} failed: native runtime is closed`)}rowStateFromValues(e,t,n){return H_(e,Mu(t),this.table(e).columns,n)}async readPlainRows(e,t,n,r){let i=this.nativeReadContext(n,r);return this.readRowsForContextAsync(e,t,i,r?.id)}readRowsForContext(e,t,n){let r=this.db.all(e,{...t,sync:!0},void 0,this.nativeReadAuthor(n),this.nativeReadClaims(n));if(typeof r.then==`function`)throw Error(`native read is asynchronous; use the asynchronous read boundary`);if(Cb(r))throw Error(`native read is pending; use the asynchronous read boundary`);return r}async readRowsForContextAsync(e,t,n,r){return this.awaitNativeRead(this.startRowsForContext(e,t,n,r),t.tier)}startRowsForContext(e,t,n,r){let i=this.nativeReadAuthor(n);return this.db.all(e,t,r,i,this.nativeReadClaims(n))}nativeReadAuthor(e){return e.kind===`session-authority`?e.identity:void 0}nativeReadClaims(e){return e.kind===`session-authority`?e.claims:void 0}nativeReadContext(e,t){return this.trustedBackend&&(e?.backendAuthority||!e&&!t?.identity)?{kind:`backend-authority`}:this.readAuthorizationHost===`trusted-serving`?{kind:`session-authority`,identity:t?.identity??e?.identity??this.peerIdentity,claims:t?.requestSession?.claims??e?.claims}:{kind:`client-local`}}subscribeForContext(e,t,n){if(!this.db.subscribe)throw Error(`Native runtime does not support subscriptions`);let r=n.kind===`session-authority`?n.identity:void 0;return this.db.subscribe(e,t,r,this.nativeReadClaims(n))}async awaitNativeRead(e,t,n){let r=await e;if(!Cb(r))return r;let i=()=>r.cancel();this.ownerRuntime.pendingNativeReadCancels.add(i);try{for(;;){if(this.closed||this.ownerRuntime.closed)throw Error(`native read was cancelled by runtime shutdown`);n?.throwIfAborted(),t&&this.throwServerTransportErrorForTier(t);let e=r.poll();if(e!==null)return e;this.startServerPump(),t&&this.throwServerTransportErrorForTier(t),await Mx(0)}}finally{this.ownerRuntime.pendingNativeReadCancels.delete(i),i(),this.ownerRuntime.scheduleCoreTick()}}trustedWriteIdentity(e){let t=this.readAuthorizationHost===`trusted-serving`;return e?!this.trustedBackend&&!t&&rC(e.identity,this.peerIdentity)?void 0:e.identity:t&&!this.trustedBackend?this.peerIdentity:void 0}backendAttribution(e){if(!this.trustedBackend||!e)return;let t;try{t=JSON.parse(e).attribution}catch{return}if(t===void 0)return;if(typeof t!=`string`||!$l(t))throw Error(`backend attribution must be a canonical author subject string`);let n=Wb(e);if(!n)throw Error(`backend attribution requires a valid author`);return n.identity}awaitNativeOperation(e,t){let n=0,r,i=!1,a,o=()=>{n+=1,r?.()},s=()=>{i=!0,e.cancel(),o()};this.pendingNativeAdmissionCancels.add(s),t?.addEventListener(`abort`,s,{once:!0});let c=()=>{this.pendingNativeAdmissionCancels.delete(s),t?.removeEventListener(`abort`,s),e.cancel()},l=()=>{for(;;){if(this.closed||i||t?.aborted)throw Error(`native operation was cancelled`);if(a)throw a;let s=n,c=e.poll();if(c!=null)return c;if(this.pumpServerTransport().catch(e=>{a=e,o()}),n===s)return new Promise(e=>{r=e,n!==s&&e()}).then(()=>(r=void 0,l()))}};try{e.setWake(o);let t=l();return t instanceof Promise?t.finally(c):(c(),t)}catch(e){throw c(),e}}clientSessionClaimsKey;installClientSessionClaims(e){let t=ox(e);if(t===this.clientSessionClaimsKey)return;let n=this.db.setSessionClaims?.(e);if(n instanceof Promise)return n.then(()=>{this.clientSessionClaimsKey=t});this.clientSessionClaimsKey=t}ensureClientSessionClaims(e){if(this.closed||this.ownerRuntime.closed)throw Error(`Native runtime is closed`);if(!e||e.backendAuthority||this.readAuthorizationHost===`trusted-serving`||ox(e.claims)===this.clientSessionClaimsKey)return;let t=()=>{if(this.closed||this.ownerRuntime.closed)throw Error(`Native runtime is closed`);return this.installClientSessionClaims(e.claims)};return this.ownerRuntime.coreOperation?this.runWhenCoreIdle(t):t()}async waitForStrictRemoteQueryTransport(e){if(e!==`remote`)return;let t=this.serverEndpointUrl,n=eb(this.serverAuthJson??`{}`,this.peerIdentity);for(;!this.hasUpstream();){this.throwServerTransportErrorForTier(`global`);let e=this.serverCarrierPromise;if(!e)return;let r=this.serverConnectionAttempt,i=e.then(()=>null,e=>e instanceof Error?e:Error(zx(e))),a=this.waitForServerTransportError(`global`),o=a?.promise.catch(e=>e instanceof Error?e:Error(zx(e))),s;try{s=await Promise.race([i,...r?.carrier===this.serverCarrier?[r.terminal]:[],...o?[o]:[]])}finally{a?.cancel()}if(this.closed)return;let c=this.serverEndpointUrl,l=this.serverAuthJson??`{}`;if(this.serverCarrierPromise&&(c!==t||!eC(n,eb(l,this.peerIdentity))))throw Error(`server transport scope changed while waiting for remote query`);if(s){if((s.message===`server transport replaced`||s.message===`server transport disconnected`)&&this.serverCarrierPromise!==null||this.linkStatus?.phase===`connecting`&&this.serverCarrierPromise!==null)continue;throw s}}}async processPendingPeerActivityBeforeRead(){if(this.nonDurableClient)for(;!this.closed&&this.peerTransportProcessedActivityEpoch<this.peerTransportActivityEpoch;)await this.progressPeerTransport()}attachLocalReadCoverageInBackground(e,t,n){e!=null&&e!==`local-first`||this.nonDurableClient||!this.serverTransport||(async()=>{await this.serverCarrierPromise,!(this.closed||this.ownerRuntime.closed)&&(await this.waitForStrictRemoteQueryTransport(`remote`),!(this.closed||this.ownerRuntime.closed)&&await this.readRowsForContextAsync(t,ex(`remote`,!1),this.nativeReadContext(n)))})().catch(()=>{})}admitLocalFirstSession(e,t,n){if(!this.trustedBackend||e.issuer!==nu||!e.account_id||!mu(e,pu(e)))throw Error(`Device account native admission requires a verified account session`);if(!this.db.admitLocalFirstSession)throw Error(`Native runtime lacks device account session admission`);this.db.admitLocalFirstSession(t,n,new Bl().decode(eu(e)))}applySessionClaims(e){!e||e.backendAuthority||this.readAuthorizationHost!==`trusted-serving`||!this.db.setIdentityClaims||this.db.setIdentityClaims(e.identity,e.claims)}table(e){let t=this.schema[e];if(!t)throw Error(`unknown table ${e}`);return t}currentTx(e,t){let n=Bb(e);if(!n)return;let r=this.pendingTxs.get(n);if(r)return r;throw Error(`${t} failed: WriteError("${Jb(n,this.completedTxs)}")`)}assertTransactionWriteIdentity(e,t){if(e.kind===`serializable`){if(e.identity&&(!t||!rC(e.identity,t)))throw Error(`Native runtime serializable transaction cannot mix write identities`)}else if(e.identity&&(!t||!rC(e.identity,t))||t&&!e.identity)throw Error(`Native runtime mergeable transaction cannot mix write identities`)}assertTransactionAttribution(e,t){if(e.attribution||t){if(!e.attribution)throw Error(`Native runtime transaction was opened without backend attribution`);if(!t||!rC(e.attribution,t))throw Error(`Native runtime backend-attributed transaction requires its original provenance subject`)}}pumpSubscriptions(){this.drainSubscriptionPool();for(let[e,t]of this.subscriptions)t.poolId===void 0&&this.startSubscriptionReader(e,t)}nativeSubscriptionPool(){return this.subscriptionPool===void 0&&(this.subscriptionPool=this.db.createSubscriptionPool?.()??null),this.subscriptionPool}drainSubscriptionPool(){let e=this.subscriptionPool;if(e&&this.pooledSubscriptions.size!==0){if(this.drainingSubscriptionPool){this.subscriptionPoolDirty=!0;return}this.drainingSubscriptionPool=!0;try{do{this.subscriptionPoolDirty=!1;for(let t of e.drain())this.applyPooledBatch(t)}while(this.subscriptionPoolDirty&&!this.closed)}finally{this.drainingSubscriptionPool=!1}}}applyPooledBatch(e){let t=this.pooledSubscriptions.get(e.id);if(t===void 0)return;let n=this.subscriptions.get(t),r=()=>n!==void 0&&!n.cancelled&&this.subscriptions.get(t)===n;if(!n||!r())this.pooledSubscriptions.delete(e.id);else{for(let i of e.events){if(!r())break;try{this.applySubscriptionChunk(t,n,i)}catch(e){this.failSubscription(n,e instanceof Error?e:Error(String(e)))}}if(e.error&&(this.pooledSubscriptions.delete(e.id),!this.closed&&r())){let t=Error(e.error.message);t.code=e.error.code,this.failSubscription(n,t)}r()||this.pooledSubscriptions.delete(e.id)}}withPermissionAdviceTimeout(e){if(this!==this.ownerRuntime)return this.ownerRuntime.withPermissionAdviceTimeout(e);if(this.closed||(!this.serverTransport||!this.serverCarrier)&&!this.nativeUpstreamConfigured())return Promise.resolve(`unknown`);let t=e(),n=Tb(t)?{promise:this.awaitNativePermissionAdvice(t),cancel:()=>t.cancel()}:typeof t==`string`?{promise:Promise.resolve(t===`allowed`||t===`denied`||t===`unknown`?t:`unknown`),cancel:()=>{}}:t;return new Promise(e=>{let t=!1,r=n=>{t||(t=!0,clearTimeout(i),e(n))},i=setTimeout(()=>{n.cancel(),r(`unknown`)},2e3);n.promise.then(r,()=>r(`unknown`))})}async awaitNativePermissionAdvice(e){for(;;){if(this.closed)return e.cancel(),`unknown`;let t=e.poll();if(t!==null)return t===`allowed`||t===`denied`||t===`unknown`?t:`unknown`;await this.pumpServerTransport(),await Mx(0)}}clearCoreDeadline(){this.coreDeadlineTimer!==void 0&&clearTimeout(this.coreDeadlineTimer),this.coreDeadlineTimer=void 0,this.coreDeadlineAt=void 0}scheduleCoreWake(e){if(this.coreProgressAllowed()){if(e===`after-current-turn`){setTimeout(()=>this.scheduleCoreWake(`immediate`),0);return}if(e.startsWith(`after:`)){let t=Number(e.slice(6));if(!Number.isSafeInteger(t)||t<0)return;let n=performance.now()+t;if(this.coreDeadlineAt!==void 0&&this.coreDeadlineAt<=n)return;this.clearCoreDeadline(),this.coreDeadlineAt=n,this.coreDeadlineTimer=setTimeout(()=>{this.coreDeadlineTimer=void 0,this.coreDeadlineAt=void 0,this.scheduleCoreWake(`immediate`)},t);return}if(this.notifyPeerTransportWork(),e===`immediate`){this.scheduleCoreTick();return}queueMicrotask(()=>{this.scheduleCoreTick()})}}scheduleCoreTick(){if(this.coreProgressAllowed()){if(this.coreOperation){this.coreTickAgain=!0;return}this.coreTickScheduled||(this.coreTickScheduled=!0,queueMicrotask(()=>{if(this.coreTickScheduled=!1,this.coreProgressAllowed()){if(this.coreOperation){this.coreTickAgain=!0;return}this.runCoreTick().catch(e=>{try{if(this.db.isNativeForegroundClosed?.())return}catch(e){oC(e);return}this.serverTransport!==null||this.serverEndpointUrl!==null?this.handleServerTransportError(e):oC(e)})}}))}}runCoreTick(){if(!this.coreProgressAllowed())return Promise.resolve();let e=this.coreOperation;if(e)return this.coreTickAgain=!0,e.kind===`tick`?e.completion:e.completion.then(()=>this.runCoreTick());let t,n,r=new Promise((e,r)=>{t=e,n=r});return this.coreOperation={kind:`tick`,completion:r},this.driveCoreTicks().then(t,n),r}reportSlowQueries(){let e=this.ownerRuntime;for(let t of this.db.takeSlowQueryReport?.(e.slowQueryApp)??[]){if(e.slowQueryConsoleDetail!==`summary`){console.warn(`[jazz] ${t}`);continue}let n=Pb(t);n===t?console.warn(`[jazz] ${t}`):(console.warn(`[jazz] ${n}. Plan and SQL are logged at the debug ("Verbose") level.`),console.debug(`[jazz] ${t}`))}}async driveCoreTicks(){let e=!1;try{for(let t=0;;t+=1){this.coreTickAgain=!1;try{await this.db.tick()}catch(e){throw new j_(e)}if(this.ownerRuntime.noteNativeAuthRestored(),this.syncStatusPublisher.changed(),this.reportSlowQueries(),this.pumpSubscriptions(),this.scheduleServerPump(),this.notifyPeerTransportWork(),!this.coreProgressAllowed()||!this.coreTickAgain)break;if(t+1>=Sb){e=!0;break}}}finally{this.drainTransportRetirements(),this.coreOperation=null}e&&this.coreProgressAllowed()&&setTimeout(()=>this.scheduleCoreTick(),0)}drainTransportRetirements(){let e=[...this.pendingTransportRetirements];this.pendingTransportRetirements.clear();for(let[t,n]of e)try{t.close();for(let e of n)e.resolve()}catch(e){for(let t of n)t.reject(e)}}startSubscriptionReader(e,t){let n=t.source;if(t.cancelled||t.reading||!t.callback||!n)return;if(t.poolId!==void 0){this.drainSubscriptionPool();return}let r=n.joinPool?this.nativeSubscriptionPool():null;if(r&&n.joinPool){let i=n.joinPool(r);t.poolId=i,this.pooledSubscriptions.set(i,e),this.drainSubscriptionPool()}else t.reading=!0,this.readSubscription(e,t,n)}readSubscription(e,t,n){let r=()=>!t.cancelled&&this.subscriptions.get(e)===t,i=()=>{t.reading=!1},a=e=>{!this.closed&&r()&&this.failSubscription(t,e instanceof Error?e:Error(String(e))),i()},o=n=>{if(n.type===`closed`||!r())return n.type===`closed`&&this.terminateSubscription(e,t),i(),!1;if(n.type===`pending`)return this.pumpServerTransport().then(()=>Mx(Math.max(0,n.retryAfterMs))).then(s).catch(a),!1;for(let a of n.events){if(!r())return i(),!1;try{this.applySubscriptionChunk(e,t,a)}catch(e){this.failSubscription(t,e instanceof Error?e:Error(String(e)))}}return n.events.length===0||!r()?(i(),!1):!0},s=()=>{for(;r();){let e;try{e=n.pull(e=>{o(e)&&s()},a)}catch(e){a(e);return}if(e===void 0||!o(e))return}i()};s()}applySubscriptionChunk(e,t,n){let r=KS(n);if(r.type===`closed`){this.terminateSubscription(e,t);return}if(r.type===`rejected`){if(r.reason.type===`ShapeRegistrationPendingCatalogueAdmission`)return;this.failSubscription(t,JS(r.reason));return}let i=IS(r.delta,this.schema,r.reset===!0,t.outputColumns,r.coalesced===!0);i.terminalOperations=Tx(r.terminalOperations,t.outputColumns?.rootColumns),t.callback?.(i)}scheduleServerPump(){if(!this.closed&&this.serverTransport){if(this.serverPumpRunning){this.serverPumpAgain=!0;return}this.serverPumpScheduled||(this.serverPumpScheduled=!0,setTimeout(()=>{this.serverPumpScheduled=!1,!this.closed&&this.startServerPump()},yb))}}startServerPump(){let e=this.serverConnectionGeneration;this.pumpServerTransport().catch(t=>this.handleServerTransportError(t,e))}notifyPeerTransportWork(e=!1){for(let t of this.peerTransportWorkListeners)t(e)}hasUpstream(){return this.serverTransport!=null||this.peerUpstreamAttached}async pumpServerTransport(){let e=this.serverTransport,t=this.serverCarrier,n=this.serverConnectionGeneration;if(!this.closed&&e&&t){if(this.serverPumpRunning){this.serverPumpAgain=!0;return}this.serverPumpRunning=!0;try{let r=this.pendingInboundServerFrames.length>0&&await this.routePendingInboundServerFrames();r||=this.serverInboundProcessed,this.serverInboundProcessed=!1;for(let i=0;i<32;i+=1){if(await this.runCoreTick(),this.flushAuxiliaryOutbound(e,t,n),(r||this.serverInboundProcessed)&&(r=!1,this.serverInboundProcessed=!1,this.notifyServerTransportWork(),queueMicrotask(()=>this.notifyServerTransportWork())),this.closed||n!==this.serverConnectionGeneration||e!==this.serverTransport||t!==this.serverCarrier||this.stopRefusedUpstream(e))return;let i=Lb(e.recvWireFrames());if(i.length>0&&this.sendServerFrames(i,t,n),this.pumpSubscriptions(),i.length===0)return}this.serverPumpAgain=!0}finally{this.serverPumpRunning=!1,this.serverPumpAgain&&(this.serverPumpAgain=!1,this.scheduleServerPump())}}}stopRefusedUpstream(e){let t=k_(e.upstreamRefusal?.());if(!t)return!1;let n=this.serverConnectionAttempt;return!n||n.transport!==e?!1:(this.upstreamRefusal=t,this.endLinkAttempt(n,t,{kind:`fatal`,message:t.message}),!0)}async routePendingInboundServerFrames(){let e=!1,t=this.serverInboundRouting.then(async()=>{let t=this.serverTransport,n=this.serverCarrier,r=this.serverConnectionGeneration;if(!t||this.pendingInboundServerFrames.length===0)return;let i=this.pendingInboundServerFrames.splice(0);e=!0,this.serverInboundProcessed=!0;let a=[];for(let e of i){let i=t.routeAuxiliaryWireFrame?await t.routeAuxiliaryWireFrame(e):e;if(n&&this.refreshAuxiliaryReceiveDeadline(t,n,r),t!==this.serverTransport||r!==this.serverConnectionGeneration)return;i!=null&&a.push(Rb(i))}if(this.publishAuxiliaryTrace(t),a.length>0){if(t.sendWireFrames)t.sendWireFrames(a);else for(let e of a)t.sendWireFrame(e)}this.notifyPeerTransportWork(!0),n&&this.flushAuxiliaryOutbound(t,n,this.serverConnectionGeneration)});return this.serverInboundRouting=t.then(()=>{},()=>{}),await t,e}refreshAuxiliaryReceiveDeadline(e,t,n){if(this.closed||e!==this.serverTransport||n!==this.serverConnectionGeneration)return;let r=this.auxiliaryReceiveDeadlines.get(e);r||(r=new uh(e,r=>{if(this.closed||e!==this.serverTransport||n!==this.serverConnectionGeneration)return;let i=r instanceof Error?r:Error(zx(r)),a=this.serverConnectionAttempt;a?.transport===e?this.finishServerConnectionAttempt(a,i):(t.close(),this.handleServerTransportError(i,n),this.retirePeerTransport(e).catch(oC))}),this.auxiliaryReceiveDeadlines.set(e,r)),r.refresh()}flushAuxiliaryOutbound(e,t,n){let r=e.recvAuxiliaryWireFrames;if(!r)return;let i=Lb(r.call(e));i.length>0&&this.sendServerFrames(i,t,n),this.publishAuxiliaryTrace(e)}publishAuxiliaryTrace(e){let t=e.takeAuxiliaryTrace?.();if(t&&t.length!==0)for(let e of this.auxiliaryTraceListeners)e(t)}async watchAuxiliaryOutbound(e,t,n){for(;!this.closed&&e===this.serverTransport&&t===this.serverCarrier&&n===this.serverConnectionGeneration;){let r=e.auxiliaryOutboundReady?.();if(!r||typeof r==`boolean`||(await r,e!==this.serverTransport||t!==this.serverCarrier))return;this.flushAuxiliaryOutbound(e,t,n)}}sendServerFrames(e,t,n){n!==this.serverConnectionGeneration||t!==this.serverCarrier||t.sendBatch(e).catch(e=>{this.handleServerTransportError(e,n)})}forgetServerTransportError(){this.serverTransportError=null,this.serverTransportErrorRetrying=!1,this.serverTransportErrorAwaitsAuth=!1}handleServerTransportError(e,t=this.serverConnectionGeneration,n=!1){if(t!==this.serverConnectionGeneration&&(this.closed||!M_(e)))return;let r=zx(e);if(this.serverTransportError&&r===`websocket closed`){if(n||!this.serverTransportErrorRetrying)return;e=this.serverTransportError}e===this.serverTransportError&&this.serverTransportErrorAwaitsAuth&&(n=!0),this.serverTransportErrorAwaitsAuth=!1;let i=this.serverTransportError===null||this.serverTransportErrorRetrying&&!n;this.serverTransportError=e instanceof Error?e:Error(r),this.serverTransportErrorRetrying=n,this.linkChanged(),n||this.failRemoteSubscriptions(this.serverTransportError),this.resolveServerTransportErrorWaiters(this.serverTransportError,n),i&&this.serverTransportErrorCallback?.(this.serverTransportError,{retrying:n})}finishServerConnectionAttempt(e,t,n=!0){if(e.finished)return;e.finished=!0,this.linkChanged(),e.outcome=t,e.resolveTerminal(t);let r=e===this.serverConnectionAttempt&&e.generation===this.serverConnectionGeneration&&e.carrier===this.serverCarrier;r&&(this.serverConnectionGeneration+=1,this.serverConnectionAttempt=null,this.serverCarrier=null),e.carrier.close();let i=e.transport;if(e.transport=null,i){i===this.serverTransport&&(this.serverTransport=null);try{if(this.coreOperation){let t=Promise.resolve(this.retirePeerTransport(i));e.retirement=t,t.catch(e=>{this.closed||this.handleServerTransportError(e)})}else this.retirePeerTransport(i),e.retirement=null}catch(t){let n=Promise.reject(t);e.retirement=n,n.catch(e=>{this.closed||this.handleServerTransportError(e)})}}if(e.admission){let t=e.admission;e.admission=null,e.retirement=t.then(e=>this.retirePeerTransport(e),()=>{}),e.retirement.catch(e=>{this.closed||this.handleServerTransportError(e)})}e.retirement&&(this.serverReplacementRetirement=Db(this.serverReplacementRetirement,e.retirement),this.serverReplacementRetirement.catch(()=>{})),r&&(n&&this.handleServerTransportError(t),this.resolveServerTransportWorkWaiters())}failRemoteSubscriptions(e){for(let t of this.subscriptions.values())t.cancelled||t.tier===`remote`&&this.failSubscription(t,e)}terminateSubscription(e,t){this.subscriptions.get(e)===t&&this.subscriptions.delete(e),this.retireSubscriptionResources(t)}failSubscription(e,t){e.cancelled||(e.terminalError=t,this.retireSubscriptionResources(e),this.deliverSubscriptionFailure(e))}retireSubscriptionResources(e){if(e.cancelled)return;e.cancelled=!0,e.poolId!==void 0&&this.pooledSubscriptions.delete(e.poolId),e.openingAbort?.abort();let t=e.source;if(e.source=void 0,t)try{cx(t)}catch(e){console.error(`Jazz subscription source cleanup failed`,e)}}deliverSubscriptionFailure(e){if(e.callback&&e.terminalError&&!e.terminalErrorDelivered){e.terminalErrorDelivered=!0;try{e.callback(e.terminalError)}catch(e){setTimeout(()=>{throw e},0)}}}serverTransportErrorFor(e){return e&&this.serverTransportErrorRetrying?null:this.serverTransportError}throwServerTransportErrorForTier(e,t=!1){if(e!==`global`&&e!==`remote`)return;let n=this.serverTransportErrorFor(t);if(n)throw n}waitForServerTransportError(e,t=!1){if(e!==`global`&&e!==`remote`)return null;let n=this.serverTransportErrorFor(t);if(n)return{promise:Promise.reject(n),cancel:()=>{}};let r={active:!0,throughOutage:t,reject:()=>{}},i=new Promise((e,t)=>{r.reject=t});return this.serverTransportErrorWaiters.push(r),{promise:i,cancel:()=>{if(!r.active)return;r.active=!1;let e=this.serverTransportErrorWaiters.indexOf(r);e>=0&&this.serverTransportErrorWaiters.splice(e,1)}}}resolveServerTransportErrorWaiters(e,t=!1){let n=this.serverTransportErrorWaiters.splice(0);for(let r of n)r.active&&(t&&r.throughOutage?this.serverTransportErrorWaiters.push(r):r.reject(e))}clearServerTransportErrorWaiters(){for(let e of this.serverTransportErrorWaiters)e.active=!1;this.serverTransportErrorWaiters.length=0}waitForServerTransportWork(e,t){if(e!==`global`&&e!==`remote`)return null;if(this.serverTransportWorkEpoch!==t)return{promise:Promise.resolve(),cancel:()=>{}};let n={active:!0,resolve:()=>{}},r=new Promise(e=>{n.resolve=e});return this.serverTransportWorkWaiters.push(n),{promise:r,cancel:()=>{if(!n.active)return;n.active=!1;let e=this.serverTransportWorkWaiters.indexOf(n);e>=0&&this.serverTransportWorkWaiters.splice(e,1)}}}notifyServerTransportWork(){this.serverTransportWorkEpoch+=1,this.resolveServerTransportWorkWaiters()}resolveServerTransportWorkWaiters(){let e=this.serverTransportWorkWaiters.splice(0);for(let t of e)t.active&&t.resolve()}};function Lb(e){return e.filter(e=>ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`)}function Rb(e){let t=Lb([e])[0];if(!t)throw Error(`native transport returned a non-byte wire frame`);return t}function zb(e,t){let n=e.txId;return t.set(n,e),n}function Bb(e){if(e)try{let t=JSON.parse(e);return typeof t.transaction_id==`string`?t.transaction_id:void 0}catch{return}}function Vb(e){if(e)try{let t=JSON.parse(e);if(!t.branch_view||typeof t.branch_view!=`object`)return;let n=t.branch_view;return n.head==null?void 0:{head:n.head,base:n.base}}catch{return}}function Hb(e,t){if(!e)return!1;let n;try{if(n=JSON.parse(e),n.attribution!==void 0)return!0;if(n.issuer===void 0&&n.user_id===void 0&&n.session===void 0)return!1}catch{return!1}try{let n=Wb(e);return n===null||!rC(n.identity,t)}catch{return!0}}function Ub(e,t){if(e&&t)throw Error(`Backend-attributed writes do not support branch views`)}function Wb(e){if(!e)return null;try{let t=JSON.parse(e);if(t.attribution===tv)throw Error(`Native runtime public session uses reserved issuer`);let n=typeof t.attribution==`string`?$l(t.attribution):null;if(n?.issuer===iu)throw Error(`Native runtime public session uses reserved issuer`);let r=n?.user_id??(typeof t.user_id==`string`?t.user_id:typeof t.session?.user_id==`string`?t.session.user_id:void 0);if(!r||!Zl(r))return null;let i=n?.issuer??t.session?.issuer??t.issuer;if(typeof i!=`string`||!Zl(i))throw Error(`session is missing issuer`);let a={account_id:rx(n?n.account_id:(t.session??t).account_id),issuer:i,user_id:r,authMode:typeof t.session?.authMode==`string`?t.session.authMode:typeof t.authMode==`string`?t.authMode:`external`};Gb(a.issuer,a.user_id,a.authMode,t.session?.[su]??t[su],a.account_id);let o=t.session?.[su]??t[su],s=sx(t.session?.claims??t.claims,a);return{...a,claims:s,identity:eu(a),backendAuthority:a.issuer===iu&&a.user_id===tv&&mu(a,o)}}catch(e){if(e instanceof Error&&(e.message===`session is missing issuer`||e.message===`session has invalid account_id`||e.message===`Native runtime public session uses reserved issuer`))throw e;return null}}function Gb(e,t,n,r,i){if(ou(e)&&(n!==`device-account`&&n!==`anonymous`&&n!==`external`||!mu({issuer:e,user_id:t,authMode:n,account_id:i},r)))throw Error(`Native runtime public session uses reserved issuer`)}function Kb(e){if(!e)return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t.updated_at==`number`){if(!Number.isSafeInteger(t.updated_at)||t.updated_at<0)throw Error(`updatedAt must be a nonnegative safe integer`);return t.updated_at}}function qb(e){return Kb(e)??null}function Jb(e,t){return t.get(e)?.state===`committed`?`open transaction ${e} is already committed`:`open transaction ${e} has already been completed or was never opened`}function Yb(e,t){let n=Jb(e,t);return t.get(e)?.state===`committed`?`Write error: ${n}`:`Commit transaction failed: Write error: ${n}`}function Xb(e,t){let n=Jb(e,t);return t.get(e)?.state===`committed`?`Write error: ${n}`:`Rollback transaction failed: Write error: ${n}`}function Zb(e,t,n){let r=$b(e);if(r&&!t.has(r))throw Error(`Query setup failed: Write error: ${Jb(r,n)}`)}function Qb(e,t){let n=$b(e);return n?t.get(n):void 0}function $b(e){if(e)try{let t=JSON.parse(e);return typeof t.transaction_id==`string`?t.transaction_id:void 0}catch{return}}function ex(e,t=!1,n){let r=n==null?{}:JSON.parse(n),i={};e!=null&&(i.tier=e),t&&(i.include_deleted=!0),typeof r.first_load_remote_wait_ms==`number`&&r.first_load_remote_wait_ms>0&&(i.first_load_remote_wait_ms=r.first_load_remote_wait_ms);let a=r.read_view??r.readView;return a!=null&&(i.read_view=a),Array.isArray(r.splices)&&r.splices.length>0&&(i.splices=r.splices),i}function tx(e){if(e==null)return!1;try{let t=JSON.parse(e);return typeof t.first_load_remote_wait_ms==`number`&&t.first_load_remote_wait_ms>0}catch{return!1}}function nx(e,t){if(e!=null&&![`local-first`,`remote`,`local-only`].includes(e))throw Error(`Native runtime received unsupported read tier '${e}'`);t!=null&&JSON.parse(t)}function rx(e){if(e!==void 0){if(typeof e!=`string`||!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(e))throw Error(`session has invalid account_id`);return e}}function ix(e){if(e==null)return null;let t=JSON.parse(e);if(typeof t.user_id!=`string`||!Zl(t.user_id))throw Error(`Native runtime session is missing user_id`);if(typeof t.issuer!=`string`||!Zl(t.issuer))throw Error(`Native runtime session is missing issuer`);let n={account_id:rx(t.account_id),issuer:t.issuer,user_id:t.user_id,authMode:typeof t.authMode==`string`?t.authMode:`external`};Gb(n.issuer,n.user_id,n.authMode,t[su],n.account_id);let r=n.issuer===iu&&n.user_id===tv&&mu(n,t[su]);return{...n,claims:sx(t.claims,n),identity:eu(n),backendAuthority:r}}function ax(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ox(e){return e===null||typeof e==`boolean`||typeof e==`string`?JSON.stringify(e):typeof e==`number`?Number.isFinite(e)?JSON.stringify(e):`null`:Array.isArray(e)?`[${e.map(ox).join(`,`)}]`:ax(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${ox(e[t])}`).join(`,`)}}`:`null`}function sx(e,t){return{...ax(e)?e:{},iss:t.issuer,sub:t.user_id}}function cx(e){e.close()}function lx(e){try{return JSON.parse(e).include_deleted===!0}catch{return!1}}function ux(e){try{let t=JSON.parse(e).array_subqueries;return Array.isArray(t)&&t.length>0}catch{return!1}}function dx(e,t){return Yx(e,t)}function fx(e){if(px(e))throw Error(`Native runtime does not support permission-introspection query columns or predicates ($canRead) until unified policy lowering exists.`)}function px(e){let t=JSON.parse(e);return vx(t.select_columns??t.select)||yx(t.conditions)||mx(t.relation_ir)||hx(t.relation_ir)||bx(t.array_subqueries)}function mx(e){return Sx(e)}function hx(e){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e))return e.some(hx);let t=e,n=t.Project;if(n&&typeof n==`object`){let e=n.columns;if(Array.isArray(e))for(let t of e){if(!t||typeof t!=`object`)continue;let e=t,n=_x(e.expr??e.source);if(n&&R_(n))return!0}}return Object.values(t).some(hx)}function gx(e){if(!e||typeof e!=`object`)return null;let t=e;return gS(t.left??t.column)}function _x(e){return!e||typeof e!=`object`?null:`Column`in e?gS(e.Column):gS(e)}function vx(e){return Array.isArray(e)?e.some(e=>typeof e==`string`&&R_(Cx(e))):!1}function yx(e){return Array.isArray(e)?e.some(Sx):!1}function bx(e){return Array.isArray(e)?e.some(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return vx(t.select_columns??t.select)||xx(t.filters)||bx(t.nested_arrays)}):!1}function xx(e){return Array.isArray(e)?e.some(Sx):!1}function Sx(e){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e))return e.some(Sx);let t=e;if(typeof t.op==`string`&&typeof t.column==`string`&&R_(Cx(t.column)))return!0;for(let e of[`Eq`,`Ne`,`Gt`,`Ge`,`Lt`,`Le`,`IsNull`,`IsNotNull`,`Contains`]){let n=t[e];if(!n||typeof n!=`object`)continue;let r=n.column;if(typeof r==`string`&&R_(Cx(r)))return!0}let n=gx(t.Cmp)??gx(t.In)??gx(t.IsNull)??gx(t.IsNotNull)??gx(t.Contains);return n&&R_(Cx(n))?!0:Object.entries(t).some(([e,t])=>e!==`Literal`&&Sx(t))}function Cx(e){return P_(e)}function wx(e,t){let n=JSON.parse(e);if(typeof n.table!=`string`)throw Error(`Native runtime only supports table queries in this slice`);return{rootTable:n.table,rootColumns:kx(n.table,t,$x(n.select_columns??n.select),tS(n.array_subqueries,n.table,t)??[])}}function Tx(e,t){if(e&&e.length!==0)return e.map(e=>{let n=t,r,i=e.path.map(e=>{if(`Key`in e)return{Key:Ex(e.Key)};if(!n)throw Error(`native terminal collection path requires subscription output columns`);let t=e.Collection.startsWith(V_)?e.Collection.slice(V_.length):e.Collection,i=n.findIndex(e=>e.name===t),a=n[i]?.column_type;if(a?.type!==`Array`||a.element.type!==`Row`)throw Error(`native terminal operation addressed unknown collection ${t}`);return n=a.element.columns,r=n,{Collection:i}}),a=e.edit;if(`Insert`in a){if(!r)throw Error(`native terminal insert has no collection target`);let t=Ox(a.Insert.key);return{root_key:Ex(e.root_key),path:i,edit:{Insert:{index:a.Insert.index,key:Ex(a.Insert.key),row:dg(t,r,Dx(a.Insert.value))}}}}if(`Update`in a){if(!r)throw Error(`native terminal update has no collection target`);let t=Ox(a.Update.key);return{root_key:Ex(e.root_key),path:i,edit:{Update:{key:Ex(a.Update.key),row:dg(t,r,Dx(a.Update.value))}}}}return`Remove`in a?{root_key:Ex(e.root_key),path:i,edit:{Remove:{key:Ex(a.Remove.key)}}}:{root_key:Ex(e.root_key),path:i,edit:{Move:{key:Ex(a.Move.key),index:a.Move.index}}}})}function Ex(e){return Array.isArray(e)?e:Array.from(e)}function Dx(e){return e instanceof Uint8Array?e:Uint8Array.from(e)}function Ox(e){let t=Dx(e);if(t.length<17||t[0]!==10)throw Error(`terminal key must begin with a UUID row key`);return Mu(t.subarray(1,17))}function kx(e,t,n,r,i=!0){let a=T_(t,e);if(!a)throw Error(`missing schema for subscription table ${e}`);let o=n===void 0,s=(n??a.columns.map(e=>e.name)).map(e=>{let t=a.columns.find(t=>t.name===e);if(t)return o&&i?{...t,sparse:!0}:t;let n=B_(e);return n?{name:e,column_type:n,nullable:e===`$deletedAt`||e.startsWith(`$deletedBy`)}:void 0}).filter(e=>e!==void 0);for(let e of r){let n=kx(e.table,t,e.select,e.nestedArrays??[],!1);s.push({name:e.columnName,column_type:{type:`Array`,element:{type:`Row`,columns:n}},nullable:!1})}return s}function Ax(e){let t=JSON.parse(e);return jx(t.array_subqueries),JSON.stringify(t)}function jx(e){if(Array.isArray(e))for(let t of e){if(!t||typeof t!=`object`)continue;let e=t;if(Array.isArray(e.select_columns)&&Array.isArray(e.nested_arrays))for(let t of e.nested_arrays){if(!t||typeof t!=`object`)continue;let n=t.outer_column;if(typeof n!=`string`)continue;let r=P_(n);($x(e.select_columns)??[]).includes(r)||e.select_columns.push(r)}jx(e.nested_arrays)}}function Mx(e){return new Promise(t=>setTimeout(t,e))}function Nx(e,t){return Kx(t)?Px(e,t):qx(t)?Fx(e,t):null}function Px(e,t){let n=zx(t),r={kind:`rejected`,transactionId:e,code:`transaction_conflict`,reason:/^\(transaction_conflict\):\s*(.*)$/s.exec(n)?.[1]||n,message:n};return Object.defineProperty(r,"message",{enumerable:!1}),r}function Fx(e,t){let n=zx(t),r={kind:`rejected`,transactionId:e,code:Ux(lv(t)),reason:Gx(n,lv(t)),message:n};return Object.defineProperty(r,"message",{enumerable:!1}),r}function Ix(e,t){try{return t()}catch(t){if(qx(t)){let n=zx(t),r=Jx(n)??n,i=lv(t)??(r.startsWith(`authorization_denied:`)?`authorization_denied`:void 0);throw Object.assign(/* @__PURE__ */ Error(`${e} failed: WriteError("${r}")`),{code:Ux(i)})}throw t}}function Lx(e,t){return/* @__PURE__ */ Error(`${e} failed: WriteError("${t.replaceAll(`"`,`\\"`)}")`)}function Rx(e){let t=/^missing required column ([A-Za-z_$][\w$]*)$/.exec(e);return t?`missing required field \`${t[1]}\``:e}function zx(e){if(e instanceof Error)return e.message;if(e&&typeof e==`object`){let t=e.message;if(typeof t==`string`&&t.trim())return t;try{return JSON.stringify(e)}catch{return Object.prototype.toString.call(e)}}return String(e)}function Bx(e=`a store configured as one user serves only its own identity's peers`){return Object.assign(Error(e),{code:`protocol`,reason:`identity_mismatch`})}function Vx(e,t){let n=t instanceof Error?t:Error(zx(t));return Error(`${e}: ${n.message}`,{cause:n})}var Hx={authorization_denied:`permission_denied`,client_clock_too_far_ahead:`client_clock_too_far_ahead`,serialization_conflict:`serialization_conflict`,row_already_deleted:`write_rejected`,row_already_exists:`write_rejected`,row_not_deleted:`write_rejected`,missing_required:`write_rejected`,branch_move:`write_rejected`,missing_chunks:`write_rejected`,predecessor_rejected:`write_rejected`,schema_version_not_deployed:`write_rejected`,identity_mismatch:`write_rejected`,schema_version_unsupported:`write_rejected`};function Ux(e){return e===void 0?`write_rejected`:Hx[e]}var Wx={permission_denied:`Write rejected by server authorization`,serialization_conflict:`Serializable transaction conflicted with another write`,client_clock_too_far_ahead:`Client clock is too far ahead`};function Gx(e,t){let n=Jx(e);return n===null?e:Wx[Ux(t)]??(n||`Write rejected`)}function Kx(e){return sv(e)===`transaction_conflict`}function qx(e){return sv(e)===`write_rejected`}function Jx(e){let t=/^WriteRejected:\s*(.*)$/s.exec(e);return t?t[1]:null}function Yx(e,t){let n=JSON.parse(e);if(typeof n.table!=`string`)throw Error(`Native runtime only supports table queries in this slice`);let r=n.table;if(n.relation_ir!=null){let i=Yg(e);if(!i.relation_ir||typeof i.relation_ir!=`object`)throw Error(`Relation query is missing relation_ir`);return n_(r,[],{relation:i.relation_ir,select:$x(n.select_columns??n.select),partial:Qx(n.select_columns),arraySubqueries:tS(n.array_subqueries,r,t)})}let i=dS(n.conditions);if(!i)throw Y();return n_(r,i.map(e=>Xx(r,e,t)),{limit:yS(n.limit),offset:bS(n.offset),orderBy:eS(n.order_by??n.orderBy),select:$x(n.select_columns??n.select),partial:Qx(n.select_columns),arraySubqueries:tS(n.array_subqueries,r,t)})}function Y(e){let t=e?` (${e})`:``;return/* @__PURE__ */ Error(`Native runtime cannot encode this query shape${t}.`)}function Xx(e,t,n){if(t.op===`All`||t.op===`Any`)return{op:t.op,predicates:t.predicates.map(t=>Xx(e,t,n))};if(t.op===`Not`)return{op:`Not`,predicate:Xx(e,t.predicate,n)};if(x_(e)&&`column`in t){if(t.column===`$transactionId`)throw Error(`History $transactionId predicates do not accept user-provided values`);if(t.column===`$acceptedAt`){if(t.op===`In`)return{op:`Any`,predicates:t.values.map(r=>Xx(e,{column:t.column,op:`Eq`,value:r},n))};if(Zx(t)){let r=cS(e,t.column,t.value,n);if(r.type!==`Timestamp`||!Number.isSafeInteger(r.value))throw Error(`History $acceptedAt predicates require a valid Date or integer milliseconds`);let i=BigInt(r.value)<<18n,a=i+(1n<<18n)-1n,o=(e,n)=>n<0n||n>(1n<<64n)-1n?{op:(n<0n?e===`Gt`||e===`Gte`:e===`Lt`||e===`Lte`)?`All`:`Any`,predicates:[]}:{column:t.column,op:e,value:{type:`U64`,value:n}};switch(t.op){case`Eq`:return{op:`All`,predicates:[o(`Gte`,i),o(`Lte`,a)]};case`Ne`:return{op:`Not`,predicate:{op:`All`,predicates:[o(`Gte`,i),o(`Lte`,a)]}};case`Gt`:return o(`Gt`,a);case`Gte`:return o(`Gte`,i);case`Lt`:return o(`Lt`,i);case`Lte`:return o(`Lte`,a)}}}}if(t.op===`In`){let r=t.column===`id`?{type:`Uuid`}:T_(n,e)?.columns.find(e=>e.name===t.column)?.column_type;return r?.type===`Array`?{op:`Any`,predicates:t.values.map(i=>i.type===`Array`?{column:t.column,op:`Eq`,value:cS(e,t.column,i,n)}:{column:t.column,op:`Contains`,value:lS(i,r.element,!1)})}:{...t,values:t.values.map(r=>cS(e,t.column,r,n))}}if(t.op===`Contains`){let r=t.column===`id`?{type:`Uuid`}:T_(n,e)?.columns.find(e=>e.name===t.column)?.column_type;return{...t,value:r?.type===`Array`?lS(t.value,r.element,!1):cS(e,t.column,t.value,n)}}if(t.op===`IsNull`||t.op===`IsNotNull`)return t;if(Zx(t))return{...t,value:cS(e,t.column,t.value,n)};throw Error(`unsupported query predicate ${JSON.stringify(t)}`)}function Zx(e){return e.op===`Eq`||e.op===`Ne`||e.op===`Gt`||e.op===`Gte`||e.op===`Lt`||e.op===`Lte`}function Qx(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(e.kind===`json_pointer`){if(typeof e.at!=`string`)throw Y(`select_columns`);t.push({column:e.column,kind:`json_pointer`,at:e.at})}else if(e.kind===`bytes`||e.kind===`text_utf16`||e.kind===`text_utf8`){if(typeof e.from!=`number`||typeof e.to!=`number`)throw Y(`select_columns`);t.push({column:e.column,kind:e.kind,from:e.from,to:e.to})}}return t}function $x(e){if(e==null)return;if(!Array.isArray(e))throw Y();let t=[];for(let n of e){if(typeof n==`string`){t.push(n);continue}if(!n||typeof n!=`object`||typeof n.column!=`string`)throw Y();let e=n;if(e.kind!==`full`&&e.kind!==`bytes`&&e.kind!==`text_utf16`&&e.kind!==`text_utf8`&&e.kind!==`json_pointer`)throw Y();t.push(e.column)}return t}function eS(e){if(e==null)return[];if(!Array.isArray(e))throw Y(`order_by`);return e.map(e=>{if(Array.isArray(e)&&e.length===2&&typeof e[0]==`string`){if(e[1]!==`asc`&&e[1]!==`desc`)throw Y(`order_by`);return{column:e[0],direction:e[1]===`asc`?`Asc`:`Desc`}}if(!e||typeof e!=`object`)throw Y(`order_by`);let t=e;if(typeof t.column!=`string`||t.direction!==`Asc`&&t.direction!==`Desc`)throw Y(`order_by`);return{column:t.column,direction:t.direction}})}function tS(e,t,n){if(e!=null){if(!Array.isArray(e))throw Y(`array_subqueries`);return e.map(e=>nS(e,t,n))}}function nS(e,t,n){if(!e||typeof e!=`object`)throw Y(`array_subqueries`);let r=e;if(typeof r.column_name!=`string`||typeof r.table!=`string`||typeof r.inner_column!=`string`||typeof r.outer_column!=`string`)throw Y(`array_subqueries`);if(Array.isArray(r.joins)&&r.joins.length>0)throw Y(`array_subqueries.joins`);let i=rS(r.filters,r.table,n),a=$x(r.select_columns),o=aS(r.order_by),s=tS(r.nested_arrays,r.table,n)??[];return{columnName:r.column_name,table:r.table,innerColumn:r.inner_column,outerColumn:sS(r.outer_column,t),filters:i,select:a,orderBy:o,limit:r.limit==null?null:vS(r.limit),offset:bS(r.offset),requirement:oS(r.requirement),nestedArrays:s}}function rS(e,t,n){if(e==null)return[];if(!Array.isArray(e))throw Y(`array_subqueries.filters`);let r=[];for(let i of e){let e=iS(i);if(!e)throw Y(`array_subqueries.filters`);r.push(...e.map(e=>Xx(t,e,n)))}return r}function iS(e){let t=pS(e);if(t)return[t];if(!e||typeof e!=`object`)return null;let n=e;for(let[e,t]of[[`Eq`,`Eq`],[`Ne`,`Ne`],[`Gt`,`Gt`],[`Ge`,`Gte`],[`Lt`,`Lt`],[`Le`,`Lte`]]){let r=n[e];if(r&&typeof r==`object`){let{column:e,value:n}=r;return typeof e==`string`?[{column:e,op:t,value:mS(n)}]:null}}let r=n.IsNull;if(r&&typeof r==`object`){let e=r.column;return typeof e==`string`?[{column:e,op:`IsNull`}]:null}let i=n.IsNotNull;if(i&&typeof i==`object`){let e=i.column;return typeof e==`string`?[{column:e,op:`IsNotNull`}]:null}let a=n.Contains;if(a&&typeof a==`object`){let{column:e,value:t}=a;return typeof e==`string`?[{column:e,op:`Contains`,value:mS(t)}]:null}return null}function aS(e){if(e==null)return[];if(!Array.isArray(e))throw Y(`array_subqueries.order_by`);return e.map(e=>{if(!Array.isArray(e)||e.length!==2||typeof e[0]!=`string`||e[1]!==`Ascending`&&e[1]!==`Descending`)throw Y(`array_subqueries.order_by`);return{column:e[0],direction:e[1]===`Ascending`?`Asc`:`Desc`}})}function oS(e){if(e==null||e===`Optional`)return`Optional`;if(e===`AtLeastOne`||e===`MatchCorrelationCardinality`)return e;throw Y(`array_subqueries.requirement`)}function sS(e,t){let n=`${t}.`;return e.startsWith(n)?e.slice(n.length):e}function cS(e,t,n,r){let i=t===`id`?{type:`Uuid`}:B_(t)??T_(r,e)?.columns.find(e=>e.name===t)?.column_type;if(i?.type===`Bytea`&&n.type===`Array`)return{type:`Bytea`,value:Uint8Array.from(n.value.map(uS))};if(n.type===`Array`){let i=t===`id`?{type:`Uuid`}:T_(r,e)?.columns.find(e=>e.name===t)?.column_type,a=i?.type===`Array`?i.element:i;return{type:`Array`,value:n.value.map(e=>lS(e,a,!1))}}return lS(n,i,!0)}function lS(e,t,n){if(e.type===`Nullable`)return n&&e.value?{type:`Nullable`,value:lS(e.value,t,!1)}:e;if(t?.type===`Uuid`&&e.type===`Text`&&xS(e.value))return{type:`Uuid`,value:e.value};if(t?.type===`Text`&&e.type===`Uuid`)return{type:`Text`,value:e.value};if(t?.type===`Double`&&e.type===`Integer`)return{type:`Double`,value:e.value};if(t?.type===`BigInt`&&e.type===`Integer`)return{type:`BigInt`,value:Uh(e.value,`BigInt value`)};if(t?.type===`Timestamp`&&e.type===`Integer`)return{type:`Timestamp`,value:e.value};if(t?.type===`Timestamp`&&e.type===`Text`){let t=Date.parse(e.value);if(Number.isFinite(t))return{type:`Timestamp`,value:t}}return t?.type===`Bytea`&&e.type===`Array`?{type:`Bytea`,value:Uint8Array.from(e.value.map(uS))}:t?.type===`Array`&&e.type===`Array`?{type:`Array`,value:e.value.map(e=>lS(e,t.element,!1))}:e}function uS(e){if(e.type!==`Integer`||e.value<0||e.value>255)throw Error(`Bytea values must contain integers in range 0..255`);return e.value}function dS(e){if(e==null)return[];if(!Array.isArray(e))return null;let t=[];for(let n of e){if(!n||typeof n!=`object`)return null;let e=pS(n);if(e){t.push(e);continue}let r=n;if(typeof r.column!=`string`||typeof r.op!=`string`)return null;let i=P_(r.column);switch(r.op){case`eq`:r.value===null?t.push({column:i,op:`IsNull`}):t.push({column:i,op:`Eq`,value:mS(r.value)});break;case`ne`:r.value===null?t.push({column:i,op:`IsNotNull`}):t.push({column:i,op:`Ne`,value:mS(r.value)});break;case`gt`:t.push({column:i,op:`Gt`,value:mS(r.value)});break;case`gte`:t.push({column:i,op:`Gte`,value:mS(r.value)});break;case`lt`:t.push({column:i,op:`Lt`,value:mS(r.value)});break;case`lte`:t.push({column:i,op:`Lte`,value:mS(r.value)});break;case`contains`:t.push({column:i,op:`Contains`,value:mS(r.value)});break;case`isNull`:if(typeof r.value!=`boolean`)return null;t.push({column:i,op:r.value?`IsNull`:`IsNotNull`});break;case`in`:if(!Array.isArray(r.value))return null;t.push({column:i,op:`In`,values:r.value.map(mS)});break;default:return null}}return t}function fS(e){if(e===`True`)return[];if(e===`False`)return[{column:`id`,op:`In`,values:[]}];if(!e||typeof e!=`object`)return null;let t=e;if(Array.isArray(t.And)){let e=[];for(let n of t.And){let t=fS(n);if(!t)return null;e.push(...t)}return e}if(Array.isArray(t.Or))return null;if(t.Not){let e=pS(t.Not);return e?[{op:`Not`,predicate:e}]:null}let n=t.IsNull;if(n&&typeof n==`object`){let e=gS(n.column);return e?[{column:e,op:`IsNull`}]:null}let r=t.IsNotNull;if(r&&typeof r==`object`){let e=gS(r.column);return e?[{column:e,op:`IsNotNull`}]:null}let i=t.Contains;if(i&&typeof i==`object`){let e=i,t=gS(e.left),n=_S(e.right);return t&&n?[{column:t,op:`Contains`,value:n}]:null}let a=t.In;if(a&&typeof a==`object`){let e=a,t=gS(e.left);if(!t||!Array.isArray(e.values))return null;let n=e.values.map(_S);return n.every(e=>e!=null)?[{column:t,op:`In`,values:n}]:null}let o=t.Cmp;if(!o||typeof o!=`object`)return null;let s=o,c=hS(s.op);if(!c)return null;let l=gS(s.left),u=_S(s.right);return l&&u?[{column:l,op:c,value:u}]:null}function pS(e){if(e===`True`)return{op:`All`,predicates:[]};if(e===`False`)return{op:`Any`,predicates:[]};if(!e||typeof e!=`object`)return null;let t=e;if(Array.isArray(t.And)||Array.isArray(t.Or)){let e=Array.isArray(t.And)?`All`:`Any`,n=(t.And??t.Or).map(pS);return n.every(e=>e!==null)?{op:e,predicates:n}:null}if(t.Not){let e=pS(t.Not);return e?{op:`Not`,predicate:e}:null}let n=fS(e);return n?.length===1?n[0]:null}function mS(e){if(e==null)return{type:`Nullable`,value:null};if(typeof e==`boolean`)return{type:`Boolean`,value:e};if(typeof e==`number`&&Number.isSafeInteger(e))return{type:`Integer`,value:e};if(typeof e==`number`&&Number.isFinite(e))return{type:`Double`,value:e};if(typeof e==`bigint`)return{type:`BigInt`,value:e};if(typeof e==`string`)return xS(e)?{type:`Uuid`,value:e}:{type:`Text`,value:e};if(e instanceof Uint8Array)return{type:`Bytea`,value:e};if(Array.isArray(e))return{type:`Array`,value:e.map(mS)};throw Y()}function hS(e){switch(e){case`Eq`:case`Ne`:case`Gt`:case`Gte`:case`Lt`:case`Lte`:return e;case`Ge`:return`Gte`;case`Le`:return`Lte`;default:return null}}function gS(e){if(!e||typeof e!=`object`)return null;let t=e.column;return typeof t==`string`?P_(t):null}function _S(e){if(!e||typeof e!=`object`||!(`Literal`in e))return null;let t=e.Literal;if(!t||typeof t!=`object`)return null;let n=t;if(n.type===`Boolean`&&typeof n.value==`boolean`)return{type:`Boolean`,value:n.value};if(n.type===`Integer`&&typeof n.value==`number`&&Number.isSafeInteger(n.value))return{type:`Integer`,value:n.value};if(n.type===`BigInt`){if(typeof n.value==`string`&&n.value.length<=_b&&vb.test(n.value))try{return{type:`BigInt`,value:Uh(BigInt(n.value),`BigInt value`)}}catch{return null}if(typeof n.value==`bigint`||typeof n.value==`number`&&Number.isSafeInteger(n.value))return{type:`BigInt`,value:BigInt(n.value)}}if(n.type===`Timestamp`&&typeof n.value==`number`&&Number.isSafeInteger(n.value))return{type:`Timestamp`,value:n.value};if(n.type===`Double`&&typeof n.value==`number`&&Number.isFinite(n.value))return{type:`Double`,value:n.value};if(n.type===`Bytea`&&Array.isArray(n.value))return{type:`Bytea`,value:Uint8Array.from(n.value.map(Number))};if(n.type===`Null`)return{type:`Nullable`,value:null};if(n.type===`Array`&&Array.isArray(n.value)){let e=n.value.map(e=>_S({Literal:e}));if(e.every(e=>e!=null))return{type:`Array`,value:e}}return n.type===`Uuid`&&typeof n.value==`string`?{type:`Uuid`,value:n.value}:(n.type===`Text`||n.type===`Enum`)&&typeof n.value==`string`?{type:`Text`,value:n.value}:null}function vS(e){if(typeof e!=`number`||!Number.isSafeInteger(e)||e<0)throw Error(`query limit must be a non-negative safe integer`);return e}function yS(e){return e==null?void 0:vS(e)}function bS(e){if(e==null)return 0;if(typeof e!=`number`||!Number.isSafeInteger(e)||e<0)throw Error(`query offset must be a non-negative safe integer`);return e}function xS(e){return/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(e)}function SS(e,t,n){return DS(e.columns,t,n),ES(e.columns.filter(e=>Object.hasOwn(t,e.name)),e=>t[e.name],!0)}function CS(e,t,n,r){return DS(e.columns.filter(e=>e.name!==n),t,r),ES(e.columns.filter(e=>e.name!==n&&Object.hasOwn(t,e.name)),e=>t[e.name],!0)}function wS(e,t,n){return ES(e.columns.filter(e=>e.name!==n&&Object.hasOwn(t,e.name)),e=>t[e.name],!1)}function TS(e,t){return ES(e.columns.filter(e=>Object.hasOwn(t,e.name)),e=>t[e.name],!1)}function ES(e,t,n){let r=[...e].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({name:e.name,valueType:jg(e),column:e})),i=r.map(({column:e})=>OS(e,t(e),n)),a=new h_;return ng(a,r),a.bytes(og(r,i)),a.finish()}function DS(e,t,n){for(let r of e){let e=t[r.name]??r.default;if(!(e&&e.type!==`Null`)&&!r.nullable)throw Error(n?`encoding error: missing required field \`${r.name}\` on table \`${n}\``:`missing required column ${r.name}`)}}function OS(e,t,n){let r=t;if(!r){if(e.nullable)return Tg(jg(e));if(n&&e.default==null)throw Error(`missing required column ${e.name}`);return/* @__PURE__ */ new Uint8Array}return Cg(e,r)}function kS(e){return new g_(e).readVec(Kh)}function AS(e){return $h(new g_(e))}function jS(e,t,n,r=`full-record`){let i=[];for(let a of e){let e=MS(a,t,n),o=gg(a.descriptor);for(let t of a.rows){let n=[],s=/* @__PURE__ */ new Map;for(let i of e){let e=zS(i,o,t.raw,r);s.set(i.name,e),i.includeInValues&&n.push(e)}i.push(cg({table:a.table,id:Mu(t.rowId),values:n},s))}}return i}function MS(e,t,n){let r=Ab.get(t);r||(r=/* @__PURE__ */ new Map,Ab.set(t,r));let i=iv(e),a=n?void 0:r.get(i);if(a)return a;let o=n??T_(t,e.table)?.columns??[],s=new Map(o.map(e=>[e.name,e])),c=n?new Set(n.map(e=>e.name)):null,l=[];for(let t=0;t<e.descriptor.length;t+=1){let n=e.descriptor[t],r=n&&Gh(n);if(!r)continue;let i=B_(r)??s.get(r)?.column_type;l.push({name:r,index:t,type:i,storageType:e.descriptor[t].valueType,includeInValues:!iC(r)&&(!z_(r)||c?.has(r)===!0)})}return n||r.set(i,l),l}function NS(e,t,n,r=`full-record`){return FS(jS(e.rows,t,n,r),t).slice(0,e.rootCount)}var PS=/* @__PURE__ */ new Set([`table`,`layer`,`schema_version`,`parents`,`created_by`,`created_at`,`updated_by`,`updated_at`]);function FS(e,t){return e.map(e=>{if(!e.valuesByColumn)return e;let n=new Set((T_(t,e.table)?.columns??[]).map(e=>e.name)),r=new Map(e.valuesByColumn),i=/* @__PURE__ */ new Set;for(let e of PS){if(n.has(e))continue;let t=r.get(e);t&&(i.add(t),r.delete(e))}return i.size===0?e:cg({...e,values:e.values.filter(e=>!i.has(e))},r)})}function IS(e,t,n=!1,r=null,i=!1){let a=(e,n,i,a)=>{let o=RS(e,t,r,`full-record`);if(o.length!==n.length)throw Error(`subscription occurrence sidecar length mismatch`);return o.flatMap((e,o)=>{if(r&&e.table!==r.rootTable)return[];let s=a?.[o];return[{sourceId:e.id,occurrenceKey:n[o],index:i[o],row:XS(e,t,r),...s&&s.length>0?{splices:LS(s,t,e.table)}:{}}]})};return{added:a(e.added,e.addedOccurrenceKeys,e.addedIndices),updated:a(e.updated,e.updatedOccurrenceKeys,e.updatedIndices,e.updatedSplices),removed:e.removed.flatMap((t,n)=>r&&t.table!==r.rootTable?[]:[{sourceId:Mu(t.rowId),occurrenceKey:e.removedOccurrenceKeys[n],index:e.removedIndices[n]}]),...n?{reset:!0}:{},...n&&i?{reason:`backlog`}:{}}}function LS(e,t,n){let r=T_(t,n)?.columns??[],i={};for(let{column:t,splices:n}of e){let e=r.find(e=>e.name===t)?.column_type.type;if(e===`Text`)i[t]=n.map(e=>({at:e.atUtf16,delete:e.deleteUtf16,insert:kb.decode(e.insert)}));else if(e===`Bytea`)i[t]=n.map(e=>({at:e.at,delete:e.delete,insert:e.insert}));else throw Error(`subscription splices for column "${t}" of type ${e} are not supported yet`)}return i}function RS(e,t,n,r){return e.flatMap(e=>jS([e],t,e.table===n?.rootTable?n.rootColumns:void 0,r))}function zS(e,t,n,r){let i=t(n,e.index);if(i==null)return{type:`Null`};if(!e.type)return{type:`Bytea`,value:i};try{return BS(e.type,i,e.name,e.storageType,r)}catch(t){throw Error(`${String(t)} while decoding ${e.name} as ${e.type.type} from storage tag ${e.storageType.tag} (${i.byteLength} bytes)`)}}function BS(e,t,n,r,i=`full-record`){let a=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(e.type){case`Boolean`:return{type:`Boolean`,value:t[0]!==0};case`Integer`:return{type:`Integer`,value:a.getInt32(0,!0)};case`BigInt`:return{type:`BigInt`,value:VS(r)?.tag===3?a.getBigUint64(0,!0):a.getBigInt64(0,!0)};case`Double`:return{type:`Double`,value:a.getFloat64(0,!0)};case`Timestamp`:return{type:`Timestamp`,value:Number(a.getBigUint64(0,!0))};case`Text`:case`Json`:case`Enum`:if(t[0]!==0)throw Error(`indirect scalar crossed a logical binding boundary`);return{type:`Text`,value:kb.decode(t.subarray(1))};case`Uuid`:return{type:`Uuid`,value:Mu(t)};case`Bytea`:if(t[0]!==0)throw Error(`indirect scalar crossed a logical binding boundary`);return{type:`Bytea`,value:t.subarray(1).slice()};case`Array`:return{type:`Array`,value:GS(e.element,t,HS(r),i)};case`Row`:{let a={type:`Row`,value:WS(e.columns,t,US(r),i)};return(n===`$createdBy`||n===`$updatedBy`)&&tu(a),a}}}function VS(e){let t=e;for(;t?.tag===15;)t=t.inner;return t}function HS(e){let t=VS(e);return t?.tag===14?t.inner:void 0}function US(e){let t=VS(e);return t?.tag===16?t.record:void 0}function WS(e,t,n,r=`full-record`){if(n){let i=r===`keyed-terminal`;if(i&&n[0]?.name!==`row_uuid`)throw Error(`keyed terminal nested row descriptor must start with row_uuid`);if(i&&t.byteLength<16)throw Error(`terminal nested row is missing its key`);let a=i?n.slice(1):n,o=i?t.subarray(16):t,s=gg(a),c=new Map(e.map(e=>[e.name,e])),l=/* @__PURE__ */ new Map,u=i?Mu(t.subarray(0,16)):void 0;for(let e=0;e<a.length;e+=1){let t=a[e]?.name;if(!t)continue;let n=s(o,e);if(!i&&t===`row_uuid`&&n){u=Mu(n);continue}let d=c.get(t);d&&l.set(t,n==null?{type:`Null`}:BS(d.column_type,n,t,a[e]?.valueType,r))}let d=e.map(e=>l.get(e.name)??(e.column_type.type===`Array`?{type:`Array`,value:[]}:{type:`Null`}));return cg({id:u,values:d},l)}if(t.byteLength<5)throw Error(`invalid nested row value`);let i=t[0]===1,a=1,o;if(i){if(t.byteLength<21)throw Error(`invalid nested row id`);o=Mu(t.subarray(a,a+16)),a+=16}let s=nC(t,a);a+=4;let c=t.subarray(a,a+s);if(c.byteLength!==s)throw Error(`invalid nested row value length`);return{id:o,values:sg(e,c)}}function GS(e,t,n,r=`full-record`){let i=Vg(n??Ng(e));if(i!=null){if(i===0)return[];if(t.length%i!==0)throw Error(`invalid fixed-width array byte length ${t.length}`);let a=[];for(let o=0;o<t.length;o+=i)a.push(BS(e,t.subarray(o,o+i),void 0,n,r));return a}if(t.length<4)throw Error(`invalid variable-width array byte length`);let a=nC(t,0),o=4+Math.max(0,a-1)*4;if(o>t.length)throw Error(`invalid variable-width array offset table`);let s=[];for(let i=0;i<a;i+=1){let c=i===0?o:nC(t,4+(i-1)*4),l=i===a-1?t.length:nC(t,4+i*4);if(c>l||l>t.length)throw Error(`invalid variable-width array element offset`);s.push(BS(e,t.subarray(c,l),void 0,n,r))}return s}function KS(e){if(!e||typeof e!=`object`)throw Error(`expected subscription chunk`);let t=e;if(t.type===`closed`||t.type===`Closed`)return{type:`closed`};if(t.type===`delta`||t.type===`Delta`)return{type:`delta`,reset:t.reset===!0,coalesced:t.coalesced===!0,delta:Xh(new g_(aC(t.delta,`subscription delta`))),terminalOperations:Array.isArray(t.terminalOperations)?t.terminalOperations:void 0};if(t.type===`rejected`||t.type===`Rejected`)return{type:`rejected`,reason:qS(t.reason)};throw Error(`unknown subscription chunk`)}function qS(e){if(!e||typeof e!=`object`)throw Error(`expected subscription rejection reason`);let t=e;if(t.type===`UnsupportedShapeCapability`&&typeof t.detail==`string`)return{type:`UnsupportedShapeCapability`,detail:t.detail};if(t.type===`ShapeRegistrationPendingCatalogueAdmission`)return{type:`ShapeRegistrationPendingCatalogueAdmission`};let n=t.code??t.detail;if(t.type===`ServerFailure`&&typeof n==`string`)return typeof t.errorCode==`string`?{type:`ServerFailure`,code:n,errorCode:t.errorCode}:{type:`ServerFailure`,code:n};if(t.type===`InvalidAuthoritySourceClosure`&&typeof t.transition==`string`)return{type:`InvalidAuthoritySourceClosure`,transition:t.transition};throw Error(`unknown subscription rejection reason`)}function JS(e){let t=e.type===`UnsupportedShapeCapability`?e.detail:e.type===`ServerFailure`?e.code:e.type===`InvalidAuthoritySourceClosure`?e.transition:`catalogue admission pending`,n=`Subscription rejected: ${e.type}: ${t}`,r=e.type===`ServerFailure`?e.errorCode:void 0;return r===void 0?Error(n):k_({code:r,message:n})??Error(n)}function YS(e){let t=e;if(typeof t.getReader==`function`){let e=t.getReader();return{pull(t,n){e.read().then(e=>t(e.done?{type:`closed`}:{type:`batch`,events:[e.value]}),n)},close(){e.cancel().catch(()=>{})}}}let n=e;return{joinPool:n.joinPool?e=>n.joinPool(e):void 0,pull(){let e=n.readAll();return Array.isArray(e)?{type:`batch`,events:e}:{type:`pending`,retryAfterMs:e.retryAfterMs?.()??0}},close(){n.close?.()}}}function XS(e,t,n=null){let r=n&&e.table===n.rootTable?n.rootColumns:t?.[e.table]?.columns,i=r?Mg(r):void 0;if(!i)throw Error(`missing schema for subscription row table ${e.table}`);let a=$S(e,i).map((e,t)=>ZS(e,i[t].column_type));return cg({id:e.id,values:a},lg(i,a))}function ZS(e,t){return e.type===`Null`?e:t.type===`Array`&&e.type===`Array`?{type:`Array`,value:e.value.map(e=>ZS(e,t.element))}:t.type===`Row`&&e.type===`Row`?{type:`Row`,value:QS(e.value,t.columns)}:e}function QS(e,t){let n=e.valuesByColumn,r=t.map((t,r)=>ZS(n?.get(t.name)??e.values[r]??(t.column_type.type===`Array`?{type:`Array`,value:[]}:{type:`Null`}),t.column_type));return cg({id:e.id,values:r},lg(t,r))}function $S(e,t){if(!e.valuesByColumn)return e.values.slice(0,t.length);let n=[];n.length=t.length;for(let r=0;r<t.length;r+=1){let i=t[r],a=e.valuesByColumn.get(i.name)??(i.column_type.type===`Array`?{type:`Array`,value:[]}:{type:`Null`});n[r]=a}return n}function eC(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function tC(e){let t=ju(e);if(!t)throw Error(`invalid uuid ${e}`);return t}function nC(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function rC(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function iC(e){return e.startsWith(V_)}function aC(e,t){if(e instanceof Uint8Array)return e;if(Array.isArray(e))return Uint8Array.from(e);throw Error(`expected ${t} bytes`)}function oC(e){queueMicrotask(()=>{throw e})}function sC(e,t,n){for(let r of e)n(r,t)}function cC(e,t,n){if(e===t)return`admit`;try{let{authClass:r,schemaHash:i,...a}=JSON.parse(e),{authClass:o,schemaHash:s,...c}=JSON.parse(t);if(JSON.stringify(a)!==JSON.stringify(c))return`incompatible`;let l=Object.keys(n).length===0;return i!==s&&!l?`held-by-another-build`:r===o?`admit`:`held-by-another-sign-in`}catch{return`incompatible`}}function lC(e,t){let n=e=>new Set((e?.schemas??[]).map(e=>e.hash)),r=n(e),i=n(t);if(r.size===0||i.size===0)return`unknown`;let a=(e,t)=>e.size>t.size&&[...t].every(t=>e.has(t));return a(i,r)?`newer`:a(r,i)?`older`:`unknown`}Error.stackTraceLimit=50;var uC=`warn`;function dC(e,t){let n=e.context.options;if(!e.inspectorAttachment||!t||t.appId!==n.appId||t.physicalDbName!==n.dbName||t.authSessionKey!==n.authSessionKey||t.storageOwner!==n.storageOwner)throw Error(`Inspector attachment does not match the worker account and storage scope`)}function fC(e){if(e===null||typeof e==`boolean`||typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`)return Number.isFinite(e)?JSON.stringify(e):`null`;if(Array.isArray(e))return`[${e.map(fC).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${fC(t[e])}`).join(`,`)}}`}return`null`}function pC(e,t){if(fC(t)!==fC(e.options.sessionClaims))throw Error(`Browser tab claims differ from the persistent worker's authenticated upstream session`)}async function mC(e,t){await Promise.all([...e.peers.values()].map(e=>e.subscriber?.updateAuthenticatedClaims?.(t))),e.options.sessionClaims=t}var hC=globalThis,gC=crypto.randomUUID(),_C=null,X=/* @__PURE__ */ new Map,vC=/* @__PURE__ */ new Map,Z=/* @__PURE__ */ new Map,yC=/* @__PURE__ */ new Map,bC=/* @__PURE__ */ new Map,xC=/* @__PURE__ */ new Set,SC=null,CC=null,wC=Promise.resolve(),TC=1,EC=0,DC=null,OC=!1,kC=[],AC=1,jC=128;function MC(e,t,n){return e.filter(e=>e.authSessionKey===t&&n.has(e.dbName)).map(({authSessionKey:e,...t})=>t)}function NC(e,t,n,r={}){let i=[...Z.values()].reduce((e,t)=>e+t.activeLeaseIds.size,0);kC.push({sequence:AC++,event:e,dbName:t,authSessionKey:n,peerCount:[...X.values()].reduce((e,t)=>e+t.peers.size,0),pendingBootstraps:EC,activeLeases:i,...r}),kC.length>jC&&kC.splice(0,kC.length-jC)}async function PC(e,t){let n=yC.get(e);if(n){if(n.release)return await n.release,await PC(e,t);if(n.storageOwner!==t)throw Error(`IndexedDB database ${e} is already owned by a different Jazz browser session; choose a different driver.dbName or reset this database before changing accounts`);return n}let r=bC.get(e);if(r){let n=await r;if(n.storageOwner!==t)throw Error(`IndexedDB database ${e} is already owned by a different Jazz browser session; choose a different driver.dbName or reset this database before changing accounts`);return n}let i=FC(e,t);bC.set(e,i);try{return await i}finally{bC.get(e)===i&&bC.delete(e)}}async function FC(e,t){let n=await Kp(e),r=null;try{r=await xm.open(e,{owner:t}),await r.claimBrowserWorkerEpoch(n.id,n);let i={epoch:n,pageStore:r,storageOwner:t,release:null,disposeInvalidation:null};return yC.set(e,i),i.disposeInvalidation=r.onInvalidated(()=>LC(e)),i}catch(e){throw r?.close(),await n.release(),e}}async function IC(e){let t=yC.get(e);t&&(t.release||=(async()=>{try{await t.pageStore.releaseBrowserWorkerEpoch(t.epoch.id)}finally{t.disposeInvalidation?.(),t.disposeInvalidation=null,t.pageStore.close(),await t.epoch.release(),vC.get(e)===t&&vC.delete(e),yC.delete(e)}})(),await t.release)}function LC(e){Z.delete(e),IC(e).catch(()=>{}).finally(()=>xw())}function RC(e={}){_C=e.foregroundLeaseTestHooks??null,hC.onconnect=e=>{let t=e.ports[0];t&&zC(t)}}function zC(e,t){EC+=1;let n=!1,r=!1,i=null,a=!1,o=!1,s=new AbortController,c=setTimeout(()=>d(),3e4),l=()=>{n||(n=!0,clearTimeout(c),--EC,xw(),WC())},u=()=>{e.removeEventListener(`message`,f),e.removeEventListener(`messageerror`,p)},d=()=>{r||(r=!0,s.abort(),u(),l(),e.close())};function f(n){let r=n.data;if(r?.type===`cancel-runtime-bootstrap`&&o)s.abort(),$(e,{type:`runtime-bootstrap-cancelled`}),u(),l();else if(!a){if(t&&(r.type===`connect-runtime`||r.type===`acquire-foreground-node-lease`&&(r.dbName!==t.dbName||r.storageOwner!==t.storageOwner))){$(e,{type:`foreground-node-lease-error`,error:J(/* @__PURE__ */ Error(`Inspector lease cannot select another storage scope`))}),d();return}if(OC){r?.type===`connect-runtime`?$(e,{type:`worker-closing`}):r?.type===`delete-store`?$(e,{type:`delete-store-result`,outcome:`held`}):(r?.type===`probe-foreground-node-lease-worker`||r?.type===`acquire-foreground-node-lease`)&&$(e,{type:`foreground-node-lease-worker-closing`,attemptId:r.attemptId??``}),d();return}if(r?.type===`probe-foreground-node-lease-worker`){i=r.attemptId,$(e,{type:`foreground-node-lease-worker-alive`,attemptId:r.attemptId}),r.wasmPrefetch&&JC(r.wasmPrefetch.runtimeSources);return}if(r?.type===`cancel-foreground-node-lease`){d();return}if(r?.type===`delete-store`){if(t){d();return}a=!0,clearTimeout(c),NC(`delete-store`,r.dbName,null),BC(r.dbName,r.runtimeSources).then(t=>$(e,{type:`delete-store-result`,outcome:t}),t=>$(e,{type:`delete-store-error`,error:J(Vl(t))})).finally(d);return}if(r?.type===`connect-runtime`||r?.type===`acquire-foreground-node-lease`){if(a=!0,clearTimeout(c),r.type===`connect-runtime`)o=!0,NC(`bootstrap-start`,r.options.dbName,r.options.authSessionKey),$(e,{type:`worker-alive`}),GC(e,r,s.signal,()=>{u(),l()});else{if(u(),i!==null&&r.attemptId!==i){l(),$(e,{type:`foreground-node-lease-error`,error:J(/* @__PURE__ */ Error(`Foreground node lease request did not match its worker probe`))}),d();return}NC(`lease-request`,r.dbName,null),VC(e,r,s.signal).finally(l)}}}}function p(){d()}return e.addEventListener(`message`,f),e.addEventListener(`messageerror`,p),e.start(),()=>{s.abort(),a||d()}}async function BC(e,t){for(let t of[...X.values()])if(t.options.dbName===e){if(t.peers.size!==0||t.pendingAdmissionTasks!==0)return`held`;await yw(t)}let n=Z.get(e);if([...X.values()].some(t=>t.options.dbName===e)||bC.has(e)||n&&(n.pendingLeaseAllocations>0||n.pendingLeaseFinalizations>0))return`held`;vC.delete(e),await IC(e).catch(()=>{}),n&&(Z.delete(e),n.pageStore.close());let r;try{r=await Kp(e)}catch(e){if(e instanceof Up)return`held`;throw e}try{await xm.destroy(e),await(await YC(t)).WasmDb.destroyBrowserStorage(void 0,e)}finally{await r.release()}return`deleted`}async function VC(e,t,n){let r=_C,i=null,a=null,o=null,s=!1,c=null,l=!1,u=()=>{n?.removeEventListener(`abort`,g),e.removeEventListener(`message`,m),e.removeEventListener(`messageerror`,h)},d=async t=>{if(!l){if(!i){if(t===void 0)return;l=!0,$(e,{type:`foreground-node-lease-cancelled`,error:J(t)}),u(),e.close(),xw();return}if(await o?.catch(()=>{}),!l){if(!a){l=!0,$(e,{type:`foreground-node-lease-cancelled`}),u(),e.close(),xw();return}l=!0;try{await UC(i,a.leaseId);let t=r?await r.cancellationRetired(i.pageStore,a.node):void 0;$(e,{type:`foreground-node-lease-cancelled`,...t===void 0?{}:{testLeaseState:t}})}catch(t){$(e,{type:`foreground-node-lease-cancelled`,error:J(Error(`Shared browser foreground lease cancellation failed`,{cause:Vl(t)}))})}finally{u(),e.close(),xw()}}}},f=e=>(l||(s=!0,(i||e!==void 0)&&!c&&(c=d(e))),c),p=async()=>{l||!a||!i||(l=!0,await UC(i,a.leaseId))},m=t=>{(async()=>{let n=t.data;try{if(n?.type===`cancel-foreground-node-lease`){f();return}if(!a||!i||l||s)return;if(n?.type===`return-foreground-node-lease`){if(!/^(0|[1-9][0-9]*)$/.test(n.confirmedTxTime))throw Error(`Invalid foreground node lease high-water`);let t=BigInt(n.confirmedTxTime);if(t>(1n<<64n)-1n)throw Error(`Invalid foreground node lease high-water`);await i.pageStore.returnForegroundNodeLease(a.leaseId,t),l=!0,i.activeLeaseIds.delete(a.leaseId),$(e,{type:`foreground-node-lease-result`}),u(),e.close(),xw();return}n?.type===`retire-foreground-node-lease`&&(await p(),$(e,{type:`foreground-node-lease-result`}),u(),e.close())}catch(t){await p().catch(()=>{}),$(e,{type:`foreground-node-lease-result`,error:J(t)}),u(),e.close()}})()},h=()=>{f()},g=()=>{f()};n?.addEventListener(`abort`,g,{once:!0}),n?.aborted&&g(),e.addEventListener(`message`,m),e.addEventListener(`messageerror`,h);try{if(i=Z.get(t.dbName)??null,!i){let e=await PC(t.dbName,t.storageOwner);i=Z.get(t.dbName)??null,i||(i={pageStore:e.pageStore,storageOwner:t.storageOwner,activeLeaseIds:/* @__PURE__ */ new Set,pendingLeaseAllocations:0,pendingLeaseFinalizations:0,allocationTail:Promise.resolve()},Z.set(t.dbName,i))}if(i.storageOwner!==t.storageOwner)throw Error(`IndexedDB database ${t.dbName} is already owned by a different Jazz browser session; choose a different driver.dbName or reset this database before changing accounts`);if(s){await f();return}let c=HC(i,t,e,r);if(o=(async()=>{let n=await c,i=r?.delayAfterLeaseAllocation(t);if(i!==void 0){if(!Number.isSafeInteger(i)||i<0||i>1e3)throw Error(`Invalid foreground lease test delay`);r?.allocationCommitted(e,n.node.slice(),gC),await new Promise(e=>setTimeout(e,i))}return n})(),a=await o,s){await f();return}n?.removeEventListener(`abort`,g),NC(`lease-admitted`,t.dbName,null),$(e,{type:`foreground-node-lease-ready`,workerRealmId:gC,leaseId:a.leaseId,node:a.node,confirmedTxTime:a.confirmedTxTime.toString()})}catch(t){if(s){await f(t);return}u(),t instanceof Up?$(e,{type:`foreground-node-lease-busy`,message:t.message}):$(e,{type:`foreground-node-lease-error`,error:J(t)}),e.close()}}async function HC(e,t,n,r){e.pendingLeaseAllocations+=1;let i=e.allocationTail,a;e.allocationTail=new Promise(e=>{a=e}),await i;try{let i=r?.delayBeforeLeaseAllocation(t);if(i!==void 0){if(!Number.isSafeInteger(i)||i<0||i>1e3)throw Error(`Invalid foreground lease test delay`);r?.allocationQueued(n),await new Promise(e=>setTimeout(e,i))}let a=await e.pageStore.acquireForegroundNodeLease(e.activeLeaseIds.size===0);return e.activeLeaseIds.add(a.leaseId),a}finally{--e.pendingLeaseAllocations,a(),xw()}}async function UC(e,t){e.pendingLeaseFinalizations+=1,e.activeLeaseIds.delete(t);try{await e.pageStore.retireForegroundNodeLease(t)}catch(n){throw e.activeLeaseIds.add(t),n}finally{--e.pendingLeaseFinalizations,xw()}}function WC(){if(EC===0)for(let[e,t]of vC){if(yC.get(e)!==t||X.has(e)){vC.delete(e);continue}let n=Z.get(e);n&&(n.activeLeaseIds.size>0||n.pendingLeaseAllocations>0||n.pendingLeaseFinalizations>0)||(vC.delete(e),Z.delete(e),IC(e).catch(()=>{}))}}async function GC(e,t,n,r){let i=Symbol(`runtime-admission`),a,o=!1,s=()=>{o&&(o=!1,a?.admissionClaims.delete(i))},c=()=>{if(n.throwIfAborted(),a&&(a.closing||X.get(a.key)!==a))throw Error(`Shared browser runtime context closed during initialization`)};n.addEventListener(`abort`,s,{once:!0});try{c();let n=Mw(t.options),l=X.get(n);if(l?.closing&&(await l.closing,c(),l=X.get(n)),l&&l.options.storageOwner!==t.options.storageOwner)throw Error(`IndexedDB database ${t.options.dbName} is already owned by a different Jazz browser session; choose a different driver.dbName or reset this database before changing accounts`);if(l&&!jw(l.options,t.options))throw Error(`incompatible persistent browser telemetry configuration`);let u=l?cC(l.fingerprint,t.fingerprint,t.options.schema):`admit`;if(l?.newerBuildHandoff&&u===`admit`)throw Error(bh);if(l&&u===`held-by-another-build`){let e=lC(l.options.migrations,t.options.migrations);if(e===`older`)throw Error(bh);e===`newer`&&(await vw(l),c(),l=X.get(n),u=l?cC(l.fingerprint,t.fingerprint,t.options.schema):`admit`)}if(u!==`admit`)throw Error(u===`held-by-another-sign-in`?vh:u===`held-by-another-build`?yh:`incompatible persistent browser configuration`);l?.idleReleaseTimer&&(clearTimeout(l.idleReleaseTimer),l.idleReleaseTimer=null),l||(l=KC(n,t.fingerprint,t.options),X.set(n,l)),a=l,l.admissionClaims.add(i),o=!0,l.pendingAdmissionTasks+=1,await l.initialize,c(),await tw(l,()=>(c(),QC(l,t.options))),c(),aw(l,t.tabId,e,t.options.author),s(),r(),$(e,{type:`runtime-ready`})}catch(t){r(),n.aborted||($(e,{type:`runtime-error`,error:J(t)}),e.close())}finally{if(n.removeEventListener(`abort`,s),s(),a&&(--a.pendingAdmissionTasks,a.pendingAdmissionTasks===0&&a.admissionClaims.size===0&&a.peers.size===0)){let e=yC.get(t.options.dbName);await yw(a),e&&yC.get(t.options.dbName)===e&&vC.set(t.options.dbName,e),WC(),xw()}}}function KC(e,t,n){let r={key:e,fingerprint:t,options:n,peers:/* @__PURE__ */ new Map,admissionClaims:/* @__PURE__ */ new Set,pendingAdmissionTasks:0,runtime:null,pageStore:null,disposePageStoreInvalidation:null,disposeTelemetry:null,disposeAuxiliaryTrace:null,resetBarrier:null,storageInvalidated:!1,intentionalStorageReset:!1,serverUrl:n.serverUrl??null,serverAuthJson:n.authJson,serverConnectionStarted:!1,explicitlyDisconnected:!1,transportTransition:Promise.resolve(),transportStateEpoch:0,transportStateWaiters:/* @__PURE__ */ new Set,authFailureEpoch:0,authFailure:null,linkFate:null,storageFailure:null,initialize:Promise.resolve(),closing:null,newerBuildHandoff:null,idleReleaseTimer:null},i=wC.then(()=>qC(r));return wC=i.catch(()=>{}),r.initialize=i,r}async function qC(e){let t=null;try{let{options:n}=e;e.pageStore=(await PC(n.dbName,n.storageOwner)).pageStore,e.disposePageStoreInvalidation=e.pageStore.onInvalidated(()=>Tw(e)),hC.__JAZZ_WASM_LOG_LEVEL=n.logLevel??uC;let r=await YC(n.runtimeSources);e.disposeTelemetry=$m({wasmModule:r,collectorUrl:n.telemetryCollectorUrl,runtimeThread:`worker`});let i=e.pageStore.replicaNode,a=rv(n.schema),o=n.selfSignedClientProof,s=e_(i,n.author,1,!1,n.initialSyncFlushEvery,o,n.migrations);if(o&&typeof r.WasmDb.openBrowserWithSelfSignedProof!=`function`)throw Error(`WASM runtime does not support self-signed client opens; rebuild the matching Jazz WASM artifact`);t=o?await r.WasmDb.openBrowserWithSelfSignedProof(e.pageStore,a,s,o.token,o.appId,o.claimedAuthor,n.dbName):await r.WasmDb.openBrowser(e.pageStore,a,s,n.dbName);let c=Ib.fromDb(t,n.schema,i,n.author,1,!1,{selfSignedClientProof:o,scopeIsolatedRelay:!0,slowQueryLog:{appId:n.appId,thresholdMs:n.slowQueryThresholdMs,consoleDetail:`summary`},subscriptionBacklogRows:n.subscriptionBacklogRows});e.runtime=c,e.linkFate=null,e.authFailure=null,t=null,e.runtime.onAuthFailure(t=>{e.authFailureEpoch+=1,e.authFailure=t,fw(e)}),e.runtime.onStorageFailure(t=>{e.storageFailure=t,mw(e,{type:`storage-failure`,message:t})}),e.runtime.onMutationError(t=>{sC(e.peers.values(),t,(e,t)=>$(e.port,{type:`mutation-error`,event:t}))});let l=()=>{e.runtime===c&&fw(e)};c.onRemoteLinkStateChange(l,new AbortController().signal),c.onUpstreamLinkStatusChange(l,new AbortController().signal),c.onServerTransportError(l),n.logLevel===`trace`&&(e.disposeAuxiliaryTrace=e.runtime.onAuxiliaryTrace(t=>{mw(e,{type:`relay-trace`,entries:t.map(e=>({...e,hop:`worker-server`}))})}))}catch(n){try{await t?.close()}catch{}try{ZC(e)}catch{}throw n}}function JC(e){SC||e?.wasmModule||e?.wasmSource||YC(e).catch(()=>{})}async function YC(e){let t=XC(e);if(SC&&(!t||CC!==t))throw Error(`incompatible WASM asset source for this SharedWorker; start a worker scoped to the new asset URL`);let n=SC??Rp(e);SC=n,CC=t;try{return await n}catch(e){throw SC===n&&(SC=null,CC=null),e}}function XC(e){return e?.wasmModule?e.workerWasmAssetIdentity?`module:${e.workerWasmAssetIdentity}`:null:e?.wasmSource?e.workerWasmAssetIdentity?`source:${e.workerWasmAssetIdentity}`:null:e?.wasmUrl??`worker-local`}function ZC(e){let t=e.runtime,n=e.disposePageStoreInvalidation,r=e.disposeTelemetry,i=e.disposeAuxiliaryTrace;e.runtime=null,e.pageStore=null,e.disposePageStoreInvalidation=null,e.disposeTelemetry=null,e.disposeAuxiliaryTrace=null,X.get(e.key)===e&&X.delete(e.key);try{t?.discard()}finally{try{n?.()}finally{try{r?.()}finally{i?.()}}}xw()}async function QC(e,t){let n=t.serverUrl??null;if(e.serverUrl===n){if(!$C(t.authJson)&&$C(e.serverAuthJson))return;e.runtime?.assertCredentialKeepsPrincipal(t.authJson),e.serverAuthJson=t.authJson,e.serverConnectionStarted&&await hw(e).updateAuth(t.authJson)}else{if(e.peers.size>0)throw Error(`incompatible persistent browser server configuration`);e.serverConnectionStarted&&=(await hw(e).disconnect({rejectWaiters:!1}),!1),e.serverUrl=n,e.serverAuthJson=t.authJson}}function $C(e){try{let t=JSON.parse(e);return!!t&&(typeof t.jwt_token==`string`||typeof t.admin_secret==`string`||typeof t.backend_secret==`string`||t.backend_session!=null)}catch{return!1}}function ew(e){let t=e.serverUrl;t||e.runtime?.setRemoteLinkHint(`none`),t&&!e.explicitlyDisconnected&&(e.serverConnectionStarted||$C(e.serverAuthJson)&&(hw(e).connect(t,e.serverAuthJson),e.serverConnectionStarted=!0))}function tw(e,t){let n=e.transportTransition.then(t,t);return e.transportTransition=n.catch(()=>{}),n}function nw(e){e.transportStateEpoch+=1,mw(e,{type:`transport-state`,explicitlyDisconnected:e.explicitlyDisconnected});let t=[...e.transportStateWaiters];e.transportStateWaiters.clear();for(let e of t)e()}function rw(e,t,n){return e.transportStateEpoch!==t||n?.aborted?Promise.resolve():new Promise(t=>{let r=()=>{e.transportStateWaiters.delete(r),n?.removeEventListener(`abort`,r),t()};n?.addEventListener(`abort`,r,{once:!0}),e.transportStateWaiters.add(r)})}async function iw(e,t,n){for(;;){if(n?.aborted||(await e.transportTransition,n?.aborted))return;if(e.explicitlyDisconnected){let t=e.transportStateEpoch;await rw(e,t,n)}else if(await t.waitForUpstreamServerConnection(),!e.explicitlyDisconnected)return}}function aw(e,t,n,r,i=!1){uw(e,t);let a,o=e=>{sw(a,e.data)},s=()=>uw(e,t);a={tabId:t,context:e,author:r,port:n,pump:null,subscriber:null,pendingFrames:[],flushedLocal:!1,flushRequestId:null,flushPumpComplete:!1,flushObserved:!1,transportWaitAbort:new AbortController,inspectorAttachment:i,watchedLivenessLock:null,pendingInspectorBootstraps:/* @__PURE__ */ new Set,inspectorSubscriptions:/* @__PURE__ */ new Map,inspectorWrites:/* @__PURE__ */ new Set,onMessage:o,onMessageError:s},e.peers.set(t,a),n.addEventListener(`message`,o),n.addEventListener(`messageerror`,s),n.start()}function ow(e,t){let{context:n,tabId:r}=e,i=globalThis.navigator?.locks;!i||e.watchedLivenessLock!==null||(e.watchedLivenessLock=t,i.request(t,{signal:e.transportWaitAbort.signal},()=>{n.peers.get(r)===e&&(uw(n,r),n.peers.size===0&&n.pendingAdmissionTasks===0&&bw(n))}).catch(()=>{}))}async function sw(e,t){if(e.context.peers.get(e.tabId)===e){if(t.type===`liveness-lock`){ow(e,t.name);return}if(t.type===`runtime-probe`){$(e.port,{type:`runtime-pong`,connectionId:t.connectionId,nonce:t.nonce});return}if(t.type===`frames`){if(e.context.options.logLevel===`trace`&&NC(`peer-frames`,e.context.options.dbName,e.context.options.authSessionKey,{frameCount:t.frames.length}),e.flushedLocal=!1,!e.pump){e.pendingFrames.push(...t.frames);return}e.pump.receive(t.frames);return}if(t.type===`close`){let n=e.context.peers.size===1&&e.context.pendingAdmissionTasks===0&&t.releaseContext;uw(e.context,e.tabId,!1);try{n&&await yw(e.context),t.id!==void 0&&$(e.port,{type:`result`,id:t.id}),n&&bw(e.context)}catch(n){t.id!==void 0&&$(e.port,{type:`result`,id:t.id,error:J(Vl(n))})}return}if(t.type===`diagnostic-query-coverage`){NC(t.stage===`attach`?`query-attach`:`query-covered`,e.context.options.dbName,e.context.options.authSessionKey,{peerActivityEpoch:t.peerActivityEpoch,peerProcessedActivityEpoch:t.peerProcessedActivityEpoch});return}if(t.type===`storage-reset-observed`){Dw(e,t.resetId);return}if(t.type===`flush-local-observed`){e.flushObserved=!0,Aw(e);return}if(t.type===`open-inspector-control`){cw(e.context.options.authSessionKey,t.port),Q(e,t.id);return}if(t.type===`store-pending-uploads`){let n;try{n=e.context.runtime?.uploadStatus().pending}catch{n=void 0}Q(e,t.id,void 0,{pendingUploads:n});return}if(t.type===`prepare-storage-reset`){e.context.intentionalStorageReset=!0;let n;try{n=e.context.runtime?.uploadStatus().pending}catch{n=void 0}Q(e,t.id,void 0,{pendingUploads:n});return}if(t.type===`abort-storage-reset`){e.context.intentionalStorageReset=!1,Q(e,t.id);return}if(t.type===`finish-storage-reset`){await gw(e.context),Ew(e.context),Q(e,t.id);return}try{let n=hw(e.context);if(t.type===`inspect-query`||t.type===`inspect-subscribe`||t.type===`inspect-unsubscribe`||t.type===`inspect-commit`||t.type===`inspect-wait`){if(dC(e,t.binding),!e.subscriber||!e.pump||e.context.storageInvalidated||e.context.closing)throw Error(`Inspector cache reads require an active authenticated attachment`);if(!Number.isSafeInteger(t.id)||t.id>=-1)throw Error(`Invalid Inspector query identifier`);if(t.type===`inspect-commit`){let r=Lu();n.beginTransaction(`mergeable`,r);let i;try{for(let e of t.edits){let t=JSON.stringify({transaction_id:r,updated_at:e.updatedAt});switch(e.operation){case`insert`:n.insert(e.table,e.values??{},t,e.rowId);break;case`update`:n.update(e.table,e.rowId,e.values??{},t);break;case`delete`:n.delete(e.table,e.rowId,t);break;default:throw Error(`Invalid Inspector edit operation`)}}i=n.commitTransaction(r)}catch(e){try{await n.rollbackTransaction(r)}catch{}throw e}e.inspectorWrites.add(i),$(e.port,{type:`inspector-query-result`,id:t.id,value:i});return}if(t.type===`inspect-wait`){let r=t.txId;if(!e.inspectorWrites.has(r))throw Error(`Unknown Inspector write`);await n.waitForTransaction(r,t.tier),e.context.peers.get(e.tabId)===e&&e.context.runtime===n&&!e.context.storageInvalidated&&!e.context.closing&&$(e.port,{type:`inspector-query-result`,id:t.id,value:null});return}if(t.type===`inspect-unsubscribe`){let r=e.inspectorSubscriptions.get(t.id);e.inspectorSubscriptions.delete(t.id),r!==void 0&&n.unsubscribe(r);return}let r=t.options,i=()=>e.context.peers.get(e.tabId)===e&&e.context.runtime===n&&!e.context.storageInvalidated&&!e.context.closing&&!!e.subscriber;if(t.type===`inspect-query`){let a=await n.query(t.query,void 0,`local-only`,r);i()&&$(e.port,{type:`inspector-query-result`,id:t.id,value:a})}else{if(e.inspectorSubscriptions.has(t.id))throw Error(`Inspector subscription already exists`);let a=n.createSubscription(t.query,void 0,`local-only`,r);e.inspectorSubscriptions.set(t.id,a),n.executeSubscription(a,n=>{!i()||e.inspectorSubscriptions.get(t.id)!==a||$(e.port,n instanceof Error?{type:`inspector-query-result`,id:t.id,error:J(n)}:{type:`inspector-query-result`,id:t.id,value:n})})}return}if(t.type===`inspect-binding`){dC(e,t.binding),t.leasePort&&e.pendingInspectorBootstraps.add(zC(t.leasePort,e.context.options)),$(e.port,{type:`inspector-binding`,id:t.id,binding:t.binding});return}if(t.type===`init`){await tw(e.context,async()=>{let r=()=>e.context.peers.get(e.tabId)===e&&e.context.runtime===n&&!e.context.storageInvalidated&&!e.context.closing;if(!r())return;if((e.inspectorAttachment||t.inspectorBinding)&&dC(e,t.inspectorBinding),e.pump||e.subscriber)throw Error(`Browser tab is already initialized`);pC(e.context,t.sessionClaims);let i=null;try{let a=n.createPeerAuthority();if(i=await n.acceptPeer(t.sessionClaims,a.epoch,e.author),!r())return;let o=kw(e,n,i);if(i=null,NC(`peer-attached`,e.context.options.dbName,e.context.options.authSessionKey),e.pendingFrames.length>0){let t=e.pendingFrames.splice(0);o.receive(t)}e.context.explicitlyDisconnected?$(e.port,{type:`transport-state`,explicitlyDisconnected:!0}):ew(e.context),e.context.storageFailure!==null&&$(e.port,{type:`storage-failure`,message:e.context.storageFailure});let s=fw(e.context);s&&!s.sent&&$(e.port,{type:`link-fate`,fate:s.fate}),Q(e,t.id,void 0,{peerAuthority:a,workerRealmId:gC,...e.inspectorAttachment?{inspectorAttachmentPhysicalDbName:e.context.options.dbName}:{}})}catch(e){if(r())throw e}finally{i&&await n.retirePeerTransport(i)}});return}if(t.type===`update-auth`){if(!e.subscriber)throw Error(`Browser tab is not initialized`);let r=!1;await tw(e.context,async()=>{n.assertCredentialKeepsPrincipal(t.authJson);let i=e.context.authFailureEpoch;try{e.context.explicitlyDisconnected||(e.context.serverConnectionStarted?await n.updateAuth(t.authJson):(e.context.serverAuthJson=t.authJson,ew(e.context)),await n.waitForUpstreamServerConnection())}catch(t){if(e.context.authFailureEpoch!==i){r=!0;return}throw t}e.context.serverAuthJson=t.authJson,await mC(e.context,t.sessionClaims)}),r||(e.context.authFailure=null,fw(e.context));return}if(t.type===`disconnect`){await tw(e.context,async()=>{let t=e.context.explicitlyDisconnected;e.context.explicitlyDisconnected=!0,e.context.serverConnectionStarted=!1;try{await n.disconnect({rejectWaiters:!1})}catch(n){throw e.context.explicitlyDisconnected=t,t||ew(e.context),n}nw(e.context)}),Q(e,t.id);return}if(t.type===`flush-pending-writes`){e.context.runtime.waitForPendingWrites(`global`).then(()=>Q(e,t.id),n=>Q(e,t.id,Vl(n)));return}if(t.type===`flush-local`){if(e.flushRequestId!==null){Q(e,t.id,/* @__PURE__ */ Error(`Browser tab already has a local flush in progress`));return}e.flushRequestId=t.id,e.flushPumpComplete=!1,e.flushObserved=!1,e.pump?.drainOutboundFrames(),e.flushPumpComplete=!0,Aw(e);return}if(t.type===`reconnect`){let r=e.context.serverUrl;if(!r)throw Error(`Browser runtime reconnect requires a serverUrl`);await tw(e.context,async()=>{let i=$C(t.authJson)||!$C(e.context.serverAuthJson),a=i?t.authJson:e.context.serverAuthJson;n.assertCredentialKeepsPrincipal(a);let o=$C(a);o&&(n.connect(r,a),await n.waitForUpstreamServerConnection(),e.context.authFailure=null,fw(e.context)),e.context.serverAuthJson=a,i&&await mC(e.context,t.sessionClaims),e.context.explicitlyDisconnected=!1,e.context.serverConnectionStarted=o,nw(e.context)}),Q(e,t.id);return}if(await iw(e.context,n,e.transportWaitAbort.signal),e.transportWaitAbort.signal.aborted)return;Q(e,t.id)}catch(n){if(t.type===`init`&&(!e.context.runtime||e.context.storageInvalidated||e.context.closing))return;`id`in t?Q(e,t.id,Vl(n)):lw(e,Vl(n))}}}function cw(e,t){xC.add(t);let n=n=>{let i=n.data;if(i.type===`close`){r();return}if(i.type===`list-contexts`){let n=[...X.values()].filter(t=>t.options.authSessionKey===e&&!t.storageInvalidated&&t.runtime!==null).map(e=>({workerRealmId:gC,key:e.key,appId:e.options.appId,dbName:e.options.dbName,schema:e.options.schema}));t.postMessage({type:`contexts`,id:i.id,contexts:n});return}if(i.type===`lifecycle-trace`){let n=new Set([...X.values()].filter(t=>t.options.authSessionKey===e&&!t.storageInvalidated&&t.runtime!==null).map(e=>e.options.dbName));t.postMessage({type:`lifecycle-trace`,id:i.id,entries:MC(kC,e,n)});return}if(i.type===`terminate-worker`){if(X.size>0){t.postMessage({type:`result`,id:i.id,error:J(/* @__PURE__ */ Error(`Worker still has live runtime contexts`))});return}if(EC>0){t.postMessage({type:`result`,id:i.id,error:J(/* @__PURE__ */ Error(`Worker still has pending bootstrap operations`))});return}if(Cw()){t.postMessage({type:`result`,id:i.id,error:J(/* @__PURE__ */ Error(`Worker still has pending or active foreground node leases`))});return}OC=!0,t.postMessage({type:`result`,id:i.id,workerTerminated:!0}),setTimeout(()=>hC.close(),0);return}let a=X.get(i.contextKey);!a||a.options.authSessionKey!==e||a.storageInvalidated||!a.runtime?(i.port.close(),t.postMessage({type:`result`,id:i.id,error:J(/* @__PURE__ */ Error(`Inspector context is no longer available`))})):(aw(a,i.tabId,i.port,a.options.author,!0),t.postMessage({type:`result`,id:i.id}))},r=()=>{t.removeEventListener(`message`,n),t.removeEventListener(`messageerror`,r),xC.delete(t),t.close(),xw()};t.addEventListener(`message`,n),t.addEventListener(`messageerror`,r),t.start()}function Q(e,t,n,r){e.context.peers.get(e.tabId)===e&&$(e.port,{type:`result`,id:t,...n?{error:J(n)}:{},...r})}function lw(e,t){$(e.port,{type:`error`,error:J(t)}),uw(e.context,e.tabId)}function uw(e,t,n=!0){let r=e.peers.get(t);if(r){e.peers.delete(t),r.transportWaitAbort.abort();for(let e of r.pendingInspectorBootstraps)e();r.pendingInspectorBootstraps.clear();for(let t of r.inspectorSubscriptions.values())e.runtime?.unsubscribe(t);r.inspectorSubscriptions.clear(),r.inspectorWrites.clear(),Ow(e,t),r.port.removeEventListener(`message`,r.onMessage),r.port.removeEventListener(`messageerror`,r.onMessageError),dw(r),n&&r.port.close()}}function dw(e){e.pump?.close(),e.pump=null,e.subscriber=null,e.pendingFrames.length=0}function fw(e){let t=e.runtime;if(!t)return null;let n=e.linkFate,r=t.remoteLinkState();r===`connected`&&n&&n.fate.state!==`connected`&&(e.authFailure=null);let i=t.upstreamFailure(),a=i?.error??null,o={state:r,link:t.upstreamLinkStatus(),failure:i&&n?.error===a&&n.fate.failure?.retrying===i.retrying?n.fate.failure:i&&{error:J(i.error),retrying:i.retrying},authFailure:e.authFailure};if(n&&pw(n.fate,o))return{fate:n.fate,sent:!1};e.linkFate={fate:o,error:a};for(let t of e.peers.values())!t.subscriber||!t.pump||$(t.port,{type:`link-fate`,fate:o});return{fate:o,sent:!0}}function pw(e,t){return e.state===t.state&&Z_(e.link,t.link)&&e.authFailure===t.authFailure&&e.failure?.retrying===t.failure?.retrying&&e.failure?.error===t.failure?.error}function mw(e,t){for(let n of e.peers.values())$(n.port,t)}function hw(e){if(!e.runtime)throw Error(`Shared browser runtime is closed`);return e.runtime}async function gw(e){e.intentionalStorageReset=!1;for(let t of e.peers.values())t.pump=null,t.subscriber=null,t.pendingFrames.length=0;e.runtime?.discard(),e.runtime=null,e.disposePageStoreInvalidation?.(),e.disposePageStoreInvalidation=null,e.pageStore=null,await(await SC)?.WasmDb.destroyBrowserStorage(void 0,e.options.dbName),e.disposeTelemetry?.(),e.disposeTelemetry=null,e.disposeAuxiliaryTrace?.(),e.disposeAuxiliaryTrace=null,X.delete(e.key);let t=Z.get(e.options.dbName);t&&(Z.delete(e.options.dbName),t.pageStore.close()),await IC(e.options.dbName).catch(()=>{})}var _w=1e3;async function vw(e){e.newerBuildHandoff??=(async()=>{mw(e,{type:`newer-build-waiting`});let t=Date.now()+xh,n=()=>X.get(e.key)===e;for(;n()&&(e.peers.size>0||e.pendingAdmissionTasks>0)&&Date.now()<t;)await new Promise(e=>setTimeout(e,50));n()&&(await Promise.race([Promise.all([...e.peers.values()].map(e=>e.pump?.settleInbound())),new Promise(e=>setTimeout(e,_w))]).catch(()=>{}),n()&&(mw(e,{type:`closed-for-newer-build`}),await new Promise(e=>setTimeout(e,0)),n()&&(ww(e),await yw(e))))})().finally(()=>{e.newerBuildHandoff=null}),await e.newerBuildHandoff}async function yw(e){X.get(e.key)===e&&(e.peers.size!==0||e.pendingAdmissionTasks!==0||(e.closing||=(async()=>{for(let t of e.peers.values())t.pump?.close(),t.pump=null,t.subscriber=null,t.pendingFrames.length=0;let t=yC.get(e.options.dbName),n=e.pageStore?.retireTreeOwnership();e.runtime?.discard(),e.runtime=null,e.disposePageStoreInvalidation?.(),e.disposePageStoreInvalidation=null,e.pageStore=null,e.disposeTelemetry?.(),e.disposeTelemetry=null,e.disposeAuxiliaryTrace?.(),e.disposeAuxiliaryTrace=null,await n,X.get(e.key)===e&&(X.delete(e.key),t&&yC.get(e.options.dbName)===t&&vC.set(e.options.dbName,t),WC())})(),await e.closing))}function bw(e){e.idleReleaseTimer&&clearTimeout(e.idleReleaseTimer),e.idleReleaseTimer=setTimeout(()=>{e.idleReleaseTimer=null,e.peers.size===0&&e.pendingAdmissionTasks===0&&yw(e).then(()=>{xw()})},50)}function xw(){if(WC(),!Sw()){if(DC)return;let e=Symbol(`worker-idle-close`);DC=e;let t=/* @__PURE__ */ new Set([...Z.keys(),...yC.keys()]);for(let e of t)NC(`owner-release-start`,e,null);Z.clear(),Promise.all([...t].map(e=>IC(e))).catch(()=>{}).finally(()=>{if(DC===e){if(Sw()){DC=null;return}for(let e of t)NC(`owner-release-finished`,e,null);DC=null}})}}function Sw(){return X.size>0||xC.size>0||EC>0||Cw()}function Cw(e){return[...Z.entries()].some(([t,n])=>(e===void 0||t===e)&&(n.activeLeaseIds.size>0||n.pendingLeaseAllocations>0||n.pendingLeaseFinalizations>0))}function ww(e){for(let t of e.peers.keys())uw(e,t)}function Tw(e){e.intentionalStorageReset?(e.runtime?.discard(),e.runtime=null,e.pageStore=null):e.storageInvalidated||(e.storageInvalidated=!0,X.delete(e.key),e.disposePageStoreInvalidation?.(),e.disposePageStoreInvalidation=null,e.pageStore=null,e.runtime?.discard(),e.runtime=null,e.disposeTelemetry?.(),e.disposeTelemetry=null,e.disposeAuxiliaryTrace?.(),e.disposeAuxiliaryTrace=null,LC(e.options.dbName),mw(e,{type:`storage-invalidated`}),setTimeout(()=>ww(e),0))}async function Ew(e){let t=new Set(e.peers.keys());if(t.size===0)return;let n=TC++;await new Promise(r=>{e.resetBarrier={id:n,pending:t,resolve:r},mw(e,{type:`storage-reset`,resetId:n})})}function Dw(e,t){e.context.resetBarrier?.id===t&&Ow(e.context,e.tabId)}function Ow(e,t){let n=e.resetBarrier;!n||!n.pending.delete(t)||n.pending.size!==0||(e.resetBarrier=null,n.resolve())}function kw(e,t,n){let r=new ph(t,n,t=>{let n=mh(t);e.port.postMessage({type:`frames`,frames:n},n.map(e=>e.buffer))},t=>lw(e,Vl(t)),e.context.options.logLevel===`trace`?t=>{$(e.port,{type:`relay-trace`,entries:t.map(e=>({...e,hop:`worker-tab`}))})}:void 0);return e.subscriber=n,e.pump=r,r}function Aw(e){let t=e.flushRequestId;t===null||!e.flushPumpComplete||!e.flushObserved||(e.flushRequestId=null,e.flushedLocal=!0,Q(e,t))}function jw(e,t){let n=e.telemetryCollectorUrl?.trim()||void 0,r=t.telemetryCollectorUrl?.trim()||void 0;return!n!=!r||n&&r&&(Qm(n,`traces`)!==Qm(r,`traces`)||Qm(n,`logs`)!==Qm(r,`logs`))?!1:(e.logLevel??uC)===(t.logLevel??uC)}function Mw(e){return e.dbName}function $(e,t){e.postMessage(t)}RC();
|