jazz-tools 2.0.0-alpha.66 → 2.0.0-alpha.67
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/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-DbxzzKYS.js → index-Dy2YbFMK.js} +3 -3
- package/dist/dev/inspector-overlay/embedded/assets/{jazz-broker-worker-nRxyqRt5.js → jazz-broker-worker-OYLmDTMs.js} +2 -2
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm-C2VuKMqv.js → jazz_wasm-mBuVt23h.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm_bg-Biazm84G.wasm → jazz_wasm_bg-ZC330TX3.wasm} +0 -0
- package/dist/dev/inspector-overlay/embedded/embedded.html +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.d.ts +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.js +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.d.ts +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.js +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprints.d.ts +2 -2
- package/dist/worker/jazz-broker-worker.js +2 -2
- package/dist/worker/jazz_wasm_bg.wasm +0 -0
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var Nh=Object.defineProperty,jh=Object.getOwnPropertyNames,_=(e,t)=>function(){return e&&(t=(0,e[jh(e)[0]])(e=0)),t},It=(e,t)=>{for(var r in t)Nh(e,r,{get:t[r],enumerable:!0})},ka={};It(ka,{PendingNativeRead:()=>yr,StreamingMutation:()=>br,UpstreamLink:()=>wr,WasmDb:()=>vr,WasmPendingSubscription:()=>_n,WasmPermissionAdviceRequest:()=>Ge,WasmTransport:()=>Sr,WasmWrite:()=>he,__testBindingCodecGoldenFixture:()=>Mh,__testValidateWireFrameBatchCorpus:()=>Dh,__testWireFrameCorpusFeatures:()=>Bh,captureTextAnchor:()=>Fh,captureTextRange:()=>Uh,currentTimestamp:()=>Wh,default:()=>fm,deriveUserId:()=>zh,drainTraceEntries:()=>qh,generateId:()=>Vh,init:()=>Gh,initSync:()=>dm,mintAnonymousToken:()=>Hh,mintLocalFirstToken:()=>Jh,nativeArtifactFingerprint:()=>Kh,resolveTextAnchor:()=>Xh,resolveTextRange:()=>Qh,setJsonSchemaValidator:()=>Yh,setTraceEntryCollectionEnabled:()=>Zh,subscribeTraceEntries:()=>em,validateSchema:()=>tm});function Mh(){let e,t;try{const r=d.__testBindingCodecGoldenFixture();return e=r[0],t=r[1],H(r[0],r[1])}finally{d.__wbindgen_free(e,t,1)}}function Dh(e,t,r){const n=I(e,d.__wbindgen_malloc),i=y,s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y,l=d.__testValidateWireFrameBatchCorpus(n,i,s,o,a,c);if(l[1])throw w(l[0])}function Bh(){let e,t;try{const r=d.__testWireFrameCorpusFeatures();return e=r[0],t=r[1],H(r[0],r[1])}finally{d.__wbindgen_free(e,t,1)}}function Fh(e,t,r,n){const i=E(e,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y,o=d.captureTextAnchor(i,s,!x(t),x(t)?0:t,r,n);if(o[2])throw w(o[1]);return w(o[0])}function Uh(e,t,r,n){const i=E(e,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y,o=d.captureTextRange(i,s,!x(t),x(t)?0:t,r,n);if(o[2])throw w(o[1]);return w(o[0])}function Wh(){const e=d.currentTimestamp();return BigInt.asUintN(64,e)}function zh(e){let t,r;try{const s=E(e,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=d.deriveUserId(s,o);var n=a[0],i=a[1];if(a[3])throw n=0,i=0,w(a[2]);return t=n,r=i,H(n,i)}finally{d.__wbindgen_free(t,r,1)}}function qh(){return d.drainTraceEntries()}function Vh(){let e,t;try{const r=d.generateId();return e=r[0],t=r[1],H(r[0],r[1])}finally{d.__wbindgen_free(e,t,1)}}function Gh(){d.init()}function Hh(e,t,r,n){let i,s;try{const c=E(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),f=y,p=d.mintAnonymousToken(c,l,u,f,r,n);var o=p[0],a=p[1];if(p[3])throw o=0,a=0,w(p[2]);return i=o,s=a,H(o,a)}finally{d.__wbindgen_free(i,s,1)}}function Jh(e,t,r,n){let i,s;try{const c=E(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),f=y,p=d.mintLocalFirstToken(c,l,u,f,r,n);var o=p[0],a=p[1];if(p[3])throw o=0,a=0,w(p[2]);return i=o,s=a,H(o,a)}finally{d.__wbindgen_free(i,s,1)}}function Kh(){let e,t;try{const r=d.nativeArtifactFingerprint();return e=r[0],t=r[1],H(r[0],r[1])}finally{d.__wbindgen_free(e,t,1)}}function Xh(e,t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=d.resolveTextAnchor(e,n,i,!x(r),x(r)?0:r);if(s[2])throw w(s[1]);return w(s[0])}function Qh(e,t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=d.resolveTextRange(e,n,i,!x(r),x(r)?0:r);if(s[2])throw w(s[1]);return w(s[0])}function Yh(e){d.setJsonSchemaValidator(e)}function Zh(e){d.setTraceEntryCollectionEnabled(e)}function em(e){return d.subscribeTraceEntries(e)}function tm(e){const t=I(e,d.__wbindgen_malloc),r=y,n=d.validateSchema(t,r);if(n[1])throw w(n[0])}function xa(){return{__proto__:null,"./jazz_wasm_bg.js":{__proto__:null,__wbg_Error_2e59b1b37a9a34c3:function(t,r){return Error(H(t,r))},__wbg_Number_e6ffdb596c888833:function(t){return Number(t)},__wbg_String_8564e559799eccda:function(t,r){const n=String(r),i=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y;re().setInt32(t+4,s,!0),re().setInt32(t+0,i,!0)},__wbg_Window_70131fc0c91e4b3c:function(t){return t.Window},__wbg_WorkerGlobalScope_601c48015b8cc78e:function(t){return t.WorkerGlobalScope},__wbg___wbindgen_bigint_get_as_i64_2c5082002e4826e2:function(t,r){const n=r,i=typeof n=="bigint"?n:void 0;re().setBigInt64(t+8,x(i)?BigInt(0):i,!0),re().setInt32(t+0,!x(i),!0)},__wbg___wbindgen_boolean_get_a86c216575a75c30:function(t){const r=t,n=typeof r=="boolean"?r:void 0;return x(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_dd5d2d07ce9e6c57:function(t,r){const n=Ni(r),i=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y;re().setInt32(t+4,s,!0),re().setInt32(t+0,i,!0)},__wbg___wbindgen_in_4bd7a57e54337366:function(t,r){return t in r},__wbg___wbindgen_is_bigint_6c98f7e945dacdde:function(t){return typeof t=="bigint"},__wbg___wbindgen_is_function_49868bde5eb1e745:function(t){return typeof t=="function"},__wbg___wbindgen_is_null_344c8750a8525473:function(t){return t===null},__wbg___wbindgen_is_object_40c5a80572e8f9d3:function(t){const r=t;return typeof r=="object"&&r!==null},__wbg___wbindgen_is_string_b29b5c5a8065ba1a:function(t){return typeof t=="string"},__wbg___wbindgen_is_undefined_c0cca72b82b86f4d:function(t){return t===void 0},__wbg___wbindgen_jsval_eq_7d430e744a913d26:function(t,r){return t===r},__wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944:function(t,r){return t==r},__wbg___wbindgen_number_get_7579aab02a8a620c:function(t,r){const n=r,i=typeof n=="number"?n:void 0;re().setFloat64(t+8,x(i)?0:i,!0),re().setInt32(t+0,!x(i),!0)},__wbg___wbindgen_string_get_914df97fcfa788f2:function(t,r){const n=r,i=typeof n=="string"?n:void 0;var s=x(i)?0:E(i,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y;re().setInt32(t+4,o,!0),re().setInt32(t+0,s,!0)},__wbg___wbindgen_throw_81fc77679af83bc6:function(t,r){throw new Error(H(t,r))},__wbg__wbg_cb_unref_3c3b4f651835fbcb:function(t){t._wbg_cb_unref()},__wbg_abort_cfab06d16d2d33a6:function(){return U(function(t){t.abort()},arguments)},__wbg_bound_88db1072ea68e901:function(){return U(function(t,r,n,i){return IDBKeyRange.bound(t,r,n!==0,i!==0)},arguments)},__wbg_call_368fa9c372d473ba:function(){return U(function(t,r,n,i){return t.call(r,n,i)},arguments)},__wbg_call_7f2987183bb62793:function(){return U(function(t,r){return t.call(r)},arguments)},__wbg_call_d578befcc3145dee:function(){return U(function(t,r,n){return t.call(r,n)},arguments)},__wbg_commit_e9c1332714c53826:function(){return U(function(t){t.commit()},arguments)},__wbg_construct_adeb3d5948c3d19a:function(){return U(function(t,r){return Reflect.construct(t,r)},arguments)},__wbg_createObjectStore_6e567b25160be2fa:function(){return U(function(t,r,n,i){return t.createObjectStore(H(r,n),i)},arguments)},__wbg_delete_fc24bd7dfa57938e:function(){return U(function(t,r){return t.delete(r)},arguments)},__wbg_done_547d467e97529006:function(t){return t.done},__wbg_entries_616b1a459b85be0b:function(t){return Object.entries(t)},__wbg_error_58469b8474e13592:function(){return U(function(t){const r=t.error;return x(r)?0:ue(r)},arguments)},__wbg_error_a6fa202b58aa1cd3:function(t,r){let n,i;try{n=t,i=r,console.error(H(t,r))}finally{d.__wbindgen_free(n,i,1)}},__wbg_getAll_93336699ea033b51:function(){return U(function(t,r){return t.getAll(r)},arguments)},__wbg_getDate_bafac038eaae076e:function(t){return t.getDate()},__wbg_getDay_6eebc8fe9cb183f5:function(t){return t.getDay()},__wbg_getFullYear_8f83597f7403c865:function(t){return t.getFullYear()},__wbg_getHours_81348c8e800060e7:function(t){return t.getHours()},__wbg_getMinutes_bd1ccf17dab913bf:function(t){return t.getMinutes()},__wbg_getMonth_288607689622719c:function(t){return t.getMonth()},__wbg_getRandomValues_15134f5c0ae6b0d0:function(){return U(function(t,r){globalThis.crypto.getRandomValues(Me(t,r))},arguments)},__wbg_getRandomValues_d49329ff89a07af1:function(){return U(function(t,r){globalThis.crypto.getRandomValues(Me(t,r))},arguments)},__wbg_getSeconds_edef7266627a185f:function(t){return t.getSeconds()},__wbg_getTime_f6ac312467f7cf09:function(t){return t.getTime()},__wbg_getTimezoneOffset_ac5be603b21a5797:function(t){return t.getTimezoneOffset()},__wbg_get_4848e350b40afc16:function(t,r){return t[r>>>0]},__wbg_get_ed0642c4b9d31ddf:function(){return U(function(t,r){return Reflect.get(t,r)},arguments)},__wbg_get_f96702c6245e4ef9:function(){return U(function(t,r){return Reflect.get(t,r)},arguments)},__wbg_get_unchecked_7d7babe32e9e6a54:function(t,r){return t[r>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(t,r){return t[r]},__wbg_global_e30ac0b7684506d0:function(t){return t.global},__wbg_has_3ec5c22db2e5237a:function(){return U(function(t,r){return Reflect.has(t,r)},arguments)},__wbg_indexedDB_065ce3ad400579e3:function(){return U(function(t){const r=t.indexedDB;return x(r)?0:ue(r)},arguments)},__wbg_indexedDB_a2139150e2ea2a08:function(){return U(function(t){const r=t.indexedDB;return x(r)?0:ue(r)},arguments)},__wbg_indexedDB_af74cb6df65fa636:function(){return U(function(t){const r=t.indexedDB;return x(r)?0:ue(r)},arguments)},__wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a:function(t){let r;try{r=t instanceof ArrayBuffer}catch{r=!1}return r},__wbg_instanceof_DomException_37f96d3fb69189bd:function(t){let r;try{r=t instanceof DOMException}catch{r=!1}return r},__wbg_instanceof_Error_e3390d6805733dad:function(t){let r;try{r=t instanceof Error}catch{r=!1}return r},__wbg_instanceof_IdbDatabase_0af111edb4be95f4:function(t){let r;try{r=t instanceof IDBDatabase}catch{r=!1}return r},__wbg_instanceof_IdbRequest_fc5918c726448f04:function(t){let r;try{r=t instanceof IDBRequest}catch{r=!1}return r},__wbg_instanceof_Map_a10a2795ef4bfe97:function(t){let r;try{r=t instanceof Map}catch{r=!1}return r},__wbg_instanceof_Uint8Array_4b8da683deb25d72:function(t){let r;try{r=t instanceof Uint8Array}catch{r=!1}return r},__wbg_isArray_db61795ad004c139:function(t){return Array.isArray(t)},__wbg_isSafeInteger_ea83862ba994770c:function(t){return Number.isSafeInteger(t)},__wbg_iterator_de403ef31815a3e6:function(){return Symbol.iterator},__wbg_length_0c32cb8543c8e4c8:function(t){return t.length},__wbg_length_6e821edde497a532:function(t){return t.length},__wbg_log_6a8b55ee2e172f54:function(t,r,n,i,s,o,a,c){let l,u;try{l=t,u=r,console.log(H(t,r),H(n,i),H(s,o),H(a,c))}finally{d.__wbindgen_free(l,u,1)}},__wbg_lowerBound_279c232a69ac0f79:function(){return U(function(t,r){return IDBKeyRange.lowerBound(t,r!==0)},arguments)},__wbg_message_52a9425f28c45ebc:function(t,r){const n=r.message,i=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y;re().setInt32(t+4,s,!0),re().setInt32(t+0,i,!0)},__wbg_message_7367f8c7d0fa1589:function(t){return t.message},__wbg_name_d7bb38b41d6d953e:function(t,r){const n=r.name,i=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y;re().setInt32(t+4,s,!0),re().setInt32(t+0,i,!0)},__wbg_new_0_bfa2ef4bc447daa2:function(){return new Date},__wbg_new_0f6d2ddfe083319b:function(t){return new Date(t)},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_new_40792555590ec35c:function(t,r){try{var n={a:t,b:r},i=(o,a)=>{const c=n.a;n.a=0;try{return Pa(c,n.b,o,a)}finally{n.a=c}};return new Promise(i)}finally{n.a=0}},__wbg_new_4f9fafbb3909af72:function(){return new Object},__wbg_new_99cabae501c0a8a0:function(){return new Map},__wbg_new_a560378ea1240b14:function(t){return new Uint8Array(t)},__wbg_new_e3b04b4d53d1b593:function(t,r){return new Error(H(t,r))},__wbg_new_f3c9df4f38f3f798:function(){return new Array},__wbg_new_from_slice_2580ff33d0d10520:function(t,r){return new Uint8Array(Me(t,r))},__wbg_new_typed_14d7cc391ce53d2c:function(t,r){try{var n={a:t,b:r},i=(o,a)=>{const c=n.a;n.a=0;try{return Pa(c,n.b,o,a)}finally{n.a=c}};return new Promise(i)}finally{n.a=0}},__wbg_new_with_length_9cedd08484b73942:function(t){return new Uint8Array(t>>>0)},__wbg_new_with_year_month_day_d7dc1e63a7b42902:function(t,r,n){return new Date(t>>>0,r,n)},__wbg_next_01132ed6134b8ef5:function(t){return t.next},__wbg_next_b3713ec761a9dbfd:function(){return U(function(t){return t.next()},arguments)},__wbg_now_6798946be0e6fe2b:function(){return U(function(){return Date.now()},arguments)},__wbg_now_88621c9c9a4f3ffc:function(){return Date.now()},__wbg_now_e7c6795a7f81e10f:function(t){return t.now()},__wbg_objectStore_3d4cade4416cd432:function(){return U(function(t,r,n){return t.objectStore(H(r,n))},arguments)},__wbg_open_ac04ec9d75d0eeaf:function(){return U(function(t,r,n,i){return t.open(H(r,n),i>>>0)},arguments)},__wbg_pendingnativeread_new:function(t){return yr.__wrap(t)},__wbg_performance_3fcf6e32a7e1ed0a:function(t){return t.performance},__wbg_prototypesetcall_3e05eb9545565046:function(t,r,n){Uint8Array.prototype.set.call(Me(t,r),n)},__wbg_push_6bdbc990be5ac37b:function(t,r){return t.push(r)},__wbg_put_015a7e88e46a2502:function(){return U(function(t,r){return t.put(r)},arguments)},__wbg_queueMicrotask_abaf92f0bd4e80a4:function(t){return t.queueMicrotask},__wbg_queueMicrotask_df5a6dac26d818f3:function(t){queueMicrotask(t)},__wbg_random_a72d453e63c9558c:function(){return Math.random()},__wbg_readyState_accbdf425c074d9c:function(t){const r=t.readyState;return(Oa.indexOf(r)+1||3)-1},__wbg_reject_1340e1211c01825b:function(t){return Promise.reject(t)},__wbg_resolve_0a79de24e9d2267b:function(t){return Promise.resolve(t)},__wbg_result_452c1006fc727317:function(){return U(function(t){return t.result},arguments)},__wbg_set_08463b1df38a7e29:function(t,r,n){return t.set(r,n)},__wbg_set_16a9c1a07b3d38ec:function(t,r,n){t.set(Me(r,n))},__wbg_set_6be42768c690e380:function(t,r,n){t[r]=n},__wbg_set_6c60b2e8ad0e9383:function(t,r,n){t[r>>>0]=n},__wbg_set_8ee2d34facb8466e:function(){return U(function(t,r,n){return Reflect.set(t,r,n)},arguments)},__wbg_set_key_path_6edd6ee0e8d75af3:function(t,r){t.keyPath=r},__wbg_set_onabort_6b6df7a41aa97c23:function(t,r){t.onabort=r},__wbg_set_oncomplete_20fb27150b4ee0d4:function(t,r){t.oncomplete=r},__wbg_set_onerror_2b7dfa4e6dea4159:function(t,r){t.onerror=r},__wbg_set_onerror_3c4b5087146b11b6:function(t,r){t.onerror=r},__wbg_set_onsuccess_f7e5b5cbed5008b1:function(t,r){t.onsuccess=r},__wbg_set_onupgradeneeded_d7e8e03a1999bf5d:function(t,r){t.onupgradeneeded=r},__wbg_stack_3b0d974bbf31e44f:function(t,r){const n=r.stack,i=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y;re().setInt32(t+4,s,!0),re().setInt32(t+0,i,!0)},__wbg_static_accessor_GLOBAL_THIS_a1248013d790bf5f:function(){const t=typeof globalThis>"u"?null:globalThis;return x(t)?0:ue(t)},__wbg_static_accessor_GLOBAL_f2e0f995a21329ff:function(){const t=typeof global>"u"?null:global;return x(t)?0:ue(t)},__wbg_static_accessor_SELF_24f78b6d23f286ea:function(){const t=typeof self>"u"?null:self;return x(t)?0:ue(t)},__wbg_static_accessor_WINDOW_59fd959c540fe405:function(){const t=typeof window>"u"?null:window;return x(t)?0:ue(t)},__wbg_subarray_0f98d3fb634508ad:function(t,r,n){return t.subarray(r>>>0,n>>>0)},__wbg_target_732d56b173b7e87c:function(t){const r=t.target;return x(r)?0:ue(r)},__wbg_then_00eed3ac0b8e82cb:function(t,r,n){return t.then(r,n)},__wbg_then_a0c8db0381c8994c:function(t,r){return t.then(r)},__wbg_toString_891d991e862e1d44:function(t){return t.toString()},__wbg_transaction_cc65dcef07fabb06:function(t){return t.transaction},__wbg_transaction_f909284bfed41115:function(){return U(function(t,r,n,i){return t.transaction(H(r,n),$a[i])},arguments)},__wbg_upperBound_2f3c07fb628c7a3c:function(){return U(function(t,r){return IDBKeyRange.upperBound(t,r!==0)},arguments)},__wbg_value_7f6052747ccf940f:function(t){return t.value},__wbg_wasmdb_new:function(t){return vr.__wrap(t)},__wbg_wasmtransport_new:function(t){return Sr.__wrap(t)},__wbg_wasmwrite_new:function(t){return he.__wrap(t)},__wbindgen_cast_0000000000000001:function(t,r){return xt(t,r,om)},__wbindgen_cast_0000000000000002:function(t,r){return xt(t,r,sm)},__wbindgen_cast_0000000000000003:function(t,r){return xt(t,r,im)},__wbindgen_cast_0000000000000004:function(t,r){return xt(t,r,am)},__wbindgen_cast_0000000000000005:function(t,r){return xt(t,r,rm)},__wbindgen_cast_0000000000000006:function(t,r){return xt(t,r,nm)},__wbindgen_cast_0000000000000007:function(t){return t},__wbindgen_cast_0000000000000008:function(t){return t},__wbindgen_cast_0000000000000009:function(t,r){return H(t,r)},__wbindgen_cast_000000000000000a:function(t){return BigInt.asUintN(64,t)},__wbindgen_init_externref_table:function(){const t=d.__wbindgen_externrefs,r=t.grow(4);t.set(0,void 0),t.set(r+0,void 0),t.set(r+1,null),t.set(r+2,!0),t.set(r+3,!1)}}}}function rm(e,t){d.wasm_bindgen__convert__closures_____invoke__h69610db431037c77(e,t)}function nm(e,t){d.wasm_bindgen__convert__closures_____invoke__h492b14c1fd17d971(e,t)}function im(e,t,r){d.wasm_bindgen__convert__closures_____invoke__hf83e1094fac4ab4c(e,t,r)}function sm(e,t,r){return d.wasm_bindgen__convert__closures_____invoke__hdac149749bdb2c9a(e,t,r)}function om(e,t,r){const n=d.wasm_bindgen__convert__closures_____invoke__hf2d3ca0c7acb67d9(e,t,r);if(n[1])throw w(n[0])}function am(e,t,r){const n=d.wasm_bindgen__convert__closures_____invoke__h05f214157d9fa149(e,t,r);if(n[1])throw w(n[0])}function Pa(e,t,r,n){d.wasm_bindgen__convert__closures_____invoke__h0c5680e9ed94b2e6(e,t,r,n)}function ue(e){const t=d.__externref_table_alloc();return d.__wbindgen_externrefs.set(t,e),t}function Ni(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){const i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){const i=e.length;let s="[";i>0&&(s+=Ni(e[0]));for(let o=1;o<i;o++)s+=", "+Ni(e[o]);return s+="]",s}const r=/\[object ([^\]]+)\]/.exec(toString.call(e));let n;if(r&&r.length>1)n=r[1];else return toString.call(e);if(n=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
|
|
2
|
-
${e.stack}`:n}function cm(e,t){e=e>>>0;const r=re(),n=[];for(let i=e;i<e+4*t;i+=4)n.push(d.__wbindgen_externrefs.get(r.getUint32(i,!0)));return d.__externref_drop_slice(e,t),n}function Me(e,t){return e=e>>>0,kt().subarray(e/1,e/1+t)}function re(){return(He===null||He.buffer.detached===!0||He.buffer.detached===void 0&&He.buffer!==d.memory.buffer)&&(He=new DataView(d.memory.buffer)),He}function H(e,t){return e=e>>>0,lm(e,t)}function kt(){return(Pt===null||Pt.byteLength===0)&&(Pt=new Uint8Array(d.memory.buffer)),Pt}function U(e,t){try{return e.apply(this,t)}catch(r){const n=ue(r);d.__wbindgen_exn_store(n)}}function x(e){return e==null}function xt(e,t,r){const n={a:e,b:t,cnt:1},i=(...s)=>{n.cnt++;const o=n.a;n.a=0;try{return r(o,n.b,...s)}finally{n.a=o,i._wbg_cb_unref()}};return i._wbg_cb_unref=()=>{--n.cnt===0&&(d.__wbindgen_destroy_closure(n.a,n.b),n.a=0,Wi.unregister(n))},Wi.register(i,n,n),i}function I(e,t){const r=t(e.length*1,1)>>>0;return kt().set(e,r/1),y=e.length,r}function E(e,t,r){if(r===void 0){const a=Ct.encode(e),c=t(a.length,1)>>>0;return kt().subarray(c,c+a.length).set(a),y=a.length,c}let n=e.length,i=t(n,1)>>>0;const s=kt();let o=0;for(;o<n;o++){const a=e.charCodeAt(o);if(a>127)break;s[i+o]=a}if(o!==n){o!==0&&(e=e.slice(o)),i=r(i,n,n=o+e.length*3,1)>>>0;const a=kt().subarray(i+o,i+n),c=Ct.encodeInto(e,a);o+=c.written,i=r(i,n,o,1)>>>0}return y=o,i}function w(e){const t=d.__wbindgen_externrefs.get(e);return d.__externref_table_dealloc(e),t}function lm(e,t){return yn+=t,yn>=Na&&(Er=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),Er.decode(),yn=t),Er.decode(kt().subarray(e,e+t))}function Ca(e,t){return d=e.exports,pm=t,He=null,Pt=null,d.__wbindgen_start(),d}async function um(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.ok&&r(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",i);else throw i}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function r(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}function dm(e){if(d!==void 0)return d;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const t=xa();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));const r=new WebAssembly.Instance(e,t);return Ca(r,e)}async function fm(e){if(d!==void 0)return d;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("jazz_wasm_bg.wasm",import.meta.url));const t=xa();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:r,module:n}=await um(await e,t);return Ca(r,n)}var yr,br,wr,vr,_n,Ge,Sr,he,Oa,$a,ji,Mi,La,Di,Bi,Fi,gn,Ui,Wi,He,Pt,Er,Na,yn,Ct,y,pm,d,hm=_({"../../crates/jazz-wasm/pkg/jazz_wasm.js"(){yr=class bh{static __wrap(t){t=t>>>0;const r=Object.create(bh.prototype);return r.__wbg_ptr=t,Mi.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Mi.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_pendingnativeread_free(t,0)}cancel(){d.pendingnativeread_cancel(this.__wbg_ptr)}poll(){const t=d.pendingnativeread_poll(this.__wbg_ptr);if(t[2])throw w(t[1]);return w(t[0])}},Symbol.dispose&&(yr.prototype[Symbol.dispose]=yr.prototype.free),br=class wh{static __wrap(t){t=t>>>0;const r=Object.create(wh.prototype);return r.__wbg_ptr=t,Bi.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Bi.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_streamingmutation_free(t,0)}abort(){return d.wasmstreamingmutation_abort(this.__wbg_ptr)}finish(){return d.wasmstreamingmutation_finish(this.__wbg_ptr)}finishInTransaction(){const t=d.wasmstreamingmutation_finishInTransaction(this.__wbg_ptr);if(t[1])throw w(t[0])}push(t){const r=I(t,d.__wbindgen_malloc),n=y;return d.wasmstreamingmutation_push(this.__wbg_ptr,r,n)}},Symbol.dispose&&(br.prototype[Symbol.dispose]=br.prototype.free),wr=class vh{static __wrap(t){t=t>>>0;const r=Object.create(vh.prototype);return r.__wbg_ptr=t,gn.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,gn.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_upstreamlink_free(t,0)}handle(t,r){let n,i;try{const a=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y,l=d.upstreamlink_handle(this.__wbg_ptr,t,a,c);var s=l[0],o=l[1];if(l[3])throw s=0,o=0,w(l[2]);return n=s,i=o,H(s,o)}finally{d.__wbindgen_free(n,i,1)}}constructor(t){const r=d.upstreamlink_new(t);return this.__wbg_ptr=r>>>0,gn.register(this,this.__wbg_ptr,this),this}},Symbol.dispose&&(wr.prototype[Symbol.dispose]=wr.prototype.free),vr=class hr{static __wrap(t){t=t>>>0;const r=Object.create(hr.prototype);return r.__wbg_ptr=t,ji.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ji.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_wasmdb_free(t,0)}acceptSubscriber(t,r,n){const i=I(t,d.__wbindgen_malloc),s=y,o=d.wasmdb_acceptSubscriber(this.__wbg_ptr,i,s,r,!x(n),x(n)?BigInt(0):n);if(o[2])throw w(o[1]);return w(o[0])}acceptSubscriberWithSelfSignedProof(t,r,n,i,s){const o=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),a=y,c=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=E(i,d.__wbindgen_malloc,d.__wbindgen_realloc),f=y,p=d.wasmdb_acceptSubscriberWithSelfSignedProof(this.__wbg_ptr,t,o,a,c,l,u,f,!x(s),x(s)?BigInt(0):s);if(p[2])throw w(p[1]);return w(p[0])}all(t,r,n,i,s){const o=I(t,d.__wbindgen_malloc),a=y;var c=x(n)?0:E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=x(i)?0:I(i,d.__wbindgen_malloc),f=y;const p=d.wasmdb_all(this.__wbg_ptr,o,a,r,c,l,u,f,s);if(p[2])throw w(p[1]);return w(p[0])}beginStreamingMutation(t,r,n,i,s,o,a,c,l,u,f){const p=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),g=y,m=I(r,d.__wbindgen_malloc),b=y,$=I(n,d.__wbindgen_malloc),O=y,C=E(i,d.__wbindgen_malloc,d.__wbindgen_realloc),N=y;var te=x(s)?0:E(s,d.__wbindgen_malloc,d.__wbindgen_realloc),V=y,le=x(o)?0:I(o,d.__wbindgen_malloc),ge=y,ye=x(a)?0:I(a,d.__wbindgen_malloc),be=y,oe=x(f)?0:E(f,d.__wbindgen_malloc,d.__wbindgen_realloc),Z=y;const B=d.wasmdb_beginStreamingMutation(this.__wbg_ptr,p,g,m,b,$,O,C,N,te,V,le,ge,ye,be,!x(c),x(c)?0:c,x(l)?0:ue(l),x(u)?0:ue(u),oe,Z);if(B[2])throw w(B[1]);return br.__wrap(B[0])}beginTransaction(t,r,n,i){const s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y;var l=x(n)?0:I(n,d.__wbindgen_malloc),u=y,f=x(i)?0:I(i,d.__wbindgen_malloc),p=y;const g=d.wasmdb_beginTransaction(this.__wbg_ptr,s,o,a,c,l,u,f,p);if(g[1])throw w(g[0])}canInsert(t,r){let n,i;try{const a=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y,l=I(r,d.__wbindgen_malloc),u=y,f=d.wasmdb_canInsert(this.__wbg_ptr,a,c,l,u);var s=f[0],o=f[1];if(f[3])throw s=0,o=0,w(f[2]);return n=s,i=o,H(s,o)}finally{d.__wbindgen_free(n,i,1)}}captureSnapshot(){const t=d.wasmdb_captureSnapshot(this.__wbg_ptr);if(t[2])throw w(t[1]);return w(t[0])}close(){return d.wasmdb_close(this.__wbg_ptr)}commitTransaction(t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y;var s=x(r)?0:E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y;const a=d.wasmdb_commitTransaction(this.__wbg_ptr,n,i,s,o);if(a[2])throw w(a[1]);return he.__wrap(a[0])}connectUpstream(){const t=d.wasmdb_connectUpstream(this.__wbg_ptr);if(t[2])throw w(t[1]);return w(t[0])}connectUpstreamWithSession(t,r,n,i,s,o){const a=I(n,d.__wbindgen_malloc),c=y,l=I(s,d.__wbindgen_malloc),u=y,f=d.wasmdb_connectUpstreamWithSession(this.__wbg_ptr,t,r,a,c,i,l,u,o);if(f[2])throw w(f[1]);return w(f[0])}createUpstreamLink(t){const r=d.wasmdb_createUpstreamLink(this.__wbg_ptr,t);return wr.__wrap(r)}delete(t,r,n){const i=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y,o=I(r,d.__wbindgen_malloc),a=y,c=d.wasmdb_delete(this.__wbg_ptr,i,s,o,a,n);if(c[2])throw w(c[1]);return he.__wrap(c[0])}deleteInTransaction(t,r,n,i){const s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y,l=I(n,d.__wbindgen_malloc),u=y,f=d.wasmdb_deleteInTransaction(this.__wbg_ptr,s,o,a,c,l,u,i);if(f[1])throw w(f[0])}static destroyBrowserStorage(t,r){const n=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y;return d.wasmdb_destroyBrowserStorage(t,n,i)}evictExpiredStagedLargeValues(){return d.wasmdb_evictExpiredStagedLargeValues(this.__wbg_ptr)}flush(){return d.wasmdb_flush(this.__wbg_ptr)}foregroundTxTimeHighWater(){const t=d.wasmdb_foregroundTxTimeHighWater(this.__wbg_ptr);if(t[2])throw w(t[1]);return w(t[0])}insert(t,r,n){const i=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y,o=I(r,d.__wbindgen_malloc),a=y,c=d.wasmdb_insert(this.__wbg_ptr,i,s,o,a,n);if(c[2])throw w(c[1]);return he.__wrap(c[0])}insertInTransaction(t,r,n,i){const s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y,l=I(n,d.__wbindgen_malloc),u=y,f=d.wasmdb_insertInTransaction(this.__wbg_ptr,s,o,a,c,l,u,i);if(f[3])throw w(f[2]);var p=Me(f[0],f[1]).slice();return d.__wbindgen_free(f[0],f[1]*1,1),p}localCurrentRow(t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=I(r,d.__wbindgen_malloc),o=y,a=d.wasmdb_localCurrentRow(this.__wbg_ptr,n,i,s,o);if(a[3])throw w(a[2]);var c=Me(a[0],a[1]).slice();return d.__wbindgen_free(a[0],a[1]*1,1),c}onMutationError(t){d.wasmdb_onMutationError(this.__wbg_ptr,t)}onStorageFailure(t){d.wasmdb_onStorageFailure(this.__wbg_ptr,t)}static openBrowser(t,r,n,i){const s=I(r,d.__wbindgen_malloc),o=y,a=I(n,d.__wbindgen_malloc),c=y,l=E(i,d.__wbindgen_malloc,d.__wbindgen_realloc),u=y;return d.wasmdb_openBrowser(t,s,o,a,c,l,u)}static openBrowserWithSelfSignedProof(t,r,n,i,s,o,a){const c=I(r,d.__wbindgen_malloc),l=y,u=I(n,d.__wbindgen_malloc),f=y,p=E(i,d.__wbindgen_malloc,d.__wbindgen_realloc),g=y,m=E(s,d.__wbindgen_malloc,d.__wbindgen_realloc),b=y,$=E(o,d.__wbindgen_malloc,d.__wbindgen_realloc),O=y,C=E(a,d.__wbindgen_malloc,d.__wbindgen_realloc),N=y;return d.wasmdb_openBrowserWithSelfSignedProof(t,c,l,u,f,p,g,m,b,$,O,C,N)}static openMemory(t,r){const n=I(t,d.__wbindgen_malloc),i=y,s=I(r,d.__wbindgen_malloc),o=y,a=d.wasmdb_openMemory(n,i,s,o);if(a[2])throw w(a[1]);return hr.__wrap(a[0])}static openMemoryAsBackend(t,r){const n=I(t,d.__wbindgen_malloc),i=y,s=I(r,d.__wbindgen_malloc),o=y,a=d.wasmdb_openMemoryAsBackend(n,i,s,o);if(a[2])throw w(a[1]);return hr.__wrap(a[0])}static openMemoryWithSelfSignedProof(t,r,n,i,s){const o=I(t,d.__wbindgen_malloc),a=y,c=I(r,d.__wbindgen_malloc),l=y,u=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),f=y,p=E(i,d.__wbindgen_malloc,d.__wbindgen_realloc),g=y,m=E(s,d.__wbindgen_malloc,d.__wbindgen_realloc),b=y,$=d.wasmdb_openMemoryWithSelfSignedProof(o,a,c,l,u,f,p,g,m,b);if($[2])throw w($[1]);return hr.__wrap($[0])}registerSchema(t,r){const n=I(t,d.__wbindgen_malloc),i=y;var s=x(r)?0:I(r,d.__wbindgen_malloc),o=y;const a=d.wasmdb_registerSchema(this.__wbg_ptr,n,i,s,o);if(a[2])throw w(a[1]);return hr.__wrap(a[0])}requestDeletePermissionAdvice(t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=I(r,d.__wbindgen_malloc),o=y,a=d.wasmdb_requestDeletePermissionAdvice(this.__wbg_ptr,n,i,s,o);if(a[2])throw w(a[1]);return Ge.__wrap(a[0])}requestInsertPermissionAdvice(t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=I(r,d.__wbindgen_malloc),o=y,a=d.wasmdb_requestInsertPermissionAdvice(this.__wbg_ptr,n,i,s,o);if(a[2])throw w(a[1]);return Ge.__wrap(a[0])}requestReadPermissionAdvice(t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=I(r,d.__wbindgen_malloc),o=y,a=d.wasmdb_requestReadPermissionAdvice(this.__wbg_ptr,n,i,s,o);if(a[2])throw w(a[1]);return Ge.__wrap(a[0])}requestUpdatePermissionAdvice(t,r,n){const i=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y,o=I(r,d.__wbindgen_malloc),a=y,c=I(n,d.__wbindgen_malloc),l=y,u=d.wasmdb_requestUpdatePermissionAdvice(this.__wbg_ptr,i,s,o,a,c,l);if(u[2])throw w(u[1]);return Ge.__wrap(u[0])}restore(t,r,n,i){const s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=I(r,d.__wbindgen_malloc),c=y;var l=x(n)?0:I(n,d.__wbindgen_malloc),u=y;const f=d.wasmdb_restore(this.__wbg_ptr,s,o,a,c,l,u,i);if(f[2])throw w(f[1]);return he.__wrap(f[0])}restoreInTransaction(t,r,n,i,s){const o=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),a=y,c=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=I(n,d.__wbindgen_malloc),f=y;var p=x(i)?0:I(i,d.__wbindgen_malloc),g=y;const m=d.wasmdb_restoreInTransaction(this.__wbg_ptr,o,a,c,l,u,f,p,g,s);if(m[1])throw w(m[0])}rollbackTransaction(t){const r=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),n=y,i=d.wasmdb_rollbackTransaction(this.__wbg_ptr,r,n);if(i[1])throw w(i[0])}seedForegroundTxTimeHighWater(t){const r=d.wasmdb_seedForegroundTxTimeHighWater(this.__wbg_ptr,t);if(r[1])throw w(r[0])}setIdentityClaims(t,r){const n=I(t,d.__wbindgen_malloc),i=y,s=d.wasmdb_setIdentityClaims(this.__wbg_ptr,n,i,r);if(s[1])throw w(s[0])}setLargeValueStagingPolicy(t,r,n){const i=d.wasmdb_setLargeValueStagingPolicy(this.__wbg_ptr,t,r,!x(n),x(n)?0:n);if(i[1])throw w(i[0])}setNonDurableClient(){const t=d.wasmdb_setNonDurableClient(this.__wbg_ptr);if(t[1])throw w(t[0])}setRemoteLinkHint(t){const r=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),n=y,i=d.wasmdb_setRemoteLinkHint(this.__wbg_ptr,r,n);if(i[1])throw w(i[0])}setSessionClaims(t){const r=d.wasmdb_setSessionClaims(this.__wbg_ptr,t);if(r[2])throw w(r[1]);return w(r[0])}setSlowQueryThresholdMs(t){const r=d.wasmdb_setSlowQueryThresholdMs(this.__wbg_ptr,t);if(r[1])throw w(r[0])}setTickScheduler(t){d.wasmdb_setTickScheduler(this.__wbg_ptr,t)}subscribe(t,r,n,i){const s=I(t,d.__wbindgen_malloc),o=y;var a=x(n)?0:I(n,d.__wbindgen_malloc),c=y;const l=d.wasmdb_subscribe(this.__wbg_ptr,s,o,r,a,c,i);if(l[2])throw w(l[1]);return w(l[0])}takeSlowQueryReport(t){var r=x(t)?0:E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),n=y;const i=d.wasmdb_takeSlowQueryReport(this.__wbg_ptr,r,n);if(i[3])throw w(i[2]);var s=cm(i[0],i[1]).slice();return d.__wbindgen_free(i[0],i[1]*4,4),s}tick(){return d.wasmdb_tick(this.__wbg_ptr)}update(t,r,n,i){const s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=I(r,d.__wbindgen_malloc),c=y,l=I(n,d.__wbindgen_malloc),u=y,f=d.wasmdb_update(this.__wbg_ptr,s,o,a,c,l,u,i);if(f[2])throw w(f[1]);return he.__wrap(f[0])}updateInTransaction(t,r,n,i,s){const o=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),a=y,c=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=I(n,d.__wbindgen_malloc),f=y,p=I(i,d.__wbindgen_malloc),g=y,m=d.wasmdb_updateInTransaction(this.__wbg_ptr,o,a,c,l,u,f,p,g,s);if(m[1])throw w(m[0])}updateLargeValues(t,r,n,i,s){const o=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),a=y,c=I(r,d.__wbindgen_malloc),l=y,u=I(n,d.__wbindgen_malloc),f=y,p=d.wasmdb_updateLargeValues(this.__wbg_ptr,o,a,c,l,u,f,i,!x(s),x(s)?0:s);if(p[2])throw w(p[1]);return he.__wrap(p[0])}updateLargeValuesInTransaction(t,r,n,i,s,o){const a=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y,l=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),u=y,f=I(n,d.__wbindgen_malloc),p=y,g=I(i,d.__wbindgen_malloc),m=y,b=d.wasmdb_updateLargeValuesInTransaction(this.__wbg_ptr,a,c,l,u,f,p,g,m,s,!x(o),x(o)?0:o);if(b[1])throw w(b[0])}uploadStatus(){const t=d.wasmdb_uploadStatus(this.__wbg_ptr);if(t[2])throw w(t[1]);return w(t[0])}upsert(t,r,n,i){const s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=I(r,d.__wbindgen_malloc),c=y,l=I(n,d.__wbindgen_malloc),u=y,f=d.wasmdb_upsert(this.__wbg_ptr,s,o,a,c,l,u,i);if(f[2])throw w(f[1]);return he.__wrap(f[0])}upsertInTransaction(t,r,n,i,s){const o=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),a=y,c=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=I(n,d.__wbindgen_malloc),f=y,p=I(i,d.__wbindgen_malloc),g=y,m=d.wasmdb_upsertInTransaction(this.__wbg_ptr,o,a,c,l,u,f,p,g,s);if(m[1])throw w(m[0])}waitForPendingWrites(t,r,n){const i=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y;return d.wasmdb_waitForPendingWrites(this.__wbg_ptr,i,s,x(r)?0:ue(r),x(n)?16777215:n?1:0)}wireFeatures(){return d.wasmdb_wireFeatures(this.__wbg_ptr)>>>0}},Symbol.dispose&&(vr.prototype[Symbol.dispose]=vr.prototype.free),_n=class{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,La.unregister(this),e}free(){const e=this.__destroy_into_raw();d.__wbg_wasmpendingsubscription_free(e,0)}cancel(){d.wasmpendingsubscription_cancel(this.__wbg_ptr)}poll(){const e=d.wasmpendingsubscription_poll(this.__wbg_ptr);if(e[2])throw w(e[1]);return w(e[0])}setWake(e){d.wasmpendingsubscription_setWake(this.__wbg_ptr,e)}},Symbol.dispose&&(_n.prototype[Symbol.dispose]=_n.prototype.free),Ge=class Sh{static __wrap(t){t=t>>>0;const r=Object.create(Sh.prototype);return r.__wbg_ptr=t,Di.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Di.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_wasmpermissionadvicerequest_free(t,0)}cancel(){d.wasmpermissionadvicerequest_cancel(this.__wbg_ptr)}get promise(){return d.wasmpermissionadvicerequest_promise(this.__wbg_ptr)}},Symbol.dispose&&(Ge.prototype[Symbol.dispose]=Ge.prototype.free),Sr=class Eh{static __wrap(t){t=t>>>0;const r=Object.create(Eh.prototype);return r.__wbg_ptr=t,Fi.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Fi.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_wasmtransport_free(t,0)}auxiliaryOutboundReady(){return d.wasmtransport_auxiliaryOutboundReady(this.__wbg_ptr)}auxiliaryReceiveTimeoutMs(){const t=d.wasmtransport_auxiliaryReceiveTimeoutMs(this.__wbg_ptr);return t===4294967297?void 0:t}clearOutboundScheduler(){d.wasmtransport_clearOutboundScheduler(this.__wbg_ptr)}close(){return d.wasmtransport_close(this.__wbg_ptr)!==0}expireAuxiliaryReceive(){d.wasmtransport_expireAuxiliaryReceive(this.__wbg_ptr)}recvAuxiliaryWireFrames(t,r){return d.wasmtransport_recvAuxiliaryWireFrames(this.__wbg_ptr,x(t)?4294967297:t>>>0,x(r)?4294967297:r>>>0)}recvWireFrames(){return d.wasmtransport_recvWireFrames(this.__wbg_ptr)}routeAuxiliaryWireFrame(t){const r=I(t,d.__wbindgen_malloc),n=y;return d.wasmtransport_routeAuxiliaryWireFrame(this.__wbg_ptr,r,n)}sendWireFrame(t){const r=I(t,d.__wbindgen_malloc),n=y;d.wasmtransport_sendWireFrame(this.__wbg_ptr,r,n)}sendWireFrames(t){d.wasmtransport_sendWireFrames(this.__wbg_ptr,t)}setAuxiliaryTraceEnabled(t){d.wasmtransport_setAuxiliaryTraceEnabled(this.__wbg_ptr,t)}setOutboundScheduler(t){d.wasmtransport_setOutboundScheduler(this.__wbg_ptr,t)}takeAuxiliaryTrace(){return d.wasmtransport_takeAuxiliaryTrace(this.__wbg_ptr)}tick(){return d.wasmtransport_tick(this.__wbg_ptr)}updateAuthenticatedClaims(t){const r=d.wasmtransport_updateAuthenticatedClaims(this.__wbg_ptr,t);if(r[2])throw w(r[1]);return w(r[0])}upstreamRefusal(){return d.wasmtransport_upstreamRefusal(this.__wbg_ptr)}},Symbol.dispose&&(Sr.prototype[Symbol.dispose]=Sr.prototype.free),he=class Ah{static __wrap(t){t=t>>>0;const r=Object.create(Ah.prototype);return r.__wbg_ptr=t,Ui.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ui.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_wasmwrite_free(t,0)}close(){return d.wasmwrite_close(this.__wbg_ptr)!==0}get payload(){const t=d.wasmwrite_payload(this.__wbg_ptr);var r=Me(t[0],t[1]).slice();return d.__wbindgen_free(t[0],t[1]*1,1),r}get rowId(){const t=d.wasmwrite_rowId(this.__wbg_ptr);var r=Me(t[0],t[1]).slice();return d.__wbindgen_free(t[0],t[1]*1,1),r}get txId(){let t,r;try{const n=d.wasmwrite_txId(this.__wbg_ptr);return t=n[0],r=n[1],H(n[0],n[1])}finally{d.__wbindgen_free(t,r,1)}}wait(t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=d.wasmwrite_wait(this.__wbg_ptr,n,i,x(r)?16777215:r?1:0);if(s[2])throw w(s[1]);return w(s[0])}writeState(){const t=d.wasmwrite_writeState(this.__wbg_ptr);if(t[2])throw w(t[1]);return w(t[0])}},Symbol.dispose&&(he.prototype[Symbol.dispose]=he.prototype.free),Oa=["pending","done"],$a=["readonly","readwrite","versionchange","readwriteflush","cleanup"],ji=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_wasmdb_free(e>>>0,1)),Mi=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_pendingnativeread_free(e>>>0,1)),La=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_wasmpendingsubscription_free(e>>>0,1)),Di=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_wasmpermissionadvicerequest_free(e>>>0,1)),Bi=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_streamingmutation_free(e>>>0,1)),Fi=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_wasmtransport_free(e>>>0,1)),gn=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_upstreamlink_free(e>>>0,1)),Ui=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_wasmwrite_free(e>>>0,1)),Wi=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbindgen_destroy_closure(e.a,e.b)),He=null,Pt=null,Er=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),Er.decode(),Na=2146435072,yn=0,Ct=new TextEncoder,"encodeInto"in Ct||(Ct.encodeInto=function(e,t){const r=Ct.encode(e);return t.set(r),{read:e.length,written:r.length}}),y=0}}),zi,mm=_({"../../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"(){zi=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()}}}}),qi,_m=_({"../../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"(){qi=class extends Error{code;name="OTLPExporterError";data;constructor(e,t,r){super(e),this.data=r,this.code=t}}}});function gm(e){if(Number.isFinite(e)&&e>0)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function ym(e){if(e!=null)return async()=>e}function bm(e,t,r){return{timeoutMillis:gm(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}function wm(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var ja=_({"../../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 vm(e){return new Ma(e.concurrencyLimit)}var Ma,Sm=_({"../../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"(){Ma=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);const t=()=>{const r=this._sendingPromises.indexOf(e);this._sendingPromises.splice(r,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}}}),Je,Da=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/version.js"(){Je="1.9.1"}});function Em(e){const t=new Set([e]),r=new Set,n=e.match(Vi);if(!n)return()=>!1;const i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(c){return c===e};function s(a){return r.add(a),!1}function o(a){return t.add(a),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;const l=c.match(Vi);if(!l)return s(c);const u={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return u.prerelease!=null||i.major!==u.major?s(c):i.major===0?i.minor===u.minor&&i.patch<=u.patch?o(c):s(c):i.minor<=u.minor?o(c):s(c)}}var Vi,Ba,Am=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js"(){Da(),Vi=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,Ba=Em(Je)}});function Gi(e,t,r,n=!1){var i;const s=$t[Ot]=(i=$t[Ot])!==null&&i!==void 0?i:{version:Je};if(!n&&s[e]){const o=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(o.stack||o.message),!1}if(s.version!==Je){const o=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${e} does not match previously registered API v${Je}`);return r.error(o.stack||o.message),!1}return s[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${Je}.`),!0}function Ar(e){var t,r;const n=(t=$t[Ot])===null||t===void 0?void 0:t.version;if(!(!n||!Ba(n)))return(r=$t[Ot])===null||r===void 0?void 0:r[e]}function Hi(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Je}.`);const r=$t[Ot];r&&delete r[e]}var Fa,Ot,$t,bn=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js"(){Da(),Am(),Fa=Je.split(".")[0],Ot=Symbol.for(`opentelemetry.js.api.${Fa}`),$t=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}}});function Tr(e,t,r){const n=Ar("diag");if(n)return n[e](t,...r)}var Ua,Tm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js"(){bn(),Ua=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return Tr("debug",this._namespace,e)}error(...e){return Tr("error",this._namespace,e)}info(...e){return Tr("info",this._namespace,e)}warn(...e){return Tr("warn",this._namespace,e)}verbose(...e){return Tr("verbose",this._namespace,e)}}}}),de,Wa=_({"../../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"})(de||(de={}))}});function Rm(e,t){e<de.NONE?e=de.NONE:e>de.ALL&&(e=de.ALL),t=t||{};function r(n,i){const s=t[n];return typeof s=="function"&&e>=i?s.bind(t):function(){}}return{error:r("error",de.ERROR),warn:r("warn",de.WARN),info:r("info",de.INFO),debug:r("debug",de.DEBUG),verbose:r("verbose",de.VERBOSE)}}var Im=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js"(){Wa()}}),za,Lt,Ji=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js"(){Tm(),Im(),Wa(),bn(),za="diag",Lt=class Th{static instance(){return this._instance||(this._instance=new Th),this._instance}constructor(){function t(i){return function(...s){const o=Ar("diag");if(o)return o[i](...s)}}const r=this,n=(i,s={logLevel:de.INFO})=>{var o,a,c;if(i===r){const f=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((o=f.stack)!==null&&o!==void 0?o:f.message),!1}typeof s=="number"&&(s={logLevel:s});const l=Ar("diag"),u=Rm((a=s.logLevel)!==null&&a!==void 0?a:de.INFO,i);if(l&&!s.suppressOverrideMessage){const f=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";l.warn(`Current logger will be overwritten from ${f}`),u.warn(`Current logger will overwrite one already registered from ${f}`)}return Gi("diag",u,r,!0)};r.setLogger=n,r.disable=()=>{Hi(za,r)},r.createComponentLogger=i=>new Ua(i),r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}}}});function qa(e){return Symbol.for(e)}var Va,Ga,Ki=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js"(){Va=class ba{constructor(t){const r=this;r._currentContext=t?new Map(t):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,i)=>{const s=new ba(r._currentContext);return s._currentContext.set(n,i),s},r.deleteValue=n=>{const i=new ba(r._currentContext);return i._currentContext.delete(n),i}}},Ga=new Va}});function Ha(){return rc}var Ja,Rr,Ka,Xa,Qa,Ya,wn,Za,ec,tc,rc,nc,ic,sc,oc,ac,cc,lc,km=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js"(){Ja=class{constructor(){}createGauge(e,t){return ic}createHistogram(e,t){return sc}createCounter(e,t){return nc}createUpDownCounter(e,t){return oc}createObservableGauge(e,t){return cc}createObservableCounter(e,t){return ac}createObservableUpDownCounter(e,t){return lc}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},Rr=class{},Ka=class extends Rr{add(e,t){}},Xa=class extends Rr{add(e,t){}},Qa=class extends Rr{record(e,t){}},Ya=class extends Rr{record(e,t){}},wn=class{addCallback(e){}removeCallback(e){}},Za=class extends wn{},ec=class extends wn{},tc=class extends wn{},rc=new Ja,nc=new Ka,ic=new Qa,sc=new Ya,oc=new Xa,ac=new Za,cc=new ec,lc=new tc}}),uc,xm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js"(){Ki(),uc=class{active(){return Ga}with(e,t,r,...n){return t.call(r,...n)}bind(e,t){return t}enable(){return this}disable(){return this}}}}),vn,dc,Sn,Xi=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/context.js"(){xm(),bn(),Ji(),vn="context",dc=new uc,Sn=class Rh{constructor(){}static getInstance(){return this._instance||(this._instance=new Rh),this._instance}setGlobalContextManager(t){return Gi(vn,t,Lt.instance())}active(){return this._getContextManager().active()}with(t,r,n,...i){return this._getContextManager().with(t,r,n,...i)}bind(t,r){return this._getContextManager().bind(t,r)}_getContextManager(){return Ar(vn)||dc}disable(){this._getContextManager().disable(),Hi(vn,Lt.instance())}}}}),fe,fc=_({"../../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"})(fe||(fe={}))}}),Qi,Yi,Zi,es=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js"(){fc(),Qi="0000000000000000",Yi="00000000000000000000000000000000",Zi={traceId:Yi,spanId:Qi,traceFlags:fe.NONE}}}),Nt,ts=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js"(){es(),Nt=class{constructor(e=Zi){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 rs(e){return e.getValue(En)||void 0}function Pm(){return rs(Sn.getInstance().active())}function ns(e,t){return e.setValue(En,t)}function Cm(e){return e.deleteValue(En)}function Om(e,t){return ns(e,new Nt(t))}function pc(e){var t;return(t=rs(e))===null||t===void 0?void 0:t.spanContext()}var En,hc=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js"(){Ki(),ts(),Xi(),En=qa("OpenTelemetry Context Key SPAN")}});function mc(e,t){if(typeof e!="string"||e.length!==t)return!1;let r=0;for(let n=0;n<e.length;n+=4)r+=(Ir[e.charCodeAt(n)]|0)+(Ir[e.charCodeAt(n+1)]|0)+(Ir[e.charCodeAt(n+2)]|0)+(Ir[e.charCodeAt(n+3)]|0);return r===t}function _c(e){return mc(e,32)&&e!==Yi}function $m(e){return mc(e,16)&&e!==Qi}function jt(e){return _c(e.traceId)&&$m(e.spanId)}function Lm(e){return new Nt(e)}var Ir,is=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js"(){es(),ts(),Ir=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 Nm(e){return e!==null&&typeof e=="object"&&"spanId"in e&&typeof e.spanId=="string"&&"traceId"in e&&typeof e.traceId=="string"&&"traceFlags"in e&&typeof e.traceFlags=="number"}var An,ss,gc=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js"(){Xi(),hc(),ts(),is(),An=Sn.getInstance(),ss=class{startSpan(e,t,r=An.active()){if(!!t?.root)return new Nt;const i=r&&pc(r);return Nm(i)&&jt(i)?new Nt(i):new Nt}startActiveSpan(e,t,r,n){let i,s,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=r):(i=t,s=r,o=n);const a=s??An.active(),c=this.startSpan(e,i,a),l=ns(a,c);return An.with(l,o,void 0,c)}}}}),yc,bc,jm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js"(){gc(),yc=new ss,bc=class{constructor(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}startSpan(e,t,r){return this._getTracer().startSpan(e,t,r)}startActiveSpan(e,t,r,n){const i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;const e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):yc}}}}),wc,Mm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js"(){gc(),wc=class{getTracer(e,t,r){return new ss}}}}),vc,os,Dm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js"(){jm(),Mm(),vc=new wc,os=class{getTracer(e,t,r){var n;return(n=this.getDelegateTracer(e,t,r))!==null&&n!==void 0?n:new bc(this,e,t,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:vc}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,r){var n;return(n=this._delegate)===null||n===void 0?void 0:n.getTracer(e,t,r)}}}}),Tn,Bm=_({"../../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"})(Tn||(Tn={}))}}),as,Fm=_({"../../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"})(as||(as={}))}}),Mt,Um=_({"../../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"})(Mt||(Mt={}))}}),me,Wm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context-api.js"(){Xi(),me=Sn.getInstance()}}),R,zm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag-api.js"(){Ji(),R=Lt.instance()}}),Rn,Sc,qm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js"(){bn(),Dm(),is(),hc(),Ji(),Rn="trace",Sc=class Ih{constructor(){this._proxyTracerProvider=new os,this.wrapSpanContext=Lm,this.isSpanContextValid=jt,this.deleteSpan=Cm,this.getSpan=rs,this.getActiveSpan=Pm,this.getSpanContext=pc,this.setSpan=ns,this.setSpanContext=Om}static getInstance(){return this._instance||(this._instance=new Ih),this._instance}setGlobalTracerProvider(t){const r=Gi(Rn,this._proxyTracerProvider,Lt.instance());return r&&this._proxyTracerProvider.setDelegate(t),r}getTracerProvider(){return Ar(Rn)||this._proxyTracerProvider}getTracer(t,r){return this.getTracerProvider().getTracer(t,r)}disable(){Hi(Rn,Lt.instance()),this._proxyTracerProvider=new os}}}}),ve,Vm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js"(){qm(),ve=Sc.getInstance()}}),z=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/index.js"(){Ki(),km(),Bm(),Fm(),Um(),fc(),is(),es(),Wm(),zm(),Vm()}});function cs(e){return e.setValue(ls,!0)}function Gm(e){return e.getValue(ls)===!0}var ls,Ec=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js"(){z(),ls=qa("OpenTelemetry SDK Context Key SUPPRESS_TRACING")}});function kr(e){const t={};if(typeof e!="object"||e==null)return t;for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if(!Hm(r)){R.warn(`Invalid attribute key: ${r}`);continue}const n=e[r];if(!Ac(n)){R.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?t[r]=n.slice():t[r]=n}return t}function Hm(e){return typeof e=="string"&&e!==""}function Ac(e){return e==null?!0:Array.isArray(e)?Jm(e):Tc(typeof e)}function Jm(e){let t;for(const r of e){if(r==null)continue;const n=typeof r;if(n!==t){if(!t){if(Tc(n)){t=n;continue}return!1}return!1}}return!0}function Tc(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}var Km=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/attributes.js"(){z()}});function Xm(){return e=>{R.error(Qm(e))}}function Qm(e){return typeof e=="string"?e:JSON.stringify(Ym(e))}function Ym(e){const t={};let r=e;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(t[n])return;const i=r[n];i&&(t[n]=String(i))}),r=Object.getPrototypeOf(r);return t}var Zm=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/logging-error-handler.js"(){z()}});function pe(e){try{Rc(e)}catch{}}var Rc,e_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/global-error-handler.js"(){Zm(),Rc=Xm()}});function uT(e){}function dT(e){}var t_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/environment.js"(){}}),Ic,r_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/version.js"(){Ic="2.7.1"}}),n_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"(){}}),i_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"(){n_()}}),s_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"(){}}),o_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"(){s_()}}),kc,xc,Pc,Cc,a_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"(){kc="telemetry.sdk.language",xc="webjs",Pc="telemetry.sdk.name",Cc="telemetry.sdk.version"}}),c_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"(){}}),l_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js"(){}}),u_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"(){i_(),o_(),a_(),c_(),l_()}}),Oc,d_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/semconv.js"(){Oc="process.runtime.name"}}),In,f_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/sdk-info.js"(){r_(),u_(),d_(),In={[Pc]:"opentelemetry",[Oc]:"browser",[kc]:xc,[Cc]:Ic}}}),Ke,$c=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/index.js"(){t_(),f_(),Ke=performance}});function Xe(e){const t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*Fc);return[r,n]}function Lc(e){const t=Xe(Ke.timeOrigin),r=Xe(typeof e=="number"?e:Ke.now());return Mc(t,r)}function Nc(e){if(ds(e))return e;if(typeof e=="number")return e<Ke.timeOrigin?Lc(e):Xe(e);if(e instanceof Date)return Xe(e.getTime());throw TypeError("Invalid input type")}function p_(e,t){let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(r-=1,n+=xr),[r,n]}function h_(e){return e[0]*xr+e[1]}function us(e){return e[0]*1e6+e[1]/1e3}function ds(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function jc(e){return ds(e)||typeof e=="number"||e instanceof Date}function Mc(e,t){const r=[e[0]+t[0],e[1]+t[1]];return r[1]>=xr&&(r[1]-=xr,r[0]+=1),r}var Dc,Bc,Fc,xr,m_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/time.js"(){$c(),Dc=9,Bc=6,Fc=Math.pow(10,Bc),xr=Math.pow(10,Dc)}}),ee,__=_({"../../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"})(ee||(ee={}))}});function Uc(e){if(!g_(e)||y_(e)!==Wc)return!1;const t=Hc(e);if(t===null)return!0;const r=hs.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&fs.call(r)===Gc}function g_(e){return e!=null&&typeof e=="object"}function y_(e){return e==null?e===void 0?qc:zc:Qe&&Qe in Object(e)?b_(e):w_(e)}function b_(e){const t=hs.call(e,Qe),r=e[Qe];let n=!1;try{e[Qe]=void 0,n=!0}catch{}const i=ms.call(e);return n&&(t?e[Qe]=r:delete e[Qe]),i}function w_(e){return ms.call(e)}var Wc,zc,qc,Vc,fs,Gc,Hc,ps,hs,Qe,ms,v_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/lodash.merge.js"(){Wc="[object Object]",zc="[object Null]",qc="[object Undefined]",Vc=Function.prototype,fs=Vc.toString,Gc=fs.call(Object),Hc=Object.getPrototypeOf,ps=Object.prototype,hs=ps.hasOwnProperty,Qe=Symbol?Symbol.toStringTag:void 0,ms=ps.toString}});function S_(...e){let t=e.shift();const r=new WeakMap;for(;e.length>0;)t=Jc(t,e.shift(),0,r);return t}function _s(e){return kn(e)?e.slice():e}function Jc(e,t,r=0,n){let i;if(!(r>Qc)){if(r++,xn(e)||xn(t)||Xc(t))i=_s(t);else if(kn(e)){if(i=e.slice(),kn(t))for(let s=0,o=t.length;s<o;s++)i.push(_s(t[s]));else if(Pr(t)){const s=Object.keys(t);for(let o=0,a=s.length;o<a;o++){const c=s[o];c==="__proto__"||c==="constructor"||c==="prototype"||(i[c]=_s(t[c]))}}}else if(Pr(e))if(Pr(t)){if(!E_(e,t))return t;i=Object.assign({},e);const s=Object.keys(t);for(let o=0,a=s.length;o<a;o++){const c=s[o];if(c==="__proto__"||c==="constructor"||c==="prototype")continue;const l=t[c];if(xn(l))typeof l>"u"?delete i[c]:i[c]=l;else{const u=i[c],f=l;if(Kc(e,c,n)||Kc(t,c,n))delete i[c];else{if(Pr(u)&&Pr(f)){const p=n.get(u)||[],g=n.get(f)||[];p.push({obj:e,key:c}),g.push({obj:t,key:c}),n.set(u,p),n.set(f,g)}i[c]=Jc(i[c],l,r,n)}}}}else i=t;return i}}function Kc(e,t,r){const n=r.get(e[t])||[];for(let i=0,s=n.length;i<s;i++){const o=n[i];if(o.key===t&&o.obj===e)return!0}return!1}function kn(e){return Array.isArray(e)}function Xc(e){return typeof e=="function"}function Pr(e){return!xn(e)&&!kn(e)&&!Xc(e)&&typeof e=="object"}function xn(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function E_(e,t){return!(!Uc(e)||!Uc(t))}var Qc,A_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/merge.js"(){v_(),Qc=20}});function T_(e,t){let r;const n=new Promise(function(s,o){r=setTimeout(function(){o(new Yc("Operation timed out."))},t)});return Promise.race([e,n]).then(i=>(clearTimeout(r),i),i=>{throw clearTimeout(r),i})}var Yc,R_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/timeout.js"(){Yc=class kh extends Error{constructor(t){super(t),Object.setPrototypeOf(this,kh.prototype)}}}}),Zc,I_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/promise.js"(){Zc=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)}}}}),Dt,k_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/callback.js"(){I_(),Dt=class{_isCalled=!1;_deferred=new Zc;_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(t=>this._deferred.resolve(t),t=>this._deferred.reject(t))}catch(t){this._deferred.reject(t)}}return this._deferred.promise}}}});function x_(e,t){return new Promise(r=>{me.with(cs(me.active()),()=>{e.export(t,r)})})}var P_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/internal/exporter.js"(){z(),Ec()}}),gs,J=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/index.js"(){Km(),e_(),m_(),__(),$c(),Ec(),A_(),R_(),k_(),P_(),gs={_export:x_}}});function C_(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function O_(){return{handleResponse(e){e==null||!C_(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||R.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}var $_=_({"../../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"(){z()}});function L_(e,t){return new el(e.transport,e.serializer,O_(),e.promiseHandler,t.timeout)}var el,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"(){J(),_m(),$_(),z(),el=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,t,r,n,i){this._transport=e,this._serializer=t,this._responseHandler=r,this._promiseQueue=n,this._timeout=i,this._diagLogger=R.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,t){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()){t({code:ee.FAILED,error:new Error("Concurrent export limit reached")});return}const r=this._serializer.serializeRequest(e);if(r==null){t({code:ee.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(r,this._timeout).then(n=>{if(n.status==="success"){if(n.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(n.data))}catch(i){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",i,n.data)}t({code:ee.SUCCESS});return}else if(n.status==="failure"&&n.error){t({code:ee.FAILED,error:n.error});return}else n.status==="retryable"?t({code:ee.FAILED,error:n.error??new qi("Export failed with retryable status")}):t({code:ee.FAILED,error:new qi("Export failed with unknown error")})},n=>t({code:ee.FAILED,error:n})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}}});function j_(e,t,r){return L_({transport:r,serializer:t,promiseHandler:vm(e)},{timeout:e.timeoutMillis})}var M_=_({"../../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"(){Sm(),N_()}}),tl=_({"../../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"(){mm()}}),pt,D_=_({"../../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"})(pt||(pt={}))}}),ys,bs,ws=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLogger.js"(){ys=class{emit(e){}enabled(){return!1}},bs=new ys}});function B_(e,t,r){return n=>n===e?t:r}var Cr,Bt,vs,F_=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/internal/global-utils.js"(){Cr=Symbol.for("io.opentelemetry.js.api.logs"),Bt=globalThis,vs=1}}),rl,Ss,nl=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLoggerProvider.js"(){ws(),rl=class{getLogger(e,t,r){return new ys}},Ss=new rl}}),il,U_=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLogger.js"(){ws(),il=class{constructor(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;const e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):bs}}}}),Es,W_=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLoggerProvider.js"(){nl(),U_(),Es=class{getLogger(e,t,r){var n;return(n=this._getDelegateLogger(e,t,r))!==null&&n!==void 0?n:new il(this,e,t,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Ss}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,r){var n;return(n=this._delegate)===null||n===void 0?void 0:n.getLogger(e,t,r)}}}}),sl,z_=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/api/logs.js"(){F_(),nl(),W_(),sl=class xh{constructor(){this._proxyLoggerProvider=new Es}static getInstance(){return this._instance||(this._instance=new xh),this._instance}setGlobalLoggerProvider(t){return Bt[Cr]?this.getLoggerProvider():(Bt[Cr]=B_(vs,t,Ss),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=Bt[Cr])===null||t===void 0?void 0:t.call(Bt,vs))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete Bt[Cr],this._proxyLoggerProvider=new Es}}}}),q_,Pn=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/index.js"(){D_(),ws(),z_(),q_=sl.getInstance()}}),V_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"(){}}),G_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"(){V_()}}),H_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"(){}}),J_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"(){H_()}}),Ye,Cn,Ze,As,Ts,Rs,Is,K_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"(){Ye="exception.message",Cn="exception.stacktrace",Ze="exception.type",As="service.name",Ts="telemetry.sdk.language",Rs="telemetry.sdk.name",Is="telemetry.sdk.version"}}),X_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"(){}}),Q_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js"(){}}),On=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"(){G_(),J_(),K_(),X_(),Q_()}});function ol(){if($n===void 0)try{const e=globalThis.process.argv0;$n=e?`unknown_service:${e}`:"unknown_service"}catch{$n="unknown_service"}return $n}var $n,al=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/default-service-name.js"(){}}),Ft,Y_=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/utils.js"(){Ft=e=>e!==null&&typeof e=="object"&&typeof e.then=="function"}});function ks(e,t){return Cs.FromAttributeList(Object.entries(e),t)}function Z_(e,t){return new Cs(e,t)}function xs(){return ks({})}function Ps(){return ks({[As]:ol(),[Ts]:In[Ts],[Rs]:In[Rs],[Is]:In[Is]})}function cl(e){return e.map(([t,r])=>Ft(r)?[t,r.catch(n=>{R.debug("promise rejection for resource attribute: %s - %s",t,n)})]:[t,r])}function eg(e){if(typeof e=="string"||e===void 0)return e;R.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}function tg(e,t){const r=e?.schemaUrl,n=t?.schemaUrl,i=r===void 0||r==="",s=n===void 0||n==="";if(i)return n;if(s||r===n)return r;R.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}var Cs,ll=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js"(){z(),J(),On(),al(),Y_(),Cs=class wa{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,r){const n=new wa({},r);return n._rawAttributes=cl(t),n._asyncAttributesPending=t.filter(([i,s])=>Ft(s)).length>0,n}constructor(t,r){const n=t.attributes??{};this._rawAttributes=Object.entries(n).map(([i,s])=>(Ft(s)&&(this._asyncAttributesPending=!0),[i,s])),this._rawAttributes=cl(this._rawAttributes),this._schemaUrl=eg(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){const[r,n]=this._rawAttributes[t];this._rawAttributes[t]=[r,Ft(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&R.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const t={};for(const[r,n]of this._rawAttributes){if(Ft(n)){R.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(t[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;const r=tg(this,t),n=r?{schemaUrl:r}:void 0;return wa.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],n)}}}}),ul,rg=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detect-resources.js"(){z(),ll(),ul=(e={})=>(e.detectors||[]).map(r=>{try{const n=Z_(r.detect(e));return R.debug(`${r.constructor.name} found resource.`,n),n}catch(n){return R.debug(`${r.constructor.name} failed: ${n.message}`),xs()}}).reduce((r,n)=>r.merge(n),xs())}}),dl,fl,ng=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/EnvDetector.js"(){z(),On(),J(),dl=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(e){const t={},r=void 0,n=void 0;if(r)try{const i=this._parseResourceAttributes(r);Object.assign(t,i)}catch(i){R.debug(`EnvDetector failed: ${i instanceof Error?i.message:i}`)}return n&&(t[As]=n),{attributes:t}}_parseResourceAttributes(e){if(!e)return{};const t={},r=e.split(this._COMMA_SEPARATOR).filter(n=>n.trim()!=="");for(const n of r){const i=n.split(this._LABEL_KEY_VALUE_SPLITTER);if(i.length!==2)throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${n}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);const[s,o]=i,a=s.trim(),c=o.trim();if(a.length===0)throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${n}".`);let l,u;try{l=decodeURIComponent(a),u=decodeURIComponent(c)}catch(f){throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${n}": ${f instanceof Error?f.message:f}`)}if(l.length>this._MAX_LENGTH)throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${l}".`);if(u.length>this._MAX_LENGTH)throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${l}".`);t[l]=u}return t}},fl=new dl}}),pl,Or,Ln=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/NoopDetector.js"(){pl=class{detect(){return{attributes:{}}}},Or=new pl}}),hl,ig=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/HostDetector.js"(){Ln(),hl=Or}}),ml,sg=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/OSDetector.js"(){Ln(),ml=Or}}),_l,og=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/ProcessDetector.js"(){Ln(),_l=Or}}),gl,ag=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/ServiceInstanceIdDetector.js"(){Ln(),gl=Or}}),cg=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/index.js"(){ig(),sg(),og(),ag()}}),lg=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/index.js"(){ng(),cg()}}),yl={};It(yl,{defaultResource:()=>Ps,defaultServiceName:()=>ol,detectResources:()=>ul,emptyResource:()=>xs,envDetector:()=>fl,hostDetector:()=>hl,osDetector:()=>ml,processDetector:()=>_l,resourceFromAttributes:()=>ks,serviceInstanceIdDetector:()=>gl});var Os=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/index.js"(){rg(),lg(),ll(),al()}});function bl(e,t){const r={attributes:Nn(e.attributes,t),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function wl(e){return{name:e.name,version:e.version}}function Nn(e,t){return Object.keys(e).map(r=>vl(r,e[r],t))}function vl(e,t,r){return{key:e,value:jn(t,r)}}function jn(e,t){const r=typeof e;if(r==="string")return{stringValue:e};if(r==="number")return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(r==="boolean")return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){const n=new Array(e.length);for(let i=0;i<e.length;i++)n[i]=jn(e[i],t);return{arrayValue:{values:n}}}if(r==="object"&&e!=null){const n=Object.keys(e),i=new Array(n.length);for(let s=0;s<n.length;s++)i[s]={key:n[s],value:jn(e[n[s]],t)};return{kvlistValue:{values:i}}}return{}}var Sl=_({"../../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 ug(e){const t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function dg(e){return ug(e).toString()}function El(e){return e}var Al,$s,Tl=_({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js"(){J(),Al=typeof BigInt<"u"?dg:h_,$s={encodeHrTime:Al,encodeSpanContext:El,encodeOptionalSpanContext:El,encodeUint8Array:e=>{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");const t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=String.fromCharCode(e[r]);return btoa(t.join(""))}}}});function Rl(e,t){let r=e&255|Il;return t&&(r|=kl),r}function fg(e,t){const r=e.spanContext(),n=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(r.traceId),spanId:t.encodeSpanContext(r.spanId),parentSpanId:i,traceState:r.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:Nn(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(s=>hg(s,t)),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(s=>pg(s,t)),droppedLinksCount:e.droppedLinksCount,flags:Rl(r.traceFlags,e.parentSpanContext?.isRemote)}}function pg(e,t){return{attributes:e.attributes?Nn(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:Rl(e.context.traceFlags,e.context.isRemote)}}function hg(e,t){return{attributes:e.attributes?Nn(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function mg(e,t){return{resourceSpans:gg(e,t)}}function _g(e){const t=new Map;for(const r of e){let n=t.get(r.resource);n||(n=new Map,t.set(r.resource,n));const i=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`;let s=n.get(i);s||(s=[],n.set(i,s)),s.push(r)}return t}function gg(e,t){const r=_g(e),n=[],i=r.entries();let s=i.next();for(;!s.done;){const[o,a]=s.value,c=[],l=a.values();let u=l.next();for(;!u.done;){const g=u.value;if(g.length>0){const m=g.map(b=>fg(b,t));c.push({scope:wl(g[0].instrumentationScope),spans:m,schemaUrl:g[0].instrumentationScope.schemaUrl})}u=l.next()}const f=bl(o,t),p={resource:f,scopeSpans:c,schemaUrl:f.schemaUrl};n.push(p),s=i.next()}return n}var Il,kl,yg=_({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js"(){Sl(),Il=256,kl=512}});function bg(e,t){return{resourceLogs:vg(e,t)}}function wg(e){const t=new Map;for(const r of e){const{resource:n,instrumentationScope:{name:i,version:s="",schemaUrl:o=""}}=r;let a=t.get(n);a||(a=new Map,t.set(n,a));const c=`${i}@${s}:${o}`;let l=a.get(c);l||(l=[],a.set(c,l)),l.push(r)}return t}function vg(e,t){const r=wg(e);return Array.from(r,([n,i])=>{const s=bl(n,t);return{resource:s,scopeLogs:Array.from(i,([,o])=>({scope:wl(o[0].instrumentationScope),logRecords:o.map(a=>Sg(a,t)),schemaUrl:o[0].instrumentationScope.schemaUrl})),schemaUrl:s.schemaUrl}})}function Sg(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:jn(e.body,t),eventName:e.eventName,attributes:Eg(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function fT(e){return e}function Eg(e,t){return Object.keys(e).map(r=>vl(r,e[r],t))}var Ag=_({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/internal.js"(){Sl()}}),xl,Tg=_({"../../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"(){Ag(),Tl(),z(),xl={serializeRequest:e=>{const t=bg(e,$s);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};const t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return R.warn(`Failed to parse logs export response: ${r.message}. Returning empty response`),{}}}}}}),Rg=_({"../../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"(){Tg()}}),Pl,Ig=_({"../../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"(){yg(),Tl(),z(),Pl={serializeRequest:e=>{const t=mg(e,$s);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};const t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return R.warn(`Failed to parse trace export response: ${r.message}. Returning empty response`),{}}}}}}),kg=_({"../../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"(){Ig()}}),Cl=_({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/index.js"(){Rg(),kg()}});function xg(){return Math.random()*(2*Ls)-Ls}function Pg(e){return new Nl(e.transport)}var Mn,Ol,$l,Ll,Ls,Nl,Cg=_({"../../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"(){z(),Mn=5,Ol=1e3,$l=5e3,Ll=1.5,Ls=.2,Nl=class{_transport;constructor(e){this._transport=e}retry(e,t,r){return new Promise((n,i)=>{setTimeout(()=>{this._transport.send(e,t).then(n,i)},r)})}async send(e,t){let r=Mn,n=Ol;const i=Date.now()+t;let s=await this._transport.send(e,t);for(;s.status==="retryable"&&r>0;){r--;const o=Math.max(Math.min(n*(1+xg()),$l),0);n=n*Ll;const a=s.retryInMillis??o,c=i-Date.now();if(a>c)return R.info(`Export retry time ${Math.round(a)}ms exceeds remaining timeout ${Math.round(c)}ms, not retrying further.`),s;R.verbose(`Scheduling export retry in ${Math.round(a)}ms`),s=await this.retry(e,c,a)}return s.status==="success"?R.verbose(`Export succeeded after ${Mn-r} retry attempts.`):s.status==="retryable"?R.info(`Export failed after maximum retry attempts (${Mn}).`):R.info(`Export failed with non-retryable error: ${s.error}`),s}shutdown(){return this._transport.shutdown()}}}});function Og(e){return e===429||e===502||e===503||e===504}function $g(e){if(e==null)return;const t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;const r=new Date(e).getTime()-Date.now();return r>=0?r:0}var Lg=_({"../../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 Ng(e){return new Dl(e)}function jg(e){return e instanceof TypeError&&!e.cause}var jl,Ml,Dn,$r,Dl,Mg=_({"../../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"(){z(),Lg(),jl=60*1024,Ml=9,Dn=0,$r=0,Dl=class{_parameters;constructor(e){this._parameters=e}async send(e,t){const r=new AbortController,n=setTimeout(()=>r.abort(),t);let i=globalThis.fetch;typeof i.__original=="function"&&(i=i.__original);const s=e.byteLength,o=Dn+s>jl,a=$r>=Ml,c=!o&&!a;if(c)Dn+=s,$r++;else{const l=o?"size limit":"count limit";R.debug(`keepalive disabled: ${(s/1024).toFixed(1)}KB payload, ${$r} pending (${l})`)}try{const l=new URL(this._parameters.url),u=await i(l.href,{method:"POST",headers:await this._parameters.headers(),body:e,signal:r.signal,keepalive:c,mode:globalThis.location?globalThis.location.origin===l.origin?"same-origin":"cors":"no-cors"});if(u.status>=200&&u.status<=299)return R.debug(`export response success (status: ${u.status})`),{status:"success"};if(Og(u.status)){R.warn(`export response retryable (status: ${u.status})`);const f=u.headers.get("Retry-After");return{status:"retryable",retryInMillis:$g(f)}}return R.error(`export response failure (status: ${u.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${u.status}`)}}catch(l){return jg(l)?(R.warn(`export request retryable (network error: ${l})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:l})}):(R.error(`export request failure (error: ${l})`),{status:"failure",error:new Error("Fetch request errored",{cause:l})})}finally{clearTimeout(n),c&&(Dn-=s,$r--)}}shutdown(){}}}});function Dg(e,t){return j_(e,t,Pg({transport:Ng(e)}))}var Bg=_({"../../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"(){Cg(),M_(),Mg()}});function Fg(e){const t={};return Object.entries(e??{}).forEach(([r,n])=>{typeof n<"u"?t[r]=String(n):R.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),t}var Ug=_({"../../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"(){z()}});function Wg(e,t,r){return async()=>{const n={...await r()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,Fg(await e())),Object.assign(i,n)}}function zg(e){if(e!=null)try{const t=globalThis.location?.href;return new URL(e,t).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function qg(e,t,r){return{...bm(e,t,r),headers:Wg(e.headers,t.headers,r.headers),url:zg(e.url)??t.url??r.url}}function Vg(e,t){return{...wm(),headers:async()=>e,url:"http://localhost:4318/"+t}}var Gg=_({"../../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"(){ja(),Ug()}});function Hg(e){return typeof e.headers=="function"?e.headers:ym(e.headers)}var Jg=_({"../../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"(){ja()}});function Kg(e,t,r){return qg({url:e.url,timeoutMillis:e.timeoutMillis,headers:Hg(e),concurrencyLimit:e.concurrencyLimit},{},Vg(r,t))}var Xg=_({"../../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"(){Gg(),Jg()}});function Bl(e,t,r,n){const i=Kg(e,r,n);return Dg(i,t)}var Qg=_({"../../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"(){Bg(),Xg()}}),Fl=_({"../../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"(){Qg()}}),Ul,Yg=_({"../../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"(){tl(),Cl(),Fl(),Ul=class extends zi{constructor(e={}){super(Bl(e,Pl,"v1/traces",{"Content-Type":"application/json"}))}}}}),Zg=_({"../../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"(){Yg()}}),Wl={};It(Wl,{OTLPTraceExporter:()=>Ul});var ey=_({"../../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"(){Zg()}}),zl,ty=_({"../../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"(){zl="exception"}}),ql,ry=_({"../../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"(){z(),J(),On(),ty(),ql=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Mt.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){const t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Ke.now(),this._performanceOffset=t-(this._performanceStartTime+Ke.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(const r of e.links)this.addLink(r);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 R.warn(`Invalid attribute key: ${e}`),this;if(!Ac(t))return R.warn(`Invalid attribute value set for key: ${e}`),this;const{attributeCountLimit:r}=this._spanLimits,n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return r!==void 0&&this._attributesCount>=r&&n?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,r){if(this._isSpanEnded())return this;const{eventCountLimit:n}=this._spanLimits;if(n===0)return R.warn("No events allowed."),this._droppedEventsCount++,this;n!==void 0&&this.events.length>=n&&(this._droppedEventsCount===0&&R.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),jc(t)&&(jc(r)||(r=t),t=void 0);const i=kr(t),{attributePerEventCountLimit:s}=this._spanLimits,o={};let a=0,c=0;for(const l in i){if(!Object.prototype.hasOwnProperty.call(i,l))continue;const u=i[l];if(s!==void 0&&c>=s){a++;continue}o[l]=this._truncateToSize(u),c++}return this.events.push({name:e,attributes:o,time:this._getTime(r),droppedAttributesCount:a}),this}addLink(e){if(this._isSpanEnded())return this;const{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&R.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);const{attributePerLinkCountLimit:r}=this._spanLimits,n=kr(e.attributes),i={};let s=0,o=0;for(const c in n){if(!Object.prototype.hasOwnProperty.call(n,c))continue;const l=n[c];if(r!==void 0&&o>=r){s++;continue}i[c]=this._truncateToSize(l),o++}const a={context:e.context};return o>0&&(a.attributes=i),s>0&&(a.droppedAttributesCount=s),this.links.push(a),this}addLinks(e){for(const t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded())return this;if(e.code===Mt.UNSET)return this;if(this.status.code===Mt.OK)return this;const t={code:e.code};return e.code===Mt.ERROR&&(typeof e.message=="string"?t.message=e.message:e.message!=null&&R.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){R.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=p_(this.startTime,this.endTime),this._duration[0]<0&&(R.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&&R.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&R.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<=Ke.now())return Lc(e+this._performanceOffset);if(typeof e=="number")return Xe(e);if(e instanceof Date)return Xe(e.getTime());if(ds(e))return e;if(this._startTimeProvided)return Xe(Date.now());const t=Ke.now()-this._performanceStartTime;return Mc(this.startTime,Xe(t))}isRecording(){return this._ended===!1}recordException(e,t){const r={};typeof e=="string"?r[Ye]=e:e&&(e.code?r[Ze]=e.code.toString():e.name&&(r[Ze]=e.name),e.message&&(r[Ye]=e.message),e.stack&&(r[Cn]=e.stack)),r[Ze]||r[Ye]?this.addEvent(zl,r,t):R.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){const e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);R.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){const t=this._attributeValueLengthLimit;return t<=0?(R.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e=="string"?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(r=>typeof r=="string"?this._truncateToLimitUtil(r,t):r):e}}}}),Se,Lr=_({"../../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"})(Se||(Se={}))}}),Ut,Ns=_({"../../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"(){Lr(),Ut=class{shouldSample(){return{decision:Se.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}}}),et,js=_({"../../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"(){Lr(),et=class{shouldSample(){return{decision:Se.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}}}),Wt,Vl=_({"../../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"(){z(),J(),Ns(),js(),Wt=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(pe(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new et),this._remoteParentSampled=e.remoteParentSampled??new et,this._remoteParentNotSampled=e.remoteParentNotSampled??new Ut,this._localParentSampled=e.localParentSampled??new et,this._localParentNotSampled=e.localParentNotSampled??new Ut}shouldSample(e,t,r,n,i,s){const o=ve.getSpanContext(e);return!o||!jt(o)?this._root.shouldSample(e,t,r,n,i,s):o.isRemote?o.traceFlags&fe.SAMPLED?this._remoteParentSampled.shouldSample(e,t,r,n,i,s):this._remoteParentNotSampled.shouldSample(e,t,r,n,i,s):o.traceFlags&fe.SAMPLED?this._localParentSampled.shouldSample(e,t,r,n,i,s):this._localParentNotSampled.shouldSample(e,t,r,n,i,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}}}),Bn,Gl=_({"../../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"(){z(),Lr(),Bn=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:_c(t)&&this._accumulate(t)<this._upperBound?Se.RECORD_AND_SAMPLED:Se.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 r=0;r<32;r+=8){let n=0;for(let i=0;i<8;i++){const s=e.charCodeAt(r+i),o=s<58?s-48:s<71?s-55:s-87;n=n<<4|o}t=(t^n)>>>0}return t}}}});function Hl(){return{sampler:Jl(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128},spanLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128,linkCountLimit:void 0??128,eventCountLimit:void 0??128,attributePerEventCountLimit:void 0??128,attributePerLinkCountLimit:void 0??128}}}function Jl(){const e=void 0??Oe.ParentBasedAlwaysOn;switch(e){case Oe.AlwaysOn:return new et;case Oe.AlwaysOff:return new Ut;case Oe.ParentBasedAlwaysOn:return new Wt({root:new et});case Oe.ParentBasedAlwaysOff:return new Wt({root:new Ut});case Oe.TraceIdRatio:return new Bn(Kl());case Oe.ParentBasedTraceIdRatio:return new Wt({root:new Bn(Kl())});default:return R.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Oe.ParentBasedAlwaysOn}".`),new Wt({root:new et})}}function Kl(){const e=void 0;return e==null?(R.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Nr}.`),Nr):e<0||e>1?(R.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${Nr}.`),Nr):e}var Oe,Nr,Xl=_({"../../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"(){z(),J(),Ns(),js(),Vl(),Gl(),(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"})(Oe||(Oe={})),Nr=1}});function ny(e){const t={sampler:Jl()},r=Hl(),n=Object.assign({},r,t,e);return n.generalLimits=Object.assign({},r.generalLimits,e.generalLimits||{}),n.spanLimits=Object.assign({},r.spanLimits,e.spanLimits||{}),n}function iy(e){const t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??Ql,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??Yl,Object.assign({},e,{spanLimits:t})}var Ql,Yl,Zl=_({"../../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"(){Xl(),J(),Ql=128,Yl=1/0}}),eu,sy=_({"../../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"(){z(),J(),eu=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:void 0??512,this._maxQueueSize=typeof t?.maxQueueSize=="number"?t.maxQueueSize:void 0??2048,this._scheduledDelayMillis=typeof t?.scheduledDelayMillis=="number"?t.scheduledDelayMillis:void 0??5e3,this._exportTimeoutMillis=typeof t?.exportTimeoutMillis=="number"?t.exportTimeoutMillis:void 0??3e4,this._shutdownOnce=new Dt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(R.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&fe.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&&R.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(R.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{const r=[],n=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let i=0,s=n;i<s;i++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{const r=setTimeout(()=>{t(new Error("Timeout"))},this._exportTimeoutMillis);me.with(cs(me.active()),()=>{let n;this._finishedSpans.length<=this._maxExportBatchSize?(n=this._finishedSpans,this._finishedSpans=[]):n=this._finishedSpans.splice(0,this._maxExportBatchSize);const i=()=>this._exporter.export(n,o=>{clearTimeout(r),o.code===ee.SUCCESS?e():t(o.error??new Error("BatchSpanProcessor: span export failed"))});let s=null;for(let o=0,a=n.length;o<a;o++){const c=n[o];c.resource.asyncAttributesPending&&c.resource.waitForAsyncAttributes&&(s??=[],s.push(c.resource.waitForAsyncAttributes()))}s===null?i():Promise.all(s).then(i,o=>{pe(o),t(o)})})})}_maybeStartTimer(){if(this._isExporting)return;const e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(t=>{this._isExporting=!1,pe(t)})};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)}}}}),tu,oy=_({"../../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"(){sy(),J(),tu=class extends eu{_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(t=>{pe(t)})},this._pageHideListener=()=>{this.forceFlush().catch(t=>{pe(t)})},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 ru(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 nu(e){let t="";for(let r=0;r<e.length;r++)t+=ou[e[r]];return t}var iu,su,Ms,Ds,ou,Bs,ay=_({"../../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"(){iu=16,su=8,Ms=new Uint8Array(iu),Ds=new Uint8Array(su),ou=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),Bs=class{generateTraceId(){return ru(Ms),nu(Ms)}generateSpanId(){return ru(Ds),nu(Ds)}}}}),au=_({"../../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"(){oy(),ay()}}),cu,Fs,lu,uu,cy=_({"../../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"(){cu="otel.span.parent.origin",Fs="otel.span.sampling_result",lu="otel.sdk.span.live",uu="otel.sdk.span.started"}});function ly(e){return e?e.isRemote?"remote":"local":"none"}function uy(e){switch(e){case Se.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case Se.RECORD:return"RECORD_ONLY";case Se.NOT_RECORD:return"DROP"}}var du,dy=_({"../../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"(){Lr(),cy(),du=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(uu,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter(lu,{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,t){const r=uy(t);if(this.startedSpans.add(1,{[cu]:ly(e),[Fs]:r}),t===Se.NOT_RECORD)return()=>{};const n={[Fs]:r};return this.liveSpans.add(1,n),()=>{this.liveSpans.add(-1,n)}}}}}),fu,fy=_({"../../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"(){fu="2.7.1"}}),pu,py=_({"../../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"(){z(),J(),ry(),Zl(),au(),dy(),fy(),pu=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,r,n){const i=ny(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new Bs,this._resource=r,this._spanProcessor=n,this.instrumentationScope=e;const s=i.meterProvider?i.meterProvider.getMeter("@opentelemetry/sdk-trace",fu):Ha();this._tracerMetrics=new du(s)}startSpan(e,t={},r=me.active()){t.root&&(r=ve.deleteSpan(r));const n=ve.getSpan(r);if(Gm(r))return R.debug("Instrumentation suppressed, returning Noop Span"),ve.wrapSpanContext(Zi);const i=n?.spanContext(),s=this._idGenerator.generateSpanId();let o,a,c;!i||!ve.isSpanContextValid(i)?a=this._idGenerator.generateTraceId():(a=i.traceId,c=i.traceState,o=i);const l=t.kind??as.INTERNAL,u=(t.links??[]).map(C=>({context:C.context,attributes:kr(C.attributes)})),f=kr(t.attributes),p=this._sampler.shouldSample(r,a,e,l,f,u),g=this._tracerMetrics.startSpan(i,p.decision);c=p.traceState??c;const m=p.decision===Tn.RECORD_AND_SAMPLED?fe.SAMPLED:fe.NONE,b={traceId:a,spanId:s,traceFlags:m,traceState:c};if(p.decision===Tn.NOT_RECORD)return R.debug("Recording is off, propagating context in a non-recording span"),ve.wrapSpanContext(b);const $=kr(Object.assign(f,p.attributes));return new ql({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:b,name:e,kind:l,links:u,parentSpanContext:o,attributes:$,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:g})}startActiveSpan(e,t,r,n){let i,s,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=r):(i=t,s=r,o=n);const a=s??me.active(),c=this.startSpan(e,i,a),l=ve.setSpan(a,c);return me.with(l,o,void 0,c)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}}}),hu,hy=_({"../../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"(){J(),hu=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){const e=[];for(const t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(r=>{pe(r||new Error("MultiSpanProcessor: forceFlush failed")),t()})})}onStart(e,t){for(const r of this._spanProcessors)r.onStart(e,t)}onEnding(e){for(const t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(const t of this._spanProcessors)t.onEnd(e)}shutdown(){const e=[];for(const t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,r)=>{Promise.all(e).then(()=>{t()},r)})}}}}),ht,mu,my=_({"../../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"(){J(),Os(),py(),Xl(),hy(),Zl(),(function(e){e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(ht||(ht={})),mu=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){const t=S_({},Hl(),iy(e));this._resource=t.resource??Ps(),this._config=Object.assign({},t,{resource:this._resource});const r=[];e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new hu(r)}getTracer(e,t,r){const n=`${e}@${t||""}:${r?.schemaUrl||""}`;return this._tracers.has(n)||this._tracers.set(n,new pu({name:e,version:t,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(n)}forceFlush(){const e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(r=>new Promise(n=>{let i;const s=setTimeout(()=>{n(new Error(`Span processor did not completed within timeout period of ${e} ms`)),i=ht.timeout},e);r.forceFlush().then(()=>{clearTimeout(s),i!==ht.timeout&&(i=ht.resolved,n(i))}).catch(o=>{clearTimeout(s),i=ht.error,n(o)})}));return new Promise((r,n)=>{Promise.all(t).then(i=>{const s=i.filter(o=>o!==ht.resolved);s.length>0?n(s):r()}).catch(i=>n([i]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}}}),_u,_y=_({"../../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"(){J(),_u=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:us(e.startTime),duration:us(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,t){for(const r of e)console.dir(this._exportInfo(r),{depth:3});if(t)return t({code:ee.SUCCESS})}}}}),gu,gy=_({"../../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"(){J(),gu=class{_finishedSpans=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:ee.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>t({code:ee.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}}}),yu,yy=_({"../../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"(){z(),J(),yu=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new Dt(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&fe.SAMPLED)===0)return;const t=this._doExport(e).catch(r=>pe(r));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();const t=await gs._export(this._exporter,[e]);if(t.code!==ee.SUCCESS)throw t.error??new Error(`SimpleSpanProcessor: span export failed (status ${t})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}}}),bu,by=_({"../../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"(){bu=class{onStart(e,t){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}}}),wu={};It(wu,{AlwaysOffSampler:()=>Ut,AlwaysOnSampler:()=>et,BasicTracerProvider:()=>mu,BatchSpanProcessor:()=>tu,ConsoleSpanExporter:()=>_u,InMemorySpanExporter:()=>gu,NoopSpanProcessor:()=>bu,ParentBasedSampler:()=>Wt,RandomIdGenerator:()=>Bs,SamplingDecision:()=>Se,SimpleSpanProcessor:()=>yu,TraceIdRatioBasedSampler:()=>Bn});var wy=_({"../../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"(){my(),au(),_y(),gy(),yy(),by(),Ns(),js(),Vl(),Gl(),Lr()}}),vu,vy=_({"../../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"(){tl(),Cl(),Fl(),vu=class extends zi{constructor(e={}){super(Bl(e,xl,"v1/logs",{"Content-Type":"application/json"}))}}}}),Sy=_({"../../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"(){vy()}}),Su={};It(Su,{OTLPLogExporter:()=>vu});var Ey=_({"../../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"(){Sy()}});function Ay(e){return Us(e,new WeakSet)}function Us(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(n=>Us(n,t));const r=e;return r.constructor!==Object&&r.constructor!==void 0?!1:Object.values(r).every(n=>Us(n,t))}return!1}var Ty=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/utils/validation.js"(){}}),Eu,Ry=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LogRecordImpl.js"(){z(),J(),On(),Ty(),Eu=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,r){const{timestamp:n,observedTimestamp:i,eventName:s,severityNumber:o,severityText:a,body:c,attributes:l={},exception:u,context:f}=r,p=Date.now();if(this.hrTime=Nc(n??p),this.hrTimeObserved=Nc(i??p),f){const g=ve.getSpanContext(f);g&&jt(g)&&(this.spanContext=g)}this.severityNumber=o,this.severityText=a,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=s,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return R.warn(`Invalid attribute key: ${e}`),this;if(!Ay(t))return R.warn(`Invalid attribute value set for key: ${e}`),this;const r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return r&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&R.warn("Dropping extra attributes."),this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(const[t,r]of Object.entries(e))this.setAttribute(t,r);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){const t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return R.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(r=>this._truncateToSize(r));if(typeof e=="object"){const r={};for(const[n,i]of Object.entries(e))r[n]=this._truncateToSize(i);return r}return e}_setException(e){let t=!1;if(typeof e=="string"||typeof e=="number")Object.hasOwn(this.attributes,Ye)||this.setAttribute(Ye,String(e)),t=!0;else if(e&&typeof e=="object"){const r=e;r.code?(Object.hasOwn(this.attributes,Ze)||this.setAttribute(Ze,r.code.toString()),t=!0):r.name&&(Object.hasOwn(this.attributes,Ze)||this.setAttribute(Ze,r.name),t=!0),r.message&&(Object.hasOwn(this.attributes,Ye)||this.setAttribute(Ye,r.message),t=!0),r.stack&&(Object.hasOwn(this.attributes,Cn)||this.setAttribute(Cn,r.stack),t=!0)}t||R.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&R.warn("Can not execute the operation on emitted log record"),this._isReadonly}}}}),Au,Iy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/Logger.js"(){Pn(),z(),Ry(),Au=class{instrumentationScope;_sharedState;_loggerConfig;constructor(e,t){this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){const t=this._loggerConfig,r=e.context||me.active(),n=e.severityNumber??pt.UNSPECIFIED;if(n!==pt.UNSPECIFIED&&n<t.minimumSeverity)return;if(t.traceBased){const s=ve.getSpanContext(r);if(s&&jt(s)&&!((s.traceFlags&fe.SAMPLED)===fe.SAMPLED))return}const i=new Eu(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,r),i._makeReadonly()}enabled(e){const t=this._loggerConfig;if(t.disabled)return!1;const r=e?.severityNumber;if(typeof r=="number"&&r!==pt.UNSPECIFIED&&r<t.minimumSeverity)return!1;const n=e?.context||me.active();if(t.traceBased){const s=ve.getSpanContext(n);if(s&&jt(s)&&!((s.traceFlags&fe.SAMPLED)===fe.SAMPLED))return!1}const i={context:n,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(const s of this._sharedState.processors)if(!s.enabled||s.enabled(i))return!0;return!1}}}}),Tu,ky=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/NoopLogRecordProcessor.js"(){Tu=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}}}),Ru,xy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/MultiLogRecordProcessor.js"(){J(),Ru=class{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){const e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>T_(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(r=>r.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(const t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}});function Py(e){return`${e.name}@${e.version||""}:${e.schemaUrl||""}`}var Cy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/utils.js"(){}}),Iu,Oy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/semconv.js"(){Iu="otel.sdk.log.created"}}),ku,$y=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerMetrics.js"(){Oy(),ku=class{createdLogs;constructor(e){this.createdLogs=e.createCounter(Iu,{unit:"{log_record}",description:"The number of logs submitted to enabled SDK Loggers."})}emitLog(){this.createdLogs.add(1)}}}}),xu,Ly=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/version.js"(){xu="0.216.0"}}),Pu,Ws,Cu,Ny=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/LoggerProviderSharedState.js"(){z(),Pn(),ky(),xy(),Cy(),$y(),Ly(),Pu={disabled:!1,minimumSeverity:pt.UNSPECIFIED,traceBased:!1},Ws=()=>({...Pu}),Cu=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=new Map;constructor(e,t,r,n,i,s){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=r,this.processors=n,n.length>0?(this.registeredLogRecordProcessors=n,this.activeProcessor=new Ru(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Tu,this._loggerConfigurator=i??Ws;const o=s?s.getMeter("@opentelemetry/sdk-logs",xu):Ha();this.loggerMetrics=new ku(o)}getLoggerConfig(e){const t=Py(e);let r=this._loggerConfigs.get(t);return r||(r=this._loggerConfigurator(e),this._loggerConfigs.set(t,r),r)}}}}),Ou,$u,jy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerProvider.js"(){z(),Pn(),Os(),J(),Iy(),Ny(),Ou="unknown",$u=class{_shutdownOnce;_sharedState;constructor(e={}){const t={resource:e.resource??Ps(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??Ws,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new Cu(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new Dt(this._shutdown,this)}getLogger(e,t,r){if(this._shutdownOnce.isCalled)return R.warn("A shutdown LoggerProvider cannot provide a Logger"),bs;e||R.warn("Logger requested without instrumentation scope name.");const n=e||Ou,i=`${n}@${t||""}:${r?.schemaUrl||""}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Au({name:n,version:t,schemaUrl:r?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(R.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(R.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}}}),Lu,My=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/ConsoleLogRecordExporter.js"(){J(),Lu=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:us(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(const r of e)console.dir(this._exportInfo(r),{depth:3});t?.({code:ee.SUCCESS})}}}}),Nu,Dy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/SimpleLogRecordProcessor.js"(){J(),Nu=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new Dt(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;const t=()=>gs._export(this._exporter,[e]).then(r=>{r.code!==ee.SUCCESS&&pe(r.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${r})`))}).catch(pe);if(e.resource.asyncAttributesPending){const r=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(r),t()),pe);r!=null&&this._unresolvedExports.add(r)}else t()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}}}),ju,By=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/InMemoryLogRecordExporter.js"(){J(),ju=class{_finishedLogRecords=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:ee.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),t({code:ee.SUCCESS})}async shutdown(){this._stopped=!0,this.reset()}async forceFlush(){}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}}}});async function Fy(e){const t=[];for(let r=0,n=e.length;r<n;r++){const i=e[r];i.resource.asyncAttributesPending&&i.resource.waitForAsyncAttributes&&t.push(i.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var zs,Mu,Uy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/BatchLogRecordProcessorBase.js"(){z(),J(),zs=class{_exportCompleted;_exportScheduledPromise;_exportScheduledResolve;constructor(e,t,r){this._exportScheduledPromise=new Promise(n=>{this._exportScheduledResolve=n}),this._exportCompleted=this._executeExport(e,t,r)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,r){try{await Fy(t),await me.with(cs(me.active()),async()=>this._exportWithTimeout(e,t,r))}catch(n){pe(n),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,r){return new Promise((n,i)=>{const s=setTimeout(()=>{i(new Error("Timeout"))},r);e.export(t,o=>{clearTimeout(s),o.code===ee.SUCCESS?n():i(o.error??new Error("BatchLogRecordProcessor: log record export failed"))}),this._exportScheduledResolve()})}},Mu=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 Dt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(R.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);const r=new zs(this._exporter,t,this._exportTimeoutMillis);this._currentExport=r;try{await r.exportScheduled,await this._exporter.forceFlush(),await r.exportCompleted}catch(n){pe(n)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){const e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();const e=this._extractBatch();if(e===null)return;const t=new zs(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(r=>{this._currentExport=null,pe(r),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)}}}}),Du,Wy=_({"../../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"(){Uy(),Du=class extends Mu{_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))}}}}),zy=_({"../../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"(){Wy()}});function qy(e){return t=>{const r=t.name;for(const{pattern:n,config:i}of e)if(Vy(r,n))return{disabled:i.disabled??jr.disabled,minimumSeverity:i.minimumSeverity??jr.minimumSeverity,traceBased:i.traceBased??jr.traceBased};return{...jr}}}function Vy(e,t){if(t===e)return!0;if(t.includes("*")){const r=t.split("*").map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${r}$`).test(e)}return!1}var jr,Gy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/config/LoggerConfigurators.js"(){Pn(),jr={disabled:!1,minimumSeverity:pt.UNSPECIFIED,traceBased:!1}}}),Bu={};It(Bu,{BatchLogRecordProcessor:()=>Du,ConsoleLogRecordExporter:()=>Lu,InMemoryLogRecordExporter:()=>ju,LoggerProvider:()=>$u,SimpleLogRecordProcessor:()=>Nu,createLoggerConfigurator:()=>qy});var Hy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/index.js"(){jy(),My(),Dy(),By(),zy(),Gy()}}),Fu;function zt(e){if(globalThis.crypto?.getRandomValues)return globalThis.crypto.getRandomValues(new Uint8Array(e));if(Fu){const t=Fu();if(!(t instanceof Uint8Array)||t.byteLength<e)throw new Error(`Native runtime entropy returned fewer than ${e*8} bits`);return t.slice(0,e)}throw new Error("Jazz requires a cryptographically secure runtime entropy source")}function Jy(e=zt(16)){const t=e.slice(0,16);return t[6]=t[6]&15|64,t[8]=t[8]&63|128,t}function Uu(e=()=>zt(16)){for(;;){const t=e(),r=new DataView(t.buffer,t.byteOffset,t.byteLength).getBigUint64(0,!0);if(r!==0n)return r}}var Wu="jazz-snapshot-v1:",zu=72,Ky=48,qs=class extends Error{name="SnapshotRefFormatError";code="invalid_snapshot_ref";constructor(){super("Invalid or unsupported snapshot reference")}};function Xy(e){if(typeof e!="string"||!e.startsWith(Wu))throw new qs;const t=e.slice(Wu.length);if(t.length<zu||!/^[0-9a-f]+$/.test(t))throw new qs;let r=0;for(let n=0;n<4;n++)r+=parseInt(t.slice(64+n*2,66+n*2),16)*2**(n*8);if(t.length!==zu+r*Ky)throw new qs;return e}var Qy=class extends Error{name="UnsupportedSnapshotError";code="unsupported_snapshot";constructor(e="Capturing snapshots is not supported by this runtime yet"){super(e)}},De=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);const t=e instanceof Uint8Array?e:new Uint8Array(e),r=[];let n=[],i=!1;const s=f=>{!i&&(i=!0,f==="\uFEFF")||(n.push(f),n.length===4096&&(r.push(n.join("")),n=[]))},o=()=>{if(this.fatal)throw new TypeError("The encoded data was not valid UTF-8");s("\uFFFD")};let a=0,c=0,l=128,u=191;for(let f=0;f<t.length;f++){const p=t[f];c===0?p<=127?s(String.fromCharCode(p)):p>=194&&p<=223?(c=1,a=p&31):p>=224&&p<=239?(c=2,a=p&15,p===224&&(l=160),p===237&&(u=159)):p>=240&&p<=244?(c=3,a=p&7,p===240&&(l=144),p===244&&(u=143)):o():p<l||p>u?(c=0,l=128,u=191,o(),f--):(l=128,u=191,a=a<<6|p&63,--c===0&&s(String.fromCodePoint(a)))}return c!==0&&o(),n.length&&r.push(n.join("")),r.join("")}};function tt(e){return e instanceof Error?e:new Error(String(e))}function mt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rt(e){const t=new Uint8Array(e.reduce((n,i)=>n+i.length,0));let r=0;for(const n of e)t.set(n,r),r+=n.length;return t}var Yy=new De({fatal:!0});function Zy(e){try{return Yy.decode(e),!0}catch{return!1}}function Vs(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 new Error(`Cannot serialize non-finite number in schema JSON (key "${e}"): ${t}.`);return t}function qu(e){return Object.fromEntries(Object.keys(e).sort().map(t=>[t,e[t]]))}function eb(e,t){return JSON.stringify({tables:qu(e),...t?{migrations:t}:{}},Vs)}function tb(e,t){const r={__jazzRuntimeSchema:1,schema:qu(e),loadedPolicyBundle:t?.loadedPolicyBundle??!1};return JSON.stringify(r,Vs)}var pT=new De({fatal:!0});function Gs(e){let t=!1;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(n>=55296&&n<=56319){const i=e.charCodeAt(r+1);if(Number.isNaN(i)||i<56320||i>57343)return!1;t=!0,r+=1;continue}if(n>=56320&&n<=57343)return!1;n!==32&&(n<9||n>13)&&(t=!0)}return t}function Ee(e){return Gs(e)}function qt(e,t,r){if(typeof e!="string")throw new Error("Author identity is missing an issuer");if(typeof t!="string")throw new Error("Author identity is missing a subject");if(!Gs(e)||!Gs(t))throw new Error("Author issuer and subject must be portable and nonempty");if(r!==void 0&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(r))throw new Error("Author account must be a canonical UUID");return JSON.stringify(r===void 0?[e,t]:[r,e,t])}function Vt(e){try{const t=JSON.parse(e);if(!Array.isArray(t)||t.length!==2&&t.length!==3)return null;const r=t.length===3?t[0]:void 0;if(r!==void 0&&typeof r!="string")return null;const[n,i]=t.slice(t.length===3?1:0);if(typeof n!="string"||typeof i!="string")return null;const s=qt(n,i,r);return e!==s?null:{...r===void 0?{}:{account_id:r},issuer:n,user_id:i,canonical:s}}catch{return null}}function Hs(e){return new TextEncoder().encode(qt(e.issuer,e.user_id,e.account_id))}function rb(e){if(e.type!=="Row"||e.value.values.length!==2)throw new Error("invalid structured author record");const[t,r]=e.value.values;if(t?.type!=="Uuid"||r?.type!=="Row"||r.value.values.length!==2)throw new Error("invalid structured author record");const[n,i]=r.value.values;if(n?.type!=="Text"||i?.type!=="Text")throw new Error("invalid structured author identity");qt(n.value,i.value,t.value)}var Vu="urn:jazz:local-first",nb="urn:jazz:anonymous",Gt="urn:jazz:system",ib="urn:jazz:static-bearer",sb=[Gt,Vu,ib,nb];function Fn(e){return sb.includes(e)}var Ht="__jazz_trusted_reserved_session",Gu=new WeakSet,Hu=new WeakMap,Ju=new Map;function ob(){const e=zt(16);return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function ab(e){return Fn(e.issuer)&&Gu.add(e),e}function Ku(e){if(!Gu.has(e)||!Fn(e.issuer))return;let t=Hu.get(e);return t||(t=ob(),Hu.set(e,t)),Ju.set(t,{account_id:e.account_id,issuer:e.issuer,user_id:e.user_id,authMode:e.authMode}),t}function Mr(e,t){if(!Fn(e.issuer)||typeof t!="string")return!1;const r=Ju.get(t);return r?.issuer===e.issuer&&r.account_id===e.account_id&&r.user_id===e.user_id&&r.authMode===e.authMode}var cb=new Set(["sub","exp","nbf","iat","iss","aud","jti"]);function Js(e){return e===null||typeof e=="string"||typeof e=="boolean"?!0:typeof e=="number"?Number.isFinite(e):Array.isArray(e)?e.every(Js):mt(e)&&Object.values(e).every(Js)}function Xu(e){const t=Object.create(null);for(const[r,n]of Object.entries(e).sort(lb))!cb.has(r)&&Js(n)&&(t[r]=n);return t}function lb([e],[t]){const r=new TextEncoder().encode(e),n=new TextEncoder().encode(t);for(let i=0;i<Math.min(r.length,n.length);i+=1){const s=r[i]-n[i];if(s!==0)return s}return r.length-n.length}function ub(e){if(typeof e!="string")return;const t=e.trim();return t.length>0?t:void 0}function db(){return globalThis.Buffer}function fb(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4;return r===0?t:t+"=".repeat(4-r)}function pb(e){const t=db();if(t)try{return t.from(e,"base64").toString("utf8")}catch{return null}if(typeof atob=="function")try{const r=atob(e),n=new Uint8Array(r.length);for(let i=0;i<r.length;i+=1)n[i]=r.charCodeAt(i);return new De().decode(n)}catch{return null}return null}function Qu(e){const t=ub(e);if(!t)return null;const r=t.split(".");if(r.length<2)return null;const n=r[1];if(n===void 0)return null;const i=pb(fb(n));if(!i)return null;try{const s=JSON.parse(i);return mt(s)?s:null}catch{return null}}function hb(e){return e!=="disabled"&&e!=="revoked"}var mb=new Set(["expired","missing","invalid","disabled","revoked"]);function Yu(e){if(mb.has(e))return e;const t=e.toLowerCase();return t.includes("expired")?"expired":t.includes("missing")?"missing":t.includes("disabled")?"disabled":t.includes("revoked")?"revoked":"invalid"}var ne=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Zu(e){let t="";for(let r=0;r<e.length;r++)t+=ne[e[r]&255];return t}function ed(e,t){return ne[e[t]&255]+ne[e[t+1]&255]+ne[e[t+2]&255]+ne[e[t+3]&255]+"-"+ne[e[t+4]&255]+ne[e[t+5]&255]+"-"+ne[e[t+6]&255]+ne[e[t+7]&255]+"-"+ne[e[t+8]&255]+ne[e[t+9]&255]+"-"+ne[e[t+10]&255]+ne[e[t+11]&255]+ne[e[t+12]&255]+ne[e[t+13]&255]+ne[e[t+14]&255]+ne[e[t+15]&255]}var _b=/^[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}$/,gb=/^[0-9a-fA-F]{32}$/;function Ks(e){if(!_b.test(e)&&!gb.test(e))return;const t=e.replaceAll("-",""),r=new Uint8Array(16);for(let n=0;n<16;n+=1)r[n]=Number.parseInt(t.slice(n*2,n*2+2),16);return r}function Be(e){return ed(e,0)}var td=new Map;function rd(e){if(td.size!==0)try{return td.get(new URL(e).host)}catch{return}}function yb(e){return rd(e)?.fetch??globalThis.fetch}function bb(e){return rd(e)?.WebSocket}function wb(){const e=zt(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(n=>n.toString(16).padStart(2,"0")).join("")}function vb(e){const t=new URL(e).protocol;return t==="http:"||t==="https:"}function Sb(e){const t=new URL(e).protocol;return t==="http:"||t==="https:"||t==="blob:"}function Eb(e){return new URL("/",e).href}function Ab(e,t){try{return new URL(e).href}catch{}if(t)try{return new URL(e,t).href}catch{}return e}function nd(e,t){if(!t?.wasmVersion)return e;try{const r=new URL(e);return r.searchParams.set("jazz-runtime-version",t.wasmVersion),r.href}catch{return e}}function Tb(e,t){try{return new URL(e).href}catch{}return t?new URL(e,t).href:null}function Rb(e,t,r){return!t||vb(e)||!r&&Sb(t)?null:new URL("jazz_wasm_bg.wasm",Eb(t)).href}function Ib(e){return e?.wasmModule?{module:e.wasmModule}:e?.wasmSource?{module:e.wasmSource}:null}function kb(e,t,r){if(r?.wasmUrl)return nd(Ab(r.wasmUrl,t),r);if(r?.baseUrl){const n=Tb(r.baseUrl,t);if(n)return nd(new URL("jazz_wasm_bg.wasm",n).href,r)}return Rb(typeof e=="function"?e():e,t,!1)}var xb="293b3c4ee11055c99bd31d3b6f532991c45407a3509436dec7ff3f45505d5e45",Pb="ea0408b6249e4383ff90c9554149de9dc9ddee467b464fb33b913b7e4214c5d0",Cb={napi:xb,wasm:Pb};function Ob(e,t,r=[]){const n=Cb[t.toLowerCase()];if(typeof e.nativeArtifactFingerprint!="function")throw new Error(`Jazz ${t} artifact is stale or incompatible: missing nativeArtifactFingerprint (expected ${n}). In this monorepo rebuild generated bindings; for installed packages reinstall matching Jazz package versions.`);const i=e.nativeArtifactFingerprint();if(i!==n)throw new Error(`Jazz ${t} artifact ABI mismatch: expected ${n}, got ${String(i)}. In this monorepo rebuild generated bindings; for installed packages reinstall matching Jazz package versions.`);for(const s of r)if(typeof e[s]!="function")throw new Error(`Jazz ${t} artifact is incomplete despite matching fingerprint: missing ${s}.`)}var Un=class extends Error{},Jt=class extends Error{},$b=new Set("\\.+*?()|[]{}^$#&-~"),Lb=new Set("imsUuRx"),Nb=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]);function jb(e){return $b.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(t){throw t instanceof Un&&this.fancy?new Jt(t.message):t}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 Un(e)}parseAlternation(e){const 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){const t=[];let r=0;for(;!this.eof();){const n=this.char();if(n==="|"||n===")")break;if(n==="?"||n==="*"||n==="+"||n==="{"?(r++,r===2&&n==="+"?this.unsupported.push("possessive quantifiers"):r===2&&n==="{"?this.unsupported.push("a counted repetition right after another quantifier"):r>=2&&this.fancyInvalid.push("a quantifier right after another quantifier")):r=0,n==="(")t.push(this.parseGroup(e));else if(n==="[")t.push({kind:"class",item:this.parseBracketed()});else if(n==="?"||n==="*"||n==="+"){this.index++;const[i,s]=n==="?"?[0,1]:n==="*"?[0,1/0]:[1,1/0];let o=!0;!this.eof()&&this.char()==="?"&&(o=!1,this.index++),this.repeatLast(t,i,s,o)}else n==="{"?this.parseCountedRepetition(t):t.push(this.parsePrimitive())}return t.length===1?t[0]:{kind:"concat",items:t}}repeatLast(e,t,r,n){const 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:r,greedy:n!==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;const t=Number(e);return t>4294967295&&this.fail("repetition count is too large"),t}parseCountedRepetition(e){const 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");const r=this.parseDecimal();this.eof()&&this.fail("unclosed counted repetition");let n;if(this.char()===",")if(this.index++,this.eof()&&this.fail("unclosed counted repetition"),this.char()!=="}"){const s=this.parseDecimal();(r===void 0||s===void 0)&&this.fail("repetition count is empty"),n=s}else r===void 0&&this.fail("repetition count is empty"),n=1/0;else r===void 0&&this.fail("repetition count is empty"),n=r;(this.eof()||this.char()!=="}")&&this.fail("unclosed counted repetition"),this.index++;let i=!0;!this.eof()&&this.char()==="?"&&(i=!1,this.index++),r>n&&this.fail("invalid repetition range"),this.repeatLast(e,r,n,i)}parseGroup(e){const t=this.index===0;this.index++;for(const r of["=","!","<=","<!"])if(this.startsWith(`?${r}`)){this.fancy=!0,this.index+=r.length+1;const n=this.parseGroupBody(e);return{kind:"look",op:r,body:n}}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");const r=this.flags,n=this.parseFlags(),i=this.char();if(this.index++,i===")")return n!==void 0&&(n&&t?this.caseInsensitive=!0:this.unsupported.push("`(?i)` anywhere but at the start of the pattern")),{kind:"flags"};n!==void 0&&this.unsupported.push("`(?i)` anywhere but at the start of the pattern");const s=this.parseGroupBody(e);return this.flags=r,{kind:"group",capture:!1,body:s}}return this.captures++,{kind:"group",capture:!0,body:this.parseGroupBody(e)}}parseGroupBody(e){const t=this.flags,r=this.parseAlternation(e+1);return this.eof()&&this.fail("unclosed group"),this.index++,this.flags=t,r}parseCaptureName(){this.eof()&&this.fail("unexpected end of group name");let e="";for(;!this.eof()&&this.char()!==">";){const 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(){const e=new Set;let t=!1,r=!1,n;const i={...this.flags};for(;this.char()!==":"&&this.char()!==")";){const s=this.char();if(s==="-")t&&this.fail("repeated negation in flags"),t=!0,r=!0;else{r=!1,Lb.has(s)||this.fail(`unrecognized flag "${s}"`),e.has(s)&&this.fail(`duplicate flag "${s}"`),e.add(s);const o=!t;s==="i"?n=o:s==="m"?i.multiLine=o:s==="s"?i.dotAll=o:s==="U"?i.swapGreed=o:s==="x"?this.unsupported.push("the `x` flag"):s==="R"?this.unsupported.push("the `R` flag"):s==="u"&&!o&&this.unsupported.push("turning off the `u` flag")}this.index++,this.eof()&&this.fail("unexpected end of flags")}return r&&this.fail("dangling flag negation"),e.size===0&&this.char()===")"&&this.fail("repetition operator missing expression"),this.flags=i,n}parsePrimitive(){const 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");const t=this.char();if(/[0-9]/.test(t)){this.fancy=!0;let n="";for(;!this.eof()&&/[0-9]/.test(this.char());)n+=this.chars[this.index++];return(e||n.startsWith("0"))&&this.unsupported.push(`\`\\${n}\``),{kind:"backref",index:Number(n)}}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++;const n=t.toLowerCase();return{kind:"class",item:{kind:"perl",perl:n,negated:t!==n}}}if(this.index++,jb(t))return{kind:"literal",char:t};const r={f:"\f",t:" ",n:`
|
|
1
|
+
var Nh=Object.defineProperty,jh=Object.getOwnPropertyNames,_=(e,t)=>function(){return e&&(t=(0,e[jh(e)[0]])(e=0)),t},It=(e,t)=>{for(var r in t)Nh(e,r,{get:t[r],enumerable:!0})},ka={};It(ka,{PendingNativeRead:()=>yr,StreamingMutation:()=>br,UpstreamLink:()=>wr,WasmDb:()=>vr,WasmPendingSubscription:()=>_n,WasmPermissionAdviceRequest:()=>Ge,WasmTransport:()=>Sr,WasmWrite:()=>he,__testBindingCodecGoldenFixture:()=>Mh,__testValidateWireFrameBatchCorpus:()=>Dh,__testWireFrameCorpusFeatures:()=>Bh,captureTextAnchor:()=>Fh,captureTextRange:()=>Uh,currentTimestamp:()=>Wh,default:()=>fm,deriveUserId:()=>zh,drainTraceEntries:()=>qh,generateId:()=>Vh,init:()=>Gh,initSync:()=>dm,mintAnonymousToken:()=>Hh,mintLocalFirstToken:()=>Jh,nativeArtifactFingerprint:()=>Kh,resolveTextAnchor:()=>Xh,resolveTextRange:()=>Qh,setJsonSchemaValidator:()=>Yh,setTraceEntryCollectionEnabled:()=>Zh,subscribeTraceEntries:()=>em,validateSchema:()=>tm});function Mh(){let e,t;try{const r=d.__testBindingCodecGoldenFixture();return e=r[0],t=r[1],H(r[0],r[1])}finally{d.__wbindgen_free(e,t,1)}}function Dh(e,t,r){const n=I(e,d.__wbindgen_malloc),i=y,s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y,l=d.__testValidateWireFrameBatchCorpus(n,i,s,o,a,c);if(l[1])throw w(l[0])}function Bh(){let e,t;try{const r=d.__testWireFrameCorpusFeatures();return e=r[0],t=r[1],H(r[0],r[1])}finally{d.__wbindgen_free(e,t,1)}}function Fh(e,t,r,n){const i=E(e,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y,o=d.captureTextAnchor(i,s,!x(t),x(t)?0:t,r,n);if(o[2])throw w(o[1]);return w(o[0])}function Uh(e,t,r,n){const i=E(e,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y,o=d.captureTextRange(i,s,!x(t),x(t)?0:t,r,n);if(o[2])throw w(o[1]);return w(o[0])}function Wh(){const e=d.currentTimestamp();return BigInt.asUintN(64,e)}function zh(e){let t,r;try{const s=E(e,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=d.deriveUserId(s,o);var n=a[0],i=a[1];if(a[3])throw n=0,i=0,w(a[2]);return t=n,r=i,H(n,i)}finally{d.__wbindgen_free(t,r,1)}}function qh(){return d.drainTraceEntries()}function Vh(){let e,t;try{const r=d.generateId();return e=r[0],t=r[1],H(r[0],r[1])}finally{d.__wbindgen_free(e,t,1)}}function Gh(){d.init()}function Hh(e,t,r,n){let i,s;try{const c=E(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),f=y,p=d.mintAnonymousToken(c,l,u,f,r,n);var o=p[0],a=p[1];if(p[3])throw o=0,a=0,w(p[2]);return i=o,s=a,H(o,a)}finally{d.__wbindgen_free(i,s,1)}}function Jh(e,t,r,n){let i,s;try{const c=E(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),f=y,p=d.mintLocalFirstToken(c,l,u,f,r,n);var o=p[0],a=p[1];if(p[3])throw o=0,a=0,w(p[2]);return i=o,s=a,H(o,a)}finally{d.__wbindgen_free(i,s,1)}}function Kh(){let e,t;try{const r=d.nativeArtifactFingerprint();return e=r[0],t=r[1],H(r[0],r[1])}finally{d.__wbindgen_free(e,t,1)}}function Xh(e,t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=d.resolveTextAnchor(e,n,i,!x(r),x(r)?0:r);if(s[2])throw w(s[1]);return w(s[0])}function Qh(e,t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=d.resolveTextRange(e,n,i,!x(r),x(r)?0:r);if(s[2])throw w(s[1]);return w(s[0])}function Yh(e){d.setJsonSchemaValidator(e)}function Zh(e){d.setTraceEntryCollectionEnabled(e)}function em(e){return d.subscribeTraceEntries(e)}function tm(e){const t=I(e,d.__wbindgen_malloc),r=y,n=d.validateSchema(t,r);if(n[1])throw w(n[0])}function xa(){return{__proto__:null,"./jazz_wasm_bg.js":{__proto__:null,__wbg_Error_2e59b1b37a9a34c3:function(t,r){return Error(H(t,r))},__wbg_Number_e6ffdb596c888833:function(t){return Number(t)},__wbg_String_8564e559799eccda:function(t,r){const n=String(r),i=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y;re().setInt32(t+4,s,!0),re().setInt32(t+0,i,!0)},__wbg_Window_70131fc0c91e4b3c:function(t){return t.Window},__wbg_WorkerGlobalScope_601c48015b8cc78e:function(t){return t.WorkerGlobalScope},__wbg___wbindgen_bigint_get_as_i64_2c5082002e4826e2:function(t,r){const n=r,i=typeof n=="bigint"?n:void 0;re().setBigInt64(t+8,x(i)?BigInt(0):i,!0),re().setInt32(t+0,!x(i),!0)},__wbg___wbindgen_boolean_get_a86c216575a75c30:function(t){const r=t,n=typeof r=="boolean"?r:void 0;return x(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_dd5d2d07ce9e6c57:function(t,r){const n=Ni(r),i=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y;re().setInt32(t+4,s,!0),re().setInt32(t+0,i,!0)},__wbg___wbindgen_in_4bd7a57e54337366:function(t,r){return t in r},__wbg___wbindgen_is_bigint_6c98f7e945dacdde:function(t){return typeof t=="bigint"},__wbg___wbindgen_is_function_49868bde5eb1e745:function(t){return typeof t=="function"},__wbg___wbindgen_is_null_344c8750a8525473:function(t){return t===null},__wbg___wbindgen_is_object_40c5a80572e8f9d3:function(t){const r=t;return typeof r=="object"&&r!==null},__wbg___wbindgen_is_string_b29b5c5a8065ba1a:function(t){return typeof t=="string"},__wbg___wbindgen_is_undefined_c0cca72b82b86f4d:function(t){return t===void 0},__wbg___wbindgen_jsval_eq_7d430e744a913d26:function(t,r){return t===r},__wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944:function(t,r){return t==r},__wbg___wbindgen_number_get_7579aab02a8a620c:function(t,r){const n=r,i=typeof n=="number"?n:void 0;re().setFloat64(t+8,x(i)?0:i,!0),re().setInt32(t+0,!x(i),!0)},__wbg___wbindgen_string_get_914df97fcfa788f2:function(t,r){const n=r,i=typeof n=="string"?n:void 0;var s=x(i)?0:E(i,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y;re().setInt32(t+4,o,!0),re().setInt32(t+0,s,!0)},__wbg___wbindgen_throw_81fc77679af83bc6:function(t,r){throw new Error(H(t,r))},__wbg__wbg_cb_unref_3c3b4f651835fbcb:function(t){t._wbg_cb_unref()},__wbg_abort_cfab06d16d2d33a6:function(){return U(function(t){t.abort()},arguments)},__wbg_bound_88db1072ea68e901:function(){return U(function(t,r,n,i){return IDBKeyRange.bound(t,r,n!==0,i!==0)},arguments)},__wbg_call_368fa9c372d473ba:function(){return U(function(t,r,n,i){return t.call(r,n,i)},arguments)},__wbg_call_7f2987183bb62793:function(){return U(function(t,r){return t.call(r)},arguments)},__wbg_call_d578befcc3145dee:function(){return U(function(t,r,n){return t.call(r,n)},arguments)},__wbg_commit_e9c1332714c53826:function(){return U(function(t){t.commit()},arguments)},__wbg_construct_adeb3d5948c3d19a:function(){return U(function(t,r){return Reflect.construct(t,r)},arguments)},__wbg_createObjectStore_6e567b25160be2fa:function(){return U(function(t,r,n,i){return t.createObjectStore(H(r,n),i)},arguments)},__wbg_delete_fc24bd7dfa57938e:function(){return U(function(t,r){return t.delete(r)},arguments)},__wbg_done_547d467e97529006:function(t){return t.done},__wbg_entries_616b1a459b85be0b:function(t){return Object.entries(t)},__wbg_error_58469b8474e13592:function(){return U(function(t){const r=t.error;return x(r)?0:ue(r)},arguments)},__wbg_error_a6fa202b58aa1cd3:function(t,r){let n,i;try{n=t,i=r,console.error(H(t,r))}finally{d.__wbindgen_free(n,i,1)}},__wbg_getAll_93336699ea033b51:function(){return U(function(t,r){return t.getAll(r)},arguments)},__wbg_getDate_bafac038eaae076e:function(t){return t.getDate()},__wbg_getDay_6eebc8fe9cb183f5:function(t){return t.getDay()},__wbg_getFullYear_8f83597f7403c865:function(t){return t.getFullYear()},__wbg_getHours_81348c8e800060e7:function(t){return t.getHours()},__wbg_getMinutes_bd1ccf17dab913bf:function(t){return t.getMinutes()},__wbg_getMonth_288607689622719c:function(t){return t.getMonth()},__wbg_getRandomValues_15134f5c0ae6b0d0:function(){return U(function(t,r){globalThis.crypto.getRandomValues(Me(t,r))},arguments)},__wbg_getRandomValues_d49329ff89a07af1:function(){return U(function(t,r){globalThis.crypto.getRandomValues(Me(t,r))},arguments)},__wbg_getSeconds_edef7266627a185f:function(t){return t.getSeconds()},__wbg_getTime_f6ac312467f7cf09:function(t){return t.getTime()},__wbg_getTimezoneOffset_ac5be603b21a5797:function(t){return t.getTimezoneOffset()},__wbg_get_4848e350b40afc16:function(t,r){return t[r>>>0]},__wbg_get_ed0642c4b9d31ddf:function(){return U(function(t,r){return Reflect.get(t,r)},arguments)},__wbg_get_f96702c6245e4ef9:function(){return U(function(t,r){return Reflect.get(t,r)},arguments)},__wbg_get_unchecked_7d7babe32e9e6a54:function(t,r){return t[r>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(t,r){return t[r]},__wbg_global_e30ac0b7684506d0:function(t){return t.global},__wbg_has_3ec5c22db2e5237a:function(){return U(function(t,r){return Reflect.has(t,r)},arguments)},__wbg_indexedDB_065ce3ad400579e3:function(){return U(function(t){const r=t.indexedDB;return x(r)?0:ue(r)},arguments)},__wbg_indexedDB_a2139150e2ea2a08:function(){return U(function(t){const r=t.indexedDB;return x(r)?0:ue(r)},arguments)},__wbg_indexedDB_af74cb6df65fa636:function(){return U(function(t){const r=t.indexedDB;return x(r)?0:ue(r)},arguments)},__wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a:function(t){let r;try{r=t instanceof ArrayBuffer}catch{r=!1}return r},__wbg_instanceof_DomException_37f96d3fb69189bd:function(t){let r;try{r=t instanceof DOMException}catch{r=!1}return r},__wbg_instanceof_Error_e3390d6805733dad:function(t){let r;try{r=t instanceof Error}catch{r=!1}return r},__wbg_instanceof_IdbDatabase_0af111edb4be95f4:function(t){let r;try{r=t instanceof IDBDatabase}catch{r=!1}return r},__wbg_instanceof_IdbRequest_fc5918c726448f04:function(t){let r;try{r=t instanceof IDBRequest}catch{r=!1}return r},__wbg_instanceof_Map_a10a2795ef4bfe97:function(t){let r;try{r=t instanceof Map}catch{r=!1}return r},__wbg_instanceof_Uint8Array_4b8da683deb25d72:function(t){let r;try{r=t instanceof Uint8Array}catch{r=!1}return r},__wbg_isArray_db61795ad004c139:function(t){return Array.isArray(t)},__wbg_isSafeInteger_ea83862ba994770c:function(t){return Number.isSafeInteger(t)},__wbg_iterator_de403ef31815a3e6:function(){return Symbol.iterator},__wbg_length_0c32cb8543c8e4c8:function(t){return t.length},__wbg_length_6e821edde497a532:function(t){return t.length},__wbg_log_6a8b55ee2e172f54:function(t,r,n,i,s,o,a,c){let l,u;try{l=t,u=r,console.log(H(t,r),H(n,i),H(s,o),H(a,c))}finally{d.__wbindgen_free(l,u,1)}},__wbg_lowerBound_279c232a69ac0f79:function(){return U(function(t,r){return IDBKeyRange.lowerBound(t,r!==0)},arguments)},__wbg_message_52a9425f28c45ebc:function(t,r){const n=r.message,i=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y;re().setInt32(t+4,s,!0),re().setInt32(t+0,i,!0)},__wbg_message_7367f8c7d0fa1589:function(t){return t.message},__wbg_name_d7bb38b41d6d953e:function(t,r){const n=r.name,i=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y;re().setInt32(t+4,s,!0),re().setInt32(t+0,i,!0)},__wbg_new_0_bfa2ef4bc447daa2:function(){return new Date},__wbg_new_0f6d2ddfe083319b:function(t){return new Date(t)},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_new_40792555590ec35c:function(t,r){try{var n={a:t,b:r},i=(o,a)=>{const c=n.a;n.a=0;try{return Pa(c,n.b,o,a)}finally{n.a=c}};return new Promise(i)}finally{n.a=0}},__wbg_new_4f9fafbb3909af72:function(){return new Object},__wbg_new_99cabae501c0a8a0:function(){return new Map},__wbg_new_a560378ea1240b14:function(t){return new Uint8Array(t)},__wbg_new_e3b04b4d53d1b593:function(t,r){return new Error(H(t,r))},__wbg_new_f3c9df4f38f3f798:function(){return new Array},__wbg_new_from_slice_2580ff33d0d10520:function(t,r){return new Uint8Array(Me(t,r))},__wbg_new_typed_14d7cc391ce53d2c:function(t,r){try{var n={a:t,b:r},i=(o,a)=>{const c=n.a;n.a=0;try{return Pa(c,n.b,o,a)}finally{n.a=c}};return new Promise(i)}finally{n.a=0}},__wbg_new_with_length_9cedd08484b73942:function(t){return new Uint8Array(t>>>0)},__wbg_new_with_year_month_day_d7dc1e63a7b42902:function(t,r,n){return new Date(t>>>0,r,n)},__wbg_next_01132ed6134b8ef5:function(t){return t.next},__wbg_next_b3713ec761a9dbfd:function(){return U(function(t){return t.next()},arguments)},__wbg_now_6798946be0e6fe2b:function(){return U(function(){return Date.now()},arguments)},__wbg_now_88621c9c9a4f3ffc:function(){return Date.now()},__wbg_now_e7c6795a7f81e10f:function(t){return t.now()},__wbg_objectStore_3d4cade4416cd432:function(){return U(function(t,r,n){return t.objectStore(H(r,n))},arguments)},__wbg_open_ac04ec9d75d0eeaf:function(){return U(function(t,r,n,i){return t.open(H(r,n),i>>>0)},arguments)},__wbg_pendingnativeread_new:function(t){return yr.__wrap(t)},__wbg_performance_3fcf6e32a7e1ed0a:function(t){return t.performance},__wbg_prototypesetcall_3e05eb9545565046:function(t,r,n){Uint8Array.prototype.set.call(Me(t,r),n)},__wbg_push_6bdbc990be5ac37b:function(t,r){return t.push(r)},__wbg_put_015a7e88e46a2502:function(){return U(function(t,r){return t.put(r)},arguments)},__wbg_queueMicrotask_abaf92f0bd4e80a4:function(t){return t.queueMicrotask},__wbg_queueMicrotask_df5a6dac26d818f3:function(t){queueMicrotask(t)},__wbg_random_a72d453e63c9558c:function(){return Math.random()},__wbg_readyState_accbdf425c074d9c:function(t){const r=t.readyState;return(Oa.indexOf(r)+1||3)-1},__wbg_reject_1340e1211c01825b:function(t){return Promise.reject(t)},__wbg_resolve_0a79de24e9d2267b:function(t){return Promise.resolve(t)},__wbg_result_452c1006fc727317:function(){return U(function(t){return t.result},arguments)},__wbg_set_08463b1df38a7e29:function(t,r,n){return t.set(r,n)},__wbg_set_16a9c1a07b3d38ec:function(t,r,n){t.set(Me(r,n))},__wbg_set_6be42768c690e380:function(t,r,n){t[r]=n},__wbg_set_6c60b2e8ad0e9383:function(t,r,n){t[r>>>0]=n},__wbg_set_8ee2d34facb8466e:function(){return U(function(t,r,n){return Reflect.set(t,r,n)},arguments)},__wbg_set_key_path_6edd6ee0e8d75af3:function(t,r){t.keyPath=r},__wbg_set_onabort_6b6df7a41aa97c23:function(t,r){t.onabort=r},__wbg_set_oncomplete_20fb27150b4ee0d4:function(t,r){t.oncomplete=r},__wbg_set_onerror_2b7dfa4e6dea4159:function(t,r){t.onerror=r},__wbg_set_onerror_3c4b5087146b11b6:function(t,r){t.onerror=r},__wbg_set_onsuccess_f7e5b5cbed5008b1:function(t,r){t.onsuccess=r},__wbg_set_onupgradeneeded_d7e8e03a1999bf5d:function(t,r){t.onupgradeneeded=r},__wbg_stack_3b0d974bbf31e44f:function(t,r){const n=r.stack,i=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y;re().setInt32(t+4,s,!0),re().setInt32(t+0,i,!0)},__wbg_static_accessor_GLOBAL_THIS_a1248013d790bf5f:function(){const t=typeof globalThis>"u"?null:globalThis;return x(t)?0:ue(t)},__wbg_static_accessor_GLOBAL_f2e0f995a21329ff:function(){const t=typeof global>"u"?null:global;return x(t)?0:ue(t)},__wbg_static_accessor_SELF_24f78b6d23f286ea:function(){const t=typeof self>"u"?null:self;return x(t)?0:ue(t)},__wbg_static_accessor_WINDOW_59fd959c540fe405:function(){const t=typeof window>"u"?null:window;return x(t)?0:ue(t)},__wbg_subarray_0f98d3fb634508ad:function(t,r,n){return t.subarray(r>>>0,n>>>0)},__wbg_target_732d56b173b7e87c:function(t){const r=t.target;return x(r)?0:ue(r)},__wbg_then_00eed3ac0b8e82cb:function(t,r,n){return t.then(r,n)},__wbg_then_a0c8db0381c8994c:function(t,r){return t.then(r)},__wbg_toString_891d991e862e1d44:function(t){return t.toString()},__wbg_transaction_cc65dcef07fabb06:function(t){return t.transaction},__wbg_transaction_f909284bfed41115:function(){return U(function(t,r,n,i){return t.transaction(H(r,n),$a[i])},arguments)},__wbg_upperBound_2f3c07fb628c7a3c:function(){return U(function(t,r){return IDBKeyRange.upperBound(t,r!==0)},arguments)},__wbg_value_7f6052747ccf940f:function(t){return t.value},__wbg_wasmdb_new:function(t){return vr.__wrap(t)},__wbg_wasmtransport_new:function(t){return Sr.__wrap(t)},__wbg_wasmwrite_new:function(t){return he.__wrap(t)},__wbindgen_cast_0000000000000001:function(t,r){return xt(t,r,om)},__wbindgen_cast_0000000000000002:function(t,r){return xt(t,r,sm)},__wbindgen_cast_0000000000000003:function(t,r){return xt(t,r,im)},__wbindgen_cast_0000000000000004:function(t,r){return xt(t,r,am)},__wbindgen_cast_0000000000000005:function(t,r){return xt(t,r,rm)},__wbindgen_cast_0000000000000006:function(t,r){return xt(t,r,nm)},__wbindgen_cast_0000000000000007:function(t){return t},__wbindgen_cast_0000000000000008:function(t){return t},__wbindgen_cast_0000000000000009:function(t,r){return H(t,r)},__wbindgen_cast_000000000000000a:function(t){return BigInt.asUintN(64,t)},__wbindgen_init_externref_table:function(){const t=d.__wbindgen_externrefs,r=t.grow(4);t.set(0,void 0),t.set(r+0,void 0),t.set(r+1,null),t.set(r+2,!0),t.set(r+3,!1)}}}}function rm(e,t){d.wasm_bindgen__convert__closures_____invoke__h69610db431037c77(e,t)}function nm(e,t){d.wasm_bindgen__convert__closures_____invoke__h492b14c1fd17d971(e,t)}function im(e,t,r){d.wasm_bindgen__convert__closures_____invoke__hf83e1094fac4ab4c(e,t,r)}function sm(e,t,r){return d.wasm_bindgen__convert__closures_____invoke__h204415932d107275(e,t,r)}function om(e,t,r){const n=d.wasm_bindgen__convert__closures_____invoke__hf2d3ca0c7acb67d9(e,t,r);if(n[1])throw w(n[0])}function am(e,t,r){const n=d.wasm_bindgen__convert__closures_____invoke__h9a626ac5c10dc9c9(e,t,r);if(n[1])throw w(n[0])}function Pa(e,t,r,n){d.wasm_bindgen__convert__closures_____invoke__h0c5680e9ed94b2e6(e,t,r,n)}function ue(e){const t=d.__externref_table_alloc();return d.__wbindgen_externrefs.set(t,e),t}function Ni(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){const i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){const i=e.length;let s="[";i>0&&(s+=Ni(e[0]));for(let o=1;o<i;o++)s+=", "+Ni(e[o]);return s+="]",s}const r=/\[object ([^\]]+)\]/.exec(toString.call(e));let n;if(r&&r.length>1)n=r[1];else return toString.call(e);if(n=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
|
|
2
|
+
${e.stack}`:n}function cm(e,t){e=e>>>0;const r=re(),n=[];for(let i=e;i<e+4*t;i+=4)n.push(d.__wbindgen_externrefs.get(r.getUint32(i,!0)));return d.__externref_drop_slice(e,t),n}function Me(e,t){return e=e>>>0,kt().subarray(e/1,e/1+t)}function re(){return(He===null||He.buffer.detached===!0||He.buffer.detached===void 0&&He.buffer!==d.memory.buffer)&&(He=new DataView(d.memory.buffer)),He}function H(e,t){return e=e>>>0,lm(e,t)}function kt(){return(Pt===null||Pt.byteLength===0)&&(Pt=new Uint8Array(d.memory.buffer)),Pt}function U(e,t){try{return e.apply(this,t)}catch(r){const n=ue(r);d.__wbindgen_exn_store(n)}}function x(e){return e==null}function xt(e,t,r){const n={a:e,b:t,cnt:1},i=(...s)=>{n.cnt++;const o=n.a;n.a=0;try{return r(o,n.b,...s)}finally{n.a=o,i._wbg_cb_unref()}};return i._wbg_cb_unref=()=>{--n.cnt===0&&(d.__wbindgen_destroy_closure(n.a,n.b),n.a=0,Wi.unregister(n))},Wi.register(i,n,n),i}function I(e,t){const r=t(e.length*1,1)>>>0;return kt().set(e,r/1),y=e.length,r}function E(e,t,r){if(r===void 0){const a=Ct.encode(e),c=t(a.length,1)>>>0;return kt().subarray(c,c+a.length).set(a),y=a.length,c}let n=e.length,i=t(n,1)>>>0;const s=kt();let o=0;for(;o<n;o++){const a=e.charCodeAt(o);if(a>127)break;s[i+o]=a}if(o!==n){o!==0&&(e=e.slice(o)),i=r(i,n,n=o+e.length*3,1)>>>0;const a=kt().subarray(i+o,i+n),c=Ct.encodeInto(e,a);o+=c.written,i=r(i,n,o,1)>>>0}return y=o,i}function w(e){const t=d.__wbindgen_externrefs.get(e);return d.__externref_table_dealloc(e),t}function lm(e,t){return yn+=t,yn>=Na&&(Er=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),Er.decode(),yn=t),Er.decode(kt().subarray(e,e+t))}function Ca(e,t){return d=e.exports,pm=t,He=null,Pt=null,d.__wbindgen_start(),d}async function um(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.ok&&r(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",i);else throw i}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function r(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}function dm(e){if(d!==void 0)return d;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const t=xa();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));const r=new WebAssembly.Instance(e,t);return Ca(r,e)}async function fm(e){if(d!==void 0)return d;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("jazz_wasm_bg.wasm",import.meta.url));const t=xa();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:r,module:n}=await um(await e,t);return Ca(r,n)}var yr,br,wr,vr,_n,Ge,Sr,he,Oa,$a,ji,Mi,La,Di,Bi,Fi,gn,Ui,Wi,He,Pt,Er,Na,yn,Ct,y,pm,d,hm=_({"../../crates/jazz-wasm/pkg/jazz_wasm.js"(){yr=class bh{static __wrap(t){t=t>>>0;const r=Object.create(bh.prototype);return r.__wbg_ptr=t,Mi.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Mi.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_pendingnativeread_free(t,0)}cancel(){d.pendingnativeread_cancel(this.__wbg_ptr)}poll(){const t=d.pendingnativeread_poll(this.__wbg_ptr);if(t[2])throw w(t[1]);return w(t[0])}},Symbol.dispose&&(yr.prototype[Symbol.dispose]=yr.prototype.free),br=class wh{static __wrap(t){t=t>>>0;const r=Object.create(wh.prototype);return r.__wbg_ptr=t,Bi.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Bi.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_streamingmutation_free(t,0)}abort(){return d.wasmstreamingmutation_abort(this.__wbg_ptr)}finish(){return d.wasmstreamingmutation_finish(this.__wbg_ptr)}finishInTransaction(){const t=d.wasmstreamingmutation_finishInTransaction(this.__wbg_ptr);if(t[1])throw w(t[0])}push(t){const r=I(t,d.__wbindgen_malloc),n=y;return d.wasmstreamingmutation_push(this.__wbg_ptr,r,n)}},Symbol.dispose&&(br.prototype[Symbol.dispose]=br.prototype.free),wr=class vh{static __wrap(t){t=t>>>0;const r=Object.create(vh.prototype);return r.__wbg_ptr=t,gn.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,gn.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_upstreamlink_free(t,0)}handle(t,r){let n,i;try{const a=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y,l=d.upstreamlink_handle(this.__wbg_ptr,t,a,c);var s=l[0],o=l[1];if(l[3])throw s=0,o=0,w(l[2]);return n=s,i=o,H(s,o)}finally{d.__wbindgen_free(n,i,1)}}constructor(t){const r=d.upstreamlink_new(t);return this.__wbg_ptr=r>>>0,gn.register(this,this.__wbg_ptr,this),this}},Symbol.dispose&&(wr.prototype[Symbol.dispose]=wr.prototype.free),vr=class hr{static __wrap(t){t=t>>>0;const r=Object.create(hr.prototype);return r.__wbg_ptr=t,ji.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ji.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_wasmdb_free(t,0)}acceptSubscriber(t,r,n){const i=I(t,d.__wbindgen_malloc),s=y,o=d.wasmdb_acceptSubscriber(this.__wbg_ptr,i,s,r,!x(n),x(n)?BigInt(0):n);if(o[2])throw w(o[1]);return w(o[0])}acceptSubscriberWithSelfSignedProof(t,r,n,i,s){const o=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),a=y,c=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=E(i,d.__wbindgen_malloc,d.__wbindgen_realloc),f=y,p=d.wasmdb_acceptSubscriberWithSelfSignedProof(this.__wbg_ptr,t,o,a,c,l,u,f,!x(s),x(s)?BigInt(0):s);if(p[2])throw w(p[1]);return w(p[0])}all(t,r,n,i,s){const o=I(t,d.__wbindgen_malloc),a=y;var c=x(n)?0:E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=x(i)?0:I(i,d.__wbindgen_malloc),f=y;const p=d.wasmdb_all(this.__wbg_ptr,o,a,r,c,l,u,f,s);if(p[2])throw w(p[1]);return w(p[0])}beginStreamingMutation(t,r,n,i,s,o,a,c,l,u,f){const p=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),g=y,m=I(r,d.__wbindgen_malloc),b=y,$=I(n,d.__wbindgen_malloc),O=y,C=E(i,d.__wbindgen_malloc,d.__wbindgen_realloc),N=y;var te=x(s)?0:E(s,d.__wbindgen_malloc,d.__wbindgen_realloc),V=y,le=x(o)?0:I(o,d.__wbindgen_malloc),ge=y,ye=x(a)?0:I(a,d.__wbindgen_malloc),be=y,oe=x(f)?0:E(f,d.__wbindgen_malloc,d.__wbindgen_realloc),Z=y;const B=d.wasmdb_beginStreamingMutation(this.__wbg_ptr,p,g,m,b,$,O,C,N,te,V,le,ge,ye,be,!x(c),x(c)?0:c,x(l)?0:ue(l),x(u)?0:ue(u),oe,Z);if(B[2])throw w(B[1]);return br.__wrap(B[0])}beginTransaction(t,r,n,i){const s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y;var l=x(n)?0:I(n,d.__wbindgen_malloc),u=y,f=x(i)?0:I(i,d.__wbindgen_malloc),p=y;const g=d.wasmdb_beginTransaction(this.__wbg_ptr,s,o,a,c,l,u,f,p);if(g[1])throw w(g[0])}canInsert(t,r){let n,i;try{const a=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y,l=I(r,d.__wbindgen_malloc),u=y,f=d.wasmdb_canInsert(this.__wbg_ptr,a,c,l,u);var s=f[0],o=f[1];if(f[3])throw s=0,o=0,w(f[2]);return n=s,i=o,H(s,o)}finally{d.__wbindgen_free(n,i,1)}}captureSnapshot(){const t=d.wasmdb_captureSnapshot(this.__wbg_ptr);if(t[2])throw w(t[1]);return w(t[0])}close(){return d.wasmdb_close(this.__wbg_ptr)}commitTransaction(t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y;var s=x(r)?0:E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y;const a=d.wasmdb_commitTransaction(this.__wbg_ptr,n,i,s,o);if(a[2])throw w(a[1]);return he.__wrap(a[0])}connectUpstream(){const t=d.wasmdb_connectUpstream(this.__wbg_ptr);if(t[2])throw w(t[1]);return w(t[0])}connectUpstreamWithSession(t,r,n,i,s,o){const a=I(n,d.__wbindgen_malloc),c=y,l=I(s,d.__wbindgen_malloc),u=y,f=d.wasmdb_connectUpstreamWithSession(this.__wbg_ptr,t,r,a,c,i,l,u,o);if(f[2])throw w(f[1]);return w(f[0])}createUpstreamLink(t){const r=d.wasmdb_createUpstreamLink(this.__wbg_ptr,t);return wr.__wrap(r)}delete(t,r,n){const i=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y,o=I(r,d.__wbindgen_malloc),a=y,c=d.wasmdb_delete(this.__wbg_ptr,i,s,o,a,n);if(c[2])throw w(c[1]);return he.__wrap(c[0])}deleteInTransaction(t,r,n,i){const s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y,l=I(n,d.__wbindgen_malloc),u=y,f=d.wasmdb_deleteInTransaction(this.__wbg_ptr,s,o,a,c,l,u,i);if(f[1])throw w(f[0])}static destroyBrowserStorage(t,r){const n=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y;return d.wasmdb_destroyBrowserStorage(t,n,i)}evictExpiredStagedLargeValues(){return d.wasmdb_evictExpiredStagedLargeValues(this.__wbg_ptr)}flush(){return d.wasmdb_flush(this.__wbg_ptr)}foregroundTxTimeHighWater(){const t=d.wasmdb_foregroundTxTimeHighWater(this.__wbg_ptr);if(t[2])throw w(t[1]);return w(t[0])}insert(t,r,n){const i=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y,o=I(r,d.__wbindgen_malloc),a=y,c=d.wasmdb_insert(this.__wbg_ptr,i,s,o,a,n);if(c[2])throw w(c[1]);return he.__wrap(c[0])}insertInTransaction(t,r,n,i){const s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y,l=I(n,d.__wbindgen_malloc),u=y,f=d.wasmdb_insertInTransaction(this.__wbg_ptr,s,o,a,c,l,u,i);if(f[3])throw w(f[2]);var p=Me(f[0],f[1]).slice();return d.__wbindgen_free(f[0],f[1]*1,1),p}localCurrentRow(t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=I(r,d.__wbindgen_malloc),o=y,a=d.wasmdb_localCurrentRow(this.__wbg_ptr,n,i,s,o);if(a[3])throw w(a[2]);var c=Me(a[0],a[1]).slice();return d.__wbindgen_free(a[0],a[1]*1,1),c}onMutationError(t){d.wasmdb_onMutationError(this.__wbg_ptr,t)}onStorageFailure(t){d.wasmdb_onStorageFailure(this.__wbg_ptr,t)}static openBrowser(t,r,n,i){const s=I(r,d.__wbindgen_malloc),o=y,a=I(n,d.__wbindgen_malloc),c=y,l=E(i,d.__wbindgen_malloc,d.__wbindgen_realloc),u=y;return d.wasmdb_openBrowser(t,s,o,a,c,l,u)}static openBrowserWithSelfSignedProof(t,r,n,i,s,o,a){const c=I(r,d.__wbindgen_malloc),l=y,u=I(n,d.__wbindgen_malloc),f=y,p=E(i,d.__wbindgen_malloc,d.__wbindgen_realloc),g=y,m=E(s,d.__wbindgen_malloc,d.__wbindgen_realloc),b=y,$=E(o,d.__wbindgen_malloc,d.__wbindgen_realloc),O=y,C=E(a,d.__wbindgen_malloc,d.__wbindgen_realloc),N=y;return d.wasmdb_openBrowserWithSelfSignedProof(t,c,l,u,f,p,g,m,b,$,O,C,N)}static openMemory(t,r){const n=I(t,d.__wbindgen_malloc),i=y,s=I(r,d.__wbindgen_malloc),o=y,a=d.wasmdb_openMemory(n,i,s,o);if(a[2])throw w(a[1]);return hr.__wrap(a[0])}static openMemoryAsBackend(t,r){const n=I(t,d.__wbindgen_malloc),i=y,s=I(r,d.__wbindgen_malloc),o=y,a=d.wasmdb_openMemoryAsBackend(n,i,s,o);if(a[2])throw w(a[1]);return hr.__wrap(a[0])}static openMemoryWithSelfSignedProof(t,r,n,i,s){const o=I(t,d.__wbindgen_malloc),a=y,c=I(r,d.__wbindgen_malloc),l=y,u=E(n,d.__wbindgen_malloc,d.__wbindgen_realloc),f=y,p=E(i,d.__wbindgen_malloc,d.__wbindgen_realloc),g=y,m=E(s,d.__wbindgen_malloc,d.__wbindgen_realloc),b=y,$=d.wasmdb_openMemoryWithSelfSignedProof(o,a,c,l,u,f,p,g,m,b);if($[2])throw w($[1]);return hr.__wrap($[0])}registerSchema(t,r){const n=I(t,d.__wbindgen_malloc),i=y;var s=x(r)?0:I(r,d.__wbindgen_malloc),o=y;const a=d.wasmdb_registerSchema(this.__wbg_ptr,n,i,s,o);if(a[2])throw w(a[1]);return hr.__wrap(a[0])}requestDeletePermissionAdvice(t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=I(r,d.__wbindgen_malloc),o=y,a=d.wasmdb_requestDeletePermissionAdvice(this.__wbg_ptr,n,i,s,o);if(a[2])throw w(a[1]);return Ge.__wrap(a[0])}requestInsertPermissionAdvice(t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=I(r,d.__wbindgen_malloc),o=y,a=d.wasmdb_requestInsertPermissionAdvice(this.__wbg_ptr,n,i,s,o);if(a[2])throw w(a[1]);return Ge.__wrap(a[0])}requestReadPermissionAdvice(t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=I(r,d.__wbindgen_malloc),o=y,a=d.wasmdb_requestReadPermissionAdvice(this.__wbg_ptr,n,i,s,o);if(a[2])throw w(a[1]);return Ge.__wrap(a[0])}requestUpdatePermissionAdvice(t,r,n){const i=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y,o=I(r,d.__wbindgen_malloc),a=y,c=I(n,d.__wbindgen_malloc),l=y,u=d.wasmdb_requestUpdatePermissionAdvice(this.__wbg_ptr,i,s,o,a,c,l);if(u[2])throw w(u[1]);return Ge.__wrap(u[0])}restore(t,r,n,i){const s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=I(r,d.__wbindgen_malloc),c=y;var l=x(n)?0:I(n,d.__wbindgen_malloc),u=y;const f=d.wasmdb_restore(this.__wbg_ptr,s,o,a,c,l,u,i);if(f[2])throw w(f[1]);return he.__wrap(f[0])}restoreInTransaction(t,r,n,i,s){const o=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),a=y,c=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=I(n,d.__wbindgen_malloc),f=y;var p=x(i)?0:I(i,d.__wbindgen_malloc),g=y;const m=d.wasmdb_restoreInTransaction(this.__wbg_ptr,o,a,c,l,u,f,p,g,s);if(m[1])throw w(m[0])}rollbackTransaction(t){const r=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),n=y,i=d.wasmdb_rollbackTransaction(this.__wbg_ptr,r,n);if(i[1])throw w(i[0])}seedForegroundTxTimeHighWater(t){const r=d.wasmdb_seedForegroundTxTimeHighWater(this.__wbg_ptr,t);if(r[1])throw w(r[0])}setIdentityClaims(t,r){const n=I(t,d.__wbindgen_malloc),i=y,s=d.wasmdb_setIdentityClaims(this.__wbg_ptr,n,i,r);if(s[1])throw w(s[0])}setLargeValueStagingPolicy(t,r,n){const i=d.wasmdb_setLargeValueStagingPolicy(this.__wbg_ptr,t,r,!x(n),x(n)?0:n);if(i[1])throw w(i[0])}setNonDurableClient(){const t=d.wasmdb_setNonDurableClient(this.__wbg_ptr);if(t[1])throw w(t[0])}setRemoteLinkHint(t){const r=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),n=y,i=d.wasmdb_setRemoteLinkHint(this.__wbg_ptr,r,n);if(i[1])throw w(i[0])}setSessionClaims(t){const r=d.wasmdb_setSessionClaims(this.__wbg_ptr,t);if(r[2])throw w(r[1]);return w(r[0])}setSlowQueryThresholdMs(t){const r=d.wasmdb_setSlowQueryThresholdMs(this.__wbg_ptr,t);if(r[1])throw w(r[0])}setTickScheduler(t){d.wasmdb_setTickScheduler(this.__wbg_ptr,t)}subscribe(t,r,n,i){const s=I(t,d.__wbindgen_malloc),o=y;var a=x(n)?0:I(n,d.__wbindgen_malloc),c=y;const l=d.wasmdb_subscribe(this.__wbg_ptr,s,o,r,a,c,i);if(l[2])throw w(l[1]);return w(l[0])}takeSlowQueryReport(t){var r=x(t)?0:E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),n=y;const i=d.wasmdb_takeSlowQueryReport(this.__wbg_ptr,r,n);if(i[3])throw w(i[2]);var s=cm(i[0],i[1]).slice();return d.__wbindgen_free(i[0],i[1]*4,4),s}tick(){return d.wasmdb_tick(this.__wbg_ptr)}update(t,r,n,i){const s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=I(r,d.__wbindgen_malloc),c=y,l=I(n,d.__wbindgen_malloc),u=y,f=d.wasmdb_update(this.__wbg_ptr,s,o,a,c,l,u,i);if(f[2])throw w(f[1]);return he.__wrap(f[0])}updateInTransaction(t,r,n,i,s){const o=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),a=y,c=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=I(n,d.__wbindgen_malloc),f=y,p=I(i,d.__wbindgen_malloc),g=y,m=d.wasmdb_updateInTransaction(this.__wbg_ptr,o,a,c,l,u,f,p,g,s);if(m[1])throw w(m[0])}updateLargeValues(t,r,n,i,s){const o=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),a=y,c=I(r,d.__wbindgen_malloc),l=y,u=I(n,d.__wbindgen_malloc),f=y,p=d.wasmdb_updateLargeValues(this.__wbg_ptr,o,a,c,l,u,f,i,!x(s),x(s)?0:s);if(p[2])throw w(p[1]);return he.__wrap(p[0])}updateLargeValuesInTransaction(t,r,n,i,s,o){const a=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),c=y,l=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),u=y,f=I(n,d.__wbindgen_malloc),p=y,g=I(i,d.__wbindgen_malloc),m=y,b=d.wasmdb_updateLargeValuesInTransaction(this.__wbg_ptr,a,c,l,u,f,p,g,m,s,!x(o),x(o)?0:o);if(b[1])throw w(b[0])}uploadStatus(){const t=d.wasmdb_uploadStatus(this.__wbg_ptr);if(t[2])throw w(t[1]);return w(t[0])}upsert(t,r,n,i){const s=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),o=y,a=I(r,d.__wbindgen_malloc),c=y,l=I(n,d.__wbindgen_malloc),u=y,f=d.wasmdb_upsert(this.__wbg_ptr,s,o,a,c,l,u,i);if(f[2])throw w(f[1]);return he.__wrap(f[0])}upsertInTransaction(t,r,n,i,s){const o=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),a=y,c=E(r,d.__wbindgen_malloc,d.__wbindgen_realloc),l=y,u=I(n,d.__wbindgen_malloc),f=y,p=I(i,d.__wbindgen_malloc),g=y,m=d.wasmdb_upsertInTransaction(this.__wbg_ptr,o,a,c,l,u,f,p,g,s);if(m[1])throw w(m[0])}waitForPendingWrites(t,r,n){const i=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),s=y;return d.wasmdb_waitForPendingWrites(this.__wbg_ptr,i,s,x(r)?0:ue(r),x(n)?16777215:n?1:0)}wireFeatures(){return d.wasmdb_wireFeatures(this.__wbg_ptr)>>>0}},Symbol.dispose&&(vr.prototype[Symbol.dispose]=vr.prototype.free),_n=class{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,La.unregister(this),e}free(){const e=this.__destroy_into_raw();d.__wbg_wasmpendingsubscription_free(e,0)}cancel(){d.wasmpendingsubscription_cancel(this.__wbg_ptr)}poll(){const e=d.wasmpendingsubscription_poll(this.__wbg_ptr);if(e[2])throw w(e[1]);return w(e[0])}setWake(e){d.wasmpendingsubscription_setWake(this.__wbg_ptr,e)}},Symbol.dispose&&(_n.prototype[Symbol.dispose]=_n.prototype.free),Ge=class Sh{static __wrap(t){t=t>>>0;const r=Object.create(Sh.prototype);return r.__wbg_ptr=t,Di.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Di.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_wasmpermissionadvicerequest_free(t,0)}cancel(){d.wasmpermissionadvicerequest_cancel(this.__wbg_ptr)}get promise(){return d.wasmpermissionadvicerequest_promise(this.__wbg_ptr)}},Symbol.dispose&&(Ge.prototype[Symbol.dispose]=Ge.prototype.free),Sr=class Eh{static __wrap(t){t=t>>>0;const r=Object.create(Eh.prototype);return r.__wbg_ptr=t,Fi.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Fi.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_wasmtransport_free(t,0)}auxiliaryOutboundReady(){return d.wasmtransport_auxiliaryOutboundReady(this.__wbg_ptr)}auxiliaryReceiveTimeoutMs(){const t=d.wasmtransport_auxiliaryReceiveTimeoutMs(this.__wbg_ptr);return t===4294967297?void 0:t}clearOutboundScheduler(){d.wasmtransport_clearOutboundScheduler(this.__wbg_ptr)}close(){return d.wasmtransport_close(this.__wbg_ptr)!==0}expireAuxiliaryReceive(){d.wasmtransport_expireAuxiliaryReceive(this.__wbg_ptr)}recvAuxiliaryWireFrames(t,r){return d.wasmtransport_recvAuxiliaryWireFrames(this.__wbg_ptr,x(t)?4294967297:t>>>0,x(r)?4294967297:r>>>0)}recvWireFrames(){return d.wasmtransport_recvWireFrames(this.__wbg_ptr)}routeAuxiliaryWireFrame(t){const r=I(t,d.__wbindgen_malloc),n=y;return d.wasmtransport_routeAuxiliaryWireFrame(this.__wbg_ptr,r,n)}sendWireFrame(t){const r=I(t,d.__wbindgen_malloc),n=y;d.wasmtransport_sendWireFrame(this.__wbg_ptr,r,n)}sendWireFrames(t){d.wasmtransport_sendWireFrames(this.__wbg_ptr,t)}setAuxiliaryTraceEnabled(t){d.wasmtransport_setAuxiliaryTraceEnabled(this.__wbg_ptr,t)}setOutboundScheduler(t){d.wasmtransport_setOutboundScheduler(this.__wbg_ptr,t)}takeAuxiliaryTrace(){return d.wasmtransport_takeAuxiliaryTrace(this.__wbg_ptr)}tick(){return d.wasmtransport_tick(this.__wbg_ptr)}updateAuthenticatedClaims(t){const r=d.wasmtransport_updateAuthenticatedClaims(this.__wbg_ptr,t);if(r[2])throw w(r[1]);return w(r[0])}upstreamRefusal(){return d.wasmtransport_upstreamRefusal(this.__wbg_ptr)}},Symbol.dispose&&(Sr.prototype[Symbol.dispose]=Sr.prototype.free),he=class Ah{static __wrap(t){t=t>>>0;const r=Object.create(Ah.prototype);return r.__wbg_ptr=t,Ui.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ui.unregister(this),t}free(){const t=this.__destroy_into_raw();d.__wbg_wasmwrite_free(t,0)}close(){return d.wasmwrite_close(this.__wbg_ptr)!==0}get payload(){const t=d.wasmwrite_payload(this.__wbg_ptr);var r=Me(t[0],t[1]).slice();return d.__wbindgen_free(t[0],t[1]*1,1),r}get rowId(){const t=d.wasmwrite_rowId(this.__wbg_ptr);var r=Me(t[0],t[1]).slice();return d.__wbindgen_free(t[0],t[1]*1,1),r}get txId(){let t,r;try{const n=d.wasmwrite_txId(this.__wbg_ptr);return t=n[0],r=n[1],H(n[0],n[1])}finally{d.__wbindgen_free(t,r,1)}}wait(t,r){const n=E(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=y,s=d.wasmwrite_wait(this.__wbg_ptr,n,i,x(r)?16777215:r?1:0);if(s[2])throw w(s[1]);return w(s[0])}writeState(){const t=d.wasmwrite_writeState(this.__wbg_ptr);if(t[2])throw w(t[1]);return w(t[0])}},Symbol.dispose&&(he.prototype[Symbol.dispose]=he.prototype.free),Oa=["pending","done"],$a=["readonly","readwrite","versionchange","readwriteflush","cleanup"],ji=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_wasmdb_free(e>>>0,1)),Mi=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_pendingnativeread_free(e>>>0,1)),La=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_wasmpendingsubscription_free(e>>>0,1)),Di=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_wasmpermissionadvicerequest_free(e>>>0,1)),Bi=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_streamingmutation_free(e>>>0,1)),Fi=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_wasmtransport_free(e>>>0,1)),gn=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_upstreamlink_free(e>>>0,1)),Ui=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_wasmwrite_free(e>>>0,1)),Wi=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbindgen_destroy_closure(e.a,e.b)),He=null,Pt=null,Er=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),Er.decode(),Na=2146435072,yn=0,Ct=new TextEncoder,"encodeInto"in Ct||(Ct.encodeInto=function(e,t){const r=Ct.encode(e);return t.set(r),{read:e.length,written:r.length}}),y=0}}),zi,mm=_({"../../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"(){zi=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()}}}}),qi,_m=_({"../../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"(){qi=class extends Error{code;name="OTLPExporterError";data;constructor(e,t,r){super(e),this.data=r,this.code=t}}}});function gm(e){if(Number.isFinite(e)&&e>0)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function ym(e){if(e!=null)return async()=>e}function bm(e,t,r){return{timeoutMillis:gm(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}function wm(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var ja=_({"../../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 vm(e){return new Ma(e.concurrencyLimit)}var Ma,Sm=_({"../../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"(){Ma=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);const t=()=>{const r=this._sendingPromises.indexOf(e);this._sendingPromises.splice(r,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}}}),Je,Da=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/version.js"(){Je="1.9.1"}});function Em(e){const t=new Set([e]),r=new Set,n=e.match(Vi);if(!n)return()=>!1;const i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(c){return c===e};function s(a){return r.add(a),!1}function o(a){return t.add(a),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;const l=c.match(Vi);if(!l)return s(c);const u={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return u.prerelease!=null||i.major!==u.major?s(c):i.major===0?i.minor===u.minor&&i.patch<=u.patch?o(c):s(c):i.minor<=u.minor?o(c):s(c)}}var Vi,Ba,Am=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js"(){Da(),Vi=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,Ba=Em(Je)}});function Gi(e,t,r,n=!1){var i;const s=$t[Ot]=(i=$t[Ot])!==null&&i!==void 0?i:{version:Je};if(!n&&s[e]){const o=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(o.stack||o.message),!1}if(s.version!==Je){const o=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${e} does not match previously registered API v${Je}`);return r.error(o.stack||o.message),!1}return s[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${Je}.`),!0}function Ar(e){var t,r;const n=(t=$t[Ot])===null||t===void 0?void 0:t.version;if(!(!n||!Ba(n)))return(r=$t[Ot])===null||r===void 0?void 0:r[e]}function Hi(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Je}.`);const r=$t[Ot];r&&delete r[e]}var Fa,Ot,$t,bn=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js"(){Da(),Am(),Fa=Je.split(".")[0],Ot=Symbol.for(`opentelemetry.js.api.${Fa}`),$t=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}}});function Tr(e,t,r){const n=Ar("diag");if(n)return n[e](t,...r)}var Ua,Tm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js"(){bn(),Ua=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return Tr("debug",this._namespace,e)}error(...e){return Tr("error",this._namespace,e)}info(...e){return Tr("info",this._namespace,e)}warn(...e){return Tr("warn",this._namespace,e)}verbose(...e){return Tr("verbose",this._namespace,e)}}}}),de,Wa=_({"../../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"})(de||(de={}))}});function Rm(e,t){e<de.NONE?e=de.NONE:e>de.ALL&&(e=de.ALL),t=t||{};function r(n,i){const s=t[n];return typeof s=="function"&&e>=i?s.bind(t):function(){}}return{error:r("error",de.ERROR),warn:r("warn",de.WARN),info:r("info",de.INFO),debug:r("debug",de.DEBUG),verbose:r("verbose",de.VERBOSE)}}var Im=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js"(){Wa()}}),za,Lt,Ji=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js"(){Tm(),Im(),Wa(),bn(),za="diag",Lt=class Th{static instance(){return this._instance||(this._instance=new Th),this._instance}constructor(){function t(i){return function(...s){const o=Ar("diag");if(o)return o[i](...s)}}const r=this,n=(i,s={logLevel:de.INFO})=>{var o,a,c;if(i===r){const f=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((o=f.stack)!==null&&o!==void 0?o:f.message),!1}typeof s=="number"&&(s={logLevel:s});const l=Ar("diag"),u=Rm((a=s.logLevel)!==null&&a!==void 0?a:de.INFO,i);if(l&&!s.suppressOverrideMessage){const f=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";l.warn(`Current logger will be overwritten from ${f}`),u.warn(`Current logger will overwrite one already registered from ${f}`)}return Gi("diag",u,r,!0)};r.setLogger=n,r.disable=()=>{Hi(za,r)},r.createComponentLogger=i=>new Ua(i),r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}}}});function qa(e){return Symbol.for(e)}var Va,Ga,Ki=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js"(){Va=class ba{constructor(t){const r=this;r._currentContext=t?new Map(t):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,i)=>{const s=new ba(r._currentContext);return s._currentContext.set(n,i),s},r.deleteValue=n=>{const i=new ba(r._currentContext);return i._currentContext.delete(n),i}}},Ga=new Va}});function Ha(){return rc}var Ja,Rr,Ka,Xa,Qa,Ya,wn,Za,ec,tc,rc,nc,ic,sc,oc,ac,cc,lc,km=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js"(){Ja=class{constructor(){}createGauge(e,t){return ic}createHistogram(e,t){return sc}createCounter(e,t){return nc}createUpDownCounter(e,t){return oc}createObservableGauge(e,t){return cc}createObservableCounter(e,t){return ac}createObservableUpDownCounter(e,t){return lc}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},Rr=class{},Ka=class extends Rr{add(e,t){}},Xa=class extends Rr{add(e,t){}},Qa=class extends Rr{record(e,t){}},Ya=class extends Rr{record(e,t){}},wn=class{addCallback(e){}removeCallback(e){}},Za=class extends wn{},ec=class extends wn{},tc=class extends wn{},rc=new Ja,nc=new Ka,ic=new Qa,sc=new Ya,oc=new Xa,ac=new Za,cc=new ec,lc=new tc}}),uc,xm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js"(){Ki(),uc=class{active(){return Ga}with(e,t,r,...n){return t.call(r,...n)}bind(e,t){return t}enable(){return this}disable(){return this}}}}),vn,dc,Sn,Xi=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/context.js"(){xm(),bn(),Ji(),vn="context",dc=new uc,Sn=class Rh{constructor(){}static getInstance(){return this._instance||(this._instance=new Rh),this._instance}setGlobalContextManager(t){return Gi(vn,t,Lt.instance())}active(){return this._getContextManager().active()}with(t,r,n,...i){return this._getContextManager().with(t,r,n,...i)}bind(t,r){return this._getContextManager().bind(t,r)}_getContextManager(){return Ar(vn)||dc}disable(){this._getContextManager().disable(),Hi(vn,Lt.instance())}}}}),fe,fc=_({"../../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"})(fe||(fe={}))}}),Qi,Yi,Zi,es=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js"(){fc(),Qi="0000000000000000",Yi="00000000000000000000000000000000",Zi={traceId:Yi,spanId:Qi,traceFlags:fe.NONE}}}),Nt,ts=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js"(){es(),Nt=class{constructor(e=Zi){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 rs(e){return e.getValue(En)||void 0}function Pm(){return rs(Sn.getInstance().active())}function ns(e,t){return e.setValue(En,t)}function Cm(e){return e.deleteValue(En)}function Om(e,t){return ns(e,new Nt(t))}function pc(e){var t;return(t=rs(e))===null||t===void 0?void 0:t.spanContext()}var En,hc=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js"(){Ki(),ts(),Xi(),En=qa("OpenTelemetry Context Key SPAN")}});function mc(e,t){if(typeof e!="string"||e.length!==t)return!1;let r=0;for(let n=0;n<e.length;n+=4)r+=(Ir[e.charCodeAt(n)]|0)+(Ir[e.charCodeAt(n+1)]|0)+(Ir[e.charCodeAt(n+2)]|0)+(Ir[e.charCodeAt(n+3)]|0);return r===t}function _c(e){return mc(e,32)&&e!==Yi}function $m(e){return mc(e,16)&&e!==Qi}function jt(e){return _c(e.traceId)&&$m(e.spanId)}function Lm(e){return new Nt(e)}var Ir,is=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js"(){es(),ts(),Ir=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 Nm(e){return e!==null&&typeof e=="object"&&"spanId"in e&&typeof e.spanId=="string"&&"traceId"in e&&typeof e.traceId=="string"&&"traceFlags"in e&&typeof e.traceFlags=="number"}var An,ss,gc=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js"(){Xi(),hc(),ts(),is(),An=Sn.getInstance(),ss=class{startSpan(e,t,r=An.active()){if(!!t?.root)return new Nt;const i=r&&pc(r);return Nm(i)&&jt(i)?new Nt(i):new Nt}startActiveSpan(e,t,r,n){let i,s,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=r):(i=t,s=r,o=n);const a=s??An.active(),c=this.startSpan(e,i,a),l=ns(a,c);return An.with(l,o,void 0,c)}}}}),yc,bc,jm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js"(){gc(),yc=new ss,bc=class{constructor(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}startSpan(e,t,r){return this._getTracer().startSpan(e,t,r)}startActiveSpan(e,t,r,n){const i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;const e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):yc}}}}),wc,Mm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js"(){gc(),wc=class{getTracer(e,t,r){return new ss}}}}),vc,os,Dm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js"(){jm(),Mm(),vc=new wc,os=class{getTracer(e,t,r){var n;return(n=this.getDelegateTracer(e,t,r))!==null&&n!==void 0?n:new bc(this,e,t,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:vc}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,r){var n;return(n=this._delegate)===null||n===void 0?void 0:n.getTracer(e,t,r)}}}}),Tn,Bm=_({"../../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"})(Tn||(Tn={}))}}),as,Fm=_({"../../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"})(as||(as={}))}}),Mt,Um=_({"../../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"})(Mt||(Mt={}))}}),me,Wm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context-api.js"(){Xi(),me=Sn.getInstance()}}),R,zm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag-api.js"(){Ji(),R=Lt.instance()}}),Rn,Sc,qm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js"(){bn(),Dm(),is(),hc(),Ji(),Rn="trace",Sc=class Ih{constructor(){this._proxyTracerProvider=new os,this.wrapSpanContext=Lm,this.isSpanContextValid=jt,this.deleteSpan=Cm,this.getSpan=rs,this.getActiveSpan=Pm,this.getSpanContext=pc,this.setSpan=ns,this.setSpanContext=Om}static getInstance(){return this._instance||(this._instance=new Ih),this._instance}setGlobalTracerProvider(t){const r=Gi(Rn,this._proxyTracerProvider,Lt.instance());return r&&this._proxyTracerProvider.setDelegate(t),r}getTracerProvider(){return Ar(Rn)||this._proxyTracerProvider}getTracer(t,r){return this.getTracerProvider().getTracer(t,r)}disable(){Hi(Rn,Lt.instance()),this._proxyTracerProvider=new os}}}}),ve,Vm=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js"(){qm(),ve=Sc.getInstance()}}),z=_({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/index.js"(){Ki(),km(),Bm(),Fm(),Um(),fc(),is(),es(),Wm(),zm(),Vm()}});function cs(e){return e.setValue(ls,!0)}function Gm(e){return e.getValue(ls)===!0}var ls,Ec=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js"(){z(),ls=qa("OpenTelemetry SDK Context Key SUPPRESS_TRACING")}});function kr(e){const t={};if(typeof e!="object"||e==null)return t;for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if(!Hm(r)){R.warn(`Invalid attribute key: ${r}`);continue}const n=e[r];if(!Ac(n)){R.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?t[r]=n.slice():t[r]=n}return t}function Hm(e){return typeof e=="string"&&e!==""}function Ac(e){return e==null?!0:Array.isArray(e)?Jm(e):Tc(typeof e)}function Jm(e){let t;for(const r of e){if(r==null)continue;const n=typeof r;if(n!==t){if(!t){if(Tc(n)){t=n;continue}return!1}return!1}}return!0}function Tc(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}var Km=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/attributes.js"(){z()}});function Xm(){return e=>{R.error(Qm(e))}}function Qm(e){return typeof e=="string"?e:JSON.stringify(Ym(e))}function Ym(e){const t={};let r=e;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(t[n])return;const i=r[n];i&&(t[n]=String(i))}),r=Object.getPrototypeOf(r);return t}var Zm=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/logging-error-handler.js"(){z()}});function pe(e){try{Rc(e)}catch{}}var Rc,e_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/global-error-handler.js"(){Zm(),Rc=Xm()}});function uT(e){}function dT(e){}var t_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/environment.js"(){}}),Ic,r_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/version.js"(){Ic="2.7.1"}}),n_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"(){}}),i_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"(){n_()}}),s_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"(){}}),o_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"(){s_()}}),kc,xc,Pc,Cc,a_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"(){kc="telemetry.sdk.language",xc="webjs",Pc="telemetry.sdk.name",Cc="telemetry.sdk.version"}}),c_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"(){}}),l_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js"(){}}),u_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"(){i_(),o_(),a_(),c_(),l_()}}),Oc,d_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/semconv.js"(){Oc="process.runtime.name"}}),In,f_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/sdk-info.js"(){r_(),u_(),d_(),In={[Pc]:"opentelemetry",[Oc]:"browser",[kc]:xc,[Cc]:Ic}}}),Ke,$c=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/index.js"(){t_(),f_(),Ke=performance}});function Xe(e){const t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*Fc);return[r,n]}function Lc(e){const t=Xe(Ke.timeOrigin),r=Xe(typeof e=="number"?e:Ke.now());return Mc(t,r)}function Nc(e){if(ds(e))return e;if(typeof e=="number")return e<Ke.timeOrigin?Lc(e):Xe(e);if(e instanceof Date)return Xe(e.getTime());throw TypeError("Invalid input type")}function p_(e,t){let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(r-=1,n+=xr),[r,n]}function h_(e){return e[0]*xr+e[1]}function us(e){return e[0]*1e6+e[1]/1e3}function ds(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function jc(e){return ds(e)||typeof e=="number"||e instanceof Date}function Mc(e,t){const r=[e[0]+t[0],e[1]+t[1]];return r[1]>=xr&&(r[1]-=xr,r[0]+=1),r}var Dc,Bc,Fc,xr,m_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/time.js"(){$c(),Dc=9,Bc=6,Fc=Math.pow(10,Bc),xr=Math.pow(10,Dc)}}),ee,__=_({"../../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"})(ee||(ee={}))}});function Uc(e){if(!g_(e)||y_(e)!==Wc)return!1;const t=Hc(e);if(t===null)return!0;const r=hs.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&fs.call(r)===Gc}function g_(e){return e!=null&&typeof e=="object"}function y_(e){return e==null?e===void 0?qc:zc:Qe&&Qe in Object(e)?b_(e):w_(e)}function b_(e){const t=hs.call(e,Qe),r=e[Qe];let n=!1;try{e[Qe]=void 0,n=!0}catch{}const i=ms.call(e);return n&&(t?e[Qe]=r:delete e[Qe]),i}function w_(e){return ms.call(e)}var Wc,zc,qc,Vc,fs,Gc,Hc,ps,hs,Qe,ms,v_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/lodash.merge.js"(){Wc="[object Object]",zc="[object Null]",qc="[object Undefined]",Vc=Function.prototype,fs=Vc.toString,Gc=fs.call(Object),Hc=Object.getPrototypeOf,ps=Object.prototype,hs=ps.hasOwnProperty,Qe=Symbol?Symbol.toStringTag:void 0,ms=ps.toString}});function S_(...e){let t=e.shift();const r=new WeakMap;for(;e.length>0;)t=Jc(t,e.shift(),0,r);return t}function _s(e){return kn(e)?e.slice():e}function Jc(e,t,r=0,n){let i;if(!(r>Qc)){if(r++,xn(e)||xn(t)||Xc(t))i=_s(t);else if(kn(e)){if(i=e.slice(),kn(t))for(let s=0,o=t.length;s<o;s++)i.push(_s(t[s]));else if(Pr(t)){const s=Object.keys(t);for(let o=0,a=s.length;o<a;o++){const c=s[o];c==="__proto__"||c==="constructor"||c==="prototype"||(i[c]=_s(t[c]))}}}else if(Pr(e))if(Pr(t)){if(!E_(e,t))return t;i=Object.assign({},e);const s=Object.keys(t);for(let o=0,a=s.length;o<a;o++){const c=s[o];if(c==="__proto__"||c==="constructor"||c==="prototype")continue;const l=t[c];if(xn(l))typeof l>"u"?delete i[c]:i[c]=l;else{const u=i[c],f=l;if(Kc(e,c,n)||Kc(t,c,n))delete i[c];else{if(Pr(u)&&Pr(f)){const p=n.get(u)||[],g=n.get(f)||[];p.push({obj:e,key:c}),g.push({obj:t,key:c}),n.set(u,p),n.set(f,g)}i[c]=Jc(i[c],l,r,n)}}}}else i=t;return i}}function Kc(e,t,r){const n=r.get(e[t])||[];for(let i=0,s=n.length;i<s;i++){const o=n[i];if(o.key===t&&o.obj===e)return!0}return!1}function kn(e){return Array.isArray(e)}function Xc(e){return typeof e=="function"}function Pr(e){return!xn(e)&&!kn(e)&&!Xc(e)&&typeof e=="object"}function xn(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function E_(e,t){return!(!Uc(e)||!Uc(t))}var Qc,A_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/merge.js"(){v_(),Qc=20}});function T_(e,t){let r;const n=new Promise(function(s,o){r=setTimeout(function(){o(new Yc("Operation timed out."))},t)});return Promise.race([e,n]).then(i=>(clearTimeout(r),i),i=>{throw clearTimeout(r),i})}var Yc,R_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/timeout.js"(){Yc=class kh extends Error{constructor(t){super(t),Object.setPrototypeOf(this,kh.prototype)}}}}),Zc,I_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/promise.js"(){Zc=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)}}}}),Dt,k_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/callback.js"(){I_(),Dt=class{_isCalled=!1;_deferred=new Zc;_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(t=>this._deferred.resolve(t),t=>this._deferred.reject(t))}catch(t){this._deferred.reject(t)}}return this._deferred.promise}}}});function x_(e,t){return new Promise(r=>{me.with(cs(me.active()),()=>{e.export(t,r)})})}var P_=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/internal/exporter.js"(){z(),Ec()}}),gs,J=_({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/index.js"(){Km(),e_(),m_(),__(),$c(),Ec(),A_(),R_(),k_(),P_(),gs={_export:x_}}});function C_(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function O_(){return{handleResponse(e){e==null||!C_(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||R.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}var $_=_({"../../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"(){z()}});function L_(e,t){return new el(e.transport,e.serializer,O_(),e.promiseHandler,t.timeout)}var el,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"(){J(),_m(),$_(),z(),el=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,t,r,n,i){this._transport=e,this._serializer=t,this._responseHandler=r,this._promiseQueue=n,this._timeout=i,this._diagLogger=R.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,t){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()){t({code:ee.FAILED,error:new Error("Concurrent export limit reached")});return}const r=this._serializer.serializeRequest(e);if(r==null){t({code:ee.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(r,this._timeout).then(n=>{if(n.status==="success"){if(n.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(n.data))}catch(i){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",i,n.data)}t({code:ee.SUCCESS});return}else if(n.status==="failure"&&n.error){t({code:ee.FAILED,error:n.error});return}else n.status==="retryable"?t({code:ee.FAILED,error:n.error??new qi("Export failed with retryable status")}):t({code:ee.FAILED,error:new qi("Export failed with unknown error")})},n=>t({code:ee.FAILED,error:n})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}}});function j_(e,t,r){return L_({transport:r,serializer:t,promiseHandler:vm(e)},{timeout:e.timeoutMillis})}var M_=_({"../../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"(){Sm(),N_()}}),tl=_({"../../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"(){mm()}}),pt,D_=_({"../../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"})(pt||(pt={}))}}),ys,bs,ws=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLogger.js"(){ys=class{emit(e){}enabled(){return!1}},bs=new ys}});function B_(e,t,r){return n=>n===e?t:r}var Cr,Bt,vs,F_=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/internal/global-utils.js"(){Cr=Symbol.for("io.opentelemetry.js.api.logs"),Bt=globalThis,vs=1}}),rl,Ss,nl=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLoggerProvider.js"(){ws(),rl=class{getLogger(e,t,r){return new ys}},Ss=new rl}}),il,U_=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLogger.js"(){ws(),il=class{constructor(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;const e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):bs}}}}),Es,W_=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLoggerProvider.js"(){nl(),U_(),Es=class{getLogger(e,t,r){var n;return(n=this._getDelegateLogger(e,t,r))!==null&&n!==void 0?n:new il(this,e,t,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Ss}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,r){var n;return(n=this._delegate)===null||n===void 0?void 0:n.getLogger(e,t,r)}}}}),sl,z_=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/api/logs.js"(){F_(),nl(),W_(),sl=class xh{constructor(){this._proxyLoggerProvider=new Es}static getInstance(){return this._instance||(this._instance=new xh),this._instance}setGlobalLoggerProvider(t){return Bt[Cr]?this.getLoggerProvider():(Bt[Cr]=B_(vs,t,Ss),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=Bt[Cr])===null||t===void 0?void 0:t.call(Bt,vs))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete Bt[Cr],this._proxyLoggerProvider=new Es}}}}),q_,Pn=_({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/index.js"(){D_(),ws(),z_(),q_=sl.getInstance()}}),V_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"(){}}),G_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"(){V_()}}),H_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"(){}}),J_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"(){H_()}}),Ye,Cn,Ze,As,Ts,Rs,Is,K_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"(){Ye="exception.message",Cn="exception.stacktrace",Ze="exception.type",As="service.name",Ts="telemetry.sdk.language",Rs="telemetry.sdk.name",Is="telemetry.sdk.version"}}),X_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"(){}}),Q_=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js"(){}}),On=_({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"(){G_(),J_(),K_(),X_(),Q_()}});function ol(){if($n===void 0)try{const e=globalThis.process.argv0;$n=e?`unknown_service:${e}`:"unknown_service"}catch{$n="unknown_service"}return $n}var $n,al=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/default-service-name.js"(){}}),Ft,Y_=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/utils.js"(){Ft=e=>e!==null&&typeof e=="object"&&typeof e.then=="function"}});function ks(e,t){return Cs.FromAttributeList(Object.entries(e),t)}function Z_(e,t){return new Cs(e,t)}function xs(){return ks({})}function Ps(){return ks({[As]:ol(),[Ts]:In[Ts],[Rs]:In[Rs],[Is]:In[Is]})}function cl(e){return e.map(([t,r])=>Ft(r)?[t,r.catch(n=>{R.debug("promise rejection for resource attribute: %s - %s",t,n)})]:[t,r])}function eg(e){if(typeof e=="string"||e===void 0)return e;R.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}function tg(e,t){const r=e?.schemaUrl,n=t?.schemaUrl,i=r===void 0||r==="",s=n===void 0||n==="";if(i)return n;if(s||r===n)return r;R.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}var Cs,ll=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js"(){z(),J(),On(),al(),Y_(),Cs=class wa{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,r){const n=new wa({},r);return n._rawAttributes=cl(t),n._asyncAttributesPending=t.filter(([i,s])=>Ft(s)).length>0,n}constructor(t,r){const n=t.attributes??{};this._rawAttributes=Object.entries(n).map(([i,s])=>(Ft(s)&&(this._asyncAttributesPending=!0),[i,s])),this._rawAttributes=cl(this._rawAttributes),this._schemaUrl=eg(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){const[r,n]=this._rawAttributes[t];this._rawAttributes[t]=[r,Ft(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&R.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const t={};for(const[r,n]of this._rawAttributes){if(Ft(n)){R.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(t[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;const r=tg(this,t),n=r?{schemaUrl:r}:void 0;return wa.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],n)}}}}),ul,rg=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detect-resources.js"(){z(),ll(),ul=(e={})=>(e.detectors||[]).map(r=>{try{const n=Z_(r.detect(e));return R.debug(`${r.constructor.name} found resource.`,n),n}catch(n){return R.debug(`${r.constructor.name} failed: ${n.message}`),xs()}}).reduce((r,n)=>r.merge(n),xs())}}),dl,fl,ng=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/EnvDetector.js"(){z(),On(),J(),dl=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(e){const t={},r=void 0,n=void 0;if(r)try{const i=this._parseResourceAttributes(r);Object.assign(t,i)}catch(i){R.debug(`EnvDetector failed: ${i instanceof Error?i.message:i}`)}return n&&(t[As]=n),{attributes:t}}_parseResourceAttributes(e){if(!e)return{};const t={},r=e.split(this._COMMA_SEPARATOR).filter(n=>n.trim()!=="");for(const n of r){const i=n.split(this._LABEL_KEY_VALUE_SPLITTER);if(i.length!==2)throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${n}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);const[s,o]=i,a=s.trim(),c=o.trim();if(a.length===0)throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${n}".`);let l,u;try{l=decodeURIComponent(a),u=decodeURIComponent(c)}catch(f){throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${n}": ${f instanceof Error?f.message:f}`)}if(l.length>this._MAX_LENGTH)throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${l}".`);if(u.length>this._MAX_LENGTH)throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${l}".`);t[l]=u}return t}},fl=new dl}}),pl,Or,Ln=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/NoopDetector.js"(){pl=class{detect(){return{attributes:{}}}},Or=new pl}}),hl,ig=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/HostDetector.js"(){Ln(),hl=Or}}),ml,sg=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/OSDetector.js"(){Ln(),ml=Or}}),_l,og=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/ProcessDetector.js"(){Ln(),_l=Or}}),gl,ag=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/ServiceInstanceIdDetector.js"(){Ln(),gl=Or}}),cg=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/index.js"(){ig(),sg(),og(),ag()}}),lg=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/index.js"(){ng(),cg()}}),yl={};It(yl,{defaultResource:()=>Ps,defaultServiceName:()=>ol,detectResources:()=>ul,emptyResource:()=>xs,envDetector:()=>fl,hostDetector:()=>hl,osDetector:()=>ml,processDetector:()=>_l,resourceFromAttributes:()=>ks,serviceInstanceIdDetector:()=>gl});var Os=_({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/index.js"(){rg(),lg(),ll(),al()}});function bl(e,t){const r={attributes:Nn(e.attributes,t),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function wl(e){return{name:e.name,version:e.version}}function Nn(e,t){return Object.keys(e).map(r=>vl(r,e[r],t))}function vl(e,t,r){return{key:e,value:jn(t,r)}}function jn(e,t){const r=typeof e;if(r==="string")return{stringValue:e};if(r==="number")return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(r==="boolean")return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){const n=new Array(e.length);for(let i=0;i<e.length;i++)n[i]=jn(e[i],t);return{arrayValue:{values:n}}}if(r==="object"&&e!=null){const n=Object.keys(e),i=new Array(n.length);for(let s=0;s<n.length;s++)i[s]={key:n[s],value:jn(e[n[s]],t)};return{kvlistValue:{values:i}}}return{}}var Sl=_({"../../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 ug(e){const t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function dg(e){return ug(e).toString()}function El(e){return e}var Al,$s,Tl=_({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js"(){J(),Al=typeof BigInt<"u"?dg:h_,$s={encodeHrTime:Al,encodeSpanContext:El,encodeOptionalSpanContext:El,encodeUint8Array:e=>{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");const t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=String.fromCharCode(e[r]);return btoa(t.join(""))}}}});function Rl(e,t){let r=e&255|Il;return t&&(r|=kl),r}function fg(e,t){const r=e.spanContext(),n=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(r.traceId),spanId:t.encodeSpanContext(r.spanId),parentSpanId:i,traceState:r.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:Nn(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(s=>hg(s,t)),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(s=>pg(s,t)),droppedLinksCount:e.droppedLinksCount,flags:Rl(r.traceFlags,e.parentSpanContext?.isRemote)}}function pg(e,t){return{attributes:e.attributes?Nn(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:Rl(e.context.traceFlags,e.context.isRemote)}}function hg(e,t){return{attributes:e.attributes?Nn(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function mg(e,t){return{resourceSpans:gg(e,t)}}function _g(e){const t=new Map;for(const r of e){let n=t.get(r.resource);n||(n=new Map,t.set(r.resource,n));const i=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`;let s=n.get(i);s||(s=[],n.set(i,s)),s.push(r)}return t}function gg(e,t){const r=_g(e),n=[],i=r.entries();let s=i.next();for(;!s.done;){const[o,a]=s.value,c=[],l=a.values();let u=l.next();for(;!u.done;){const g=u.value;if(g.length>0){const m=g.map(b=>fg(b,t));c.push({scope:wl(g[0].instrumentationScope),spans:m,schemaUrl:g[0].instrumentationScope.schemaUrl})}u=l.next()}const f=bl(o,t),p={resource:f,scopeSpans:c,schemaUrl:f.schemaUrl};n.push(p),s=i.next()}return n}var Il,kl,yg=_({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js"(){Sl(),Il=256,kl=512}});function bg(e,t){return{resourceLogs:vg(e,t)}}function wg(e){const t=new Map;for(const r of e){const{resource:n,instrumentationScope:{name:i,version:s="",schemaUrl:o=""}}=r;let a=t.get(n);a||(a=new Map,t.set(n,a));const c=`${i}@${s}:${o}`;let l=a.get(c);l||(l=[],a.set(c,l)),l.push(r)}return t}function vg(e,t){const r=wg(e);return Array.from(r,([n,i])=>{const s=bl(n,t);return{resource:s,scopeLogs:Array.from(i,([,o])=>({scope:wl(o[0].instrumentationScope),logRecords:o.map(a=>Sg(a,t)),schemaUrl:o[0].instrumentationScope.schemaUrl})),schemaUrl:s.schemaUrl}})}function Sg(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:jn(e.body,t),eventName:e.eventName,attributes:Eg(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function fT(e){return e}function Eg(e,t){return Object.keys(e).map(r=>vl(r,e[r],t))}var Ag=_({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/internal.js"(){Sl()}}),xl,Tg=_({"../../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"(){Ag(),Tl(),z(),xl={serializeRequest:e=>{const t=bg(e,$s);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};const t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return R.warn(`Failed to parse logs export response: ${r.message}. Returning empty response`),{}}}}}}),Rg=_({"../../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"(){Tg()}}),Pl,Ig=_({"../../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"(){yg(),Tl(),z(),Pl={serializeRequest:e=>{const t=mg(e,$s);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};const t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return R.warn(`Failed to parse trace export response: ${r.message}. Returning empty response`),{}}}}}}),kg=_({"../../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"(){Ig()}}),Cl=_({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/index.js"(){Rg(),kg()}});function xg(){return Math.random()*(2*Ls)-Ls}function Pg(e){return new Nl(e.transport)}var Mn,Ol,$l,Ll,Ls,Nl,Cg=_({"../../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"(){z(),Mn=5,Ol=1e3,$l=5e3,Ll=1.5,Ls=.2,Nl=class{_transport;constructor(e){this._transport=e}retry(e,t,r){return new Promise((n,i)=>{setTimeout(()=>{this._transport.send(e,t).then(n,i)},r)})}async send(e,t){let r=Mn,n=Ol;const i=Date.now()+t;let s=await this._transport.send(e,t);for(;s.status==="retryable"&&r>0;){r--;const o=Math.max(Math.min(n*(1+xg()),$l),0);n=n*Ll;const a=s.retryInMillis??o,c=i-Date.now();if(a>c)return R.info(`Export retry time ${Math.round(a)}ms exceeds remaining timeout ${Math.round(c)}ms, not retrying further.`),s;R.verbose(`Scheduling export retry in ${Math.round(a)}ms`),s=await this.retry(e,c,a)}return s.status==="success"?R.verbose(`Export succeeded after ${Mn-r} retry attempts.`):s.status==="retryable"?R.info(`Export failed after maximum retry attempts (${Mn}).`):R.info(`Export failed with non-retryable error: ${s.error}`),s}shutdown(){return this._transport.shutdown()}}}});function Og(e){return e===429||e===502||e===503||e===504}function $g(e){if(e==null)return;const t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;const r=new Date(e).getTime()-Date.now();return r>=0?r:0}var Lg=_({"../../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 Ng(e){return new Dl(e)}function jg(e){return e instanceof TypeError&&!e.cause}var jl,Ml,Dn,$r,Dl,Mg=_({"../../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"(){z(),Lg(),jl=60*1024,Ml=9,Dn=0,$r=0,Dl=class{_parameters;constructor(e){this._parameters=e}async send(e,t){const r=new AbortController,n=setTimeout(()=>r.abort(),t);let i=globalThis.fetch;typeof i.__original=="function"&&(i=i.__original);const s=e.byteLength,o=Dn+s>jl,a=$r>=Ml,c=!o&&!a;if(c)Dn+=s,$r++;else{const l=o?"size limit":"count limit";R.debug(`keepalive disabled: ${(s/1024).toFixed(1)}KB payload, ${$r} pending (${l})`)}try{const l=new URL(this._parameters.url),u=await i(l.href,{method:"POST",headers:await this._parameters.headers(),body:e,signal:r.signal,keepalive:c,mode:globalThis.location?globalThis.location.origin===l.origin?"same-origin":"cors":"no-cors"});if(u.status>=200&&u.status<=299)return R.debug(`export response success (status: ${u.status})`),{status:"success"};if(Og(u.status)){R.warn(`export response retryable (status: ${u.status})`);const f=u.headers.get("Retry-After");return{status:"retryable",retryInMillis:$g(f)}}return R.error(`export response failure (status: ${u.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${u.status}`)}}catch(l){return jg(l)?(R.warn(`export request retryable (network error: ${l})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:l})}):(R.error(`export request failure (error: ${l})`),{status:"failure",error:new Error("Fetch request errored",{cause:l})})}finally{clearTimeout(n),c&&(Dn-=s,$r--)}}shutdown(){}}}});function Dg(e,t){return j_(e,t,Pg({transport:Ng(e)}))}var Bg=_({"../../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"(){Cg(),M_(),Mg()}});function Fg(e){const t={};return Object.entries(e??{}).forEach(([r,n])=>{typeof n<"u"?t[r]=String(n):R.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),t}var Ug=_({"../../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"(){z()}});function Wg(e,t,r){return async()=>{const n={...await r()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,Fg(await e())),Object.assign(i,n)}}function zg(e){if(e!=null)try{const t=globalThis.location?.href;return new URL(e,t).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function qg(e,t,r){return{...bm(e,t,r),headers:Wg(e.headers,t.headers,r.headers),url:zg(e.url)??t.url??r.url}}function Vg(e,t){return{...wm(),headers:async()=>e,url:"http://localhost:4318/"+t}}var Gg=_({"../../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"(){ja(),Ug()}});function Hg(e){return typeof e.headers=="function"?e.headers:ym(e.headers)}var Jg=_({"../../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"(){ja()}});function Kg(e,t,r){return qg({url:e.url,timeoutMillis:e.timeoutMillis,headers:Hg(e),concurrencyLimit:e.concurrencyLimit},{},Vg(r,t))}var Xg=_({"../../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"(){Gg(),Jg()}});function Bl(e,t,r,n){const i=Kg(e,r,n);return Dg(i,t)}var Qg=_({"../../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"(){Bg(),Xg()}}),Fl=_({"../../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"(){Qg()}}),Ul,Yg=_({"../../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"(){tl(),Cl(),Fl(),Ul=class extends zi{constructor(e={}){super(Bl(e,Pl,"v1/traces",{"Content-Type":"application/json"}))}}}}),Zg=_({"../../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"(){Yg()}}),Wl={};It(Wl,{OTLPTraceExporter:()=>Ul});var ey=_({"../../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"(){Zg()}}),zl,ty=_({"../../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"(){zl="exception"}}),ql,ry=_({"../../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"(){z(),J(),On(),ty(),ql=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Mt.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){const t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Ke.now(),this._performanceOffset=t-(this._performanceStartTime+Ke.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(const r of e.links)this.addLink(r);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 R.warn(`Invalid attribute key: ${e}`),this;if(!Ac(t))return R.warn(`Invalid attribute value set for key: ${e}`),this;const{attributeCountLimit:r}=this._spanLimits,n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return r!==void 0&&this._attributesCount>=r&&n?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,r){if(this._isSpanEnded())return this;const{eventCountLimit:n}=this._spanLimits;if(n===0)return R.warn("No events allowed."),this._droppedEventsCount++,this;n!==void 0&&this.events.length>=n&&(this._droppedEventsCount===0&&R.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),jc(t)&&(jc(r)||(r=t),t=void 0);const i=kr(t),{attributePerEventCountLimit:s}=this._spanLimits,o={};let a=0,c=0;for(const l in i){if(!Object.prototype.hasOwnProperty.call(i,l))continue;const u=i[l];if(s!==void 0&&c>=s){a++;continue}o[l]=this._truncateToSize(u),c++}return this.events.push({name:e,attributes:o,time:this._getTime(r),droppedAttributesCount:a}),this}addLink(e){if(this._isSpanEnded())return this;const{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&R.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);const{attributePerLinkCountLimit:r}=this._spanLimits,n=kr(e.attributes),i={};let s=0,o=0;for(const c in n){if(!Object.prototype.hasOwnProperty.call(n,c))continue;const l=n[c];if(r!==void 0&&o>=r){s++;continue}i[c]=this._truncateToSize(l),o++}const a={context:e.context};return o>0&&(a.attributes=i),s>0&&(a.droppedAttributesCount=s),this.links.push(a),this}addLinks(e){for(const t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded())return this;if(e.code===Mt.UNSET)return this;if(this.status.code===Mt.OK)return this;const t={code:e.code};return e.code===Mt.ERROR&&(typeof e.message=="string"?t.message=e.message:e.message!=null&&R.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){R.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=p_(this.startTime,this.endTime),this._duration[0]<0&&(R.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&&R.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&R.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<=Ke.now())return Lc(e+this._performanceOffset);if(typeof e=="number")return Xe(e);if(e instanceof Date)return Xe(e.getTime());if(ds(e))return e;if(this._startTimeProvided)return Xe(Date.now());const t=Ke.now()-this._performanceStartTime;return Mc(this.startTime,Xe(t))}isRecording(){return this._ended===!1}recordException(e,t){const r={};typeof e=="string"?r[Ye]=e:e&&(e.code?r[Ze]=e.code.toString():e.name&&(r[Ze]=e.name),e.message&&(r[Ye]=e.message),e.stack&&(r[Cn]=e.stack)),r[Ze]||r[Ye]?this.addEvent(zl,r,t):R.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){const e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);R.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){const t=this._attributeValueLengthLimit;return t<=0?(R.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e=="string"?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(r=>typeof r=="string"?this._truncateToLimitUtil(r,t):r):e}}}}),Se,Lr=_({"../../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"})(Se||(Se={}))}}),Ut,Ns=_({"../../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"(){Lr(),Ut=class{shouldSample(){return{decision:Se.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}}}),et,js=_({"../../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"(){Lr(),et=class{shouldSample(){return{decision:Se.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}}}),Wt,Vl=_({"../../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"(){z(),J(),Ns(),js(),Wt=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(pe(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new et),this._remoteParentSampled=e.remoteParentSampled??new et,this._remoteParentNotSampled=e.remoteParentNotSampled??new Ut,this._localParentSampled=e.localParentSampled??new et,this._localParentNotSampled=e.localParentNotSampled??new Ut}shouldSample(e,t,r,n,i,s){const o=ve.getSpanContext(e);return!o||!jt(o)?this._root.shouldSample(e,t,r,n,i,s):o.isRemote?o.traceFlags&fe.SAMPLED?this._remoteParentSampled.shouldSample(e,t,r,n,i,s):this._remoteParentNotSampled.shouldSample(e,t,r,n,i,s):o.traceFlags&fe.SAMPLED?this._localParentSampled.shouldSample(e,t,r,n,i,s):this._localParentNotSampled.shouldSample(e,t,r,n,i,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}}}),Bn,Gl=_({"../../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"(){z(),Lr(),Bn=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:_c(t)&&this._accumulate(t)<this._upperBound?Se.RECORD_AND_SAMPLED:Se.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 r=0;r<32;r+=8){let n=0;for(let i=0;i<8;i++){const s=e.charCodeAt(r+i),o=s<58?s-48:s<71?s-55:s-87;n=n<<4|o}t=(t^n)>>>0}return t}}}});function Hl(){return{sampler:Jl(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128},spanLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128,linkCountLimit:void 0??128,eventCountLimit:void 0??128,attributePerEventCountLimit:void 0??128,attributePerLinkCountLimit:void 0??128}}}function Jl(){const e=void 0??Oe.ParentBasedAlwaysOn;switch(e){case Oe.AlwaysOn:return new et;case Oe.AlwaysOff:return new Ut;case Oe.ParentBasedAlwaysOn:return new Wt({root:new et});case Oe.ParentBasedAlwaysOff:return new Wt({root:new Ut});case Oe.TraceIdRatio:return new Bn(Kl());case Oe.ParentBasedTraceIdRatio:return new Wt({root:new Bn(Kl())});default:return R.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Oe.ParentBasedAlwaysOn}".`),new Wt({root:new et})}}function Kl(){const e=void 0;return e==null?(R.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Nr}.`),Nr):e<0||e>1?(R.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${Nr}.`),Nr):e}var Oe,Nr,Xl=_({"../../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"(){z(),J(),Ns(),js(),Vl(),Gl(),(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"})(Oe||(Oe={})),Nr=1}});function ny(e){const t={sampler:Jl()},r=Hl(),n=Object.assign({},r,t,e);return n.generalLimits=Object.assign({},r.generalLimits,e.generalLimits||{}),n.spanLimits=Object.assign({},r.spanLimits,e.spanLimits||{}),n}function iy(e){const t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??Ql,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??Yl,Object.assign({},e,{spanLimits:t})}var Ql,Yl,Zl=_({"../../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"(){Xl(),J(),Ql=128,Yl=1/0}}),eu,sy=_({"../../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"(){z(),J(),eu=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:void 0??512,this._maxQueueSize=typeof t?.maxQueueSize=="number"?t.maxQueueSize:void 0??2048,this._scheduledDelayMillis=typeof t?.scheduledDelayMillis=="number"?t.scheduledDelayMillis:void 0??5e3,this._exportTimeoutMillis=typeof t?.exportTimeoutMillis=="number"?t.exportTimeoutMillis:void 0??3e4,this._shutdownOnce=new Dt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(R.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&fe.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&&R.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(R.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{const r=[],n=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let i=0,s=n;i<s;i++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{const r=setTimeout(()=>{t(new Error("Timeout"))},this._exportTimeoutMillis);me.with(cs(me.active()),()=>{let n;this._finishedSpans.length<=this._maxExportBatchSize?(n=this._finishedSpans,this._finishedSpans=[]):n=this._finishedSpans.splice(0,this._maxExportBatchSize);const i=()=>this._exporter.export(n,o=>{clearTimeout(r),o.code===ee.SUCCESS?e():t(o.error??new Error("BatchSpanProcessor: span export failed"))});let s=null;for(let o=0,a=n.length;o<a;o++){const c=n[o];c.resource.asyncAttributesPending&&c.resource.waitForAsyncAttributes&&(s??=[],s.push(c.resource.waitForAsyncAttributes()))}s===null?i():Promise.all(s).then(i,o=>{pe(o),t(o)})})})}_maybeStartTimer(){if(this._isExporting)return;const e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(t=>{this._isExporting=!1,pe(t)})};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)}}}}),tu,oy=_({"../../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"(){sy(),J(),tu=class extends eu{_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(t=>{pe(t)})},this._pageHideListener=()=>{this.forceFlush().catch(t=>{pe(t)})},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 ru(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 nu(e){let t="";for(let r=0;r<e.length;r++)t+=ou[e[r]];return t}var iu,su,Ms,Ds,ou,Bs,ay=_({"../../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"(){iu=16,su=8,Ms=new Uint8Array(iu),Ds=new Uint8Array(su),ou=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),Bs=class{generateTraceId(){return ru(Ms),nu(Ms)}generateSpanId(){return ru(Ds),nu(Ds)}}}}),au=_({"../../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"(){oy(),ay()}}),cu,Fs,lu,uu,cy=_({"../../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"(){cu="otel.span.parent.origin",Fs="otel.span.sampling_result",lu="otel.sdk.span.live",uu="otel.sdk.span.started"}});function ly(e){return e?e.isRemote?"remote":"local":"none"}function uy(e){switch(e){case Se.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case Se.RECORD:return"RECORD_ONLY";case Se.NOT_RECORD:return"DROP"}}var du,dy=_({"../../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"(){Lr(),cy(),du=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(uu,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter(lu,{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,t){const r=uy(t);if(this.startedSpans.add(1,{[cu]:ly(e),[Fs]:r}),t===Se.NOT_RECORD)return()=>{};const n={[Fs]:r};return this.liveSpans.add(1,n),()=>{this.liveSpans.add(-1,n)}}}}}),fu,fy=_({"../../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"(){fu="2.7.1"}}),pu,py=_({"../../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"(){z(),J(),ry(),Zl(),au(),dy(),fy(),pu=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,r,n){const i=ny(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new Bs,this._resource=r,this._spanProcessor=n,this.instrumentationScope=e;const s=i.meterProvider?i.meterProvider.getMeter("@opentelemetry/sdk-trace",fu):Ha();this._tracerMetrics=new du(s)}startSpan(e,t={},r=me.active()){t.root&&(r=ve.deleteSpan(r));const n=ve.getSpan(r);if(Gm(r))return R.debug("Instrumentation suppressed, returning Noop Span"),ve.wrapSpanContext(Zi);const i=n?.spanContext(),s=this._idGenerator.generateSpanId();let o,a,c;!i||!ve.isSpanContextValid(i)?a=this._idGenerator.generateTraceId():(a=i.traceId,c=i.traceState,o=i);const l=t.kind??as.INTERNAL,u=(t.links??[]).map(C=>({context:C.context,attributes:kr(C.attributes)})),f=kr(t.attributes),p=this._sampler.shouldSample(r,a,e,l,f,u),g=this._tracerMetrics.startSpan(i,p.decision);c=p.traceState??c;const m=p.decision===Tn.RECORD_AND_SAMPLED?fe.SAMPLED:fe.NONE,b={traceId:a,spanId:s,traceFlags:m,traceState:c};if(p.decision===Tn.NOT_RECORD)return R.debug("Recording is off, propagating context in a non-recording span"),ve.wrapSpanContext(b);const $=kr(Object.assign(f,p.attributes));return new ql({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:b,name:e,kind:l,links:u,parentSpanContext:o,attributes:$,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:g})}startActiveSpan(e,t,r,n){let i,s,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=r):(i=t,s=r,o=n);const a=s??me.active(),c=this.startSpan(e,i,a),l=ve.setSpan(a,c);return me.with(l,o,void 0,c)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}}}),hu,hy=_({"../../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"(){J(),hu=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){const e=[];for(const t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(r=>{pe(r||new Error("MultiSpanProcessor: forceFlush failed")),t()})})}onStart(e,t){for(const r of this._spanProcessors)r.onStart(e,t)}onEnding(e){for(const t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(const t of this._spanProcessors)t.onEnd(e)}shutdown(){const e=[];for(const t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,r)=>{Promise.all(e).then(()=>{t()},r)})}}}}),ht,mu,my=_({"../../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"(){J(),Os(),py(),Xl(),hy(),Zl(),(function(e){e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(ht||(ht={})),mu=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){const t=S_({},Hl(),iy(e));this._resource=t.resource??Ps(),this._config=Object.assign({},t,{resource:this._resource});const r=[];e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new hu(r)}getTracer(e,t,r){const n=`${e}@${t||""}:${r?.schemaUrl||""}`;return this._tracers.has(n)||this._tracers.set(n,new pu({name:e,version:t,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(n)}forceFlush(){const e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(r=>new Promise(n=>{let i;const s=setTimeout(()=>{n(new Error(`Span processor did not completed within timeout period of ${e} ms`)),i=ht.timeout},e);r.forceFlush().then(()=>{clearTimeout(s),i!==ht.timeout&&(i=ht.resolved,n(i))}).catch(o=>{clearTimeout(s),i=ht.error,n(o)})}));return new Promise((r,n)=>{Promise.all(t).then(i=>{const s=i.filter(o=>o!==ht.resolved);s.length>0?n(s):r()}).catch(i=>n([i]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}}}),_u,_y=_({"../../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"(){J(),_u=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:us(e.startTime),duration:us(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,t){for(const r of e)console.dir(this._exportInfo(r),{depth:3});if(t)return t({code:ee.SUCCESS})}}}}),gu,gy=_({"../../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"(){J(),gu=class{_finishedSpans=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:ee.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>t({code:ee.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}}}),yu,yy=_({"../../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"(){z(),J(),yu=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new Dt(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&fe.SAMPLED)===0)return;const t=this._doExport(e).catch(r=>pe(r));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();const t=await gs._export(this._exporter,[e]);if(t.code!==ee.SUCCESS)throw t.error??new Error(`SimpleSpanProcessor: span export failed (status ${t})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}}}),bu,by=_({"../../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"(){bu=class{onStart(e,t){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}}}),wu={};It(wu,{AlwaysOffSampler:()=>Ut,AlwaysOnSampler:()=>et,BasicTracerProvider:()=>mu,BatchSpanProcessor:()=>tu,ConsoleSpanExporter:()=>_u,InMemorySpanExporter:()=>gu,NoopSpanProcessor:()=>bu,ParentBasedSampler:()=>Wt,RandomIdGenerator:()=>Bs,SamplingDecision:()=>Se,SimpleSpanProcessor:()=>yu,TraceIdRatioBasedSampler:()=>Bn});var wy=_({"../../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"(){my(),au(),_y(),gy(),yy(),by(),Ns(),js(),Vl(),Gl(),Lr()}}),vu,vy=_({"../../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"(){tl(),Cl(),Fl(),vu=class extends zi{constructor(e={}){super(Bl(e,xl,"v1/logs",{"Content-Type":"application/json"}))}}}}),Sy=_({"../../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"(){vy()}}),Su={};It(Su,{OTLPLogExporter:()=>vu});var Ey=_({"../../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"(){Sy()}});function Ay(e){return Us(e,new WeakSet)}function Us(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(n=>Us(n,t));const r=e;return r.constructor!==Object&&r.constructor!==void 0?!1:Object.values(r).every(n=>Us(n,t))}return!1}var Ty=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/utils/validation.js"(){}}),Eu,Ry=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LogRecordImpl.js"(){z(),J(),On(),Ty(),Eu=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,r){const{timestamp:n,observedTimestamp:i,eventName:s,severityNumber:o,severityText:a,body:c,attributes:l={},exception:u,context:f}=r,p=Date.now();if(this.hrTime=Nc(n??p),this.hrTimeObserved=Nc(i??p),f){const g=ve.getSpanContext(f);g&&jt(g)&&(this.spanContext=g)}this.severityNumber=o,this.severityText=a,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=s,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return R.warn(`Invalid attribute key: ${e}`),this;if(!Ay(t))return R.warn(`Invalid attribute value set for key: ${e}`),this;const r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return r&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&R.warn("Dropping extra attributes."),this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(const[t,r]of Object.entries(e))this.setAttribute(t,r);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){const t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return R.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(r=>this._truncateToSize(r));if(typeof e=="object"){const r={};for(const[n,i]of Object.entries(e))r[n]=this._truncateToSize(i);return r}return e}_setException(e){let t=!1;if(typeof e=="string"||typeof e=="number")Object.hasOwn(this.attributes,Ye)||this.setAttribute(Ye,String(e)),t=!0;else if(e&&typeof e=="object"){const r=e;r.code?(Object.hasOwn(this.attributes,Ze)||this.setAttribute(Ze,r.code.toString()),t=!0):r.name&&(Object.hasOwn(this.attributes,Ze)||this.setAttribute(Ze,r.name),t=!0),r.message&&(Object.hasOwn(this.attributes,Ye)||this.setAttribute(Ye,r.message),t=!0),r.stack&&(Object.hasOwn(this.attributes,Cn)||this.setAttribute(Cn,r.stack),t=!0)}t||R.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&R.warn("Can not execute the operation on emitted log record"),this._isReadonly}}}}),Au,Iy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/Logger.js"(){Pn(),z(),Ry(),Au=class{instrumentationScope;_sharedState;_loggerConfig;constructor(e,t){this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){const t=this._loggerConfig,r=e.context||me.active(),n=e.severityNumber??pt.UNSPECIFIED;if(n!==pt.UNSPECIFIED&&n<t.minimumSeverity)return;if(t.traceBased){const s=ve.getSpanContext(r);if(s&&jt(s)&&!((s.traceFlags&fe.SAMPLED)===fe.SAMPLED))return}const i=new Eu(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,r),i._makeReadonly()}enabled(e){const t=this._loggerConfig;if(t.disabled)return!1;const r=e?.severityNumber;if(typeof r=="number"&&r!==pt.UNSPECIFIED&&r<t.minimumSeverity)return!1;const n=e?.context||me.active();if(t.traceBased){const s=ve.getSpanContext(n);if(s&&jt(s)&&!((s.traceFlags&fe.SAMPLED)===fe.SAMPLED))return!1}const i={context:n,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(const s of this._sharedState.processors)if(!s.enabled||s.enabled(i))return!0;return!1}}}}),Tu,ky=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/NoopLogRecordProcessor.js"(){Tu=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}}}),Ru,xy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/MultiLogRecordProcessor.js"(){J(),Ru=class{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){const e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>T_(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(r=>r.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(const t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}});function Py(e){return`${e.name}@${e.version||""}:${e.schemaUrl||""}`}var Cy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/utils.js"(){}}),Iu,Oy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/semconv.js"(){Iu="otel.sdk.log.created"}}),ku,$y=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerMetrics.js"(){Oy(),ku=class{createdLogs;constructor(e){this.createdLogs=e.createCounter(Iu,{unit:"{log_record}",description:"The number of logs submitted to enabled SDK Loggers."})}emitLog(){this.createdLogs.add(1)}}}}),xu,Ly=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/version.js"(){xu="0.216.0"}}),Pu,Ws,Cu,Ny=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/LoggerProviderSharedState.js"(){z(),Pn(),ky(),xy(),Cy(),$y(),Ly(),Pu={disabled:!1,minimumSeverity:pt.UNSPECIFIED,traceBased:!1},Ws=()=>({...Pu}),Cu=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=new Map;constructor(e,t,r,n,i,s){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=r,this.processors=n,n.length>0?(this.registeredLogRecordProcessors=n,this.activeProcessor=new Ru(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Tu,this._loggerConfigurator=i??Ws;const o=s?s.getMeter("@opentelemetry/sdk-logs",xu):Ha();this.loggerMetrics=new ku(o)}getLoggerConfig(e){const t=Py(e);let r=this._loggerConfigs.get(t);return r||(r=this._loggerConfigurator(e),this._loggerConfigs.set(t,r),r)}}}}),Ou,$u,jy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerProvider.js"(){z(),Pn(),Os(),J(),Iy(),Ny(),Ou="unknown",$u=class{_shutdownOnce;_sharedState;constructor(e={}){const t={resource:e.resource??Ps(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??Ws,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new Cu(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new Dt(this._shutdown,this)}getLogger(e,t,r){if(this._shutdownOnce.isCalled)return R.warn("A shutdown LoggerProvider cannot provide a Logger"),bs;e||R.warn("Logger requested without instrumentation scope name.");const n=e||Ou,i=`${n}@${t||""}:${r?.schemaUrl||""}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Au({name:n,version:t,schemaUrl:r?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(R.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(R.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}}}),Lu,My=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/ConsoleLogRecordExporter.js"(){J(),Lu=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:us(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(const r of e)console.dir(this._exportInfo(r),{depth:3});t?.({code:ee.SUCCESS})}}}}),Nu,Dy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/SimpleLogRecordProcessor.js"(){J(),Nu=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new Dt(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;const t=()=>gs._export(this._exporter,[e]).then(r=>{r.code!==ee.SUCCESS&&pe(r.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${r})`))}).catch(pe);if(e.resource.asyncAttributesPending){const r=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(r),t()),pe);r!=null&&this._unresolvedExports.add(r)}else t()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}}}),ju,By=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/InMemoryLogRecordExporter.js"(){J(),ju=class{_finishedLogRecords=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:ee.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),t({code:ee.SUCCESS})}async shutdown(){this._stopped=!0,this.reset()}async forceFlush(){}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}}}});async function Fy(e){const t=[];for(let r=0,n=e.length;r<n;r++){const i=e[r];i.resource.asyncAttributesPending&&i.resource.waitForAsyncAttributes&&t.push(i.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var zs,Mu,Uy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/BatchLogRecordProcessorBase.js"(){z(),J(),zs=class{_exportCompleted;_exportScheduledPromise;_exportScheduledResolve;constructor(e,t,r){this._exportScheduledPromise=new Promise(n=>{this._exportScheduledResolve=n}),this._exportCompleted=this._executeExport(e,t,r)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,r){try{await Fy(t),await me.with(cs(me.active()),async()=>this._exportWithTimeout(e,t,r))}catch(n){pe(n),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,r){return new Promise((n,i)=>{const s=setTimeout(()=>{i(new Error("Timeout"))},r);e.export(t,o=>{clearTimeout(s),o.code===ee.SUCCESS?n():i(o.error??new Error("BatchLogRecordProcessor: log record export failed"))}),this._exportScheduledResolve()})}},Mu=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 Dt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(R.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);const r=new zs(this._exporter,t,this._exportTimeoutMillis);this._currentExport=r;try{await r.exportScheduled,await this._exporter.forceFlush(),await r.exportCompleted}catch(n){pe(n)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){const e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();const e=this._extractBatch();if(e===null)return;const t=new zs(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(r=>{this._currentExport=null,pe(r),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)}}}}),Du,Wy=_({"../../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"(){Uy(),Du=class extends Mu{_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))}}}}),zy=_({"../../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"(){Wy()}});function qy(e){return t=>{const r=t.name;for(const{pattern:n,config:i}of e)if(Vy(r,n))return{disabled:i.disabled??jr.disabled,minimumSeverity:i.minimumSeverity??jr.minimumSeverity,traceBased:i.traceBased??jr.traceBased};return{...jr}}}function Vy(e,t){if(t===e)return!0;if(t.includes("*")){const r=t.split("*").map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${r}$`).test(e)}return!1}var jr,Gy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/config/LoggerConfigurators.js"(){Pn(),jr={disabled:!1,minimumSeverity:pt.UNSPECIFIED,traceBased:!1}}}),Bu={};It(Bu,{BatchLogRecordProcessor:()=>Du,ConsoleLogRecordExporter:()=>Lu,InMemoryLogRecordExporter:()=>ju,LoggerProvider:()=>$u,SimpleLogRecordProcessor:()=>Nu,createLoggerConfigurator:()=>qy});var Hy=_({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/index.js"(){jy(),My(),Dy(),By(),zy(),Gy()}}),Fu;function zt(e){if(globalThis.crypto?.getRandomValues)return globalThis.crypto.getRandomValues(new Uint8Array(e));if(Fu){const t=Fu();if(!(t instanceof Uint8Array)||t.byteLength<e)throw new Error(`Native runtime entropy returned fewer than ${e*8} bits`);return t.slice(0,e)}throw new Error("Jazz requires a cryptographically secure runtime entropy source")}function Jy(e=zt(16)){const t=e.slice(0,16);return t[6]=t[6]&15|64,t[8]=t[8]&63|128,t}function Uu(e=()=>zt(16)){for(;;){const t=e(),r=new DataView(t.buffer,t.byteOffset,t.byteLength).getBigUint64(0,!0);if(r!==0n)return r}}var Wu="jazz-snapshot-v1:",zu=72,Ky=48,qs=class extends Error{name="SnapshotRefFormatError";code="invalid_snapshot_ref";constructor(){super("Invalid or unsupported snapshot reference")}};function Xy(e){if(typeof e!="string"||!e.startsWith(Wu))throw new qs;const t=e.slice(Wu.length);if(t.length<zu||!/^[0-9a-f]+$/.test(t))throw new qs;let r=0;for(let n=0;n<4;n++)r+=parseInt(t.slice(64+n*2,66+n*2),16)*2**(n*8);if(t.length!==zu+r*Ky)throw new qs;return e}var Qy=class extends Error{name="UnsupportedSnapshotError";code="unsupported_snapshot";constructor(e="Capturing snapshots is not supported by this runtime yet"){super(e)}},De=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);const t=e instanceof Uint8Array?e:new Uint8Array(e),r=[];let n=[],i=!1;const s=f=>{!i&&(i=!0,f==="\uFEFF")||(n.push(f),n.length===4096&&(r.push(n.join("")),n=[]))},o=()=>{if(this.fatal)throw new TypeError("The encoded data was not valid UTF-8");s("\uFFFD")};let a=0,c=0,l=128,u=191;for(let f=0;f<t.length;f++){const p=t[f];c===0?p<=127?s(String.fromCharCode(p)):p>=194&&p<=223?(c=1,a=p&31):p>=224&&p<=239?(c=2,a=p&15,p===224&&(l=160),p===237&&(u=159)):p>=240&&p<=244?(c=3,a=p&7,p===240&&(l=144),p===244&&(u=143)):o():p<l||p>u?(c=0,l=128,u=191,o(),f--):(l=128,u=191,a=a<<6|p&63,--c===0&&s(String.fromCodePoint(a)))}return c!==0&&o(),n.length&&r.push(n.join("")),r.join("")}};function tt(e){return e instanceof Error?e:new Error(String(e))}function mt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rt(e){const t=new Uint8Array(e.reduce((n,i)=>n+i.length,0));let r=0;for(const n of e)t.set(n,r),r+=n.length;return t}var Yy=new De({fatal:!0});function Zy(e){try{return Yy.decode(e),!0}catch{return!1}}function Vs(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 new Error(`Cannot serialize non-finite number in schema JSON (key "${e}"): ${t}.`);return t}function qu(e){return Object.fromEntries(Object.keys(e).sort().map(t=>[t,e[t]]))}function eb(e,t){return JSON.stringify({tables:qu(e),...t?{migrations:t}:{}},Vs)}function tb(e,t){const r={__jazzRuntimeSchema:1,schema:qu(e),loadedPolicyBundle:t?.loadedPolicyBundle??!1};return JSON.stringify(r,Vs)}var pT=new De({fatal:!0});function Gs(e){let t=!1;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(n>=55296&&n<=56319){const i=e.charCodeAt(r+1);if(Number.isNaN(i)||i<56320||i>57343)return!1;t=!0,r+=1;continue}if(n>=56320&&n<=57343)return!1;n!==32&&(n<9||n>13)&&(t=!0)}return t}function Ee(e){return Gs(e)}function qt(e,t,r){if(typeof e!="string")throw new Error("Author identity is missing an issuer");if(typeof t!="string")throw new Error("Author identity is missing a subject");if(!Gs(e)||!Gs(t))throw new Error("Author issuer and subject must be portable and nonempty");if(r!==void 0&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(r))throw new Error("Author account must be a canonical UUID");return JSON.stringify(r===void 0?[e,t]:[r,e,t])}function Vt(e){try{const t=JSON.parse(e);if(!Array.isArray(t)||t.length!==2&&t.length!==3)return null;const r=t.length===3?t[0]:void 0;if(r!==void 0&&typeof r!="string")return null;const[n,i]=t.slice(t.length===3?1:0);if(typeof n!="string"||typeof i!="string")return null;const s=qt(n,i,r);return e!==s?null:{...r===void 0?{}:{account_id:r},issuer:n,user_id:i,canonical:s}}catch{return null}}function Hs(e){return new TextEncoder().encode(qt(e.issuer,e.user_id,e.account_id))}function rb(e){if(e.type!=="Row"||e.value.values.length!==2)throw new Error("invalid structured author record");const[t,r]=e.value.values;if(t?.type!=="Uuid"||r?.type!=="Row"||r.value.values.length!==2)throw new Error("invalid structured author record");const[n,i]=r.value.values;if(n?.type!=="Text"||i?.type!=="Text")throw new Error("invalid structured author identity");qt(n.value,i.value,t.value)}var Vu="urn:jazz:local-first",nb="urn:jazz:anonymous",Gt="urn:jazz:system",ib="urn:jazz:static-bearer",sb=[Gt,Vu,ib,nb];function Fn(e){return sb.includes(e)}var Ht="__jazz_trusted_reserved_session",Gu=new WeakSet,Hu=new WeakMap,Ju=new Map;function ob(){const e=zt(16);return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function ab(e){return Fn(e.issuer)&&Gu.add(e),e}function Ku(e){if(!Gu.has(e)||!Fn(e.issuer))return;let t=Hu.get(e);return t||(t=ob(),Hu.set(e,t)),Ju.set(t,{account_id:e.account_id,issuer:e.issuer,user_id:e.user_id,authMode:e.authMode}),t}function Mr(e,t){if(!Fn(e.issuer)||typeof t!="string")return!1;const r=Ju.get(t);return r?.issuer===e.issuer&&r.account_id===e.account_id&&r.user_id===e.user_id&&r.authMode===e.authMode}var cb=new Set(["sub","exp","nbf","iat","iss","aud","jti"]);function Js(e){return e===null||typeof e=="string"||typeof e=="boolean"?!0:typeof e=="number"?Number.isFinite(e):Array.isArray(e)?e.every(Js):mt(e)&&Object.values(e).every(Js)}function Xu(e){const t=Object.create(null);for(const[r,n]of Object.entries(e).sort(lb))!cb.has(r)&&Js(n)&&(t[r]=n);return t}function lb([e],[t]){const r=new TextEncoder().encode(e),n=new TextEncoder().encode(t);for(let i=0;i<Math.min(r.length,n.length);i+=1){const s=r[i]-n[i];if(s!==0)return s}return r.length-n.length}function ub(e){if(typeof e!="string")return;const t=e.trim();return t.length>0?t:void 0}function db(){return globalThis.Buffer}function fb(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4;return r===0?t:t+"=".repeat(4-r)}function pb(e){const t=db();if(t)try{return t.from(e,"base64").toString("utf8")}catch{return null}if(typeof atob=="function")try{const r=atob(e),n=new Uint8Array(r.length);for(let i=0;i<r.length;i+=1)n[i]=r.charCodeAt(i);return new De().decode(n)}catch{return null}return null}function Qu(e){const t=ub(e);if(!t)return null;const r=t.split(".");if(r.length<2)return null;const n=r[1];if(n===void 0)return null;const i=pb(fb(n));if(!i)return null;try{const s=JSON.parse(i);return mt(s)?s:null}catch{return null}}function hb(e){return e!=="disabled"&&e!=="revoked"}var mb=new Set(["expired","missing","invalid","disabled","revoked"]);function Yu(e){if(mb.has(e))return e;const t=e.toLowerCase();return t.includes("expired")?"expired":t.includes("missing")?"missing":t.includes("disabled")?"disabled":t.includes("revoked")?"revoked":"invalid"}var ne=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Zu(e){let t="";for(let r=0;r<e.length;r++)t+=ne[e[r]&255];return t}function ed(e,t){return ne[e[t]&255]+ne[e[t+1]&255]+ne[e[t+2]&255]+ne[e[t+3]&255]+"-"+ne[e[t+4]&255]+ne[e[t+5]&255]+"-"+ne[e[t+6]&255]+ne[e[t+7]&255]+"-"+ne[e[t+8]&255]+ne[e[t+9]&255]+"-"+ne[e[t+10]&255]+ne[e[t+11]&255]+ne[e[t+12]&255]+ne[e[t+13]&255]+ne[e[t+14]&255]+ne[e[t+15]&255]}var _b=/^[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}$/,gb=/^[0-9a-fA-F]{32}$/;function Ks(e){if(!_b.test(e)&&!gb.test(e))return;const t=e.replaceAll("-",""),r=new Uint8Array(16);for(let n=0;n<16;n+=1)r[n]=Number.parseInt(t.slice(n*2,n*2+2),16);return r}function Be(e){return ed(e,0)}var td=new Map;function rd(e){if(td.size!==0)try{return td.get(new URL(e).host)}catch{return}}function yb(e){return rd(e)?.fetch??globalThis.fetch}function bb(e){return rd(e)?.WebSocket}function wb(){const e=zt(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(n=>n.toString(16).padStart(2,"0")).join("")}function vb(e){const t=new URL(e).protocol;return t==="http:"||t==="https:"}function Sb(e){const t=new URL(e).protocol;return t==="http:"||t==="https:"||t==="blob:"}function Eb(e){return new URL("/",e).href}function Ab(e,t){try{return new URL(e).href}catch{}if(t)try{return new URL(e,t).href}catch{}return e}function nd(e,t){if(!t?.wasmVersion)return e;try{const r=new URL(e);return r.searchParams.set("jazz-runtime-version",t.wasmVersion),r.href}catch{return e}}function Tb(e,t){try{return new URL(e).href}catch{}return t?new URL(e,t).href:null}function Rb(e,t,r){return!t||vb(e)||!r&&Sb(t)?null:new URL("jazz_wasm_bg.wasm",Eb(t)).href}function Ib(e){return e?.wasmModule?{module:e.wasmModule}:e?.wasmSource?{module:e.wasmSource}:null}function kb(e,t,r){if(r?.wasmUrl)return nd(Ab(r.wasmUrl,t),r);if(r?.baseUrl){const n=Tb(r.baseUrl,t);if(n)return nd(new URL("jazz_wasm_bg.wasm",n).href,r)}return Rb(typeof e=="function"?e():e,t,!1)}var xb="b84e0904a2a57ac95066df0640d867441da3c2c06464eb57123a3b9824623f57",Pb="d7ba77fde7fc70f887022c32e739c08358627d9b32911fddde3ebbabf1767191",Cb={napi:xb,wasm:Pb};function Ob(e,t,r=[]){const n=Cb[t.toLowerCase()];if(typeof e.nativeArtifactFingerprint!="function")throw new Error(`Jazz ${t} artifact is stale or incompatible: missing nativeArtifactFingerprint (expected ${n}). In this monorepo rebuild generated bindings; for installed packages reinstall matching Jazz package versions.`);const i=e.nativeArtifactFingerprint();if(i!==n)throw new Error(`Jazz ${t} artifact ABI mismatch: expected ${n}, got ${String(i)}. In this monorepo rebuild generated bindings; for installed packages reinstall matching Jazz package versions.`);for(const s of r)if(typeof e[s]!="function")throw new Error(`Jazz ${t} artifact is incomplete despite matching fingerprint: missing ${s}.`)}var Un=class extends Error{},Jt=class extends Error{},$b=new Set("\\.+*?()|[]{}^$#&-~"),Lb=new Set("imsUuRx"),Nb=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]);function jb(e){return $b.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(t){throw t instanceof Un&&this.fancy?new Jt(t.message):t}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 Un(e)}parseAlternation(e){const 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){const t=[];let r=0;for(;!this.eof();){const n=this.char();if(n==="|"||n===")")break;if(n==="?"||n==="*"||n==="+"||n==="{"?(r++,r===2&&n==="+"?this.unsupported.push("possessive quantifiers"):r===2&&n==="{"?this.unsupported.push("a counted repetition right after another quantifier"):r>=2&&this.fancyInvalid.push("a quantifier right after another quantifier")):r=0,n==="(")t.push(this.parseGroup(e));else if(n==="[")t.push({kind:"class",item:this.parseBracketed()});else if(n==="?"||n==="*"||n==="+"){this.index++;const[i,s]=n==="?"?[0,1]:n==="*"?[0,1/0]:[1,1/0];let o=!0;!this.eof()&&this.char()==="?"&&(o=!1,this.index++),this.repeatLast(t,i,s,o)}else n==="{"?this.parseCountedRepetition(t):t.push(this.parsePrimitive())}return t.length===1?t[0]:{kind:"concat",items:t}}repeatLast(e,t,r,n){const 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:r,greedy:n!==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;const t=Number(e);return t>4294967295&&this.fail("repetition count is too large"),t}parseCountedRepetition(e){const 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");const r=this.parseDecimal();this.eof()&&this.fail("unclosed counted repetition");let n;if(this.char()===",")if(this.index++,this.eof()&&this.fail("unclosed counted repetition"),this.char()!=="}"){const s=this.parseDecimal();(r===void 0||s===void 0)&&this.fail("repetition count is empty"),n=s}else r===void 0&&this.fail("repetition count is empty"),n=1/0;else r===void 0&&this.fail("repetition count is empty"),n=r;(this.eof()||this.char()!=="}")&&this.fail("unclosed counted repetition"),this.index++;let i=!0;!this.eof()&&this.char()==="?"&&(i=!1,this.index++),r>n&&this.fail("invalid repetition range"),this.repeatLast(e,r,n,i)}parseGroup(e){const t=this.index===0;this.index++;for(const r of["=","!","<=","<!"])if(this.startsWith(`?${r}`)){this.fancy=!0,this.index+=r.length+1;const n=this.parseGroupBody(e);return{kind:"look",op:r,body:n}}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");const r=this.flags,n=this.parseFlags(),i=this.char();if(this.index++,i===")")return n!==void 0&&(n&&t?this.caseInsensitive=!0:this.unsupported.push("`(?i)` anywhere but at the start of the pattern")),{kind:"flags"};n!==void 0&&this.unsupported.push("`(?i)` anywhere but at the start of the pattern");const s=this.parseGroupBody(e);return this.flags=r,{kind:"group",capture:!1,body:s}}return this.captures++,{kind:"group",capture:!0,body:this.parseGroupBody(e)}}parseGroupBody(e){const t=this.flags,r=this.parseAlternation(e+1);return this.eof()&&this.fail("unclosed group"),this.index++,this.flags=t,r}parseCaptureName(){this.eof()&&this.fail("unexpected end of group name");let e="";for(;!this.eof()&&this.char()!==">";){const 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(){const e=new Set;let t=!1,r=!1,n;const i={...this.flags};for(;this.char()!==":"&&this.char()!==")";){const s=this.char();if(s==="-")t&&this.fail("repeated negation in flags"),t=!0,r=!0;else{r=!1,Lb.has(s)||this.fail(`unrecognized flag "${s}"`),e.has(s)&&this.fail(`duplicate flag "${s}"`),e.add(s);const o=!t;s==="i"?n=o:s==="m"?i.multiLine=o:s==="s"?i.dotAll=o:s==="U"?i.swapGreed=o:s==="x"?this.unsupported.push("the `x` flag"):s==="R"?this.unsupported.push("the `R` flag"):s==="u"&&!o&&this.unsupported.push("turning off the `u` flag")}this.index++,this.eof()&&this.fail("unexpected end of flags")}return r&&this.fail("dangling flag negation"),e.size===0&&this.char()===")"&&this.fail("repetition operator missing expression"),this.flags=i,n}parsePrimitive(){const 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");const t=this.char();if(/[0-9]/.test(t)){this.fancy=!0;let n="";for(;!this.eof()&&/[0-9]/.test(this.char());)n+=this.chars[this.index++];return(e||n.startsWith("0"))&&this.unsupported.push(`\`\\${n}\``),{kind:"backref",index:Number(n)}}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++;const n=t.toLowerCase();return{kind:"class",item:{kind:"perl",perl:n,negated:t!==n}}}if(this.index++,jb(t))return{kind:"literal",char:t};const r={f:"\f",t:" ",n:`
|
|
3
3
|
`,r:"\r",v:"\v"};if(r[t]!==void 0)return{kind:"literal",char:r[t]};if(t==="a")return e||(this.bellOutsideClass=!0),{kind:"literal",char:"\x07"};if(t==="c"){const n=this.eof()?void 0:this.char();return(n===void 0||!/[A-Za-z]/.test(n))&&this.fail("invalid `\\c` escape"),this.index++,{kind:"literal",char:String.fromCharCode(n.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";const 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{const n=e==="x"?2:e==="u"?4:8;for(let i=0;i<n;i++)this.eof()&&this.fail("incomplete hex escape"),/[0-9A-Fa-f]/.test(this.char())||this.fail("invalid hex digit"),t+=this.chars[this.index++]}const r=parseInt(t,16);return(t.length>8||r>1114111||r>=55296&&r<=57343)&&this.fail("invalid Unicode scalar value"),String.fromCodePoint(r)}parseUnicodeClass(e){if(this.index++,this.eof()&&this.fail("incomplete Unicode class"),this.char()==="{"){this.index++;let r="";for(;!this.eof()&&this.char()!=="}";)r+=this.chars[this.index++];this.eof()&&this.fail("incomplete Unicode class"),this.index++;const n=r.indexOf("!=");return n>=0?{kind:"unicode",name:`${r.slice(0,n)}=${r.slice(n+2)}`,negated:!e}:{kind:"unicode",name:r.replace(":","="),negated:e}}const 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 r,n;const i=()=>{const s={kind:"union",items:t};return r===void 0?s:{kind:"op",op:n,lhs:r,rhs:s}};for(;;){this.eof()&&this.fail("unclosed class");const s=this.char();if(s==="["){const o=this.maybeParseAsciiClass();t.push(o??this.parseBracketed())}else{if(s==="]")return this.index++,{kind:"bracket",negated:e,set:i()};(s==="&"||s==="-"||s==="~")&&this.peek()===s?(r=i(),n=`${s}${s}`,t=[],this.index+=2):t.push(this.parseClassRange())}}}maybeParseAsciiClass(){const e=/^\[:(\^?)([^:]*):\]/.exec(this.chars.slice(this.index).join(""));if(!(!e||!Nb.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(){const 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");const 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"}}},sd={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}",Mb={d:"\\p{Nd}",s:"\\p{White_Space}",w:od};function Kt(e){return/^[A-Za-z0-9]$/.test(e)?e:`\\u{${e.codePointAt(0).toString(16)}}`}function ad(e){return e.map(([t,r])=>{const n=Kt(String.fromCodePoint(t));return t===r?n:`${n}-${Kt(String.fromCodePoint(r))}`}).join("")}var Db=class{constructor(e){this.parsed=e}emit(e){switch(e.kind){case"flags":return"";case"literal":return Kt(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 Jt(`backreference \`\\${e.index}\``);return`\\${e.index}(?:)`;case"repeat":{const{min:t,max:r}=e,n=r===1/0?t===0?"*":t===1?"+":`{${t},}`:t===0&&r===1?"?":t===r?`{${t}}`:`{${t},${r}}`;return`(?:${this.emit(e.body)})${n}${e.greedy?"":"?"}`}case"concat":return e.items.map(t=>this.emit(t)).join("");case"alternation":return e.items.map(t=>this.emit(t)).join("|")}}assertion(e,t){const r=`[${od}]`;switch(e){case"start":return t?"(?<![^\\n])":"^";case"end":return t?"(?![^\\n])":"$";case"startText":return"^";case"endText":return"$";case"wordBoundary":return`(?:(?<=${r})(?!${r})|(?<!${r})(?=${r}))`;case"notWordBoundary":return`(?:(?<=${r})(?=${r})|(?<!${r})(?!${r}))`;case"wordStart":return`(?<!${r})(?=${r})`;case"wordEnd":return`(?<=${r})(?!${r})`;case"wordStartHalf":return`(?<!${r})`;case"wordEndHalf":return`(?!${r})`}}item(e){switch(e.kind){case"literal":{const t=Kt(e.char);return{fragment:t,atom:`[${t}]`}}case"range":{const t=`${Kt(e.start)}-${Kt(e.end)}`;return{fragment:t,atom:`[${t}]`}}case"perl":return Xs(this.parsed.fancy?Mb[e.perl]:ad(sd[e.perl]),e.negated);case"ascii":return Xs(ad(sd[e.ascii]),e.negated);case"unicode":return Xs(Bb(e.name),e.negated);case"bracket":{const t=this.set(e.set);return e.negated?t.fragment!==void 0?{atom:`[^${t.fragment}]`}:{atom:`(?:(?!${t.atom})[^])`}:t}}}set(e){if(e.kind==="union"){const n=e.items.map(i=>this.item(i));if(n.every(i=>i.fragment!==void 0)){const i=n.map(s=>s.fragment).join("");return{fragment:i,atom:`[${i}]`}}return{atom:`(?:${n.map(i=>i.atom).join("|")})`}}const t=this.set(e.lhs).atom,r=this.set(e.rhs).atom;switch(e.op){case"&&":return{atom:`(?:(?=${t})${r})`};case"--":return{atom:`(?:(?!${r})${t})`};case"~~":return{atom:`(?:(?!${r})${t}|(?!${t})${r})`}}}};function Xs(e,t){return t?{atom:`[^${e}]`}:{fragment:e,atom:`[${e}]`}}function Bb(e){for(const t of[e,`Script=${e}`])try{return new RegExp(`\\p{${t}}`,"u"),`\\p{${t}}`}catch{}throw new Jt(`the Unicode class \`${e}\``)}function Fb(e){try{return new id(e).parse(),!0}catch(t){return t instanceof Jt}}var Wn=new Map,Ub=1024;function Qs(e){let t=Wn.get(e);if(t)return t;const r=new id(e).parse();if(r.fancyInvalid.length>0)throw new Un(r.fancyInvalid[0]);if(r.unsupported.length>0)throw new Jt(r.unsupported[0]);const n=new Db(r).emit(r.node);return t=new RegExp(n,r.caseInsensitive?"iu":"u"),Wn.size>=Ub&&Wn.clear(),Wn.set(e,t),t}function _t(e,t){const r=e.charCodeAt(t)-48,n=e.charCodeAt(t+1)-48;if(!(r<0||r>9||n<0||n>9))return r*10+n}function Wb(e){return e%4===0&&e%100!==0||e%400===0}function cd(e){if(e.length!==10||e[4]!=="-"||e[7]!=="-"||!/^[0-9]{4}$/.test(e.slice(0,4)))return!1;const t=Number(e.slice(0,4)),r=_t(e,5),n=_t(e,8);return r===void 0||r<1||r>12||n===void 0||n===0?!1:r===2?n<=(Wb(t)?29:28):n<=([4,6,9,11].includes(r)?30:31)}function ld(e){if(e.length<9||e[2]!==":"||e[5]!==":")return!1;const t=_t(e,0),r=_t(e,3),n=_t(e,6);if(t===void 0||r===void 0||n===void 0||t>23||r>59||n>60)return!1;let i=8;if(e[i]==="."){i++;const f=i;for(;i<e.length&&e.charCodeAt(i)>=48&&e.charCodeAt(i)<=57;)i++;if(i===f)return!1}if(i===e.length)return!1;const s=e[i];if(s==="Z"||s==="z")return i===e.length-1&&(n!==60||t===23&&r===59);if(s!=="+"&&s!=="-"||e.length-i!==6||e[i+3]!==":")return!1;const o=_t(e,i+1),a=_t(e,i+4);if(o===void 0||a===void 0||o>23||a>59)return!1;if(n!==60)return!0;const c=s==="+"?-1:1;let l=t+c*o,u=r+c*a;return l+=Math.trunc(u/60),u%=60,u<0&&(u+=60,l-=1),l=(l+24)%24,l===23&&u===59}function zb(e){const t=e.search(/[Tt]/);return t<0?!1:cd(e.slice(0,t))&&ld(e.slice(t+1))}var ud="(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])",dd=`${ud}(?:\\.${ud}){3}`,X="[0-9A-Fa-f]{1,4}",gt=`(?:${X}:${X}|${dd})`,fd=[`(?:${X}:){6}${gt}`,`::(?:${X}:){5}${gt}`,`(?:${X})?::(?:${X}:){4}${gt}`,`(?:(?:${X}:){0,1}${X})?::(?:${X}:){3}${gt}`,`(?:(?:${X}:){0,2}${X})?::(?:${X}:){2}${gt}`,`(?:(?:${X}:){0,3}${X})?::${X}:${gt}`,`(?:(?:${X}:){0,4}${X})?::${gt}`,`(?:(?:${X}:){0,5}${X})?::${X}`,`(?:(?:${X}:){0,6}${X})?::`].map(e=>`(?:${e})`).join("|"),qb=new RegExp(`^${dd}$`),Vb=new RegExp(`^(?:${fd})$`),pd=e=>qb.test(e),hd=e=>Vb.test(e);function md(e){if(e.length===0||e.length>253||e.endsWith(".")||!/^[A-Za-z0-9.-]*$/.test(e))return!1;const t=e.split(".");for(const r of t){if(r.length===0||r.length>63||r.startsWith("-")||r.endsWith("-"))return!1;const n=r.startsWith("xn--");if(r.slice(2,4)==="--"&&!n)return!1;if(n){const i=Hb(r.slice(4));if(i===void 0||!Qb(i))return!1}}return!0}var yt=36,zn=1,Ys=26,qn=4294967295;function Gb(e,t,r){let n=Math.trunc(e/(r?700:2));n+=Math.trunc(n/t);let i=0;for(;n>(yt-zn)*Ys>>1;)n=Math.trunc(n/(yt-zn)),i+=yt;return i+Math.trunc((yt-zn+1)*n/(n+38))}function Hb(e){const t=e.lastIndexOf("-"),r=t>0?e.slice(0,t):"",n=t>0?e.slice(t+1):e,i=[...r].map(l=>l.charCodeAt(0));let s=128,o=72,a=0,c=0;for(;c<n.length;){const l=a;let u=1;for(let p=yt;;p+=yt){if(c>=n.length)return;const g=Jb(n.charCodeAt(c++));if(g===void 0||(a+=g*u,g*u>qn||a>qn))return;const m=p<=o?zn:p>=o+Ys?Ys:p-o;if(g<m)break;if(u*=yt-m,u>qn)return}const f=i.length+1;if(o=Gb(a-l,f,l===0),s+=Math.trunc(a/f),s>qn||(a%=f,s>1114111||s>=55296&&s<=57343))return;i.splice(a,0,s),a++}return String.fromCodePoint(...i)}function Jb(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 Kb=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))),Xb=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347].map(e=>String.fromCodePoint(e)));function Qb(e){const t=[...e];if(t.length>0&&/^\p{M}/u.test(t[0]))return!1;let r=!1,n=!1,i=!1,s=!1;for(let o=0;o<t.length;o++){const a=t[o],c=t[o-1],l=t[o+1],u=a.codePointAt(0);if(a==="\u200D"){if(c===void 0||!Kb.has(c))return!1}else if(a==="\xB7"){if(c!=="l"||l!=="l")return!1}else if(a==="\u0375"){const f=l?.codePointAt(0);if(f===void 0||f<880||f>1023)return!1}else if(a==="\u05F3"||a==="\u05F4"){const f=c?.codePointAt(0);if(f===void 0||f<1424||f>1535)return!1}else if(a==="\u30FB")r=!0;else if(u>=12352&&u<=12447||u>=12448&&u<=12543||u>=19968&&u<=40959)n=!0;else if(u>=1632&&u<=1641)i=!0;else if(u>=1776&&u<=1785)s=!0;else if(Xb.has(a))return!1}return!(r&&!n||i&&s)}var Yb=new TextEncoder;function Zs(e){return Yb.encode(e).length}function eo(e){const t=e.codePointAt(0),r=t>>>24,n=t>>>16&255,i=t>>>8&255,s=t&255,o=a=>a>=128&&a<=191;return r===0&&n===0?i>=194&&i<=223&&o(s):r===0?n===224?i>=160&&i<=191&&o(s):n>=225&&n<=236?o(i)&&o(s):n===237?i>=128&&i<=159&&o(s):n===238||n===239?o(i)&&o(s):!1:r===240?n>=144&&n<=191&&o(i)&&o(s):r>=241&&r<=243?o(n)&&o(i)&&o(s):r===244?n>=128&&n<=143&&o(i)&&o(s):!1}var to=/^[\p{Alphabetic}\p{N}]$/u,Zb=new Set("!#$%&'*+-/=?^_`{|}~");function ew(e){return to.test(e)||Zb.has(e)||eo(e)}function _d(e){return e.length>0&&[...e].every(ew)}function tw(e){const t=[...e];for(let r=0;r<t.length;r++){const n=t[r],i=n.codePointAt(0);if(n==="\\"){const s=t[++r]?.codePointAt(0);if(s===void 0||s<33||s>126)return!1}else if(!(n===" "||n===" "||i===33||i>=35&&i<=91||i>=93&&i<=126||eo(n)))return!1}return!0}function rw(e){const t=e.codePointAt(0);return t>=33&&t<=90||t>=94&&t<=126||eo(e)}function gd(e){return e.replace(/^\p{White_Space}+|\p{White_Space}+$/gu,"")}function nw(e){let t=e,r="";const n=e.lastIndexOf(" <");if(n>=0){const a=gd(e.slice(n+2));if(!a.endsWith(">"))return!1;t=a.slice(0,-1),r=gd(e.slice(0,n))}const i=t.lastIndexOf("@");if(i<0)return!1;const s=t.slice(0,i),o=t.slice(i+1);if(r===""&&s.startsWith("<")||s.length===0||Zs(s)>64)return!1;if(s.startsWith('"')&&s.endsWith('"')){if(s.length<=2||!tw(s.slice(1,-1)))return!1}else if(!s.split(".").every(_d))return!1;if(o.length===0||Zs(o)>254)return!1;if(o.startsWith("[")&&o.endsWith("]")){const a=o.slice(1,-1);return[...a].every(rw)?a.startsWith("IPv6:")?hd(a.slice(5)):pd(a):!1}for(const a of o.split(".")){const c=[...a];if(c.length===0||!to.test(c[0])||!to.test(c[c.length-1])||Zs(a)>63||!_d(a))return!1}return md(o)}var Dr="A-Za-z0-9\\-._~",Br="!$&'()*+,;=",Vn="%[0-9A-Fa-f]{2}",ro=`(?:[${Dr}${Br}:@]|${Vn})`,Gn=`${ro}*`,yd=`${ro}+`,iw=`(?:[${Dr}${Br}@]|${Vn})+`,sw=`\\[(?:${fd}|[vV][0-9A-Fa-f]+\\.[${Dr}${Br}:]+)\\]`,ow=`(?:[${Dr}${Br}]|${Vn})*`,aw=`(?:[${Dr}${Br}:]|${Vn})*`,bd=`(?:${aw}@)?(?:${sw}|${ow})(?::[0-9]*)?`,wd=`(?:/${Gn})*`,vd=`/(?:${yd}(?:/${Gn})*)?`,cw=`${yd}(?:/${Gn})*`,lw=`${iw}(?:/${Gn})*`,Sd=`(?:${ro}|[/?])*`,Ed="[A-Za-z][A-Za-z0-9+\\-.]*",Ad=`(?://${bd}${wd}|${vd}|${cw}|)`,uw=`(?://${bd}${wd}|${vd}|${lw}|)`,Td=`(?:\\?${Sd})?(?:#${Sd})?`,dw=new RegExp(`^${Ed}:${Ad}${Td}$`),fw=new RegExp(`^(?:${Ed}:${Ad}|${uw})${Td}$`);function Rd(e){return e===""||/^(?:\/(?:[^~/]|~[01])*)+$/.test(e)}function pw(e){const t=/^(0|[1-9][0-9]*)(.*)$/s.exec(e);if(!t)return!1;const r=t[2];return r===""||r==="#"||r.startsWith("/")&&Rd(r)}var hw=new Set("+#./;?&=,!@|"),mw=new Set("\"'<>%\\^`{|}");function _w(e){let t=0;const r=a=>/^[0-9A-Fa-f]$/.test(e[a]??""),n=a=>/^[A-Za-z0-9_]$/.test(e[a]??""),i=()=>{const a=t;for(;t<e.length;)if(n(t))t++;else if(e[t]==="%"){if(t+2>=e.length||!r(t+1)||!r(t+2))return!1;t+=3}else break;return t>a},s=()=>{if(!i())return!1;for(;t<e.length;)if(e[t]==="."){if(t++,!i())return!1}else if(n(t)||e[t]==="%"){if(!i())return!1}else break;return!0},o=()=>{if(!s())return!1;if(e[t]===":"){if(t++,!/^[1-9]$/.test(e[t]??""))return!1;t++;for(let a=1;a<4&&/^[0-9]$/.test(e[t]??"");a++)t++}else e[t]==="*"&&t++;return!0};for(;t<e.length;){const a=e[t];if(a==="{"){if(t++,t>=e.length||hw.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(a==="}")return!1;if(a==="%"){if(t+2>=e.length||!r(t+1)||!r(t+2))return!1;t+=3}else{const c=e.charCodeAt(t);if(c<=32||c===127||mw.has(a))return!1;t++}}}return!0}var gw={date:cd,"date-time":zb,email:nw,hostname:md,ipv4:pd,ipv6:hd,"json-pointer":Rd,regex:Fb,"relative-json-pointer":pw,time:ld,uri:e=>dw.test(e),"uri-reference":e=>fw.test(e),"uri-template":_w},nt=class{constructor(e){this.value=e}},yw=2n**64n-1n,bw=-(2n**63n),no=/-?(?:0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/y,io=/[ \t\n\r]*/y;function Id(e){let t=0;const r=()=>{throw new SyntaxError(`invalid JSON at position ${t}`)},n=()=>{io.lastIndex=t,io.test(e),t=io.lastIndex},i=()=>{const c=t;t++;let l=!1;for(;t<e.length;){const u=e.charCodeAt(t);if(u===34){t++;const f=e.slice(c,t);return l?JSON.parse(f):f.slice(1,-1)}u===92?(l=!0,t++):u<32&&r(),t++}return r()},s=()=>{no.lastIndex=t;const c=no.exec(e);if(!c)return r();t=no.lastIndex;const l=c[0],u=Number(l);if(c[1]!==void 0||c[2]!==void 0)return Number.isInteger(u)?new nt(u):u;if(Object.is(u,-0))return new nt(u);if(Number.isSafeInteger(u))return u;const f=BigInt(l);return f<bw||f>yw?new nt(u):BigInt(u)===f?u:f},o=()=>{n();const c=e[t];if(c==="{"){t++;const l=Object.create(null);if(n(),e[t]==="}")return t++,l;for(;;){n(),e[t]!=='"'&&r();const u=i();if(n(),e[t]!==":"&&r(),t++,l[u]=o(),n(),e[t]===",")t++;else{if(e[t]==="}")return t++,l;r()}}}if(c==="["){t++;const l=[];if(n(),e[t]==="]")return t++,l;for(;;)if(l.push(o()),n(),e[t]===",")t++;else{if(e[t]==="]")return t++,l;r()}}return c==='"'?i():e.startsWith("true",t)?(t+=4,!0):e.startsWith("false",t)?(t+=5,!1):e.startsWith("null",t)?(t+=4,null):s()},a=o();return n(),t!==e.length&&r(),a}function Hn(e){return typeof e=="number"||typeof e=="bigint"||e instanceof nt}function Fr(e){return e instanceof nt?e.value:e}function ww(e,t){return typeof e=="bigint"?!0:e instanceof nt?!t:Number.isInteger(e)}function Jn(e){if(typeof e=="bigint")return e.toString();if(e instanceof nt){if(Object.is(e.value,-0))return"-0.0";const t=Number.isSafeInteger(e.value)?String(e.value):kd(e.value);return/[.e]/.test(t)?t:`${t}.0`}return typeof e=="number"&&Number.isInteger(e)?kd(e):Array.isArray(e)?`[${e.map(Jn).join(",")}]`:typeof e=="object"&&e!==null?`{${Object.entries(e).map(([t,r])=>`${JSON.stringify(t)}:${Jn(r)}`).join(",")}}`:JSON.stringify(e)}function kd(e){return Number.isFinite(e)&&Math.abs(e)<1e21?BigInt(e).toString():String(e)}function so(e){if(e instanceof nt)return e.value;if(Array.isArray(e))return e.map(so);if(typeof e!="object"||e===null)return e;const t=Object.create(null);for(const[r,n]of Object.entries(e))t[r]=so(n);return t}function Ur(e,t){if(Hn(e)){if(!Hn(t))return!1;const r=Fr(e),n=Fr(t);return r==n}if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((r,n)=>Ur(r,t[n]));if(typeof e=="object"&&e!==null){if(typeof t!="object"||t===null||Array.isArray(t)||Hn(t))return!1;const r=Object.keys(e);return r.length!==Object.keys(t).length?!1:r.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&Ur(e[n],t[n]))}return e===t}function vw(e,t){const r=Number(Fr(e)),n=Number(Fr(t));if(Number.isInteger(n))return Number.isInteger(r)&&r%n===0;if(r===0)return!0;if(r<n)return!1;const[i,s]=xd(r),[o,a]=xd(n);if(o===0n)return!0;const c=s*o;return i*a%c===0n}function xd(e){let t=0,r=e;for(;!(Math.abs(Math.floor(r)-r)<Number.EPSILON);)if(t++,r=e*Pd(10,t),!Number.isFinite(r))return Sw(e);const n=BigInt(Math.trunc(Math.abs(r)));return[e<0?-n:n,BigInt(Pd(10,t))]}function Pd(e,t){let r=1,n=e;for(let i=t;i&1&&(r*=n),i=Math.trunc(i/2),i!==0;)n*=n;return r}function Sw(e){const[t,r]=Math.abs(e).toExponential().split("e"),[n,i=""]=t.split("."),s=Number(r)-i.length;let o=BigInt(n+i),a=1n;return s>=0?o*=10n**BigInt(s):a=10n**BigInt(-s),[e<0?-o:o,a]}var Ew={additionalItems:!0,unevaluatedItems:!0,items:!0,contains:!0,additionalProperties:!0,unevaluatedProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Aw={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Tw={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Rw=new URL("json-schema:///");function Fe(e){return encodeURI(e.replace(/~/g,"~0").replace(/\//g,"~1"))}function Kn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Wr(e,t=Object.create(null),r=[],n=Rw,i=!0){const s=(a,c)=>{t[a]===void 0&&(t[a]=c)};if(typeof e=="boolean")return i&&s(n.href,e),t;if(!Kn(e))return t;const o=e.$id??e.id;if(typeof o=="string"){const a=new URL(o,n.href);a.hash.length>1||(a.hash="",n=a),s(a.href,e)}if(i&&s(n.href,e),typeof e.$ref=="string"&&e.__absolute_ref__===void 0){const a=new URL(e.$ref,n.href);a.hash=a.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:a.href}),r.push(a.href)}if(typeof e.$recursiveRef=="string"&&e.__absolute_recursive_ref__===void 0){const a=new URL(e.$recursiveRef,n.href);a.hash=a.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:a.href})}typeof e.$anchor=="string"&&s(new URL("#"+e.$anchor,n.href).href,e);for(const a in e){const c=e[a];if(Aw[a]&&Array.isArray(c))for(const l of c)Wr(l,t,r,n,!1);else if(Ew[a])Wr(c,t,r,n,!1);else if((Tw[a]||a==="dependencies")&&Kn(c))for(const l in c)Wr(c[l],t,r,n,!1)}return t}function oo(e,t){const r=e[t];if(r!==void 0)return r;const n=t.indexOf("#");if(n<0)return;let i=e[t.slice(0,n)];const s=t.slice(n+1);if(!(i===void 0||!s.startsWith("/"))){for(const o of s.slice(1).split("/")){let a;try{a=decodeURIComponent(o).replace(/~1/g,"/").replace(/~0/g,"~")}catch{return}if(Array.isArray(i)){if(!/^(?:0|[1-9][0-9]*)$/.test(a))return;i=i[Number(a)]}else if(Kn(i)&&Object.prototype.hasOwnProperty.call(i,a))i=i[a];else return}return typeof i=="boolean"||Kn(i)?i:void 0}}function Iw(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);n>=55296&&n<=56319&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320&&r++,t++}return t}function kw(e){if(e===null)return"null";if(Hn(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 new Error(`Instances of "${typeof e}" type are not supported.`)}}function xw(e,t,r,n,i){return K(e,t,{draft:r,lookup:n,shortCircuit:i},null,"#","#")}function K(e,t,r,n,i,s,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."}]};const{draft:a,lookup:c,shortCircuit:l}=r,u=kw(e),{$ref:f,$recursiveRef:p,$recursiveAnchor:g,type:m,const:b,enum:$,required:O,not:C,anyOf:N,allOf:te,oneOf:V,if:le,then:ge,else:ye,format:be,properties:oe,patternProperties:Z,additionalProperties:B,unevaluatedProperties:h,minProperties:T,maxProperties:W,propertyNames:G,dependentRequired:F,dependentSchemas:we,dependencies:Ce,prefixItems:Ci,items:mr,additionalItems:Sa,unevaluatedItems:Ea,contains:Aa,minContains:Ne,maxContains:fn,minItems:Oi,maxItems:$i,uniqueItems:Ch,minimum:dt,maximum:ft,exclusiveMinimum:_r,exclusiveMaximum:gr,multipleOf:Li,minLength:pn,maxLength:hn,pattern:Ta,__absolute_ref__:Oh,__absolute_recursive_ref__:$h}=t,A=[];if(g===!0&&n===null&&(n=t),p==="#"){const S=n===null?oo(c,$h):n,L=`${s}/$recursiveRef`,P=K(e,n===null?t:n,r,S,i,L,o);P.valid||A.push({instanceLocation:i,keyword:"$recursiveRef",keywordLocation:L,error:"A subschema had errors."},...P.errors)}if(f!==void 0){const S=oo(c,Oh??f);if(S===void 0)throw new Error(`Unresolved $ref "${f}".`);const L=`${s}/$ref`,P=K(e,S,r,n,i,L,o);if(P.valid||A.push({instanceLocation:i,keyword:"$ref",keywordLocation:L,error:"A subschema had errors."},...P.errors),a==="4"||a==="6"||a==="7")return{valid:A.length===0,errors:A}}const Ra=u==="number"&&ww(e,a==="4");if(Array.isArray(m)?m.some(L=>L===u||L==="integer"&&Ra)||A.push({instanceLocation:i,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${u}" is invalid. Expected "${m.join('", "')}".`}):m==="integer"?Ra||A.push({instanceLocation:i,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${u}" is invalid. Expected "${m}".`}):m!==void 0&&u!==m&&A.push({instanceLocation:i,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${u}" is invalid. Expected "${m}".`}),b!==void 0&&!Ur(e,b)&&A.push({instanceLocation:i,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${Jn(b)}.`}),$!==void 0&&!$.some(S=>Ur(e,S))&&A.push({instanceLocation:i,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${Jn($)}.`}),C!==void 0){const S=`${s}/not`;K(e,C,r,n,i,S).valid&&A.push({instanceLocation:i,keyword:"not",keywordLocation:S,error:'Instance matched "not" schema.'})}const mn=[];if(N!==void 0){const S=`${s}/anyOf`,L=A.length;let P=!1;for(let D=0;D<N.length;D++){const k=Object.create(o),v=K(e,N[D],r,g===!0?n:null,i,`${S}/${D}`,k);A.push(...v.errors),P=P||v.valid,v.valid&&mn.push(k)}P?A.length=L:A.splice(L,0,{instanceLocation:i,keyword:"anyOf",keywordLocation:S,error:"Instance does not match any subschemas."})}if(te!==void 0){const S=`${s}/allOf`,L=A.length;let P=!0;for(let D=0;D<te.length;D++){const k=Object.create(o),v=K(e,te[D],r,g===!0?n:null,i,`${S}/${D}`,k);A.push(...v.errors),P=P&&v.valid,v.valid&&mn.push(k)}P?A.length=L:A.splice(L,0,{instanceLocation:i,keyword:"allOf",keywordLocation:S,error:"Instance does not match every subschema."})}if(V!==void 0){const S=`${s}/oneOf`,L=A.length,P=V.filter((D,k)=>{const v=Object.create(o),j=K(e,D,r,g===!0?n:null,i,`${S}/${k}`,v);return A.push(...j.errors),j.valid&&mn.push(v),j.valid}).length;P===1?A.length=L:A.splice(L,0,{instanceLocation:i,keyword:"oneOf",keywordLocation:S,error:`Instance does not match exactly one subschema (${P} matches).`})}if((u==="object"||u==="array")&&Object.assign(o,...mn),le!==void 0){const S=`${s}/if`,L=Object.create(o);if(K(e,le,r,n,i,S,L).valid){if(Object.assign(o,L),ge!==void 0){const D=K(e,ge,r,n,i,`${s}/then`,o);D.valid||A.push({instanceLocation:i,keyword:"if",keywordLocation:S,error:'Instance does not match "then" schema.'},...D.errors)}}else if(ye!==void 0){const D=K(e,ye,r,n,i,`${s}/else`,o);D.valid||A.push({instanceLocation:i,keyword:"if",keywordLocation:S,error:'Instance does not match "else" schema.'},...D.errors)}}if(u==="object"){const S=e;if(O!==void 0)for(const k of O)k in S||A.push({instanceLocation:i,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${k}".`});const L=Object.keys(S);if(T!==void 0&&L.length<T&&A.push({instanceLocation:i,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${T} properties.`}),W!==void 0&&L.length>W&&A.push({instanceLocation:i,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance has more than ${W} properties.`}),G!==void 0){const k=`${s}/propertyNames`;for(const v in S){const j=`${i}/${Fe(v)}`,q=K(v,G,r,n,j,k);q.valid||A.push({instanceLocation:i,keyword:"propertyNames",keywordLocation:k,error:`Property name "${v}" does not match schema.`},...q.errors)}}if(F!==void 0){const k=`${s}/dependentRequired`;for(const v in F)if(v in S)for(const j of F[v])j in S||A.push({instanceLocation:i,keyword:"dependentRequired",keywordLocation:k,error:`Instance has "${v}" but does not have "${j}".`})}if(we!==void 0)for(const k in we){const v=`${s}/dependentSchemas`;if(k in S){const j=K(e,we[k],r,n,i,`${v}/${Fe(k)}`,o);j.valid||A.push({instanceLocation:i,keyword:"dependentSchemas",keywordLocation:v,error:`Instance has "${k}" but does not match dependant schema.`},...j.errors)}}if(Ce!==void 0){const k=`${s}/dependencies`;for(const v in Ce)if(v in S){const j=Ce[v];if(Array.isArray(j))for(const q of j)q in S||A.push({instanceLocation:i,keyword:"dependencies",keywordLocation:k,error:`Instance has "${v}" but does not have "${q}".`});else{const q=K(e,j,r,n,i,`${k}/${Fe(v)}`);q.valid||A.push({instanceLocation:i,keyword:"dependencies",keywordLocation:k,error:`Instance has "${v}" but does not match dependant schema.`},...q.errors)}}}const P=Object.create(null);let D=!1;if(oe!==void 0){const k=`${s}/properties`;for(const v in oe){if(!(v in S))continue;const j=`${i}/${Fe(v)}`,q=K(S[v],oe[v],r,n,j,`${k}/${Fe(v)}`);if(q.valid)o[v]=P[v]=!0;else if(D=l,A.push({instanceLocation:i,keyword:"properties",keywordLocation:k,error:`Property "${v}" does not match schema.`},...q.errors),D)break}}if(!D&&Z!==void 0){const k=`${s}/patternProperties`;for(const v in Z){const j=Qs(v),q=Z[v];for(const je in S){if(!j.test(je))continue;const Lh=`${i}/${Fe(je)}`,Ia=K(S[je],q,r,n,Lh,`${k}/${Fe(v)}`);Ia.valid?o[je]=P[je]=!0:(D=l,A.push({instanceLocation:i,keyword:"patternProperties",keywordLocation:k,error:`Property "${je}" matches pattern "${v}" but does not match associated schema.`},...Ia.errors))}}}if(!D&&B!==void 0){const k=`${s}/additionalProperties`;for(const v in S){if(P[v])continue;const j=`${i}/${Fe(v)}`,q=K(S[v],B,r,n,j,k);q.valid?o[v]=!0:(D=l,A.push({instanceLocation:i,keyword:"additionalProperties",keywordLocation:k,error:`Property "${v}" does not match additional properties schema.`},...q.errors))}}else if(!D&&h!==void 0){const k=`${s}/unevaluatedProperties`;for(const v in S)if(!o[v]){const j=`${i}/${Fe(v)}`,q=K(S[v],h,r,n,j,k);q.valid?o[v]=!0:A.push({instanceLocation:i,keyword:"unevaluatedProperties",keywordLocation:k,error:`Property "${v}" does not match unevaluated properties schema.`},...q.errors)}}}else if(u==="array"){const S=e,L=S.length;$i!==void 0&&L>$i&&A.push({instanceLocation:i,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${L} > ${$i}).`}),Oi!==void 0&&L<Oi&&A.push({instanceLocation:i,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${L} < ${Oi}).`});let P=0,D=!1;if(Ci!==void 0){const k=`${s}/prefixItems`,v=Math.min(Ci.length,L);for(;P<v;P++){const j=K(S[P],Ci[P],r,n,`${i}/${P}`,`${k}/${P}`);if(o[P]=!0,!j.valid&&(D=l,A.push({instanceLocation:i,keyword:"prefixItems",keywordLocation:k,error:"Items did not match schema."},...j.errors),D))break}}if(mr!==void 0){const k=`${s}/items`;if(Array.isArray(mr)){const v=Math.min(mr.length,L);for(;P<v;P++){const j=K(S[P],mr[P],r,n,`${i}/${P}`,`${k}/${P}`);if(o[P]=!0,!j.valid&&(D=l,A.push({instanceLocation:i,keyword:"items",keywordLocation:k,error:"Items did not match schema."},...j.errors),D))break}}else for(;P<L;P++){const v=K(S[P],mr,r,n,`${i}/${P}`,k);if(o[P]=!0,!v.valid&&(D=l,A.push({instanceLocation:i,keyword:"items",keywordLocation:k,error:"Items did not match schema."},...v.errors),D))break}if(!D&&Sa!==void 0){const v=`${s}/additionalItems`;for(;P<L;P++){const j=K(S[P],Sa,r,n,`${i}/${P}`,v);o[P]=!0,j.valid||(D=l,A.push({instanceLocation:i,keyword:"additionalItems",keywordLocation:v,error:"Items did not match additional items schema."},...j.errors))}}}if(Aa!==void 0)if(L===0&&Ne===void 0)A.push({instanceLocation:i,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(Ne!==void 0&&L<Ne)A.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${L}) than minContains (${Ne}).`});else{const k=`${s}/contains`,v=A.length;let j=0;for(let q=0;q<L;q++){const je=K(S[q],Aa,r,n,`${i}/${q}`,k);je.valid?(o[q]=!0,j++):A.push(...je.errors)}j>=(Ne||0)&&(A.length=v),Ne===void 0&&fn===void 0&&j===0?A.splice(v,0,{instanceLocation:i,keyword:"contains",keywordLocation:k,error:"Array does not contain item matching schema."}):Ne!==void 0&&j<Ne?A.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${Ne} items matching schema. Only ${j} items were found.`}):fn!==void 0&&j>fn&&A.push({instanceLocation:i,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${fn} items matching schema. ${j} items were found.`})}if(!D&&Ea!==void 0){const k=`${s}/unevaluatedItems`;for(;P<L;P++){if(o[P])continue;const v=K(S[P],Ea,r,n,`${i}/${P}`,k);o[P]=!0,v.valid||A.push({instanceLocation:i,keyword:"unevaluatedItems",keywordLocation:k,error:"Items did not match unevaluated items schema."},...v.errors)}}if(Ch){e:for(let k=0;k<L;k++)for(let v=k+1;v<L;v++)if(Ur(S[k],S[v])){A.push({instanceLocation:i,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${k} and ${v}.`});break e}}}else if(u==="number"){const S=Fr(e);a==="4"?(dt!==void 0&&(_r===!0&&S<=dt||S<dt)&&A.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${S} is less than ${_r?"or equal to ":""}${dt}.`}),ft!==void 0&&(gr===!0&&S>=ft||S>ft)&&A.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${S} is greater than ${gr?"or equal to ":""}${ft}.`})):(dt!==void 0&&S<dt&&A.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${S} is less than ${dt}.`}),ft!==void 0&&S>ft&&A.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${S} is greater than ${ft}.`}),_r!==void 0&&S<=_r&&A.push({instanceLocation:i,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${S} is less than or equal to ${_r}.`}),gr!==void 0&&S>=gr&&A.push({instanceLocation:i,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${S} is greater than or equal to ${gr}.`})),Li!==void 0&&!vw(e,Li)&&A.push({instanceLocation:i,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${S} is not a multiple of ${Li}.`})}else if(u==="string"){const S=e,L=pn===void 0&&hn===void 0?0:Iw(S);pn!==void 0&&L<pn&&A.push({instanceLocation:i,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${L} < ${pn}).`}),hn!==void 0&&L>hn&&A.push({instanceLocation:i,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${L} > ${hn}).`}),Ta!==void 0&&!Qs(Ta).test(S)&&A.push({instanceLocation:i,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."});const P=be===void 0?void 0:gw[be];P&&!P(S)&&A.push({instanceLocation:i,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${be}".`})}return{valid:A.length===0,errors:A}}var zr={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"}}}]},Pw={"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"},Cw=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"]),Xn={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"]},ao={...Xn,single:[...Xn.single,"contains","propertyNames"],plain:[...Xn.plain.filter(e=>e!=="id"),"$id","const"]},qr={...ao,single:[...ao.single,"if","then","else"]},Qn={single:[...qr.single,"unevaluatedItems","unevaluatedProperties"],array:qr.array,map:[...qr.map,"$defs","dependentSchemas"],plain:[...qr.plain.filter(e=>e!=="format"),"$anchor","$recursiveAnchor","$recursiveRef","dependentRequired","maxContains","minContains"]},Ow={single:Qn.single.filter(e=>e!=="additionalItems"),array:["allOf","anyOf","oneOf","prefixItems"],map:Qn.map,plain:Qn.plain.filter(e=>e!=="$recursiveAnchor"&&e!=="$recursiveRef")},$w={4:Xn,6:ao,7:qr,"2019-09":Qn,"2020-12":Ow},Lw={4:[],6:["contentMediaType"],7:["contentMediaType"],"2019-09":[],"2020-12":["$dynamicAnchor","$dynamicRef"]},Cd=["date","date-time","email","hostname","idn-email","ipv4","ipv6","regex","time","uri"],Od=[...Cd,"json-pointer","uri-reference","uri-template"],Nw={4:Cd,6:Od,7:[...Od,"idn-hostname","iri","iri-reference","relative-json-pointer"]},jw=["idn-email","idn-hostname","iri","iri-reference"],Mw={base64:$d("A-Za-z0-9+/"),base64url:$d("A-Za-z0-9\\-_"),base32:Ld("A-Z2-7","AEIMQUY4","AQ","ACEGIKMOQSUWY246","AIQY"),base32hex:Ld("0-9A-V","048CGKOS","0G","02468ACEGIKMOQSU","08GO"),base16:"^(?:[0-9A-Fa-f]{2})*$"};function $d(e){const t=`[${e}]`;return`^(?:${t}{4})*(?:${t}[AQgw]==|${t}{2}[AEIMQUYcgkosw048]=)?$`}function Ld(e,t,r,n,i){const s=`[${e}]`;return`^(?:${s}{8})*(?:${s}[${t}]={6}|${s}{3}[${r}]={4}|${s}{4}[${n}]={3}|${s}{6}[${i}]=)?$`}var it=class extends Error{};function Dw(e){if(!mt(e))return"2020-12";const t=e.$schema;if(typeof t!="string")return"2020-12";const r=t.replace(/#+$/,"").replace(/^https?:\/\//,""),n=Pw[r];if(!n)throw new it(`unknown JSON Schema dialect "${t}"`);return n}function Xt(e,t,r=[]){if(typeof e=="boolean")return e;if(!mt(e))return{};const n=$w[t],i=new Set([...n.single,...n.array,...n.map,...n.plain,...r]),s=typeof e.$ref=="string"&&["4","6","7"].includes(t),o=[];for(const[c,l]of Object.entries(e)){if(Lw[t].includes(c)&&!r.includes(c))throw new it(`the \`${c}\` keyword is not supported by the browser runtime yet`);if(!(Cw.has(c)&&(!i.has(c)||s&&c!=="$ref"))){if(c==="pattern"&&typeof l=="string"&&Nd(l),c==="patternProperties"&&mt(l))for(const u of Object.keys(l))Nd(u);if(c==="format"&&typeof l=="string"){if(!Nw[t]?.includes(l))continue;if(jw.includes(l))throw new it(`the "${l}" format is not supported by the browser runtime yet`)}n.array.includes(c)&&Array.isArray(l)?o.push([c,l.map(u=>Xt(u,t,r))]):n.single.includes(c)?o.push([c,Xt(l,t,r)]):n.map.includes(c)&&mt(l)?o.push([c,Bw(l,t,r)]):o.push([c,l])}}const a=e.contentEncoding;if(!s&&(t==="6"||t==="7")&&typeof a=="string"){const c=Mw[a];if(c){const l=o.find(([u])=>u==="allOf");l?l[1]=[...l[1],{pattern:c}]:o.push(["allOf",[{pattern:c}]])}}return Object.fromEntries(o)}function Bw(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Array.isArray(i)?i:Xt(i,t,r)]))}function Nd(e){try{Qs(e)}catch(t){throw t instanceof Un?new it(`"${e}" is not a valid regular expression: ${t.message}`):t instanceof Jt?new it(`the regular expression "${e}" is not supported by the browser runtime yet: ${t.message}`):t}}function Fw(e){for(const t of e.references)if(oo(e.lookup,t)===void 0)throw new it(`unresolvable reference "${decodeURI(t.replace(/^json-schema:\/\/\//,""))}"`)}function co(e){if(Array.isArray(e))return e.map(co);if(!mt(e))return e;const t=[];for(const[r,n]of Object.entries(e))r==="$dynamicAnchor"?t.push(["$recursiveAnchor",!0]):r==="$dynamicRef"?t.push(["$recursiveRef","#"]):t.push([r,co(n)]);return Object.fromEntries(t)}var Uw={4:zr.draft4,6:zr.draft6,7:zr.draft7,"2019-09":zr.draft201909,"2020-12":zr.draft202012};function jd(e){return Uw[e].map(t=>e==="2020-12"?co(Xt(t,e,["$dynamicAnchor","$dynamicRef"])):Xt(t,e))}var Md=class{constructor(e,t,r,n){this.schema=e,this.dialect=t,this.shortCircuit=r,this.lookup=Wr(e,void 0,this.references);for(const i of n)Wr(i,this.lookup)}lookup;references=[];validate(e){return xw(e,this.schema,this.dialect,this.lookup,this.shortCircuit)}},Dd=new Map;function Ww(e){let t=Dd.get(e);if(!t){const[r,...n]=jd(e);t=new Md(r,e,!1,n),Dd.set(e,t)}return t}function Bd(e){const t=e[e.length-1];if(!t)return"value does not match the schema";const r=t.instanceLocation.replace(/^#/,"");return r?`${t.error} (at ${r})`:t.error}function zw(e){const t=Dw(e);if(typeof e=="boolean"){if(t==="4")throw new it("boolean schemas need draft 6 or later")}else{const i=Ww(t).validate(e);if(!i.valid)throw new it(Bd(i.errors))}const r=Xt(so(e),t),n=new Md(r,t,!0,jd(t));return Fw(n),i=>{const s=n.validate(Id(i));return s.valid?void 0:Bd(s.errors)}}function qw(e){return zw(Id(e))}function Vw(e){e.setJsonSchemaValidator(qw)}function Gw(){return import.meta.url}function Hw(){return null}var Jw="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 Kw(){return"__METRO_GLOBAL_PREFIX__"in globalThis}async function Xw(){const e=process.getBuiltinModule?.("module"),t=process.getBuiltinModule?.("fs"),r=process.getBuiltinModule?.("path");if(!e||!t||!r)return null;const{createRequire:n}=e,{existsSync:i,readFileSync:s}=t,{dirname:o,resolve:a}=r,c=process.env.JAZZ_CORRECTNESS_WASM_PACKAGE;if(process.env.JAZZ_CORRECTNESS_ARTIFACT_RUN==="1"&&!c)throw new Error("sealed correctness consumer is missing its admitted WASM package");if(c){const p=a(c,"jazz_wasm_bg.wasm");return i(p)?s(p):null}const u=n(import.meta.url).resolve("jazz-wasm/package.json"),f=a(o(u),"pkg/jazz_wasm_bg.wasm");return i(f)?s(f):null}var Fd=Promise.resolve(),lo;function Qw(e){const t=Fd.then(()=>Yw(e));return Fd=t.then(()=>{},()=>{}),t}async function Yw(e){const t=await Promise.resolve().then(()=>(hm(),ka)),r=Ib(e);if(r)return t.initSync(r),Ud(t);let n=!1;if(typeof process<"u"&&process.versions?.node)try{const i=await Xw();i&&(t.initSync({module:i}),n=!0)}catch{}if(!n&&typeof t.default=="function"){const i=typeof location<"u"?kb(Gw,location.href,e)??Hw():null;if(i)await Zw(t,i);else{if(typeof location<"u"&&Kw())throw new Error(Jw);await t.default()}}return Ud(t)}function Ud(e){return Ob(e,"WASM",["initSync","WasmDb","setJsonSchemaValidator"]),Vw(e),e}async function Zw(e,t){if(lo===t)return;const r=await fetch(t);if(!r.ok)throw new Error(`WASM asset request failed (${r.status} ${r.statusText}) for ${t}`);const n=r.headers.get("content-type");if(ev(n)){let s;try{s=await WebAssembly.compileStreaming(r)}catch(o){throw o instanceof WebAssembly.CompileError?new Error(`WASM asset response is not a WebAssembly binary for ${t} (${n}): ${o.message}`):o}await e.default({module_or_path:s}),lo=t;return}const i=new Uint8Array(await r.arrayBuffer());if(i.length<4||i[0]!==0||i[1]!==97||i[2]!==115||i[3]!==109)throw new Error(`WASM asset response is not a WebAssembly binary for ${t} (${n??"unknown content type"})`);await e.default({module_or_path:i}),lo=t}function ev(e){return typeof WebAssembly.compileStreaming!="function"?!1:e?.trim()==="application/wasm"}var uo=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"}},Wd=new WeakMap;function tv(e,t){const r=Wd.get(e);if(!r||r.databaseName!==t||!r.active()||r.claimed)throw new Error("IndexedDB reclamation requires an unclaimed live database Web Lock");return r.claimed=!0,r.active}async function zd(e,t=globalThis.navigator?.locks){if(!t)throw new Error("Persistent browser storage requires the Web Locks API");let r,n;const i=new Promise((f,p)=>{r=f,n=p});let s=!1,o;const a=new Promise(f=>{o=f});let c;const l=new Promise(f=>{c=f}),u=crypto.randomUUID();return t.request(`jazz:browser-physical-database:${e}`,{mode:"exclusive",ifAvailable:!0},async f=>{if(!f){n(new uo(e));return}const p={id:u,release:()=>(s||(s=!0,o()),l)};Wd.set(p,{databaseName:e,active:()=>!s,claimed:!1}),r(p),await a}).then(()=>{s=!0,c()},f=>{s=!0,c(),n(tt(f))}),await i}var fo="unsupported_storage_codecs",po=class extends Error{name="UnsupportedStorageCodecsError";code=fo;missing;unknown;format;constructor(e,t,r=`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`,n){super(r,n),this.missing=e,this.unknown=t,n?.format!==void 0&&(this.format=n.format)}};function rv(e){return!e||typeof e!="object"?!1:e.code===fo}function nv(e){if(e instanceof po||!rv(e))return e;const{missing:t,unknown:r,format:n}=e;return n!==void 0&&(typeof n!="string"||n.length===0)||!(t===void 0&&r===void 0)&&(!qd(t)||!qd(r))?e:new po([...t??[]],[...r??[]],e.message,{cause:e,...n===void 0?{}:{format:n}})}function qd(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}var Yn=1,Vd="jazz-idb-tree",iv=3,st="pages",ot="metadata",se="storage-manifest",Gd="epoch",Hd="browser-runtime-owner",ho="browser-worker-epoch-v1",Jd="jazz-browser-worker-epoch-v1",Kd="replica-node-v1",Zn=16,mo="foreground-node-leases-v1",Xd="jazz-foreground-node-leases-v1",sv=(1n<<64n)-1n,_o="current",ov=1024,av=2147483648,go=16*1024,Qd=1,cv="xxh3-64-le",lv="IDBTREE\0",uv=["jazz.sqlite-storage.v1"],$e={storageEpoch:Qd,adapterId:"jazz-idb-tree",adapterFormatVersion:Yn,requiredCodecIds:uv,pageSize:go,pageChecksum:cv,pageFormatMagic:lv,pageFormatVersion:Yn},Yd=class extends Error{constructor(e){super(`IndexedDB storage was invalidated: ${e}`),this.databaseName=e,this.name="IndexedDbStorageInvalidatedError"}},dv=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 yo(e,t){return e?.name==="QuotaExceededError"?new dv(e):e??new Error(t)}var Zd=class Ph{constructor(t,r,n){this.db=t,this.name=r,n&&this.invalidationListeners.add(n),t.addEventListener("versionchange",this.handleVersionChange),t.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 new Error("IndexedDB reclamation owner already has a tree or pending transaction");if(this.nextTreeToken===Number.MAX_SAFE_INTEGER)throw new Error("IndexedDB tree token space exhausted");const t=++this.nextTreeToken;return this.treeClaims.add(t),t}releaseTreeOwnership(t){this.treeClaims.delete(t)}isTreeOwnershipActive(t){return!this.invalidated&&this.treeClaims.has(t)&&(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(t){return this.invalidationListeners.add(t),()=>this.invalidationListeners.delete(t)}static async open(t,r={}){const n=indexedDB.open(t,iv);let i=!1;n.onupgradeneeded=a=>{if(a.oldVersion!==0){i=!0,n.result.close(),n.transaction?.abort();return}const c=n.result;if(c.objectStoreNames.contains(st)||c.createObjectStore(st),c.objectStoreNames.contains(ot)||c.createObjectStore(ot),!c.objectStoreNames.contains(se)){const l=c.createObjectStore(se);n.transaction&&(l.put($e,Gd),l.put(ef().buffer,Kd))}};let s;try{s=await Ae(n)}catch(a){throw i?new Error("Missing or invalid IndexedDB storage epoch manifest"):a}const o=new Ph(s,t,r.onInvalidated);try{return await o.assertStorageManifest(),r.owner&&await o.claimBrowserRuntimeOwner(r.owner),o.replicaNodeBytes=await o.readReplicaNodeBytes(),o}catch(a){throw o.close(),a}}get replicaNode(){if(!this.replicaNodeBytes)throw new Error("IndexedDB replica node is unavailable before storage admission");return this.replicaNodeBytes.slice()}async acquireForegroundNodeLease(t=!1){return await this.updateForegroundNodeLeasePool(r=>{if(t){for(const s of r.active)r.retired.push(s.node);r.active=[]}const n=r.reusable.pop(),i={leaseId:crypto.randomUUID(),node:n?.node??tf(ef()),confirmedTxTime:n?.confirmedTxTime??"0"};return r.active.push(i),pv(i)})}async returnForegroundNodeLease(t,r){if(!wo(t)||!cf(r))throw new Error("Invalid IndexedDB foreground node lease handoff");await this.updateForegroundNodeLeasePool(n=>{const i=n.active.findIndex(a=>a.leaseId===t);if(i<0)throw new Error("Unknown IndexedDB foreground node lease");const[s]=n.active.splice(i,1);if(!s)throw new Error("Unknown IndexedDB foreground node lease");const o=BigInt(s.confirmedTxTime);n.reusable.push({...s,confirmedTxTime:(r>o?r:o).toString()})})}async retireForegroundNodeLease(t){if(!wo(t))throw new Error("Invalid IndexedDB foreground node lease");await this.updateForegroundNodeLeasePool(r=>{const n=r.active.findIndex(s=>s.leaseId===t);if(n<0)return;const[i]=r.active.splice(n,1);i&&r.retired.push(i.node)})}async foregroundNodeLeaseNodeState(t){if(t.byteLength!==Zn)throw new Error("Invalid IndexedDB foreground node identity");this.assertValid();const r=this.db.transaction(se,"readonly"),n=Te(r);try{const i=await Ae(r.objectStore(se).get(mo));if(await n,i===void 0)return"missing";const s=rf(i),o=Qt(tf(t));return s.active.some(a=>Qt(a.node)===o)?"active":s.reusable.some(a=>Qt(a.node)===o)?"reusable":s.retired.some(a=>Qt(a)===o)?"retired":"missing"}catch(i){throw await n.catch(()=>{}),i}}async claimBrowserWorkerEpoch(t,r){if(!af(t))throw new Error("Invalid browser worker epoch");if(this.assertValid(),r&&(r.id!==t||this.treeClaims.size>0))throw new Error("IndexedDB reclamation ownership must precede tree construction");const n=this.ownershipRevision,i=r?tv(r,this.name):null,s=this.db.transaction(se,"readwrite"),o=Te(s);if(s.objectStore(se).put({format:Jd,epoch:t},ho),await o,this.assertValid(),n!==this.ownershipRevision)throw new Error("IndexedDB worker ownership was released while claiming");this.reclamationOwnership=i}async releaseBrowserWorkerEpoch(t){if(this.treeClaims.clear(),this.ownershipRevision++,this.reclamationOwnership=null,!af(t))throw new Error("Invalid browser worker epoch");this.assertValid();const r=this.db.transaction(se,"readwrite"),n=Te(r),i=r.objectStore(se),s=await Ae(i.get(ho));s&&typeof s=="object"&&s.format===Jd&&s.epoch===t&&i.delete(ho),await n}async metadata(){this.assertValid();const t=this.db.transaction(ot,"readonly"),r=Te(t),n=await Ae(t.objectStore(ot).get(_o));return await r,n===void 0?null:(vo(n),n)}async assertStorageManifest(){const t=this.db.transaction(se,"readonly"),r=Te(t),n=await Ae(t.objectStore(se).get(Gd));await r,bv(n)}async claimBrowserRuntimeOwner(t){if(typeof t!="string"||t.length===0)throw new Error("Invalid browser IndexedDB runtime owner");const r=this.db.transaction(se,"readwrite"),n=Te(r),i=r.objectStore(se),s=await Ae(i.get(Hd));if(s===void 0){i.put(t,Hd),await n;return}if(s===t){await n;return}throw r.abort(),await n.catch(()=>{}),new 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(){const t=this.db.transaction(se,"readonly"),r=Te(t),n=await Ae(t.objectStore(se).get(Kd));if(await r,!(n instanceof ArrayBuffer)&&!ArrayBuffer.isView(n))throw new Error("Missing or invalid IndexedDB replica node identity");const i=n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength);if(i.byteLength!==Zn)throw new Error("Missing or invalid IndexedDB replica node identity");return i.slice()}async updateForegroundNodeLeasePool(t){this.assertValid();const r=bo(this.db,[se]),n=Te(r),i=r.objectStore(se);try{const s=await Ae(i.get(mo)),o=s===void 0?fv():rf(s),a=t(o);return sf(o),i.put(o,mo),await n,a}catch(s){try{r.abort()}catch{}throw await n.catch(()=>{}),s}}async readPage(t){return(await this.readPages([t]))[0]}async readPages(t){this.assertValid();for(const o of t)wv(o);if(t.length===0)return[];const r=this.db.transaction(st,"readonly"),n=Te(r),i=r.objectStore(st);let s;try{s=await Promise.all(t.map(o=>Ae(i.get(o))))}catch(o){throw await n.catch(()=>{}),o}return await n,s.map((o,a)=>_v(t[a],o))}async commit(t,r){if(this.assertValid(),yv(t),r!==void 0&&!this.isTreeOwnershipActive(r))throw new Error("IndexedDB tree ownership has expired");const n=(t.deletedPageIds?.length??0)>0;if(n&&!this.canReclaimObsoletePages)throw new Error("IndexedDB page reclamation ownership is not active");const i=bo(this.db,[st,ot]),s=Te(i),o=i.objectStore(st),a=i.objectStore(ot),c=await Ae(a.get(_o)),l=c===void 0?0:gv(c);if(l!==t.expectedGeneration)throw i.abort(),await s.catch(()=>{}),new Error(`IndexedDB B-tree generation changed: expected ${t.expectedGeneration}, found ${l}`);const u={...t.metadata,formatMagic:Vd,formatVersion:Yn,generation:l+1};vo(u);try{if(u.rootPageId!==null&&!t.pages.has(u.rootPageId)&&await Ae(o.get(u.rootPageId))===void 0)throw new Error(`IndexedDB B-tree root page ${u.rootPageId} is missing`);if(r!==void 0&&!this.isTreeOwnershipActive(r))throw new Error("IndexedDB tree ownership expired before publication");if(n&&!this.canReclaimObsoletePages)throw new Error("IndexedDB page reclamation ownership expired before publication");for(const[f,p]of t.pages){if(p.byteLength>u.pageSize)throw new Error(`IndexedDB B-tree page ${f} exceeds configured page size`);o.put(p.slice().buffer,f)}for(const f of t.deletedPageIds??[])o.delete(f);return a.put(u,_o),await s,u}catch(f){try{i.abort()}catch{}throw await s.catch(()=>{}),f}}commitPages(t,r,n,i,s,o,a,c){if(s.length!==o.length)return Promise.reject(new Error("IDBTree page ids and page bytes have different lengths"));const l=this.commit({expectedGeneration:t,metadata:{pageSize:r,rootPageId:n<0?null:n,nextPageId:i},pages:new Map(s.map((u,f)=>[u,o[f]])),deletedPageIds:a},c);return c!==void 0&&(this.treeTransactions.add(l),l.then(()=>this.treeTransactions.delete(l),()=>this.treeTransactions.delete(l))),l}close(){this.treeClaims.clear(),this.invalidated=!0,this.ownershipRevision++,this.reclamationOwnership=null,this.removeInvalidationListeners(),this.db.close()}async clear(){this.assertValid();const t=bo(this.db,[st,ot]),r=Te(t);t.objectStore(st).clear(),t.objectStore(ot).clear(),await r}static async destroy(t){const r=indexedDB.deleteDatabase(t);await new Promise((n,i)=>{r.onsuccess=()=>n(),r.onerror=()=>i(r.error??new Error("IndexedDB deletion failed")),r.onblocked=()=>i(new Error(`IndexedDB deletion was blocked by an open connection: ${t}`))})}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();const t=new Yd(this.name);for(const r of this.invalidationListeners)r(t)}assertValid(){if(this.invalidated)throw new Yd(this.name)}removeInvalidationListeners(){this.db.removeEventListener("versionchange",this.handleVersionChange),this.db.removeEventListener("close",this.handleUnexpectedClose)}};function bo(e,t){return e.transaction(t,"readwrite",{durability:"relaxed"})}function ef(){if(!globalThis.crypto?.getRandomValues)throw new Error("Browser storage requires cryptographic random values for its replica identity");return Jy(globalThis.crypto.getRandomValues(new Uint8Array(Zn)))}function tf(e){return e.slice().buffer}function fv(){return{format:Xd,active:[],reusable:[],retired:[]}}function pv(e){return{leaseId:e.leaseId,node:new Uint8Array(e.node).slice(),confirmedTxTime:BigInt(e.confirmedTxTime)}}function rf(e){return sf(e),{format:e.format,active:e.active.map(nf),reusable:e.reusable.map(nf),retired:e.retired.map(t=>t.slice(0))}}function nf(e){return{leaseId:e.leaseId,node:e.node.slice(0),confirmedTxTime:e.confirmedTxTime}}function sf(e){if(!e||typeof e!="object")throw new Error("Invalid IndexedDB foreground node lease pool");const t=e;if(t.format!==Xd||!Array.isArray(t.active)||!Array.isArray(t.reusable)||!Array.isArray(t.retired))throw new Error("Invalid IndexedDB foreground node lease pool");const r=new Set,n=new Set;for(const i of[...t.active,...t.reusable]){hv(i);const s=Qt(i.node);if(n.has(i.leaseId)||r.has(s))throw new Error("Invalid IndexedDB foreground node lease pool");n.add(i.leaseId),r.add(s)}for(const i of t.retired){const s=of(i)?Qt(i):null;if(!s||r.has(s))throw new Error("Invalid IndexedDB foreground node lease pool");r.add(s)}}function hv(e){if(!e||typeof e!="object")throw new Error("Invalid IndexedDB foreground node lease");const t=e;if(!wo(t.leaseId)||!of(t.node)||!mv(t.confirmedTxTime)||!cf(BigInt(t.confirmedTxTime)))throw new Error("Invalid IndexedDB foreground node lease")}function of(e){return e instanceof ArrayBuffer&&e.byteLength===Zn}function wo(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 af(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 mv(e){return typeof e=="string"&&/^(0|[1-9][0-9]*)$/.test(e)}function cf(e){return e>=0n&&e<=sv}function Qt(e){return Array.from(new Uint8Array(e),t=>t.toString(16).padStart(2,"0")).join("")}function _v(e,t){if(t===void 0)return null;if(!(t instanceof ArrayBuffer)&&!ArrayBuffer.isView(t))throw new 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 Ae(e){return new Promise((t,r)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>r(yo(e.error,"IndexedDB request failed"))})}function Te(e){return new Promise((t,r)=>{e.oncomplete=()=>t(),e.onabort=()=>r(yo(e.error,"IndexedDB transaction aborted")),e.onerror=n=>{const i=n.target===e?null:n.target;r(yo(e.error??i?.error??null,"IndexedDB transaction failed"))}})}function gv(e){return vo(e),e.generation}function vo(e){if(!e||typeof e!="object")throw new Error("Invalid IndexedDB B-tree metadata");const t=e;if(t.formatMagic!==Vd||t.formatVersion!==Yn||!lf(t.pageSize)||t.pageSize!==go||!Number.isSafeInteger(t.generation)||Number(t.generation)<1||t.rootPageId!==null&&!Yt(t.rootPageId)||!Number.isSafeInteger(t.nextPageId)||Number(t.nextPageId)<0||t.rootPageId!==null&&Number(t.rootPageId)>=Number(t.nextPageId))throw new Error("Invalid IndexedDB B-tree metadata")}function yv(e){if(!Number.isSafeInteger(e.expectedGeneration)||e.expectedGeneration<0)throw new Error("Invalid IndexedDB B-tree expected generation");const{pageSize:t,rootPageId:r,nextPageId:n}=e.metadata;if(!lf(t)||t!==go||!Yt(n))throw new Error("Invalid IndexedDB B-tree commit metadata");if(r!==null&&(!Yt(r)||r>=n))throw new Error("Invalid IndexedDB B-tree commit root page id");const i=new Set;for(const[s,o]of e.pages){if(!Yt(s)||s>=n||o.byteLength>t)throw new Error("Invalid IndexedDB B-tree page commit");i.add(s)}for(const s of e.deletedPageIds??[])if(!Yt(s)||s>=n||s===r||i.has(s))throw new Error("Invalid IndexedDB B-tree deleted page commit")}function bv(e){if(!e||typeof e!="object")throw new Error("Missing or invalid IndexedDB storage epoch manifest");const t=e,r=Object.keys(t).sort(),n=Object.keys($e).sort();if(r.length!==n.length||r.some((o,a)=>o!==n[a])||t.storageEpoch!==$e.storageEpoch||t.adapterId!==$e.adapterId||t.adapterFormatVersion!==$e.adapterFormatVersion||t.pageSize!==$e.pageSize||t.pageChecksum!==$e.pageChecksum||t.pageFormatMagic!==$e.pageFormatMagic||t.pageFormatVersion!==$e.pageFormatVersion||!Array.isArray(t.requiredCodecIds)||!t.requiredCodecIds.every(o=>typeof o=="string"))throw new Error("Missing or invalid IndexedDB storage epoch manifest");const i=t.requiredCodecIds,s=$e.requiredCodecIds;if(i.length!==s.length||i.some((o,a)=>o!==s[a])){const o=s.filter(c=>!i.includes(c)),a=i.filter(c=>!s.includes(c));throw new po(o,a,`Missing or invalid IndexedDB storage epoch manifest: unsupported storage format: this epoch-${Qd} root lacks codec families ${JSON.stringify(o)} required by this build and declares ${JSON.stringify(a)} that this build does not read`)}}function lf(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=ov&&e<=av&&Number.isInteger(Math.log2(e))}function wv(e){if(!Yt(e))throw new Error(`Invalid IndexedDB B-tree page id: ${e}`)}function Yt(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}var Zt=new WeakMap,vv=256,Sv=5e3,Ev=1,er={TRACE:1,DEBUG:5,INFO:9,WARN:13,ERROR:17};function tr(e,t){const r=e.trim().replace(/\/+$/,""),n=`/v1/${t}`;return r.endsWith("/v1/logs")?`${r.slice(0,-8)}${n}`:r.endsWith("/v1/traces")?`${r.slice(0,-10)}${n}`:`${r}${n}`}function Av(e){if(!e.collectorUrl)return()=>{};const t={traceUrl:tr(e.collectorUrl,"traces"),logUrl:tr(e.collectorUrl,"logs")},{runtimeThread:r,wasmModule:n}=e;if(!Rv(n))return console.warn("[jazz] WASM telemetry unavailable: trace entry hooks are missing."),()=>{};let i=Zt.get(n);if(i){if(i.closing)throw new Error("WASM telemetry collector is closing");if(i.runtimeThread!==r)throw new Error("incompatible WASM telemetry runtime thread");if(i.identity.traceUrl!==t.traceUrl||i.identity.logUrl!==t.logUrl)throw new Error("incompatible WASM telemetry collector");return uf(n,i)}i={identity:t,runtimeThread:r,leases:new Set,nextLeaseId:0,closing:!1,unsubscribe:null,exporter:null,exportTail:Promise.resolve(),shutdownScheduled:!1,drainMicrotaskPending:!1},Zt.set(n,i);const s=()=>{const c=n.drainTraceEntries();!Array.isArray(c)||c.length===0||df(i,c)},o=()=>{i.closing||i.drainMicrotaskPending||(i.drainMicrotaskPending=!0,queueMicrotask(()=>{i.drainMicrotaskPending=!1,!i.closing&&s()}))};let a=!1;try{return i.unsubscribe=n.subscribeTraceEntries(o),a=!0,n.setTraceEntryCollectionEnabled(!0),uf(n,i)}catch(c){if(a)try{n.setTraceEntryCollectionEnabled(!1)}catch{}try{i.unsubscribe?.()}catch{}throw i.unsubscribe=null,Zt.get(n)===i&&Zt.delete(n),c}}function uf(e,t){const r=t.nextLeaseId++;t.leases.add(r);let n=!1;return()=>{if(n||(n=!0,t.leases.delete(r),t.leases.size>0||t.closing))return;t.closing=!0;let i;try{t.unsubscribe?.()}catch(s){i=s}finally{try{const s=e.drainTraceEntries();Array.isArray(s)&&s.length>0&&df(t,s)}catch(s){i??=s}finally{try{e.setTraceEntryCollectionEnabled(!1)}catch(s){i??=s}finally{t.unsubscribe=null,Tv(t),!i&&Zt.get(e)===t&&Zt.delete(e)}}}if(i)throw i}}function df(e,t){e.exportTail=e.exportTail.catch(()=>{}).then(async()=>{e.exporter||(e.exporter=kv(e.identity.traceUrl,e.identity.logUrl));try{const r=await e.exporter;for(const n of t)try{Iv(r,e.runtimeThread,n)}catch(i){console.warn("[jazz] WASM telemetry export failed:",i)}}catch(r){e.exporter=null,console.warn("[jazz] WASM telemetry export failed:",r)}})}function Tv(e){e.shutdownScheduled||(e.shutdownScheduled=!0,e.exportTail.catch(()=>{}).then(async()=>{try{await(e.exporter?await e.exporter:void 0)?.shutdown()}catch(t){console.warn("[jazz] WASM telemetry shutdown failed:",t)}}))}function Rv(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.subscribeTraceEntries=="function"&&typeof t.drainTraceEntries=="function"&&typeof t.setTraceEntryCollectionEnabled=="function"}function Iv(e,t,r){if(r.kind==="span"){const n={"jazz.runtime_thread":t,"jazz.span.sequence":r.sequence,"jazz.span.level":r.level,"jazz.span.target":r.target,"jazz.span.fields":pf(r.fields)};e.tracer.startSpan(r.name||"wasm span",{kind:Ev,startTime:r.startUnixNano,attributes:So(r.fields)?{...ff(r.fields),...n}:n}).end(r.endUnixNano);return}if(r.kind==="log"){const n={"jazz.runtime_thread":t,"jazz.log.sequence":r.sequence,"jazz.log.target":r.target,"jazz.log.fields":pf(r.fields)};e.logger.emit({timestamp:r.timestampUnixNano,severityNumber:xv(r.level),severityText:r.level,body:r.message,attributes:So(r.fields)?{...ff(r.fields),...n}:n});return}e.logger.emit({severityNumber:er.WARN,severityText:"WARN",body:`Dropped ${r.count} WASM telemetry records`,attributes:{"jazz.runtime_thread":t,"jazz.telemetry.dropped_count":r.count}})}async function kv(e,t){const[{OTLPTraceExporter:r},{BasicTracerProvider:n,BatchSpanProcessor:i},{OTLPLogExporter:s},{LoggerProvider:o,BatchLogRecordProcessor:a},{resourceFromAttributes:c}]=await Promise.all([Promise.resolve().then(()=>(ey(),Wl)),Promise.resolve().then(()=>(wy(),wu)),Promise.resolve().then(()=>(Ey(),Su)),Promise.resolve().then(()=>(Hy(),Bu)),Promise.resolve().then(()=>(Os(),yl))]),l=c({"service.name":"jazz-browser","telemetry.sdk.language":"webjs"}),u={maxExportBatchSize:vv,maxQueueSize:Sv,scheduledDelayMillis:1e3},f=new n({resource:l,spanProcessors:[new i(new r({url:e}),u)]}),p=new o({resource:l,processors:[new a(new s({url:t}),u)]});return{tracer:f.getTracer("jazz-wasm.tracing"),logger:p.getLogger("jazz-wasm.tracing"),shutdown:async()=>{await Promise.all([typeof f.shutdown=="function"?f.shutdown():void 0,typeof p.shutdown=="function"?p.shutdown():void 0])}}}function ff(e){if(!e||typeof e!="object")return{};const t={};for(const[r,n]of Object.entries(e))r.startsWith("jazz.")||n!=null&&(typeof n=="string"||typeof n=="number"||typeof n=="boolean"?t[r]=n:t[r]=JSON.stringify(n));return t}function xv(e){switch(e.toUpperCase()){case"TRACE":return er.TRACE;case"DEBUG":return er.DEBUG;case"INFO":return er.INFO;case"WARN":case"WARNING":return er.WARN;case"ERROR":return er.ERROR;default:return 0}}function So(e){if(!e)return!1;for(const t in e)return!0;return!1}function pf(e){return So(e)?JSON.stringify(e):"{}"}var hf=class{constructor(e,t){this.transport=e,this.onError=t}timer;deadline;closed=!1;refresh(){if(!this.closed)try{const e=this.transport.auxiliaryReceiveTimeoutMs?.();if(e==null){this.clear();return}if(!Number.isFinite(e)||e<0||!this.transport.expireAuxiliaryReceive)throw new Error("Invalid auxiliary receive deadline capability");const 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(r){this.fail(r)}},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)}},Pv=8,Cv=1024*1024,Ov=class{constructor(e,t,r,n,i){this.runtime=e,this.transport=t,this.sendFrames=r,this.onError=n,this.onAuxiliaryTrace=i,this.receiveDeadline=new hf(t,s=>{this.close(),this.onError(s)}),this.removeWorkListener=e.onPeerTransportWork(this.handleRuntimeWork);try{this.transport.setAuxiliaryTraceEnabled?.(i!==void 0),this.transport.setOutboundScheduler?.(()=>this.scheduleOutboundDrain())}catch(s){this.closed=!0;try{this.removeWorkListener()}finally{try{this.transport.clearOutboundScheduler?.()}finally{this.transport.setAuxiliaryTraceEnabled?.(!1)}}throw s}this.watchAuxiliaryOutbound().catch(s=>{this.closed||this.onError(s)}),this.schedule(!0)}receiveDeadline;scheduled=!1;running=!1;runAgain=!1;closed=!1;outboundDrainScheduled=!1;inboundRouting=Promise.resolve();requestedGeneration=0;completedGeneration=0;flushWaiters=new Set;removeWorkListener;handleRuntimeWork=e=>this.schedule(e??!1);receive(e){if(this.closed||e.length===0)return;const t=this.inboundRouting.then(()=>this.routeInboundFrames(e));this.inboundRouting=t.catch(r=>{this.closed||this.onError(r)})}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(t=>{this.closed||this.onError(t)})}))}}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(const e of this.flushWaiters)e.resolve();this.flushWaiters.clear()}}async flush(){if(this.closed)return;this.schedule();const e=this.requestedGeneration;this.completedGeneration>=e||await new Promise(t=>this.flushWaiters.add({target:e,resolve:t}))}drainOutboundFrames(){if(this.closed)return!1;const e=mf(this.transport.recvWireFrames());e.length>0&&this.sendFrames(e);const t=this.transport.recvAuxiliaryWireFrames;if(!t)return!1;const r=mf(t.call(this.transport,Pv,Cv));return r.length>0&&this.sendFrames(r),this.publishAuxiliaryTrace(),r.length>0}scheduleOutboundDrain(){this.closed||this.outboundDrainScheduled||(this.outboundDrainScheduled=!0,queueMicrotask(()=>{this.outboundDrainScheduled=!1,this.closed||this.drainOutboundFrames()}))}async pump(){if(this.closed||this.running)return;this.running=!0;const 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(const t of this.flushWaiters)t.target>this.completedGeneration||(this.flushWaiters.delete(t),t.resolve())}this.closed||this.runAgain&&(this.runAgain=!1,this.schedule())}async routeInboundFrames(e){if(this.closed)return;const t=[];for(const r of e){const n=this.transport.routeAuxiliaryWireFrame?await this.transport.routeAuxiliaryWireFrame(r):r;if(this.receiveDeadline.refresh(),this.closed)return;n!=null&&t.push(_f(n))}if(!this.closed){if(t.length>0)if(this.transport.sendWireFrames)this.transport.sendWireFrames(t);else for(const r of t)this.transport.sendWireFrame(r);this.runtime.notifyPeerTransportActivity?.(),this.publishAuxiliaryTrace(),this.schedule()}}publishAuxiliaryTrace(){if(!this.onAuxiliaryTrace)return;const e=this.transport.takeAuxiliaryTrace?.();!e||e.length===0||this.onAuxiliaryTrace(e)}async watchAuxiliaryOutbound(){for(;!this.closed;){const e=this.transport.auxiliaryOutboundReady?.();if(!e||typeof e=="boolean"||(await e,this.closed))return;this.drainOutboundFrames()&&await Lv()}}};function $v(e){return e.map(t=>t.slice())}function mf(e){return e.map(_f)}function _f(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 new Error("Browser worker transport received a non-binary wire frame")}function Lv(){return new Promise(e=>setTimeout(e,0))}var Nv="this account's store is open under another sign-in in another tab",gf=32,jv=64*1024,yf=128,Mv=64,Dv=128,Bv=256,Fv=8*1024,Uv=16*1024,bf=2*1024;function ie(e){const t={remaining:jv},r=wf(e,t);let n=e,i=r;const s=new WeakSet;for(let o=0;o<gf;o+=1){if(n&&typeof n=="object"){if(s.has(n))break;s.add(n)}const a=rr(n,"cause");if(a===void 0)break;if(!Wv(a)){const l=Vv(a,t);l!==void 0&&(i.cause=l);break}if(o+1>gf||t.remaining===0||s.has(a))break;const c=wf(a,t);i.cause=c,i=c,n=a}return r}function wf(e,t){const r=Eo(e,"stack"),n=zv(rr(e,"code")),i={name:nr(Eo(e,"name")??"Error",Bv,t),message:nr(Eo(e,"message")??qv(e),Fv,t),...r===void 0?{}:{stack:nr(r,Uv,t)}};if(n!==void 0&&n.length<=t.remaining&&(i.code=nr(n,yf,t)),i.code===fo){const s=vf(rr(e,"missing")),o=vf(rr(e,"unknown"));s!==void 0&&o!==void 0&&ei(s)+ei(o)<=t.remaining&&(t.remaining-=ei(s)+ei(o),i.missing=[...s],i.unknown=[...o])}return i}function Wv(e){return e!==null&&typeof e=="object"&&typeof rr(e,"message")=="string"}function zv(e){return typeof e=="string"&&e.length>0&&e.length<=yf?e:void 0}function vf(e){return Array.isArray(e)&&e.length<=Mv&&e.every(t=>typeof t=="string"&&t.length>0&&t.length<=Dv)?e:void 0}function ei(e){return e.reduce((t,r)=>t+r.length,0)}function rr(e,t){if(!(e===null||typeof e!="object"&&typeof e!="function"))try{return e[t]}catch{return}}function Eo(e,t){const r=rr(e,t);return typeof r=="string"?r:void 0}function qv(e){try{return String(e)}catch{return"Unstringifiable relay error"}}function nr(e,t,r){const n=Math.min(e.length,t,r.remaining);return r.remaining-=n,e.slice(0,n)}function Vv(e,t){if(e===null||typeof e=="boolean"||typeof e=="number")return e;if(typeof e=="string")return nr(e,bf,t);if(e!==void 0)return nr("[non-error relay cause omitted]",bf,t)}var Gv=-(1n<<63n),Hv=(1n<<63n)-1n;function ti(e,t){if(typeof e=="number"&&!Number.isSafeInteger(e))throw new Error(`${t} must be a safe integer when passed as a number, got ${e}`);const r=BigInt(e);if(r<Gv||r>Hv)throw new Error(`${t} must be a signed 64-bit integer`);return r}var Jv=new De({fatal:!0});function Kv(e){if(e.kind!=="hidden-metadata")return e.kind==="stored-column"?e.outputName:e.name}function ri(e){return{table:e.string(),descriptor:Qv(e),rows:e.readVec(t=>({rowId:t.bytes(),deleted:t.bool(),raw:t.bytes()}))}}function Xv(e,t){e.vec((r,n)=>{const i=t[n];r.u64(i.kind==="stored-column"?0:i.kind==="result-field"?1:2),i.kind==="stored-column"?(r.u64(i.id),r.string(i.outputName)):r.string(i.name),ni(r,i.valueType)},t.length)}function Qv(e){return e.readVec(t=>{const r=t.u64();return r===0?{kind:"stored-column",id:t.u64(),outputName:t.string(),valueType:ir(t)}:r===1?{kind:"result-field",name:t.string(),valueType:ir(t)}:r===2?{kind:"hidden-metadata",name:t.string(),valueType:ir(t)}:Yv(r)})}function Yv(e){throw new Error(`unknown native row descriptor field kind ${e}`)}function Zv(e){const t={added:e.readVec(ri),updated:e.readVec(ri),removed:e.readVec(r0),addedOccurrenceKeys:e.readVec(n=>Ao(n)),updatedOccurrenceKeys:e.readVec(n=>Ao(n)),removedOccurrenceKeys:e.readVec(n=>Ao(n)),addedIndices:e.readVec(n=>n.u64()),updatedPreviousIndices:e.readVec(n=>n.u64()),updatedIndices:e.readVec(n=>n.u64()),removedIndices:e.readVec(n=>n.u64()),updatedSplices:e.readVec(n=>n.readVec(i=>({column:i.string(),splices:i.readVec(s=>({at:s.u64(),delete:s.u64(),insert:s.bytes(),atUtf16:s.u64(),deleteUtf16:s.u64()}))})))},r=n=>n.reduce((i,s)=>i+s.rows.length,0);if(t.addedOccurrenceKeys.length!==r(t.added)||t.updatedOccurrenceKeys.length!==r(t.updated)||t.removedOccurrenceKeys.length!==t.removed.length||t.addedIndices.length!==r(t.added)||t.updatedPreviousIndices.length!==r(t.updated)||t.updatedIndices.length!==r(t.updated)||t.removedIndices.length!==t.removed.length||t.updatedSplices.length!==r(t.updated))throw new Error("subscription occurrence sidecar length mismatch");return Sf(e,"subscription delta"),t}function Ao(e){const t=e.bytes();if(t[0]!==2||!e0(t.subarray(1)))throw new Error("malformed ResultKey");return t}function e0(e){const t=o=>(e[o]<<24|e[o+1]<<16|e[o+2]<<8|e[o+3])>>>0;if(e.length<25)return!1;let r=16;const n=t(r);if(r+=4,n>256||r+n*16+4>e.length)return!1;r+=n*16;const i=t(r);if(r+=4,i>n+1)return!1;let s=-1;for(let o=0;o<i;o++){if(r+8>e.length)return!1;const a=t(r),c=t(r+4);if(r+=8,a>n||a<=s||c===0||c>4096||r+c>e.length||!Zy(e.subarray(r,r+c)))return!1;s=a,r+=c}for(let o=0;o<=n;o++){const a=e[r++];if(a===1)r+=24;else if(a!==0)return!1}return r===e.length}function t0(e){const t=e.u64(),r=e.readVec(ri);return Sf(e,"relation snapshot"),{rootCount:t,rows:r}}function Sf(e,t){if(!e.done())throw new Error(`${t} has trailing postcard bytes`)}function r0(e){return{table:e.string(),rowId:e.bytes()}}function To(e,t){e.vec((r,n)=>{r.some(i=>i.string(t[n].name??"")),ni(r,t[n].valueType)},t.length)}function Ef(e){return e.readVec(t=>({name:t.option(r=>r.string()),valueType:ir(t)}))}function ni(e,t){if(e.enumUnit(t.tag),t.tag===10){if(!t.internal)throw new Error("missing physical type for ValueType::Internal");if(e.enumUnit(t.internal.tag),t.internal.tag===2){if(t.internal.kind==null)throw new Error("missing stored-scalar kind");e.enumUnit(t.internal.kind)}return}if(t.tag===12){const r=t.enumSchema,n=r?.variants;if(!r||!n)throw new Error("missing enum schema for ValueType::Enum");e.u64(r.registryId??0),e.string(r.name),e.vec((i,s)=>i.string(n[s]),n.length);return}if(t.tag===13){const r=t.members??(t.inner?[t.inner]:[]);e.vec((n,i)=>ni(n,r[i]),r.length);return}if(t.tag===14||t.tag===15){if(!t.inner)throw new Error(`missing inner value type for tag ${t.tag}`);ni(e,t.inner);return}if(t.tag===16){if(!t.record)throw new Error("missing inline record descriptor for tag 16");To(e,t.record);return}if(t.tag===17){const r=t.enumSchema,n=r?.cases;if(!r||!n)throw new Error("missing cases for ValueType::Enum");e.u64(r.registryId??0),e.string(r.name),e.vec((i,s)=>{const o=n[s];i.string(o.name),To(i,o.payload)},n.length)}}function ir(e){const t=e.u64();if(t===10){const r=e.u64();return{tag:t,internal:{tag:r,kind:r===2?e.u64():void 0}}}if(t===12)return{tag:t,enumSchema:{registryId:e.u64(),name:e.string(),variants:e.readVec(r=>r.string())}};if(t===14||t===15)return{tag:t,inner:ir(e)};if(t===13){const r=e.readVec(ir);return{tag:t,members:r,inner:r[0]}}return t===16?{tag:t,record:Ef(e)}:t===17?{tag:t,enumSchema:{registryId:e.u64(),name:e.string(),cases:e.readVec(r=>({name:r.string(),payload:Ef(r)}))}}:{tag:t}}function Af(e,t){const r=Lf(e),n=r.fixed.map(c=>t[c.logicalIndex]),i=r.variable.map(c=>t[c.logicalIndex]),s=rt(n),o=new g0;let a=s.length+Math.max(0,i.length-1)*4;for(const c of i.slice(0,-1))a+=c.length,o.u32Le(a);return rt([s,o.finish(),...i])}function Tf(e,t){const r=si(ko(e));return e.map((n,i)=>{const s=r(t,i);return s==null?{type:"Null"}:Oo(n.column_type,s)})}function bt(e,t){return Object.defineProperty(e,"valuesByColumn",{value:t,enumerable:!1,configurable:!0}),e}function ii(e,t){const r=new Map;for(let n=0;n<e.length;n++){const i=e[n];i&&r.set(i.name,t[n])}return r}var n0={name:"__jazz_terminal_row_key",column_type:{type:"Uuid"},nullable:!1};function Ro(e,t,r){const n=[n0,...t],i=i0(n,r),s=i[0];if(s?.type!=="Uuid"||s.value!==e)throw new Error(`terminal record key ${s?.type==="Uuid"?s.value:"<non-uuid>"} does not match addressed key ${e}`);const o=i.slice(1);return bt({id:e,values:o},ii(t,o))}function i0(e,t){const r=si(ko(e));return e.map((n,i)=>{const s=r(t,i);return s==null?{type:"Null"}:Rf(n.column_type,s,n.name)})}function Rf(e,t,r){switch(e.type){case"Timestamp":return{type:"Timestamp",value:h0(t,r)};case"Array":return{type:"Array",value:s0(e.element,t)};case"Row":{if(t.byteLength<16)throw new Error("terminal nested row is missing its physical key");const n=$o(t.subarray(0,16));return{type:"Row",value:Ro(n,e.columns,t)}}default:return Oo(e,t)}}function s0(e,t){return $f(e,t,r=>Rf(e,r))}function o0(e,t){return Af(ko(e),e.map((r,n)=>kf(r,t[n])))}function si(e){const t=Lf(e);return(r,n)=>a0(e,t,r,n)}function a0(e,t,r,n){const i=t.fields[n];if(!i)throw new Error("field is not present");const s=e[n].valueType;if(i.kind==="fixed"){if(i.offset+i.size>r.length)throw new Error("unexpected end of record");const p=r.subarray(i.offset,i.offset+i.size);return Io(p,s)}const o=t.fixedSize,a=t.fixedSize+Math.max(0,t.variable.length-1)*4,c=i.variableIndex===0?a:Vr(r,o+(i.variableIndex-1)*4),l=i.variableIndex===t.variable.length-1?r.length:Vr(r,o+i.variableIndex*4);if(c>l||l>r.length){const f=e[n],p=l-c,g=Math.max(0,r.length-c);throw new Error(`invalid offset for ${f?.name??`<field ${n}>`}: declared type ${If(s)}, tag ${s.tag}, claimed width ${p}, remaining buffer ${g}, current offset ${c}, end offset ${l}, record length ${r.length}`)}const u=r.subarray(c,l);return Io(u,s)}function Io(e,t){if(t.tag!==15)return e;const r=l0(e);return r==null?null:t.inner?Io(r,t.inner):r}function If(e){return e.tag===14||e.tag===15?`${e.tag===14?"Array":"Nullable"}<${e.inner?If(e.inner):"?"}>`:c0(e.tag)}function c0(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 l0(e){return e[0]===0?null:e[0]!==1?e:e.subarray(1)}function ko(e){return e.map(t=>({name:t.name,valueType:Po(t)}))}function kf(e,t){const r=sr(e.column_type),n=e.nullable?{tag:15,inner:r}:r;if(!t){if(e.sparse)return oi({tag:15,inner:n});if(!e.nullable)throw new Error(`missing non-nullable value for ${e.name}`);return oi(n)}if(t.type==="Null"){if(!e.nullable)throw new Error(`missing non-nullable value for ${e.name}`);const s=oi(n);return e.sparse?xo(s,n):s}let i=xf(e.column_type,t);return e.nullable&&(i=xo(i,r)),e.sparse?xo(i,n):i}function xo(e,t){if(Ue(t)==null)return rt([Uint8Array.of(1),e]);const r=new Uint8Array(1+e.length);return r[0]=1,r.set(e,1),r}function oi(e){const t=Ue(e);return t==null?Uint8Array.of(0):new Uint8Array(t)}function xf(e,t){switch(e.type){case"Boolean":if(t.type!=="Boolean")throw new Error("expected Boolean value");return Uint8Array.of(t.value?1:0);case"Integer":{const r=m0(t),n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,r,!0),n}case"Timestamp":{if(t.type!=="Timestamp"||!Number.isSafeInteger(t.value))throw new Error(`expected ${e.type} value`);if(t.value<0)throw new Error(`Timestamp value must be a non-negative safe integer (dates before 1970 are not supported), got ${t.value}`);const r=new Uint8Array(8);return new DataView(r.buffer).setBigUint64(0,BigInt(t.value),!0),r}case"BigInt":{const r=_0(t),n=new Uint8Array(8);return new DataView(n.buffer).setBigInt64(0,r,!0),n}case"Double":{if(t.type!=="Double")throw new Error("expected Double value");const r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,t.value,!0),r}case"Text":case"Json":case"Enum":if(t.type!=="Text")throw new Error(`expected ${e.type} value`);return rt([Uint8Array.of(0),new TextEncoder().encode(t.value)]);case"Uuid":if(t.type!=="Uuid")throw new Error("expected Uuid value");return Cf(t.value);case"Bytea":if(t.type!=="Bytea")throw new Error("expected Bytea value");return rt([Uint8Array.of(0),t.value]);case"Array":if(t.type!=="Array")throw new Error("expected Array value");return d0(e.element,t.value);case"Row":if(t.type!=="Row")throw new Error("expected Row value");return u0(e.columns,t.value)}}function u0(e,t){const r=t.valuesByColumn?e.map(s=>t.valuesByColumn?.get(s.name)??(s.column_type.type==="Array"?{type:"Array",value:[]}:{type:"Null"})):t.values,n=o0(e,r),i=t.id?Cf(t.id):new Uint8Array;return rt([Uint8Array.of(t.id?1:0),i,Pf(n.byteLength),n])}function d0(e,t){const r=t.map(a=>xf(e,a));if(Ue(sr(e))!=null)return rt(r);const i=new Uint8Array(Math.max(0,t.length-1)*4),s=new DataView(i.buffer);let o=4+i.byteLength;return r.slice(0,-1).forEach((a,c)=>{o+=a.length,s.setUint32(c*4,o,!0)}),rt([Pf(t.length),i,...r])}function Pf(e){const t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),t}function Cf(e){const t=Ks(e);if(!t)throw new Error(`invalid UUID value ${e}`);return t}function Po(e){let t=sr(e.column_type);return e.nullable&&(t={tag:15,inner:t}),e.sparse?{tag:15,inner:t}:t}function Co(e){return e.map(t=>({...t,sparse:void 0,column_type:t.column_type.type==="Row"?{...t.column_type,columns:[...Co(t.column_type.columns)]}:t.column_type.type==="Array"&&t.column_type.element.type==="Row"?{...t.column_type,element:{...t.column_type.element,columns:[...Co(t.column_type.element.columns)]}}:t.column_type}))}function sr(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:sr(e.element)};case"Row":return{tag:9}}}function Oo(e,t){const r=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:r.getInt32(0,!0)};case"BigInt":return{type:"BigInt",value:r.getBigInt64(0,!0)};case"Double":return{type:"Double",value:r.getFloat64(0,!0)};case"Timestamp":return{type:"Timestamp",value:Number(r.getBigUint64(0,!0))};case"Text":case"Json":case"Enum":return{type:"Text",value:Jv.decode(Of(t))};case"Uuid":return{type:"Uuid",value:$o(t)};case"Bytea":return{type:"Bytea",value:Of(t).slice()};case"Array":return{type:"Array",value:p0(e.element,t)};case"Row":return{type:"Row",value:f0(e.columns,t)}}}function Of(e){if(e[0]!==0)throw new Error("indirect scalar crossed a logical binding boundary");return e.subarray(1)}function f0(e,t){if(t.byteLength<5)throw new Error("invalid nested row value");const r=t[0]===1;let n=1,i;r&&(i=$o(t.subarray(n,n+16)),n+=16);const o=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(n,!0);n+=4;const a=t.subarray(n,n+o);if(a.byteLength!==o)throw new Error("invalid nested row value length");const c=Tf(e,a);return bt({id:i,values:c},ii(e,c))}function p0(e,t){return $f(e,t,r=>Oo(e,r))}function $f(e,t,r){const n=Ue(sr(e));if(n!=null){if(n===0)return[];if(t.length%n!==0)throw new Error(`invalid fixed-width array byte length ${t.length}`);const a=[];for(let c=0;c<t.length;c+=n)a.push(r(t.subarray(c,c+n)));return a}if(t.length<4)throw new Error("invalid variable-width array byte length");const i=Vr(t,0),s=4+Math.max(0,i-1)*4;if(s>t.length)throw new Error("invalid variable-width array offset table");const o=[];for(let a=0;a<i;a+=1){const c=a===0?s:Vr(t,4+(a-1)*4),l=a===i-1?t.length:Vr(t,4+a*4);if(c>l||l>t.length)throw new Error("invalid variable-width array element offset");o.push(r(t.subarray(c,l)))}return o}function h0(e,t){const r=new DataView(e.buffer,e.byteOffset,e.byteLength).getBigUint64(0,!0);return Number(r)}function $o(e){if(e.length>=16)return ed(e,0);const t=Zu(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Ue(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((r,n)=>{if(r==null)return;const i=Ue(n);return i==null?void 0:r+i},0);case 10:case 14:return;case 15:{const t=e.inner?Ue(e.inner):void 0;return t==null?void 0:t+1}default:return}}function Lf(e){const t=[];t.length=e.length;const r=[],n=[];let i=0;for(let s=0;s<e.length;s+=1){const o=Ue(e[s].valueType);if(o==null)continue;const a={kind:"fixed",logicalIndex:s,offset:i,size:o};t[s]=a,r.push(a),i+=o}for(let s=0;s<e.length;s+=1){if(Ue(e[s].valueType)!=null)continue;const o={kind:"variable",logicalIndex:s,variableIndex:n.length};t[s]=o,n.push(o)}return{fields:t,fixed:r,variable:n,fixedSize:i}}function Vr(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function m0(e){if(e.type!=="Integer"||!Number.isSafeInteger(e.value)||e.value<-2147483648||e.value>2147483647)throw new Error("Integer value must be a signed 32-bit integer");return e.value}function _0(e){if(e.type!=="BigInt")throw new Error("expected BigInt value");return ti(e.value,"BigInt value")}var g0=class{#e=[];u32Le(e){if(!Number.isInteger(e)||e<0||e>4294967295)throw new 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)}},Lo=class{constructor(e){this.text=e}};function No(e){for(let t=0;t<e.length;t++){const r=e.charCodeAt(t);if(r>=55296&&r<=56319){if(++t>=e.length||e.charCodeAt(t)<56320||e.charCodeAt(t)>57343)throw new Error("invalid relation query: unpaired surrogate")}else if(r>=56320&&r<=57343)throw new Error("invalid relation query: unpaired surrogate")}}function y0(e){const t=JSON.parse(e),r=(l,u)=>typeof l=="string"?(No(l),l.includes(u)):Array.isArray(l)?l.some(f=>r(f,u)):l&&typeof l=="object"?Object.entries(l).some(([f,p])=>(No(f),f.includes(u)||r(p,u))):!1;let n="__jrq_raw_number_";for(;e.includes(n)||r(t,n);)n=`_${n}`;const i=[];let s="",o=!1,a=!1;for(let l=0;l<e.length;l++){const u=e[l];if(o){s+=u,a?a=!1:u==="\\"?a=!0:u==='"'&&(o=!1);continue}if(u==='"'){o=!0,s+=u;continue}if(u==="-"||u>="0"&&u<="9"){const f=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(e.slice(l));if(f){i.push(f[0]),s+=JSON.stringify(`${n}${i.length-1}__`),l+=f[0].length-1;continue}}s+=u}const c=l=>{if(typeof l=="string"){const u=new RegExp(`^${n}(\\d+)__$`).exec(l);return u?new Lo(i[Number(u[1])]):l}return Array.isArray(l)?l.map(c):l&&typeof l=="object"?Object.fromEntries(Object.entries(l).map(([u,f])=>[u,c(f)])):l};return c(JSON.parse(s))}function b0(e){const s=[];let o=0,a=0;const c=new TextEncoder,l=h=>{throw new Error(`invalid relation Postcard: ${h}`)},u=(...h)=>{h.some(T=>!Number.isInteger(T)||T<0||T>255)&&l("byte"),s.length>1048576-h.length&&l("byte limit"),s.push(...h)},f=h=>{(!Number.isSafeInteger(h)||h<0||h>4096)&&l("collection"),m(h)},p=()=>{++a>4096&&l("node limit")},g=h=>{++o>128&&l("depth limit");try{h()}finally{o--}},m=h=>{let T=typeof h=="bigint"?h:BigInt(h);(T<0n||T>0xffffffffffffffffn)&&l("integer range");do{let W=Number(T&0x7fn);T>>=7n,T&&(W|=128),u(W)}while(T)},b=h=>m(h<0n?(-h<<1n)-1n:h<<1n),$=h=>{typeof h!="string"&&l("string"),No(h);const T=c.encode(h);T.length>65536&&l("string limit"),m(T.length),u(...T)},O=(h,T)=>{h==null?u(0):(u(1),T())},C=(h,T,W)=>{const G=Object.keys(h);(G.length!==1||!T.includes(G[0]))&&l(W)},N=(h,T,W)=>{Object.keys(h).some(G=>!T.includes(G))&&l(W)},te=h=>{h instanceof Lo&&(/^(?:0|[1-9]\d*)$/.test(h.text)||l("dimension"),h=Number(h.text));const T=typeof h=="number"?h:l("dimension");(!Number.isSafeInteger(T)||T<0||T>4294967295)&&l("dimension"),m(T)},V=h=>{(!h||typeof h!="object")&&l("column"),N(h,["scope","column"],"column"),(typeof h.column!="string"||h.scope!==void 0&&typeof h.scope!="string")&&l("column"),O(h.scope,()=>$(h.scope)),$(h.column)},le=h=>m(h==="Current"?0:h==="Outer"?1:h==="Frontier"?2:l("row id")),ge=h=>{if(p(),h instanceof Lo){if(/^(?:0|[1-9]\d*|-[1-9]\d*)$/.test(h.text)){const F=BigInt(h.text);if(F>=-0x8000000000000000n&&F<=0x7fffffffffffffffn){m(2),b(F);return}if(F>=0n&&F<=0xffffffffffffffffn){m(3),m(F);return}}const W=Number(h.text);Number.isFinite(W)||l("number"),m(4);const G=new DataView(new ArrayBuffer(8));G.setFloat64(0,W,!0),m(G.getBigUint64(0,!0));return}if(h===null){m(0);return}if(typeof h=="boolean"){m(1),u(h?1:0);return}if(typeof h=="number"){if(Number.isFinite(h)||l("number"),Number.isInteger(h)&&!Object.is(h,-0)){const G=JSON.stringify(h);if(/^(?:0|[1-9]\d*|-[1-9]\d*)$/.test(G)){const F=BigInt(G);if(F>=-0x8000000000000000n&&F<=0x7fffffffffffffffn){m(2),b(F);return}if(F>=0n&&F<=0xffffffffffffffffn){m(3),m(F);return}}}m(4);const W=new DataView(new ArrayBuffer(8));W.setFloat64(0,h,!0),m(W.getBigUint64(0,!0));return}if(typeof h=="string"){m(5),$(h);return}if(Array.isArray(h)){m(6),f(h.length),h.forEach(W=>g(()=>ge(W)));return}(!h||typeof h!="object")&&l("literal"),m(7);const T=Object.entries(h).sort(([W],[G])=>{const F=c.encode(W),we=c.encode(G);for(let Ce=0;Ce<Math.min(F.length,we.length);Ce++)if(F[Ce]!==we[Ce])return F[Ce]-we[Ce];return F.length-we.length});f(T.length);for(const[W,G]of T)$(W),g(()=>ge(G))},ye=h=>{p(),C(h,["Column","RowId"],"key"),"Column"in h?(m(0),V(h.Column)):(m(1),le(h.RowId))},be=h=>{p(),C(h,["Column","RowId"],"project"),"Column"in h?(m(0),V(h.Column)):(m(1),le(h.RowId))},oe=h=>{p(),C(h,["Literal","Param","SessionRef","OuterColumn","FrontierColumn","RowId"],"value"),"Literal"in h?(m(0),ge(h.Literal)):"Param"in h?(m(1),$(h.Param)):"SessionRef"in h?(m(2),f(h.SessionRef.length),h.SessionRef.forEach($)):"OuterColumn"in h?(m(3),V(h.OuterColumn)):"FrontierColumn"in h?(m(4),V(h.FrontierColumn)):(m(5),le(h.RowId))},Z=h=>{if(p(),h==="True"){m(9);return}if(h==="False"){m(10);return}if(C(h,["Cmp","IsNull","IsNotNull","In","Contains","And","Or","Not"],"predicate"),"Cmp"in h){m(0),V(h.Cmp.left);const T=["Eq","Ne","Lt","Le","Gt","Ge"].indexOf(h.Cmp.op);T<0&&l("comparison operator"),m(T),g(()=>oe(h.Cmp.right))}else"IsNull"in h?(m(1),V(h.IsNull.column)):"IsNotNull"in h?(m(2),V(h.IsNotNull.column)):"In"in h?(m(3),V(h.In.left),f(h.In.values.length),h.In.values.forEach(T=>g(()=>oe(T)))):"Contains"in h?(m(4),V(h.Contains.left),g(()=>oe(h.Contains.right))):"And"in h?(m(6),f(h.And.length),h.And.forEach(T=>g(()=>Z(T)))):"Or"in h?(m(7),f(h.Or.length),h.Or.forEach(T=>g(()=>Z(T)))):(m(8),g(()=>Z(h.Not)))},B=h=>{p(),C(h,["TableScan","Filter","Union","Join","Project","Gather","Distinct","OrderBy","Offset","Limit"],"expression"),"TableScan"in h?(N(h.TableScan,["table","alias"],"table scan"),m(0),$(h.TableScan.table),O(h.TableScan.alias,()=>$(h.TableScan.alias))):"Filter"in h?(m(1),g(()=>B(h.Filter.input)),g(()=>Z(h.Filter.predicate))):"Union"in h?(m(2),f(h.Union.inputs.length),h.Union.inputs.forEach(T=>{$(T.label),g(()=>B(T.input))})):"Join"in h?(N(h.Join,["left","right","on","join_kind"],"join"),m(3),g(()=>B(h.Join.left)),g(()=>B(h.Join.right)),f(h.Join.on.length),h.Join.on.forEach(T=>{p(),V(T.left),V(T.right)}),h.Join.join_kind!=="Inner"&&h.Join.join_kind!=="Left"&&l("join kind"),m(h.Join.join_kind==="Inner"?0:1)):"Project"in h?(m(4),g(()=>B(h.Project.input)),f(h.Project.columns.length),h.Project.columns.forEach(T=>{$(T.alias),be(T.expr)})):"Gather"in h?(m(5),g(()=>B(h.Gather.seed)),g(()=>B(h.Gather.step)),ye(h.Gather.frontier_key),h.Gather.bound==="Fixpoint"?m(0):(m(1),te(h.Gather.bound.MaxDepth)),f(h.Gather.dedupe_key.length),h.Gather.dedupe_key.forEach(ye)):"Distinct"in h?(m(6),g(()=>B(h.Distinct.input)),f(h.Distinct.key.length),h.Distinct.key.forEach(ye)):"OrderBy"in h?(m(7),g(()=>B(h.OrderBy.input)),f(h.OrderBy.terms.length),h.OrderBy.terms.forEach(T=>{p(),N(T,["column","direction"],"order term"),V(T.column),T.direction!=="Asc"&&T.direction!=="Desc"&&l("order direction"),m(T.direction==="Asc"?0:1)})):"Offset"in h?(m(8),g(()=>B(h.Offset.input)),te(h.Offset.offset)):(m(9),g(()=>B(h.Limit.input)),te(h.Limit.limit))};return B(e),Uint8Array.from(s)}var Nf=new De({fatal:!0}),w0=new TextEncoder().encode('["https://jazz.invalid","self-signed-open"]');function v0(e,t){return t?w0:e}function jf(e,t,r,n=!1,i,s,o,a){const c=new wt;return c.bytes(e),c.string(S0(v0(t,s))),r==null?c.none():c.some(l=>l.u64(r)),c.bool(n),i==null?c.none():c.some(l=>l.u64(i)),o==null?c.none():c.some(l=>l.bytes(Uf(o))),a==null?c.none():c.some(l=>l.bytes(a)),c.finish()}function S0(e){try{const t=Nf.decode(e);if(Vt(t))return t}catch{}throw new Error("native open config author must be a canonical UTF-8 author identity")}function Mf(e,t,r={}){const n=typeof r=="number"?{limit:r}:r,{limit:i,offset:s=0,orderBy:o=[],select:a,arraySubqueries:c=[],relation:l,partial:u=[]}=n;i!=null&&or("query limit",i),or("query offset",s);const f=new wt;return f.string(e),f.vec((p,g)=>{const m=t[g];ai(p,m)},t.length),f.vec(()=>{},0),f.none(),f.vec(()=>{},0),f.vec(()=>{},0),f.vec(()=>{},0),f.vec(()=>{},0),f.vec((p,g)=>{Bf(p,c[g])},c.length),a==null?f.none():f.some(p=>{p.vec((g,m)=>{g.string(a[m])},a.length)}),f.vec((p,g)=>{const m=o[g];p.string(m.column),p.u64(m.direction==="Asc"?0:1)},o.length),f.none(),i==null?f.none():f.some(p=>p.u64(i)),f.u64(s),l==null?f.none():f.some(p=>p.bytes(b0(l),!1)),Df(f,u),f.finish()}function Df(e,t){e.vec((r,n)=>{const i=t[n];if(r.string(i.column),i.kind==="json_pointer"){r.u64(3),r.string(i.at);return}or(`partial selection ${i.column} start`,i.from),or(`partial selection ${i.column} end`,i.to),r.u64(i.kind==="bytes"?0:i.kind==="text_utf16"?1:2),r.u64(i.from),r.u64(i.to)},t.length)}function Bf(e,t){const{filters:r=[],select:n,orderBy:i=[],limit:s=null,offset:o=0,requirement:a="Optional",nestedArrays:c=[]}=t;s!=null&&or(`array subquery ${t.columnName} limit`,s),or(`array subquery ${t.columnName} offset`,o),e.string(t.columnName),e.string(t.table),e.string(t.innerColumn),e.string(t.outerColumn),e.vec((l,u)=>{ai(l,r[u])},r.length),n==null?e.none():e.some(l=>{l.vec((u,f)=>{u.string(n[f])},n.length)}),e.vec((l,u)=>{const f=i[u];l.string(f.column),l.u64(f.direction==="Asc"?0:1)},i.length),s==null?e.none():e.some(l=>l.u64(s)),e.u64(o),e.u64(E0(a)),e.vec((l,u)=>{Bf(l,c[u])},c.length),Df(e,[])}function or(e,t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative safe integer`)}function E0(e){switch(e){case"Optional":return 0;case"AtLeastOne":return 1;case"MatchCorrelationCardinality":return 2}}function ai(e,t){if(t.op==="All"||t.op==="Any"){e.u64(t.op==="All"?0:1),e.vec((r,n)=>ai(r,t.predicates[n]),t.predicates.length);return}if(t.op==="Not"){e.u64(2),ai(e,t.predicate);return}if(t.op==="In"){e.u64(5),ci(e,t.column),e.vec((r,n)=>{r.u64(3),li(r,t.values[n])},t.values.length);return}if(t.op==="Contains"){e.u64(10),ci(e,t.column),Ff(e,t.value);return}if(t.op==="IsNull"||t.op==="IsNotNull"){t.op==="IsNotNull"&&e.u64(2),e.u64(12),ci(e,t.column);return}if(A0(t)){T0(e,t.column,t.op,t.value);return}throw new Error(`unsupported query predicate ${JSON.stringify(t)}`)}function A0(e){return e.op==="Eq"||e.op==="Ne"||e.op==="Gt"||e.op==="Gte"||e.op==="Lt"||e.op==="Lte"}function T0(e,t,r,n){e.u64(R0(r)),ci(e,t),Ff(e,n)}function ci(e,t){e.u64(0),e.string(t)}function Ff(e,t){e.u64(3),li(e,t)}function R0(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 li(e,t){if(t.type==="U64"){if(t.value<0n||t.value>(1n<<64n)-1n)throw new 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(r=>li(r,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 new 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 new 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 new 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 new Error("Double value must be finite");e.u64(4),e.f64Le(t.value);return}if(t.type==="Uuid"){e.u64(9);const r=Ks(t.value);if(!r)throw new Error(`invalid uuid ${t.value}`);e.bytes(r);return}if(t.type==="Bytea"){e.u64(7),e.bytes(t.value);return}if(t.type==="Array"){e.u64(12),e.vec((r,n)=>li(r,t.value[n]),t.value.length);return}e.u64(6),e.string(t.value)}var I0=64,wt=class{chunks=[];parts=[];partsBytes=0;finish(){if(this.parts.length===0)return Uint8Array.from(this.chunks);this.flushChunks();const e=new Uint8Array(this.partsBytes);let t=0;for(const r of this.parts)e.set(r,t),t+=r.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>0xffffffffffffffffn)throw new Error(`u64 out of range: ${e}`);this.u64Big(e);return}if(!Number.isSafeInteger(e)||e<0)throw new Error(`u64 must be a non-negative safe integer, got ${e}`);let t=e;do{let r=t&127;t=Math.floor(t/128),t!==0&&(r|=128),this.chunks.push(r)}while(t!==0)}i64(e){const t=ti(e,"i64"),r=t<0n?(-t<<1n)-1n:t<<1n;this.u64Big(r)}u64Big(e){let t=e;do{let r=Number(t&0x7fn);t>>=7n,t!==0n&&(r|=128),this.chunks.push(r)}while(t!==0n)}u32Le(e){if(!Number.isInteger(e)||e<0||e>4294967295)throw new 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){const 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(Wf(e))}bytes(e,t=!0){if(t&&this.u64(e.length),e.length<I0){for(const r of e)this.chunks.push(r);return}this.flushChunks(),this.pushPart(new Uint8Array(e))}vec(e,t){this.u64(t);for(let r=0;r<t;r+=1)e(this,r)}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)}},We=class{constructor(e){this.bytesValue=e}offset=0;u64(){const e=this.readCanonicalU64();if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error(`postcard u64 exceeds Number.MAX_SAFE_INTEGER: ${e}`);return Number(e)}u64BigInt(){return this.readCanonicalU64()}i64(){const e=this.readCanonicalU64();return(e&1n)===0n?e>>1n:-(e+1n>>1n)}readCanonicalU64(){let e=0n;for(let t=0;t<10;t+=1){const r=this.readByte(),n=BigInt(r&127);if(t===9&&n>1n)throw new Error("postcard u64 overflow");if(e|=n<<BigInt(t*7),(r&128)===0){if(t!==0&&e<1n<<BigInt(t*7))throw new Error("postcard u64 is not minimally encoded");return e}}throw new Error("postcard u64 overflow")}string(){return Nf.decode(this.bytes())}bool(){const e=this.readByte();if(e===0)return!1;if(e===1)return!0;throw new Error(`invalid bool tag ${e}`)}f64Le(){const e=this.bytesOfLength(8);return new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(0,!0)}bytes(e=!0){const t=e?this.u64():16;return this.bytesOfLength(t)}bytesAtMost(e,t){const r=this.u64();if(r>e)throw new Error(`${t} exceeds maximum length of ${e} bytes`);return this.bytesOfLength(r)}bytesOfLength(e){const t=this.offset+e;if(t>this.bytesValue.length)throw new Error("postcard bytes overflow");const r=this.bytesValue.subarray(this.offset,t);return this.offset=t,r}option(e){const t=this.readByte();if(t!==0){if(t!==1)throw new Error(`invalid option tag ${t}`);return e(this)}}readVec(e){const 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 new Error("postcard eof");return this.bytesValue[this.offset++]}};function Uf(e){return Wf(JSON.stringify(e,Vs))}function Wf(e){return new TextEncoder().encode(e)}async function*k0(e){const t=e;if(typeof t.getReader!="function"){const i=e[Symbol.asyncIterator]();let s=!1;try{for(;;){const o=await i.next();if(o.done){s=!0;return}yield o.value}}finally{if(!s)try{Promise.resolve(i.return?.()).catch(()=>{})}catch{}}}const r=t.getReader();let n=!1;try{for(;;){const i=await r.read();if(i.done){n=!0;return}yield i.value}}finally{if(!n)try{Promise.resolve(r.cancel()).catch(()=>{})}catch{}r.releaseLock()}}var zf="history.";function qf(e){return Vf(e)!==void 0}function Vf(e){return e.startsWith(zf)?e.slice(zf.length):void 0}var x0=[{name:"$transactionId",column_type:{type:"Text"},nullable:!1},{name:"$acceptedAt",column_type:{type:"Timestamp"},nullable:!1}],Gf=new WeakMap;function at(e,t){const r=Vf(t);if(r===void 0)return e[t];if(qf(r)||!Object.hasOwn(e,r))return;let n=Gf.get(e);n||Gf.set(e,n=new Map);let i=n.get(t);if(!i){const s=e[r];i={columns:[...s.columns,...x0],...s.branchBy?{branchBy:s.branchBy}:{}},n.set(t,i)}return i}var Hf="authority_changed",P0=class extends Error{name="AuthorityChangedError";code=Hf;constructor(e,t){super(e,t)}};function jo(e){return!e||typeof e!="object"?!1:e.code===Hf}function Mo(e){if(e==null)return null;const t=typeof e=="object"&&typeof e.message=="string"?e.message:String(e);if(jo(e))return new P0(t,{cause:e});if(e instanceof Error)return e;const r=new Error(t),n=typeof e=="object"?e.code:void 0;return typeof n=="string"&&Object.assign(r,{code:n}),r}var Jf="core_tick_failed",C0=class extends Error{name="CoreTickFailedError";code=Jf;constructor(e){super(`core tick failed: ${$0(e)}`,{cause:e})}};function O0(e){return!e||typeof e!="object"?!1:e.code===Jf}function $0(e){if(e instanceof Error)return e.message;if(e&&typeof e=="object"){const t=e.message;if(typeof t=="string")return t}return String(e)}function ui(e){if(e.startsWith("$"))return e;const t=e.indexOf(".$");return t>=0?e.slice(t+1):e.split(".").at(-1)??e}function Kf(){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 L0=["$canRead"],N0=["$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 Gr(e){return L0.includes(e)}function Xf(e){return N0.includes(e)}function Do(e){if(e==="$createdBy"||e==="$updatedBy"||e==="$deletedBy")return Kf();if(e==="$createdAt"||e==="$updatedAt"||e==="$deletedAt")return{type:"Timestamp"};const[t,...r]=e.split(".");if((t==="$createdBy"||t==="$updatedBy"||t==="$deletedBy")&&r.length){let n=Kf();for(const i of r){if(n.type!=="Row")return;const s=n.columns.find(o=>o.name===i);if(!s)return;n=s.column_type}return n}}var di="__jazz_include_";function j0(e,t,r,n){const i=r.filter(o=>!o.name.startsWith(di)),s=new Map;for(const o of i)s.set(o.name,n[o.name]??o.default??{type:"Null"});return Object.defineProperty({table:e,id:t,values:i.filter(o=>!Xf(o.name)).map(o=>s.get(o.name))},"valuesByColumn",{value:s,configurable:!0})}var Qf=Object.freeze({pending:0,oldestPendingAt:null,rejected:0,lastRejection:null});function M0(e,t){if(e.state!=="offline"||e.reason==="disconnected")return null;const r={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."}[e.reason];return{kind:e.reason,message:t||r,at:Date.now()}}var Yf=Object.freeze({state:"local-only"}),Zf=Object.freeze({state:"connecting"}),ep=Object.freeze({state:"connected"});function Re(e,t=e==="network"){return{state:"offline",reason:e,retrying:t}}function D0(e){switch(e?.phase??"noServer"){case"noServer":return Yf;case"offline":return Re("disconnected");case"live":return ep;case"connecting":case"backoff":return e.outagePublished?Re("network"):Zf;case"awaitingCredential":return Re("auth");case"stopped":return Re("stopped")}}function Bo(e,t){return e.state!==t.state?!1:e.state!=="offline"||t.state!=="offline"?!0:e.reason===t.reason&&e.retrying===t.retrying}function B0(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 Fo=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;const e=this.read();if(!(this.published!==void 0&&this.same(e,this.published))){this.published=e;for(const t of[...this.listeners])t(e)}}))}},F0=class extends Fo{},Hr="system",hT=ab({issuer:Gt,user_id:Hr,claims:{},authMode:"external"}),U0=new TextEncoder;function Uo(e){return U0.encode(eb(e))}function W0(e){const t=new wt;return t.string(e.table),Xv(t,[...e.descriptor]),Zu(t.finish())}function z0(e){if(!e||typeof e!="object")return;const t=e.code;return typeof t=="string"?t:void 0}var q0=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 tp(e){const t=z0(e);return t!==void 0&&q0.has(t)?t:void 0}var V0=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"]);function Wo(e){if(!e||typeof e!="object")return;const t=e.reason;return typeof t=="string"&&V0.has(t)?t:void 0}var rp=3600*1e3,G0=500,H0="jazz-http-stream-endpoints",zo="endpoints";function J0(){return globalThis.indexedDB!==void 0}function K0(){const e=globalThis.indexedDB;if(e)return new Promise((t,r)=>{const n=e.open(H0,1);n.onupgradeneeded=()=>n.result.createObjectStore(zo),n.onsuccess=()=>t(n.result),n.onerror=()=>r(n.error),n.onblocked=()=>r(new Error("blocked"))})}async function qo(e,t){const r=K0();if(!r)return;const n=await r;try{return await new Promise((i,s)=>{const o=t(n.transaction(zo,e).objectStore(zo));o.onsuccess=()=>i(o.result),o.onerror=()=>s(o.error)})}finally{n.close()}}var fi="jazz-stream-endpoint:",np=600*1e3;function ip(){if(!(typeof document>"u"))try{return globalThis.localStorage??void 0}catch{return}}function X0(e,t=Date.now()){const r=ip();if(r)try{const n=r.getItem(fi+e);if(n===null)return;const[i,s]=n.split(":");if(i!=="stream"&&i!=="none"||!(Number(s)>t)){r.removeItem(fi+e);return}return i==="stream"}catch{return}}function pi(e,t,r){const n=ip();if(n)try{n.setItem(fi+e,`${t}:${r}`)}catch{try{n.removeItem(fi+e)}catch{}}}async function Q0(e,t=Date.now()){let r;const n=await Promise.race([qo("readonly",s=>s.get(e)).then(s=>({until:s}),()=>{}),new Promise(s=>{r=setTimeout(()=>s(void 0),G0)})]).finally(()=>clearTimeout(r));if(!n)return!1;const i=typeof n.until=="number"&&n.until>t;return i?pi(e,"stream",n.until):pi(e,"none",t+np),i}function Y0(e,t=Date.now()){return pi(e,"stream",t+rp),qo("readwrite",r=>r.put(t+rp,e)).then(()=>{},()=>{})}function Z0(e){return pi(e,"none",Date.now()+np),qo("readwrite",t=>t.delete(e)).then(()=>{},()=>{})}var eS=0,sp="x-jazz-stream-key",op=1,tS=2;function rS(e,t){const r=new Uint8Array(5+t.byteLength);return r[0]=e,new DataView(r.buffer).setUint32(1,t.byteLength,!1),r.set(t,5),r}function ap(e){const t=e.reduce((i,s)=>i+s.byteLength,0),r=new Uint8Array(t);let n=0;for(const i of e)r.set(i,n),n+=i.byteLength;return r}var nS=class{buffered=new Uint8Array(0);push(e){this.buffered=this.buffered.byteLength?ap([this.buffered,e]):e;const t=[];let r=0;for(;this.buffered.byteLength-r>=5;){const i=new DataView(this.buffered.buffer,this.buffered.byteOffset+r).getUint32(1,!1);if(this.buffered.byteLength-r<5+i)break;t.push({kind:this.buffered[r],payload:this.buffered.slice(r+5,r+5+i)}),r+=5+i}return this.buffered=this.buffered.slice(r),t}get pending(){return this.buffered.byteLength}},iS=new TextEncoder,cp=new TextDecoder;function sS(e){const 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 lp=class{listeners=new Map;addEventListener(e,t){const r=this.listeners.get(e)??[];r.push(t),this.listeners.set(e,r)}emit(e,t){for(const r of this.listeners.get(e)??[])r(t)}},oS=4*1024*1024,up=(e,t)=>fetch(e,t),aS=class extends lp{constructor(e,t=up){super(),this.request=t,this.streamUrl=sS(e),this.run()}binaryType="arraybuffer";readyState=0;streamUrl;abort=new AbortController;session;queued=[];sending=!1;send(e){if(this.readyState!==1)throw new Error("HTTP stream session is not open");const t=typeof e=="string"?iS.encode(e):e;this.queued.push(rS(op,t)),this.flush()}close(){if(this.readyState>=2)return;const 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:{[sp]:e.key},signal:AbortSignal.timeout?.(hi)}).catch(()=>{}).finally(()=>this.abort.abort())}async run(){try{const e=await this.request(this.streamUrl,{method:"POST",credentials:"same-origin",signal:this.abort.signal});if(!e.ok||!e.body)throw new Error(`HTTP stream refused (${e.status})`);const t=e.body.getReader(),r=new nS;for(;;){const{done:n,value:i}=await t.read();if(n)break;for(const s of r.push(i)){if(this.readyState>=2)return;this.receive(s.kind,s.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===eS)this.session=JSON.parse(cp.decode(t)),this.readyState=1,this.emit("open");else if(e===op){const r=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);this.emit("message",{data:r})}else if(e===tS){const{code:r,reason:n}=JSON.parse(cp.decode(t));this.finish(r,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<=oS);)t+=this.queued[e].byteLength,e+=1;const r=ap(this.queued.splice(0,e)),n=await this.request(`${this.streamUrl}/${encodeURIComponent(this.session.id)}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/octet-stream",[sp]:this.session.key},body:r});if(!n.ok)throw new Error(`HTTP stream send refused (${n.status})`)}}catch(e){this.emit("error",e),this.close()}finally{this.sending=!1}}}fail(e,t){this.finish(e,t)}finish(e,t,r=!0){this.readyState>=2||(this.readyState=3,r&&this.abort.abort(),this.emit("close",{code:e,reason:t}))}},Jr=new Set,Kr=new Map,cS=3,hi=1e4,lS=2,ar=new Map,uS="x-jazz-stream",dp=new Set,dS="x-jazz-store-error",fp=new Set;async function fS(e,t){try{const r=await t(e.replace(/^ws/,"http"),{method:"POST",credentials:"same-origin",signal:AbortSignal.timeout?.(hi)});if(r.status===503&&r.headers.get(dS)==="1"){const n=await r.text().catch(()=>"");return n&&!fp.has(`${e}
|
|
4
4
|
${n}`)&&(fp.add(`${e}
|
|
5
5
|
${n}`),console.error(`jazz: the backend at ${e} can't serve: ${n}`)),"other"}return r.body?.cancel().catch(()=>{}),r.status===403?"refused":r.status!==426?"other":r.headers.get(uS)==="1"?"stream":"upgrades"}catch{return"silent"}}async function pS(e,t,r){const n=await fS(e,r);if(n==="stream")return n;if(n!=="upgrades")return Kr.delete(e),ar.delete(e),n==="refused"&&!dp.has(e)&&(dp.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.`)),n;const i=(Kr.get(e)??0)+1;Kr.set(e,i);const s=t?(ar.get(e)??0)+1:0;t?ar.set(e,s):ar.delete(e);const o=s>=lS;return i<cS&&!o?n:(Kr.delete(e),ar.delete(e),o?(console.warn(`jazz: ${s} WebSockets in a row to ${e} got no answer in ${hi/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 hS(e,t={}){const r=t.fetch??up,n=t.describeFailedUpgrade;return class extends lp{constructor(s){if(super(),this.url=s,Jr.has(s)){this.openStream();return}if(!J0()){this.inner=this.openNative();return}const o=X0(s);if(o===!0){Jr.add(s),this.openStream();return}if(o===!1){this.inner=this.openNative();return}Q0(s).then(a=>{this.closedEarly||(a?(Jr.add(s),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(s){if(!this.inner)throw new Error("WebSocket is not open");this.inner.send(s)}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(){const s=new aS(this.url,r);let o=!1;s.addEventListener("open",()=>{o=!0}),s.addEventListener("close",()=>{!o&&!this.closedByClient&&(Jr.delete(this.url),Z0(this.url))}),this.inner=s,this.forward(s)}openNative(){const s=new e(this.url);s.binaryType="arraybuffer";let o=!1,a;const c=(l,u,f=!1)=>{if(clearTimeout(this.openDeadline),!this.settled){if(a){a[l]??=u;return}a={[l]:u},this.probing=!0,pS(this.url,f,r).then(async p=>{const g=p==="stream"||p==="stream-in-between",b=!(!f&&(p==="upgrades"||p==="other"))||this.settled?void 0:await n?.(this.url,this.abort.signal).catch(()=>{});if(this.probing=!1,!this.settled){if(this.settled=!0,g){Jr.add(this.url),p==="stream"&&Y0(this.url),this.openStream();return}if(b){this.emit("error",new Error(b)),this.emit("close",{code:1006,reason:b});return}a?.error!==void 0&&this.emit("error",a.error),this.emit("close",a?.close??{code:1006,reason:""})}})}};return this.openDeadline=setTimeout(()=>{c("close",{code:1006,reason:"the WebSocket upgrade got no answer"},!0),s.close()},hi),s.addEventListener("open",()=>{a||(clearTimeout(this.openDeadline),o=!0,Kr.delete(this.url),ar.delete(this.url),this.settled=!0,this.emit("open"))}),s.addEventListener("message",l=>{a||this.emit("message",l)}),s.addEventListener("error",l=>{o?this.emit("error",l):c("error",l)}),s.addEventListener("close",l=>{o?this.emit("close",l):c("close",l)}),s}forward(s){s.addEventListener("open",()=>this.emit("open")),s.addEventListener("message",o=>this.emit("message",o)),s.addEventListener("error",o=>this.emit("error",o)),s.addEventListener("close",o=>this.emit("close",o))}}}var mS="jazz_renewal",_S="X-Jazz-Renew",pp=64,gS=65,yS=2048;function bS(e){const t=new We(e);if(t.u64()!==pp)throw new Error("not a renew-soon frame");const r=t.string(),n=t.u64();if(!t.done()||!r||r.length>yS)throw new Error("malformed renew-soon frame");return{session:r,renewInMs:n}}function wS(e){const t=new wt;return t.u64(gS),t.string(e),t.finish()}function vS(e){return e[0]===pp}function SS(e){try{const 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 ES(e){try{return`jazz-session-refresh:${new URL(e.replace(/^ws/,"http")).origin}`}catch{return`jazz-session-refresh:${e}`}}var AS=class extends Error{wireError;constructor(e){super(`websocket ${e.code} before server hello: ${e.message}`),this.name="PreHelloWireError",this.wireError=e}};function Vo(e){return e.retry==="later"&&(e.code==="not_ready"||e.code==="backpressure")}var TS="reauthenticate:";function RS(e){return e.code==="auth_failed"&&e.retry==="after_resume"&&e.message.startsWith(TS)}function IS(e){return e.retry==="later"&&(e.code==="websocket_closed"||e.code==="websocket_error"||e.code==="websocket_silent")}var ze=6,kS=ze,xS=ze,PS=16,CS=128,OS=256,Go=2048,Ho=12e4,$S=1e4,hp=1e3,LS=7,NS=4096,Jo=PS|CS|OS|NS,jS=1<<20,MS=5,mp=5,vt=2*1024*1024,Xr=4096;function Ko(e){BS(e);const t=new wt;t.vec((n,i)=>n.bytes(e[i]),e.length);const r=t.finish();if(r.byteLength>vt)throw new Error(`websocket frame batch exceeds maximum length of ${vt} bytes`);return r}function DS(e){if(e.byteLength>vt)throw new Error(`websocket frame batch exceeds maximum length of ${vt} bytes`);const t=new We(e),r=t.u64();if(r===0||r>Xr)throw new Error(`websocket frame batch exceeds frame-count limit of ${Xr}`);const n=[];for(let i=0;i<r;i+=1)n.push(t.bytesAtMost(vt,"websocket frame"));return Xo(t,"websocket frame batch"),n}function BS(e){if(e.length===0||e.length>Xr)throw new Error(`websocket frame batch exceeds frame-count limit of ${Xr}`);for(const t of e)if(t.byteLength>vt)throw new Error(`websocket frame exceeds maximum length of ${vt} bytes`)}function FS(e=Jo){wp(e,"client wire features");const t=new wt;return t.u64(0),t.u64(kS),t.u64(xS),t.u64(e),t.u64(0),t.none(),t.finish()}var US=0,WS=1;function zS(e){if(e[0]!==US)return!1;const t=new We(e);t.u64();const{min:r,max:n}=vp(t);return r===ze&&n===ze&&Sp(t),!0}function _p(e){if(e[0]!==WS)return!1;const t=new We(e);return t.u64(),yp(t),!0}function gp(e){const t=new We(e),r=t.u64();if(r!==1)throw new Error(`expected WireFrame::Error, got tag ${r}`);return yp(t)}function yp(e){const t={code:sE(e.u64()),retry:oE(e.u64()),message:e.string()};return Xo(e,"WireFrame::Error"),t}function bp(e){return e.code!=="auth_failed"?null:Yu(e.message)}var qS=class{url;socket;onFrame;onError;onTerminal;localFeatures;opened;resolveNegotiation;rejectNegotiation;negotiated=!1;closing=!1;terminated=!1;lastInbound=performance.now();silenceTimer;handshakeTimer;renewalUrl;renewalTimer;constructor(e){this.url=e.endpointUrl;const t=e.WebSocket??bb(this.url)??rE(this.url);this.onFrame=e.onFrame,this.onError=e.onError,this.onTerminal=e.onTerminal,this.localFeatures=(e.features??Jo)|Go,this.renewalUrl=JS(e.authJson)?SS(this.url):null,wp(this.localFeatures,"client wire features"),this.socket=new t(this.url),this.socket.binaryType="arraybuffer",this.watchHandshake(e.handshakeTimeoutMs??$S),this.opened=new Promise((r,n)=>{this.resolveNegotiation=r,this.rejectNegotiation=n}),aE(this.socket).then(()=>{this.closing||(this.socket.send(HS(e.authJson??"{}",e.peerIdentity,e.requestedLink,this.renewalUrl!==null)),this.socket.send(Ko([FS(this.localFeatures)])))},r=>{this.reportTerminal({code:"websocket_error",retry:"later",message:r instanceof Error?r.message:String(r)}),this.close()}),this.socket.addEventListener("message",r=>{this.lastInbound=performance.now(),this.handleMessage(r.data).catch(n=>{this.reportTerminal({code:"protocol_error",retry:"never",message:n instanceof Error?n.message:String(n)},void 0,!1),this.close()})}),this.socket.addEventListener("error",r=>{this.reportTerminal({code:"websocket_error",retry:"later",message:r instanceof Error?r.message:"websocket transport error"})}),this.socket.addEventListener("close",r=>{const n=GS(r);this.reportTerminal({code:"websocket_closed",retry:"later",message:`websocket closed (code=${n.code??"unknown"}, reason=${n.reason??"none"})`})})}async send(e){await this.sendBatch([e])}async sendBatch(e){await this.ready();let t=[],r=mp;for(const n of e){const i=n.byteLength+MS;t.length>0&&(t.length>=Xr||r+i>jS)&&(this.socket.send(Ko(t)),t=[],r=mp),t.push(n),r+=i}t.length>0&&this.socket.send(Ko(t))}ready(){return this.opened}get hasNegotiated(){return this.negotiated}close(){if(!this.closing){this.closing=!0,clearTimeout(this.silenceTimer),clearTimeout(this.handshakeTimer),clearTimeout(this.renewalTimer),this.reportTerminal({code:"websocket_closed",retry:"never",message:"websocket closed before server hello"},new Error("websocket closed before server hello"),!1,!1);try{this.socket.close()}catch{}}}reportTerminal(e,t=new Error(e.message),r=!0,n=!0){this.terminated||(this.terminated=!0,clearTimeout(this.silenceTimer),clearTimeout(this.handshakeTimer),clearTimeout(this.renewalTimer),this.rejectNegotiation(t),r&&this.onError?.(e),n&&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())},hp)},e)}scheduleRenewal({session:e,renewInMs:t}){clearTimeout(this.renewalTimer);const r=this.renewalUrl;r&&(this.renewalTimer=setTimeout(()=>{this.renewalTimer=void 0,!(this.closing||this.terminated)&&XS(r,e).then(n=>{if(!(!n||this.closing||this.terminated))return this.send(wS(n))}).catch(()=>{})},Math.min(t,2**31-1)))}watchSilence(e=!1){if(clearTimeout(this.silenceTimer),this.closing||this.terminated)return;const t=performance.now()-this.lastInbound;if(t>=Ho&&!e){this.silenceTimer=setTimeout(()=>this.watchSilence(!0),hp);return}if(t>=Ho){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(),Ho-t)}async handleMessage(e){for(const t of DS(await tE(e))){if(this.closing)return;if(zS(t)){if(this.negotiated)continue;this.negotiated=!0,clearTimeout(this.handshakeTimer);const r=VS(t,this.localFeatures);(r.features&Go)!==0&&this.watchSilence(),this.resolveNegotiation({...r,features:r.features&~Go});continue}if(!(this.negotiated&&t.byteLength===1&&t[0]===LS)){if(this.negotiated&&this.renewalUrl&&vS(t)){this.scheduleRenewal(bS(t));continue}if(!this.negotiated){if(_p(t)){const r=gp(t);if(bp(r)){this.reportTerminal(r,new Error(`websocket authentication failed before server hello: ${r.message}`)),this.close();return}this.reportTerminal(r,new AS(r)),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(_p(t)){const r=gp(t);if(Vo(r)){this.reportTerminal(r),this.close();return}this.onError?.(r);continue}this.onFrame(t)}}}};function VS(e,t=Jo){const r=new We(e);if(r.u64()!==0)throw new Error("expected WireFrame::Hello");const{min:n,max:i}=vp(r);if(n!==ze||i!==ze)throw new Error(`server must advertise exactly wire protocol ${ze}, got ${n}..=${i}`);const{features:s,role:o,authority:a}=Sp(r),c=s&~BigInt(t);if(c!==0n)throw new Error(`server accepted unsupported wire features 0x${c.toString(16)}`);if(o!==1)throw new Error("expected WirePeerRole::Core server hello");return{protocolVersion:ze,features:Number(s),authority:a}}function wp(e,t){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw new Error(`${t} must be an unsigned 32-bit integer, got ${e}`)}function vp(e){return{min:e.u64(),max:e.u64()}}function Sp(e){const t=e.u64BigInt(),r=e.u64(),n=e.option(i=>{const s=i.bytes();if(s.byteLength!==16)throw new Error(`WireHello.authority.node must be exactly 16 bytes, got ${s.byteLength}`);return{node:s,epoch:i.u64BigInt()}});return Xo(e,"WireFrame::Hello"),{features:t,role:r,authority:n}}function Xo(e,t){if(!e.done())throw new Error(`${t} has trailing postcard bytes`)}function GS(e){if(!e||typeof e!="object")return{};const t=e;return{code:typeof t.code=="number"?t.code:void 0,reason:typeof t.reason=="string"?t.reason:void 0}}function HS(e,t,r,n=!1){const i=JSON.parse(e),s=new De().decode(t),o=cE(i)??eE(s)??s;return JSON.stringify({peer_identity:s,...i,auth:{...i,sub:o},sub:o,...r?{requested_link:r}:{},...n?{[mS]:1}:{}})}function JS(e){if(!e)return!1;try{const 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 KS=3e4;async function XS(e,t){return QS(ES(e),()=>YS(e,t))}async function QS(e,t){const r=globalThis.navigator?.locks;if(!r)return t();let n;const i=()=>n??=t();try{await r.request(e,()=>{let s;return Promise.race([i().catch(()=>{}),new Promise(o=>{s=setTimeout(o,KS)})]).finally(()=>clearTimeout(s))})}catch{}return i()}async function YS(e,t){try{const r=await yb(e)(e,{method:"POST",credentials:"same-origin",redirect:"error",headers:{[_S]:t}});if(!r.ok)return null;const n=await r.json();return typeof n.renewal=="string"?n.renewal:null}catch{return null}}function ZS(e){const t=JSON.parse(e);if(t.admin_secret)return{};if(typeof t.backend_secret=="string"){const n=t.backend_session,i=n&&typeof n=="object"?n.claims:void 0;return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}if(typeof t.jwt_token!="string")return{};const r=Qu(t.jwt_token);if(!r)return{};if(r.iss==="urn:jazz:local-first"||r.iss==="urn:jazz:anonymous"){const{jazz_pub_key:n,...i}=r;return Xu(i)}return Xu(r)}function Qr(e,t){const r=JSON.parse(e);if(typeof r.admin_secret=="string"||typeof r.backend_secret=="string"&&!Yo(r))return new TextEncoder().encode(qt("urn:jazz:system","system"));const n=Ap(r);let i=null;try{i=Vt(new De({fatal:!0}).decode(t))}catch{}if(i?.account_id&&n){const s=Vt(n);if(s.issuer!==i.issuer||s.user_id!==i.user_id||s.account_id!==void 0&&s.account_id!==i.account_id)throw new Error("WebSocket credential must match the context account identity");return t}return n?new TextEncoder().encode(n):t}function Qo(e){const t=JSON.parse(e);return typeof t.backend_secret=="string"&&!t.admin_secret&&!Yo(t)&&delete t.jwt_token,JSON.stringify(t)}function Yo(e){const t=e.backend_session;return t!==null&&typeof t=="object"&&!Array.isArray(t)&&typeof t.issuer=="string"&&typeof t.user_id=="string"&&Ee(t.issuer)&&Ee(t.user_id)}function Ep(e){const t=JSON.parse(e);return typeof t.admin_secret=="string"||typeof t.backend_secret=="string"||Ap(t)!==null}function Ap(e){if(typeof e.admin_secret=="string")return null;if(typeof e.backend_secret=="string"&&Yo(e)){const t=e.backend_session;return qt(t.issuer,t.user_id,t.account_id)}if(typeof e.jwt_token=="string"){const t=Qu(e.jwt_token),r=typeof t?.iss=="string"?t.iss:void 0,n=t?.sub;if(typeof r=="string"&&typeof n=="string"&&Ee(r)&&Ee(n))return qt(r,n)}return null}function eE(e){return Vt(e)?.user_id??null}async function tE(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 new Error(`expected binary websocket message, got ${typeof e}`)}function rE(e){const t=iE();return nE(e)?hS(t):t}function nE(e){const t=globalThis.location;if(!t?.host)return!1;try{return new URL(e).host===t.host}catch{return!1}}function iE(){const e=globalThis.WebSocket;if(!e)throw new Error("browser WebSocket is not available");return e}function sE(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:throw new Error(`unknown WireErrorCode discriminant ${e}`)}}function oE(e){switch(e){case 0:return"never";case 1:return"after_auth";case 2:return"after_resume";case 3:return"later";default:throw new Error(`unknown WireRetry discriminant ${e}`)}}function aE(e){return e.readyState===1?Promise.resolve():new Promise((t,r)=>{let n=!1;const i=s=>{n||(n=!0,s())};e.addEventListener("open",()=>i(t)),e.addEventListener("error",s=>i(()=>r(s))),e.addEventListener("close",()=>i(()=>r(new Error("websocket closed before open"))))})}function cE(e){const t=e.sub;if(typeof t=="string"&&Ee(t))return t;const r=e.jwt_token;if(typeof r=="string"){const i=lE(r);if(i)return i}const n=e.backend_session;if(n&&typeof n=="object"){const i=n.user_id;if(typeof i=="string"&&Ee(i))return i}return null}function lE(e){const t=e.split(".");if(t.length<2)return null;try{const r=JSON.parse(uE(t[1]));return typeof r.sub=="string"&&Ee(r.sub)?r.sub:null}catch{return null}}function uE(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return typeof atob=="function"?atob(r):Buffer.from(r,"base64").toString("binary")}var dE=20,fE=/^(?:0|[1-9][0-9]*|-[1-9][0-9]*)$/,pE=16,hE={none:"none",connecting:"attempting",connected:"live",unavailable:"failed"},mE=250,_E=4;function Tp(e){return typeof e?.poll=="function"}function Yr(e){if(!e||e instanceof Uint8Array)throw new Error("Native runtime direct mutation did not return a write receipt");return e}function gE(e){const t=e;return typeof t?.poll=="function"&&typeof t.cancel=="function"}function yE(e,t){const r=e.message;return RS(e)?{kind:"reauthenticate",message:r}:bp(e)?{kind:"authRejected",message:r}:Vo(e)||e.code==="internal"&&e.retry==="later"?t?{kind:"network",message:r}:{kind:e.code==="not_ready"?"serverNotReady":"refused",message:r}:IS(e)?{kind:"network",message:r}:{kind:"fatal",message:r}}function bE(e,t){return e?Promise.allSettled([e,t]).then(r=>{for(const n of r)if(n.status==="rejected")throw n.reason}):t}function wE(e){const t=e;return typeof t?.poll=="function"&&typeof t.cancel=="function"&&typeof t.setWake=="function"}var Zo=new De({fatal:!0}),Rp=new WeakMap;function vE(e,t,r,n,i,s=!1){try{return SE(e,t,r,n,i,s)}catch(o){throw nv(o)}}function SE(e,t,r,n,i,s){if(i&&s)throw new Error("A native runtime cannot be both self-signed and backend-scoped");if(s){if(!e.openPersistentAsBackend)throw new Error("Native runtime does not support explicit backend opens; rebuild the matching Jazz native artifact");return e.openPersistentAsBackend(t,r,n)}if(i){if(!e.openPersistentWithSelfSignedProof)throw new Error("Native runtime does not support self-signed client opens; rebuild the matching Jazz native artifact");return e.openPersistentWithSelfSignedProof(t,r,n,i.token,i.appId,i.claimedAuthor)}if(!e.openPersistent)throw new Error("Native runtime does not expose persistent storage");return e.openPersistent(t,r,n)}function EE(e,t,r,n,i=!1){if(n&&i)throw new Error("A native runtime cannot be both self-signed and backend-scoped");if(i){if(!e.openMemoryAsBackend)throw new Error("Native runtime does not support explicit backend opens; rebuild the matching Jazz native artifact");return e.openMemoryAsBackend(t,r)}if(!n)return e.openMemory(t,r);if(!e.openMemoryWithSelfSignedProof)throw new Error("Native runtime does not support self-signed client opens; rebuild the matching Jazz native artifact");return e.openMemoryWithSelfSignedProof(t,r,n.token,n.appId,n.claimedAuthor)}function AE(e){const t=e.indexOf(". Plan: ");return t===-1?e:e.slice(0,t)}var TE=class va{constructor(t,r,n,i,s,o,a){if(this.schema=r,this.node=n,this.ownerRuntime=a?.owner?.ownerRuntime??this,this.readAuthorizationHost=a?.owner?.readAuthorizationHost??a?.readAuthorizationHost??"client-local",this.transactionOwner=a?.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=Uo(r),this.trustedBackend=(a?.owner?.trustedBackend??a?.backendMode)===!0,this.selfSignedClientProof=a?.selfSignedClientProof,this.scopeIsolatedRelay=a?.scopeIsolatedRelay===!0,this.webSocket=a?.webSocket,this.configBytes=jf(n,i,void 0,o,a?.initialSyncFlushEvery,a?.selfSignedClientProof,a?.migrations,a?.systemNode),this.peerIdentity=i,this.migrations=a?.owner?.migrations??a?.migrations,this.schemaHash=tb(r),a?.db)this.db=a.db;else if(a?.persistentPath){if(!t)throw new Error("Native runtime constructor required for persistent storage");this.db=vE(t,a.persistentPath,this.schemaBytes,this.configBytes,a?.selfSignedClientProof,a?.backendMode)}else{if(!t)throw new Error("Native runtime constructor required for memory storage");this.db=EE(t,this.schemaBytes,this.configBytes,a?.selfSignedClientProof,a?.backendMode)}if(a?.owner)return;this.slowQueryApp=a?.slowQueryLog?.appId,this.slowQueryConsoleDetail=a?.slowQueryLog?.consoleDetail;const c=a?.slowQueryLog?.thresholdMs;if(c!==void 0){if(!Number.isFinite(c)||c<0)throw new Error("slowQueryThresholdMs must be a non-negative number of milliseconds");this.db.setSlowQueryThresholdMs?.(c)}if(typeof this.db.setTickScheduler!="function")throw new Error("Native runtime requires db.setTickScheduler");this.db.setTickScheduler(((l,u)=>{const f=typeof l=="string"?l:u;(f==="immediate"||f==="deferred"||f==="after-current-turn"||typeof f=="string"&&f.startsWith("after:"))&&this.scheduleCoreWake(f)})),this.db.onUpstreamFailure?.(l=>{if(!l)return this.nativeAuthRefusalRenewable=!1,this.clearRemoteServerTransportError();const u=l.code?Mo({code:l.code,message:l.reason}):new Error(l.reason);this.handleServerTransportError(u,this.serverConnectionGeneration,l.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;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 F0(()=>this.readRemoteLinkState());linkStatusPublisher=new Fo(()=>this.upstreamLinkStatus(),Bo);syncStatusPublisher=new Fo(()=>this.readSyncStatus(),(t,r)=>B0(t.uploads,r.uploads)&&Bo(t.link,r.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;closed=!1;foregroundLeaseQuiesced=!1;foregroundLeaseCapture=null;foregroundLeaseDraining=!1;physicalCloseStarted=!1;nextSubscriptionId=1;static fromDb(t,r,n,i,s,o,a){return new va(null,r,n,i,s,o,{db:t,selfSignedClientProof:a?.selfSignedClientProof,scopeIsolatedRelay:a?.scopeIsolatedRelay,slowQueryLog:a?.slowQueryLog})}migrations;registerSchemaView(t,r){return new va(null,t,this.node,this.peerIdentity,1,!0,{db:this.db.registerSchema(Uo(t),r?Uf(r):void 0),backendMode:this.trustedBackend,owner:this})}createPeerAuthority(){return{node:this.node,epoch:Uu(),features:this.nativeWireFeatures()}}async connectUpstreamPeer(t){return this!==this.ownerRuntime?await this.ownerRuntime.connectUpstreamPeer(t):(this.peerUpstreamAttached=!0,t?this.connectNegotiatedUpstream({protocolVersion:ze,features:t.features,authority:t}):await this.db.connectUpstream())}onPeerTransportWork(t){return this!==this.ownerRuntime?this.ownerRuntime.onPeerTransportWork(t):(this.peerTransportWorkListeners.add(t),()=>{this.peerTransportWorkListeners.delete(t)})}onAuxiliaryTrace(t){return this!==this.ownerRuntime?this.ownerRuntime.onAuxiliaryTrace(t):(this.auxiliaryTraceListeners.add(t),this.serverTransport?.setAuxiliaryTraceEnabled?.(!0),()=>{this.auxiliaryTraceListeners.delete(t),this.auxiliaryTraceListeners.size===0&&this.serverTransport?.setAuxiliaryTraceEnabled?.(!1)})}onQueryCoverageTrace(t){return this!==this.ownerRuntime?this.ownerRuntime.onQueryCoverageTrace(t):(this.queryCoverageTraceListeners.add(t),()=>this.queryCoverageTraceListeners.delete(t))}emitQueryCoverageTrace(t){if(this!==this.ownerRuntime){this.ownerRuntime.emitQueryCoverageTrace(t);return}const r={stage:t,peerActivityEpoch:this.peerTransportActivityEpoch,peerProcessedActivityEpoch:this.peerTransportProcessedActivityEpoch};for(const n of this.queryCoverageTraceListeners)n(r)}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();const t=this.peerTransportActivityEpoch;await this.runCoreTick(),!this.closed&&(this.peerTransportProcessedActivityEpoch=Math.max(this.peerTransportProcessedActivityEpoch,t))}retirePeerTransport(t){return this!==this.ownerRuntime?this.ownerRuntime.retirePeerTransport(t):(this.auxiliaryReceiveDeadlines.get(t)?.close(),this.auxiliaryReceiveDeadlines.delete(t),this.coreOperation?new Promise((r,n)=>{const i=this.pendingTransportRetirements.get(t)??[];i.push({resolve:r,reject:n}),this.pendingTransportRetirements.set(t,i)}):(t.close(),Promise.resolve()))}setNonDurableClient(){if(this!==this.ownerRuntime)return this.ownerRuntime.setNonDurableClient();if(!this.db.setNonDurableClient)throw new 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 new 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 new Error("Native runtime is already closed");this.closed=!0,this.clearCoreDeadline(),this.foregroundLeaseQuiesced=!0,this.foregroundLeaseDraining=!0;const t=this.captureForegroundTxTimeHighWater().finally(()=>{this.foregroundLeaseDraining=!1,this.clearCoreDeadline()});return this.foregroundLeaseCapture=t,t}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(t){if(this!==this.ownerRuntime)return this.ownerRuntime.seedForegroundTxTimeHighWater(t);if(!this.db.seedForegroundTxTimeHighWater)throw new Error("Native runtime does not expose foreground transaction high-water seeding");this.db.seedForegroundTxTimeHighWater(t)}setLargeValueStagingPolicy(t,r,n){if(this!==this.ownerRuntime)return this.ownerRuntime.setLargeValueStagingPolicy(t,r,n);if(!this.db.setLargeValueStagingPolicy)throw new Error("Native runtime does not expose large-value staging policy");this.db.setLargeValueStagingPolicy(t,r,n)}async evictExpiredStagedLargeValues(){if(this!==this.ownerRuntime)return await this.ownerRuntime.evictExpiredStagedLargeValues();if(!this.db.evictExpiredStagedLargeValues)throw new Error("Native runtime does not expose large-value staging maintenance");return await this.db.evictExpiredStagedLargeValues()}async acceptPeer(t={},r,n=this.peerIdentity){if(this!==this.ownerRuntime)return this.ownerRuntime.acceptPeer(t,r,n);if(this.closed)throw new Error("Native runtime is closed");return this.runWhenCoreIdle(async()=>{if(this.closed)throw new Error("Native runtime is closed");let i;this.coreOperation={kind:"admission",completion:new Promise(s=>{i=s})};try{const s=this.selfSignedClientProof;let o;if(s){if(!Tt(n,this.peerIdentity))throw zp();if(!this.db.acceptSubscriberWithSelfSignedProof)throw new Error("Native runtime does not support self-signed subscriber admission; rebuild the matching Jazz WASM artifact");o=await this.db.acceptSubscriberWithSelfSignedProof(t,s.token,s.appId,s.claimedAuthor,r)}else{if(!this.db.acceptSubscriber)throw new Error("Native runtime does not expose subscriber links");o=await this.db.acceptSubscriber(n,t,r)}if(this.closed)throw o.close(),new Error("Native runtime closed during subscriber admission");return o}finally{this.drainTransportRetirements(),this.coreOperation=null,i(),this.coreTickAgain&&!this.closed&&this.scheduleCoreTick()}})}async runWhenCoreIdle(t){const r=this.ownerRuntime;for(;r.coreOperation;)await r.coreOperation.completion;return t()}setRemoteLinkHint(t){if(this!==this.ownerRuntime)return this.ownerRuntime.setRemoteLinkHint(t);this.closed||this.db.setRemoteLinkHint?.(hE[t])}remoteLinkState(){return this!==this.ownerRuntime?this.ownerRuntime.remoteLinkState():this.readRemoteLinkState()}onRemoteLinkStateChange(t,r){if(this!==this.ownerRuntime){this.ownerRuntime.onRemoteLinkStateChange(t,r);return}this.remoteLink.subscribe(t,r),this.startNativeLinkPoll()}startNativeLinkPoll(){!this.db?.nativeConnectionStatus||this.nativeLinkPoll||this.closed||!this.linkHasListeners()||(this.nativeLinkPoll=setInterval(()=>{this.linkHasListeners()?this.linkChanged():this.stopNativeLinkPoll()},mE))}noteFirstLoadWait(t){if(!$E(t))return;const r=this.ownerRuntime;r.firstLoadWaitSeen||(r.firstLoadWaitSeen=!0,r.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 Re("stopped",!1);const t=this.db?.nativeConnectionStatus?.();return t?t.configured?t.explicitlyOffline?Re("disconnected"):t.authRejected?Re("auth"):t.connected?ep:this.serverTransportError?this.serverTransportErrorRetrying?Re("network"):jo(this.serverTransportError)?Re("authority-changed",!1):Re("stopped"):Zf:Yf:this.linkStatus?.phase==="stopped"&&jo(this.upstreamRefusal)?Re("authority-changed",!1):D0(this.linkStatus)}canClearClientStorage(){return this!==this.ownerRuntime?this.ownerRuntime.canClearClientStorage():typeof this.db?.deleteNativeStore=="function"}async clearClientStorage(){if(this!==this.ownerRuntime)return this.ownerRuntime.clearClientStorage();if(!this.db?.deleteNativeStore)throw new Error("Runtime does not support client storage reset.");const t=this.db.deleteNativeStore();return this.closed=!0,t}uploadStatus(){return this!==this.ownerRuntime?this.ownerRuntime.uploadStatus():this.closed?Qf:this.db?.uploadStatus?.()??Qf}lastLinkFailure(){return this!==this.ownerRuntime?this.ownerRuntime.lastLinkFailure():(this.noteLinkFailure(),this.lastFailure)}noteLinkFailure(){const t=this.upstreamLinkStatus(),r=t.state==="offline"?t.reason:null;if(r===this.failingAs)return;this.failingAs=r;const n=M0(t,(this.linkFailure??this.serverTransportError)?.message);n&&(this.lastFailure=n)}onUpstreamLinkStatusChange(t,r){if(this!==this.ownerRuntime){this.ownerRuntime.onUpstreamLinkStatusChange(t,r);return}this.linkStatusPublisher.subscribe(t,r),this.startNativeLinkPoll()}onSyncStatusChange(t,r){if(this!==this.ownerRuntime){this.ownerRuntime.onSyncStatusChange(t,r);return}this.syncStatusPublisher.subscribe(t,r),this.startNativeLinkPoll()}readSyncStatus(){return{link:this.upstreamLinkStatus(),uploads:this.uploadStatus()}}readRemoteLinkState(){if(this.closed)return"unavailable";const t=this.db?.nativeConnectionStatus?.();if(t)return t.configured?t.explicitlyOffline||t.authRejected?"unavailable":t.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;const t=this.linkStatus?.consecutiveFailures?this.waitForServerTransportError("global"):null;try{await(t?Promise.race([this.serverCarrierPromise,t.promise]):this.serverCarrierPromise)}finally{t?.cancel()}}isClosed(){return this.ownerRuntime.closed}async close(){if(this!==this.ownerRuntime){this.closeRuntimeState();return}if(!this.physicalCloseStarted&&!(this.closed&&!this.foregroundLeaseQuiesced)){this.physicalCloseStarted=!0,this.closed=!0,this.clearCoreDeadline();for(const t of this.pendingNativeAdmissionCancels)t();for(const t of this.pendingNativeReadCancels)t();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(()=>{}),this.closeRuntimeState(!0),await this.db.close?.()}}discard(){this.closeRuntimeState()}closeRuntimeState(t=!1){if(this.closed&&!t)return!1;this.closed=!0,this.clearCoreDeadline();for(const i of this.pendingNativeAdmissionCancels)i();for(const i of this.pendingNativeReadCancels)i();for(const[i,s]of this.subscriptions)this.terminateSubscription(i,s);if(this!==this.ownerRuntime)return this.subscriptions.clear(),!1;for(const i of this.writes.values())i.close?.();this.subscriptions.clear(),this.pendingTxs.clear(),this.completedTxs.clear(),this.writes.clear(),this.serverConnectionGeneration+=1,this.clearLinkTimer(),this.linkAttemptId=null,this.settleLinkConnection(new Error("server transport disconnected")),this.stopNativeLinkPoll(),this.linkChanged();const r=this.serverConnectionAttempt;this.serverConnectionAttempt=null,r&&this.finishServerConnectionAttempt(r,new Error("runtime closed")),this.serverCarrierPromise=null,this.clearServerTransportErrorWaiters(),this.resolveServerTransportWorkWaiters(),this.peerTransportWorkListeners.clear(),this.localSettlementListeners.clear(),this.pendingInboundServerFrames.length=0;const n=this.serverTransport;return this.serverTransport=null,n&&this.retirePeerTransport(n).catch(Ti),this.peerUpstreamAttached=!1,this.serverCarrier?.close(),this.serverCarrier=null,!0}previewInsert(t,r,n){const i=this.rowStateFromValues(t,n?Pe(n):zt(16),r);return{id:i.id,values:i.values}}insert(t,r,n,i){this.assertMutationAdmission("Insert");const s=i?Pe(i):void 0,o=Ie(n);this.applySessionClaims(o);const a=this.trustedWriteIdentity(o),c=this.backendAttribution(n),l=At(n),u=Et(n);cr(c,u);const f=this.currentTx(n,"Insert");f&&this.assertTransactionAttribution(f,c);const p=aa(this.table(t),r);if(f){this.assertTransactionWriteIdentity(f,c?void 0:a);const m=this.db.insertInTransaction(f.id,t,p,{rowId:s,branch:u?.head,updatedAtMs:l??void 0});if(!(m instanceof Uint8Array))throw new Error("Native runtime transaction insert did not return a row id");const b=this.rowStateFromValues(t,m,r);return f.hasStagedMutations=!0,{id:b.id,values:b.values,kind:"staged",openTransactionId:St(n)}}const g=lr("Insert",()=>Yr(this.db.insert(t,p,{rowId:s,author:c?void 0:a,attribution:c,branch:u?.head,updatedAtMs:l??void 0})));return this.finishInsert(t,s??g.rowId,r,g)}async streamingMutation(t,r,n,i,s,o,a){const c=this.db.beginStreamingMutation,l=t==="insert"?"Insert":t==="update"?"Update":"Upsert";this.assertMutationAdmission(l);const u=this.currentTx(o,l),f=Ie(o);this.applySessionClaims(f);const p=this.trustedWriteIdentity(f),g=this.backendAttribution(o),m=Et(o),b=At(o);if(cr(g,m),u&&(this.assertTransactionAttribution(u,g),this.assertTransactionWriteIdentity(u,g?void 0:p)),!c)throw new Error("Native runtime does not expose streaming mutations");const $=this.table(r),C=$.columns.find(B=>B.name===i)?.column_type.type;if(C!=="Text"&&C!=="Json"&&C!=="Bytea")throw new Error(`Streaming insert requires a Text, Json, or Bytea column: ${r}.${i}`);const N=a?Pe(a):zt(16),te=t==="insert"?cA($,n,i,r):lA($,n,i),V=c.call(this.db,r,N,te,i,t,g?void 0:p,g,b??void 0,m?.head,m?.base,u?.id);if(u&&!V.finishInTransaction)throw await V.abort(),new Error("This native runtime does not support streaming inside a transaction yet");const le=this.ownerRuntime;let ge;const ye=new Promise(B=>{ge=B});le.pendingStreamingMutations.add(ye);const be=new TextEncoder,oe=async B=>{for(let T=0;T<B.byteLength;T+=65536)await V.push(B.subarray(T,T+65536))};let Z="";try{for await(const G of k0(s))if(typeof G=="string"){if(C==="Bytea")throw new Error("Bytea streams require Uint8Array chunks");let F=Z+G;Z="";const we=F.charCodeAt(F.length-1);we>=55296&&we<=56319&&(Z=F.slice(-1),F=F.slice(0,-1)),F.length>0&&await oe(be.encode(F))}else if(G instanceof Uint8Array)Z&&(await oe(be.encode(Z)),Z=""),await oe(G);else throw new Error("Streaming insert chunks must be strings or Uint8Array values");Z&&await oe(be.encode(Z));const B=le.streamingFinalization;let h;const T=new Promise(G=>{h=G});le.streamingFinalization=B.then(()=>T),await B;let W;try{u?(await V.finishInTransaction(),u.hasStagedMutations=!0,W={kind:"staged",openTransactionId:u.id}):W=this.finishMutation(await V.finish())}finally{h()}return{id:Be(N),...W}}catch(B){throw await V.abort(),B}finally{ge(),le.pendingStreamingMutations.delete(ye)}}restore(t,r,n,i){this.assertMutationAdmission("Restore");const s=Pe(r),o=Ie(i);this.applySessionClaims(o);const a=this.trustedWriteIdentity(o),c=this.backendAttribution(i),l=At(i),u=Et(i);cr(c,u);const f=this.currentTx(i,"Restore");f&&this.assertTransactionAttribution(f,c);const p=aa(this.table(t),n);if(f){this.assertTransactionWriteIdentity(f,c?void 0:a),this.db.restoreInTransaction(f.id,t,s,p,{branch:u?.head,updatedAtMs:l??void 0});const m=this.rowStateFromValues(t,s,n);return f.hasStagedMutations=!0,{id:m.id,values:m.values,kind:"staged",openTransactionId:St(i)}}const g=lr("Restore",()=>Yr(this.db.restore(t,s,p,{author:c?void 0:a,attribution:c,branch:u?.head,updatedAtMs:l??void 0})));return this.finishInsert(t,s,n,g)}update(t,r,n,i){this.assertMutationAdmission("Update");const s=Pe(r),o=Ie(i);this.applySessionClaims(o);const a=this.trustedWriteIdentity(o),c=this.backendAttribution(i),l=At(i),u=Et(i);cr(c,u);const f=this.currentTx(i,"Update");f&&this.assertTransactionAttribution(f,c);const p=on(this.table(t),n);if(f)return this.assertTransactionWriteIdentity(f,c?void 0:a),this.db.updateInTransaction(f.id,t,s,p,{head:u?.head,base:u?.base,updatedAtMs:l??void 0}),f.hasStagedMutations=!0,{kind:"staged",openTransactionId:St(i)};const g=lr("Update",()=>Yr(this.db.update(t,s,p,{author:c?void 0:a,attribution:c,head:u?.head,base:u?.base,updatedAtMs:l??void 0})));return this.finishMutation(g)}updateLargeValues(t,r,n,i,s){this.assertMutationAdmission("Update");const o=Pe(r),a=At(s),c=Et(s),l=this.currentTx(s,"Update");if(c)throw new Error("Partial-value updates (applyDiffs, editedFrom) are not yet supported in branch views.");if(l){const g=Ie(s);this.applySessionClaims(g);const m=this.trustedWriteIdentity(g),b=this.backendAttribution(s);this.assertTransactionAttribution(l,b),this.assertTransactionWriteIdentity(l,b?void 0:m);const $=this.db.updateLargeValuesInTransaction;if(!$)throw Wp("Update","typed partial-value updates in transactions are not supported by this runtime");const O=on(this.table(t),n);return $.call(this.db,l.id,t,o,O,i,a??void 0),l.hasStagedMutations=!0,{kind:"staged",openTransactionId:St(s)}}if(IE(s,this.peerIdentity))throw new Error("Partial-value updates (applyDiffs, editedFrom) do not yet support a session or attributed identity outside a transaction.");const u=this.db.updateLargeValues;if(!u)throw new Error("Native runtime does not support typed partial-value updates.");const f=on(this.table(t),n),p=lr("Update",()=>u.call(this.db,t,o,f,i,a??void 0));return this.finishMutation(p)}upsert(t,r,n,i){this.assertMutationAdmission("Upsert");const s=Pe(r),o=this.table(t),a=Ie(i);this.applySessionClaims(a);const c=this.trustedWriteIdentity(a),l=this.backendAttribution(i),u=At(i),f=Et(i);cr(l,f);const p=this.currentTx(i,"Upsert");p&&this.assertTransactionAttribution(p,l);let g;try{g=on(o,n)}catch(b){throw Wp("Upsert",VE(ke(b)))}if(p)return this.assertTransactionWriteIdentity(p,l?void 0:c),this.db.upsertInTransaction(p.id,t,s,g,{head:f?.head,base:f?.base,updatedAtMs:u??void 0}),p.hasStagedMutations=!0,{kind:"staged",openTransactionId:St(i)};const m=lr("Upsert",()=>Yr(this.db.upsert(t,s,g,{author:l?void 0:c,attribution:l,head:f?.head,base:f?.base,updatedAtMs:u??void 0})));return this.finishMutation(m)}delete(t,r,n){this.assertMutationAdmission("Delete"),this.table(t);const i=Pe(r),s=Ie(n);this.applySessionClaims(s);const o=this.trustedWriteIdentity(s),a=this.backendAttribution(n),c=At(n),l=Et(n);cr(a,l);const u=this.currentTx(n,"Delete");if(u&&this.assertTransactionAttribution(u,a),u)return this.assertTransactionWriteIdentity(u,a?void 0:o),this.db.deleteInTransaction(u.id,t,i,{head:l?.head,base:l?.base,updatedAtMs:c??void 0}),u.hasStagedMutations=!0,{kind:"staged",openTransactionId:St(n)};const f=lr("Delete",()=>Yr(this.db.delete(t,i,{author:a?void 0:o,attribution:a,head:l?.head,base:l?.base,updatedAtMs:c??void 0})));return this.finishMutation(f)}canInsertLocally(t,r,n){return"unknown"}canReadLocally(t,r,n){return"unknown"}canUpdateLocally(t,r,n,i){return"unknown"}canDeleteLocally(t,r,n){return"unknown"}isScopedPermissionAdvice(t){return this.readAuthorizationHost!=="trusted-serving"||!t?!1:!(this.trustedBackend&&t.issuer===Gt&&t.user_id===Hr&&Mr(t,Ku(t)))}delegatedPermissionAdviceSession(t){if(!this.trustedBackend||!t||!this.isScopedPermissionAdvice(t))return null;try{return _i(JSON.stringify(t))}catch{return null}}explainReadClauses(t,r,n){if(!this.trustedBackend)throw new Error("explain runs only on a trusted backend");const i=this.db.explainReadClauses;if(!i)throw new Error("explain is not supported yet by this runtime");const s=_i(JSON.stringify(n));if(!s?.identity)throw new Error("explain needs a user to explain for");return i.call(this.db,t,r,s.identity,s.claims)}requestInsertPermissionAdvice(t,r,n){if(this.isScopedPermissionAdvice(n)&&!this.trustedBackend)return Promise.resolve("unknown");const i=this.delegatedPermissionAdviceSession(n);if(this.isScopedPermissionAdvice(n)&&!i)return Promise.resolve("unknown");const s=this.db.requestInsertPermissionAdvice;if(!s)return Promise.resolve("unknown");const o=aa(this.table(t),r,t);return this.withPermissionAdviceTimeout(()=>s.call(this.db,t,o,i?.identity,i?.claims))}requestReadPermissionAdvice(t,r,n){if(this.isScopedPermissionAdvice(n)&&!this.trustedBackend)return Promise.resolve("unknown");const i=this.delegatedPermissionAdviceSession(n);if(this.isScopedPermissionAdvice(n)&&!i)return Promise.resolve("unknown");const s=this.db.requestReadPermissionAdvice;return s?this.withPermissionAdviceTimeout(()=>s.call(this.db,t,Pe(r),i?.identity,i?.claims)):Promise.resolve("unknown")}requestUpdatePermissionAdvice(t,r,n,i){if(this.isScopedPermissionAdvice(i)&&!this.trustedBackend)return Promise.resolve("unknown");const s=this.delegatedPermissionAdviceSession(i);if(this.isScopedPermissionAdvice(i)&&!s)return Promise.resolve("unknown");const o=this.db.requestUpdatePermissionAdvice;if(!o)return Promise.resolve("unknown");const a=on(this.table(t),n);return this.withPermissionAdviceTimeout(()=>o.call(this.db,t,Pe(r),a,s?.identity,s?.claims))}requestDeletePermissionAdvice(t,r,n){if(this.isScopedPermissionAdvice(n)&&!this.trustedBackend)return Promise.resolve("unknown");const i=this.delegatedPermissionAdviceSession(n);if(this.isScopedPermissionAdvice(n)&&!i)return Promise.resolve("unknown");const s=this.db.requestDeletePermissionAdvice;return s?this.withPermissionAdviceTimeout(()=>s.call(this.db,t,Pe(r),i?.identity,i?.claims)):Promise.resolve("unknown")}captureSnapshot(){if(this!==this.ownerRuntime)return this.ownerRuntime.captureSnapshot();if(this.closed)return Promise.reject(new Error("Cannot capture a snapshot: native runtime is closed"));if(!this.db.captureSnapshot)return Promise.reject(new Qy);const t=this.db.captureSnapshot();return this.scheduleCoreTick(),this.awaitNativeRead(t).then(r=>Xy(Zo.decode(r)))}beginTransaction(t,r,n){if(this!==this.ownerRuntime)return this.ownerRuntime.beginTransaction(t,r,n);if(this.closed)throw new Error("Begin transaction failed: native runtime is closed");if(this.pendingTxs.has(r)||this.completedTxs.has(r))throw new Error(`Begin transaction failed: transaction ${r} has already been opened`);const i=Ie(n);this.applySessionClaims(i);const s=this.trustedWriteIdentity(i),o=this.backendAttribution(n),a=o?void 0:s;return this.db.beginTransaction(r,t,a,o),this.pendingTxs.set(r,{id:r,kind:t,identity:a,requestSession:a?i??void 0:void 0,attribution:o,hasStagedMutations:!1}),r}hasStagedTransactionWrites(t){return this!==this.ownerRuntime?this.ownerRuntime.hasStagedTransactionWrites(t):this.pendingTxs.get(t)?.hasStagedMutations}commitTransaction(t){if(this!==this.ownerRuntime)return this.ownerRuntime.commitTransaction(t);if(this.closed)throw new Error("Commit transaction failed: native runtime is closed");const r=this.pendingTxs.get(t);if(!r)throw new Error(xE(t,this.completedTxs));if(!r.hasStagedMutations&&r.kind==="mergeable")throw new Error("Commit transaction failed: empty mergeable transaction has no committed unit; roll it back instead");const n=this.db.commitTransaction(t,r.kind);this.pendingTxs.delete(t),this.completedTxs.set(t,{kind:r.kind,state:"committed"}),this.pumpSubscriptions(),this.scheduleServerPump(),this.notifyPeerTransportWork();const i=ta(n,this.writes);return this.nonDurableClient&&this.trackLocalSettlement(i),i}async waitForTransaction(t,r,n={}){if(this!==this.ownerRuntime)return this.ownerRuntime.waitForTransaction(t,r,n);typeof t!="string"&&(t=await t);const i=this.writes.get(t);if(!i)throw new Error(`Wait for transaction failed: unknown transaction ${t}`);const{signal:s}=n,o=n.observeOnly?i.wait(r,!0):i.wait(r);if(o.catch(()=>{}),n.ready)if(s){let c;const l=new Promise(u=>{c=()=>u(),s.addEventListener("abort",c,{once:!0})});try{await Promise.race([n.ready,l])}finally{s.removeEventListener("abort",c)}}else await n.ready;const a=o.then(()=>"settled");for(a.catch(()=>{});;){if(this.closed)throw new Error("Wait for transaction failed: native runtime is closed");s?.throwIfAborted(),this.throwServerTransportErrorForTier(r,!0);const c=this.serverTransportWorkEpoch;this.startServerPump(),this.throwServerTransportErrorForTier(r,!0);const l=this.waitForServerTransportError(r,!0),u=this.waitForServerTransportWork(r,c),f=this.waitForLocalStorageFailure(r);let p;try{const g=[a];if(l&&g.push(l.promise),f&&g.push(f.promise),u&&g.push(u.promise.then(()=>"work")),s&&g.push(new Promise(m=>{const b=()=>m("work");s.addEventListener("abort",b,{once:!0}),p=()=>s.removeEventListener("abort",b)})),await Promise.race(g)==="settled"){this.pumpSubscriptions();return}}catch(g){const m=WE(t,g);throw m||g}finally{p?.(),l?.cancel(),u?.cancel(),f?.cancel()}}}rollbackTransaction(t){if(this!==this.ownerRuntime)return this.ownerRuntime.rollbackTransaction(t);const r=this.pendingTxs.get(t);if(!r)throw new Error(PE(t,this.completedTxs));try{this.db.rollbackTransaction(t)}finally{this.pendingTxs.delete(t)}return this.completedTxs.set(t,{kind:r.kind,state:"rolled_back"}),Promise.resolve(!0)}async query(t,r,n,i){if(this.closed||this.ownerRuntime.closed)throw new Error("Native runtime is closed");xp(n,i),this.noteFirstLoadWait(i),CE(i,this.pendingTxs,this.completedTxs);const s=_i(r);jp(t);const o=UE(t),a=OE(i,this.pendingTxs),c=ra(n,Lp(o),i),l=this.nativeReadContext(s,a),u=Np(o,this.schema);if(await this.ensureClientSessionClaims(s),await this.waitForStrictRemoteQueryTransport(n),await this.processPendingPeerActivityBeforeRead(),this.closed||this.ownerRuntime.closed)return[];if(a||this.attachLocalReadCoverageInBackground(n,u,s),this.emitQueryCoverageTrace("attach"),LE(o)){if(a){const m=await this.readRowsForContextAsync(u,c,l,a.id);return this.emitQueryCoverageTrace("covered"),th(eh(m),this.schema,bi(o,this.schema).rootColumns)}const g=await this.readRowsForContextAsync(u,c,l);return this.emitQueryCoverageTrace("covered"),th(eh(g),this.schema,bi(o,this.schema).rootColumns)}const f=bi(o,this.schema).rootColumns,p=await this.readPlainRows(u,c,s??void 0,a);return this.emitQueryCoverageTrace("covered"),ca(dA(p),this.schema,f)}createSubscription(t,r,n,i){xp(n,i),this.noteFirstLoadWait(i);const s=_i(r),o=this.nativeReadContext(s);jp(t);const a=this.nextSubscriptionId++,c=ra(n,Lp(t),i);this.subscriptions.set(a,{openingAbort:new AbortController,reading:!1,outputColumns:bi(t,this.schema),tier:n??"local-first",cancelled:!1});const l=this.subscriptions.get(a),u=Np(t,this.schema),f=m=>{const b=RA(m);if(l.cancelled||this.closed||this.ownerRuntime.closed){$p(b);return}l.source=b,l.callback&&this.startSubscriptionReader(a,l)},p=m=>{l.cancelled||this.failSubscription(l,m instanceof Error?m:new Error(String(m)))},g=()=>{if(this.closed||this.ownerRuntime.closed)throw new Error("Native runtime is closed");if(l.cancelled)throw new Error("native operation was cancelled");const m=this.subscribeForContext(u,c,o);return wE(m)?this.awaitNativeOperation(m,l.openingAbort.signal):m};try{const m=this.ensureClientSessionClaims(s),b=m instanceof Promise?m.then(g):g();b instanceof Promise?b.then(f).catch(p):f(b)}catch(m){p(m)}return a}executeSubscription(t,r){const n=this.subscriptions.get(t);if(n){if(n.callback)throw new Error("Subscription has already been activated");if(n.callback=r,n.terminalError){this.deliverSubscriptionFailure(n);return}this.startSubscriptionReader(t,n)}}unsubscribe(t){const r=this.subscriptions.get(t);r&&this.terminateSubscription(t,r)}connect(t,r){if(this!==this.ownerRuntime)return this.ownerRuntime.connect(t,r);if(this.db?.reconnectNativeUpstream){this.db.reconnectNativeUpstream(),this.nativeLinkEverConnected=!1,this.linkChanged();return}const n=Qo(r);this.assertCredentialKeepsPrincipal(n),this.nativeWireFeatures(),this.link??=this.createUpstreamLink(),this.serverEndpointUrl=t,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 new 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()*Number.MAX_SAFE_INTEGER))}stepLink(t){if(this.linkInputs.push(t),!this.linkStepping){this.linkStepping=!0;try{for(let r=this.linkInputs.shift();r;r=this.linkInputs.shift()){if(this.closed||!this.link)continue;const n=JSON.parse(this.link.handle(Date.now(),JSON.stringify(r))),i=this.linkStatus;this.linkStatus=n.status;for(const s of n.actions)this.runLinkAction(s);this.applyLinkStatus(i,n.status);for(const s of n.events)s.type==="authFailed"&&this.authFailureCallback?.(s.reason);this.linkChanged()}}catch(r){throw this.linkInputs.length=0,r}finally{this.linkStepping=!1}}}runLinkAction(t){switch(t.type){case"connect":this.runLinkAttempt(t.attempt);return;case"close":{this.linkAttemptId===t.attempt&&(this.linkAttemptId=null);const r=this.serverConnectionAttempt;r?.id===t.attempt&&this.finishServerConnectionAttempt(r,new Error(this.linkCloseReason),!1),this.pendingInboundServerFrames.length=0,this.serverPumpScheduled=!1,this.serverPumpAgain=!1;return}case"armTimer":{this.clearLinkTimer();const r=t.token,n=setTimeout(()=>{this.linkTimer?.token===r&&(this.linkTimer=null,this.stepLink({type:"timerFired",token:r}))},t.afterMs);this.linkTimer={token:r,handle:n};return}case"cancelTimer":this.linkTimer?.token===t.token&&this.clearLinkTimer();return}}applyLinkStatus(t,r){const n=this.linkFailure??new Error(r.reason??"server transport failed");switch(r.phase){case"live":t?.outagePublished&&this.forgetServerTransportError();return;case"connecting":case"backoff":this.linkConnection||this.awaitLinkConnection(),r.outagePublished&&!t?.outagePublished&&this.handleServerTransportError(new Error(n.message),void 0,!0);return;case"awaitingCredential":case"stopped":if(t?.phase!==r.phase){const i=r.phase==="awaitingCredential"&&!r.terminal;this.handleServerTransportError(n,void 0,i),this.serverTransportErrorAwaitsAuth=i,this.settleLinkConnection(n)}return;case"offline":case"noServer":this.settleLinkConnection(new Error("server transport disconnected"));return}}awaitLinkConnection(){const t=new Promise((r,n)=>{this.linkConnection={resolve:r,reject:n}});t.catch(()=>{}),this.serverCarrierPromise=t}settleLinkConnection(t){const r=this.linkConnection;this.linkConnection=null,t instanceof Error?(this.serverCarrierPromise=null,r?.reject(t)):(this.serverCarrierPromise=Promise.resolve(t),r?.resolve(t))}clearLinkTimer(){this.linkTimer&&clearTimeout(this.linkTimer.handle),this.linkTimer=null}endLinkAttempt(t,r,n){if(t.finished)return;const i=t.id===this.linkAttemptId;if(this.finishServerConnectionAttempt(t,r,!1),!(!i||this.closed)){this.linkAttemptId=null,this.pendingInboundServerFrames.length=0,this.linkFailure=r;try{this.stepLink({type:"ended",attempt:t.id,failure:n})}finally{this.linkFailure=null}}}runLinkAttempt(t){this.linkAttemptId=t,this.linkConnection||this.awaitLinkConnection();const r=this.serverEndpointUrl,n=this.serverAuthJson;(async()=>{for(let i=this.serverReplacementRetirement;i;i=this.serverReplacementRetirement)await i,this.serverReplacementRetirement===i&&(this.serverReplacementRetirement=null);this.closed||this.linkAttemptId!==t||r===null||n===null||this.startServerConnection(t,r,n)})().catch(i=>{if(this.closed||this.linkAttemptId!==t)return;this.linkAttemptId=null;const s=i instanceof Error?i:new Error(ke(i));this.linkFailure=s;try{this.stepLink({type:"ended",attempt:t,failure:{kind:"fatal",message:s.message}})}finally{this.linkFailure=null}})}startServerConnection(t,r,n){this.serverConnectionGeneration+=1;const i=this.serverConnectionGeneration,s=this.nativeWireFeatures(),o=Qr(n,this.peerIdentity);this.linkStatus?.outagePublished||this.forgetServerTransportError(),this.upstreamRefusal=null,this.linkChanged();let a;const c=new Promise(m=>{a=m});let l=null;const u=m=>{if(!l)return;const b=this.serverTransportError&&!this.linkStatus?.outagePublished?{kind:"fatal",message:m.message}:yE(m,l.carrier.hasNegotiated);this.endLinkAttempt(l,new Error(m.message),b)},f=new qS({WebSocket:this.webSocket,endpointUrl:r,peerIdentity:o,features:s,authJson:n,requestedLink:this.scopeIsolatedRelay?"scope_isolated_client_relay":void 0,onFrame:m=>{i===this.serverConnectionGeneration&&(this.pendingInboundServerFrames.push(m),this.notifyServerTransportWork(),this.scheduleServerPump(),this.serverPumpRunning&&queueMicrotask(()=>{!this.serverPumpRunning||this.pendingInboundServerFrames.length===0||this.routePendingInboundServerFrames().catch(b=>this.handleServerTransportError(b,i))}))},onError:m=>{Vo(m)||m.code==="websocket_closed"||m.code==="websocket_error"||m.code==="websocket_silent"||u(m)},onTerminal:u});l={id:t,generation:i,carrier:f,terminal:c,resolveTerminal:a,finished:!1,outcome:null,transport:null,retirement:null,admission:null},this.serverConnectionAttempt=l,this.serverCarrier=f;const p=()=>!this.closed&&i===this.serverConnectionGeneration&&f===this.serverCarrier&&l===this.serverConnectionAttempt;Promise.race([f.ready(),c.then(m=>{throw m})]).then(async m=>{if(!p()){f.close();return}if(!this.trustedBackend&&(await this.runWhenCoreIdle(()=>{if(p())return this.installClientSessionClaims(ZS(n))}),!p())){f.close();return}const b=this.connectNegotiatedUpstream(m).catch(N=>{throw GE("connecting the negotiated upstream transport",N)});l.admission=b;const $=await Promise.race([b.then(N=>({type:"admitted",transport:N})),c.then(N=>({type:"terminal",error:N}))]);if($.type==="terminal")return;l.admission=null;const O=$.transport;if(!p()){f.close(),l.finished?await l.retirement:await this.retirePeerTransport(O);return}l.transport=O,this.serverTransport=O,O.setAuxiliaryTraceEnabled?.(this.auxiliaryTraceListeners.size>0),this.watchAuxiliaryOutbound(O,f,i).catch(N=>this.handleServerTransportError(N,i));const C=this.pumpServerTransport();C.catch(N=>this.handleServerTransportError(N,i)),this.pumpSubscriptions(),this.pinUpstreamPrincipal(n),this.stepLink({type:"admitted",attempt:t}),await Promise.race([C.catch(()=>{}),new Promise(N=>setTimeout(N,0))]),p()&&this.settleLinkConnection(f)}).catch(m=>{const b=m instanceof Error?m:new Error(ke(m));this.endLinkAttempt(l,b,{kind:"fatal",message:b.message})})}async connectNegotiatedUpstream(t){const r=t.authority,n=this.db.connectUpstreamWithSession;if(!r||!n)return await this.db.connectUpstream();const i=Uu();return await n.call(this.db,t.protocolVersion,t.features,r.node,r.epoch,this.node,i)}nativeWireFeatures(){if(!this.db.wireFeatures)throw new Error("native runtime binding does not expose its wire feature mask; install the matching Jazz native runtime package");const t=this.db.wireFeatures();if(!Number.isSafeInteger(t)||t<0||t>4294967295)throw new Error(`native binding returned invalid wire feature mask ${t}`);return t}nativeUpstreamConfigured(){return this!==this.ownerRuntime?this.ownerRuntime.nativeUpstreamConfigured():this.db.nativeConnectionStatus?.().configured===!0}async disconnect(t={}){if(this!==this.ownerRuntime)return this.ownerRuntime.disconnect(t);if(this.db?.disconnectNativeUpstream){this.db.disconnectNativeUpstream(),this.linkChanged();return}const r=this.serverTransport,n=this.serverConnectionAttempt,i=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(),t.rejectWaiters??!0?this.resolveServerTransportErrorWaiters(new Error("server transport disconnected")):this.clearServerTransportErrorWaiters(),this.resolveServerTransportWorkWaiters(),this.serverTransport=null;const s=[];n?.retirement&&s.push(n.retirement),r&&r!==i&&s.push(Promise.resolve().then(()=>this.retirePeerTransport(r))),this.linkChanged(),await Promise.all(s)}updateAuth(t){if(this!==this.ownerRuntime)return this.ownerRuntime.updateAuth(t);if(this.nativeAuthRefusalRenewable=!1,this.db?.rejectAuthUpdate)return this.db.rejectAuthUpdate();const r=Qo(t);this.assertCredentialKeepsPrincipal(r),this.serverEndpointUrl&&(this.serverAuthJson=r,this.stepLink({type:"credentialUpdated"}))}assertCredentialKeepsPrincipal(t){if(this!==this.ownerRuntime)return this.ownerRuntime.assertCredentialKeepsPrincipal(t);if(!this.upstreamPrincipal)return;const r=Qo(t);if(!Ep(r))return;let n;try{n=Qr(r,this.peerIdentity)}catch{n=null}if(!n||!Tt(n,this.upstreamPrincipal))throw zp("a credential refresh must keep the principal this store connects upstream as")}pinUpstreamPrincipal(t){this.upstreamPrincipal||!Ep(t)||(this.upstreamPrincipal=Qr(t,this.peerIdentity))}onAuthFailure(t){if(this!==this.ownerRuntime)return this.ownerRuntime.onAuthFailure(t);this.authFailureCallback=t,this.db.onAuthRejected?.(r=>{this.nativeAuthRefusalRenewable=hb(Yu(r)),this.authFailureCallback?.(r)})}onMutationError(t){if(this!==this.ownerRuntime)return this.ownerRuntime.onMutationError(t);this.mutationErrorCallback=t,this.db.onMutationError(r=>this.deliverMutationError(r))}onStorageFailure(t){if(this!==this.ownerRuntime)return this.ownerRuntime.onStorageFailure(t);this.db.onStorageFailure?.(t)}onServerTransportError(t){if(this!==this.ownerRuntime)return this.ownerRuntime.onServerTransportError(t);this.serverTransportErrorCallback=t}endCredentialWait(){if(this!==this.ownerRuntime)return this.ownerRuntime.endCredentialWait();this.nativeAuthRefusalRenewable=!1;const t=this.serverTransportError;!t||!this.serverTransportErrorRetrying||(this.serverTransportErrorAwaitsAuth=!1,this.handleServerTransportError(t,this.serverConnectionGeneration,!1))}reportRemoteServerTransportError(t,r=!1){if(this!==this.ownerRuntime)return this.ownerRuntime.reportRemoteServerTransportError(t,r);this.handleServerTransportError(t,this.serverConnectionGeneration,r)}clearRemoteServerTransportError(){if(this!==this.ownerRuntime)return this.ownerRuntime.clearRemoteServerTransportError();this.serverTransportError&&(this.forgetServerTransportError(),this.linkChanged())}reportLocalStorageFailure(t){if(this!==this.ownerRuntime)return this.ownerRuntime.reportLocalStorageFailure(t);if(t===null){this.localStorageFailure=null;return}const r=Object.assign(new Error(t),{code:"storage"});this.localStorageFailure=r;for(const n of this.localStorageFailureWaiters)n(r);this.localStorageFailureWaiters.clear()}waitForLocalStorageFailure(t){if(t!=="local"||!this.nonDurableClient)return null;if(this.localStorageFailure)return{promise:Promise.reject(this.localStorageFailure),cancel:()=>{}};let r;const n=new Promise((i,s)=>{r=s});return this.localStorageFailureWaiters.add(r),{promise:n,cancel:()=>this.localStorageFailureWaiters.delete(r)}}reportRemoteMutationError(t){if(this!==this.ownerRuntime)return this.ownerRuntime.reportRemoteMutationError(t);this.deliverMutationError(t)}async waitForPendingWrites(t="global",r={}){if(this!==this.ownerRuntime)return this.ownerRuntime.waitForPendingWrites(t,r);if(!this.db.waitForPendingWrites)throw new Error("Native runtime lacks graceful sync shutdown; rebuild its bindings");const{throughOutage:n=!1,signal:i}=r;i?.throwIfAborted(),await this.flushLocalSettlements(),this.throwServerTransportErrorForTier(t,n),this.startServerPump();const s=this.waitForServerTransportError(t,n),o=new AbortController,a=new Promise((u,f)=>{o.signal.addEventListener("abort",()=>f(o.signal.reason),{once:!0})});a.catch(()=>{});const c=new Promise(u=>{o.signal.addEventListener("abort",()=>u(),{once:!0})}),l=()=>o.abort(i?.reason);i?.addEventListener("abort",l,{once:!0});try{const{sync:u}=r,f=u?this.db.waitForSync?this.db.waitForSync(t,this.trustedWriteIdentity(Ie(u.writeContext))??null):this.db.waitForPendingWrites(t,c,!0):this.db.waitForPendingWrites(t,c),p=this.awaitNativeRead(Promise.resolve(f).then(m=>m??new Uint8Array),void 0,o.signal);p.catch(()=>{});const g=[p,a];s&&g.push(s.promise),await Promise.race(g)}finally{s?.cancel(),i?.removeEventListener("abort",l),o.abort(new Error("waitForPendingWrites ended"))}}async flushLocalSettlements(){if(this!==this.ownerRuntime)return this.ownerRuntime.flushLocalSettlements();this.pendingLocalSettlements.size>0&&await Promise.all(this.pendingLocalSettlements)}onLocalSettlementChange(t){return this!==this.ownerRuntime?this.ownerRuntime.onLocalSettlementChange(t):(this.localSettlementListeners.add(t),t(this.pendingLocalSettlements.size>0),()=>this.localSettlementListeners.delete(t))}deliverMutationError(t){const r=t.transaction.transactionId;this.deliveredMutationErrors.has(r)||(this.deliveredMutationErrors.add(r),this.mutationErrorCallback?.(t))}trackLocalSettlement(t){if(this!==this.ownerRuntime)return this.ownerRuntime.trackLocalSettlement(t);let r;r=this.waitForTransaction(t,"local",{observeOnly:!0}).catch(()=>{}).finally(()=>{if(this.pendingLocalSettlements.delete(r),this.pendingLocalSettlements.size===0)for(const i of this.localSettlementListeners)i(!1)});const n=this.pendingLocalSettlements.size===0;if(this.pendingLocalSettlements.add(r),n)for(const i of this.localSettlementListeners)i(!0)}finishInsert(t,r,n,i){const s=ta(i,this.writes);this.nonDurableClient&&this.trackLocalSettlement(s),this.pumpSubscriptions(),this.scheduleServerPump(),this.notifyPeerTransportWork();const o=this.rowStateFromValues(t,r,n);return{id:o.id,values:o.values,kind:"committed",txId:s}}finishMutation(t){const r=ta(t,this.writes);return this.nonDurableClient&&this.trackLocalSettlement(r),this.pumpSubscriptions(),this.scheduleServerPump(),this.notifyPeerTransportWork(),{kind:"committed",txId:r}}assertMutationAdmission(t){if(this.ownerRuntime.closed)throw new Error(`${t} failed: native runtime is closed`)}rowStateFromValues(t,r,n){return j0(t,Be(r),this.table(t).columns,n)}async readPlainRows(t,r,n,i){const s=this.nativeReadContext(n,i);return this.readRowsForContextAsync(t,r,s,i?.id)}readRowsForContext(t,r,n){const i=this.db.all(t,{...r,sync:!0},void 0,this.nativeReadAuthor(n),this.nativeReadClaims(n));if(typeof i.then=="function")throw new Error("native read is asynchronous; use the asynchronous read boundary");if(Tp(i))throw new Error("native read is pending; use the asynchronous read boundary");return i}async readRowsForContextAsync(t,r,n,i){return this.awaitNativeRead(this.startRowsForContext(t,r,n,i),r.tier)}startRowsForContext(t,r,n,i){const s=this.nativeReadAuthor(n);return this.db.all(t,r,i,s,this.nativeReadClaims(n))}nativeReadAuthor(t){return t.kind==="session-authority"?t.identity:void 0}nativeReadClaims(t){return t.kind==="session-authority"?t.claims:void 0}nativeReadContext(t,r){return this.trustedBackend&&(t?.backendAuthority||!t&&!r?.identity)?{kind:"backend-authority"}:this.readAuthorizationHost==="trusted-serving"?{kind:"session-authority",identity:r?.identity??t?.identity??this.peerIdentity,claims:r?.requestSession?.claims??t?.claims}:{kind:"client-local"}}subscribeForContext(t,r,n){if(!this.db.subscribe)throw new Error("Native runtime does not support subscriptions");const i=n.kind==="session-authority"?n.identity:void 0;return this.db.subscribe(t,r,i,this.nativeReadClaims(n))}async awaitNativeRead(t,r,n){const i=await t;if(!Tp(i))return i;const s=()=>i.cancel();this.ownerRuntime.pendingNativeReadCancels.add(s);try{for(;;){if(this.closed||this.ownerRuntime.closed)throw new Error("native read was cancelled by runtime shutdown");n?.throwIfAborted(),r&&this.throwServerTransportErrorForTier(r);const o=i.poll();if(o!==null)return o;this.startServerPump(),r&&this.throwServerTransportErrorForTier(r),await sa(0)}}finally{this.ownerRuntime.pendingNativeReadCancels.delete(s),s(),this.ownerRuntime.scheduleCoreTick()}}trustedWriteIdentity(t){const r=this.readAuthorizationHost==="trusted-serving";return t?!this.trustedBackend&&!r&&Tt(t.identity,this.peerIdentity)?void 0:t.identity:r&&!this.trustedBackend?this.peerIdentity:void 0}backendAttribution(t){if(!this.trustedBackend||!t)return;let r;try{r=JSON.parse(t).attribution}catch{return}if(r===void 0)return;if(typeof r!="string")throw new Error("backend attribution must be a canonical author subject string");if(!Vt(r))throw new Error("backend attribution must be a canonical author subject string");const i=Ie(t);if(!i)throw new Error("backend attribution requires a valid author");return i.identity}awaitNativeOperation(t,r){let n=0,i,s=!1,o;const a=()=>{n+=1,i?.()},c=()=>{s=!0,t.cancel(),a()};this.pendingNativeAdmissionCancels.add(c),r?.addEventListener("abort",c,{once:!0});const l=()=>{this.pendingNativeAdmissionCancels.delete(c),r?.removeEventListener("abort",c),t.cancel()},u=()=>{for(;;){if(this.closed||s||r?.aborted)throw new Error("native operation was cancelled");if(o)throw o;const f=n,p=t.poll();if(p!=null)return p;if(this.pumpServerTransport().catch(g=>{o=g,a()}),n===f)return new Promise(g=>{i=g,n!==f&&g()}).then(()=>(i=void 0,u()))}};try{t.setWake(a);const f=u();return f instanceof Promise?f.finally(l):(l(),f)}catch(f){throw l(),f}}clientSessionClaimsKey;installClientSessionClaims(t){const r=gi(t);if(r===this.clientSessionClaimsKey)return;const n=this.db.setSessionClaims?.(t);if(n instanceof Promise)return n.then(()=>{this.clientSessionClaimsKey=r});this.clientSessionClaimsKey=r}ensureClientSessionClaims(t){if(this.closed||this.ownerRuntime.closed)throw new Error("Native runtime is closed");if(!t||t.backendAuthority||this.readAuthorizationHost==="trusted-serving"||gi(t.claims)===this.clientSessionClaimsKey)return;const r=()=>{if(this.closed||this.ownerRuntime.closed)throw new Error("Native runtime is closed");return this.installClientSessionClaims(t.claims)};return this.ownerRuntime.coreOperation?this.runWhenCoreIdle(r):r()}async waitForStrictRemoteQueryTransport(t){if(t!=="remote")return;const r=this.serverEndpointUrl,n=this.serverAuthJson??"{}",i=Qr(n,this.peerIdentity);for(;!this.hasUpstream();){this.throwServerTransportErrorForTier("global");const s=this.serverCarrierPromise;if(!s)return;const o=this.serverConnectionAttempt,a=s.then(()=>null,g=>g instanceof Error?g:new Error(ke(g))),c=this.waitForServerTransportError("global"),l=c?.promise.catch(g=>g instanceof Error?g:new Error(ke(g)));let u;try{u=await Promise.race([a,...o?.carrier===this.serverCarrier?[o.terminal]:[],...l?[l]:[]])}finally{c?.cancel()}if(this.closed)return;const f=this.serverEndpointUrl,p=this.serverAuthJson??"{}";if(this.serverCarrierPromise&&(f!==r||!PA(i,Qr(p,this.peerIdentity))))throw new Error("server transport scope changed while waiting for remote query");if(u){if((u.message==="server transport replaced"||u.message==="server transport disconnected")&&this.serverCarrierPromise!==null||this.linkStatus?.phase==="connecting"&&this.serverCarrierPromise!==null)continue;throw u}}}async processPendingPeerActivityBeforeRead(){if(this.nonDurableClient)for(;!this.closed&&this.peerTransportProcessedActivityEpoch<this.peerTransportActivityEpoch;)await this.progressPeerTransport()}attachLocalReadCoverageInBackground(t,r,n){if(t!=null&&t!=="local-first"||this.nonDurableClient||!this.serverTransport)return;(async()=>{await this.serverCarrierPromise,!(this.closed||this.ownerRuntime.closed)&&(await this.waitForStrictRemoteQueryTransport("remote"),!(this.closed||this.ownerRuntime.closed)&&await this.readRowsForContextAsync(r,ra("remote",!1),this.nativeReadContext(n)))})().catch(()=>{})}admitLocalFirstSession(t,r,n){if(!this.trustedBackend||t.issuer!==Vu||!t.account_id||!Mr(t,Ku(t)))throw new Error("Local-first native admission requires a verified account session");if(!this.db.admitLocalFirstSession)throw new Error("Native runtime lacks local-first session admission");this.db.admitLocalFirstSession(r,n,new De().decode(Hs(t)))}applySessionClaims(t){!t||t.backendAuthority||this.readAuthorizationHost!=="trusted-serving"||!this.db.setIdentityClaims||this.db.setIdentityClaims(t.identity,t.claims)}table(t){const r=this.schema[t];if(!r)throw new Error(`unknown table ${t}`);return r}currentTx(t,r){const n=St(t);if(!n)return;const i=this.pendingTxs.get(n);if(i)return i;throw new Error(`${r} failed: WriteError("${mi(n,this.completedTxs)}")`)}assertTransactionWriteIdentity(t,r){if(t.kind==="serializable"){if(t.identity&&(!r||!Tt(t.identity,r)))throw new Error("Native runtime serializable transaction cannot mix write identities");return}if(t.identity&&(!r||!Tt(t.identity,r)))throw new Error("Native runtime mergeable transaction cannot mix write identities");if(r&&!t.identity)throw new Error("Native runtime mergeable transaction cannot mix write identities")}assertTransactionAttribution(t,r){if(!(!t.attribution&&!r)){if(!t.attribution)throw new Error("Native runtime transaction was opened without backend attribution");if(!r||!Tt(t.attribution,r))throw new Error("Native runtime backend-attributed transaction requires its original provenance subject")}}pumpSubscriptions(){this.drainSubscriptionPool();for(const[t,r]of this.subscriptions)r.poolId===void 0&&this.startSubscriptionReader(t,r)}nativeSubscriptionPool(){return this.subscriptionPool===void 0&&(this.subscriptionPool=this.db.createSubscriptionPool?.()??null),this.subscriptionPool}drainSubscriptionPool(){const t=this.subscriptionPool;if(!(!t||this.pooledSubscriptions.size===0)){if(this.drainingSubscriptionPool){this.subscriptionPoolDirty=!0;return}this.drainingSubscriptionPool=!0;try{do{this.subscriptionPoolDirty=!1;for(const r of t.drain())this.applyPooledBatch(r)}while(this.subscriptionPoolDirty&&!this.closed)}finally{this.drainingSubscriptionPool=!1}}}applyPooledBatch(t){const r=this.pooledSubscriptions.get(t.id);if(r===void 0)return;const n=this.subscriptions.get(r),i=()=>n!==void 0&&!n.cancelled&&this.subscriptions.get(r)===n;if(!n||!i()){this.pooledSubscriptions.delete(t.id);return}for(const s of t.events){if(!i())break;try{this.applySubscriptionChunk(r,n,s)}catch(o){this.failSubscription(n,o instanceof Error?o:new Error(String(o)))}}if(t.error&&(this.pooledSubscriptions.delete(t.id),!this.closed&&i())){const s=new Error(t.error.message);s.code=t.error.code,this.failSubscription(n,s)}i()||this.pooledSubscriptions.delete(t.id)}withPermissionAdviceTimeout(t){if(this!==this.ownerRuntime)return this.ownerRuntime.withPermissionAdviceTimeout(t);if(this.closed||(!this.serverTransport||!this.serverCarrier)&&!this.nativeUpstreamConfigured())return Promise.resolve("unknown");const r=t(),n=gE(r)?{promise:this.awaitNativePermissionAdvice(r),cancel:()=>r.cancel()}:typeof r=="string"?{promise:Promise.resolve(r==="allowed"||r==="denied"||r==="unknown"?r:"unknown"),cancel:()=>{}}:r;return new Promise(i=>{let s=!1;const o=c=>{s||(s=!0,clearTimeout(a),i(c))},a=setTimeout(()=>{n.cancel(),o("unknown")},2e3);n.promise.then(o,()=>o("unknown"))})}async awaitNativePermissionAdvice(t){for(;;){if(this.closed)return t.cancel(),"unknown";const r=t.poll();if(r!==null)return r==="allowed"||r==="denied"||r==="unknown"?r:"unknown";await this.pumpServerTransport(),await sa(0)}}clearCoreDeadline(){this.coreDeadlineTimer!==void 0&&clearTimeout(this.coreDeadlineTimer),this.coreDeadlineTimer=void 0,this.coreDeadlineAt=void 0}scheduleCoreWake(t){if(this.coreProgressAllowed()){if(t==="after-current-turn"){setTimeout(()=>this.scheduleCoreWake("immediate"),0);return}if(t.startsWith("after:")){const r=Number(t.slice(6));if(!Number.isSafeInteger(r)||r<0)return;const n=performance.now()+r;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")},r);return}if(this.notifyPeerTransportWork(),t==="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(t=>{try{if(this.db.isNativeForegroundClosed?.())return}catch(r){Ti(r);return}this.serverTransport!==null||this.serverEndpointUrl!==null?this.handleServerTransportError(t):Ti(t)})}}))}}runCoreTick(){if(!this.coreProgressAllowed())return Promise.resolve();const t=this.coreOperation;if(t)return this.coreTickAgain=!0,t.kind==="tick"?t.completion:t.completion.then(()=>this.runCoreTick());let r,n;const i=new Promise((s,o)=>{r=s,n=o});return this.coreOperation={kind:"tick",completion:i},this.driveCoreTicks().then(r,n),i}reportSlowQueries(){const t=this.ownerRuntime;for(const r of this.db.takeSlowQueryReport?.(t.slowQueryApp)??[]){if(t.slowQueryConsoleDetail!=="summary"){console.warn(`[jazz] ${r}`);continue}const n=AE(r);if(n===r){console.warn(`[jazz] ${r}`);continue}console.warn(`[jazz] ${n}. Plan and SQL are logged at the debug ("Verbose") level.`),console.debug(`[jazz] ${r}`)}}async driveCoreTicks(){let t=!1;try{for(let r=0;;r+=1){this.coreTickAgain=!1;try{await this.db.tick()}catch(n){throw new C0(n)}if(this.syncStatusPublisher.changed(),this.reportSlowQueries(),this.pumpSubscriptions(),this.scheduleServerPump(),this.notifyPeerTransportWork(),!this.coreProgressAllowed()||!this.coreTickAgain)break;if(r+1>=_E){t=!0;break}}}finally{this.drainTransportRetirements(),this.coreOperation=null}t&&this.coreProgressAllowed()&&setTimeout(()=>this.scheduleCoreTick(),0)}drainTransportRetirements(){const t=[...this.pendingTransportRetirements];this.pendingTransportRetirements.clear();for(const[r,n]of t)try{r.close();for(const i of n)i.resolve()}catch(i){for(const s of n)s.reject(i)}}startSubscriptionReader(t,r){const n=r.source;if(r.cancelled||r.reading||!r.callback||!n)return;if(r.poolId!==void 0){this.drainSubscriptionPool();return}const i=n.joinPool?this.nativeSubscriptionPool():null;if(i&&n.joinPool){const s=n.joinPool(i);r.poolId=s,this.pooledSubscriptions.set(s,t),this.drainSubscriptionPool();return}r.reading=!0,this.readSubscription(t,r,n)}readSubscription(t,r,n){const i=()=>!r.cancelled&&this.subscriptions.get(t)===r,s=()=>{r.reading=!1},o=l=>{!this.closed&&i()&&this.failSubscription(r,l instanceof Error?l:new Error(String(l))),s()},a=l=>{if(l.type==="closed"||!i())return l.type==="closed"&&this.terminateSubscription(t,r),s(),!1;if(l.type==="pending")return this.pumpServerTransport().then(()=>sa(Math.max(0,l.retryAfterMs))).then(c).catch(o),!1;for(const u of l.events){if(!i())return s(),!1;try{this.applySubscriptionChunk(t,r,u)}catch(f){this.failSubscription(r,f instanceof Error?f:new Error(String(f)))}}return l.events.length===0||!i()?(s(),!1):!0},c=()=>{for(;i();){let l;try{l=n.pull(u=>{a(u)&&c()},o)}catch(u){o(u);return}if(l===void 0||!a(l))return}s()};c()}applySubscriptionChunk(t,r,n){const i=EA(n);if(i.type==="closed"){this.terminateSubscription(t,r);return}if(i.type==="rejected"){if(i.reason.type==="ShapeRegistrationPendingCatalogueAdmission")return;this.failSubscription(r,TA(i.reason));return}const s=mA(i.delta,this.schema,i.reset===!0,r.outputColumns);s.terminalOperations=FE(i.terminalOperations,r.outputColumns?.rootColumns),r.callback?.(s)}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()},pE))}}startServerPump(){const t=this.serverConnectionGeneration;this.pumpServerTransport().catch(r=>this.handleServerTransportError(r,t))}notifyPeerTransportWork(t=!1){for(const r of this.peerTransportWorkListeners)r(t)}hasUpstream(){return this.serverTransport!=null||this.peerUpstreamAttached}async pumpServerTransport(){const t=this.serverTransport,r=this.serverCarrier,n=this.serverConnectionGeneration;if(!(this.closed||!t||!r)){if(this.serverPumpRunning){this.serverPumpAgain=!0;return}this.serverPumpRunning=!0;try{let i=this.pendingInboundServerFrames.length>0?await this.routePendingInboundServerFrames():!1;i||=this.serverInboundProcessed,this.serverInboundProcessed=!1;for(let s=0;s<32;s+=1){if(await this.runCoreTick(),this.flushAuxiliaryOutbound(t,r,n),(i||this.serverInboundProcessed)&&(i=!1,this.serverInboundProcessed=!1,this.notifyServerTransportWork(),queueMicrotask(()=>this.notifyServerTransportWork())),this.closed||n!==this.serverConnectionGeneration||t!==this.serverTransport||r!==this.serverCarrier||this.stopRefusedUpstream(t))return;const o=ea(t.recvWireFrames());if(o.length>0&&this.sendServerFrames(o,r,n),this.pumpSubscriptions(),o.length===0)return}this.serverPumpAgain=!0}finally{this.serverPumpRunning=!1,this.serverPumpAgain&&(this.serverPumpAgain=!1,this.scheduleServerPump())}}}stopRefusedUpstream(t){const r=Mo(t.upstreamRefusal?.());if(!r)return!1;const n=this.serverConnectionAttempt;return!n||n.transport!==t?!1:(this.upstreamRefusal=r,this.endLinkAttempt(n,r,{kind:"fatal",message:r.message}),!0)}async routePendingInboundServerFrames(){let t=!1;const r=this.serverInboundRouting.then(async()=>{const n=this.serverTransport,i=this.serverCarrier,s=this.serverConnectionGeneration;if(!n||this.pendingInboundServerFrames.length===0)return;const o=this.pendingInboundServerFrames.splice(0);t=!0,this.serverInboundProcessed=!0;const a=[];for(const c of o){const l=n.routeAuxiliaryWireFrame?await n.routeAuxiliaryWireFrame(c):c;if(i&&this.refreshAuxiliaryReceiveDeadline(n,i,s),n!==this.serverTransport||s!==this.serverConnectionGeneration)return;l!=null&&a.push(RE(l))}if(this.publishAuxiliaryTrace(n),a.length>0)if(n.sendWireFrames)n.sendWireFrames(a);else for(const c of a)n.sendWireFrame(c);this.notifyPeerTransportWork(!0),i&&this.flushAuxiliaryOutbound(n,i,this.serverConnectionGeneration)});return this.serverInboundRouting=r.then(()=>{},()=>{}),await r,t}refreshAuxiliaryReceiveDeadline(t,r,n){if(this.closed||t!==this.serverTransport||n!==this.serverConnectionGeneration)return;let i=this.auxiliaryReceiveDeadlines.get(t);i||(i=new hf(t,s=>{if(this.closed||t!==this.serverTransport||n!==this.serverConnectionGeneration)return;const o=s instanceof Error?s:new Error(ke(s)),a=this.serverConnectionAttempt;a?.transport===t?this.finishServerConnectionAttempt(a,o):(r.close(),this.handleServerTransportError(o,n),this.retirePeerTransport(t).catch(Ti))}),this.auxiliaryReceiveDeadlines.set(t,i)),i.refresh()}flushAuxiliaryOutbound(t,r,n){const i=t.recvAuxiliaryWireFrames;if(!i)return;const s=ea(i.call(t));s.length>0&&this.sendServerFrames(s,r,n),this.publishAuxiliaryTrace(t)}publishAuxiliaryTrace(t){const r=t.takeAuxiliaryTrace?.();if(!(!r||r.length===0))for(const n of this.auxiliaryTraceListeners)n(r)}async watchAuxiliaryOutbound(t,r,n){for(;!this.closed&&t===this.serverTransport&&r===this.serverCarrier&&n===this.serverConnectionGeneration;){const i=t.auxiliaryOutboundReady?.();if(!i||typeof i=="boolean"||(await i,t!==this.serverTransport||r!==this.serverCarrier))return;this.flushAuxiliaryOutbound(t,r,n)}}sendServerFrames(t,r,n){n!==this.serverConnectionGeneration||r!==this.serverCarrier||r.sendBatch(t).catch(i=>{this.handleServerTransportError(i,n)})}forgetServerTransportError(){this.serverTransportError=null,this.serverTransportErrorRetrying=!1,this.serverTransportErrorAwaitsAuth=!1}handleServerTransportError(t,r=this.serverConnectionGeneration,n=!1){if(r!==this.serverConnectionGeneration&&(this.closed||!O0(t)))return;const i=ke(t);if(this.serverTransportError&&i==="websocket closed"){if(n||!this.serverTransportErrorRetrying)return;t=this.serverTransportError}t===this.serverTransportError&&this.serverTransportErrorAwaitsAuth&&(n=!0),this.serverTransportErrorAwaitsAuth=!1;const s=this.serverTransportError===null||this.serverTransportErrorRetrying&&!n;this.serverTransportError=t instanceof Error?t:new Error(i),this.serverTransportErrorRetrying=n,this.linkChanged(),n||this.failRemoteSubscriptions(this.serverTransportError),this.resolveServerTransportErrorWaiters(this.serverTransportError,n),s&&this.serverTransportErrorCallback?.(this.serverTransportError,{retrying:n})}finishServerConnectionAttempt(t,r,n=!0){if(t.finished)return;t.finished=!0,this.linkChanged(),t.outcome=r,t.resolveTerminal(r);const i=t===this.serverConnectionAttempt&&t.generation===this.serverConnectionGeneration&&t.carrier===this.serverCarrier;i&&(this.serverConnectionGeneration+=1,this.serverConnectionAttempt=null,this.serverCarrier=null),t.carrier.close();const s=t.transport;if(t.transport=null,s){s===this.serverTransport&&(this.serverTransport=null);try{if(this.coreOperation){const o=Promise.resolve(this.retirePeerTransport(s));t.retirement=o,o.catch(a=>{this.closed||this.handleServerTransportError(a)})}else this.retirePeerTransport(s),t.retirement=null}catch(o){const a=Promise.reject(o);t.retirement=a,a.catch(c=>{this.closed||this.handleServerTransportError(c)})}}if(t.admission){const o=t.admission;t.admission=null,t.retirement=o.then(a=>this.retirePeerTransport(a),()=>{}),t.retirement.catch(a=>{this.closed||this.handleServerTransportError(a)})}t.retirement&&(this.serverReplacementRetirement=bE(this.serverReplacementRetirement,t.retirement),this.serverReplacementRetirement.catch(()=>{})),i&&(n&&this.handleServerTransportError(r),this.resolveServerTransportWorkWaiters())}failRemoteSubscriptions(t){for(const r of this.subscriptions.values())r.cancelled||r.tier==="remote"&&this.failSubscription(r,t)}terminateSubscription(t,r){this.subscriptions.get(t)===r&&this.subscriptions.delete(t),this.retireSubscriptionResources(r)}failSubscription(t,r){t.cancelled||(t.terminalError=r,this.retireSubscriptionResources(t),this.deliverSubscriptionFailure(t))}retireSubscriptionResources(t){if(t.cancelled)return;t.cancelled=!0,t.poolId!==void 0&&this.pooledSubscriptions.delete(t.poolId),t.openingAbort?.abort();const r=t.source;if(t.source=void 0,r)try{$p(r)}catch(n){console.error("Jazz subscription source cleanup failed",n)}}deliverSubscriptionFailure(t){if(!(!t.callback||!t.terminalError||t.terminalErrorDelivered)){t.terminalErrorDelivered=!0;try{t.callback(t.terminalError)}catch(r){setTimeout(()=>{throw r},0)}}}serverTransportErrorFor(t){return t&&this.serverTransportErrorRetrying?null:this.serverTransportError}throwServerTransportErrorForTier(t,r=!1){if(t!=="global"&&t!=="remote")return;const n=this.serverTransportErrorFor(r);if(n)throw n}waitForServerTransportError(t,r=!1){if(t!=="global"&&t!=="remote")return null;const n=this.serverTransportErrorFor(r);if(n)return{promise:Promise.reject(n),cancel:()=>{}};const i={active:!0,throughOutage:r,reject:()=>{}},s=new Promise((o,a)=>{i.reject=a});return this.serverTransportErrorWaiters.push(i),{promise:s,cancel:()=>{if(!i.active)return;i.active=!1;const o=this.serverTransportErrorWaiters.indexOf(i);o>=0&&this.serverTransportErrorWaiters.splice(o,1)}}}resolveServerTransportErrorWaiters(t,r=!1){const n=this.serverTransportErrorWaiters.splice(0);for(const i of n)i.active&&(r&&i.throughOutage?this.serverTransportErrorWaiters.push(i):i.reject(t))}clearServerTransportErrorWaiters(){for(const t of this.serverTransportErrorWaiters)t.active=!1;this.serverTransportErrorWaiters.length=0}waitForServerTransportWork(t,r){if(t!=="global"&&t!=="remote")return null;if(this.serverTransportWorkEpoch!==r)return{promise:Promise.resolve(),cancel:()=>{}};const n={active:!0,resolve:()=>{}},i=new Promise(s=>{n.resolve=s});return this.serverTransportWorkWaiters.push(n),{promise:i,cancel:()=>{if(!n.active)return;n.active=!1;const s=this.serverTransportWorkWaiters.indexOf(n);s>=0&&this.serverTransportWorkWaiters.splice(s,1)}}}notifyServerTransportWork(){this.serverTransportWorkEpoch+=1,this.resolveServerTransportWorkWaiters()}resolveServerTransportWorkWaiters(){const t=this.serverTransportWorkWaiters.splice(0);for(const r of t)r.active&&r.resolve()}};function ea(e){return e.filter(t=>ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array")}function RE(e){const t=ea([e])[0];if(!t)throw new Error("native transport returned a non-byte wire frame");return t}function ta(e,t){const r=e.txId;return t.set(r,e),r}function St(e){if(e)try{const t=JSON.parse(e);return typeof t.transaction_id=="string"?t.transaction_id:void 0}catch{return}}function Et(e){if(e)try{const t=JSON.parse(e);if(!t.branch_view||typeof t.branch_view!="object")return;const r=t.branch_view;return r.head==null?void 0:{head:r.head,base:r.base}}catch{return}}function IE(e,t){if(!e)return!1;let r;try{if(r=JSON.parse(e),r.attribution!==void 0)return!0;if(!(r.issuer!==void 0||r.user_id!==void 0||r.session!==void 0))return!1}catch{return!1}try{const n=Ie(e);return n===null||!Tt(n.identity,t)}catch{return!0}}function cr(e,t){if(e&&t)throw new Error("Backend-attributed writes do not support branch views")}function Ie(e){if(!e)return null;try{const t=JSON.parse(e);if(t.attribution===Hr)throw new Error("Native runtime public session uses reserved issuer");const r=typeof t.attribution=="string"?Vt(t.attribution):null;if(r?.issuer===Gt)throw new Error("Native runtime public session uses reserved issuer");const n=r?.user_id??(typeof t.user_id=="string"?t.user_id:typeof t.session?.user_id=="string"?t.session.user_id:void 0);if(!n||!Ee(n))return null;const i=r?.issuer??t.session?.issuer??t.issuer;if(typeof i!="string"||!Ee(i))throw new Error("session is missing issuer");const s={account_id:Pp(r?r.account_id:(t.session??t).account_id),issuer:i,user_id:n,authMode:typeof t.session?.authMode=="string"?t.session.authMode:typeof t.authMode=="string"?t.authMode:"external"};Ip(s.issuer,s.user_id,s.authMode,t.session?.[Ht]??t[Ht],s.account_id);const o=t.session?.[Ht]??t[Ht],a=Op(t.session?.claims??t.claims,s);return{...s,claims:a,identity:Hs(s),backendAuthority:s.issuer===Gt&&s.user_id===Hr&&Mr(s,o)}}catch(t){if(t instanceof Error&&(t.message==="session is missing issuer"||t.message==="session has invalid account_id"||t.message==="Native runtime public session uses reserved issuer"))throw t;return null}}function Ip(e,t,r,n,i){if(Fn(e)&&!((r==="local-first"||r==="anonymous"||r==="external")&&Mr({issuer:e,user_id:t,authMode:r,account_id:i},n)))throw new Error("Native runtime public session uses reserved issuer")}function kE(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 new Error("updatedAt must be a nonnegative safe integer");return t.updated_at}}function At(e){return kE(e)??null}function mi(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 xE(e,t){const r=mi(e,t);return t.get(e)?.state==="committed"?`Write error: ${r}`:`Commit transaction failed: Write error: ${r}`}function PE(e,t){const r=mi(e,t);return t.get(e)?.state==="committed"?`Write error: ${r}`:`Rollback transaction failed: Write error: ${r}`}function CE(e,t,r){const n=kp(e);if(!(!n||t.has(n)))throw new Error(`Query setup failed: Write error: ${mi(n,r)}`)}function OE(e,t){const r=kp(e);return r?t.get(r):void 0}function kp(e){if(e)try{const t=JSON.parse(e);return typeof t.transaction_id=="string"?t.transaction_id:void 0}catch{return}}function ra(e,t=!1,r){const n=r==null?{}:JSON.parse(r),i={};e!=null&&(i.tier=e),t&&(i.include_deleted=!0),typeof n.first_load_remote_wait_ms=="number"&&n.first_load_remote_wait_ms>0&&(i.first_load_remote_wait_ms=n.first_load_remote_wait_ms);const s=n.read_view??n.readView;return s!=null&&(i.read_view=s),Array.isArray(n.splices)&&n.splices.length>0&&(i.splices=n.splices),i}function $E(e){if(e==null)return!1;try{const t=JSON.parse(e);return typeof t.first_load_remote_wait_ms=="number"&&t.first_load_remote_wait_ms>0}catch{return!1}}function xp(e,t){if(e!=null&&!["local-first","remote","local-only"].includes(e))throw new Error(`Native runtime received unsupported read tier '${e}'`);t!=null&&JSON.parse(t)}function Pp(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 new Error("session has invalid account_id");return e}}function _i(e){if(e==null)return null;const t=JSON.parse(e);if(typeof t.user_id!="string"||!Ee(t.user_id))throw new Error("Native runtime session is missing user_id");if(typeof t.issuer!="string"||!Ee(t.issuer))throw new Error("Native runtime session is missing issuer");const r={account_id:Pp(t.account_id),issuer:t.issuer,user_id:t.user_id,authMode:typeof t.authMode=="string"?t.authMode:"external"};Ip(r.issuer,r.user_id,r.authMode,t[Ht],r.account_id);const n=r.issuer===Gt&&r.user_id===Hr&&Mr(r,t[Ht]);return{...r,claims:Op(t.claims,r),identity:Hs(r),backendAuthority:n}}function Cp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function gi(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(gi).join(",")}]`:Cp(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${gi(e[t])}`).join(",")}}`:"null"}function Op(e,t){return{...Cp(e)?e:{},iss:t.issuer,sub:t.user_id}}function $p(e){e.close()}function Lp(e){try{return JSON.parse(e).include_deleted===!0}catch{return!1}}function LE(e){try{const t=JSON.parse(e).array_subqueries;return Array.isArray(t)&&t.length>0}catch{return!1}}function Np(e,t){return QE(e,t)}function jp(e){if(NE(e))throw new Error("Native runtime does not support permission-introspection query columns or predicates ($canRead) until unified policy lowering exists.")}function NE(e){const t=JSON.parse(e);return Mp(t.select_columns??t.select)||DE(t.conditions)||jE(t.relation_ir)||na(t.relation_ir)||Dp(t.array_subqueries)}function jE(e){return en(e)}function na(e){if(!e||typeof e!="object")return!1;if(Array.isArray(e))return e.some(na);const t=e,r=t.Project;if(r&&typeof r=="object"){const n=r.columns;if(Array.isArray(n))for(const i of n){if(!i||typeof i!="object")continue;const s=i,o=ME(s.expr??s.source);if(o&&Gr(o))return!0}}return Object.values(t).some(na)}function Zr(e){if(!e||typeof e!="object")return null;const t=e;return ct(t.left??t.column)}function ME(e){return!e||typeof e!="object"?null:"Column"in e?ct(e.Column):ct(e)}function Mp(e){return Array.isArray(e)?e.some(t=>typeof t=="string"&&Gr(yi(t))):!1}function DE(e){return Array.isArray(e)?e.some(en):!1}function Dp(e){return Array.isArray(e)?e.some(t=>{if(!t||typeof t!="object")return!1;const r=t;return Mp(r.select_columns??r.select)||BE(r.filters)||Dp(r.nested_arrays)}):!1}function BE(e){return Array.isArray(e)?e.some(en):!1}function en(e){if(!e||typeof e!="object")return!1;if(Array.isArray(e))return e.some(en);const t=e;if(typeof t.op=="string"&&typeof t.column=="string"&&Gr(yi(t.column)))return!0;for(const n of["Eq","Ne","Gt","Ge","Lt","Le","IsNull","IsNotNull","Contains"]){const i=t[n];if(!i||typeof i!="object")continue;const s=i.column;if(typeof s=="string"&&Gr(yi(s)))return!0}const r=Zr(t.Cmp)??Zr(t.In)??Zr(t.IsNull)??Zr(t.IsNotNull)??Zr(t.Contains);return r&&Gr(yi(r))?!0:Object.entries(t).some(([n,i])=>n!=="Literal"&&en(i))}function yi(e){return ui(e)}function bi(e,t){const r=JSON.parse(e);if(typeof r.table!="string")throw new Error("Native runtime only supports table queries in this slice");return{rootTable:r.table,rootColumns:Fp(r.table,t,rn(r.select_columns??r.select),wi(r.array_subqueries,r.table,t)??[])}}function FE(e,t){if(!(!e||e.length===0))return e.map(r=>{let n=t,i;const s=r.path.map(a=>{if("Key"in a)return{Key:qe(a.Key)};if(!n)throw new Error("native terminal collection path requires subscription output columns");const c=a.Collection.startsWith(di)?a.Collection.slice(di.length):a.Collection,l=n.findIndex(f=>f.name===c),u=n[l]?.column_type;if(u?.type!=="Array"||u.element.type!=="Row")throw new Error(`native terminal operation addressed unknown collection ${c}`);return n=u.element.columns,i=n,{Collection:l}}),o=r.edit;if("Insert"in o){if(!i)throw new Error("native terminal insert has no collection target");const a=Bp(o.Insert.key);return{root_key:qe(r.root_key),path:s,edit:{Insert:{index:o.Insert.index,key:qe(o.Insert.key),row:Ro(a,i,ia(o.Insert.value))}}}}if("Update"in o){if(!i)throw new Error("native terminal update has no collection target");const a=Bp(o.Update.key);return{root_key:qe(r.root_key),path:s,edit:{Update:{key:qe(o.Update.key),row:Ro(a,i,ia(o.Update.value))}}}}return"Remove"in o?{root_key:qe(r.root_key),path:s,edit:{Remove:{key:qe(o.Remove.key)}}}:{root_key:qe(r.root_key),path:s,edit:{Move:{key:qe(o.Move.key),index:o.Move.index}}}})}function qe(e){return Array.isArray(e)?e:Array.from(e)}function ia(e){return e instanceof Uint8Array?e:Uint8Array.from(e)}function Bp(e){const t=ia(e);if(t.length<17||t[0]!==10)throw new Error("terminal key must begin with a UUID row key");return Be(t.subarray(1,17))}function Fp(e,t,r,n,i=!0){const s=at(t,e);if(!s)throw new Error(`missing schema for subscription table ${e}`);const o=r===void 0,c=(r??s.columns.map(l=>l.name)).map(l=>{const u=s.columns.find(p=>p.name===l);if(u)return o&&i?{...u,sparse:!0}:u;const f=Do(l);return f?{name:l,column_type:f,nullable:l==="$deletedAt"||l.startsWith("$deletedBy")}:void 0}).filter(l=>l!==void 0);for(const l of n){const u=Fp(l.table,t,l.select,l.nestedArrays??[],!1);c.push({name:l.columnName,column_type:{type:"Array",element:{type:"Row",columns:u}},nullable:!1})}return c}function UE(e){const t=JSON.parse(e);return Up(t.array_subqueries),JSON.stringify(t)}function Up(e){if(Array.isArray(e))for(const t of e){if(!t||typeof t!="object")continue;const r=t;if(Array.isArray(r.select_columns)&&Array.isArray(r.nested_arrays))for(const n of r.nested_arrays){if(!n||typeof n!="object")continue;const i=n.outer_column;if(typeof i!="string")continue;const s=ui(i);(rn(r.select_columns)??[]).includes(s)||r.select_columns.push(s)}Up(r.nested_arrays)}}function sa(e){return new Promise(t=>setTimeout(t,e))}function WE(e,t){return XE(t)?zE(e,t):qp(t)?qE(e,t):null}function zE(e,t){const r=ke(t),n={kind:"rejected",transactionId:e,code:"transaction_conflict",reason:/^\(transaction_conflict\):\s*(.*)$/s.exec(r)?.[1]||r,message:r};return Object.defineProperty(n,"message",{enumerable:!1}),n}function qE(e,t){const r=ke(t),n={kind:"rejected",transactionId:e,code:oa(Wo(t)),reason:KE(r,Wo(t)),message:r};return Object.defineProperty(n,"message",{enumerable:!1}),n}function lr(e,t){try{return t()}catch(r){if(qp(r)){const n=ke(r),i=Vp(n)??n,s=Wo(r)??(i.startsWith("authorization_denied:")?"authorization_denied":void 0);throw Object.assign(new Error(`${e} failed: WriteError("${i}")`),{code:oa(s)})}throw r}}function Wp(e,t){return new Error(`${e} failed: WriteError("${t.replaceAll('"','\\"')}")`)}function VE(e){const t=/^missing required column ([A-Za-z_$][\w$]*)$/.exec(e);return t?`missing required field \`${t[1]}\``:e}function ke(e){if(e instanceof Error)return e.message;if(e&&typeof e=="object"){const 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 zp(e="a store configured as one user serves only its own identity's peers"){return Object.assign(new Error(e),{code:"protocol",reason:"identity_mismatch"})}function GE(e,t){const r=t instanceof Error?t:new Error(ke(t));return new Error(`${e}: ${r.message}`,{cause:r})}var HE={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"};function oa(e){return e===void 0?"write_rejected":HE[e]}var JE={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 KE(e,t){const r=Vp(e);return r===null?e:JE[oa(t)]??(r||"Write rejected")}function XE(e){return tp(e)==="transaction_conflict"}function qp(e){return tp(e)==="write_rejected"}function Vp(e){const t=/^WriteRejected:\s*(.*)$/s.exec(e);return t?t[1]:null}function QE(e,t){const r=JSON.parse(e);if(typeof r.table!="string")throw new Error("Native runtime only supports table queries in this slice");const n=r.table;if(r.relation_ir!=null){const s=y0(e);if(!s.relation_ir||typeof s.relation_ir!="object")throw new Error("Relation query is missing relation_ir");return Mf(n,[],{relation:s.relation_ir,select:rn(r.select_columns??r.select),partial:Hp(r.select_columns),arraySubqueries:wi(r.array_subqueries,n,t)})}const i=sA(r.conditions);if(!i)throw Q();return Mf(n,i.map(s=>tn(n,s,t)),{limit:aA(r.limit),offset:Qp(r.offset),orderBy:YE(r.order_by??r.orderBy),select:rn(r.select_columns??r.select),partial:Hp(r.select_columns),arraySubqueries:wi(r.array_subqueries,n,t)})}function Q(e){const t=e?` (${e})`:"";return new Error(`Native runtime cannot encode this query shape${t}.`)}function tn(e,t,r){if(t.op==="All"||t.op==="Any")return{op:t.op,predicates:t.predicates.map(n=>tn(e,n,r))};if(t.op==="Not")return{op:"Not",predicate:tn(e,t.predicate,r)};if(qf(e)&&"column"in t){if(t.column==="$transactionId")throw new 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(n=>tn(e,{column:t.column,op:"Eq",value:n},r))};if(Gp(t)){const n=nn(e,t.column,t.value,r);if(n.type!=="Timestamp"||!Number.isSafeInteger(n.value))throw new Error("History $acceptedAt predicates require a valid Date or integer milliseconds");const i=BigInt(n.value)<<18n,s=i+(1n<<18n)-1n,o=(a,c)=>c<0n||c>(1n<<64n)-1n?{op:(c<0n?a==="Gt"||a==="Gte":a==="Lt"||a==="Lte")?"All":"Any",predicates:[]}:{column:t.column,op:a,value:{type:"U64",value:c}};switch(t.op){case"Eq":return{op:"All",predicates:[o("Gte",i),o("Lte",s)]};case"Ne":return{op:"Not",predicate:{op:"All",predicates:[o("Gte",i),o("Lte",s)]}};case"Gt":return o("Gt",s);case"Gte":return o("Gte",i);case"Lt":return o("Lt",i);case"Lte":return o("Lte",s)}}}}if(t.op==="In"){const n=t.column==="id"?{type:"Uuid"}:at(r,e)?.columns.find(i=>i.name===t.column)?.column_type;return n?.type==="Array"?{op:"Any",predicates:t.values.map(i=>i.type==="Array"?{column:t.column,op:"Eq",value:nn(e,t.column,i,r)}:{column:t.column,op:"Contains",value:ur(i,n.element,!1)})}:{...t,values:t.values.map(i=>nn(e,t.column,i,r))}}if(t.op==="Contains"){const n=t.column==="id"?{type:"Uuid"}:at(r,e)?.columns.find(i=>i.name===t.column)?.column_type;return{...t,value:n?.type==="Array"?ur(t.value,n.element,!1):nn(e,t.column,t.value,r)}}if(t.op==="IsNull"||t.op==="IsNotNull")return t;if(Gp(t))return{...t,value:nn(e,t.column,t.value,r)};throw new Error(`unsupported query predicate ${JSON.stringify(t)}`)}function Gp(e){return e.op==="Eq"||e.op==="Ne"||e.op==="Gt"||e.op==="Gte"||e.op==="Lt"||e.op==="Lte"}function Hp(e){if(!Array.isArray(e))return[];const t=[];for(const r of e){if(!r||typeof r!="object")continue;const n=r;if(n.kind==="json_pointer"){if(typeof n.at!="string")throw Q("select_columns");t.push({column:n.column,kind:"json_pointer",at:n.at})}else if(n.kind==="bytes"||n.kind==="text_utf16"||n.kind==="text_utf8"){if(typeof n.from!="number"||typeof n.to!="number")throw Q("select_columns");t.push({column:n.column,kind:n.kind,from:n.from,to:n.to})}}return t}function rn(e){if(e==null)return;if(!Array.isArray(e))throw Q();const t=[];for(const r of e){if(typeof r=="string"){t.push(r);continue}if(!r||typeof r!="object"||typeof r.column!="string")throw Q();const n=r;if(n.kind!=="full"&&n.kind!=="bytes"&&n.kind!=="text_utf16"&&n.kind!=="text_utf8"&&n.kind!=="json_pointer")throw Q();t.push(n.column)}return t}function YE(e){if(e==null)return[];if(!Array.isArray(e))throw Q("order_by");return e.map(t=>{if(Array.isArray(t)&&t.length===2&&typeof t[0]=="string"){if(t[1]!=="asc"&&t[1]!=="desc")throw Q("order_by");return{column:t[0],direction:t[1]==="asc"?"Asc":"Desc"}}if(!t||typeof t!="object")throw Q("order_by");const r=t;if(typeof r.column!="string"||r.direction!=="Asc"&&r.direction!=="Desc")throw Q("order_by");return{column:r.column,direction:r.direction}})}function wi(e,t,r){if(e!=null){if(!Array.isArray(e))throw Q("array_subqueries");return e.map(n=>ZE(n,t,r))}}function ZE(e,t,r){if(!e||typeof e!="object")throw Q("array_subqueries");const n=e;if(typeof n.column_name!="string"||typeof n.table!="string"||typeof n.inner_column!="string"||typeof n.outer_column!="string")throw Q("array_subqueries");if(Array.isArray(n.joins)&&n.joins.length>0)throw Q("array_subqueries.joins");const i=eA(n.filters,n.table,r),s=rn(n.select_columns),o=rA(n.order_by),a=wi(n.nested_arrays,n.table,r)??[];return{columnName:n.column_name,table:n.table,innerColumn:n.inner_column,outerColumn:iA(n.outer_column,t),filters:i,select:s,orderBy:o,limit:n.limit==null?null:Xp(n.limit),offset:Qp(n.offset),requirement:nA(n.requirement),nestedArrays:a}}function eA(e,t,r){if(e==null)return[];if(!Array.isArray(e))throw Q("array_subqueries.filters");const n=[];for(const i of e){const s=tA(i);if(!s)throw Q("array_subqueries.filters");n.push(...s.map(o=>tn(t,o,r)))}return n}function tA(e){const t=sn(e);if(t)return[t];if(!e||typeof e!="object")return null;const r=e;for(const[o,a]of[["Eq","Eq"],["Ne","Ne"],["Gt","Gt"],["Ge","Gte"],["Lt","Lt"],["Le","Lte"]]){const c=r[o];if(c&&typeof c=="object"){const{column:l,value:u}=c;return typeof l=="string"?[{column:l,op:a,value:xe(u)}]:null}}const n=r.IsNull;if(n&&typeof n=="object"){const o=n.column;return typeof o=="string"?[{column:o,op:"IsNull"}]:null}const i=r.IsNotNull;if(i&&typeof i=="object"){const o=i.column;return typeof o=="string"?[{column:o,op:"IsNotNull"}]:null}const s=r.Contains;if(s&&typeof s=="object"){const{column:o,value:a}=s;return typeof o=="string"?[{column:o,op:"Contains",value:xe(a)}]:null}return null}function rA(e){if(e==null)return[];if(!Array.isArray(e))throw Q("array_subqueries.order_by");return e.map(t=>{if(!Array.isArray(t)||t.length!==2||typeof t[0]!="string"||t[1]!=="Ascending"&&t[1]!=="Descending")throw Q("array_subqueries.order_by");return{column:t[0],direction:t[1]==="Ascending"?"Asc":"Desc"}})}function nA(e){if(e==null||e==="Optional")return"Optional";if(e==="AtLeastOne"||e==="MatchCorrelationCardinality")return e;throw Q("array_subqueries.requirement")}function iA(e,t){const r=`${t}.`;return e.startsWith(r)?e.slice(r.length):e}function nn(e,t,r,n){const i=t==="id"?{type:"Uuid"}:Do(t)??at(n,e)?.columns.find(o=>o.name===t)?.column_type;if(i?.type==="Bytea"&&r.type==="Array")return{type:"Bytea",value:Uint8Array.from(r.value.map(Jp))};if(r.type==="Array"){const o=t==="id"?{type:"Uuid"}:at(n,e)?.columns.find(c=>c.name===t)?.column_type,a=o?.type==="Array"?o.element:o;return{type:"Array",value:r.value.map(c=>ur(c,a,!1))}}return ur(r,i,!0)}function ur(e,t,r){if(e.type==="Nullable")return r&&e.value?{type:"Nullable",value:ur(e.value,t,!1)}:e;if(t?.type==="Uuid"&&e.type==="Text"&&Yp(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:ti(e.value,"BigInt value")};if(t?.type==="Timestamp"&&e.type==="Integer")return{type:"Timestamp",value:e.value};if(t?.type==="Timestamp"&&e.type==="Text"){const n=Date.parse(e.value);if(Number.isFinite(n))return{type:"Timestamp",value:n}}return t?.type==="Bytea"&&e.type==="Array"?{type:"Bytea",value:Uint8Array.from(e.value.map(Jp))}:t?.type==="Array"&&e.type==="Array"?{type:"Array",value:e.value.map(n=>ur(n,t.element,!1))}:e}function Jp(e){if(e.type!=="Integer"||e.value<0||e.value>255)throw new Error("Bytea values must contain integers in range 0..255");return e.value}function sA(e){if(e==null)return[];if(!Array.isArray(e))return null;const t=[];for(const r of e){if(!r||typeof r!="object")return null;const n=sn(r);if(n){t.push(n);continue}const i=r;if(typeof i.column!="string"||typeof i.op!="string")return null;const s=ui(i.column);switch(i.op){case"eq":i.value===null?t.push({column:s,op:"IsNull"}):t.push({column:s,op:"Eq",value:xe(i.value)});break;case"ne":i.value===null?t.push({column:s,op:"IsNotNull"}):t.push({column:s,op:"Ne",value:xe(i.value)});break;case"gt":t.push({column:s,op:"Gt",value:xe(i.value)});break;case"gte":t.push({column:s,op:"Gte",value:xe(i.value)});break;case"lt":t.push({column:s,op:"Lt",value:xe(i.value)});break;case"lte":t.push({column:s,op:"Lte",value:xe(i.value)});break;case"contains":t.push({column:s,op:"Contains",value:xe(i.value)});break;case"isNull":if(typeof i.value!="boolean")return null;t.push({column:s,op:i.value?"IsNull":"IsNotNull"});break;case"in":if(!Array.isArray(i.value))return null;t.push({column:s,op:"In",values:i.value.map(xe)});break;default:return null}}return t}function Kp(e){if(e==="True")return[];if(e==="False")return[{column:"id",op:"In",values:[]}];if(!e||typeof e!="object")return null;const t=e;if(Array.isArray(t.And)){const f=[];for(const p of t.And){const g=Kp(p);if(!g)return null;f.push(...g)}return f}if(Array.isArray(t.Or))return null;if(t.Not){const f=sn(t.Not);return f?[{op:"Not",predicate:f}]:null}const r=t.IsNull;if(r&&typeof r=="object"){const f=ct(r.column);return f?[{column:f,op:"IsNull"}]:null}const n=t.IsNotNull;if(n&&typeof n=="object"){const f=ct(n.column);return f?[{column:f,op:"IsNotNull"}]:null}const i=t.Contains;if(i&&typeof i=="object"){const f=i,p=ct(f.left),g=vi(f.right);return p&&g?[{column:p,op:"Contains",value:g}]:null}const s=t.In;if(s&&typeof s=="object"){const f=s,p=ct(f.left);if(!p||!Array.isArray(f.values))return null;const g=f.values.map(vi);return g.every(m=>m!=null)?[{column:p,op:"In",values:g}]:null}const o=t.Cmp;if(!o||typeof o!="object")return null;const a=o,c=oA(a.op);if(!c)return null;const l=ct(a.left),u=vi(a.right);return l&&u?[{column:l,op:c,value:u}]:null}function sn(e){if(e==="True")return{op:"All",predicates:[]};if(e==="False")return{op:"Any",predicates:[]};if(!e||typeof e!="object")return null;const t=e;if(Array.isArray(t.And)||Array.isArray(t.Or)){const n=Array.isArray(t.And)?"All":"Any",s=(t.And??t.Or).map(sn);return s.every(o=>o!==null)?{op:n,predicates:s}:null}if(t.Not){const n=sn(t.Not);return n?{op:"Not",predicate:n}:null}const r=Kp(e);return r?.length===1?r[0]:null}function xe(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 Yp(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(xe)};throw Q()}function oA(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 ct(e){if(!e||typeof e!="object")return null;const t=e.column;return typeof t!="string"?null:ui(t)}function vi(e){if(!e||typeof e!="object"||!("Literal"in e))return null;const t=e.Literal;if(!t||typeof t!="object")return null;const r=t;if(r.type==="Boolean"&&typeof r.value=="boolean")return{type:"Boolean",value:r.value};if(r.type==="Integer"&&typeof r.value=="number"&&Number.isSafeInteger(r.value))return{type:"Integer",value:r.value};if(r.type==="BigInt"){if(typeof r.value=="string"&&r.value.length<=dE&&fE.test(r.value))try{return{type:"BigInt",value:ti(BigInt(r.value),"BigInt value")}}catch{return null}if(typeof r.value=="bigint"||typeof r.value=="number"&&Number.isSafeInteger(r.value))return{type:"BigInt",value:BigInt(r.value)}}if(r.type==="Timestamp"&&typeof r.value=="number"&&Number.isSafeInteger(r.value))return{type:"Timestamp",value:r.value};if(r.type==="Double"&&typeof r.value=="number"&&Number.isFinite(r.value))return{type:"Double",value:r.value};if(r.type==="Bytea"&&Array.isArray(r.value))return{type:"Bytea",value:Uint8Array.from(r.value.map(Number))};if(r.type==="Null")return{type:"Nullable",value:null};if(r.type==="Array"&&Array.isArray(r.value)){const n=r.value.map(i=>vi({Literal:i}));if(n.every(i=>i!=null))return{type:"Array",value:n}}return r.type==="Uuid"&&typeof r.value=="string"?{type:"Uuid",value:r.value}:(r.type==="Text"||r.type==="Enum")&&typeof r.value=="string"?{type:"Text",value:r.value}:null}function Xp(e){if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new Error("query limit must be a non-negative safe integer");return e}function aA(e){return e==null?void 0:Xp(e)}function Qp(e){if(e==null)return 0;if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new Error("query offset must be a non-negative safe integer");return e}function Yp(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 aa(e,t,r){Zp(e.columns,t,r);const n=e.columns.filter(i=>Object.hasOwn(t,i.name));return Si(n,i=>t[i.name],!0)}function cA(e,t,r,n){Zp(e.columns.filter(s=>s.name!==r),t,n);const i=e.columns.filter(s=>s.name!==r&&Object.hasOwn(t,s.name));return Si(i,s=>t[s.name],!0)}function lA(e,t,r){const n=e.columns.filter(i=>i.name!==r&&Object.hasOwn(t,i.name));return Si(n,i=>t[i.name],!1)}function on(e,t){const r=e.columns.filter(n=>Object.hasOwn(t,n.name));return Si(r,n=>t[n.name],!1)}function Si(e,t,r){const n=[...e].sort((o,a)=>o.name.localeCompare(a.name)).map(o=>({name:o.name,valueType:Po(o),column:o})),i=n.map(({column:o})=>uA(o,t(o),r)),s=new wt;return To(s,n),s.bytes(Af(n,i)),s.finish()}function Zp(e,t,r){for(const n of e){const i=t[n.name]??n.default;if(!(i&&i.type!=="Null")&&!n.nullable)throw new Error(r?`encoding error: missing required field \`${n.name}\` on table \`${r}\``:`missing required column ${n.name}`)}}function uA(e,t,r){const n=t;if(!n){if(e.nullable)return oi(Po(e));if(r&&e.default==null)throw new Error(`missing required column ${e.name}`);return new Uint8Array}return kf(e,n)}function dA(e){return new We(e).readVec(ri)}function eh(e){return t0(new We(e))}function ca(e,t,r,n="full-record"){const i=[];for(const s of e){const o=fA(s,t,r),a=si(s.descriptor);for(const c of s.rows){const l=[],u=new Map;for(const f of o){const p=yA(f,a,c.raw,n);u.set(f.name,p),f.includeInValues&&l.push(p)}i.push(bt({table:s.table,id:Be(c.rowId),values:l},u))}}return i}function fA(e,t,r){let n=Rp.get(t);n||(n=new Map,Rp.set(t,n));const i=W0(e),s=r?void 0:n.get(i);if(s)return s;const o=r??at(t,e.table)?.columns??[],a=new Map(o.map(u=>[u.name,u])),c=r?new Set(r.map(u=>u.name)):null,l=[];for(let u=0;u<e.descriptor.length;u+=1){const f=e.descriptor[u],p=f&&Kv(f);if(!p)continue;const g=Do(p)??a.get(p)?.column_type;l.push({name:p,index:u,type:g,storageType:e.descriptor[u].valueType,includeInValues:!CA(p)&&(!Xf(p)||c?.has(p)===!0)})}return r||n.set(i,l),l}function th(e,t,r,n="full-record"){return hA(ca(e.rows,t,r,n),t).slice(0,e.rootCount)}var pA=new Set(["table","layer","schema_version","parents","created_by","created_at","updated_by","updated_at"]);function hA(e,t){return e.map(r=>{if(!r.valuesByColumn)return r;const n=new Set((at(t,r.table)?.columns??[]).map(o=>o.name)),i=new Map(r.valuesByColumn),s=new Set;for(const o of pA){if(n.has(o))continue;const a=i.get(o);a&&(s.add(a),i.delete(o))}return s.size===0?r:bt({...r,values:r.values.filter(o=>!s.has(o))},i)})}function mA(e,t,r=!1,n=null){const i=(s,o,a,c)=>{const l=gA(s,t,n,"full-record");if(l.length!==o.length)throw new Error("subscription occurrence sidecar length mismatch");return l.flatMap((u,f)=>{if(n&&u.table!==n.rootTable)return[];const p=c?.[f];return[{sourceId:u.id,occurrenceKey:o[f],index:a[f],row:IA(u,t,n),...p&&p.length>0?{splices:_A(p,t,u.table)}:{}}]})};return{added:i(e.added,e.addedOccurrenceKeys,e.addedIndices),updated:i(e.updated,e.updatedOccurrenceKeys,e.updatedIndices,e.updatedSplices),removed:e.removed.flatMap((s,o)=>n&&s.table!==n.rootTable?[]:[{sourceId:Be(s.rowId),occurrenceKey:e.removedOccurrenceKeys[o],index:e.removedIndices[o]}]),...r?{reset:!0}:{}}}function _A(e,t,r){const n=at(t,r)?.columns??[],i={};for(const{column:s,splices:o}of e){const a=n.find(c=>c.name===s)?.column_type.type;if(a==="Text")i[s]=o.map(c=>({at:c.atUtf16,delete:c.deleteUtf16,insert:Zo.decode(c.insert)}));else if(a==="Bytea")i[s]=o.map(c=>({at:c.at,delete:c.delete,insert:c.insert}));else throw new Error(`subscription splices for column "${s}" of type ${a} are not supported yet`)}return i}function gA(e,t,r,n){return e.flatMap(i=>ca([i],t,i.table===r?.rootTable?r.rootColumns:void 0,n))}function yA(e,t,r,n){const i=t(r,e.index);if(i==null)return{type:"Null"};if(!e.type)return{type:"Bytea",value:i};try{return Ei(e.type,i,e.name,e.storageType,n)}catch(s){throw new Error(`${String(s)} while decoding ${e.name} as ${e.type.type} from storage tag ${e.storageType.tag} (${i.byteLength} bytes)`)}}function Ei(e,t,r,n,i="full-record"){const s=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:s.getInt32(0,!0)};case"BigInt":return{type:"BigInt",value:la(n)?.tag===3?s.getBigUint64(0,!0):s.getBigInt64(0,!0)};case"Double":return{type:"Double",value:s.getFloat64(0,!0)};case"Timestamp":return{type:"Timestamp",value:Number(s.getBigUint64(0,!0))};case"Text":case"Json":case"Enum":if(t[0]!==0)throw new Error("indirect scalar crossed a logical binding boundary");return{type:"Text",value:Zo.decode(t.subarray(1))};case"Uuid":return{type:"Uuid",value:Be(t)};case"Bytea":if(t[0]!==0)throw new Error("indirect scalar crossed a logical binding boundary");return{type:"Bytea",value:t.subarray(1).slice()};case"Array":return{type:"Array",value:SA(e.element,t,bA(n),i)};case"Row":{const o={type:"Row",value:vA(e.columns,t,wA(n),i)};return(r==="$createdBy"||r==="$updatedBy")&&rb(o),o}}}function la(e){let t=e;for(;t?.tag===15;)t=t.inner;return t}function bA(e){const t=la(e);return t?.tag===14?t.inner:void 0}function wA(e){const t=la(e);return t?.tag===16?t.record:void 0}function vA(e,t,r,n="full-record"){if(r){const l=n==="keyed-terminal";if(l&&r[0]?.name!=="row_uuid")throw new Error("keyed terminal nested row descriptor must start with row_uuid");if(l&&t.byteLength<16)throw new Error("terminal nested row is missing its key");const u=l?r.slice(1):r,f=l?t.subarray(16):t,p=si(u),g=new Map(e.map(O=>[O.name,O])),m=new Map;let b=l?Be(t.subarray(0,16)):void 0;for(let O=0;O<u.length;O+=1){const C=u[O]?.name;if(!C)continue;const N=p(f,O);if(!l&&C==="row_uuid"&&N){b=Be(N);continue}const te=g.get(C);te&&m.set(C,N==null?{type:"Null"}:Ei(te.column_type,N,C,u[O]?.valueType,n))}const $=e.map(O=>m.get(O.name)??(O.column_type.type==="Array"?{type:"Array",value:[]}:{type:"Null"}));return bt({id:b,values:$},m)}if(t.byteLength<5)throw new Error("invalid nested row value");const i=t[0]===1;let s=1,o;if(i){if(t.byteLength<21)throw new Error("invalid nested row id");o=Be(t.subarray(s,s+16)),s+=16}const a=Ai(t,s);s+=4;const c=t.subarray(s,s+a);if(c.byteLength!==a)throw new Error("invalid nested row value length");return{id:o,values:Tf(e,c)}}function SA(e,t,r,n="full-record"){const i=Ue(r??sr(e));if(i!=null){if(i===0)return[];if(t.length%i!==0)throw new Error(`invalid fixed-width array byte length ${t.length}`);const c=[];for(let l=0;l<t.length;l+=i)c.push(Ei(e,t.subarray(l,l+i),void 0,r,n));return c}if(t.length<4)throw new Error("invalid variable-width array byte length");const s=Ai(t,0),o=4+Math.max(0,s-1)*4;if(o>t.length)throw new Error("invalid variable-width array offset table");const a=[];for(let c=0;c<s;c+=1){const l=c===0?o:Ai(t,4+(c-1)*4),u=c===s-1?t.length:Ai(t,4+c*4);if(l>u||u>t.length)throw new Error("invalid variable-width array element offset");a.push(Ei(e,t.subarray(l,u),void 0,r,n))}return a}function EA(e){if(!e||typeof e!="object")throw new Error("expected subscription chunk");const 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,delta:Zv(new We(OA(t.delta,"subscription delta"))),terminalOperations:Array.isArray(t.terminalOperations)?t.terminalOperations:void 0};if(t.type==="rejected"||t.type==="Rejected")return{type:"rejected",reason:AA(t.reason)};throw new Error("unknown subscription chunk")}function AA(e){if(!e||typeof e!="object")throw new Error("expected subscription rejection reason");const t=e;if(t.type==="UnsupportedShapeCapability"&&typeof t.detail=="string")return{type:"UnsupportedShapeCapability",detail:t.detail};if(t.type==="ShapeRegistrationPendingCatalogueAdmission")return{type:"ShapeRegistrationPendingCatalogueAdmission"};const r=t.code??t.detail;if(t.type==="ServerFailure"&&typeof r=="string")return typeof t.errorCode=="string"?{type:"ServerFailure",code:r,errorCode:t.errorCode}:{type:"ServerFailure",code:r};if(t.type==="InvalidAuthoritySourceClosure"&&typeof t.transition=="string")return{type:"InvalidAuthoritySourceClosure",transition:t.transition};throw new Error("unknown subscription rejection reason")}function TA(e){const t=e.type==="UnsupportedShapeCapability"?e.detail:e.type==="ServerFailure"?e.code:e.type==="InvalidAuthoritySourceClosure"?e.transition:"catalogue admission pending",r=`Subscription rejected: ${e.type}: ${t}`,n=e.type==="ServerFailure"?e.errorCode:void 0;return n===void 0?new Error(r):Mo({code:n,message:r})??new Error(r)}function RA(e){const t=e;if(typeof t.getReader=="function"){const n=t.getReader();return{pull(i,s){n.read().then(o=>i(o.done?{type:"closed"}:{type:"batch",events:[o.value]}),s)},close(){n.cancel().catch(()=>{})}}}const r=e;return{joinPool:r.joinPool?n=>r.joinPool(n):void 0,pull(){const n=r.readAll();return Array.isArray(n)?{type:"batch",events:n}:{type:"pending",retryAfterMs:n.retryAfterMs?.()??0}},close(){r.close?.()}}}function IA(e,t,r=null){const n=r&&e.table===r.rootTable?r.rootColumns:t?.[e.table]?.columns,i=n?Co(n):void 0;if(!i)throw new Error(`missing schema for subscription row table ${e.table}`);const s=xA(e,i).map((o,a)=>ua(o,i[a].column_type));return bt({id:e.id,values:s},ii(i,s))}function ua(e,t){return e.type==="Null"?e:t.type==="Array"&&e.type==="Array"?{type:"Array",value:e.value.map(r=>ua(r,t.element))}:t.type==="Row"&&e.type==="Row"?{type:"Row",value:kA(e.value,t.columns)}:e}function kA(e,t){const r=e.valuesByColumn,n=t.map((i,s)=>{const a=r?.get(i.name)??e.values[s]??(i.column_type.type==="Array"?{type:"Array",value:[]}:{type:"Null"});return ua(a,i.column_type)});return bt({id:e.id,values:n},ii(t,n))}function xA(e,t){if(!e.valuesByColumn)return e.values.slice(0,t.length);const r=[];r.length=t.length;for(let n=0;n<t.length;n+=1){const i=t[n],s=e.valuesByColumn.get(i.name)??(i.column_type.type==="Array"?{type:"Array",value:[]}:{type:"Null"});r[n]=s}return r}function PA(e,t){return e.length!==t.length?!1:e.every((r,n)=>r===t[n])}function Pe(e){const t=Ks(e);if(!t)throw new Error(`invalid uuid ${e}`);return t}function Ai(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Tt(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}function CA(e){return e.startsWith(di)}function OA(e,t){if(e instanceof Uint8Array)return e;if(Array.isArray(e))return Uint8Array.from(e);throw new Error(`expected ${t} bytes`)}function Ti(e){queueMicrotask(()=>{throw e})}function $A(e,t,r){for(const n of e)r(n,t)}function LA(e,t,r){if(e===t)return"admit";try{const{authClass:n,schemaHash:i,...s}=JSON.parse(e),{authClass:o,schemaHash:a,...c}=JSON.parse(t);if(JSON.stringify(s)!==JSON.stringify(c))return"incompatible";const l=Object.keys(r).length===0;return i!==a&&!l?"incompatible":n===o?"admit":"held-by-another-sign-in"}catch{return"incompatible"}}Error.stackTraceLimit=50;var da="warn";function fa(e,t){const r=e.context.options;if(!e.inspectorAttachment||!t||t.appId!==r.appId||t.physicalDbName!==r.dbName||t.authSessionKey!==r.authSessionKey||t.storageOwner!==r.storageOwner)throw new Error("Inspector attachment does not match the worker account and storage scope")}function Ri(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(Ri).join(",")}]`;if(typeof e=="object"&&e!==null){const t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${Ri(t[r])}`).join(",")}}`}return"null"}function NA(e,t){if(Ri(t)!==Ri(e.options.sessionClaims))throw new Error("Browser tab claims differ from the persistent worker's authenticated upstream session")}async function rh(e,t){await Promise.all([...e.peers.values()].map(r=>r.subscriber?.updateAuthenticatedClaims?.(t))),e.options.sessionClaims=t}var pa=globalThis,Ii=crypto.randomUUID(),nh=null,Y=new Map,lt=new Map,ae=new Map,Le=new Map,an=new Map,ha=new Set,Rt=null,ma=null,ih=Promise.resolve(),jA=1,dr=0,cn=null,sh=!1,ln=[],MA=1,oh=128;function DA(e,t,r){return e.filter(n=>n.authSessionKey===t&&r.has(n.dbName)).map(({authSessionKey:n,...i})=>i)}function Ve(e,t,r,n={}){const i=[...ae.values()].reduce((s,o)=>s+o.activeLeaseIds.size,0);ln.push({sequence:MA++,event:e,dbName:t,authSessionKey:r,peerCount:[...Y.values()].reduce((s,o)=>s+o.peers.size,0),pendingBootstraps:dr,activeLeases:i,...n}),ln.length>oh&&ln.splice(0,ln.length-oh)}async function _a(e,t){const r=Le.get(e);if(r){if(r.release)return await r.release,await _a(e,t);if(r.storageOwner!==t)throw new 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 r}const n=an.get(e);if(n){const s=await n;if(s.storageOwner!==t)throw new 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 s}const i=BA(e,t);an.set(e,i);try{return await i}finally{an.get(e)===i&&an.delete(e)}}async function BA(e,t){const r=await zd(e);let n=null;try{n=await Zd.open(e,{owner:t}),await n.claimBrowserWorkerEpoch(r.id,r);const i={epoch:r,pageStore:n,storageOwner:t,release:null,disposeInvalidation:null};return Le.set(e,i),i.disposeInvalidation=n.onInvalidated(()=>ah(e)),i}catch(i){throw n?.close(),await r.release(),i}}async function un(e){const t=Le.get(e);t&&(t.release||(t.release=(async()=>{try{await t.pageStore.releaseBrowserWorkerEpoch(t.epoch.id)}finally{t.disposeInvalidation?.(),t.disposeInvalidation=null,t.pageStore.close(),await t.epoch.release(),lt.get(e)===t&<.delete(e),Le.delete(e)}})()),await t.release)}function ah(e){ae.delete(e),un(e).catch(()=>{}).finally(()=>_e())}function ch(e={}){nh=e.foregroundLeaseTestHooks??null,pa.onconnect=t=>{const r=t.ports[0];r&&lh(r)}}function lh(e,t){dr+=1;let r=!1,n=!1,i=null,s=!1,o=!1;const a=new AbortController,c=setTimeout(()=>f(),3e4),l=()=>{r||(r=!0,clearTimeout(c),dr-=1,_e(),ki())},u=()=>{e.removeEventListener("message",p),e.removeEventListener("messageerror",g)},f=()=>{n||(n=!0,a.abort(),u(),l(),e.close())};function p(m){const b=m.data;if(b?.type==="cancel-runtime-bootstrap"&&o){a.abort(),M(e,{type:"runtime-bootstrap-cancelled"}),u(),l();return}if(!s){if(t&&(b.type==="connect-runtime"||b.type==="acquire-foreground-node-lease"&&(b.dbName!==t.dbName||b.storageOwner!==t.storageOwner))){M(e,{type:"foreground-node-lease-error",error:ie(new Error("Inspector lease cannot select another storage scope"))}),f();return}if(sh){b?.type==="connect-runtime"?M(e,{type:"worker-closing"}):b?.type==="delete-store"?M(e,{type:"delete-store-result",outcome:"held"}):(b?.type==="probe-foreground-node-lease-worker"||b?.type==="acquire-foreground-node-lease")&&M(e,{type:"foreground-node-lease-worker-closing",attemptId:b.attemptId??""}),f();return}if(b?.type==="probe-foreground-node-lease-worker"){i=b.attemptId,M(e,{type:"foreground-node-lease-worker-alive",attemptId:b.attemptId}),b.wasmPrefetch&&GA(b.wasmPrefetch.runtimeSources);return}if(b?.type==="cancel-foreground-node-lease"){f();return}if(b?.type==="delete-store"){if(t){f();return}s=!0,clearTimeout(c),Ve("delete-store",b.dbName,null),FA(b.dbName,b.runtimeSources).then($=>M(e,{type:"delete-store-result",outcome:$}),$=>M(e,{type:"delete-store-error",error:ie(tt($))})).finally(f);return}if(!(b?.type!=="connect-runtime"&&b?.type!=="acquire-foreground-node-lease"))if(s=!0,clearTimeout(c),b.type==="connect-runtime")o=!0,Ve("bootstrap-start",b.options.dbName,b.options.authSessionKey),M(e,{type:"worker-alive"}),zA(e,b,a.signal,()=>{u(),l()});else{if(u(),i!==null&&b.attemptId!==i){l(),M(e,{type:"foreground-node-lease-error",error:ie(new Error("Foreground node lease request did not match its worker probe"))}),f();return}Ve("lease-request",b.dbName,null),UA(e,b,a.signal).finally(l)}}}function g(){f()}return e.addEventListener("message",p),e.addEventListener("messageerror",g),e.start(),()=>{a.abort(),s||f()}}async function FA(e,t){for(const i of[...Y.values()])if(i.options.dbName===e){if(i.peers.size!==0||i.pendingAdmissionTasks!==0)return"held";await Pi(i)}const r=ae.get(e);if([...Y.values()].some(i=>i.options.dbName===e)||an.has(e)||r&&(r.pendingLeaseAllocations>0||r.pendingLeaseFinalizations>0))return"held";lt.delete(e),await un(e).catch(()=>{}),r&&(ae.delete(e),r.pageStore.close());let n;try{n=await zd(e)}catch(i){if(i instanceof uo)return"held";throw i}try{await Zd.destroy(e),await(await ga(t)).WasmDb.destroyBrowserStorage(void 0,e)}finally{await n.release()}return"deleted"}async function UA(e,t,r){const n=nh;let i=null,s=null,o=null,a=!1,c=null,l=!1;const u=()=>{r?.removeEventListener("abort",$),e.removeEventListener("message",m),e.removeEventListener("messageerror",b)},f=async O=>{if(!l){if(!i){if(O===void 0)return;l=!0,M(e,{type:"foreground-node-lease-cancelled",error:ie(O)}),u(),e.close(),_e();return}if(await o?.catch(()=>{}),!l){if(!s){l=!0,M(e,{type:"foreground-node-lease-cancelled"}),u(),e.close(),_e();return}l=!0;try{await uh(i,s.leaseId);const C=n?await n.cancellationRetired(i.pageStore,s.node):void 0;M(e,{type:"foreground-node-lease-cancelled",...C===void 0?{}:{testLeaseState:C}})}catch(C){M(e,{type:"foreground-node-lease-cancelled",error:ie(new Error("Shared browser foreground lease cancellation failed",{cause:tt(C)}))})}finally{u(),e.close(),_e()}}}},p=O=>(l||(a=!0,(i||O!==void 0)&&!c&&(c=f(O))),c),g=async()=>{l||!s||!i||(l=!0,await uh(i,s.leaseId))},m=O=>{(async()=>{const C=O.data;try{if(C?.type==="cancel-foreground-node-lease"){p();return}if(!s||!i||l||a)return;if(C?.type==="return-foreground-node-lease"){if(!/^(0|[1-9][0-9]*)$/.test(C.confirmedTxTime))throw new Error("Invalid foreground node lease high-water");const N=BigInt(C.confirmedTxTime);if(N>(1n<<64n)-1n)throw new Error("Invalid foreground node lease high-water");await i.pageStore.returnForegroundNodeLease(s.leaseId,N),l=!0,i.activeLeaseIds.delete(s.leaseId),M(e,{type:"foreground-node-lease-result"}),u(),e.close(),_e();return}C?.type==="retire-foreground-node-lease"&&(await g(),M(e,{type:"foreground-node-lease-result"}),u(),e.close())}catch(N){await g().catch(()=>{}),M(e,{type:"foreground-node-lease-result",error:ie(N)}),u(),e.close()}})()},b=()=>{p()},$=()=>{p()};r?.addEventListener("abort",$,{once:!0}),r?.aborted&&$(),e.addEventListener("message",m),e.addEventListener("messageerror",b);try{if(i=ae.get(t.dbName)??null,!i){const C=await _a(t.dbName,t.storageOwner);i=ae.get(t.dbName)??null,i||(i={pageStore:C.pageStore,storageOwner:t.storageOwner,activeLeaseIds:new Set,pendingLeaseAllocations:0,pendingLeaseFinalizations:0,allocationTail:Promise.resolve()},ae.set(t.dbName,i))}if(i.storageOwner!==t.storageOwner)throw new 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(a){await p();return}const O=WA(i,t,e,n);if(o=(async()=>{const C=await O,N=n?.delayAfterLeaseAllocation(t);if(N!==void 0){if(!Number.isSafeInteger(N)||N<0||N>1e3)throw new Error("Invalid foreground lease test delay");n?.allocationCommitted(e,C.node.slice(),Ii),await new Promise(te=>setTimeout(te,N))}return C})(),s=await o,a){await p();return}r?.removeEventListener("abort",$),Ve("lease-admitted",t.dbName,null),M(e,{type:"foreground-node-lease-ready",workerRealmId:Ii,leaseId:s.leaseId,node:s.node,confirmedTxTime:s.confirmedTxTime.toString()})}catch(O){if(a){await p(O);return}u(),O instanceof uo?M(e,{type:"foreground-node-lease-busy",message:O.message}):M(e,{type:"foreground-node-lease-error",error:ie(O)}),e.close()}}async function WA(e,t,r,n){e.pendingLeaseAllocations+=1;const i=e.allocationTail;let s;e.allocationTail=new Promise(o=>{s=o}),await i;try{const o=n?.delayBeforeLeaseAllocation(t);if(o!==void 0){if(!Number.isSafeInteger(o)||o<0||o>1e3)throw new Error("Invalid foreground lease test delay");n?.allocationQueued(r),await new Promise(c=>setTimeout(c,o))}const a=await e.pageStore.acquireForegroundNodeLease(e.activeLeaseIds.size===0);return e.activeLeaseIds.add(a.leaseId),a}finally{e.pendingLeaseAllocations-=1,s(),_e()}}async function uh(e,t){e.pendingLeaseFinalizations+=1,e.activeLeaseIds.delete(t);try{await e.pageStore.retireForegroundNodeLease(t)}catch(r){throw e.activeLeaseIds.add(t),r}finally{e.pendingLeaseFinalizations-=1,_e()}}function ki(){if(dr===0)for(const[e,t]of lt){if(Le.get(e)!==t||Y.has(e)){lt.delete(e);continue}const r=ae.get(e);r&&(r.activeLeaseIds.size>0||r.pendingLeaseAllocations>0||r.pendingLeaseFinalizations>0)||(lt.delete(e),ae.delete(e),un(e).catch(()=>{}))}}async function zA(e,t,r,n){const i=Symbol("runtime-admission");let s,o=!1;const a=()=>{o&&(o=!1,s?.admissionClaims.delete(i))},c=()=>{if(r.throwIfAborted(),s&&(s.closing||Y.get(s.key)!==s))throw new Error("Shared browser runtime context closed during initialization")};r.addEventListener("abort",a,{once:!0});try{c();const l=lT(t.options);let u=Y.get(l);if(u?.closing&&(await u.closing,c(),u=Y.get(l)),u&&u.options.storageOwner!==t.options.storageOwner)throw new 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(u&&!cT(u.options,t.options))throw new Error("incompatible persistent browser telemetry configuration");const f=u?LA(u.fingerprint,t.fingerprint,t.options.schema):"admit";if(f!=="admit")throw new Error(f==="held-by-another-sign-in"?Nv:"incompatible persistent browser configuration");u?.idleReleaseTimer&&(clearTimeout(u.idleReleaseTimer),u.idleReleaseTimer=null),u||(u=qA(l,t.fingerprint,t.options),Y.set(l,u)),s=u,u.admissionClaims.add(i),o=!0,u.pendingAdmissionTasks+=1,await u.initialize,c(),await dn(u,()=>(c(),KA(u,t.options))),c(),fh(u,t.tabId,e,t.options.author),a(),n(),M(e,{type:"runtime-ready"})}catch(l){n(),r.aborted||(M(e,{type:"runtime-error",error:ie(l)}),e.close())}finally{if(r.removeEventListener("abort",a),a(),s&&(s.pendingAdmissionTasks-=1,s.pendingAdmissionTasks===0&&s.admissionClaims.size===0&&s.peers.size===0)){const l=Le.get(t.options.dbName);await Pi(s),l&&Le.get(t.options.dbName)===l&<.set(t.options.dbName,l),ki(),_e()}}}function qA(e,t,r){const n={key:e,fingerprint:t,options:r,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:r.serverUrl??null,serverAuthJson:r.authJson,serverConnectionStarted:!1,explicitlyDisconnected:!1,transportTransition:Promise.resolve(),transportStateEpoch:0,transportStateWaiters:new Set,authFailureEpoch:0,storageFailure:null,initialize:Promise.resolve(),closing:null,idleReleaseTimer:null},i=ih.then(()=>VA(n));return ih=i.catch(()=>{}),n.initialize=i,n}async function VA(e){let t=null;try{const{options:r}=e,n=await _a(r.dbName,r.storageOwner);e.pageStore=n.pageStore,e.disposePageStoreInvalidation=e.pageStore.onInvalidated(()=>iT(e)),pa.__JAZZ_WASM_LOG_LEVEL=r.logLevel??da;const i=await ga(r.runtimeSources);e.disposeTelemetry=Av({wasmModule:i,collectorUrl:r.telemetryCollectorUrl,runtimeThread:"worker"});const s=e.pageStore.replicaNode,o=Uo(r.schema),a=r.selfSignedClientProof,c=jf(s,r.author,1,!1,r.initialSyncFlushEvery,a,r.migrations);if(a&&typeof i.WasmDb.openBrowserWithSelfSignedProof!="function")throw new Error("WASM runtime does not support self-signed client opens; rebuild the matching Jazz WASM artifact");t=a?await i.WasmDb.openBrowserWithSelfSignedProof(e.pageStore,o,c,a.token,a.appId,a.claimedAuthor,r.dbName):await i.WasmDb.openBrowser(e.pageStore,o,c,r.dbName);const l=TE.fromDb(t,r.schema,s,r.author,1,!1,{selfSignedClientProof:a,scopeIsolatedRelay:!0,slowQueryLog:{appId:r.appId,thresholdMs:r.slowQueryThresholdMs,consoleDetail:"summary"}});e.runtime=l,t=null,e.runtime.onAuthFailure(p=>{e.authFailureEpoch+=1,ut(e,{type:"auth-failure",reason:p})}),e.runtime.onStorageFailure(p=>{e.storageFailure=p,ut(e,{type:"storage-failure",message:p})}),e.runtime.onMutationError(p=>{$A(e.peers.values(),p,(g,m)=>M(g.port,{type:"mutation-error",event:m}))});let u=null;const f=()=>{if(e.runtime!==l)return;const p=l.remoteLinkState(),g=l.upstreamLinkStatus();u?.state===p&&Bo(u.link,g)||(u={state:p,link:g},ut(e,{type:"remote-link",state:p,link:g}))};l.onRemoteLinkStateChange(f,new AbortController().signal),l.onUpstreamLinkStatusChange(f,new AbortController().signal),e.runtime.onServerTransportError((p,{retrying:g})=>{for(const m of e.peers.values())!m.subscriber||!m.pump||M(m.port,{type:"transport-error",error:ie(p),retrying:g})}),r.logLevel==="trace"&&(e.disposeAuxiliaryTrace=e.runtime.onAuxiliaryTrace(p=>{ut(e,{type:"relay-trace",entries:p.map(g=>({...g,hop:"worker-server"}))})}))}catch(r){try{await t?.close()}catch{}try{JA(e)}catch{}throw r}}function GA(e){Rt||e?.wasmModule||e?.wasmSource||ga(e).catch(()=>{})}async function ga(e){const t=HA(e);if(Rt&&(!t||ma!==t))throw new Error("incompatible WASM asset source for this SharedWorker; start a worker scoped to the new asset URL");const r=Rt??Qw(e);Rt=r,ma=t;try{return await r}catch(n){throw Rt===r&&(Rt=null,ma=null),n}}function HA(e){return e?.wasmModule?e.workerWasmAssetIdentity?`module:${e.workerWasmAssetIdentity}`:null:e?.wasmSource?e.workerWasmAssetIdentity?`source:${e.workerWasmAssetIdentity}`:null:e?.wasmUrl??"worker-local"}function JA(e){const t=e.runtime,r=e.disposePageStoreInvalidation,n=e.disposeTelemetry,i=e.disposeAuxiliaryTrace;e.runtime=null,e.pageStore=null,e.disposePageStoreInvalidation=null,e.disposeTelemetry=null,e.disposeAuxiliaryTrace=null,Y.get(e.key)===e&&Y.delete(e.key);try{t?.discard()}finally{try{r?.()}finally{try{n?.()}finally{i?.()}}}_e()}async function KA(e,t){const r=t.serverUrl??null;if(e.serverUrl===r){if(!fr(t.authJson)&&fr(e.serverAuthJson))return;e.runtime?.assertCredentialKeepsPrincipal(t.authJson),e.serverAuthJson=t.authJson,e.serverConnectionStarted&&await xi(e).updateAuth(t.authJson);return}if(e.peers.size>0)throw new Error("incompatible persistent browser server configuration");e.serverConnectionStarted&&(await xi(e).disconnect({rejectWaiters:!1}),e.serverConnectionStarted=!1),e.serverUrl=r,e.serverAuthJson=t.authJson}function fr(e){try{const 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 ya(e){const t=e.serverUrl;t||e.runtime?.setRemoteLinkHint("none"),!(!t||e.explicitlyDisconnected)&&(e.serverConnectionStarted||fr(e.serverAuthJson)&&(xi(e).connect(t,e.serverAuthJson),e.serverConnectionStarted=!0))}function dn(e,t){const r=e.transportTransition.then(t,t);return e.transportTransition=r.catch(()=>{}),r}function dh(e){e.transportStateEpoch+=1,ut(e,{type:"transport-state",explicitlyDisconnected:e.explicitlyDisconnected});const t=[...e.transportStateWaiters];e.transportStateWaiters.clear();for(const r of t)r()}function XA(e,t,r){return e.transportStateEpoch!==t||r?.aborted?Promise.resolve():new Promise(n=>{const i=()=>{e.transportStateWaiters.delete(i),r?.removeEventListener("abort",i),n()};r?.addEventListener("abort",i,{once:!0}),e.transportStateWaiters.add(i)})}async function QA(e,t,r){for(;;){if(r?.aborted||(await e.transportTransition,r?.aborted))return;if(e.explicitlyDisconnected){const n=e.transportStateEpoch;await XA(e,n,r);continue}if(await t.waitForUpstreamServerConnection(),!e.explicitlyDisconnected)return}}function fh(e,t,r,n,i=!1){pr(e,t);let s;const o=c=>{ZA(s,c.data)},a=()=>pr(e,t);s={tabId:t,context:e,author:n,port:r,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:a},e.peers.set(t,s),r.addEventListener("message",o),r.addEventListener("messageerror",a),r.start()}function YA(e,t){const{context:r,tabId:n}=e,i=globalThis.navigator?.locks;!i||e.watchedLivenessLock!==null||(e.watchedLivenessLock=t,i.request(t,{signal:e.transportWaitAbort.signal},()=>{r.peers.get(n)===e&&(pr(r,n),r.peers.size===0&&r.pendingAdmissionTasks===0&&hh(r))}).catch(()=>{}))}async function ZA(e,t){if(e.context.peers.get(e.tabId)===e){if(t.type==="liveness-lock"){YA(e,t.name);return}if(t.type==="runtime-probe"){M(e.port,{type:"runtime-pong",connectionId:t.connectionId,nonce:t.nonce});return}if(t.type==="frames"){if(e.context.options.logLevel==="trace"&&Ve("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"){const r=e.context.peers.size===1&&e.context.pendingAdmissionTasks===0&&t.releaseContext;pr(e.context,e.tabId,!1);try{r&&await Pi(e.context),t.id!==void 0&&M(e.port,{type:"result",id:t.id}),r&&hh(e.context)}catch(n){t.id!==void 0&&M(e.port,{type:"result",id:t.id,error:ie(tt(n))})}return}if(t.type==="diagnostic-query-coverage"){Ve(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"){oT(e,t.resetId);return}if(t.type==="flush-local-observed"){e.flushObserved=!0,yh(e);return}if(t.type==="open-inspector-control"){eT(e.context.options.authSessionKey,t.port),ce(e,t.id);return}if(t.type==="store-pending-uploads"){let r;try{r=e.context.runtime?.uploadStatus().pending}catch{r=void 0}ce(e,t.id,void 0,{pendingUploads:r});return}if(t.type==="prepare-storage-reset"){e.context.intentionalStorageReset=!0;let r;try{r=e.context.runtime?.uploadStatus().pending}catch{r=void 0}ce(e,t.id,void 0,{pendingUploads:r});return}if(t.type==="abort-storage-reset"){e.context.intentionalStorageReset=!1,ce(e,t.id);return}if(t.type==="finish-storage-reset"){await rT(e.context),sT(e.context),ce(e,t.id);return}try{const r=xi(e.context);if(t.type==="inspect-query"||t.type==="inspect-subscribe"||t.type==="inspect-unsubscribe"||t.type==="inspect-commit"||t.type==="inspect-wait"){if(fa(e,t.binding),!e.subscriber||!e.pump||e.context.storageInvalidated||e.context.closing)throw new Error("Inspector cache reads require an active authenticated attachment");if(!Number.isSafeInteger(t.id)||t.id>=-1)throw new Error("Invalid Inspector query identifier");if(t.type==="inspect-commit"){const s=wb();r.beginTransaction("mergeable",s);let o;try{for(const a of t.edits){const c=JSON.stringify({transaction_id:s,updated_at:a.updatedAt});switch(a.operation){case"insert":r.insert(a.table,a.values??{},c,a.rowId);break;case"update":r.update(a.table,a.rowId,a.values??{},c);break;case"delete":r.delete(a.table,a.rowId,c);break;default:throw new Error("Invalid Inspector edit operation")}}o=r.commitTransaction(s)}catch(a){try{await r.rollbackTransaction(s)}catch{}throw a}e.inspectorWrites.add(o),M(e.port,{type:"inspector-query-result",id:t.id,value:o});return}if(t.type==="inspect-wait"){const s=t.txId;if(!e.inspectorWrites.has(s))throw new Error("Unknown Inspector write");await r.waitForTransaction(s,t.tier),e.context.peers.get(e.tabId)===e&&e.context.runtime===r&&!e.context.storageInvalidated&&!e.context.closing&&M(e.port,{type:"inspector-query-result",id:t.id,value:null});return}if(t.type==="inspect-unsubscribe"){const s=e.inspectorSubscriptions.get(t.id);e.inspectorSubscriptions.delete(t.id),s!==void 0&&r.unsubscribe(s);return}const n=t.options,i=()=>e.context.peers.get(e.tabId)===e&&e.context.runtime===r&&!e.context.storageInvalidated&&!e.context.closing&&!!e.subscriber;if(t.type==="inspect-query"){const s=await r.query(t.query,void 0,"local-only",n);i()&&M(e.port,{type:"inspector-query-result",id:t.id,value:s})}else{if(e.inspectorSubscriptions.has(t.id))throw new Error("Inspector subscription already exists");const s=r.createSubscription(t.query,void 0,"local-only",n);e.inspectorSubscriptions.set(t.id,s),r.executeSubscription(s,o=>{!i()||e.inspectorSubscriptions.get(t.id)!==s||M(e.port,o instanceof Error?{type:"inspector-query-result",id:t.id,error:ie(o)}:{type:"inspector-query-result",id:t.id,value:o})})}return}if(t.type==="inspect-binding"){fa(e,t.binding),t.leasePort&&e.pendingInspectorBootstraps.add(lh(t.leasePort,e.context.options)),M(e.port,{type:"inspector-binding",id:t.id,binding:t.binding});return}if(t.type==="init"){await dn(e.context,async()=>{const n=()=>e.context.peers.get(e.tabId)===e&&e.context.runtime===r&&!e.context.storageInvalidated&&!e.context.closing;if(!n())return;if((e.inspectorAttachment||t.inspectorBinding)&&fa(e,t.inspectorBinding),e.pump||e.subscriber)throw new Error("Browser tab is already initialized");NA(e.context,t.sessionClaims);let i=null;try{const s=r.createPeerAuthority();if(i=await r.acceptPeer(t.sessionClaims,s.epoch,e.author),!n())return;const o=aT(e,r,i);if(i=null,Ve("peer-attached",e.context.options.dbName,e.context.options.authSessionKey),e.pendingFrames.length>0){const a=e.pendingFrames.splice(0);o.receive(a)}e.context.explicitlyDisconnected?M(e.port,{type:"transport-state",explicitlyDisconnected:!0}):ya(e.context),e.context.storageFailure!==null&&M(e.port,{type:"storage-failure",message:e.context.storageFailure}),M(e.port,{type:"remote-link",state:r.remoteLinkState(),link:r.upstreamLinkStatus()}),ce(e,t.id,void 0,{peerAuthority:s,workerRealmId:Ii,...e.inspectorAttachment?{inspectorAttachmentPhysicalDbName:e.context.options.dbName}:{}})}catch(s){if(n())throw s}finally{i&&await r.retirePeerTransport(i)}});return}if(t.type==="update-auth"){if(!e.subscriber)throw new Error("Browser tab is not initialized");let n=!1;await dn(e.context,async()=>{r.assertCredentialKeepsPrincipal(t.authJson);const i=e.context.authFailureEpoch;try{e.context.explicitlyDisconnected||(e.context.serverConnectionStarted?await r.updateAuth(t.authJson):(e.context.serverAuthJson=t.authJson,ya(e.context)),await r.waitForUpstreamServerConnection())}catch(s){if(e.context.authFailureEpoch!==i){n=!0;return}throw s}e.context.serverAuthJson=t.authJson,await rh(e.context,t.sessionClaims)}),n||ut(e.context,{type:"auth-restored"});return}if(t.type==="disconnect"){await dn(e.context,async()=>{const n=e.context.explicitlyDisconnected;e.context.explicitlyDisconnected=!0,e.context.serverConnectionStarted=!1;try{await r.disconnect({rejectWaiters:!1})}catch(i){throw e.context.explicitlyDisconnected=n,n||ya(e.context),i}dh(e.context)}),ce(e,t.id);return}if(t.type==="flush-pending-writes"){e.context.runtime.waitForPendingWrites("global").then(()=>ce(e,t.id),n=>ce(e,t.id,tt(n)));return}if(t.type==="flush-local"){if(e.flushRequestId!==null){ce(e,t.id,new 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,yh(e);return}if(t.type==="reconnect"){const n=e.context.serverUrl;if(!n)throw new Error("Browser runtime reconnect requires a serverUrl");await dn(e.context,async()=>{const i=fr(t.authJson)||!fr(e.context.serverAuthJson),s=i?t.authJson:e.context.serverAuthJson;r.assertCredentialKeepsPrincipal(s);const o=fr(s);o&&(r.connect(n,s),await r.waitForUpstreamServerConnection()),e.context.serverAuthJson=s,i&&await rh(e.context,t.sessionClaims),e.context.explicitlyDisconnected=!1,e.context.serverConnectionStarted=o,dh(e.context)}),ce(e,t.id);return}if(await QA(e.context,r,e.transportWaitAbort.signal),e.transportWaitAbort.signal.aborted)return;ce(e,t.id)}catch(r){if(t.type==="init"&&(!e.context.runtime||e.context.storageInvalidated||e.context.closing))return;"id"in t?ce(e,t.id,tt(r)):ph(e,tt(r))}}}function eT(e,t){ha.add(t);const r=i=>{const s=i.data;if(s.type==="close"){n();return}if(s.type==="list-contexts"){const a=[...Y.values()].filter(c=>c.options.authSessionKey===e&&!c.storageInvalidated&&c.runtime!==null).map(c=>({workerRealmId:Ii,key:c.key,appId:c.options.appId,dbName:c.options.dbName,schema:c.options.schema}));t.postMessage({type:"contexts",id:s.id,contexts:a});return}if(s.type==="lifecycle-trace"){const a=new Set([...Y.values()].filter(c=>c.options.authSessionKey===e&&!c.storageInvalidated&&c.runtime!==null).map(c=>c.options.dbName));t.postMessage({type:"lifecycle-trace",id:s.id,entries:DA(ln,e,a)});return}if(s.type==="terminate-worker"){if(Y.size>0){t.postMessage({type:"result",id:s.id,error:ie(new Error("Worker still has live runtime contexts"))});return}if(dr>0){t.postMessage({type:"result",id:s.id,error:ie(new Error("Worker still has pending bootstrap operations"))});return}if(_h()){t.postMessage({type:"result",id:s.id,error:ie(new Error("Worker still has pending or active foreground node leases"))});return}sh=!0,t.postMessage({type:"result",id:s.id,workerTerminated:!0}),setTimeout(()=>pa.close(),0);return}const o=Y.get(s.contextKey);if(!o||o.options.authSessionKey!==e||o.storageInvalidated||!o.runtime){s.port.close(),t.postMessage({type:"result",id:s.id,error:ie(new Error("Inspector context is no longer available"))});return}fh(o,s.tabId,s.port,o.options.author,!0),t.postMessage({type:"result",id:s.id})},n=()=>{t.removeEventListener("message",r),t.removeEventListener("messageerror",n),ha.delete(t),t.close(),_e()};t.addEventListener("message",r),t.addEventListener("messageerror",n),t.start()}function ce(e,t,r,n){e.context.peers.get(e.tabId)===e&&M(e.port,{type:"result",id:t,...r?{error:ie(r)}:{},...n})}function ph(e,t){M(e.port,{type:"error",error:ie(t)}),pr(e.context,e.tabId)}function pr(e,t,r=!0){const n=e.peers.get(t);if(n){e.peers.delete(t),n.transportWaitAbort.abort();for(const i of n.pendingInspectorBootstraps)i();n.pendingInspectorBootstraps.clear();for(const i of n.inspectorSubscriptions.values())e.runtime?.unsubscribe(i);n.inspectorSubscriptions.clear(),n.inspectorWrites.clear(),gh(e,t),n.port.removeEventListener("message",n.onMessage),n.port.removeEventListener("messageerror",n.onMessageError),tT(n),r&&n.port.close()}}function tT(e){e.pump?.close(),e.pump=null,e.subscriber=null,e.pendingFrames.length=0}function ut(e,t){for(const r of e.peers.values())M(r.port,t)}function xi(e){if(!e.runtime)throw new Error("Shared browser runtime is closed");return e.runtime}async function rT(e){e.intentionalStorageReset=!1;for(const n of e.peers.values())n.pump=null,n.subscriber=null,n.pendingFrames.length=0;e.runtime?.discard(),e.runtime=null,e.disposePageStoreInvalidation?.(),e.disposePageStoreInvalidation=null,e.pageStore=null,await(await Rt)?.WasmDb.destroyBrowserStorage(void 0,e.options.dbName),e.disposeTelemetry?.(),e.disposeTelemetry=null,e.disposeAuxiliaryTrace?.(),e.disposeAuxiliaryTrace=null,Y.delete(e.key);const r=ae.get(e.options.dbName);r&&(ae.delete(e.options.dbName),r.pageStore.close()),await un(e.options.dbName).catch(()=>{})}async function Pi(e){Y.get(e.key)===e&&(e.peers.size!==0||e.pendingAdmissionTasks!==0||(e.closing||(e.closing=(async()=>{for(const n of e.peers.values())n.pump?.close(),n.pump=null,n.subscriber=null,n.pendingFrames.length=0;const t=Le.get(e.options.dbName),r=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 r,Y.get(e.key)===e&&(Y.delete(e.key),t&&Le.get(e.options.dbName)===t&<.set(e.options.dbName,t),ki())})()),await e.closing))}function hh(e){e.idleReleaseTimer&&clearTimeout(e.idleReleaseTimer),e.idleReleaseTimer=setTimeout(()=>{e.idleReleaseTimer=null,!(e.peers.size!==0||e.pendingAdmissionTasks!==0)&&Pi(e).then(()=>{_e()})},50)}function _e(){if(ki(),!mh()){if(cn)return;const e=Symbol("worker-idle-close");cn=e;const t=new Set([...ae.keys(),...Le.keys()]);for(const r of t)Ve("owner-release-start",r,null);ae.clear(),Promise.all([...t].map(r=>un(r))).catch(()=>{}).finally(()=>{if(cn===e){if(mh()){cn=null;return}for(const r of t)Ve("owner-release-finished",r,null);cn=null}})}}function mh(){return Y.size>0||ha.size>0||dr>0||_h()}function _h(e){return[...ae.entries()].some(([t,r])=>(e===void 0||t===e)&&(r.activeLeaseIds.size>0||r.pendingLeaseAllocations>0||r.pendingLeaseFinalizations>0))}function nT(e){for(const t of e.peers.keys())pr(e,t)}function iT(e){if(e.intentionalStorageReset){e.runtime?.discard(),e.runtime=null,e.pageStore=null;return}e.storageInvalidated||(e.storageInvalidated=!0,Y.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,ah(e.options.dbName),ut(e,{type:"storage-invalidated"}),setTimeout(()=>nT(e),0))}async function sT(e){const t=new Set(e.peers.keys());if(t.size===0)return;const r=jA++;await new Promise(n=>{e.resetBarrier={id:r,pending:t,resolve:n},ut(e,{type:"storage-reset",resetId:r})})}function oT(e,t){e.context.resetBarrier?.id===t&&gh(e.context,e.tabId)}function gh(e,t){const r=e.resetBarrier;!r||!r.pending.delete(t)||r.pending.size!==0||(e.resetBarrier=null,r.resolve())}function aT(e,t,r){const n=new Ov(t,r,i=>{const s=$v(i);e.port.postMessage({type:"frames",frames:s},s.map(o=>o.buffer))},i=>ph(e,tt(i)),e.context.options.logLevel==="trace"?i=>{M(e.port,{type:"relay-trace",entries:i.map(s=>({...s,hop:"worker-tab"}))})}:void 0);return e.subscriber=r,e.pump=n,n}function yh(e){const t=e.flushRequestId;t===null||!e.flushPumpComplete||!e.flushObserved||(e.flushRequestId=null,e.flushedLocal=!0,ce(e,t))}function cT(e,t){const r=e.telemetryCollectorUrl?.trim()||void 0,n=t.telemetryCollectorUrl?.trim()||void 0;return!r!=!n||r&&n&&(tr(r,"traces")!==tr(n,"traces")||tr(r,"logs")!==tr(n,"logs"))?!1:(e.logLevel??da)===(t.logLevel??da)}function lT(e){return e.dbName}function M(e,t){e.postMessage(t)}ch();export{ch as installJazzBrokerWorker};
|