jazz-tools 2.0.0-alpha.68 → 2.0.0-alpha.69
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/dist/backend/blobs.d.ts +7 -1
- package/dist/backend/blobs.d.ts.map +1 -1
- package/dist/backend/blobs.js +7 -1
- package/dist/backend/blobs.js.map +1 -1
- package/dist/backend/create-jazz.d.ts +4 -0
- package/dist/backend/create-jazz.d.ts.map +1 -1
- package/dist/backend/create-jazz.js +4 -0
- package/dist/backend/create-jazz.js.map +1 -1
- package/dist/backend/inspector-ui/10.js +2 -2
- package/dist/backend/inspector-ui/11.js +2 -2
- package/dist/backend/inspector-ui/12.js +2 -2
- package/dist/backend/inspector-ui/18.js +1 -1
- package/dist/backend/inspector-ui/9.js +2 -2
- package/dist/backend/inspector-ui-files.js +4 -4
- package/dist/dev/inspector-overlay/embedded/assets/{index-BMlShD3p.js → index-Dwq5UKtM.js} +3 -3
- package/dist/dev/inspector-overlay/embedded/assets/{jazz-broker-worker-DTBugu7j.js → jazz-broker-worker-BTBxu5GV.js} +2 -2
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm-MSQOvwc8.js → jazz_wasm-BOTo6QbW.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm_bg-hIvU0oYr.wasm → jazz_wasm_bg-ZDkHqBG4.wasm} +0 -0
- package/dist/dev/inspector-overlay/embedded/embedded.html +1 -1
- package/dist/durable-object/index.d.ts +6 -1
- package/dist/durable-object/index.d.ts.map +1 -1
- package/dist/durable-object/index.js +6 -1
- package/dist/durable-object/index.js.map +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?1:0},__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 new Date},__wbg_new_0f6d2ddfe083319b:function(e){return new Date(e)},__wbg_new_227d7c05414eb861:function(){return 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 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__ha43af549b5d562a7(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__h601d5d8f9bb6d857(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)}else{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-hIvU0oYr.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){return this.__wbg_ptr=F.upstreamlink_new(e)>>>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])}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?1:0)}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?1:0);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=new Set([e]),n=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=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==tt){let t=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=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=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):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];if(!$n(r)){z.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}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=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:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:H.FAILED,error:Error(`Nothing to send`)});return}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});return}else if(e.status===`failure`&&e.error){t({code:H.FAILED,error:e.error});return}else 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){if(Sa(n)){z.debug(`Unsettled resource attribute ${t} skipped`);continue}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=new Map;for(let n of e){let e=t.get(n.resource);e||(e=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=new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=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=60*1024,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: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];if(a!==void 0&&c>=a){s++;continue}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];if(n!==void 0&&o>=n){a++;continue}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){if(this._isSpanEnded()){z.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}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=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(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){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&z.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}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(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??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||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=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(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: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=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??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,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=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=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=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??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: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(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===H.SUCCESS?r():i(e.error??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}else 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()}}),jl;function Ml(e){if(globalThis.crypto?.getRandomValues)return globalThis.crypto.getRandomValues(new Uint8Array(e));if(jl){let t=jl();if(!(t instanceof Uint8Array)||t.byteLength<e)throw Error(`Native runtime entropy returned fewer than ${e*8} bits`);return t.slice(0,e)}throw Error(`Jazz requires a cryptographically secure runtime entropy source`)}function Nl(e=Ml(16)){let t=e.slice(0,16);return t[6]=t[6]&15|64,t[8]=t[8]&63|128,t}function Pl(e=()=>Ml(16)){for(;;){let t=e(),n=new DataView(t.buffer,t.byteOffset,t.byteLength).getBigUint64(0,!0);if(n!==0n)return n}}var Fl=`jazz-snapshot-v1:`,Il=72,Ll=48,Rl=class extends Error{name=`SnapshotRefFormatError`;code=`invalid_snapshot_ref`;constructor(){super(`Invalid or unsupported snapshot reference`)}};function zl(e){if(typeof e!=`string`||!e.startsWith(Fl))throw new Rl;let t=e.slice(Fl.length);if(t.length<Il||!/^[0-9a-f]+$/.test(t))throw new Rl;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!==Il+n*Ll)throw new Rl;return e}var Bl=class extends Error{name=`UnsupportedSnapshotError`;code=`unsupported_snapshot`;constructor(e=`Capturing snapshots is not supported by this runtime yet`){super(e)}},Vl=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=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 Hl(e){return e instanceof Error?e:Error(String(e))}function Ul(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Wl(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 Gl=new Vl({fatal:!0});function Kl(e){try{return Gl.decode(e),!0}catch{return!1}}function ql(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 Jl(e){return Object.fromEntries(Object.keys(e).sort().map(t=>[t,e[t]]))}function Yl(e,t){return JSON.stringify({tables:Jl(e),...t?{migrations:t}:{}},ql)}function Xl(e,t){let n={__jazzRuntimeSchema:1,schema:Jl(e),loadedPolicyBundle:t?.loadedPolicyBundle??!1};return JSON.stringify(n,ql)}new Vl({fatal:!0});function Zl(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;continue}if(r>=56320&&r<=57343)return!1;r!==32&&(r<9||r>13)&&(t=!0)}return t}function Ql(e){return Zl(e)}function $l(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(!Zl(e)||!Zl(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 eu(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?1:0);if(typeof r!=`string`||typeof i!=`string`)return null;let a=$l(r,i,n);return e===a?{...n===void 0?{}:{account_id:n},issuer:r,user_id:i,canonical:a}:null}catch{return null}}function tu(e){return new TextEncoder().encode($l(e.issuer,e.user_id,e.account_id))}function nu(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`);$l(r.value,i.value,t.value)}var ru=`urn:jazz:local-first`,iu=`urn:jazz:anonymous`,au=`urn:jazz:system`,ou=[au,ru,`urn:jazz:static-bearer`,iu];function su(e){return ou.includes(e)}var cu=`__jazz_trusted_reserved_session`,lu=new WeakSet,uu=new WeakMap,du=new Map;function fu(){let e=Ml(16);return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function pu(e){return su(e.issuer)&&lu.add(e),e}function mu(e){if(!lu.has(e)||!su(e.issuer))return;let t=uu.get(e);return t||(t=fu(),uu.set(e,t)),du.set(t,{account_id:e.account_id,issuer:e.issuer,user_id:e.user_id,authMode:e.authMode}),t}function hu(e,t){if(!su(e.issuer)||typeof t!=`string`)return!1;let n=du.get(t);return n?.issuer===e.issuer&&n.account_id===e.account_id&&n.user_id===e.user_id&&n.authMode===e.authMode}var gu=new Set([`sub`,`exp`,`nbf`,`iat`,`iss`,`aud`,`jti`]);function _u(e){return e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?Number.isFinite(e):Array.isArray(e)?e.every(_u):Ul(e)&&Object.values(e).every(_u)}function vu(e){let t=Object.create(null);for(let[n,r]of Object.entries(e).sort(yu))!gu.has(n)&&_u(r)&&(t[n]=r);return t}function yu([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 bu(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function xu(){return globalThis.Buffer}function Su(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;return n===0?t:t+`=`.repeat(4-n)}function Cu(e){let t=xu();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 Vl().decode(n)}catch{return null}return null}function wu(e){let t=bu(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=Cu(Su(r));if(!i)return null;try{let e=JSON.parse(i);return Ul(e)?e:null}catch{return null}}function Tu(e){return e!==`disabled`&&e!==`revoked`}var Eu=new Set([`expired`,`missing`,`invalid`,`disabled`,`revoked`]);function Du(e){if(Eu.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 Ou(e){let t=``;for(let n=0;n<e.length;n++)t+=W[e[n]&255];return t}function ku(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 Au=/^[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}$/,ju=/^[0-9a-fA-F]{32}$/;function Mu(e){if(!Au.test(e)&&!ju.test(e))return;let t=e.replaceAll(`-`,``),n=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 Nu(e){return ku(e,0)}var Pu=new Map;function Fu(e){if(Pu.size!==0)try{return Pu.get(new URL(e).host)}catch{return}}function Iu(e){return Fu(e)?.fetch??globalThis.fetch}function Lu(e){return Fu(e)?.WebSocket}function Ru(){let e=Ml(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/2**8)&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 zu(e){let t=new URL(e).protocol;return t===`http:`||t===`https:`}function Bu(e){let t=new URL(e).protocol;return t===`http:`||t===`https:`||t===`blob:`}function Vu(e){return new URL(`/`,e).href}function Hu(e,t){try{return new URL(e).href}catch{}if(t)try{return new URL(e,t).href}catch{}return e}function Uu(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 Wu(e,t){try{return new URL(e).href}catch{}return t?new URL(e,t).href:null}function Gu(e,t,n){return!t||zu(e)||!n&&Bu(t)?null:new URL(`jazz_wasm_bg.wasm`,Vu(t)).href}function Ku(e){return e?.wasmModule?{module:e.wasmModule}:e?.wasmSource?{module:e.wasmSource}:null}function qu(e,t,n){if(n?.wasmUrl)return Uu(Hu(n.wasmUrl,t),n);if(n?.baseUrl){let e=Wu(n.baseUrl,t);if(e)return Uu(new URL(`jazz_wasm_bg.wasm`,e).href,n)}return Gu(typeof e==`function`?e():e,t,!1)}var Ju={napi:`bbf6677c5c2c40908bcd09fe354b774ecfa8a8e32f99a5449d0b37c7929ed3ae`,wasm:`17e42320465c3a9f0208a1f5bd9e6386a045623b3df4f3e4d34254197c54e1bb`},Yu=`JAZZ_NATIVE_ARTIFACT_MISMATCH`,Xu=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=Yu};function Zu(e,t,n=[]){let r=Ju[t.toLowerCase()];if(typeof e.nativeArtifactFingerprint!=`function`)throw new Xu(`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 Xu(`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 Xu(`Jazz ${t} artifact is incomplete despite matching fingerprint: missing ${i}.`,t,r,r,i)}var Qu=class extends Error{},$u=class extends Error{},ed=new Set(`\\.+*?()|[]{}^$#&-~`),td=new Set(`imsUuRx`),nd=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]);function rd(e){return ed.has(e)?!0:e.codePointAt(0)>127?!1:!/[0-9A-Za-z<>]/.test(e)}var id=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=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 Qu&&this.fancy?new $u(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 Qu(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=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,td.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++,rd(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?1:0},__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 new Date},__wbg_new_0f6d2ddfe083319b:function(e){return new Date(e)},__wbg_new_227d7c05414eb861:function(){return 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 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__h95df83d0517d4c5f(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__h3526ab7b7e6e89b3(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)}else{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-ZDkHqBG4.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){return this.__wbg_ptr=F.upstreamlink_new(e)>>>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])}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?1:0)}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?1:0);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=new Set([e]),n=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=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==tt){let t=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=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=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):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];if(!$n(r)){z.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}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=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:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:H.FAILED,error:Error(`Nothing to send`)});return}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});return}else if(e.status===`failure`&&e.error){t({code:H.FAILED,error:e.error});return}else 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){if(Sa(n)){z.debug(`Unsettled resource attribute ${t} skipped`);continue}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=new Map;for(let n of e){let e=t.get(n.resource);e||(e=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=new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=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=60*1024,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: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];if(a!==void 0&&c>=a){s++;continue}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];if(n!==void 0&&o>=n){a++;continue}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){if(this._isSpanEnded()){z.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}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=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(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){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&z.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}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(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??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||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=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(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: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=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??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,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=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=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=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??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: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(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===H.SUCCESS?r():i(e.error??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}else 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()}}),jl;function Ml(e){if(globalThis.crypto?.getRandomValues)return globalThis.crypto.getRandomValues(new Uint8Array(e));if(jl){let t=jl();if(!(t instanceof Uint8Array)||t.byteLength<e)throw Error(`Native runtime entropy returned fewer than ${e*8} bits`);return t.slice(0,e)}throw Error(`Jazz requires a cryptographically secure runtime entropy source`)}function Nl(e=Ml(16)){let t=e.slice(0,16);return t[6]=t[6]&15|64,t[8]=t[8]&63|128,t}function Pl(e=()=>Ml(16)){for(;;){let t=e(),n=new DataView(t.buffer,t.byteOffset,t.byteLength).getBigUint64(0,!0);if(n!==0n)return n}}var Fl=`jazz-snapshot-v1:`,Il=72,Ll=48,Rl=class extends Error{name=`SnapshotRefFormatError`;code=`invalid_snapshot_ref`;constructor(){super(`Invalid or unsupported snapshot reference`)}};function zl(e){if(typeof e!=`string`||!e.startsWith(Fl))throw new Rl;let t=e.slice(Fl.length);if(t.length<Il||!/^[0-9a-f]+$/.test(t))throw new Rl;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!==Il+n*Ll)throw new Rl;return e}var Bl=class extends Error{name=`UnsupportedSnapshotError`;code=`unsupported_snapshot`;constructor(e=`Capturing snapshots is not supported by this runtime yet`){super(e)}},Vl=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=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 Hl(e){return e instanceof Error?e:Error(String(e))}function Ul(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Wl(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 Gl=new Vl({fatal:!0});function Kl(e){try{return Gl.decode(e),!0}catch{return!1}}function ql(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 Jl(e){return Object.fromEntries(Object.keys(e).sort().map(t=>[t,e[t]]))}function Yl(e,t){return JSON.stringify({tables:Jl(e),...t?{migrations:t}:{}},ql)}function Xl(e,t){let n={__jazzRuntimeSchema:1,schema:Jl(e),loadedPolicyBundle:t?.loadedPolicyBundle??!1};return JSON.stringify(n,ql)}new Vl({fatal:!0});function Zl(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;continue}if(r>=56320&&r<=57343)return!1;r!==32&&(r<9||r>13)&&(t=!0)}return t}function Ql(e){return Zl(e)}function $l(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(!Zl(e)||!Zl(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 eu(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?1:0);if(typeof r!=`string`||typeof i!=`string`)return null;let a=$l(r,i,n);return e===a?{...n===void 0?{}:{account_id:n},issuer:r,user_id:i,canonical:a}:null}catch{return null}}function tu(e){return new TextEncoder().encode($l(e.issuer,e.user_id,e.account_id))}function nu(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`);$l(r.value,i.value,t.value)}var ru=`urn:jazz:local-first`,iu=`urn:jazz:anonymous`,au=`urn:jazz:system`,ou=[au,ru,`urn:jazz:static-bearer`,iu];function su(e){return ou.includes(e)}var cu=`__jazz_trusted_reserved_session`,lu=new WeakSet,uu=new WeakMap,du=new Map;function fu(){let e=Ml(16);return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function pu(e){return su(e.issuer)&&lu.add(e),e}function mu(e){if(!lu.has(e)||!su(e.issuer))return;let t=uu.get(e);return t||(t=fu(),uu.set(e,t)),du.set(t,{account_id:e.account_id,issuer:e.issuer,user_id:e.user_id,authMode:e.authMode}),t}function hu(e,t){if(!su(e.issuer)||typeof t!=`string`)return!1;let n=du.get(t);return n?.issuer===e.issuer&&n.account_id===e.account_id&&n.user_id===e.user_id&&n.authMode===e.authMode}var gu=new Set([`sub`,`exp`,`nbf`,`iat`,`iss`,`aud`,`jti`]);function _u(e){return e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?Number.isFinite(e):Array.isArray(e)?e.every(_u):Ul(e)&&Object.values(e).every(_u)}function vu(e){let t=Object.create(null);for(let[n,r]of Object.entries(e).sort(yu))!gu.has(n)&&_u(r)&&(t[n]=r);return t}function yu([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 bu(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function xu(){return globalThis.Buffer}function Su(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;return n===0?t:t+`=`.repeat(4-n)}function Cu(e){let t=xu();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 Vl().decode(n)}catch{return null}return null}function wu(e){let t=bu(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=Cu(Su(r));if(!i)return null;try{let e=JSON.parse(i);return Ul(e)?e:null}catch{return null}}function Tu(e){return e!==`disabled`&&e!==`revoked`}var Eu=new Set([`expired`,`missing`,`invalid`,`disabled`,`revoked`]);function Du(e){if(Eu.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 Ou(e){let t=``;for(let n=0;n<e.length;n++)t+=W[e[n]&255];return t}function ku(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 Au=/^[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}$/,ju=/^[0-9a-fA-F]{32}$/;function Mu(e){if(!Au.test(e)&&!ju.test(e))return;let t=e.replaceAll(`-`,``),n=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 Nu(e){return ku(e,0)}var Pu=new Map;function Fu(e){if(Pu.size!==0)try{return Pu.get(new URL(e).host)}catch{return}}function Iu(e){return Fu(e)?.fetch??globalThis.fetch}function Lu(e){return Fu(e)?.WebSocket}function Ru(){let e=Ml(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/2**8)&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 zu(e){let t=new URL(e).protocol;return t===`http:`||t===`https:`}function Bu(e){let t=new URL(e).protocol;return t===`http:`||t===`https:`||t===`blob:`}function Vu(e){return new URL(`/`,e).href}function Hu(e,t){try{return new URL(e).href}catch{}if(t)try{return new URL(e,t).href}catch{}return e}function Uu(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 Wu(e,t){try{return new URL(e).href}catch{}return t?new URL(e,t).href:null}function Gu(e,t,n){return!t||zu(e)||!n&&Bu(t)?null:new URL(`jazz_wasm_bg.wasm`,Vu(t)).href}function Ku(e){return e?.wasmModule?{module:e.wasmModule}:e?.wasmSource?{module:e.wasmSource}:null}function qu(e,t,n){if(n?.wasmUrl)return Uu(Hu(n.wasmUrl,t),n);if(n?.baseUrl){let e=Wu(n.baseUrl,t);if(e)return Uu(new URL(`jazz_wasm_bg.wasm`,e).href,n)}return Gu(typeof e==`function`?e():e,t,!1)}var Ju={napi:`5c243927a8228e339a72613c233fb3e90732f8843cfc4cc35fe2d192bb0a2547`,wasm:`190c82211fdb6dd352084577811d1a7c2088d1ac0b391e9b6e98e2dea9123f64`},Yu=`JAZZ_NATIVE_ARTIFACT_MISMATCH`,Xu=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=Yu};function Zu(e,t,n=[]){let r=Ju[t.toLowerCase()];if(typeof e.nativeArtifactFingerprint!=`function`)throw new Xu(`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 Xu(`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 Xu(`Jazz ${t} artifact is incomplete despite matching fingerprint: missing ${i}.`,t,r,r,i)}var Qu=class extends Error{},$u=class extends Error{},ed=new Set(`\\.+*?()|[]{}^$#&-~`),td=new Set(`imsUuRx`),nd=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]);function rd(e){return ed.has(e)?!0:e.codePointAt(0)>127?!1:!/[0-9A-Za-z<>]/.test(e)}var id=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=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 Qu&&this.fancy?new $u(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 Qu(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=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,td.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++,rd(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||!nd.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`}}},ad={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]]},od=`\\p{Alphabetic}\\p{M}\\p{Nd}\\p{Pc}\\p{Join_Control}`,sd={d:`\\p{Nd}`,s:`\\p{White_Space}`,w:od};function cd(e){return/^[A-Za-z0-9]$/.test(e)?e:`\\u{${e.codePointAt(0).toString(16)}}`}function ld(e){return e.map(([e,t])=>{let n=cd(String.fromCodePoint(e));return e===t?n:`${n}-${cd(String.fromCodePoint(t))}`}).join(``)}var ud=class{constructor(e){this.parsed=e}emit(e){switch(e.kind){case`flags`:return``;case`literal`:return cd(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 $u(`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=`[${od}]`;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=cd(e.char);return{fragment:t,atom:`[${t}]`}}case`range`:{let t=`${cd(e.start)}-${cd(e.end)}`;return{fragment:t,atom:`[${t}]`}}case`perl`:return dd(this.parsed.fancy?sd[e.perl]:ld(ad[e.perl]),e.negated);case`ascii`:return dd(ld(ad[e.ascii]),e.negated);case`unicode`:return dd(fd(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 dd(e,t){return t?{atom:`[^${e}]`}:{fragment:e,atom:`[${e}]`}}function fd(e){for(let t of[e,`Script=${e}`])try{return RegExp(`\\p{${t}}`,`u`),`\\p{${t}}`}catch{}throw new $u(`the Unicode class \`${e}\``)}function pd(e){try{return new id(e).parse(),!0}catch(e){return e instanceof $u}}var md=new Map,hd=1024;function gd(e){let t=md.get(e);if(t)return t;let n=new id(e).parse();if(n.fancyInvalid.length>0)throw new Qu(n.fancyInvalid[0]);if(n.unsupported.length>0)throw new $u(n.unsupported[0]);let r=new ud(n).emit(n.node);return t=new RegExp(r,n.caseInsensitive?`iu`:`u`),md.size>=hd&&md.clear(),md.set(e,t),t}function _d(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 vd(e){return e%4==0&&e%100!=0||e%400==0}function yd(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=_d(e,5),r=_d(e,8);return n===void 0||n<1||n>12||r===void 0||r===0?!1:n===2?r<=(vd(t)?29:28):r<=([4,6,9,11].includes(n)?30:31)}function bd(e){if(e.length<9||e[2]!==`:`||e[5]!==`:`)return!1;let t=_d(e,0),n=_d(e,3),r=_d(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=_d(e,i+1),s=_d(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 xd(e){let t=e.search(/[Tt]/);return t<0?!1:yd(e.slice(0,t))&&bd(e.slice(t+1))}var Sd=`(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])`,Cd=`${Sd}(?:\\.${Sd}){3}`,G=`[0-9A-Fa-f]{1,4}`,wd=`(?:${G}:${G}|${Cd})`,Td=[`(?:${G}:){6}${wd}`,`::(?:${G}:){5}${wd}`,`(?:${G})?::(?:${G}:){4}${wd}`,`(?:(?:${G}:){0,1}${G})?::(?:${G}:){3}${wd}`,`(?:(?:${G}:){0,2}${G})?::(?:${G}:){2}${wd}`,`(?:(?:${G}:){0,3}${G})?::${G}:${wd}`,`(?:(?:${G}:){0,4}${G})?::${wd}`,`(?:(?:${G}:){0,5}${G})?::${G}`,`(?:(?:${G}:){0,6}${G})?::`].map(e=>`(?:${e})`).join(`|`),Ed=RegExp(`^${Cd}$`),Dd=RegExp(`^(?:${Td})$`),Od=e=>Ed.test(e),kd=e=>Dd.test(e);function Ad(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=Id(e.slice(4));if(t===void 0||!Bd(t))return!1}}return!0}var jd=36,Md=1,Nd=26,Pd=4294967295;function Fd(e,t,n){let r=Math.trunc(e/(n?700:2));r+=Math.trunc(r/t);let i=0;for(;r>(jd-Md)*Nd>>1;)r=Math.trunc(r/(jd-Md)),i+=jd;return i+Math.trunc((jd-Md+1)*r/(r+38))}function Id(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=jd;;e+=jd){if(c>=r.length)return;let n=Ld(r.charCodeAt(c++));if(n===void 0||(s+=n*t,n*t>Pd||s>Pd))return;let i=e<=o?Md:e>=o+Nd?Nd:e-o;if(n<i)break;if(t*=jd-i,t>Pd)return}let n=i.length+1;if(o=Fd(s-e,n,e===0),a+=Math.trunc(s/n),a>Pd||(s%=n,a>1114111||a>=55296&&a<=57343))return;i.splice(s,0,a),s++}return String.fromCodePoint(...i)}function Ld(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 Rd=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))),zd=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347].map(e=>String.fromCodePoint(e)));function Bd(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||!Rd.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(zd.has(o))return!1}return!(n&&!r||i&&a)}var Vd=new TextEncoder;function Hd(e){return Vd.encode(e).length}function Ud(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):!1}var Wd=/^[\p{Alphabetic}\p{N}]$/u,Gd=new Set("!#$%&'*+-/=?^_`{|}~");function Kd(e){return Wd.test(e)||Gd.has(e)||Ud(e)}function qd(e){return e.length>0&&[...e].every(Kd)}function Jd(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||Ud(n)))return!1}return!0}function Yd(e){let t=e.codePointAt(0);return t>=33&&t<=90||t>=94&&t<=126||Ud(e)}function Xd(e){return e.replace(/^\p{White_Space}+|\p{White_Space}+$/gu,``)}function Zd(e){let t=e,n=``,r=e.lastIndexOf(` <`);if(r>=0){let i=Xd(e.slice(r+2));if(!i.endsWith(`>`))return!1;t=i.slice(0,-1),n=Xd(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||Hd(a)>64)return!1;if(a.startsWith(`"`)&&a.endsWith(`"`)){if(a.length<=2||!Jd(a.slice(1,-1)))return!1}else if(!a.split(`.`).every(qd))return!1;if(o.length===0||Hd(o)>254)return!1;if(o.startsWith(`[`)&&o.endsWith(`]`)){let e=o.slice(1,-1);return[...e].every(Yd)?e.startsWith(`IPv6:`)?kd(e.slice(5)):Od(e):!1}for(let e of o.split(`.`)){let t=[...e];if(t.length===0||!Wd.test(t[0])||!Wd.test(t[t.length-1])||Hd(e)>63||!qd(e))return!1}return Ad(o)}var Qd=`A-Za-z0-9\\-._~`,$d=`!$&'()*+,;=`,ef=`%[0-9A-Fa-f]{2}`,tf=`(?:[${Qd}${$d}:@]|${ef})`,nf=`${tf}*`,rf=`${tf}+`,af=`(?:[${Qd}${$d}@]|${ef})+`,of=`\\[(?:${Td}|[vV][0-9A-Fa-f]+\\.[${Qd}${$d}:]+)\\]`,sf=`(?:[${Qd}${$d}]|${ef})*`,cf=`(?:${`(?:[${Qd}${$d}:]|${ef})*`}@)?(?:${of}|${sf})(?::[0-9]*)?`,lf=`(?:/${nf})*`,uf=`/(?:${rf}(?:/${nf})*)?`,df=`${rf}(?:/${nf})*`,ff=`${af}(?:/${nf})*`,pf=`(?:${tf}|[/?])*`,mf=`[A-Za-z][A-Za-z0-9+\\-.]*`,hf=`(?://${cf}${lf}|${uf}|${df}|)`,gf=`(?://${cf}${lf}|${uf}|${ff}|)`,_f=`(?:\\?${pf})?(?:#${pf})?`,vf=RegExp(`^${mf}:${hf}${_f}$`),yf=RegExp(`^(?:${mf}:${hf}|${gf})${_f}$`);function bf(e){return e===``||/^(?:\/(?:[^~/]|~[01])*)+$/.test(e)}function xf(e){let t=/^(0|[1-9][0-9]*)(.*)$/s.exec(e);if(!t)return!1;let n=t[2];return n===``||n===`#`||n.startsWith(`/`)&&bf(n)}var Sf=new Set(`+#./;?&=,!@|`),Cf=new Set(`"'<>%\\^\`{|}`);function wf(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||Sf.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||Cf.has(r))return!1;t++}}}return!0}var Tf={date:yd,"date-time":xd,email:Zd,hostname:Ad,ipv4:Od,ipv6:kd,"json-pointer":bf,regex:pd,"relative-json-pointer":xf,time:bd,uri:e=>vf.test(e),"uri-reference":e=>yf.test(e),"uri-template":wf},Ef=class{constructor(e){this.value=e}},Df=2n**64n-1n,Of=-(2n**63n),kf=/-?(?:0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/y,Af=/[ \t\n\r]*/y;function jf(e){let t=0,n=()=>{throw SyntaxError(`invalid JSON at position ${t}`)},r=()=>{Af.lastIndex=t,Af.test(e),t=Af.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=()=>{kf.lastIndex=t;let r=kf.exec(e);if(!r)return n();t=kf.lastIndex;let i=r[0],a=Number(i);if(r[1]!==void 0||r[2]!==void 0)return Number.isInteger(a)?new Ef(a):a;if(Object.is(a,-0))return new Ef(a);if(Number.isSafeInteger(a))return a;let o=BigInt(i);return o<Of||o>Df?new Ef(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 Mf(e){return typeof e==`number`||typeof e==`bigint`||e instanceof Ef}function Nf(e){return e instanceof Ef?e.value:e}function Pf(e,t){return typeof e==`bigint`?!0:e instanceof Ef?!t:Number.isInteger(e)}function Ff(e){if(typeof e==`bigint`)return e.toString();if(e instanceof Ef){if(Object.is(e.value,-0))return`-0.0`;let t=Number.isSafeInteger(e.value)?String(e.value):If(e.value);return/[.e]/.test(t)?t:`${t}.0`}return typeof e==`number`&&Number.isInteger(e)?If(e):Array.isArray(e)?`[${e.map(Ff).join(`,`)}]`:typeof e==`object`&&e?`{${Object.entries(e).map(([e,t])=>`${JSON.stringify(e)}:${Ff(t)}`).join(`,`)}}`:JSON.stringify(e)}function If(e){return Number.isFinite(e)&&Math.abs(e)<1e21?BigInt(e).toString():String(e)}function Lf(e){if(e instanceof Ef)return e.value;if(Array.isArray(e))return e.map(Lf);if(typeof e!=`object`||!e)return e;let t=Object.create(null);for(let[n,r]of Object.entries(e))t[n]=Lf(r);return t}function Rf(e,t){if(Mf(e))return Mf(t)?Nf(e)==Nf(t):!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>Rf(e,t[n]));if(typeof e==`object`&&e){if(typeof t!=`object`||!t||Array.isArray(t)||Mf(t))return!1;let n=Object.keys(e);return n.length===Object.keys(t).length?n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&Rf(e[n],t[n])):!1}return e===t}function zf(e,t){let n=Number(Nf(e)),r=Number(Nf(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]=Bf(n),[o,s]=Bf(r);if(o===0n)return!0;let c=a*o;return i*s%c===0n}function Bf(e){let t=0,n=e;for(;!(Math.abs(Math.floor(n)-n)<2**-52);)if(t++,n=e*Vf(10,t),!Number.isFinite(n))return Hf(e);let r=BigInt(Math.trunc(Math.abs(n)));return[e<0?-r:r,BigInt(Vf(10,t))]}function Vf(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 Hf(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 Uf={additionalItems:!0,unevaluatedItems:!0,items:!0,contains:!0,additionalProperties:!0,unevaluatedProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Wf={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Gf={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Kf=new URL(`json-schema:///`);function qf(e){return encodeURI(e.replace(/~/g,`~0`).replace(/\//g,`~1`))}function Jf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Yf(e,t=Object.create(null),n=[],r=Kf,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(!Jf(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(Wf[i]&&Array.isArray(a))for(let e of a)Yf(e,t,n,r,!1);else if(Uf[i])Yf(a,t,n,r,!1);else if((Gf[i]||i===`dependencies`)&&Jf(a))for(let e in a)Yf(a[e],t,n,r,!1)}return t}function Xf(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(Jf(i)&&Object.prototype.hasOwnProperty.call(i,t))i=i[t];else return}return typeof i==`boolean`||Jf(i)?i:void 0}}function Zf(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 Qf(e){if(e===null)return`null`;if(Mf(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 $f(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=Qf(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?Xf(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=Xf(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`&&Pf(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&&!Rf(e,h)&&M.push({instanceLocation:i,keyword:`const`,keywordLocation:`${a}/const`,error:`Instance does not match ${Ff(h)}.`}),g!==void 0&&!g.some(t=>Rf(e,t))&&M.push({instanceLocation:i,keyword:`enum`,keywordLocation:`${a}/enum`,error:`Instance does not match any of ${Ff(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}/${qf(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}/${qf(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}/${qf(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}/${qf(a)}`,d=K(t[a],ie[a],n,r,s,`${e}/${qf(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=gd(a),d=ae[a];for(let f in t){if(!s.test(f))continue;let p=`${i}/${qf(f)}`,m=K(t[f],d,n,r,p,`${e}/${qf(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}/${qf(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}/${qf(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(Rf(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=Nf(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&&!zf(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:Zf(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&&!gd(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:Tf[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 ep={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`}}}]},tp={"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`},np=new Set(`$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(`.`)),rp={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`]},ip={...rp,single:[...rp.single,`contains`,`propertyNames`],plain:[...rp.plain.filter(e=>e!==`id`),`$id`,`const`]},ap={...ip,single:[...ip.single,`if`,`then`,`else`]},op={single:[...ap.single,`unevaluatedItems`,`unevaluatedProperties`],array:ap.array,map:[...ap.map,`$defs`,`dependentSchemas`],plain:[...ap.plain.filter(e=>e!==`format`),`$anchor`,`$recursiveAnchor`,`$recursiveRef`,`dependentRequired`,`maxContains`,`minContains`]},sp={single:op.single.filter(e=>e!==`additionalItems`),array:[`allOf`,`anyOf`,`oneOf`,`prefixItems`],map:op.map,plain:op.plain.filter(e=>e!==`$recursiveAnchor`&&e!==`$recursiveRef`)},cp={4:rp,6:ip,7:ap,"2019-09":op,"2020-12":sp},lp={4:[],6:[`contentMediaType`],7:[`contentMediaType`],"2019-09":[],"2020-12":[`$dynamicAnchor`,`$dynamicRef`]},up=[`date`,`date-time`,`email`,`hostname`,`idn-email`,`ipv4`,`ipv6`,`regex`,`time`,`uri`],dp=[...up,`json-pointer`,`uri-reference`,`uri-template`],fp={4:up,6:dp,7:[...dp,`idn-hostname`,`iri`,`iri-reference`,`relative-json-pointer`]},pp=[`idn-email`,`idn-hostname`,`iri`,`iri-reference`],mp={base64:hp(`A-Za-z0-9+/`),base64url:hp(`A-Za-z0-9\\-_`),base32:gp(`A-Z2-7`,`AEIMQUY4`,`AQ`,`ACEGIKMOQSUWY246`,`AIQY`),base32hex:gp(`0-9A-V`,`048CGKOS`,`0G`,`02468ACEGIKMOQSU`,`08GO`),base16:`^(?:[0-9A-Fa-f]{2})*$`};function hp(e){let t=`[${e}]`;return`^(?:${t}{4})*(?:${t}[AQgw]==|${t}{2}[AEIMQUYcgkosw048]=)?$`}function gp(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 _p=class extends Error{};function vp(e){if(!Ul(e))return`2020-12`;let t=e.$schema;if(typeof t!=`string`)return`2020-12`;let n=tp[t.replace(/#+$/,``).replace(/^https?:\/\//,``)];if(!n)throw new _p(`unknown JSON Schema dialect "${t}"`);return n}function yp(e,t,n=[]){if(typeof e==`boolean`)return e;if(!Ul(e))return{};let r=cp[t],i=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(lp[t].includes(s)&&!n.includes(s))throw new _p(`the \`${s}\` keyword is not supported by the browser runtime yet`);if(!(np.has(s)&&(!i.has(s)||a&&s!==`$ref`))){if(s===`pattern`&&typeof c==`string`&&xp(c),s===`patternProperties`&&Ul(c))for(let e of Object.keys(c))xp(e);if(s===`format`&&typeof c==`string`){if(!fp[t]?.includes(c))continue;if(pp.includes(c))throw new _p(`the "${c}" format is not supported by the browser runtime yet`)}r.array.includes(s)&&Array.isArray(c)?o.push([s,c.map(e=>yp(e,t,n))]):r.single.includes(s)?o.push([s,yp(c,t,n)]):r.map.includes(s)&&Ul(c)?o.push([s,bp(c,t,n)]):o.push([s,c])}}let s=e.contentEncoding;if(!a&&(t===`6`||t===`7`)&&typeof s==`string`){let e=mp[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 bp(e,t,n){return Object.fromEntries(Object.entries(e).map(([e,r])=>[e,Array.isArray(r)?r:yp(r,t,n)]))}function xp(e){try{gd(e)}catch(t){throw t instanceof Qu?new _p(`"${e}" is not a valid regular expression: ${t.message}`):t instanceof $u?new _p(`the regular expression "${e}" is not supported by the browser runtime yet: ${t.message}`):t}}function Sp(e){for(let t of e.references)if(Xf(e.lookup,t)===void 0)throw new _p(`unresolvable reference "${decodeURI(t.replace(/^json-schema:\/\/\//,``))}"`)}function Cp(e){if(Array.isArray(e))return e.map(Cp);if(!Ul(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,Cp(r)]);return Object.fromEntries(t)}var wp={4:ep.draft4,6:ep.draft6,7:ep.draft7,"2019-09":ep.draft201909,"2020-12":ep.draft202012};function Tp(e){return wp[e].map(t=>e===`2020-12`?Cp(yp(t,e,[`$dynamicAnchor`,`$dynamicRef`])):yp(t,e))}var Ep=class{constructor(e,t,n,r){this.schema=e,this.dialect=t,this.shortCircuit=n,this.lookup=Yf(e,void 0,this.references);for(let e of r)Yf(e,this.lookup)}lookup;references=[];validate(e){return $f(e,this.schema,this.dialect,this.lookup,this.shortCircuit)}},Dp=new Map;function Op(e){let t=Dp.get(e);if(!t){let[n,...r]=Tp(e);t=new Ep(n,e,!1,r),Dp.set(e,t)}return t}function kp(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 Ap(e){let t=vp(e);if(typeof e==`boolean`){if(t===`4`)throw new _p(`boolean schemas need draft 6 or later`)}else{let n=Op(t).validate(e);if(!n.valid)throw new _p(kp(n.errors))}let n=new Ep(yp(Lf(e),t),t,!0,Tp(t));return Sp(n),e=>{let t=n.validate(jf(e));return t.valid?void 0:kp(t.errors)}}function jp(e){return Ap(jf(e))}function Mp(e){e.setJsonSchemaValidator(jp)}function Np(){return import.meta.url}function Pp(){return null}var Fp=`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 Ip(){return`__METRO_GLOBAL_PREFIX__`in globalThis}async function Lp(){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 Rp=Promise.resolve(),zp;function Bp(e){let t=Rp.then(()=>Vp(e));return Rp=t.then(()=>{},()=>{}),t}async function Vp(e){let t=await Promise.resolve().then(()=>(He(),i)),n=Ku(e);if(n)return t.initSync(n),Hp(t);let r=!1;if(typeof process<`u`&&process.versions?.node)try{let e=await Lp();e&&(t.initSync({module:e}),r=!0)}catch{}if(!r&&typeof t.default==`function`){let n=typeof location<`u`?qu(Np,location.href,e)??Pp():null;if(n)await Up(t,n);else{if(typeof location<`u`&&Ip())throw Error(Fp);await t.default()}}return Hp(t)}function Hp(e){return Zu(e,`WASM`,[`initSync`,`WasmDb`,`setJsonSchemaValidator`]),Mp(e),e}async function Up(e,t){if(zp===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(Wp(r)){let i;try{i=await WebAssembly.compileStreaming(n)}catch(e){throw e instanceof WebAssembly.CompileError?Error(`WASM asset response is not a WebAssembly binary for ${t} (${r}): ${e.message}`):e}await e.default({module_or_path:i}),zp=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}),zp=t}function Wp(e){return typeof WebAssembly.compileStreaming==`function`?e?.trim()===`application/wasm`:!1}var Gp=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`}},Kp=new WeakMap;function qp(e,t){let n=Kp.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 Jp(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 Gp(e));return}let i={id:u,release:()=>(a||(a=!0,o()),l)};Kp.set(i,{databaseName:e,active:()=>!a,claimed:!1}),n(i),await s}).then(()=>{a=!0,c()},e=>{a=!0,c(),r(Hl(e))}),await i}var Yp=`unsupported_storage_codecs`,Xp=class extends Error{name=`UnsupportedStorageCodecsError`;code=Yp;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 Zp(e){return!e||typeof e!=`object`?!1:e.code===Yp}function Qp(e){if(e instanceof Xp||!Zp(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)&&(!$p(t)||!$p(n))?e:new Xp([...t??[]],[...n??[]],e.message,{cause:e,...r===void 0?{}:{format:r}})}function $p(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}var em=1,tm=`jazz-idb-tree`,nm=3,rm=`pages`,im=`metadata`,q=`storage-manifest`,am=`epoch`,om=`browser-runtime-owner`,sm=`browser-worker-epoch-v1`,cm=`jazz-browser-worker-epoch-v1`,lm=`replica-node-v1`,um=16,dm=`foreground-node-leases-v1`,fm=`jazz-foreground-node-leases-v1`,pm=(1n<<64n)-1n,mm=`current`,hm=1024,gm=2147483648,_m=16*1024,vm=1,ym={storageEpoch:vm,adapterId:`jazz-idb-tree`,adapterFormatVersion:em,requiredCodecIds:[`jazz.sqlite-storage.v1`],pageSize:_m,pageChecksum:`xxh3-64-le`,pageFormatMagic:`IDBTREE\0`,pageFormatVersion:em},bm=class extends Error{constructor(e){super(`IndexedDB storage was invalidated: ${e}`),this.databaseName=e,this.name=`IndexedDbStorageInvalidatedError`}},xm=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 Sm(e,t){return e?.name===`QuotaExceededError`?new xm(e):e??Error(t)}var Cm=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=new Set;nextTreeToken=0;treeTransactions=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=new Set;onInvalidated(e){return this.invalidationListeners.add(e),()=>this.invalidationListeners.delete(e)}static async open(t,n={}){let r=indexedDB.open(t,nm),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(rm)||t.createObjectStore(rm),t.objectStoreNames.contains(im)||t.createObjectStore(im),!t.objectStoreNames.contains(q)){let e=t.createObjectStore(q);r.transaction&&(e.put(ym,am),e.put(Tm().buffer,lm))}};let a;try{a=await Bm(r)}catch(e){throw i?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??Em(Tm()),confirmedTxTime:n?.confirmedTxTime??`0`};return t.active.push(r),Om(r)})}async returnForegroundNodeLease(e,t){if(!Pm(e)||!Lm(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(!Pm(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!==um)throw Error(`Invalid IndexedDB foreground node identity`);this.assertValid();let t=this.db.transaction(q,`readonly`),n=Vm(t);try{let r=await Bm(t.objectStore(q).get(dm));if(await n,r===void 0)return`missing`;let i=km(r),a=Rm(Em(e));return i.active.some(e=>Rm(e.node)===a)?`active`:i.reusable.some(e=>Rm(e.node)===a)?`reusable`:i.retired.some(e=>Rm(e)===a)?`retired`:`missing`}catch(e){throw await n.catch(()=>{}),e}}async claimBrowserWorkerEpoch(e,t){if(!Fm(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?qp(t,this.name):null,i=this.db.transaction(q,`readwrite`),a=Vm(i);if(i.objectStore(q).put({format:cm,epoch:e},sm),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,!Fm(e))throw Error(`Invalid browser worker epoch`);this.assertValid();let t=this.db.transaction(q,`readwrite`),n=Vm(t),r=t.objectStore(q),i=await Bm(r.get(sm));i&&typeof i==`object`&&i.format===cm&&i.epoch===e&&r.delete(sm),await n}async metadata(){this.assertValid();let e=this.db.transaction(im,`readonly`),t=Vm(e),n=await Bm(e.objectStore(im).get(mm));return await t,n===void 0?null:(Um(n),n)}async assertStorageManifest(){let e=this.db.transaction(q,`readonly`),t=Vm(e),n=await Bm(e.objectStore(q).get(am));await t,Gm(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=Vm(t),r=t.objectStore(q),i=await Bm(r.get(om));if(i===void 0){r.put(e,om),await n;return}if(i===e){await n;return}throw t.abort(),await n.catch(()=>{}),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=Vm(e),n=await Bm(e.objectStore(q).get(lm));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!==um)throw Error(`Missing or invalid IndexedDB replica node identity`);return r.slice()}async updateForegroundNodeLeasePool(e){this.assertValid();let t=wm(this.db,[q]),n=Vm(t),r=t.objectStore(q);try{let t=await Bm(r.get(dm)),i=t===void 0?Dm():km(t),a=e(i);return jm(i),r.put(i,dm),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)qm(t);if(e.length===0)return[];let t=this.db.transaction(rm,`readonly`),n=Vm(t),r=t.objectStore(rm),i;try{i=await Promise.all(e.map(e=>Bm(r.get(e))))}catch(e){throw await n.catch(()=>{}),e}return await n,i.map((t,n)=>zm(e[n],t))}async commit(e,t){if(this.assertValid(),Wm(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=wm(this.db,[rm,im]),i=Vm(r),a=r.objectStore(rm),o=r.objectStore(im),s=await Bm(o.get(mm)),c=s===void 0?0:Hm(s);if(c!==e.expectedGeneration)throw r.abort(),await i.catch(()=>{}),Error(`IndexedDB B-tree generation changed: expected ${e.expectedGeneration}, found ${c}`);let l={...e.metadata,formatMagic:tm,formatVersion:em,generation:c+1};Um(l);try{if(l.rootPageId!==null&&!e.pages.has(l.rootPageId)&&await Bm(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,mm),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(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=wm(this.db,[rm,im]),t=Vm(e);e.objectStore(rm).clear(),e.objectStore(im).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??Error(`IndexedDB deletion failed`)),t.onblocked=()=>r(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 bm(this.name);for(let t of this.invalidationListeners)t(e)}assertValid(){if(this.invalidated)throw new bm(this.name)}removeInvalidationListeners(){this.db.removeEventListener(`versionchange`,this.handleVersionChange),this.db.removeEventListener(`close`,this.handleUnexpectedClose)}};function wm(e,t){return e.transaction(t,`readwrite`,{durability:`relaxed`})}function Tm(){if(!globalThis.crypto?.getRandomValues)throw Error(`Browser storage requires cryptographic random values for its replica identity`);return Nl(globalThis.crypto.getRandomValues(new Uint8Array(um)))}function Em(e){return e.slice().buffer}function Dm(){return{format:fm,active:[],reusable:[],retired:[]}}function Om(e){return{leaseId:e.leaseId,node:new Uint8Array(e.node).slice(),confirmedTxTime:BigInt(e.confirmedTxTime)}}function km(e){return jm(e),{format:e.format,active:e.active.map(Am),reusable:e.reusable.map(Am),retired:e.retired.map(e=>e.slice(0))}}function Am(e){return{leaseId:e.leaseId,node:e.node.slice(0),confirmedTxTime:e.confirmedTxTime}}function jm(e){if(!e||typeof e!=`object`)throw Error(`Invalid IndexedDB foreground node lease pool`);let t=e;if(t.format!==fm||!Array.isArray(t.active)||!Array.isArray(t.reusable)||!Array.isArray(t.retired))throw Error(`Invalid IndexedDB foreground node lease pool`);let n=new Set,r=new Set;for(let e of[...t.active,...t.reusable]){Mm(e);let t=Rm(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=Nm(e)?Rm(e):null;if(!t||n.has(t))throw Error(`Invalid IndexedDB foreground node lease pool`);n.add(t)}}function Mm(e){if(!e||typeof e!=`object`)throw Error(`Invalid IndexedDB foreground node lease`);let t=e;if(!Pm(t.leaseId)||!Nm(t.node)||!Im(t.confirmedTxTime)||!Lm(BigInt(t.confirmedTxTime)))throw Error(`Invalid IndexedDB foreground node lease`)}function Nm(e){return e instanceof ArrayBuffer&&e.byteLength===um}function Pm(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 Fm(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 Im(e){return typeof e==`string`&&/^(0|[1-9][0-9]*)$/.test(e)}function Lm(e){return e>=0n&&e<=pm}function Rm(e){return Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}function zm(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 Bm(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(Sm(e.error,`IndexedDB request failed`))})}function Vm(e){return new Promise((t,n)=>{e.oncomplete=()=>t(),e.onabort=()=>n(Sm(e.error,`IndexedDB transaction aborted`)),e.onerror=t=>{let r=t.target===e?null:t.target;n(Sm(e.error??r?.error??null,`IndexedDB transaction failed`))}})}function Hm(e){return Um(e),e.generation}function Um(e){if(!e||typeof e!=`object`)throw Error(`Invalid IndexedDB B-tree metadata`);let t=e;if(t.formatMagic!==tm||t.formatVersion!==em||!Km(t.pageSize)||t.pageSize!==_m||!Number.isSafeInteger(t.generation)||Number(t.generation)<1||t.rootPageId!==null&&!Jm(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 Wm(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(!Km(t)||t!==_m||!Jm(r))throw Error(`Invalid IndexedDB B-tree commit metadata`);if(n!==null&&(!Jm(n)||n>=r))throw Error(`Invalid IndexedDB B-tree commit root page id`);let i=new Set;for(let[n,a]of e.pages){if(!Jm(n)||n>=r||a.byteLength>t)throw Error(`Invalid IndexedDB B-tree page commit`);i.add(n)}for(let t of e.deletedPageIds??[])if(!Jm(t)||t>=r||t===n||i.has(t))throw Error(`Invalid IndexedDB B-tree deleted page commit`)}function Gm(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(ym).sort();if(n.length!==r.length||n.some((e,t)=>e!==r[t])||t.storageEpoch!==ym.storageEpoch||t.adapterId!==ym.adapterId||t.adapterFormatVersion!==ym.adapterFormatVersion||t.pageSize!==ym.pageSize||t.pageChecksum!==ym.pageChecksum||t.pageFormatMagic!==ym.pageFormatMagic||t.pageFormatVersion!==ym.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=ym.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 Xp(e,t,`Missing or invalid IndexedDB storage epoch manifest: unsupported storage format: this epoch-${vm} root lacks codec families ${JSON.stringify(e)} required by this build and declares ${JSON.stringify(t)} that this build does not read`)}}function Km(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=hm&&e<=gm&&Number.isInteger(Math.log2(e))}function qm(e){if(!Jm(e))throw Error(`Invalid IndexedDB B-tree page id: ${e}`)}function Jm(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}var Ym=new WeakMap,Xm=256,Zm=5e3,Qm=1,$m={TRACE:1,DEBUG:5,INFO:9,WARN:13,ERROR:17};function eh(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 th(e){if(!e.collectorUrl)return()=>{};let t={traceUrl:eh(e.collectorUrl,`traces`),logUrl:eh(e.collectorUrl,`logs`)},{runtimeThread:n,wasmModule:r}=e;if(!ah(r))return console.warn(`[jazz] WASM telemetry unavailable: trace entry hooks are missing.`),()=>{};let i=Ym.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 nh(r,i)}i={identity:t,runtimeThread:n,leases:new Set,nextLeaseId:0,closing:!1,unsubscribe:null,exporter:null,exportTail:Promise.resolve(),shutdownScheduled:!1,drainMicrotaskPending:!1},Ym.set(r,i);let a=()=>{let e=r.drainTraceEntries();!Array.isArray(e)||e.length===0||rh(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),nh(r,i)}catch(e){if(s)try{r.setTraceEntryCollectionEnabled(!1)}catch{}try{i.unsubscribe?.()}catch{}throw i.unsubscribe=null,Ym.get(r)===i&&Ym.delete(r),e}}function nh(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&&rh(t,n)}catch(e){i??=e}finally{try{e.setTraceEntryCollectionEnabled(!1)}catch(e){i??=e}finally{t.unsubscribe=null,ih(t),!i&&Ym.get(e)===t&&Ym.delete(e)}}}if(i)throw i}}function rh(e,t){e.exportTail=e.exportTail.catch(()=>{}).then(async()=>{e.exporter||=sh(e.identity.traceUrl,e.identity.logUrl);try{let n=await e.exporter;for(let r of t)try{oh(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 ih(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 ah(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 oh(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":dh(n.fields)};e.tracer.startSpan(n.name||`wasm span`,{kind:Qm,startTime:n.startUnixNano,attributes:uh(n.fields)?{...ch(n.fields),...r}:r}).end(n.endUnixNano);return}if(n.kind===`log`){let r={"jazz.runtime_thread":t,"jazz.log.sequence":n.sequence,"jazz.log.target":n.target,"jazz.log.fields":dh(n.fields)};e.logger.emit({timestamp:n.timestampUnixNano,severityNumber:lh(n.level),severityText:n.level,body:n.message,attributes:uh(n.fields)?{...ch(n.fields),...r}:r});return}e.logger.emit({severityNumber:$m.WARN,severityText:`WARN`,body:`Dropped ${n.count} WASM telemetry records`,attributes:{"jazz.runtime_thread":t,"jazz.telemetry.dropped_count":n.count}})}async function sh(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:Xm,maxQueueSize:Zm,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 ch(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e))n.startsWith(`jazz.`)||r!=null&&(typeof r==`string`||typeof r==`number`||typeof r==`boolean`?t[n]=r:t[n]=JSON.stringify(r));return t}function lh(e){switch(e.toUpperCase()){case`TRACE`:return $m.TRACE;case`DEBUG`:return $m.DEBUG;case`INFO`:return $m.INFO;case`WARN`:case`WARNING`:return $m.WARN;case`ERROR`:return $m.ERROR;default:return 0}}function uh(e){if(!e)return!1;for(let t in e)return!0;return!1}function dh(e){return uh(e)?JSON.stringify(e):`{}`}var fh=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)}},ph=8,mh=1024*1024,hh=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 fh(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=new Set;removeWorkListener;handleRuntimeWork=e=>this.schedule(e??!1);receive(e){this.closed||e.length===0||(this.inboundRouting=this.inboundRouting.then(()=>this.routeInboundFrames(e)).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=_h(this.transport.recvWireFrames());e.length>0&&this.sendFrames(e);let t=this.transport.recvAuxiliaryWireFrames;if(!t)return!1;let n=_h(t.call(this.transport,ph,mh));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=_h(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(vh(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 yh()}}};function gh(e){return e.map(e=>e.slice())}function _h(e){return e.map(vh)}function vh(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 yh(){return new Promise(e=>setTimeout(e,0))}var bh=`this account's store is open under another sign-in in another tab`,xh=`this account's store is open with another build's schema in another tab`,Sh=`this account's store is open with a newer build of this app in another tab`,Ch=5e3,wh=32,Th=64*1024,Eh=128,Dh=64,Oh=128,kh=256,Ah=8*1024,jh=16*1024,Mh=2*1024;function J(e){let t={remaining:Th},n=Nh(e,t),r=e,i=n,a=new WeakSet;for(let e=0;e<wh;e+=1){if(r&&typeof r==`object`){if(a.has(r))break;a.add(r)}let n=Rh(r,`cause`);if(n===void 0)break;if(!Ph(n)){let e=Hh(n,t);e!==void 0&&(i.cause=e);break}if(e+1>wh||t.remaining===0||a.has(n))break;let o=Nh(n,t);i.cause=o,i=o,r=n}return n}function Nh(e,t){let n=zh(e,`stack`),r=Fh(Rh(e,`code`)),i={name:Vh(zh(e,`name`)??`Error`,kh,t),message:Vh(zh(e,`message`)??Bh(e),Ah,t),...n===void 0?{}:{stack:Vh(n,jh,t)}};if(r!==void 0&&r.length<=t.remaining&&(i.code=Vh(r,Eh,t)),i.code===Yp){let n=Ih(Rh(e,`missing`)),r=Ih(Rh(e,`unknown`));n!==void 0&&r!==void 0&&Lh(n)+Lh(r)<=t.remaining&&(t.remaining-=Lh(n)+Lh(r),i.missing=[...n],i.unknown=[...r])}return i}function Ph(e){return typeof e==`object`&&!!e&&typeof Rh(e,`message`)==`string`}function Fh(e){return typeof e==`string`&&e.length>0&&e.length<=Eh?e:void 0}function Ih(e){return Array.isArray(e)&&e.length<=Dh&&e.every(e=>typeof e==`string`&&e.length>0&&e.length<=Oh)?e:void 0}function Lh(e){return e.reduce((e,t)=>e+t.length,0)}function Rh(e,t){if(!(e===null||typeof e!=`object`&&typeof e!=`function`))try{return e[t]}catch{return}}function zh(e,t){let n=Rh(e,t);return typeof n==`string`?n:void 0}function Bh(e){try{return String(e)}catch{return`Unstringifiable relay error`}}function Vh(e,t,n){let r=Math.min(e.length,t,n.remaining);return n.remaining-=r,e.slice(0,r)}function Hh(e,t){if(e===null||typeof e==`boolean`||typeof e==`number`)return e;if(typeof e==`string`)return Vh(e,Mh,t);if(e!==void 0)return Vh(`[non-error relay cause omitted]`,Mh,t)}var Uh=-(1n<<63n),Wh=(1n<<63n)-1n;function Gh(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<Uh||n>Wh)throw Error(`${t} must be a signed 64-bit integer`);return n}var Kh=new Vl({fatal:!0});function qh(e){if(e.kind!==`hidden-metadata`)return e.kind===`stored-column`?e.outputName:e.name}function Jh(e){return{table:e.string(),descriptor:Xh(e),rows:e.readVec(e=>({rowId:e.bytes(),deleted:e.bool(),raw:e.bytes()}))}}function Yh(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),og(e,r.valueType)},t.length)}function Xh(e){return e.readVec(e=>{let t=e.u64();return t===0?{kind:`stored-column`,id:e.u64(),outputName:e.string(),valueType:sg(e)}:t===1?{kind:`result-field`,name:e.string(),valueType:sg(e)}:t===2?{kind:`hidden-metadata`,name:e.string(),valueType:sg(e)}:Zh(t)})}function Zh(e){throw Error(`unknown native row descriptor field kind ${e}`)}function Qh(e){let t={added:e.readVec(Jh),updated:e.readVec(Jh),removed:e.readVec(rg),addedOccurrenceKeys:e.readVec(e=>$h(e)),updatedOccurrenceKeys:e.readVec(e=>$h(e)),removedOccurrenceKeys:e.readVec(e=>$h(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 ng(e,`subscription delta`),t}function $h(e){let t=e.bytes();if(t[0]!==2||!eg(t.subarray(1)))throw Error(`malformed ResultKey`);return t}function eg(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||!Kl(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 tg(e){let t=e.u64(),n=e.readVec(Jh);return ng(e,`relation snapshot`),{rootCount:t,rows:n}}function ng(e,t){if(!e.done())throw Error(`${t} has trailing postcard bytes`)}function rg(e){return{table:e.string(),rowId:e.bytes()}}function ig(e,t){e.vec((e,n)=>{e.some(e=>e.string(t[n].name??``)),og(e,t[n].valueType)},t.length)}function ag(e){return e.readVec(e=>({name:e.option(e=>e.string()),valueType:sg(e)}))}function og(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)}return}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);return}if(t.tag===13){let n=t.members??(t.inner?[t.inner]:[]);e.vec((e,t)=>og(e,n[t]),n.length);return}if(t.tag===14||t.tag===15){if(!t.inner)throw Error(`missing inner value type for tag ${t.tag}`);og(e,t.inner);return}if(t.tag===16){if(!t.record)throw Error(`missing inline record descriptor for tag 16`);ig(e,t.record);return}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),ig(e,n.payload)},r.length)}}function sg(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:sg(e)};if(t===13){let n=e.readVec(sg);return{tag:t,members:n,inner:n[0]}}return t===16?{tag:t,record:ag(e)}:t===17?{tag:t,enumSchema:{registryId:e.u64(),name:e.string(),cases:e.readVec(e=>({name:e.string(),payload:ag(e)}))}}:{tag:t}}function cg(e,t){let n=Wg(e),r=n.fixed.map(e=>t[e.logicalIndex]),i=n.variable.map(e=>t[e.logicalIndex]),a=Wl(r),o=new Jg,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 Wl([a,o.finish(),...i])}function lg(e,t){let n=vg(wg(e));return e.map((e,r)=>{let i=n(t,r);return i==null?{type:`Null`}:Ig(e.column_type,i)})}function ug(e,t){return Object.defineProperty(e,`valuesByColumn`,{value:t,enumerable:!1,configurable:!0}),e}function dg(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r];i&&n.set(i.name,t[r])}return n}var fg={name:`__jazz_terminal_row_key`,column_type:{type:`Uuid`},nullable:!1};function pg(e,t,n){let r=mg([fg,...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 ug({id:e,values:a},dg(t,a))}function mg(e,t){let n=vg(wg(e));return e.map((e,r)=>{let i=n(t,r);return i==null?{type:`Null`}:hg(e.column_type,i,e.name)})}function hg(e,t,n){switch(e.type){case`Timestamp`:return{type:`Timestamp`,value:Vg(t,n)};case`Array`:return{type:`Array`,value:gg(e.element,t)};case`Row`:if(t.byteLength<16)throw Error(`terminal nested row is missing its physical key`);return{type:`Row`,value:pg(Hg(t.subarray(0,16)),e.columns,t)};default:return Ig(e,t)}}function gg(e,t){return Bg(e,t,t=>hg(e,t))}function _g(e,t){return cg(wg(e),e.map((e,n)=>Tg(e,t[n])))}function vg(e){let t=Wg(e);return(n,r)=>yg(e,t,n,r)}function yg(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 bg(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:Gg(n,o+(i.variableIndex-1)*4),l=i.variableIndex===t.variable.length-1?n.length:Gg(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 ${xg(a)}, tag ${a.tag}, claimed width ${i}, remaining buffer ${o}, current offset ${c}, end offset ${l}, record length ${n.length}`)}return bg(n.subarray(c,l),a)}function bg(e,t){if(t.tag!==15)return e;let n=Cg(e);return n==null?null:t.inner?bg(n,t.inner):n}function xg(e){return e.tag===14||e.tag===15?`${e.tag===14?`Array`:`Nullable`}<${e.inner?xg(e.inner):`?`}>`:Sg(e.tag)}function Sg(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 Cg(e){return e[0]===0?null:e[0]===1?e.subarray(1):e}function wg(e){return e.map(e=>({name:e.name,valueType:Ng(e)}))}function Tg(e,t){let n=Fg(e.column_type),r=e.nullable?{tag:15,inner:n}:n;if(!t){if(e.sparse)return Dg({tag:15,inner:r});if(!e.nullable)throw Error(`missing non-nullable value for ${e.name}`);return Dg(r)}if(t.type===`Null`){if(!e.nullable)throw Error(`missing non-nullable value for ${e.name}`);let t=Dg(r);return e.sparse?Eg(t,r):t}let i=Og(e.column_type,t);return e.nullable&&(i=Eg(i,n)),e.sparse?Eg(i,r):i}function Eg(e,t){if(Ug(t)==null)return Wl([Uint8Array.of(1),e]);let n=new Uint8Array(1+e.length);return n[0]=1,n.set(e,1),n}function Dg(e){let t=Ug(e);return t==null?Uint8Array.of(0):new Uint8Array(t)}function Og(e,t){switch(e.type){case`Boolean`:if(t.type!==`Boolean`)throw Error(`expected Boolean value`);return Uint8Array.of(t.value?1:0);case`Integer`:{let e=Kg(t),n=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=new Uint8Array(8);return new DataView(n.buffer).setBigUint64(0,BigInt(t.value),!0),n}case`BigInt`:{let e=qg(t),n=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=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 Wl([Uint8Array.of(0),new TextEncoder().encode(t.value)]);case`Uuid`:if(t.type!==`Uuid`)throw Error(`expected Uuid value`);return Mg(t.value);case`Bytea`:if(t.type!==`Bytea`)throw Error(`expected Bytea value`);return Wl([Uint8Array.of(0),t.value]);case`Array`:if(t.type!==`Array`)throw Error(`expected Array value`);return Ag(e.element,t.value);case`Row`:if(t.type!==`Row`)throw Error(`expected Row value`);return kg(e.columns,t.value)}}function kg(e,t){let n=_g(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?Mg(t.id):new Uint8Array;return Wl([Uint8Array.of(t.id?1:0),r,jg(n.byteLength),n])}function Ag(e,t){let n=t.map(t=>Og(e,t));if(Ug(Fg(e))!=null)return Wl(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)}),Wl([jg(t.length),r,...n])}function jg(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),t}function Mg(e){let t=Mu(e);if(!t)throw Error(`invalid UUID value ${e}`);return t}function Ng(e){let t=Fg(e.column_type);return e.nullable&&(t={tag:15,inner:t}),e.sparse?{tag:15,inner:t}:t}function Pg(e){return e.map(e=>({...e,sparse:void 0,column_type:e.column_type.type===`Row`?{...e.column_type,columns:[...Pg(e.column_type.columns)]}:e.column_type.type===`Array`&&e.column_type.element.type===`Row`?{...e.column_type,element:{...e.column_type.element,columns:[...Pg(e.column_type.element.columns)]}}:e.column_type}))}function Fg(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:Fg(e.element)};case`Row`:return{tag:9}}}function Ig(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:Kh.decode(Lg(t))};case`Uuid`:return{type:`Uuid`,value:Hg(t)};case`Bytea`:return{type:`Bytea`,value:Lg(t).slice()};case`Array`:return{type:`Array`,value:zg(e.element,t)};case`Row`:return{type:`Row`,value:Rg(e.columns,t)}}}function Lg(e){if(e[0]!==0)throw Error(`indirect scalar crossed a logical binding boundary`);return e.subarray(1)}function Rg(e,t){if(t.byteLength<5)throw Error(`invalid nested row value`);let n=t[0]===1,r=1,i;n&&(i=Hg(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=lg(e,o);return ug({id:i,values:s},dg(e,s))}function zg(e,t){return Bg(e,t,t=>Ig(e,t))}function Bg(e,t,n){let r=Ug(Fg(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=Gg(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:Gg(t,4+(e-1)*4),s=e===i-1?t.length:Gg(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 Vg(e,t){let n=new DataView(e.buffer,e.byteOffset,e.byteLength).getBigUint64(0,!0);return Number(n)}function Hg(e){if(e.length>=16)return ku(e,0);let t=Ou(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Ug(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=Ug(t);return n==null?void 0:e+n},0);case 10:case 14:return;case 15:{let t=e.inner?Ug(e.inner):void 0;return t==null?void 0:t+1}default:return}}function Wg(e){let t=[];t.length=e.length;let n=[],r=[],i=0;for(let r=0;r<e.length;r+=1){let a=Ug(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(Ug(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 Gg(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Kg(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 qg(e){if(e.type!==`BigInt`)throw Error(`expected BigInt value`);return Gh(e.value,`BigInt value`)}var Jg=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)}},Yg=class{constructor(e){this.text=e}};function Xg(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 Zg(e){let t=JSON.parse(e),n=(e,t)=>typeof e==`string`?(Xg(e),e.includes(t)):Array.isArray(e)?e.some(e=>n(e,t)):e&&typeof e==`object`?Object.entries(e).some(([e,r])=>(Xg(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);continue}if(n===`"`){o=!0,a+=n;continue}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 Yg(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 Qg(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`),Xg(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 Yg&&(/^(?: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 Yg){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=new DataView(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?1:0);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=new DataView(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);return}if(e===`False`){u(10);return}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 $g=new Vl({fatal:!0}),e_=new TextEncoder().encode(`["https://jazz.invalid","self-signed-open"]`);function t_(e,t){return t?e_:e}function n_(e,t,n,r=!1,i,a,o,s){let c=new __;return c.bytes(e),c.string(r_(t_(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(y_(o))),s==null?c.none():c.some(e=>e.bytes(s)),c.finish()}function r_(e){try{let t=$g.decode(e);if(eu(t))return t}catch{}throw Error(`native open config author must be a canonical UTF-8 author identity`)}function i_(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&&s_(`query limit`,r),s_(`query offset`,i);let u=new __;return u.string(e),u.vec((e,n)=>{let r=t[n];l_(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)=>{o_(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(Qg(c),!1)),a_(u,l),u.finish()}function a_(e,t){e.vec((e,n)=>{let r=t[n];if(e.string(r.column),r.kind===`json_pointer`){e.u64(3),e.string(r.at);return}s_(`partial selection ${r.column} start`,r.from),s_(`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 o_(e,t){let{filters:n=[],select:r,orderBy:i=[],limit:a=null,offset:o=0,requirement:s=`Optional`,nestedArrays:c=[]}=t;a!=null&&s_(`array subquery ${t.columnName} limit`,a),s_(`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)=>{l_(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(c_(s)),e.vec((e,t)=>{o_(e,c[t])},c.length),a_(e,[])}function s_(e,t){if(!Number.isSafeInteger(t)||t<0)throw Error(`${e} must be a non-negative safe integer`)}function c_(e){switch(e){case`Optional`:return 0;case`AtLeastOne`:return 1;case`MatchCorrelationCardinality`:return 2}}function l_(e,t){if(t.op===`All`||t.op===`Any`){e.u64(t.op===`All`?0:1),e.vec((e,n)=>l_(e,t.predicates[n]),t.predicates.length);return}if(t.op===`Not`){e.u64(2),l_(e,t.predicate);return}if(t.op===`In`){e.u64(5),f_(e,t.column),e.vec((e,n)=>{e.u64(3),h_(e,t.values[n])},t.values.length);return}if(t.op===`Contains`){e.u64(10),f_(e,t.column),p_(e,t.value);return}if(t.op===`StartsWith`||t.op===`EndsWith`){e.u64(t.op===`StartsWith`?13:14),f_(e,t.column),p_(e,t.value);return}if(t.op===`IsNull`||t.op===`IsNotNull`){t.op===`IsNotNull`&&e.u64(2),e.u64(12),f_(e,t.column);return}if(u_(t)){d_(e,t.column,t.op,t.value);return}throw Error(`unsupported query predicate ${JSON.stringify(t)}`)}function u_(e){return e.op===`Eq`||e.op===`Ne`||e.op===`Gt`||e.op===`Gte`||e.op===`Lt`||e.op===`Lte`}function d_(e,t,n,r){e.u64(m_(n)),f_(e,t),p_(e,r)}function f_(e,t){e.u64(0),e.string(t)}function p_(e,t){e.u64(3),h_(e,t)}function m_(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 h_(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);return}if(t.type===`Nullable`){e.u64(13),t.value==null?e.none():e.some(e=>h_(e,t.value));return}if(t.type===`Boolean`){e.u64(5),e.bool(t.value);return}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);return}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);return}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);return}if(t.type===`Double`){if(!Number.isFinite(t.value))throw Error(`Double value must be finite`);e.u64(4),e.f64Le(t.value);return}if(t.type===`Uuid`){e.u64(9);let n=Mu(t.value);if(!n)throw Error(`invalid uuid ${t.value}`);e.bytes(n);return}if(t.type===`Bytea`){e.u64(7),e.bytes(t.value);return}if(t.type===`Array`){e.u64(12),e.vec((e,n)=>h_(e,t.value[n]),t.value.length);return}e.u64(6),e.string(t.value)}var g_=64,__=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=Gh(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=new Uint8Array(8);new DataView(t.buffer).setFloat64(0,e,!0),this.bytes(t,!1)}bool(e){this.chunks.push(e?1:0)}string(e){this.bytes(b_(e))}bytes(e,t=!0){if(t&&this.u64(e.length),e.length<g_){for(let t of e)this.chunks.push(t);return}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)}},v_=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 $g.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 y_(e){return b_(JSON.stringify(e,ql))}function b_(e){return new TextEncoder().encode(e)}async function*x_(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 S_=`history.`;function C_(e){return w_(e)!==void 0}function w_(e){return e.startsWith(S_)?e.slice(S_.length):void 0}var T_=[{name:`$transactionId`,column_type:{type:`Text`},nullable:!1},{name:`$acceptedAt`,column_type:{type:`Timestamp`},nullable:!1}],E_=new WeakMap;function D_(e,t){let n=w_(t);if(n===void 0)return e[t];if(C_(n)||!Object.hasOwn(e,n))return;let r=E_.get(e);r||E_.set(e,r=new Map);let i=r.get(t);if(!i){let a=e[n];i={columns:[...a.columns,...T_],...a.branchBy?{branchBy:a.branchBy}:{}},r.set(t,i)}return i}var O_=`authority_changed`,k_=class extends Error{name=`AuthorityChangedError`;code=O_;constructor(e,t){super(e,t)}};function A_(e){return!e||typeof e!=`object`?!1:e.code===O_}function j_(e){if(e==null)return null;let t=typeof e==`object`&&typeof e.message==`string`?e.message:String(e);if(A_(e))return new k_(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 M_=`core_tick_failed`,N_=class extends Error{name=`CoreTickFailedError`;code=M_;constructor(e){super(`core tick failed: ${F_(e)}`,{cause:e})}};function P_(e){return!e||typeof e!=`object`?!1:e.code===M_}function F_(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 I_(e){if(e.startsWith(`$`))return e;let t=e.indexOf(`.$`);return t>=0?e.slice(t+1):e.split(`.`).at(-1)??e}function L_(){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 R_=[`$canRead`],z_=[`$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 B_(e){return R_.includes(e)}function V_(e){return z_.includes(e)}function H_(e){if(e===`$createdBy`||e===`$updatedBy`||e===`$deletedBy`)return L_();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=L_();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 U_=`__jazz_include_`;function W_(e,t,n,r){let i=n.filter(e=>!e.name.startsWith(U_)),a=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=>!V_(e.name)).map(e=>a.get(e.name))},`valuesByColumn`,{value:a,configurable:!0})}function G_(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 K_=Object.freeze({pending:0,oldestPendingAt:null,rejected:0,lastRejection:null});function q_(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 J_=Object.freeze({state:`local-only`}),Y_=Object.freeze({state:`connecting`}),X_=Object.freeze({state:`connected`});function Z_(e,t=e===`network`){return{state:`offline`,reason:e,retrying:t}}function Q_(e){switch(e?.phase??`noServer`){case`noServer`:return J_;case`offline`:return Z_(`disconnected`);case`live`:return X_;case`connecting`:case`backoff`:return e.outagePublished?Z_(`network`):Y_;case`awaitingCredential`:return Z_(`auth`);case`stopped`:return Z_(`stopped`)}}function $_(e,t){return e.state===t.state?e.state!==`offline`||t.state!==`offline`?!0:e.reason===t.reason&&e.retrying===t.retrying&&e.authReason===t.authReason:!1}function ev(e,t){return e.pending===t.pending&&e.oldestPendingAt===t.oldestPendingAt&&e.rejected===t.rejected&&e.lastRejection?.at===t.lastRejection?.at&&e.lastRejection?.code===t.lastRejection?.code}var tv=class{constructor(e,t=Object.is){this.read=e,this.same=t}listeners=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)}}))}},nv=class extends tv{},rv=`system`;pu({issuer:au,user_id:rv,claims:{},authMode:`external`});var iv=new TextEncoder;function av(e){return iv.encode(Yl(e))}function ov(e){let t=new __;return t.string(e.table),Yh(t,[...e.descriptor]),Ou(t.finish())}function sv(e){if(!e||typeof e!=`object`)return;let t=e.code;return typeof t==`string`?t:void 0}var cv=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 lv(e){let t=sv(e);return t!==void 0&&cv.has(t)?t:void 0}var uv=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 dv(e){if(!e||typeof e!=`object`)return;let t=e.reason;return typeof t==`string`&&uv.has(t)?t:void 0}var fv=3600*1e3,pv=500,mv=`jazz-http-stream-endpoints`,hv=`endpoints`;function gv(){return globalThis.indexedDB!==void 0}function _v(){let e=globalThis.indexedDB;if(e)return new Promise((t,n)=>{let r=e.open(mv,1);r.onupgradeneeded=()=>r.result.createObjectStore(hv),r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error),r.onblocked=()=>n(Error(`blocked`))})}async function vv(e,t){let n=_v();if(!n)return;let r=await n;try{return await new Promise((n,i)=>{let a=t(r.transaction(hv,e).objectStore(hv));a.onsuccess=()=>n(a.result),a.onerror=()=>i(a.error)})}finally{r.close()}}var yv=`jazz-stream-endpoint:`,bv=600*1e3;function xv(){if(!(typeof document>`u`))try{return globalThis.localStorage??void 0}catch{return}}function Sv(e,t=Date.now()){let n=xv();if(n)try{let r=n.getItem(yv+e);if(r===null)return;let[i,a]=r.split(`:`);if(i!==`stream`&&i!==`none`||!(Number(a)>t)){n.removeItem(yv+e);return}return i===`stream`}catch{return}}function Cv(e,t,n){let r=xv();if(r)try{r.setItem(yv+e,`${t}:${n}`)}catch{try{r.removeItem(yv+e)}catch{}}}async function wv(e,t=Date.now()){let n,r=await Promise.race([vv(`readonly`,t=>t.get(e)).then(e=>({until:e}),()=>{}),new Promise(e=>{n=setTimeout(()=>e(void 0),pv)})]).finally(()=>clearTimeout(n));if(!r)return!1;let i=typeof r.until==`number`&&r.until>t;return i?Cv(e,`stream`,r.until):Cv(e,`none`,t+bv),i}function Tv(e,t=Date.now()){return Cv(e,`stream`,t+fv),vv(`readwrite`,n=>n.put(t+fv,e)).then(()=>{},()=>{})}function Ev(e){return Cv(e,`none`,Date.now()+bv),vv(`readwrite`,t=>t.delete(e)).then(()=>{},()=>{})}var Dv=0,Ov=`x-jazz-stream-key`,kv=1,Av=2;function jv(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 Mv(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 Nv=class{buffered=new Uint8Array;push(e){this.buffered=this.buffered.byteLength?Mv([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}},Pv=new TextEncoder,Fv=new TextDecoder;function Iv(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 Lv=class{listeners=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)}},Rv=4*1024*1024,zv=(e,t)=>fetch(e,t),Bv=class extends Lv{constructor(e,t=zv){super(),this.request=t,this.streamUrl=Iv(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`?Pv.encode(e):e;this.queued.push(jv(kv,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:{[Ov]:e.key},signal:AbortSignal.timeout?.(Wv)}).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 Nv;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===Dv)this.session=JSON.parse(Fv.decode(t)),this.readyState=1,this.emit(`open`);else if(e===kv){let e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);this.emit(`message`,{data:e})}else if(e===Av){let{code:e,reason:n}=JSON.parse(Fv.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<=Rv);)t+=this.queued[e].byteLength,e+=1;let n=Mv(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`,[Ov]: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}))}},Vv=new Set,Hv=new Map,Uv=3,Wv=1e4,Gv=2,Kv=new Map,qv=`x-jazz-stream`,Jv=new Set,Yv=`x-jazz-store-error`,Xv=new Set;async function Zv(e,t){try{let n=await t(e.replace(/^ws/,`http`),{method:`POST`,credentials:`same-origin`,signal:AbortSignal.timeout?.(Wv)});if(n.status===503&&n.headers.get(Yv)===`1`){let t=await n.text().catch(()=>``);return t&&!Xv.has(`${e}
|
|
4
4
|
${t}`)&&(Xv.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(qv)===`1`?`stream`:`upgrades`:`other`}catch{return`silent`}}async function Qv(e,t,n){let r=await Zv(e,n);if(r===`stream`)return r;if(r!==`upgrades`)return Hv.delete(e),Kv.delete(e),r===`refused`&&!Jv.has(e)&&(Jv.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=(Hv.get(e)??0)+1;Hv.set(e,i);let a=t?(Kv.get(e)??0)+1:0;t?Kv.set(e,a):Kv.delete(e);let o=a>=Gv;return i<Uv&&!o?r:(Hv.delete(e),Kv.delete(e),o?(console.warn(`jazz: ${a} WebSockets in a row to ${e} got no answer in ${Wv/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 $v(e,t={}){let n=t.fetch??zv,r=t.describeFailedUpgrade;return class extends Lv{constructor(e){if(super(),this.url=e,Vv.has(e)){this.openStream();return}if(!gv()){this.inner=this.openNative();return}let t=Sv(e);if(t===!0){Vv.add(e),this.openStream();return}if(t===!1){this.inner=this.openNative();return}wv(e).then(t=>{this.closedEarly||(t?(Vv.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 Bv(this.url,n),t=!1;e.addEventListener(`open`,()=>{t=!0}),e.addEventListener(`close`,()=>{!t&&!this.closedByClient&&(Vv.delete(this.url),Ev(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,Qv(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){Vv.add(this.url),e===`stream`&&Tv(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()},Wv),t.addEventListener(`open`,()=>{a||(clearTimeout(this.openDeadline),i=!0,Hv.delete(this.url),Kv.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 ey=`jazz_renewal`,ty=`X-Jazz-Renew`,ny=64,ry=65,iy=2048;function ay(e){let t=new v_(e);if(t.u64()!==ny)throw Error(`not a renew-soon frame`);let n=t.string(),r=t.u64();if(!t.done()||!n||n.length>iy)throw Error(`malformed renew-soon frame`);return{session:n,renewInMs:r}}function oy(e){let t=new __;return t.u64(ry),t.string(e),t.finish()}function sy(e){return e[0]===ny}function cy(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 ly(e){try{return`jazz-session-refresh:${new URL(e.replace(/^ws/,`http`)).origin}`}catch{return`jazz-session-refresh:${e}`}}var uy=class extends Error{wireError;constructor(e){super(`websocket ${e.code} before server hello: ${e.message}`),this.name=`PreHelloWireError`,this.wireError=e}};function dy(e){return e.retry===`later`&&(e.code===`not_ready`||e.code===`backpressure`)}function fy(e){return e.retry===`later`&&(e.code===`websocket_closed`||e.code===`websocket_error`||e.code===`websocket_silent`)}function py(e){return e.code===`protocol_error`?!0:(e.code===`websocket_closed`||e.code===`websocket_error`||e.code===`websocket_silent`)&&!fy(e)}var my=6,hy=my,gy=my,_y=16,vy=128,yy=256,by=2048,xy=12e4,Sy=16384,Cy=1e4,wy=1e3,Ty=7,Ey=_y|vy|yy|12288,Dy=1<<20,Oy=5,ky=5,Ay=2*1024*1024,jy=4096;function My(e){Py(e);let t=new __;t.vec((t,n)=>t.bytes(e[n]),e.length);let n=t.finish();if(n.byteLength>Ay)throw Error(`websocket frame batch exceeds maximum length of ${Ay} bytes`);return n}function Ny(e){if(e.byteLength>Ay)throw Error(`websocket frame batch exceeds maximum length of ${Ay} bytes`);let t=new v_(e),n=t.u64();if(n===0||n>jy)throw Error(`websocket frame batch exceeds frame-count limit of ${jy}`);let r=[];for(let e=0;e<n;e+=1)r.push(t.bytesAtMost(Ay,`websocket frame`));return qy(t,`websocket frame batch`),r}function Py(e){if(e.length===0||e.length>jy)throw Error(`websocket frame batch exceeds frame-count limit of ${jy}`);for(let t of e)if(t.byteLength>Ay)throw Error(`websocket frame exceeds maximum length of ${Ay} bytes`)}function Fy(e=Ey){Wy(e,`client wire features`);let t=new __;return t.u64(0),t.u64(hy),t.u64(gy),t.u64(e),t.u64(0),t.none(),t.finish()}var Iy=0,Ly=1;function Ry(e){if(e[0]!==Iy)return!1;let t=new v_(e);t.u64();let{min:n,max:r}=Gy(t);return n===my&&r===my&&Ky(t),!0}function zy(e){return e[0]===Ly?(By(e),!0):!1}function By(e){let t=new v_(e),n=t.u64();if(n!==Ly)throw Error(`expected WireFrame::Error, got tag ${n}`);let r={code:fb(t.u64()),retry:mb(t.u64()),message:t.string()};return t.done()||(r.reason=pb(t.u64())),qy(t,`WireFrame::Error`),r}function Vy(e){return e.code===`auth_failed`?e.reason===`reauthenticate`?`invalid`:Du(e.reason!==void 0&&!e.reason.startsWith(`unknown:`)?e.reason:e.message):null}var Hy=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??Lu(this.url)??lb(this.url);this.onFrame=e.onFrame,this.onError=e.onError,this.onTerminal=e.onTerminal,this.localFeatures=(e.features??Ey)|by|Sy,this.renewalUrl=Xy(e.authJson)?cy(this.url):null,Wy(this.localFeatures,`client wire features`),this.socket=new t(this.url),this.socket.binaryType=`arraybuffer`,this.watchHandshake(e.handshakeTimeoutMs??Cy),this.opened=new Promise((e,t)=>{this.resolveNegotiation=e,this.rejectNegotiation=t}),hb(this.socket).then(()=>{if(!this.closing){this.socket.send(Yy(e.authJson??`{}`,e.peerIdentity,e.requestedLink,this.renewalUrl!==null)),this.socket.send(My([Fy(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=Jy(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=ky;for(let r of e){let e=r.byteLength+Oy;t.length>0&&(t.length>=jy||n+e>Dy)&&(this.socket.send(My(t)),t=[],n=ky),t.push(r),n+=e}t.length>0&&this.socket.send(My(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`},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())},wy)},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)&&Qy(n,e).then(e=>{if(!(!e||this.closing||this.terminated))return this.send(oy(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;if(t>=xy&&!e){this.silenceTimer=setTimeout(()=>this.watchSilence(!0),wy);return}if(t>=xy){this.reportTerminal({code:`websocket_silent`,retry:`later`,message:`the server sent nothing for ${Math.round(t/1e3)} s, not even a heartbeat`}),this.close();return}this.silenceTimer=setTimeout(()=>this.watchSilence(),xy-t)}async handleMessage(e){for(let t of Ny(await cb(e))){if(this.closing)return;if(Ry(t)){if(this.negotiated)continue;this.negotiated=!0,clearTimeout(this.handshakeTimer);let e=Uy(t,this.localFeatures);(e.features&by)!==0&&this.watchSilence(),this.resolveNegotiation({...e,features:e.features&~by&~Sy});continue}if(!(this.negotiated&&t.byteLength===1&&t[0]===Ty)){if(this.negotiated&&this.renewalUrl&&sy(t)){this.scheduleRenewal(ay(t));continue}if(!this.negotiated){if(zy(t)){let e=By(t);if(Vy(e)){this.reportTerminal(e,Error(`websocket authentication failed before server hello: ${e.message}`)),this.close();return}this.reportTerminal(e,new uy(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(zy(t)){let e=By(t);if(dy(e)){this.reportTerminal(e),this.close();return}this.onError?.(e);continue}this.onFrame(t)}}}};function Uy(e,t=Ey){let n=new v_(e);if(n.u64()!==0)throw Error(`expected WireFrame::Hello`);let{min:r,max:i}=Gy(n);if(r!==my||i!==my)throw Error(`server must advertise exactly wire protocol ${my}, got ${r}..=${i}`);let{features:a,role:o,authority:s}=Ky(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:my,features:Number(a),authority:s}}function Wy(e,t){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw Error(`${t} must be an unsigned 32-bit integer, got ${e}`)}function Gy(e){return{min:e.u64(),max:e.u64()}}function Ky(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 qy(e,`WireFrame::Hello`),{features:t,role:n,authority:r}}function qy(e,t){if(!e.done())throw Error(`${t} has trailing postcard bytes`)}function Jy(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 Yy(e,t,n,r=!1){let i=JSON.parse(e),a=new Vl().decode(t),o=gb(i)??sb(a)??a;return JSON.stringify({peer_identity:a,...i,auth:{...i,sub:o},sub:o,...n?{requested_link:n}:{},...r?{[ey]:1}:{}})}function Xy(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 Zy=3e4;async function Qy(e,t){return $y(ly(e),()=>eb(e,t))}async function $y(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,Zy)})]).finally(()=>clearTimeout(e))})}catch{}return i()}async function eb(e,t){try{let n=await Iu(e)(e,{method:`POST`,credentials:`same-origin`,redirect:`error`,headers:{[ty]:t}});if(!n.ok)return null;let r=await n.json();return typeof r.renewal==`string`?r.renewal:null}catch{return null}}function tb(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=wu(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 vu(t)}return vu(n)}function nb(e,t){let n=JSON.parse(e);if(typeof n.admin_secret==`string`||typeof n.backend_secret==`string`&&!ib(n))return new TextEncoder().encode($l(`urn:jazz:system`,`system`));let r=ob(n),i=null;try{i=eu(new Vl({fatal:!0}).decode(t))}catch{}if(i?.account_id&&r){let e=eu(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 rb(e){let t=JSON.parse(e);return typeof t.backend_secret==`string`&&!t.admin_secret&&!ib(t)&&delete t.jwt_token,JSON.stringify(t)}function ib(e){let t=e.backend_session;return typeof t==`object`&&!!t&&!Array.isArray(t)&&typeof t.issuer==`string`&&typeof t.user_id==`string`&&Ql(t.issuer)&&Ql(t.user_id)}function ab(e){let t=JSON.parse(e);return typeof t.admin_secret==`string`||typeof t.backend_secret==`string`||ob(t)!==null}function ob(e){if(typeof e.admin_secret==`string`)return null;if(typeof e.backend_secret==`string`&&ib(e)){let t=e.backend_session;return $l(t.issuer,t.user_id,t.account_id)}if(typeof e.jwt_token==`string`){let t=wu(e.jwt_token),n=typeof t?.iss==`string`?t.iss:void 0,r=t?.sub;if(typeof n==`string`&&typeof r==`string`&&Ql(n)&&Ql(r))return $l(n,r)}return null}function sb(e){return eu(e)?.user_id??null}async function cb(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 lb(e){let t=db();return ub(e)?$v(t):t}function ub(e){let t=globalThis.location;if(!t?.host)return!1;try{return new URL(e).host===t.host}catch{return!1}}function db(){let e=globalThis.WebSocket;if(!e)throw Error(`browser WebSocket is not available`);return e}function fb(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 pb(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 mb(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 hb(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(Error(`websocket closed before open`))))})}function gb(e){let t=e.sub;if(typeof t==`string`&&Ql(t))return t;let n=e.jwt_token;if(typeof n==`string`){let e=_b(n);if(e)return e}let r=e.backend_session;if(r&&typeof r==`object`){let e=r.user_id;if(typeof e==`string`&&Ql(e))return e}return null}function _b(e){let t=e.split(`.`);if(t.length<2)return null;try{let e=JSON.parse(vb(t[1]));return typeof e.sub==`string`&&Ql(e.sub)?e.sub:null}catch{return null}}function vb(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 yb=20,bb=/^(?:0|[1-9][0-9]*|-[1-9][0-9]*)$/,xb=16,Sb={none:`none`,connecting:`attempting`,connected:`live`,unavailable:`failed`},Cb=250,wb=4;function Tb(e){return typeof e?.poll==`function`}function Eb(e){if(!e||e instanceof Uint8Array)throw Error(`Native runtime direct mutation did not return a write receipt`);return e}function Db(e){let t=e;return typeof t?.poll==`function`&&typeof t.cancel==`function`}function Ob(e,t){return fy(e)?{kind:`network`,message:e.message}:py(e)?{kind:`fatal`,message:e.message}:{kind:`wire`,...e,admitted:t}}function kb(e,t){return e?Promise.allSettled([e,t]).then(e=>{for(let t of e)if(t.status===`rejected`)throw t.reason}):t}function Ab(e){let t=e;return typeof t?.poll==`function`&&typeof t.cancel==`function`&&typeof t.setWake==`function`}var jb=new Vl({fatal:!0}),Mb=new WeakMap;function Nb(e,t,n,r,i,a=!1){try{return Pb(e,t,n,r,i,a)}catch(e){throw Qp(e)}}function Pb(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 Fb(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 Ib(e){let t=e.indexOf(`. Plan: `);return t===-1?e:e.slice(0,t)}var Lb={open:0,quiesced:1,storageCleared:1,closing:2,closed:3},Rb=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:new Map,completedTxs:new Map,writes:new Map},this.pendingTxs=this.transactionOwner.pendingTxs,this.completedTxs=this.transactionOwner.completedTxs,this.writes=this.transactionOwner.writes,this.schemaBytes=av(t),this.trustedBackend=(o?.owner?.trustedBackend??o?.backendMode)===!0,this.selfSignedClientProof=o?.selfSignedClientProof,this.scopeIsolatedRelay=o?.scopeIsolatedRelay===!0,this.webSocket=o?.webSocket,this.configBytes=n_(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=Xl(t),o?.db)this.db=o.db;else if(o?.persistentPath){if(!e)throw Error(`Native runtime constructor required for persistent storage`);this.db=Nb(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=Fb(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&&(G_(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(!e)return this.nativeAuthRefusalRenewable=!1,this.clearRemoteServerTransportError();let t=e.code?j_({code:e.code,message:e.reason}):Error(e.reason);this.handleServerTransportError(t,this.serverConnectionGeneration,e.retrying||this.nativeAuthRefusalRenewable)})}auxiliaryReceiveDeadlines=new Map;pendingNativeAdmissionCancels=new Set;pendingNativeReadCancels=new Set;db;schemaBytes;configBytes;peerIdentity;upstreamPrincipal=null;selfSignedClientProof;scopeIsolatedRelay;schemaHash;trustedBackend;transactionOwner;pendingTxs;completedTxs;writes;pendingLocalSettlements=new Set;localSettlementListeners=new Set;pendingStreamingMutations=new Set;streamingFinalization=Promise.resolve();ownerRuntime;slowQueryApp;slowQueryConsoleDetail;get preparationOwner(){return this.ownerRuntime}readAuthorizationHost;subscriptions=new Map;subscriptionPool;pooledSubscriptions=new Map;drainingSubscriptionPool=!1;subscriptionPoolDirty=!1;authFailureCallback=null;authRestoredCallback=null;mutationErrorCallback=null;serverTransportErrorCallback=null;deliveredMutationErrors=new Set;serverTransport=null;peerUpstreamAttached=!1;nonDurableClient=!1;serverCarrier=null;webSocket;serverCarrierPromise=null;serverConnectionAttempt=null;serverReplacementRetirement=null;serverTransportError=null;serverTransportErrorWaiters=[];localStorageFailure=null;localStorageFailureWaiters=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;nativeLinkEverConnected=!1;nativeLinkPoll=null;firstLoadWaitSeen=!1;remoteLink=new nv(()=>this.readRemoteLinkState());linkStatusPublisher=new tv(()=>this.upstreamLinkStatus(),$_);syncStatusPublisher=new tv(()=>this.readSyncStatus(),(e,t)=>ev(e.uploads,t.uploads)&&$_(e.link,t.link));lastFailure=null;failingAs=null;pendingInboundServerFrames=[];serverInboundRouting=Promise.resolve();serverInboundProcessed=!1;peerTransportWorkListeners=new Set;auxiliaryTraceListeners=new Set;queryCoverageTraceListeners=new Set;peerTransportActivityEpoch=0;peerTransportProcessedActivityEpoch=0;coreTickScheduled=!1;coreDeadlineTimer;coreDeadlineAt;coreTickAgain=!1;coreOperation=null;pendingTransportRetirements=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(av(t),n?y_(n):void 0),backendMode:this.trustedBackend,owner:this})}createPeerAuthority(){return{node:this.node,epoch:Pl(),features:this.nativeWireFeatures()}}async connectUpstreamPeer(e){return this===this.ownerRuntime?(this.peerUpstreamAttached=!0,e?this.connectNegotiatedUpstream({protocolVersion:my,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(!aC(n,this.peerIdentity))throw Hx();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(),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?.(Sb[e])}remoteLinkState(){return this===this.ownerRuntime?this.readRemoteLinkState():this.ownerRuntime.remoteLinkState()}onRemoteLinkStateChange(e,t){if(this!==this.ownerRuntime){this.ownerRuntime.onRemoteLinkStateChange(e,t);return}this.remoteLink.subscribe(e,t),this.startNativeLinkPoll()}startNativeLinkPoll(){!this.db?.nativeConnectionStatus||this.nativeLinkPoll||this.closed||!this.linkHasListeners()||(this.nativeLinkPoll=setInterval(()=>{this.linkHasListeners()?this.linkChanged():this.stopNativeLinkPoll()},Cb))}noteFirstLoadWait(e){if(!rx(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.noteLinkFailure(),this.remoteLink.changed(),this.linkStatusPublisher.changed(),this.syncStatusPublisher.changed()}upstreamLinkStatus(){if(this!==this.ownerRuntime)return this.ownerRuntime.upstreamLinkStatus();if(this.closed)return Z_(`stopped`,!1);let e=this.db?.nativeConnectionStatus?.();return e?e.configured?e.explicitlyOffline?Z_(`disconnected`):e.authRejected?Z_(`auth`):e.connected?X_:this.serverTransportError?this.serverTransportErrorRetrying?Z_(`network`):A_(this.serverTransportError)?Z_(`authority-changed`,!1):Z_(`stopped`):Y_:J_:this.linkStatus?.phase===`stopped`&&A_(this.upstreamRefusal)?Z_(`authority-changed`,!1):Q_(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?K_:this.db?.uploadStatus?.()??K_:this.ownerRuntime.uploadStatus()}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=q_(e,(this.linkFailure??this.serverTransportError)?.message);n&&(this.lastFailure=n)}onUpstreamLinkStatusChange(e,t){if(this!==this.ownerRuntime){this.ownerRuntime.onUpstreamLinkStatusChange(e,t);return}this.linkStatusPublisher.subscribe(e,t),this.startNativeLinkPoll()}onSyncStatusChange(e,t){if(this!==this.ownerRuntime){this.ownerRuntime.onSyncStatusChange(e,t);return}this.syncStatusPublisher.subscribe(e,t),this.startNativeLinkPoll()}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(Lb[e]<=Lb[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();return}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(Error(`server transport disconnected`)),this.stopNativeLinkPoll(),this.linkChanged();let e=this.serverConnectionAttempt;this.serverConnectionAttempt=null,e&&this.finishServerConnectionAttempt(e,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(cC),this.peerUpstreamAttached=!1,this.serverCarrier?.close(),this.serverCarrier=null}previewInsert(e,t,n){let r=this.rowStateFromValues(e,n?rC(n):Ml(16),t);return{id:r.id,values:r.values}}insert(e,t,n,r){this.assertMutationAdmission(`Insert`);let i=r?rC(r):void 0,a=Kb(n);this.applySessionClaims(a);let o=this.trustedWriteIdentity(a),s=this.backendAttribution(n),c=Yb(n),l=Ub(n);Gb(s,l);let u=this.currentTx(n,`Insert`);u&&this.assertTransactionAttribution(u,s);let d=wS(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:Hb(n)}}let f=Rx(`Insert`,()=>Eb(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=Kb(a);this.applySessionClaims(u);let d=this.trustedWriteIdentity(u),f=this.backendAttribution(a),p=Ub(a),m=Yb(a);if(Gb(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?rC(o):Ml(16),ee=e===`insert`?TS(h,n,r,t):ES(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(),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 x_(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:Nu(_),...r}}catch(e){throw await v.abort(),e}finally{te(),y.pendingStreamingMutations.delete(ne)}}restore(e,t,n,r){this.assertMutationAdmission(`Restore`);let i=rC(t),a=Kb(r);this.applySessionClaims(a);let o=this.trustedWriteIdentity(a),s=this.backendAttribution(r),c=Yb(r),l=Ub(r);Gb(s,l);let u=this.currentTx(r,`Restore`);u&&this.assertTransactionAttribution(u,s);let d=wS(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:Hb(r)}}let f=Rx(`Restore`,()=>Eb(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=rC(t),a=Kb(r);this.applySessionClaims(a);let o=this.trustedWriteIdentity(a),s=this.backendAttribution(r),c=Yb(r),l=Ub(r);Gb(s,l);let u=this.currentTx(r,`Update`);u&&this.assertTransactionAttribution(u,s);let d=DS(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:Hb(r)};let f=Rx(`Update`,()=>Eb(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=rC(t),o=Yb(i),s=Ub(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=Kb(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 zx(`Update`,`typed partial-value updates in transactions are not supported by this runtime`);let d=DS(this.table(e),n);return u.call(this.db,c.id,e,a,d,r,o??void 0),c.hasStagedMutations=!0,{kind:`staged`,openTransactionId:Hb(i)}}if(Wb(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=DS(this.table(e),n),d=Rx(`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=rC(t),a=this.table(e),o=Kb(r);this.applySessionClaims(o);let s=this.trustedWriteIdentity(o),c=this.backendAttribution(r),l=Yb(r),u=Ub(r);Gb(c,u);let d=this.currentTx(r,`Upsert`);d&&this.assertTransactionAttribution(d,c);let f;try{f=DS(a,n)}catch(e){throw zx(`Upsert`,Bx(Vx(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:Hb(r)};let p=Rx(`Upsert`,()=>Eb(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=rC(t),i=Kb(n);this.applySessionClaims(i);let a=this.trustedWriteIdentity(i),o=this.backendAttribution(n),s=Yb(n),c=Ub(n);Gb(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:Hb(n)};let u=Rx(`Delete`,()=>Eb(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===au&&e.user_id===rv&&hu(e,mu(e)))}delegatedPermissionAdviceSession(e){if(!this.trustedBackend||!e||!this.isScopedPermissionAdvice(e))return null;try{return ox(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=ox(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=wS(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,rC(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=DS(this.table(e),n);return this.withPermissionAdviceTimeout(()=>a.call(this.db,e,rC(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,rC(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(Error(`the native runtime is closed`));if(!this.db.serveThinTransaction)return Promise.reject(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(Error(`Cannot capture a snapshot: native runtime is closed`));if(!this.db.captureSnapshot)return Promise.reject(new Bl);let e=this.db.captureSnapshot();return this.scheduleCoreTick(),this.awaitNativeRead(e).then(e=>zl(jb.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=Kb(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(Zb(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=Vb(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 Fx(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(Qb(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`);ix(n,r),this.noteFirstLoadWait(r),$b(r,this.pendingTxs,this.completedTxs);let i=ox(t);mx(e);let a=Mx(e),o=ex(r,this.pendingTxs),s=nx(n,dx(a),r),c=this.nativeReadContext(i,o),l=px(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`),fx(a)){if(o){let e=await this.readRowsForContextAsync(l,s,c,o.id);return this.emitQueryCoverageTrace(`covered`),FS(MS(e),this.schema,Ex(a,this.schema).rootColumns)}let e=await this.readRowsForContextAsync(l,s,c);return this.emitQueryCoverageTrace(`covered`),FS(MS(e),this.schema,Ex(a,this.schema).rootColumns)}let u=Ex(a,this.schema).rootColumns,d=await this.readPlainRows(l,s,i??void 0,o);return this.emitQueryCoverageTrace(`covered`),NS(jS(d),this.schema,u)}createSubscription(e,t,n,r){ix(n,r),this.noteFirstLoadWait(r);let i=ox(t),a=this.nativeReadContext(i);mx(e);let o=this.nextSubscriptionId++,s=nx(n,dx(e),r);this.subscriptions.set(o,{openingAbort:new AbortController,reading:!1,outputColumns:Ex(e,this.schema),tier:n??`local-first`,cancelled:!1});let c=this.subscriptions.get(o),l=px(e,this.schema),u=e=>{let t=ZS(e);if(c.cancelled||this.closed||this.ownerRuntime.closed){ux(t);return}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 Ab(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=rb(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;this.linkTimer={token:t,handle:setTimeout(()=>{this.linkTimer?.token===t&&(this.linkTimer=null,this.stepLink({type:`timerFired`,token:t}))},e.afterMs)};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(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(Vx(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=nb(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}:Ob(e,c.carrier.hasNegotiated);this.endLinkAttempt(c,Error(e.message),t)},u=new Hy({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=>{dy(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()){u.close();return}if(!this.trustedBackend&&(await this.runWhenCoreIdle(()=>{if(d())return this.installClientSessionClaims(tb(n))}),!d())){u.close();return}let i=this.connectNegotiatedUpstream(t).catch(e=>{throw Ux(`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(Vx(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=Pl();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(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=rb(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=rb(e);if(!ab(t))return;let n;try{n=nb(t,this.peerIdentity)}catch{n=null}if(!n||!aC(n,this.upstreamPrincipal))throw Hx(`a credential refresh must keep the principal this store connects upstream as`)}pinUpstreamPrincipal(e){this.upstreamPrincipal||!ab(e)||(this.upstreamPrincipal=nb(e,this.peerIdentity))}onAuthFailure(e){if(this!==this.ownerRuntime)return this.ownerRuntime.onAuthFailure(e);this.authFailureCallback=e,this.db.onAuthRejected?.(e=>{this.nativeAuthRefusalRenewable=Tu(Du(e)),this.authFailureCallback?.(e)})}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(Kb(n.writeContext))??null,s):this.db.waitForPendingWrites(e,s,!0):this.db.waitForPendingWrites(e,s),c=this.awaitNativeRead(Promise.resolve(r).then(e=>e??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(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=Vb(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=Vb(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 W_(e,Nu(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(Tb(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(!Tb(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 Px(0)}}finally{this.ownerRuntime.pendingNativeReadCancels.delete(i),i(),this.ownerRuntime.scheduleCoreTick()}}trustedWriteIdentity(e){let t=this.readAuthorizationHost===`trusted-serving`;return e?!this.trustedBackend&&!t&&aC(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`||!eu(t))throw Error(`backend attribution must be a canonical author subject string`);let n=Kb(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=cx(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`||cx(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=nb(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(Vx(e))),a=this.waitForServerTransportError(`global`),o=a?.promise.catch(e=>e instanceof Error?e:Error(Vx(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||!nC(n,nb(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,nx(`remote`,!1),this.nativeReadContext(n)))})().catch(()=>{})}admitLocalFirstSession(e,t,n){if(!this.trustedBackend||e.issuer!==ru||!e.account_id||!hu(e,mu(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 Vl().decode(tu(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=Hb(e);if(!n)return;let r=this.pendingTxs.get(n);if(r)return r;throw Error(`${t} failed: WriteError("${Xb(n,this.completedTxs)}")`)}assertTransactionWriteIdentity(e,t){if(e.kind===`serializable`){if(e.identity&&(!t||!aC(e.identity,t)))throw Error(`Native runtime serializable transaction cannot mix write identities`);return}if(e.identity&&(!t||!aC(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||!aC(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);return}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=Db(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 Px(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){cC(e);return}this.serverTransport!==null||this.serverEndpointUrl!==null?this.handleServerTransportError(e):cC(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=Ib(t);if(n===t){console.warn(`[jazz] ${t}`);continue}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 N_(e)}if(this.syncStatusPublisher.changed(),this.reportSlowQueries(),this.pumpSubscriptions(),this.scheduleServerPump(),this.notifyPeerTransportWork(),!this.coreProgressAllowed()||!this.coreTickAgain)break;if(t+1>=wb){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();return}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(()=>Px(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=JS(n);if(r.type===`closed`){this.terminateSubscription(e,t);return}if(r.type===`rejected`){if(r.reason.type===`ShapeRegistrationPendingCatalogueAdmission`)return;this.failSubscription(t,XS(r.reason));return}let i=RS(r.delta,this.schema,r.reset===!0,t.outputColumns,r.coalesced===!0);i.terminalOperations=Dx(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()},xb))}}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():!1;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=zb(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=j_(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(Bb(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 fh(e,r=>{if(this.closed||e!==this.serverTransport||n!==this.serverConnectionGeneration)return;let i=r instanceof Error?r:Error(Vx(r)),a=this.serverConnectionAttempt;a?.transport===e?this.finishServerConnectionAttempt(a,i):(t.close(),this.handleServerTransportError(i,n),this.retirePeerTransport(e).catch(cC))}),this.auxiliaryReceiveDeadlines.set(e,r)),r.refresh()}flushAuxiliaryOutbound(e,t,n){let r=e.recvAuxiliaryWireFrames;if(!r)return;let i=zb(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||!P_(e)))return;let r=Vx(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=kb(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{ux(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 zb(e){return e.filter(e=>ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`)}function Bb(e){let t=zb([e])[0];if(!t)throw Error(`native transport returned a non-byte wire frame`);return t}function Vb(e,t){let n=e.txId;return t.set(n,e),n}function Hb(e){if(e)try{let t=JSON.parse(e);return typeof t.transaction_id==`string`?t.transaction_id:void 0}catch{return}}function Ub(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 Wb(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=Kb(e);return n===null||!aC(n.identity,t)}catch{return!0}}function Gb(e,t){if(e&&t)throw Error(`Backend-attributed writes do not support branch views`)}function Kb(e){if(!e)return null;try{let t=JSON.parse(e);if(t.attribution===rv)throw Error(`Native runtime public session uses reserved issuer`);let n=typeof t.attribution==`string`?eu(t.attribution):null;if(n?.issuer===au)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||!Ql(r))return null;let i=n?.issuer??t.session?.issuer??t.issuer;if(typeof i!=`string`||!Ql(i))throw Error(`session is missing issuer`);let a={account_id:ax(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`};qb(a.issuer,a.user_id,a.authMode,t.session?.[cu]??t[cu],a.account_id);let o=t.session?.[cu]??t[cu],s=lx(t.session?.claims??t.claims,a);return{...a,claims:s,identity:tu(a),backendAuthority:a.issuer===au&&a.user_id===rv&&hu(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 qb(e,t,n,r,i){if(su(e)&&!((n===`device-account`||n===`anonymous`||n===`external`)&&hu({issuer:e,user_id:t,authMode:n,account_id:i},r)))throw Error(`Native runtime public session uses reserved issuer`)}function Jb(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 Yb(e){return Jb(e)??null}function Xb(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 Zb(e,t){let n=Xb(e,t);return t.get(e)?.state===`committed`?`Write error: ${n}`:`Commit transaction failed: Write error: ${n}`}function Qb(e,t){let n=Xb(e,t);return t.get(e)?.state===`committed`?`Write error: ${n}`:`Rollback transaction failed: Write error: ${n}`}function $b(e,t,n){let r=tx(e);if(!(!r||t.has(r)))throw Error(`Query setup failed: Write error: ${Xb(r,n)}`)}function ex(e,t){let n=tx(e);return n?t.get(n):void 0}function tx(e){if(e)try{let t=JSON.parse(e);return typeof t.transaction_id==`string`?t.transaction_id:void 0}catch{return}}function nx(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 rx(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 ix(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 ax(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 ox(e){if(e==null)return null;let t=JSON.parse(e);if(typeof t.user_id!=`string`||!Ql(t.user_id))throw Error(`Native runtime session is missing user_id`);if(typeof t.issuer!=`string`||!Ql(t.issuer))throw Error(`Native runtime session is missing issuer`);let n={account_id:ax(t.account_id),issuer:t.issuer,user_id:t.user_id,authMode:typeof t.authMode==`string`?t.authMode:`external`};qb(n.issuer,n.user_id,n.authMode,t[cu],n.account_id);let r=n.issuer===au&&n.user_id===rv&&hu(n,t[cu]);return{...n,claims:lx(t.claims,n),identity:tu(n),backendAuthority:r}}function sx(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function cx(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(cx).join(`,`)}]`:sx(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${cx(e[t])}`).join(`,`)}}`:`null`}function lx(e,t){return{...sx(e)?e:{},iss:t.issuer,sub:t.user_id}}function ux(e){e.close()}function dx(e){try{return JSON.parse(e).include_deleted===!0}catch{return!1}}function fx(e){try{let t=JSON.parse(e).array_subqueries;return Array.isArray(t)&&t.length>0}catch{return!1}}function px(e,t){return Zx(e,t)}function mx(e){if(hx(e))throw Error(`Native runtime does not support permission-introspection query columns or predicates ($canRead) until unified policy lowering exists.`)}function hx(e){let t=JSON.parse(e);return bx(t.select_columns??t.select)||xx(t.conditions)||gx(t.relation_ir)||_x(t.relation_ir)||Sx(t.array_subqueries)}function gx(e){return wx(e)}function _x(e){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e))return e.some(_x);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=yx(e.expr??e.source);if(n&&B_(n))return!0}}return Object.values(t).some(_x)}function vx(e){if(!e||typeof e!=`object`)return null;let t=e;return vS(t.left??t.column)}function yx(e){return!e||typeof e!=`object`?null:`Column`in e?vS(e.Column):vS(e)}function bx(e){return Array.isArray(e)?e.some(e=>typeof e==`string`&&B_(Tx(e))):!1}function xx(e){return Array.isArray(e)?e.some(wx):!1}function Sx(e){return Array.isArray(e)?e.some(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return bx(t.select_columns??t.select)||Cx(t.filters)||Sx(t.nested_arrays)}):!1}function Cx(e){return Array.isArray(e)?e.some(wx):!1}function wx(e){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e))return e.some(wx);let t=e;if(typeof t.op==`string`&&typeof t.column==`string`&&B_(Tx(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`&&B_(Tx(r)))return!0}let n=vx(t.Cmp)??vx(t.In)??vx(t.IsNull)??vx(t.IsNotNull)??vx(t.Contains);return n&&B_(Tx(n))?!0:Object.entries(t).some(([e,t])=>e!==`Literal`&&wx(t))}function Tx(e){return I_(e)}function Ex(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:jx(n.table,t,tS(n.select_columns??n.select),rS(n.array_subqueries,n.table,t)??[])}}function Dx(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:Ox(e.Key)};if(!n)throw Error(`native terminal collection path requires subscription output columns`);let t=e.Collection.startsWith(U_)?e.Collection.slice(U_.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=Ax(a.Insert.key);return{root_key:Ox(e.root_key),path:i,edit:{Insert:{index:a.Insert.index,key:Ox(a.Insert.key),row:pg(t,r,kx(a.Insert.value))}}}}if(`Update`in a){if(!r)throw Error(`native terminal update has no collection target`);let t=Ax(a.Update.key);return{root_key:Ox(e.root_key),path:i,edit:{Update:{key:Ox(a.Update.key),row:pg(t,r,kx(a.Update.value))}}}}return`Remove`in a?{root_key:Ox(e.root_key),path:i,edit:{Remove:{key:Ox(a.Remove.key)}}}:{root_key:Ox(e.root_key),path:i,edit:{Move:{key:Ox(a.Move.key),index:a.Move.index}}}})}function Ox(e){return Array.isArray(e)?e:Array.from(e)}function kx(e){return e instanceof Uint8Array?e:Uint8Array.from(e)}function Ax(e){let t=kx(e);if(t.length<17||t[0]!==10)throw Error(`terminal key must begin with a UUID row key`);return Nu(t.subarray(1,17))}function jx(e,t,n,r,i=!0){let a=D_(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=H_(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=jx(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 Mx(e){let t=JSON.parse(e);return Nx(t.array_subqueries),JSON.stringify(t)}function Nx(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=I_(n);(tS(e.select_columns)??[]).includes(r)||e.select_columns.push(r)}Nx(e.nested_arrays)}}function Px(e){return new Promise(t=>setTimeout(t,e))}function Fx(e,t){return Jx(t)?Ix(e,t):Yx(t)?Lx(e,t):null}function Ix(e,t){let n=Vx(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 Lx(e,t){let n=Vx(t),r={kind:`rejected`,transactionId:e,code:Gx(dv(t)),reason:qx(n,dv(t)),message:n};return Object.defineProperty(r,`message`,{enumerable:!1}),r}function Rx(e,t){try{return t()}catch(t){if(Yx(t)){let n=Vx(t),r=Xx(n)??n,i=dv(t)??(r.startsWith(`authorization_denied:`)?`authorization_denied`:void 0);throw Object.assign(Error(`${e} failed: WriteError("${r}")`),{code:Gx(i)})}throw t}}function zx(e,t){return Error(`${e} failed: WriteError("${t.replaceAll(`"`,`\\"`)}")`)}function Bx(e){let t=/^missing required column ([A-Za-z_$][\w$]*)$/.exec(e);return t?`missing required field \`${t[1]}\``:e}function Vx(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 Hx(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 Ux(e,t){let n=t instanceof Error?t:Error(Vx(t));return Error(`${e}: ${n.message}`,{cause:n})}var Wx={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 Gx(e){return e===void 0?`write_rejected`:Wx[e]}var Kx={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 qx(e,t){let n=Xx(e);return n===null?e:Kx[Gx(t)]??(n||`Write rejected`)}function Jx(e){return lv(e)===`transaction_conflict`}function Yx(e){return lv(e)===`write_rejected`}function Xx(e){let t=/^WriteRejected:\s*(.*)$/s.exec(e);return t?t[1]:null}function Zx(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=Zg(e);if(!i.relation_ir||typeof i.relation_ir!=`object`)throw Error(`Relation query is missing relation_ir`);return i_(r,[],{relation:i.relation_ir,select:tS(n.select_columns??n.select),partial:eS(n.select_columns),arraySubqueries:rS(n.array_subqueries,r,t)})}let i=pS(n.conditions);if(!i)throw Y();return i_(r,i.map(e=>Qx(r,e,t)),{limit:xS(n.limit),offset:SS(n.offset),orderBy:nS(n.order_by??n.orderBy),select:tS(n.select_columns??n.select),partial:eS(n.select_columns),arraySubqueries:rS(n.array_subqueries,r,t)})}function Y(e){let t=e?` (${e})`:``;return Error(`Native runtime cannot encode this query shape${t}.`)}function Qx(e,t,n){if(t.op===`All`||t.op===`Any`)return{op:t.op,predicates:t.predicates.map(t=>Qx(e,t,n))};if(t.op===`Not`)return{op:`Not`,predicate:Qx(e,t.predicate,n)};if(C_(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=>Qx(e,{column:t.column,op:`Eq`,value:r},n))};if($x(t)){let r=uS(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`}:D_(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:uS(e,t.column,i,n)}:{column:t.column,op:`Contains`,value:dS(i,r.element,!1)})}:{...t,values:t.values.map(r=>uS(e,t.column,r,n))}}if(t.op===`Contains`){let r=t.column===`id`?{type:`Uuid`}:D_(n,e)?.columns.find(e=>e.name===t.column)?.column_type;return{...t,value:r?.type===`Array`?dS(t.value,r.element,!1):uS(e,t.column,t.value,n)}}if(t.op===`IsNull`||t.op===`IsNotNull`)return t;if($x(t))return{...t,value:uS(e,t.column,t.value,n)};throw Error(`unsupported query predicate ${JSON.stringify(t)}`)}function $x(e){return e.op===`Eq`||e.op===`Ne`||e.op===`Gt`||e.op===`Gte`||e.op===`Lt`||e.op===`Lte`}function eS(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 tS(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 nS(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 rS(e,t,n){if(e!=null){if(!Array.isArray(e))throw Y(`array_subqueries`);return e.map(e=>iS(e,t,n))}}function iS(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=aS(r.filters,r.table,n),a=tS(r.select_columns),o=sS(r.order_by),s=rS(r.nested_arrays,r.table,n)??[];return{columnName:r.column_name,table:r.table,innerColumn:r.inner_column,outerColumn:lS(r.outer_column,t),filters:i,select:a,orderBy:o,limit:r.limit==null?null:bS(r.limit),offset:SS(r.offset),requirement:cS(r.requirement),nestedArrays:s}}function aS(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=oS(i);if(!e)throw Y(`array_subqueries.filters`);r.push(...e.map(e=>Qx(t,e,n)))}return r}function oS(e){let t=hS(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:gS(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:gS(t)}]:null}return null}function sS(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 cS(e){if(e==null||e===`Optional`)return`Optional`;if(e===`AtLeastOne`||e===`MatchCorrelationCardinality`)return e;throw Y(`array_subqueries.requirement`)}function lS(e,t){let n=`${t}.`;return e.startsWith(n)?e.slice(n.length):e}function uS(e,t,n,r){let i=t===`id`?{type:`Uuid`}:H_(t)??D_(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(fS))};if(n.type===`Array`){let i=t===`id`?{type:`Uuid`}:D_(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=>dS(e,a,!1))}}return dS(n,i,!0)}function dS(e,t,n){if(e.type===`Nullable`)return n&&e.value?{type:`Nullable`,value:dS(e.value,t,!1)}:e;if(t?.type===`Uuid`&&e.type===`Text`&&CS(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:Gh(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(fS))}:t?.type===`Array`&&e.type===`Array`?{type:`Array`,value:e.value.map(e=>dS(e,t.element,!1))}:e}function fS(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 pS(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=hS(n);if(e){t.push(e);continue}let r=n;if(typeof r.column!=`string`||typeof r.op!=`string`)return null;let i=I_(r.column);switch(r.op){case`eq`:r.value===null?t.push({column:i,op:`IsNull`}):t.push({column:i,op:`Eq`,value:gS(r.value)});break;case`ne`:r.value===null?t.push({column:i,op:`IsNotNull`}):t.push({column:i,op:`Ne`,value:gS(r.value)});break;case`gt`:t.push({column:i,op:`Gt`,value:gS(r.value)});break;case`gte`:t.push({column:i,op:`Gte`,value:gS(r.value)});break;case`lt`:t.push({column:i,op:`Lt`,value:gS(r.value)});break;case`lte`:t.push({column:i,op:`Lte`,value:gS(r.value)});break;case`contains`:t.push({column:i,op:`Contains`,value:gS(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(gS)});break;default:return null}}return t}function mS(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=mS(n);if(!t)return null;e.push(...t)}return e}if(Array.isArray(t.Or))return null;if(t.Not){let e=hS(t.Not);return e?[{op:`Not`,predicate:e}]:null}let n=t.IsNull;if(n&&typeof n==`object`){let e=vS(n.column);return e?[{column:e,op:`IsNull`}]:null}let r=t.IsNotNull;if(r&&typeof r==`object`){let e=vS(r.column);return e?[{column:e,op:`IsNotNull`}]:null}let i=t.Contains;if(i&&typeof i==`object`){let e=i,t=vS(e.left),n=yS(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=vS(e.left);if(!t||!Array.isArray(e.values))return null;let n=e.values.map(yS);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=_S(s.op);if(!c)return null;let l=vS(s.left),u=yS(s.right);return l&&u?[{column:l,op:c,value:u}]:null}function hS(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(hS);return n.every(e=>e!==null)?{op:e,predicates:n}:null}if(t.Not){let e=hS(t.Not);return e?{op:`Not`,predicate:e}:null}let n=mS(e);return n?.length===1?n[0]:null}function gS(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 CS(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(gS)};throw Y()}function _S(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 vS(e){if(!e||typeof e!=`object`)return null;let t=e.column;return typeof t==`string`?I_(t):null}function yS(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<=yb&&bb.test(n.value))try{return{type:`BigInt`,value:Gh(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=>yS({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 bS(e){if(typeof e!=`number`||!Number.isSafeInteger(e)||e<0)throw Error(`query limit must be a non-negative safe integer`);return e}function xS(e){return e==null?void 0:bS(e)}function SS(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 CS(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 wS(e,t,n){return kS(e.columns,t,n),OS(e.columns.filter(e=>Object.hasOwn(t,e.name)),e=>t[e.name],!0)}function TS(e,t,n,r){return kS(e.columns.filter(e=>e.name!==n),t,r),OS(e.columns.filter(e=>e.name!==n&&Object.hasOwn(t,e.name)),e=>t[e.name],!0)}function ES(e,t,n){return OS(e.columns.filter(e=>e.name!==n&&Object.hasOwn(t,e.name)),e=>t[e.name],!1)}function DS(e,t){return OS(e.columns.filter(e=>Object.hasOwn(t,e.name)),e=>t[e.name],!1)}function OS(e,t,n){let r=[...e].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({name:e.name,valueType:Ng(e),column:e})),i=r.map(({column:e})=>AS(e,t(e),n)),a=new __;return ig(a,r),a.bytes(cg(r,i)),a.finish()}function kS(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 AS(e,t,n){let r=t;if(!r){if(e.nullable)return Dg(Ng(e));if(n&&e.default==null)throw Error(`missing required column ${e.name}`);return new Uint8Array}return Tg(e,r)}function jS(e){return new v_(e).readVec(Jh)}function MS(e){return tg(new v_(e))}function NS(e,t,n,r=`full-record`){let i=[];for(let a of e){let e=PS(a,t,n),o=vg(a.descriptor);for(let t of a.rows){let n=[],s=new Map;for(let i of e){let e=VS(i,o,t.raw,r);s.set(i.name,e),i.includeInValues&&n.push(e)}i.push(ug({table:a.table,id:Nu(t.rowId),values:n},s))}}return i}function PS(e,t,n){let r=Mb.get(t);r||(r=new Map,Mb.set(t,r));let i=ov(e),a=n?void 0:r.get(i);if(a)return a;let o=n??D_(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&&qh(n);if(!r)continue;let i=H_(r)??s.get(r)?.column_type;l.push({name:r,index:t,type:i,storageType:e.descriptor[t].valueType,includeInValues:!oC(r)&&(!V_(r)||c?.has(r)===!0)})}return n||r.set(i,l),l}function FS(e,t,n,r=`full-record`){return LS(NS(e.rows,t,n,r),t).slice(0,e.rootCount)}var IS=new Set([`table`,`layer`,`schema_version`,`parents`,`created_by`,`created_at`,`updated_by`,`updated_at`]);function LS(e,t){return e.map(e=>{if(!e.valuesByColumn)return e;let n=new Set((D_(t,e.table)?.columns??[]).map(e=>e.name)),r=new Map(e.valuesByColumn),i=new Set;for(let e of IS){if(n.has(e))continue;let t=r.get(e);t&&(i.add(t),r.delete(e))}return i.size===0?e:ug({...e,values:e.values.filter(e=>!i.has(e))},r)})}function RS(e,t,n=!1,r=null,i=!1){let a=(e,n,i,a)=>{let o=BS(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:QS(e,t,r),...s&&s.length>0?{splices:zS(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:Nu(t.rowId),occurrenceKey:e.removedOccurrenceKeys[n],index:e.removedIndices[n]}]),...n?{reset:!0}:{},...n&&i?{reason:`backlog`}:{}}}function zS(e,t,n){let r=D_(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:jb.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 BS(e,t,n,r){return e.flatMap(e=>NS([e],t,e.table===n?.rootTable?n.rootColumns:void 0,r))}function VS(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 HS(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 HS(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:US(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:jb.decode(t.subarray(1))};case`Uuid`:return{type:`Uuid`,value:Nu(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:qS(e.element,t,WS(r),i)};case`Row`:{let a={type:`Row`,value:KS(e.columns,t,GS(r),i)};return(n===`$createdBy`||n===`$updatedBy`)&&nu(a),a}}}function US(e){let t=e;for(;t?.tag===15;)t=t.inner;return t}function WS(e){let t=US(e);return t?.tag===14?t.inner:void 0}function GS(e){let t=US(e);return t?.tag===16?t.record:void 0}function KS(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=vg(a),c=new Map(e.map(e=>[e.name,e])),l=new Map,u=i?Nu(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=Nu(n);continue}let d=c.get(t);d&&l.set(t,n==null?{type:`Null`}:HS(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 ug({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=Nu(t.subarray(a,a+16)),a+=16}let s=iC(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:lg(e,c)}}function qS(e,t,n,r=`full-record`){let i=Ug(n??Fg(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(HS(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=iC(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:iC(t,4+(i-1)*4),l=i===a-1?t.length:iC(t,4+i*4);if(c>l||l>t.length)throw Error(`invalid variable-width array element offset`);s.push(HS(e,t.subarray(c,l),void 0,n,r))}return s}function JS(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:Qh(new v_(sC(t.delta,`subscription delta`))),terminalOperations:Array.isArray(t.terminalOperations)?t.terminalOperations:void 0};if(t.type===`rejected`||t.type===`Rejected`)return{type:`rejected`,reason:YS(t.reason)};throw Error(`unknown subscription chunk`)}function YS(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 XS(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):j_({code:r,message:n})??Error(n)}function ZS(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 QS(e,t,n=null){let r=n&&e.table===n.rootTable?n.rootColumns:t?.[e.table]?.columns,i=r?Pg(r):void 0;if(!i)throw Error(`missing schema for subscription row table ${e.table}`);let a=tC(e,i).map((e,t)=>$S(e,i[t].column_type));return ug({id:e.id,values:a},dg(i,a))}function $S(e,t){return e.type===`Null`?e:t.type===`Array`&&e.type===`Array`?{type:`Array`,value:e.value.map(e=>$S(e,t.element))}:t.type===`Row`&&e.type===`Row`?{type:`Row`,value:eC(e.value,t.columns)}:e}function eC(e,t){let n=e.valuesByColumn,r=t.map((t,r)=>$S(n?.get(t.name)??e.values[r]??(t.column_type.type===`Array`?{type:`Array`,value:[]}:{type:`Null`}),t.column_type));return ug({id:e.id,values:r},dg(t,r))}function tC(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];n[r]=e.valuesByColumn.get(i.name)??(i.column_type.type===`Array`?{type:`Array`,value:[]}:{type:`Null`})}return n}function nC(e,t){return e.length===t.length?e.every((e,n)=>e===t[n]):!1}function rC(e){let t=Mu(e);if(!t)throw Error(`invalid uuid ${e}`);return t}function iC(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function aC(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function oC(e){return e.startsWith(U_)}function sC(e,t){if(e instanceof Uint8Array)return e;if(Array.isArray(e))return Uint8Array.from(e);throw Error(`expected ${t} bytes`)}function cC(e){queueMicrotask(()=>{throw e})}function lC(e,t,n){for(let r of e)n(r,t)}function uC(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 dC(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 fC=`warn`;function pC(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 mC(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(mC).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${mC(t[e])}`).join(`,`)}}`}return`null`}function hC(e,t){if(mC(t)!==mC(e.options.sessionClaims))throw Error(`Browser tab claims differ from the persistent worker's authenticated upstream session`)}async function gC(e,t){await Promise.all([...e.peers.values()].map(e=>e.subscriber?.updateAuthenticatedClaims?.(t))),e.options.sessionClaims=t}var _C=globalThis,vC=crypto.randomUUID(),yC=null,X=new Map,bC=new Map,Z=new Map,xC=new Map,SC=new Map,CC=new Set,wC=null,TC=null,EC=Promise.resolve(),DC=1,OC=0,kC=null,AC=!1,jC=[],MC=1,NC=128;function PC(e,t,n){return e.filter(e=>e.authSessionKey===t&&n.has(e.dbName)).map(({authSessionKey:e,...t})=>t)}function FC(e,t,n,r={}){let i=[...Z.values()].reduce((e,t)=>e+t.activeLeaseIds.size,0);jC.push({sequence:MC++,event:e,dbName:t,authSessionKey:n,peerCount:[...X.values()].reduce((e,t)=>e+t.peers.size,0),pendingBootstraps:OC,activeLeases:i,...r}),jC.length>NC&&jC.splice(0,jC.length-NC)}async function IC(e,t){let n=xC.get(e);if(n){if(n.release)return await n.release,await IC(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=SC.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=LC(e,t);SC.set(e,i);try{return await i}finally{SC.get(e)===i&&SC.delete(e)}}async function LC(e,t){let n=await Jp(e),r=null;try{r=await Cm.open(e,{owner:t}),await r.claimBrowserWorkerEpoch(n.id,n);let i={epoch:n,pageStore:r,storageOwner:t,release:null,disposeInvalidation:null};return xC.set(e,i),i.disposeInvalidation=r.onInvalidated(()=>zC(e)),i}catch(e){throw r?.close(),await n.release(),e}}async function RC(e){let t=xC.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(),bC.get(e)===t&&bC.delete(e),xC.delete(e)}})(),await t.release)}function zC(e){Z.delete(e),RC(e).catch(()=>{}).finally(()=>Cw())}function BC(e={}){yC=e.foregroundLeaseTestHooks??null,_C.onconnect=e=>{let t=e.ports[0];t&&VC(t)}}function VC(e,t){OC+=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),--OC,Cw(),KC())},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();return}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(Error(`Inspector lease cannot select another storage scope`))}),d();return}if(AC){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&&XC(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),FC(`delete-store`,r.dbName,null),HC(r.dbName,r.runtimeSources).then(t=>$(e,{type:`delete-store-result`,outcome:t}),t=>$(e,{type:`delete-store-error`,error:J(Hl(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,FC(`bootstrap-start`,r.options.dbName,r.options.authSessionKey),$(e,{type:`worker-alive`}),qC(e,r,s.signal,()=>{u(),l()});else{if(u(),i!==null&&r.attemptId!==i){l(),$(e,{type:`foreground-node-lease-error`,error:J(Error(`Foreground node lease request did not match its worker probe`))}),d();return}FC(`lease-request`,r.dbName,null),UC(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 HC(e,t){for(let t of[...X.values()])if(t.options.dbName===e){if(t.peers.size!==0||t.pendingAdmissionTasks!==0)return`held`;await xw(t)}let n=Z.get(e);if([...X.values()].some(t=>t.options.dbName===e)||SC.has(e)||n&&(n.pendingLeaseAllocations>0||n.pendingLeaseFinalizations>0))return`held`;bC.delete(e),await RC(e).catch(()=>{}),n&&(Z.delete(e),n.pageStore.close());let r;try{r=await Jp(e)}catch(e){if(e instanceof Gp)return`held`;throw e}try{await Cm.destroy(e),await(await ZC(t)).WasmDb.destroyBrowserStorage(void 0,e)}finally{await r.release()}return`deleted`}async function UC(e,t,n){let r=yC,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(),Cw();return}if(await o?.catch(()=>{}),!l){if(!a){l=!0,$(e,{type:`foreground-node-lease-cancelled`}),u(),e.close(),Cw();return}l=!0;try{await GC(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:Hl(t)}))})}finally{u(),e.close(),Cw()}}}},f=e=>(l||(s=!0,(i||e!==void 0)&&!c&&(c=d(e))),c),p=async()=>{l||!a||!i||(l=!0,await GC(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(),Cw();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 IC(t.dbName,t.storageOwner);i=Z.get(t.dbName)??null,i||(i={pageStore:e.pageStore,storageOwner:t.storageOwner,activeLeaseIds: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=WC(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(),vC),await new Promise(e=>setTimeout(e,i))}return n})(),a=await o,s){await f();return}n?.removeEventListener(`abort`,g),FC(`lease-admitted`,t.dbName,null),$(e,{type:`foreground-node-lease-ready`,workerRealmId:vC,leaseId:a.leaseId,node:a.node,confirmedTxTime:a.confirmedTxTime.toString()})}catch(t){if(s){await f(t);return}u(),t instanceof Gp?$(e,{type:`foreground-node-lease-busy`,message:t.message}):$(e,{type:`foreground-node-lease-error`,error:J(t)}),e.close()}}async function WC(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(),Cw()}}async function GC(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,Cw()}}function KC(){if(OC===0)for(let[e,t]of bC){if(xC.get(e)!==t||X.has(e)){bC.delete(e);continue}let n=Z.get(e);n&&(n.activeLeaseIds.size>0||n.pendingLeaseAllocations>0||n.pendingLeaseFinalizations>0)||(bC.delete(e),Z.delete(e),RC(e).catch(()=>{}))}}async function qC(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=Pw(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&&!Nw(l.options,t.options))throw Error(`incompatible persistent browser telemetry configuration`);let u=l?uC(l.fingerprint,t.fingerprint,t.options.schema):`admit`;if(l?.newerBuildHandoff&&u===`admit`)throw Error(Sh);if(l&&u===`held-by-another-build`){let e=dC(l.options.migrations,t.options.migrations);if(e===`older`)throw Error(Sh);e===`newer`&&(await bw(l),c(),l=X.get(n),u=l?uC(l.fingerprint,t.fingerprint,t.options.schema):`admit`)}if(u!==`admit`)throw Error(u===`held-by-another-sign-in`?bh:u===`held-by-another-build`?xh:`incompatible persistent browser configuration`);l?.idleReleaseTimer&&(clearTimeout(l.idleReleaseTimer),l.idleReleaseTimer=null),l||(l=JC(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 rw(l,()=>(c(),ew(l,t.options))),c(),sw(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=xC.get(t.options.dbName);await xw(a),e&&xC.get(t.options.dbName)===e&&bC.set(t.options.dbName,e),KC(),Cw()}}}function JC(e,t,n){let r={key:e,fingerprint:t,options:n,peers:new Map,admissionClaims: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:new Set,authFailureEpoch:0,authFailure:null,linkFate:null,storageFailure:null,initialize:Promise.resolve(),closing:null,newerBuildHandoff:null,idleReleaseTimer:null},i=EC.then(()=>YC(r));return EC=i.catch(()=>{}),r.initialize=i,r}async function YC(e){let t=null;try{let{options:n}=e;e.pageStore=(await IC(n.dbName,n.storageOwner)).pageStore,e.disposePageStoreInvalidation=e.pageStore.onInvalidated(()=>Dw(e)),_C.__JAZZ_WASM_LOG_LEVEL=n.logLevel??fC;let r=await ZC(n.runtimeSources);e.disposeTelemetry=th({wasmModule:r,collectorUrl:n.telemetryCollectorUrl,runtimeThread:`worker`});let i=e.pageStore.replicaNode,a=av(n.schema),o=n.selfSignedClientProof,s=n_(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=Rb.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,mw(e)}),e.runtime.onStorageFailure(t=>{e.storageFailure=t,gw(e,{type:`storage-failure`,message:t})}),e.runtime.onMutationError(t=>{lC(e.peers.values(),t,(e,t)=>$(e.port,{type:`mutation-error`,event:t}))});let l=()=>{e.runtime===c&&mw(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=>{gw(e,{type:`relay-trace`,entries:t.map(e=>({...e,hop:`worker-server`}))})}))}catch(n){try{await t?.close()}catch{}try{$C(e)}catch{}throw n}}function XC(e){wC||e?.wasmModule||e?.wasmSource||ZC(e).catch(()=>{})}async function ZC(e){let t=QC(e);if(wC&&(!t||TC!==t))throw Error(`incompatible WASM asset source for this SharedWorker; start a worker scoped to the new asset URL`);let n=wC??Bp(e);wC=n,TC=t;try{return await n}catch(e){throw wC===n&&(wC=null,TC=null),e}}function QC(e){return e?.wasmModule?e.workerWasmAssetIdentity?`module:${e.workerWasmAssetIdentity}`:null:e?.wasmSource?e.workerWasmAssetIdentity?`source:${e.workerWasmAssetIdentity}`:null:e?.wasmUrl??`worker-local`}function $C(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?.()}}}Cw()}async function ew(e,t){let n=t.serverUrl??null;if(e.serverUrl===n){if(!tw(t.authJson)&&tw(e.serverAuthJson))return;e.runtime?.assertCredentialKeepsPrincipal(t.authJson),e.serverAuthJson=t.authJson,e.serverConnectionStarted&&await _w(e).updateAuth(t.authJson);return}if(e.peers.size>0)throw Error(`incompatible persistent browser server configuration`);e.serverConnectionStarted&&=(await _w(e).disconnect({rejectWaiters:!1}),!1),e.serverUrl=n,e.serverAuthJson=t.authJson}function tw(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 nw(e){let t=e.serverUrl;t||e.runtime?.setRemoteLinkHint(`none`),!(!t||e.explicitlyDisconnected)&&(e.serverConnectionStarted||tw(e.serverAuthJson)&&(_w(e).connect(t,e.serverAuthJson),e.serverConnectionStarted=!0))}function rw(e,t){let n=e.transportTransition.then(t,t);return e.transportTransition=n.catch(()=>{}),n}function iw(e){e.transportStateEpoch+=1,gw(e,{type:`transport-state`,explicitlyDisconnected:e.explicitlyDisconnected});let t=[...e.transportStateWaiters];e.transportStateWaiters.clear();for(let e of t)e()}function aw(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 ow(e,t,n){for(;;){if(n?.aborted||(await e.transportTransition,n?.aborted))return;if(e.explicitlyDisconnected){let t=e.transportStateEpoch;await aw(e,t,n);continue}if(await t.waitForUpstreamServerConnection(),!e.explicitlyDisconnected)return}}function sw(e,t,n,r,i=!1){fw(e,t);let a,o=e=>{lw(a,e.data)},s=()=>fw(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:new Set,inspectorSubscriptions:new Map,inspectorWrites:new Set,onMessage:o,onMessageError:s},e.peers.set(t,a),n.addEventListener(`message`,o),n.addEventListener(`messageerror`,s),n.start()}function cw(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&&(fw(n,r),n.peers.size===0&&n.pendingAdmissionTasks===0&&Sw(n))}).catch(()=>{}))}async function lw(e,t){if(e.context.peers.get(e.tabId)===e){if(t.type===`liveness-lock`){cw(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`&&FC(`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;fw(e.context,e.tabId,!1);try{n&&await xw(e.context),t.id!==void 0&&$(e.port,{type:`result`,id:t.id}),n&&Sw(e.context)}catch(n){t.id!==void 0&&$(e.port,{type:`result`,id:t.id,error:J(Hl(n))})}return}if(t.type===`diagnostic-query-coverage`){FC(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`){kw(e,t.resetId);return}if(t.type===`flush-local-observed`){e.flushObserved=!0,Mw(e);return}if(t.type===`open-inspector-control`){uw(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 vw(e.context),Ow(e.context),Q(e,t.id);return}try{let n=_w(e.context);if(t.type===`inspect-query`||t.type===`inspect-subscribe`||t.type===`inspect-unsubscribe`||t.type===`inspect-commit`||t.type===`inspect-wait`){if(pC(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=Ru();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`){pC(e,t.binding),t.leasePort&&e.pendingInspectorBootstraps.add(VC(t.leasePort,e.context.options)),$(e.port,{type:`inspector-binding`,id:t.id,binding:t.binding});return}if(t.type===`init`){await rw(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)&&pC(e,t.inspectorBinding),e.pump||e.subscriber)throw Error(`Browser tab is already initialized`);hC(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=jw(e,n,i);if(i=null,FC(`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}):nw(e.context),e.context.storageFailure!==null&&$(e.port,{type:`storage-failure`,message:e.context.storageFailure});let s=mw(e.context);s&&!s.sent&&$(e.port,{type:`link-fate`,fate:s.fate}),Q(e,t.id,void 0,{peerAuthority:a,workerRealmId:vC,...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 rw(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,nw(e.context)),await n.waitForUpstreamServerConnection())}catch(t){if(e.context.authFailureEpoch!==i){r=!0;return}throw t}e.context.serverAuthJson=t.authJson,await gC(e.context,t.sessionClaims)}),r||(e.context.authFailure=null,mw(e.context));return}if(t.type===`disconnect`){await rw(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||nw(e.context),n}iw(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,Hl(n)));return}if(t.type===`flush-local`){if(e.flushRequestId!==null){Q(e,t.id,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,Mw(e);return}if(t.type===`reconnect`){let r=e.context.serverUrl;if(!r)throw Error(`Browser runtime reconnect requires a serverUrl`);await rw(e.context,async()=>{let i=tw(t.authJson)||!tw(e.context.serverAuthJson),a=i?t.authJson:e.context.serverAuthJson;n.assertCredentialKeepsPrincipal(a);let o=tw(a);o&&(n.connect(r,a),await n.waitForUpstreamServerConnection(),e.context.authFailure=null,mw(e.context)),e.context.serverAuthJson=a,i&&await gC(e.context,t.sessionClaims),e.context.explicitlyDisconnected=!1,e.context.serverConnectionStarted=o,iw(e.context)}),Q(e,t.id);return}if(await ow(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,Hl(n)):dw(e,Hl(n))}}}function uw(e,t){CC.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:vC,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:PC(jC,e,n)});return}if(i.type===`terminate-worker`){if(X.size>0){t.postMessage({type:`result`,id:i.id,error:J(Error(`Worker still has live runtime contexts`))});return}if(OC>0){t.postMessage({type:`result`,id:i.id,error:J(Error(`Worker still has pending bootstrap operations`))});return}if(Tw()){t.postMessage({type:`result`,id:i.id,error:J(Error(`Worker still has pending or active foreground node leases`))});return}AC=!0,t.postMessage({type:`result`,id:i.id,workerTerminated:!0}),setTimeout(()=>_C.close(),0);return}let a=X.get(i.contextKey);if(!a||a.options.authSessionKey!==e||a.storageInvalidated||!a.runtime){i.port.close(),t.postMessage({type:`result`,id:i.id,error:J(Error(`Inspector context is no longer available`))});return}sw(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),CC.delete(t),t.close(),Cw()};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 dw(e,t){$(e.port,{type:`error`,error:J(t)}),fw(e.context,e.tabId)}function fw(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(),Aw(e,t),r.port.removeEventListener(`message`,r.onMessage),r.port.removeEventListener(`messageerror`,r.onMessageError),pw(r),n&&r.port.close()}}function pw(e){e.pump?.close(),e.pump=null,e.subscriber=null,e.pendingFrames.length=0}function mw(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&&hw(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 hw(e,t){return e.state===t.state&&$_(e.link,t.link)&&e.authFailure===t.authFailure&&e.failure?.retrying===t.failure?.retrying&&e.failure?.error===t.failure?.error}function gw(e,t){for(let n of e.peers.values())$(n.port,t)}function _w(e){if(!e.runtime)throw Error(`Shared browser runtime is closed`);return e.runtime}async function vw(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 wC)?.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 RC(e.options.dbName).catch(()=>{})}var yw=1e3;async function bw(e){e.newerBuildHandoff??=(async()=>{gw(e,{type:`newer-build-waiting`});let t=Date.now()+Ch,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,yw))]).catch(()=>{}),n()&&(gw(e,{type:`closed-for-newer-build`}),await new Promise(e=>setTimeout(e,0)),n()&&(Ew(e),await xw(e))))})().finally(()=>{e.newerBuildHandoff=null}),await e.newerBuildHandoff}async function xw(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=xC.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&&xC.get(e.options.dbName)===t&&bC.set(e.options.dbName,t),KC())})(),await e.closing))}function Sw(e){e.idleReleaseTimer&&clearTimeout(e.idleReleaseTimer),e.idleReleaseTimer=setTimeout(()=>{e.idleReleaseTimer=null,!(e.peers.size!==0||e.pendingAdmissionTasks!==0)&&xw(e).then(()=>{Cw()})},50)}function Cw(){if(KC(),!ww()){if(kC)return;let e=Symbol(`worker-idle-close`);kC=e;let t=new Set([...Z.keys(),...xC.keys()]);for(let e of t)FC(`owner-release-start`,e,null);Z.clear(),Promise.all([...t].map(e=>RC(e))).catch(()=>{}).finally(()=>{if(kC===e){if(ww()){kC=null;return}for(let e of t)FC(`owner-release-finished`,e,null);kC=null}})}}function ww(){return X.size>0||CC.size>0||OC>0||Tw()}function Tw(e){return[...Z.entries()].some(([t,n])=>(e===void 0||t===e)&&(n.activeLeaseIds.size>0||n.pendingLeaseAllocations>0||n.pendingLeaseFinalizations>0))}function Ew(e){for(let t of e.peers.keys())fw(e,t)}function Dw(e){if(e.intentionalStorageReset){e.runtime?.discard(),e.runtime=null,e.pageStore=null;return}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,zC(e.options.dbName),gw(e,{type:`storage-invalidated`}),setTimeout(()=>Ew(e),0))}async function Ow(e){let t=new Set(e.peers.keys());if(t.size===0)return;let n=DC++;await new Promise(r=>{e.resetBarrier={id:n,pending:t,resolve:r},gw(e,{type:`storage-reset`,resetId:n})})}function kw(e,t){e.context.resetBarrier?.id===t&&Aw(e.context,e.tabId)}function Aw(e,t){let n=e.resetBarrier;!n||!n.pending.delete(t)||n.pending.size!==0||(e.resetBarrier=null,n.resolve())}function jw(e,t,n){let r=new hh(t,n,t=>{let n=gh(t);e.port.postMessage({type:`frames`,frames:n},n.map(e=>e.buffer))},t=>dw(e,Hl(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 Mw(e){let t=e.flushRequestId;t===null||!e.flushPumpComplete||!e.flushObserved||(e.flushRequestId=null,e.flushedLocal=!0,Q(e,t))}function Nw(e,t){let n=e.telemetryCollectorUrl?.trim()||void 0,r=t.telemetryCollectorUrl?.trim()||void 0;return!n!=!r||n&&r&&(eh(n,`traces`)!==eh(r,`traces`)||eh(n,`logs`)!==eh(r,`logs`))?!1:(e.logLevel??fC)===(t.logLevel??fC)}function Pw(e){return e.dbName}function $(e,t){e.postMessage(t)}BC();
|