From e1ab822b7dc78e30b1e194273f28d42f70431a55 Mon Sep 17 00:00:00 2001 From: Blake Kaufman <68204898+BlakeKaufman@users.noreply.github.com> Date: Tue, 30 Jun 2026 07:22:29 -0400 Subject: [PATCH] Fix balance issue (#981) * get fresh balance on load * improve balance version matchup + unbounded debounce * bump to 50 * using sdk balance event * bumping sdk * fixing minor bugs * remove uneeded log * fixing border radius * lower to 50 txs --- .../functions/lrc20/cachedTokens.test.js | 84 ++++ __tests__/functions/pollingManager.test.js | 51 +++ android/app/src/main/assets/sparkContext.html | 4 +- .../homeLightning/halfModalOtherOptions.js | 2 +- app/functions/initiateWalletConnection.js | 22 +- app/functions/lrc20/cachedTokens.js | 15 + app/functions/pollingManager.js | 30 +- app/functions/spark/balanceSnapshots.js | 14 +- context-store/sparkContext.js | 399 ++++++++++++++---- context-store/webViewContext.js | 89 ++-- package.json | 2 +- yarn.lock | 8 +- 12 files changed, 599 insertions(+), 121 deletions(-) create mode 100644 __tests__/functions/lrc20/cachedTokens.test.js create mode 100644 __tests__/functions/pollingManager.test.js diff --git a/__tests__/functions/lrc20/cachedTokens.test.js b/__tests__/functions/lrc20/cachedTokens.test.js new file mode 100644 index 00000000..68f6c24f --- /dev/null +++ b/__tests__/functions/lrc20/cachedTokens.test.js @@ -0,0 +1,84 @@ +// mergeAndCacheTokens lets the token-balance:update handler update the token map +// from the event payload (the SDK's full getTokenBalanceMap()) without a second +// balance read. These tests pin the two properties the handler relies on: +// 1. live token balances are normalized to Number (string or BigInt input), +// 2. a token absent from the new full map is zeroed (proving the payload is +// treated as authoritative, not merged additively). +jest.mock('../../../app/functions/localStorage', () => { + const store = {}; + return { + getLocalStorageItem: jest.fn(async key => + key in store ? store[key] : null, + ), + setLocalStorageItem: jest.fn(async (key, val) => { + store[key] = val; + }), + __reset: () => { + for (const key of Object.keys(store)) delete store[key]; + }, + }; +}); + +const localStorage = require('../../../app/functions/localStorage'); +const { + mergeAndCacheTokens, +} = require('../../../app/functions/lrc20/cachedTokens'); + +const MNEMONIC = 'test mnemonic'; + +const tokenEntry = (balance, maxSupply) => ({ + tokenMetadata: { maxSupply, name: 'TKN' }, + balance, +}); + +describe('mergeAndCacheTokens', () => { + beforeEach(() => { + localStorage.__reset(); + }); + + it('normalizes string balances from the WebView payload to Number', async () => { + const merged = await mergeAndCacheTokens( + { btknAAA: tokenEntry('500', '1000') }, + MNEMONIC, + ); + + expect(merged.btknAAA.balance).toBe(500); + expect(merged.btknAAA.tokenMetadata.maxSupply).toBe(1000); + expect(typeof merged.btknAAA.balance).toBe('number'); + }); + + it('normalizes BigInt balances from the native payload to Number', async () => { + const merged = await mergeAndCacheTokens( + { btknAAA: tokenEntry(500n, 1000n) }, + MNEMONIC, + ); + + expect(merged.btknAAA.balance).toBe(500); + expect(merged.btknAAA.tokenMetadata.maxSupply).toBe(1000); + }); + + it('zeroes a previously held token absent from the new full map', async () => { + await mergeAndCacheTokens( + { + btknAAA: tokenEntry('500', '1000'), + btknBBB: tokenEntry('200', '1000'), + }, + MNEMONIC, + ); + + // Next event reports only btknAAA — btknBBB must be retained but zeroed, + // never left at its stale balance. + const merged = await mergeAndCacheTokens( + { btknAAA: tokenEntry('700', '1000') }, + MNEMONIC, + ); + + expect(merged.btknAAA.balance).toBe(700); + expect(merged.btknBBB.balance).toBe(0); + }); + + it('returns an empty map and writes nothing harmful for an empty payload', async () => { + const merged = await mergeAndCacheTokens({}, MNEMONIC); + expect(merged).toEqual({}); + }); +}); diff --git a/__tests__/functions/pollingManager.test.js b/__tests__/functions/pollingManager.test.js new file mode 100644 index 00000000..e48f7cce --- /dev/null +++ b/__tests__/functions/pollingManager.test.js @@ -0,0 +1,51 @@ +// getBalanceWithTimeout wraps getSparkBalance in a hard timeout so a read that +// never settles (e.g. a WebView request whose timeout is neutered while the app +// is backgrounded) can't park the balance supervisor's await forever — which +// would wedge the entire balance lane (its running guard is only cleared in the +// supervisor's finally). +jest.mock('../../app/functions/spark', () => ({ + getSparkBalance: jest.fn(), +})); + +jest.mock('../../app/functions/spark/restore', () => ({ + fullRestoreSparkState: jest.fn(), +})); + +const { getSparkBalance } = require('../../app/functions/spark'); +const { getBalanceWithTimeout } = require('../../app/functions/pollingManager'); + +describe('getBalanceWithTimeout', () => { + afterEach(() => { + jest.clearAllMocks(); + jest.useRealTimers(); + }); + + it('returns the real balance when the read resolves before the timeout', async () => { + getSparkBalance.mockResolvedValue({ didWork: true, balance: 42 }); + await expect(getBalanceWithTimeout('mnemonic', 1000)).resolves.toEqual({ + didWork: true, + balance: 42, + }); + }); + + it('resolves to didWork:false when the read hangs past the timeout', async () => { + jest.useFakeTimers(); + // Never resolves — simulates a hung/neutered WebView read. + getSparkBalance.mockReturnValue(new Promise(() => {})); + + const promise = getBalanceWithTimeout('mnemonic', 1000); + jest.advanceTimersByTime(1000); + + await expect(promise).resolves.toEqual({ didWork: false }); + }); + + it('resolves to didWork:false when the read rejects', async () => { + // getSparkBalance swallows its own errors today, but if a throw ever + // escapes the race the wrapper must still honor its {didWork} contract so + // callers (e.g. applyIncomingPaymentSnapshot) never dereference undefined. + getSparkBalance.mockRejectedValue(new Error('boom')); + await expect(getBalanceWithTimeout('mnemonic', 1000)).resolves.toEqual({ + didWork: false, + }); + }); +}); diff --git a/android/app/src/main/assets/sparkContext.html b/android/app/src/main/assets/sparkContext.html index 3b210b1b..5fbb89e0 100644 --- a/android/app/src/main/assets/sparkContext.html +++ b/android/app/src/main/assets/sparkContext.html @@ -1,5 +1,5 @@
- +>>0,t.setUint32(a,r,I),({s0:c,s1:D,s2:w,s3:d}=k(A,E[0],E[1],E[2],E[3]));const h=i*Math.floor(o.length/4);if(h16)throw new Error("aes/pcks5: wrong padding");const B=A.subarray(0,-C);for(let I=0;Ig(A,I),decrypt:(A,I)=>g(A,I)}}),I.ecb=(0,B.wrapCipher)({blockSize:16},function(A,I={}){const g=!I.disablePadding;return{encrypt(I,C){const{b:i,o:Q,out:e}=S(I,g,C),E=d(A);let t=0;for(;t+4<=i.length;){const{s0:A,s1:I,s2:g,s3:C}=k(E,i[t+0],i[t+1],i[t+2],i[t+3]);Q[t++]=A,Q[t++]=I,Q[t++]=g,Q[t++]=C}if(g){const A=F(I.subarray(4*t)),{s0:g,s1:C,s2:B,s3:i}=k(E,A[0],A[1],A[2],A[3]);Q[t++]=g,Q[t++]=C,Q[t++]=B,Q[t++]=i}return(0,B.clean)(E),e},decrypt(I,C){p(I);const i=h(A);C=(0,B.getOutput)(I.length,C);const Q=[i];(0,B.isAligned32)(I)||Q.push(I=(0,B.copyBytes)(I)),(0,B.complexOverlapBytes)(I,C);const e=(0,B.u32)(I),E=(0,B.u32)(C);for(let A=0;A+4<=e.length;){const{s0:I,s1:g,s2:C,s3:B}=u(i,e[A+0],e[A+1],e[A+2],e[A+3]);E[A++]=I,E[A++]=g,E[A++]=C,E[A++]=B}return(0,B.clean)(...Q),f(C,g)}}}),I.cbc=(0,B.wrapCipher)({blockSize:16,nonceLength:16},function(A,I,g={}){const C=!g.disablePadding;return{encrypt(g,i){const Q=d(A),{b:e,o:E,out:t}=S(g,C,i);let o=I;const n=[Q];(0,B.isAligned32)(o)||n.push(o=(0,B.copyBytes)(o));const a=(0,B.u32)(o);let s=a[0],r=a[1],c=a[2],D=a[3],w=0;for(;w+4<=e.length;)s^=e[w+0],r^=e[w+1],c^=e[w+2],D^=e[w+3],({s0:s,s1:r,s2:c,s3:D}=k(Q,s,r,c,D)),E[w++]=s,E[w++]=r,E[w++]=c,E[w++]=D;if(C){const A=F(g.subarray(4*w));s^=A[0],r^=A[1],c^=A[2],D^=A[3],({s0:s,s1:r,s2:c,s3:D}=k(Q,s,r,c,D)),E[w++]=s,E[w++]=r,E[w++]=c,E[w++]=D}return(0,B.clean)(...n),t},decrypt(g,i){p(g);const Q=h(A);let e=I;const E=[Q];(0,B.isAligned32)(e)||E.push(e=(0,B.copyBytes)(e));const t=(0,B.u32)(e);i=(0,B.getOutput)(g.length,i),(0,B.isAligned32)(g)||E.push(g=(0,B.copyBytes)(g)),(0,B.complexOverlapBytes)(g,i);const o=(0,B.u32)(g),n=(0,B.u32)(i);let a=t[0],s=t[1],r=t[2],c=t[3];for(let A=0;A+4<=o.length;){const I=a,g=s,C=r,B=c;a=o[A+0],s=o[A+1],r=o[A+2],c=o[A+3];const{s0:i,s1:e,s2:E,s3:t}=u(Q,a,s,r,c);n[A++]=i^I,n[A++]=e^g,n[A++]=E^C,n[A++]=t^B}return(0,B.clean)(...E),f(i,C)}}}),I.cfb=(0,B.wrapCipher)({blockSize:16,nonceLength:16},function(A,I){function g(g,C,Q){(0,B.abytes)(g);const e=g.length;if(Q=(0,B.getOutput)(e,Q),(0,B.overlapBytes)(g,Q))throw new Error("overlapping src and dst not supported.");const E=d(A);let t=I;const o=[E];(0,B.isAligned32)(t)||o.push(t=(0,B.copyBytes)(t)),(0,B.isAligned32)(g)||o.push(g=(0,B.copyBytes)(g));const n=(0,B.u32)(g),a=(0,B.u32)(Q),s=C?a:n,r=(0,B.u32)(t);let c=r[0],D=r[1],w=r[2],h=r[3];for(let A=0;A+4<=n.length;){const{s0:I,s1:g,s2:C,s3:B}=k(E,c,D,w,h);a[A+0]=n[A+0]^I,a[A+1]=n[A+1]^g,a[A+2]=n[A+2]^C,a[A+3]=n[A+3]^B,c=s[A++],D=s[A++],w=s[A++],h=s[A++]}const y=i*Math.floor(n.length/4);if(y g(A,!0,I),decrypt:(A,I)=>g(A,!1,I)}}),I.gcm=(0,B.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16,varSizeNonce:!0},function(A,I,g){if(I.length<8)throw new Error("aes/gcm: invalid nonce length");function i(A,I,B){const i=R(C.ghash,!1,A,B,g);for(let A=0;A C=>{if(!Number.isSafeInteger(C)||I>C||C>g)throw new Error(A+": expected value in range ["+I+".."+g+"], got "+C)};function M(A){return A instanceof Uint32Array||ArrayBuffer.isView(A)&&"Uint32Array"===A.constructor.name}function K(A,I){if((0,B.abytes)(I,16),!M(A))throw new Error("_encryptBlock accepts result of expandKeyLE");const g=(0,B.u32)(I);let{s0:C,s1:i,s2:Q,s3:e}=k(A,g[0],g[1],g[2],g[3]);return g[0]=C,g[1]=i,g[2]=Q,g[3]=e,I}function m(A,I){if((0,B.abytes)(I,16),!M(A))throw new Error("_decryptBlock accepts result of expandKeyLE");const g=(0,B.u32)(I);let{s0:C,s1:i,s2:Q,s3:e}=u(A,g[0],g[1],g[2],g[3]);return g[0]=C,g[1]=i,g[2]=Q,g[3]=e,I}I.gcmsiv=(0,B.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16,varSizeNonce:!0},function(A,I,g){const i=U("AAD",0,2**36),Q=U("plaintext",0,2**36),e=U("nonce",12,12),E=U("ciphertext",16,2**36+16);function t(){const g=d(A),C=new Uint8Array(A.length),i=new Uint8Array(16),Q=[g,C];let e=I;(0,B.isAligned32)(e)||Q.push(e=(0,B.copyBytes)(e));const E=(0,B.u32)(e);let t=0,o=E[0],n=E[1],a=E[2],s=0;for(const A of[i,C].map(B.u32)){const I=(0,B.u32)(A);for(let A=0;A =2**32)throw new Error("plaintext should be less than 4gb");const g=d(A);if(16===I.length)K(g,I);else{const A=(0,B.u32)(I);let C=A[0],i=A[1];for(let I=0,B=1;I<6;I++)for(let I=2;I =2**32)throw new Error("ciphertext should be less than 4gb");const g=h(A),C=I.length/8-1;if(1===C)m(g,I);else{const A=(0,B.u32)(I);let i=A[0],Q=A[1];for(let I=0,B=6*C;I<6;I++)for(let I=2*C;I>=1;I-=2,B--){Q^=s(B);const{s0:C,s1:e,s2:E,s3:t}=u(g,i,Q,A[I],A[I+1]);i=C,Q=e,A[I]=E,A[I+1]=t}A[0]=i,A[1]=Q}g.fill(0)}},b=new Uint8Array(8).fill(166);I.aeskw=(0,B.wrapCipher)({blockSize:8},A=>({encrypt(I){if(!I.length||I.length%8!=0)throw new Error("invalid plaintext length");if(8===I.length)throw new Error("8-byte keys not allowed in AESKW, use AESKWP instead");const g=(0,B.concatBytes)(b,I);return J.encrypt(A,g),g},decrypt(I){if(I.length%8!=0||I.length<24)throw new Error("invalid ciphertext length");const g=(0,B.copyBytes)(I);if(J.decrypt(A,g),!(0,B.equalBytes)(g.subarray(0,8),b))throw new Error("integrity check failed");return g.subarray(0,8).fill(0),g.subarray(8)}}));const H=2790873510;I.aeskwp=(0,B.wrapCipher)({blockSize:8},A=>({encrypt(I){if(!I.length)throw new Error("invalid plaintext length");const g=8*Math.ceil(I.length/8),C=new Uint8Array(8+g);C.set(I,8);const i=(0,B.u32)(C);return i[0]=H,i[1]=s(I.length),J.encrypt(A,C),C},decrypt(I){if(I.length<16)throw new Error("invalid ciphertext length");const g=(0,B.copyBytes)(I),C=(0,B.u32)(g);J.decrypt(A,g);const i=s(C[1])>>>0,Q=8*Math.ceil(i/8);if(C[0]!==H||g.length-8!==Q)throw new Error("integrity check failed");for(let A=i;A {"use strict";function g(A){return 0===A.length?A:A[0].toLowerCase()+A.slice(1)}Object.defineProperty(I,"__esModule",{value:!0}),I.fromGrpcWebServiceDefinition=function(A){const I={};for(const[C,B]of Object.entries(A)){if("serviceName"===C)continue;const i=B;I[g(C)]={path:`/${A.serviceName}/${C}`,requestStream:i.requestStream,responseStream:i.responseStream,requestDeserialize:i.requestType.deserializeBinary,requestSerialize:A=>A.serializeBinary(),responseDeserialize:i.responseType.deserializeBinary,responseSerialize:A=>A.serializeBinary(),options:{}}}return I},I.isGrpcWebServiceDefinition=function(A){return"prototype"in A}},1475:(A,I,g)=>{"use strict";g.r(I),g.d(I,{AbortError:()=>C,abortable:()=>t,all:()=>r,catchAbortError:()=>e,delay:()=>o,execute:()=>E,forever:()=>n,isAbortError:()=>B,proactiveRetry:()=>h,race:()=>c,rethrowAbortError:()=>Q,retry:()=>D,run:()=>d,spawn:()=>w,throwIfAborted:()=>i,waitForEvent:()=>a});class C extends Error{constructor(){super("The operation has been aborted"),this.message="The operation has been aborted",this.name="AbortError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}function B(A){return"object"==typeof A&&null!==A&&"AbortError"===A.name}function i(A){if(A.aborted)throw new C}function Q(A){if(B(A))throw A}function e(A){if(!B(A))throw A}function E(A,I){return new Promise((g,B)=>{if(A.aborted)return void B(new C);let i,Q=!1;function e(){Q||(Q=!0,null!=i&&i())}const E=I(A=>{g(A),e()},A=>{B(A),e()});if(!Q){const I=()=>{const A=E();null==A?B(new C):A.then(()=>{B(new C)},A=>{B(A)}),e()};A.addEventListener("abort",I),i=()=>{A.removeEventListener("abort",I)}}})}function t(A,I){if(A.aborted){const A=()=>{};I.then(A,A)}return E(A,(A,g)=>(I.then(A,g),()=>{}))}function o(A,I){return E(A,A=>{const g="number"==typeof I?I:I.getTime()-Date.now(),C=setTimeout(A,g);return()=>{clearTimeout(C)}})}function n(A){return E(A,()=>()=>{})}function a(A,I,g,C){return E(A,A=>{let B,i=!1;return B=function(A,I,g,C){if(s((B=A).addEventListener)&&s(B.removeEventListener))return A.addEventListener(I,g,C),()=>A.removeEventListener(I,g,C);var B;if(function(A){return s(A.on)&&s(A.off)}(A))return A.on(I,g),()=>A.off(I,g);if(function(A){return s(A.addListener)&&s(A.removeListener)}(A))return A.addListener(I,g),()=>A.removeListener(I,g);throw new Error("Invalid event target")}(I,g,(...I)=>{A(I.length>1?I:I[0]),i=!0,null!=B&&B()},C),i&&B(),()=>{i=!0,null!=B&&B()}})}const s=A=>"function"==typeof A;function r(A,I){return new Promise((g,i)=>{if(A.aborted)return void i(new C);const Q=new AbortController,e=I(Q.signal);if(0===e.length)return void g([]);const E=()=>{Q.abort()};let t;A.addEventListener("abort",E);const o=new Array(e.length);let n=0;function a(){n+=1,n===e.length&&(A.removeEventListener("abort",E),null!=t?i(t.reason):g(o))}for(const[A,I]of e.entries())I.then(I=>{o[A]=I,a()},A=>{Q.abort(),(null==t||!B(A)&&B(t.reason))&&(t={reason:A}),a()})})}function c(A,I){return new Promise((g,i)=>{if(A.aborted)return void i(new C);const Q=new AbortController,e=I(Q.signal),E=()=>{Q.abort()};A.addEventListener("abort",E);let t,o=0;function n(I){Q.abort(),o+=1,o===e.length&&(A.removeEventListener("abort",E),"fulfilled"===I.status?g(I.value):i(I.reason))}for(const A of e)A.then(A=>{null==t&&(t={status:"fulfilled",value:A}),n(t)},A=>{null!=t&&(B(A)||"fulfilled"!==t.status&&!B(t.reason))||(t={status:"rejected",reason:A}),n(t)})})}async function D(A,I,g={}){const{baseMs:C=1e3,maxDelayMs:B=3e4,onError:i,maxAttempts:e=1/0}=g;let E=0;const t=()=>{E=-1};for(;;)try{return await I(A,E,t)}catch(I){if(Q(I),E>=e)throw I;let g;if(-1===E)g=0;else{const A=Math.min(B,Math.pow(2,E)*C);g=Math.round(A*(1+Math.random())/2)}i&&i(I,E,g),0!==g&&await o(A,g),E+=1}}function w(A,I){if(A.aborted)return Promise.reject(new C);const g=[],i=new AbortController,Q=i.signal,E=()=>{i.abort()};A.addEventListener("abort",E);const t=new Set,o=()=>{for(const A of t)A.abort()};Q.addEventListener("abort",o);let n=new Promise((A,E)=>{let o,n;function a(I){if(Q.aborted)return{abort(){},async join(){throw new C}};const g=new AbortController,B=I(g.signal),a={abort(){g.abort()},join:()=>B};return t.add(a),B.catch(e).catch(A=>{n={error:A},i.abort()}).finally(()=>{t.delete(a),0===t.size&&(null!=n?E(n.error):A(o.value))}),a}a(A=>I(A,{defer(A){g.push(A)},fork:a})).join().then(A=>{i.abort(),o={value:A}},A=>{i.abort(),B(A)&&null!=n||(n={error:A})})});return n=n.finally(()=>{A.removeEventListener("abort",E),Q.removeEventListener("abort",o);let I=Promise.resolve();for(let A=g.length-1;A>=0;A--)I=I.finally(g[A]);return I}),n}function d(A){const I=new AbortController,g=A(I.signal).catch(e);return()=>(I.abort(),g)}function h(A,I,g={}){const{baseMs:C=1e3,onError:i,maxAttempts:Q=1/0}=g;return E(A,(A,g)=>{const E=new AbortController;let t=!1;const n=new Map;function a(I){E.abort(),n.clear(),A(I)}function s(A,I){if(n.delete(I),t&&0===n.size)g(A);else if(!B(A)&&i)try{i(A,I)}catch(A){E.abort(),n.clear(),g(A)}}return async function(A){for(let g=0;;g++){const B=I(A,g);if(n.set(g,B),B.then(a,A=>s(A,g)),g+1>=Q)break;const i=Math.pow(2,g)*C,e=Math.round(i*(1+Math.random())/2);await o(A,e)}t=!0}(E.signal).catch(e),()=>{E.abort()}})}},1510:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.NodeHttpTransport=function(){throw new Error("NodeHttpTransport is not supported in the browser")}},1546:(A,I,g)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.createClientStreamingMethod=function(A,I,g,Q){const e={path:A.path,requestStream:A.requestStream,responseStream:A.responseStream,options:A.options};async function*E(g,Q){if(!(0,B.isAsyncIterable)(g))throw Error("A middleware passed invalid request to next(): expected a single message for client streaming method");const e=(0,i.makeCall)(A,I,g,Q);let E;for await(const I of e){if(null!=E)throw new C.ClientError(A.path,C.Status.INTERNAL,"Received more than one message from server for client streaming method");E=I}if(null==E)throw new C.ClientError(A.path,C.Status.INTERNAL,"Server did not return a response");return E}const t=null==g?E:(A,I)=>g({method:e,requestStream:!0,request:A,responseStream:!1,next:E},I);return async(A,I)=>{const g=t(A,{...Q,...I})[Symbol.asyncIterator]();let C=await g.next();for(;;)if(C.done){if(null!=C.value)return C.value;C=await g.throw(new Error("A middleware returned void, but expected to return a message for client streaming method"))}else C=await g.throw(new Error("A middleware yielded a message, but expected to only return a message for client streaming method"))}};const C=g(91),B=g(7768),i=g(2810)},1746:(A,I)=>{"use strict";function g(A){if(!Number.isSafeInteger(A))throw new Error(`Wrong integer: ${A}`)}function C(...A){const I=(A,I)=>g=>A(I(g));return{encode:Array.from(A).reverse().reduce((A,g)=>A?I(A,g.encode):g.encode,void 0),decode:A.reduce((A,g)=>A?I(A,g.decode):g.decode,void 0)}}function B(A){return{encode:I=>{if(!Array.isArray(I)||I.length&&"number"!=typeof I[0])throw new Error("alphabet.encode input should be an array of numbers");return I.map(I=>{if(g(I),I<0||I>=A.length)throw new Error(`Digit index outside alphabet: ${I} (alphabet: ${A.length})`);return A[I]})},decode:I=>{if(!Array.isArray(I)||I.length&&"string"!=typeof I[0])throw new Error("alphabet.decode input should be array of strings");return I.map(I=>{if("string"!=typeof I)throw new Error(`alphabet.decode: not string element=${I}`);const g=A.indexOf(I);if(-1===g)throw new Error(`Unknown letter: "${I}". Allowed: ${A}`);return g})}}}function i(A=""){if("string"!=typeof A)throw new Error("join separator should be string");return{encode:I=>{if(!Array.isArray(I)||I.length&&"string"!=typeof I[0])throw new Error("join.encode input should be array of strings");for(let A of I)if("string"!=typeof A)throw new Error(`join.encode: non-string input=${A}`);return I.join(A)},decode:I=>{if("string"!=typeof I)throw new Error("join.decode input should be string");return I.split(A)}}}function Q(A,I="="){if(g(A),"string"!=typeof I)throw new Error("padding chr should be string");return{encode(g){if(!Array.isArray(g)||g.length&&"string"!=typeof g[0])throw new Error("padding.encode input should be array of strings");for(let A of g)if("string"!=typeof A)throw new Error(`padding.encode: non-string input=${A}`);for(;g.length*A%8;)g.push(I);return g},decode(g){if(!Array.isArray(g)||g.length&&"string"!=typeof g[0])throw new Error("padding.encode input should be array of strings");for(let A of g)if("string"!=typeof A)throw new Error(`padding.decode: non-string input=${A}`);let C=g.length;if(C*A%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;C>0&&g[C-1]===I;C--)if(!((C-1)*A%8))throw new Error("Invalid padding: string has too much padding");return g.slice(0,C)}}}function e(A){if("function"!=typeof A)throw new Error("normalize fn should be function");return{encode:A=>A,decode:I=>A(I)}}function E(A,I,C){if(I<2)throw new Error(`convertRadix: wrong from=${I}, base cannot be less than 2`);if(C<2)throw new Error(`convertRadix: wrong to=${C}, base cannot be less than 2`);if(!Array.isArray(A))throw new Error("convertRadix: data should be array");if(!A.length)return[];let B=0;const i=[],Q=Array.from(A);for(Q.forEach(A=>{if(g(A),A<0||A>=I)throw new Error(`Wrong integer: ${A}`)});;){let A=0,g=!0;for(let i=B;iI?t(I,A%I):A,o=(A,I)=>A+(I-t(A,I));function n(A,I,C,B){if(!Array.isArray(A))throw new Error("convertRadix2: data should be array");if(I<=0||I>32)throw new Error(`convertRadix2: wrong from=${I}`);if(C<=0||C>32)throw new Error(`convertRadix2: wrong to=${C}`);if(o(I,C)>32)throw new Error(`convertRadix2: carry overflow from=${I} to=${C} carryBits=${o(I,C)}`);let i=0,Q=0;const e=2**C-1,E=[];for(const B of A){if(g(B),B>=2**I)throw new Error(`convertRadix2: invalid data word=${B} from=${I}`);if(i=i<32)throw new Error(`convertRadix2: carry overflow pos=${Q} from=${I}`);for(Q+=I;Q>=C;Q-=C)E.push((i>>Q-C&e)>>>0);i&=2**Q-1}if(i=i< =I)throw new Error("Excess padding");if(!B&&i)throw new Error(`Non-zero padding: ${i}`);return B&&Q>0&&E.push(i>>>0),E}function a(A){return g(A),{encode:I=>{if(!(I instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return E(Array.from(I),256,A)},decode:I=>{if(!Array.isArray(I)||I.length&&"number"!=typeof I[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(E(I,A,256))}}}function s(A,I=!1){if(g(A),A<=0||A>32)throw new Error("radix2: bits should be in (0..32]");if(o(8,A)>32||o(A,8)>32)throw new Error("radix2: carry overflow");return{encode:g=>{if(!(g instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return n(Array.from(g),8,A,!I)},decode:g=>{if(!Array.isArray(g)||g.length&&"number"!=typeof g[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(n(g,A,8,I))}}}function r(A){if("function"!=typeof A)throw new Error("unsafeWrapper fn should be function");return function(...I){try{return A.apply(null,I)}catch(A){}}}function c(A,I){if(g(A),"function"!=typeof I)throw new Error("checksum fn should be function");return{encode(g){if(!(g instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");const C=I(g).slice(0,A),B=new Uint8Array(g.length+A);return B.set(g),B.set(C,g.length),B},decode(g){if(!(g instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");const C=g.slice(0,-A),B=I(C).slice(0,A),i=g.slice(-A);for(let I=0;IA.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),I.base64=C(s(6),B("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Q(6),i("")),I.base64url=C(s(6),B("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Q(6),i(""));const D=A=>C(a(58),B(A),i(""));I.base58=D("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),I.base58flickr=D("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),I.base58xrp=D("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const w=[0,2,3,5,6,7,9,10,11];I.base58xmr={encode(A){let g="";for(let C=0;C C(c(4,I=>A(A(I))),I.base58);const d=C(B("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),i("")),h=[996825010,642813549,513874426,1027748829,705979059];function y(A){const I=A>>25;let g=(33554431&A)<<5;for(let A=0;A >A&1)&&(g^=h[A]);return g}function l(A,I,g=1){const C=A.length;let B=1;for(let I=0;I 126)throw new Error(`Invalid prefix (${A})`);B=y(B)^g>>5}B=y(B);for(let I=0;I g)throw new TypeError(`Wrong string length: ${A.length} (${A}). Expected (8..${g})`);const C=A.toLowerCase();if(A!==C&&A!==A.toUpperCase())throw new Error("String must be lowercase or uppercase");const B=(A=C).lastIndexOf("1");if(0===B||-1===B)throw new Error('Letter "1" must be present between prefix and data only');const i=A.slice(0,B),Q=A.slice(B+1);if(Q.length<6)throw new Error("Data must be at least 6 characters long");const e=d.decode(Q).slice(0,-6),E=l(i,e,I);if(!Q.endsWith(E))throw new Error(`Invalid checksum in ${A}: expected "${E}"`);return{prefix:i,words:e}}return{encode:function(A,g,C=90){if("string"!=typeof A)throw new Error("bech32.encode prefix should be string, not "+typeof A);if(!Array.isArray(g)||g.length&&"number"!=typeof g[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof g);const B=A.length+7+g.length;if(!1!==C&&B>C)throw new TypeError(`Length ${B} exceeds limit ${C}`);return`${A=A.toLowerCase()}1${d.encode(g)}${l(A,g,I)}`},decode:Q,decodeToBytes:function(A){const{prefix:I,words:g}=Q(A,!1);return{prefix:I,words:g,bytes:C(g)}},decodeUnsafe:r(Q),fromWords:C,fromWordsUnsafe:i,toWords:B}}I.bech32=k("bech32"),I.bech32m=k("bech32m"),I.utf8={encode:A=>(new TextDecoder).decode(A),decode:A=>(new TextEncoder).encode(A)},I.hex=C(s(4),B("0123456789abcdef"),i(""),e(A=>{if("string"!=typeof A||A.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof A} with length ${A.length}`);return A.toLowerCase()}));const u={utf8:I.utf8,hex:I.hex,base16:I.base16,base32:I.base32,base64:I.base64,base64url:I.base64url,base58:I.base58,base58xmr:I.base58xmr},N=`Invalid encoding type. Available types: ${Object.keys(u).join(", ")}`;I.bytesToString=(A,I)=>{if("string"!=typeof A||!u.hasOwnProperty(A))throw new TypeError(N);if(!(I instanceof Uint8Array))throw new TypeError("bytesToString() expects Uint8Array");return u[A].encode(I)},I.str=I.bytesToString,I.stringToBytes=(A,I)=>{if(!u.hasOwnProperty(A))throw new TypeError(N);if("string"!=typeof I)throw new TypeError("stringToBytes() expects string");return u[A].decode(I)},I.bytes=I.stringToBytes},1891:(A,I,g)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.decodeMetadata=function(A){const I=(0,C.Metadata)(),g=(new TextDecoder).decode(A);for(const A of g.split("\r\n")){if(!A)continue;const g=A.indexOf(":");if(-1===g)throw new Error(`Invalid metadata line: ${A}`);const C=A.slice(0,g).trim().toLowerCase(),i=A.slice(g+1).trim();if(C.endsWith("-bin"))for(const A of i.split(/,\s?/))I.append(C,B.Base64.toUint8Array(A));else I.append(C,i)}return I};const C=g(91),B=g(8127)},1953:(A,I,g)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.createBidiStreamingMethod=function(A,I,g,i){const Q={path:A.path,requestStream:A.requestStream,responseStream:A.responseStream,options:A.options};async function*e(g,i){if(!(0,C.isAsyncIterable)(g))throw new Error("A middleware passed invalid request to next(): expected a single message for bidirectional streaming method");const Q=(0,B.makeCall)(A,I,g,i);yield*Q}const E=null==g?e:(A,I)=>g({method:Q,requestStream:!0,request:A,responseStream:!0,next:e},I);return(A,I)=>{const g=E(A,{...i,...I})[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({async next(){const A=await g.next();return A.done&&null!=A.value?await g.throw(new Error("A middleware returned a message, but expected to return void for bidirectional streaming method")):A},return:()=>g.return(),throw:A=>g.throw(A)})}}};const C=g(7768),B=g(2810)},1999:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0})},2018:function(A,I,g){"use strict";var C=this&&this.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(I,"__esModule",{value:!0}),I.WebsocketTransport=function(){return async function*({url:A,body:I,metadata:g,signal:C}){if(C.aborted)throw new B.AbortError;const t=new e.AsyncSink;C.addEventListener("abort",()=>{t.error(new B.AbortError)});const o=new URL(A);o.protocol=o.protocol.replace("http","ws");const n=new i.default(o,["grpc-websockets"]);n.binaryType="arraybuffer",n.addEventListener("message",A=>{A.data instanceof ArrayBuffer?t.write({type:"data",data:new Uint8Array(A.data)}):t.error(new Error("Unexpected message type: "+typeof A.data))}),n.addEventListener("close",A=>{A.wasClean?t.end():t.error(new Error(`WebSocket closed with code ${A.code}`+(A.reason&&`: ${A.reason}`)))});const a=new AbortController;(async function(A,I,g,C){C.readyState==i.default.CONNECTING&&await(0,B.waitForEvent)(A,C,"open"),C.send(function(A){let I="";for(const[g,C]of A)for(const A of C){const C=`${g}: ${"string"==typeof A?A:Q.Base64.fromUint8Array(A)}\r\n`;for(let A=0;A {(0,B.isAbortError)(A)||t.error(A)});try{return yield*t}finally{a.abort(),n.close()}}};const B=g(1475),i=C(g(169)),Q=g(8127),e=g(2505);function E(A){return 9===A||10===A||13===A||A>=32&&A<=126}},2260:function(A,I,g){"use strict";var C=this&&this.__createBinding||(Object.create?function(A,I,g,C){void 0===C&&(C=g);var B=Object.getOwnPropertyDescriptor(I,g);B&&!("get"in B?!I.__esModule:B.writable||B.configurable)||(B={enumerable:!0,get:function(){return I[g]}}),Object.defineProperty(A,C,B)}:function(A,I,g,C){void 0===C&&(C=g),A[C]=I[g]}),B=this&&this.__exportStar||function(A,I){for(var g in A)"default"===g||Object.prototype.hasOwnProperty.call(I,g)||C(I,A,g)};Object.defineProperty(I,"__esModule",{value:!0}),I.NodeHttpTransport=I.WebsocketTransport=I.FetchTransport=I.Status=I.Metadata=I.composeClientMiddleware=I.ClientError=void 0;var i=g(91);Object.defineProperty(I,"ClientError",{enumerable:!0,get:function(){return i.ClientError}}),Object.defineProperty(I,"composeClientMiddleware",{enumerable:!0,get:function(){return i.composeClientMiddleware}}),Object.defineProperty(I,"Metadata",{enumerable:!0,get:function(){return i.Metadata}}),Object.defineProperty(I,"Status",{enumerable:!0,get:function(){return i.Status}}),B(g(7671),I),B(g(3297),I),B(g(2969),I),B(g(1999),I);var Q=g(7005);Object.defineProperty(I,"FetchTransport",{enumerable:!0,get:function(){return Q.FetchTransport}});var e=g(2018);Object.defineProperty(I,"WebsocketTransport",{enumerable:!0,get:function(){return e.WebsocketTransport}});var E=g(1510);Object.defineProperty(I,"NodeHttpTransport",{enumerable:!0,get:function(){return E.NodeHttpTransport}})},2343:(A,I)=>{"use strict";I.p2=void 0;const g="qpzry9x8gf2tvdw0s3jn54khce6mua7l",C={};for(let A=0;A<32;A++){const I=g.charAt(A);C[I]=A}function B(A){const I=A>>25;return(33554431&A)<<5^996825010&-(1&I)^642813549&-(I>>1&1)^513874426&-(I>>2&1)^1027748829&-(I>>3&1)^705979059&-(I>>4&1)}function i(A){let I=1;for(let g=0;g 126)return"Invalid prefix ("+A+")";I=B(I)^C>>5}I=B(I);for(let g=0;g =g;)i-=g,e.push(B>>i&Q);if(C)i>0&&e.push(B< =I)return"Excess padding";if(B< g)return"Exceeds length limit";const Q=A.toLowerCase(),e=A.toUpperCase();if(A!==Q&&A!==e)return"Mixed-case string "+A;const E=(A=Q).lastIndexOf("1");if(-1===E)return"No separator character for "+A;if(0===E)return"Missing prefix for "+A;const t=A.slice(0,E),o=A.slice(E+1);if(o.length<6)return"Data too short";let n=i(t);if("string"==typeof n)return n;const a=[];for(let A=0;A =o.length||a.push(g)}return n!==I?"Invalid checksum for "+A:{prefix:t,words:a}}return I="bech32"===A?1:734539939,{decodeUnsafe:function(A,I){const g=Q(A,I);if("object"==typeof g)return g},decode:function(A,I){const g=Q(A,I);if("object"==typeof g)return g;throw new Error(g)},encode:function(A,C,Q){if(Q=Q||90,A.length+7+C.length>Q)throw new TypeError("Exceeds length limit");let e=i(A=A.toLowerCase());if("string"==typeof e)throw new Error(e);let E=A+"1";for(let A=0;A >5)throw new Error("Non 5-bit word");e=B(e)^I,E+=g.charAt(I)}for(let A=0;A<6;++A)e=B(e);e^=I;for(let A=0;A<6;++A)E+=g.charAt(e>>5*(5-A)&31);return E},toWords:e,fromWordsUnsafe:E,fromWords:t}}o("bech32"),I.p2=o("bech32m")},2421:(A,I)=>{"use strict";var g;Object.defineProperty(I,"__esModule",{value:!0}),I.Status=void 0,(g=I.Status||(I.Status={}))[g.OK=0]="OK",g[g.CANCELLED=1]="CANCELLED",g[g.UNKNOWN=2]="UNKNOWN",g[g.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",g[g.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",g[g.NOT_FOUND=5]="NOT_FOUND",g[g.ALREADY_EXISTS=6]="ALREADY_EXISTS",g[g.PERMISSION_DENIED=7]="PERMISSION_DENIED",g[g.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",g[g.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",g[g.ABORTED=10]="ABORTED",g[g.OUT_OF_RANGE=11]="OUT_OF_RANGE",g[g.UNIMPLEMENTED=12]="UNIMPLEMENTED",g[g.INTERNAL=13]="INTERNAL",g[g.UNAVAILABLE=14]="UNAVAILABLE",g[g.DATA_LOSS=15]="DATA_LOSS",g[g.UNAUTHENTICATED=16]="UNAUTHENTICATED"},2505:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.AsyncSink=void 0;const g="error";class C{constructor(){this._ended=!1,this._values=[],this._resolvers=[]}[Symbol.asyncIterator](){return this}write(A){this._push({type:"value",value:A})}error(A){this._push({type:g,error:A})}_push(A){if(!this._ended)if(this._resolvers.length>0){const{resolve:I,reject:C}=this._resolvers.shift();A.type===g?C(A.error):I({done:!1,value:A.value})}else this._values.push(A)}next(){if(this._values.length>0){const{type:A,value:I,error:C}=this._values.shift();return A===g?Promise.reject(C):Promise.resolve({done:!1,value:I})}return this._ended?Promise.resolve({done:!0}):new Promise((A,I)=>{this._resolvers.push({resolve:A,reject:I})})}end(){for(;this._resolvers.length>0;)this._resolvers.shift().resolve({done:!0});this._ended=!0}}I.AsyncSink=C},2721:(A,I,g)=>{"use strict";I.__esModule=void 0,I.__esModule=!0;var C=g(7522),B=C.setPrototypeOf,i=C.getPrototypeOf,Q=C.defineProperty,e=C.objectCreate,E="[object Error]"===(new Error).toString(),t="";function o(A){var I,g=this.constructor,C=g.name||(null===(I=g.toString().match(/^function\s*([^\s(]+)/))?t||"Error":I[1]),e="Error"===C,n=e?t:C,a=Error.apply(this,arguments);if(B(a,i(this)),a instanceof g&&a instanceof o||(a=this,Error.apply(this,arguments),Q(a,"message",{configurable:!0,enumerable:!1,value:A,writable:!0})),Q(a,"name",{configurable:!0,enumerable:!1,value:n,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(a,e?o:g),void 0===a.stack){var s=new Error(A);s.name=a.name,a.stack=s.stack}return E&&Q(a,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(void 0===this.message?"":": "+this.message)},writable:!0}),a}t=o.name||"ExtendableError",o.prototype=e(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),I.ExtendableError=o,I.default=I.ExtendableError},2774:(A,I)=>{"use strict";function g(A){return A.toLowerCase()}function C(A,I){if(!/^[0-9a-z_.-]+$/.test(A))throw new Error(`Metadata key '${A}' contains illegal characters`);if(A.endsWith("-bin")){if(!(I instanceof Uint8Array))throw new Error(`Metadata key '${A}' ends with '-bin', thus it must have binary value`)}else{if("string"!=typeof I)throw new Error(`Metadata key '${A}' doesn't end with '-bin', thus it must have string value`);if(!/^[ -~]*$/.test(I))throw new Error(`Metadata value '${I}' of key '${A}' contains illegal characters`)}}Object.defineProperty(I,"__esModule",{value:!0}),I.Metadata=void 0,I.Metadata=function(A){const I=new Map,B={set(A,i){if(A=g(A),Array.isArray(i))if(0===i.length)I.delete(A);else{for(const I of i)C(A,I);I.set(A,A.endsWith("-bin")?i:[i.join(", ")])}else C(A,i),I.set(A,[i]);return B},append(A,i){C(A=g(A),i);let Q=I.get(A);return null==Q&&(Q=[],I.set(A,Q)),Q.push(i),A.endsWith("-bin")||I.set(A,[Q.join(", ")]),B},delete(A){A=g(A),I.delete(A)},get(A){var C;return A=g(A),null===(C=I.get(A))||void 0===C?void 0:C[0]},getAll(A){var C;return A=g(A),null!==(C=I.get(A))&&void 0!==C?C:[]},has:A=>(A=g(A),I.has(A)),[Symbol.iterator]:()=>I[Symbol.iterator]()};if(null!=A){const I=(i=A,Symbol.iterator in i?A:Object.entries(A));for(const[A,g]of I)B.set(A,g)}var i;return B}},2810:(A,I,g)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.makeCall=async function*(A,I,g,t){const{metadata:o,signal:n=(new AbortController).signal,onHeader:a,onTrailer:s}=t;(0,C.throwIfAborted)(n);let r,c,D=!1;function w(I){if(D){if(new Map(I).size>0)throw new B.ClientError(A.path,B.Status.INTERNAL,"Received non-empty trailer after trailers-only response");return}const g=(0,E.parseTrailer)(I);({status:r,message:c}=g),null==s||s(g.trailer)}const d=(0,B.Metadata)(o);d.set("content-type","application/grpc-web+proto"),d.set("x-grpc-web","1");const h=new AbortController,y=()=>{h.abort()};n.addEventListener("abort",y);let l,k=!1;async function*u(){try{for await(const A of g){if(k)throw new Error("Request finished");yield A}}catch(A){throw l={err:A},h.abort(),A}}const N=(0,i.decodeResponse)({response:async function*(){try{return yield*I.transport({url:I.address+A.path,metadata:d,body:(0,Q.encodeRequest)({request:u(),encode:A.requestSerialize}),signal:h.signal,method:A})}catch(I){throw(0,C.rethrowAbortError)(I),new B.ClientError(A.path,B.Status.UNKNOWN,`Transport error: ${(0,e.makeInternalErrorMessage)(I)}`)}}(),decode:A.responseDeserialize,onHeader(A){A.has("grpc-status")?(w(A),D=!0):null==a||a(A)},onTrailer(A){w(A)}});try{yield*N}catch(I){throw void 0!==l?l.err:I instanceof B.ClientError||(0,C.isAbortError)(I)?I:new B.ClientError(A.path,B.Status.INTERNAL,(0,e.makeInternalErrorMessage)(I))}finally{if(k=!0,n.removeEventListener("abort",y),null!=r&&r!==B.Status.OK)throw new B.ClientError(A.path,r,null!=c?c:"")}if(null==r)throw new B.ClientError(A.path,B.Status.UNKNOWN,'Response stream closed without gRPC status. This may indicate a misconfigured CORS policy on the server: Access-Control-Expose-Headers must include "grpc-status" and "grpc-message".')};const C=g(1475),B=g(91),i=g(2941),Q=g(7621),e=g(8198),E=g(4762)},2941:(A,I,g)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.decodeResponse=async function*({response:A,decode:I,onHeader:g,onTrailer:Q}){let e,E=!1,t=!1,o=!1,n=r(i.LPM_HEADER_LENGTH);for await(const g of A)if("header"===g.type)a(g.header);else if("trailer"===g.type)s(g.trailer);else if("data"===g.type){if(t)throw new Error("Received data after trailer");let{data:A}=g;for(;A.length>0||0===(null==e?void 0:e.length);){const g=Math.min(A.length,n.targetLength-n.totalLength),Q=A.subarray(0,g);if(A=A.subarray(g),n.chunks.push(Q),n.totalLength+=Q.length,n.totalLength===n.targetLength){const A=(0,C.concatBuffers)(n.chunks,n.totalLength);if(null==e)e=(0,i.parseLpmHeader)(A),n=r(e.length);else{if(e.compressed)throw new Error("Compressed messages not supported");if(e.isMetadata)E?s((0,B.decodeMetadata)(A)):a((0,B.decodeMetadata)(A));else{if(!E)throw new Error("Received data before header");yield I(A),o=!0}e=void 0,n=r(i.LPM_HEADER_LENGTH)}}}}function a(A){if(E)throw new Error("Received multiple headers");if(o)throw new Error("Received header after data");if(t)throw new Error("Received header after trailer");E=!0,g(A)}function s(A){if(t)throw new Error("Received multiple trailers");t=!0,Q(A)}function r(A){return{chunks:[],totalLength:0,targetLength:A}}};const C=g(4101),B=g(1891),i=g(3564)},2969:(A,I,g)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.createClientFactory=t,I.createClient=function(A,I,g){return t().create(A,I,g)};const C=g(91),B=g(7671),i=g(1953),Q=g(1546),e=g(4230),E=g(8632);function t(){return o()}function o(A){return{use:I=>o(null==A?I:(0,C.composeClientMiddleware)(A,I)),create(I,g,C={}){const t={},o=Object.entries((0,B.normalizeServiceDefinition)(I));for(const[I,B]of o){const o={...C["*"],...C[I]};B.requestStream?B.responseStream?t[I]=(0,i.createBidiStreamingMethod)(B,g,A,o):t[I]=(0,Q.createClientStreamingMethod)(B,g,A,o):B.responseStream?t[I]=(0,e.createServerStreamingMethod)(B,g,A,o):t[I]=(0,E.createUnaryMethod)(B,g,A,o)}return t}}}},3297:(A,I,g)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.createChannel=function(A,I=(0,C.FetchTransport)()){return{address:A,transport:I}};const C=g(7005)},3564:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.LPM_HEADER_LENGTH=void 0,I.parseLpmHeader=function(A){if(A.length!==I.LPM_HEADER_LENGTH)throw new Error(`Invalid LPM header length: ${A.length}`);const g=new DataView(A.buffer,A.byteOffset,A.byteLength);return{compressed:!!(1&g.getUint8(0)),isMetadata:!!(128&g.getUint8(0)),length:g.getUint32(1)}},I.encodeFrame=function(A){const g=new Uint8Array(I.LPM_HEADER_LENGTH+A.length);return new DataView(g.buffer,1,4).setUint32(0,A.length,!1),g.set(A,I.LPM_HEADER_LENGTH),g},I.LPM_HEADER_LENGTH=5},3652:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0})},3826:function(A){A.exports=function(){"use strict";var A="minute",I=/[+-]\d\d(?::?\d\d)?/g,g=/([+-]|\d\d)/g;return function(C,B,i){var Q=B.prototype;i.utc=function(A){return new B({date:A,utc:!0,args:arguments})},Q.utc=function(I){var g=i(this.toDate(),{locale:this.$L,utc:!0});return I?g.add(this.utcOffset(),A):g},Q.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var e=Q.parse;Q.parse=function(A){A.utc&&(this.$u=!0),this.$utils().u(A.$offset)||(this.$offset=A.$offset),e.call(this,A)};var E=Q.init;Q.init=function(){if(this.$u){var A=this.$d;this.$y=A.getUTCFullYear(),this.$M=A.getUTCMonth(),this.$D=A.getUTCDate(),this.$W=A.getUTCDay(),this.$H=A.getUTCHours(),this.$m=A.getUTCMinutes(),this.$s=A.getUTCSeconds(),this.$ms=A.getUTCMilliseconds()}else E.call(this)};var t=Q.utcOffset;Q.utcOffset=function(C,B){var i=this.$utils().u;if(i(C))return this.$u?0:i(this.$offset)?t.call(this):this.$offset;if("string"==typeof C&&(C=function(A){void 0===A&&(A="");var C=A.match(I);if(!C)return null;var B=(""+C[0]).match(g)||["-",0,0],i=B[0],Q=60*+B[1]+ +B[2];return 0===Q?0:"+"===i?Q:-Q}(C),null===C))return this;var Q=Math.abs(C)<=16?60*C:C;if(0===Q)return this.utc(B);var e=this.clone();if(B)return e.$offset=Q,e.$u=!1,e;var E=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(e=this.local().add(Q+E,A)).$offset=Q,e.$x.$localOffset=E,e};var o=Q.format;Q.format=function(A){var I=A||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return o.call(this,I)},Q.valueOf=function(){var A=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*A},Q.isUTC=function(){return!!this.$u},Q.toISOString=function(){return this.toDate().toISOString()},Q.toString=function(){return this.toDate().toUTCString()};var n=Q.toDate;Q.toDate=function(A){return"s"===A&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():n.call(this)};var a=Q.diff;Q.diff=function(A,I,g){if(A&&this.$u===A.$u)return a.call(this,A,I,g);var C=this.local(),B=i(A).local();return a.call(C,B,I,g)}}}()},4092:(A,I,g)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.ServerError=void 0;const C=g(2721),B=g(2421);class i extends C.ExtendableError{constructor(A,I){super(`${B.Status[A]}: ${I}`),this.code=A,this.details=I,this.name="ServerError",Object.defineProperty(this,"@@nice-grpc",{value:!0}),Object.defineProperty(this,"@@nice-grpc:ServerError",{value:!0})}static[Symbol.hasInstance](A){return this!==i?this.prototype.isPrototypeOf(A):"object"==typeof A&&null!==A&&(A.constructor===i||!0===A["@@nice-grpc:ServerError"]||"ServerError"===A.name&&!0===A["@@nice-grpc"])}}I.ServerError=i},4101:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.concatBuffers=function(A,I){if(1===A.length)return A[0];const g=new Uint8Array(I);let C=0;for(const I of A)g.set(I,C),C+=I.length;return g}},4230:(A,I,g)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.createServerStreamingMethod=function(A,I,g,Q){const e={path:A.path,requestStream:A.requestStream,responseStream:A.responseStream,options:A.options};async function*E(g,Q){if((0,B.isAsyncIterable)(g))throw new Error("A middleware passed invalid request to next(): expected a single message for server streaming method");const e=(0,i.makeCall)(A,I,(0,C.asyncIterableOf)(g),Q);yield*e}const t=null==g?E:(A,I)=>g({method:e,requestStream:!1,request:A,responseStream:!0,next:E},I);return(A,I)=>{const g=t(A,{...Q,...I})[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({async next(){const A=await g.next();return A.done&&null!=A.value?await g.throw(new Error("A middleware returned a message, but expected to return void for server streaming method")):A},return:()=>g.return(),throw:A=>g.throw(A)})}}};const C=g(213),B=g(7768),i=g(2810)},4236:(A,I,g)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.ClientError=void 0;const C=g(2721),B=g(2421);class i extends C.ExtendableError{constructor(A,I,g){super(`${A} ${B.Status[I]}: ${g}`),this.path=A,this.code=I,this.details=g,this.name="ClientError",Object.defineProperty(this,"@@nice-grpc",{value:!0}),Object.defineProperty(this,"@@nice-grpc:ClientError",{value:!0})}static[Symbol.hasInstance](A){return this!==i?this.prototype.isPrototypeOf(A):"object"==typeof A&&null!==A&&(A.constructor===i||!0===A["@@nice-grpc:ClientError"]||"ClientError"===A.name&&!0===A["@@nice-grpc"])}}I.ClientError=i},4353:function(A){A.exports=function(){"use strict";var A=6e4,I=36e5,g="millisecond",C="second",B="minute",i="hour",Q="day",e="week",E="month",t="quarter",o="year",n="date",a="Invalid Date",s=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,r=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,c={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(A){var I=["th","st","nd","rd"],g=A%100;return"["+A+(I[(g-20)%10]||I[g]||I[0])+"]"}},D=function(A,I,g){var C=String(A);return!C||C.length>=I?A:""+Array(I+1-C.length).join(g)+A},w={s:D,z:function(A){var I=-A.utcOffset(),g=Math.abs(I),C=Math.floor(g/60),B=g%60;return(I<=0?"+":"-")+D(C,2,"0")+":"+D(B,2,"0")},m:function A(I,g){if(I.date() 1)return A(Q[0])}else{var e=I.name;h[e]=I,B=e}return!C&&B&&(d=B),B||!C&&d},u=function(A,I){if(l(A))return A.clone();var g="object"==typeof I?I:{};return g.date=A,g.args=arguments,new G(g)},N=w;N.l=k,N.i=l,N.w=function(A,I){return u(A,{locale:I.$L,utc:I.$u,x:I.$x,$offset:I.$offset})};var G=function(){function c(A){this.$L=k(A.locale,null,!0),this.parse(A),this.$x=this.$x||A.x||{},this[y]=!0}var D=c.prototype;return D.parse=function(A){this.$d=function(A){var I=A.date,g=A.utc;if(null===I)return new Date(NaN);if(N.u(I))return new Date;if(I instanceof Date)return new Date(I);if("string"==typeof I&&!/Z$/i.test(I)){var C=I.match(s);if(C){var B=C[2]-1||0,i=(C[7]||"0").substring(0,3);return g?new Date(Date.UTC(C[1],B,C[3]||1,C[4]||0,C[5]||0,C[6]||0,i)):new Date(C[1],B,C[3]||1,C[4]||0,C[5]||0,C[6]||0,i)}}return new Date(I)}(A),this.init()},D.init=function(){var A=this.$d;this.$y=A.getFullYear(),this.$M=A.getMonth(),this.$D=A.getDate(),this.$W=A.getDay(),this.$H=A.getHours(),this.$m=A.getMinutes(),this.$s=A.getSeconds(),this.$ms=A.getMilliseconds()},D.$utils=function(){return N},D.isValid=function(){return!(this.$d.toString()===a)},D.isSame=function(A,I){var g=u(A);return this.startOf(I)<=g&&g<=this.endOf(I)},D.isAfter=function(A,I){return u(A) {"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.parseTrailer=function(A){let I;const g=A.get("grpc-status");if(null==g)throw new Error("Received no status code from server");{const A=+g;if(!(A in C.Status))throw new Error(`Received invalid status code from server: ${g}`);I=A}let B=A.get("grpc-message");if(null!=B)try{B=decodeURIComponent(B)}catch(A){}const i=(0,C.Metadata)(A);return i.delete("grpc-status"),i.delete("grpc-message"),{status:I,message:B,trailer:i}};const C=g(91)},5653:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.fromTsProtoServiceDefinition=function(A){const I={};for(const[g,C]of Object.entries(A.methods)){const B=C.requestType.encode,i=C.requestType.fromPartial,Q=C.responseType.encode,e=C.responseType.fromPartial;I[g]={path:`/${A.fullName}/${C.name}`,requestStream:C.requestStream,responseStream:C.responseStream,requestDeserialize:C.requestType.decode,requestSerialize:null!=i?A=>B(i(A)).finish():A=>B(A).finish(),responseDeserialize:C.responseType.decode,responseSerialize:null!=e?A=>Q(e(A)).finish():A=>Q(A).finish(),options:C.options}}return I},I.isTsProtoServiceDefinition=function(A){return"name"in A&&"fullName"in A&&"methods"in A}},5972:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0})},6524:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0})},6527:(A,I)=>{"use strict";function g(A){return A instanceof Uint8Array||ArrayBuffer.isView(A)&&"Uint8Array"===A.constructor.name}function C(A){if("boolean"!=typeof A)throw new Error(`boolean expected, not ${A}`)}function B(A){if(!Number.isSafeInteger(A)||A<0)throw new Error("positive integer expected, got "+A)}function i(A,...I){if(!g(A))throw new Error("Uint8Array expected");if(I.length>0&&!I.includes(A.length))throw new Error("Uint8Array expected of length "+I+", got length="+A.length)}function Q(A){return new DataView(A.buffer,A.byteOffset,A.byteLength)}Object.defineProperty(I,"__esModule",{value:!0}),I.wrapCipher=I.Hash=I.nextTick=I.isLE=void 0,I.isBytes=g,I.abool=C,I.anumber=B,I.abytes=i,I.ahash=function(A){if("function"!=typeof A||"function"!=typeof A.create)throw new Error("Hash should be wrapped by utils.createHasher");B(A.outputLen),B(A.blockLen)},I.aexists=function(A,I=!0){if(A.destroyed)throw new Error("Hash instance has been destroyed");if(I&&A.finished)throw new Error("Hash#digest() has already been called")},I.aoutput=function(A,I){i(A);const g=I.outputLen;if(A.length "function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),E=Array.from({length:256},(A,I)=>I.toString(16).padStart(2,"0"));function t(A){if(i(A),e)return A.toHex();let I="";for(let g=0;g =o._0&&A<=o._9?A-o._0:A>=o.A&&A<=o.F?A-(o.A-10):A>=o.a&&A<=o.f?A-(o.a-10):void 0}function a(A){if("string"!=typeof A)throw new Error("hex string expected, got "+typeof A);if(e)return Uint8Array.fromHex(A);const I=A.length,g=I/2;if(I%2)throw new Error("hex string expected, got unpadded hex of length "+I);const C=new Uint8Array(g);for(let I=0,B=0;I >B&i),e=Number(g&i),E=C?4:0,t=C?0:4;A.setUint32(I+E,Q,C),A.setUint32(I+t,e,C)}function w(A){return A.byteOffset%4==0}function d(A){return Uint8Array.from(A)}I.nextTick=async()=>{},I.Hash=class{},I.wrapCipher=(A,g)=>{function C(C,...B){if(i(C),!I.isLE)throw new Error("Non little-endian hardware is not yet supported");if(void 0!==A.nonceLength){const I=B[0];if(!I)throw new Error("nonce / iv required");A.varSizeNonce?i(I):i(I,A.nonceLength)}const Q=A.tagLength;Q&&void 0!==B[1]&&i(B[1]);const e=g(C,...B),E=(A,I)=>{if(void 0!==I){if(2!==A)throw new Error("cipher output not supported");i(I)}};let t=!1;return{encrypt(A,I){if(t)throw new Error("cannot encrypt() twice with same key + nonce");return t=!0,i(A),E(e.encrypt.length,I),e.encrypt(A,I)},decrypt(A,I){if(i(A),Q&&A.length B.encode(C.fromWordsUnsafe(A)),16:A=>B.encode(C.fromWordsUnsafe(A)),13:A=>i.encode(C.fromWordsUnsafe(A)),19:A=>B.encode(C.fromWordsUnsafe(A)),23:A=>B.encode(C.fromWordsUnsafe(A)),27:A=>B.encode(C.fromWordsUnsafe(A)),6:h,24:h,3:function(A){const I=[];let g,i,Q,e,E,t=C.fromWordsUnsafe(A);for(;t.length>0;)g=B.encode(t.slice(0,33)),i=B.encode(t.slice(33,41)),Q=parseInt(B.encode(t.slice(41,45)),16),e=parseInt(B.encode(t.slice(45,49)),16),E=parseInt(B.encode(t.slice(49,51)),16),t=t.slice(51),I.push({pubkey:g,short_channel_id:i,fee_base_msat:Q,fee_proportional_millionths:e,cltv_expiry_delta:E});return I},5:function(A){const I=A.slice().reverse().map(A=>[!!(1&A),!!(2&A),!!(4&A),!!(8&A),!!(16&A)]).reduce((A,I)=>A.concat(I),[]);for(;I.length<2*n.length;)I.push(!1);const g={};n.forEach((A,C)=>{let B;B=I[2*C]?"required":I[2*C+1]?"supported":"unsupported",g[A]=B});const C=I.slice(2*n.length);return g.extra_bits={start_bit:2*n.length,bits:C,has_required:C.reduce((A,I,g)=>g%2!=0?A||!1:A||I,!1)},g}};function d(A){return I=>({tagCode:parseInt(A),words:C.encode("unknown",I,Number.MAX_SAFE_INTEGER)})}function h(A){return A.reverse().reduce((A,I,g)=>A+I*Math.pow(32,g),0)}function y(A,I){let g,C;if(A.slice(-1).match(/^[munp]$/))g=A.slice(-1),C=A.slice(0,-1);else{if(A.slice(-1).match(/^[^munp0-9]$/))throw new Error("Not a valid multiplier for the amount");C=A}if(!C.match(/^\d+$/))throw new Error("Not a valid human readable amount");const B=BigInt(C),i=g?B*r/a[g]:B*r;if("p"===g&&B%BigInt(10)!==BigInt(0)||i>s)throw new Error("Amount is outside of valid range");return I?i.toString():i}A.exports={decode:function(A,I){if("string"!=typeof A)throw new Error("Lightning Payment Request must be string");if("ln"!==A.slice(0,2).toLowerCase())throw new Error("Not a proper lightning payment request");const g=[],i=C.decode(A,Number.MAX_SAFE_INTEGER);A=A.toLowerCase();const n=i.prefix;let a=i.words,s=A.slice(n.length+1),r=a.slice(-104);a=a.slice(0,-104);let l=n.match(/^ln(\S+?)(\d*)([a-zA-Z]?)$/);if(l&&!l[2]&&(l=n.match(/^ln(\S+)$/)),!l)throw new Error("Not a proper lightning payment request");g.push({name:"lightning_network",letters:"ln"});const k=l[1];let u;if(I){if(void 0===I.bech32||void 0===I.pubKeyHash||void 0===I.scriptHash||!Array.isArray(I.validWitnessVersions))throw new Error("Invalid network");u=I}else switch(k){case Q.bech32:u=Q;break;case e.bech32:u=e;break;case E.bech32:u=E;break;case t.bech32:u=t;break;case o.bech32:u=o}if(!u||u.bech32!==k)throw new Error("Unknown coin bech32 prefix");g.push({name:"coin_network",letters:k,value:u});const N=l[2];let G;N?(G=y(N+l[3],!0),g.push({name:"amount",letters:l[2]+l[3],value:G})):G=null,g.push({name:"separator",letters:"1"});const p=h(a.slice(0,7));let S,f,F,R;for(a=a.slice(7),g.push({name:"timestamp",letters:s.slice(0,7),value:p}),s=s.slice(7);a.length>0;){const A=a[0].toString();S=D[A]||"unknown_tag",f=w[A]||d(A),a=a.slice(1),F=h(a.slice(0,2)),a=a.slice(2),R=a.slice(0,F),a=a.slice(F),g.push({name:S,tag:s[0],letters:s.slice(0,3+F),value:f(R)}),s=s.slice(3+F)}g.push({name:"signature",letters:s.slice(0,104),value:B.encode(C.fromWordsUnsafe(r))}),s=s.slice(104),g.push({name:"checksum",letters:s});let U={paymentRequest:A,sections:g,get expiry(){let A=g.find(A=>"expiry"===A.name);if(A)return M("timestamp")+A.value},get route_hints(){return g.filter(A=>"route_hint"===A.name).map(A=>A.value)}};for(let A in c)"route_hint"!==A&&Object.defineProperty(U,A,{get:()=>M(A)});return U;function M(A){let I=g.find(I=>I.name===A);return I?I.value:void 0}},hrpToMillisat:y}},6776:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.composeClientMiddleware=void 0,I.composeClientMiddleware=function(A,I){return(g,C)=>I(Object.assign(Object.assign({},g),{next:(I,C)=>A(Object.assign(Object.assign({},g),{request:I}),C)}),C)}},7005:(A,I,g)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.FetchTransport=function(A){return async function*({url:I,body:g,metadata:B,signal:E,method:t}){let o;if(t.requestStream){let A;o=new ReadableStream({type:"bytes",start(){A=g[Symbol.asyncIterator]()},async pull(I){const{done:g,value:C}=await A.next();g?I.close():I.enqueue(C)},async cancel(){var I,g;await(null===(g=(I=A).return)||void 0===g?void 0:g.call(I))}})}else{let A;for await(const I of g){A=I;break}o=A}const n=await fetch(I,{method:"POST",body:o,headers:Q(B),signal:E,cache:null==A?void 0:A.cache,duplex:"half",credentials:null==A?void 0:A.credentials});if(yield{type:"header",header:e(n.headers)},!n.ok){const A=await n.text();throw new i.ClientError(t.path,function(A){switch(A){case 400:return i.Status.INTERNAL;case 401:return i.Status.UNAUTHENTICATED;case 403:return i.Status.PERMISSION_DENIED;case 404:return i.Status.UNIMPLEMENTED;case 429:case 502:case 503:case 504:return i.Status.UNAVAILABLE;default:return i.Status.UNKNOWN}}(n.status),function(A,I){return`Received HTTP ${A} response: `+(I.length>1e3?I.slice(0,1e3)+"... (truncated)":I)}(n.status,A))}(0,C.throwIfAborted)(E);const a=n.body.getReader(),s=()=>{a.cancel().catch(()=>{})};E.addEventListener("abort",s);try{for(;;){const{done:A,value:I}=await a.read();if(null!=I&&(yield{type:"data",data:I}),A)break}}finally{E.removeEventListener("abort",s),(0,C.throwIfAborted)(E)}}};const C=g(1475),B=g(8127),i=g(91);function Q(A){const I=new Headers;for(const[g,C]of A)for(const A of C)I.append(g,"string"==typeof A?A:B.Base64.fromUint8Array(A));return I}function e(A){const I=new i.Metadata;for(const[g,C]of A)if(g.endsWith("-bin"))for(const A of C.split(/,\s?/))I.append(g,B.Base64.toUint8Array(A));else I.set(g,C);return I}},7395:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0})},7522:(A,I)=>{"use strict";I.__esModule=void 0,I.__esModule=!0;var g="function"==typeof Object.setPrototypeOf,C="function"==typeof Object.getPrototypeOf,B="function"==typeof Object.defineProperty,i="function"==typeof Object.create,Q="function"==typeof Object.prototype.hasOwnProperty;I.setPrototypeOf=function(A,I){g?Object.setPrototypeOf(A,I):A.__proto__=I},I.getPrototypeOf=function(A){return C?Object.getPrototypeOf(A):A.__proto__||A.prototype};var e=!1;I.defineProperty=function A(I,g,C){if(B&&!e)try{Object.defineProperty(I,g,C)}catch(B){e=!0,A(I,g,C)}else I[g]=C.value};var E=function(A,I){return Q?A.hasOwnProperty(A,I):void 0===A[I]};I.hasOwnProperty=E,I.objectCreate=function(A,I){if(i)return Object.create(A,I);var g=function(){};g.prototype=A;var C=new g;if(void 0===I)return C;if("null"==typeof I)throw new Error("PropertyDescriptors must not be null.");if("object"==typeof I)for(var B in I)E(I,B)&&(C[B]=I[B].value);return C}},7526:(A,I)=>{"use strict";I.byteLength=function(A){var I=e(A),g=I[0],C=I[1];return 3*(g+C)/4-C},I.toByteArray=function(A){var I,g,i=e(A),Q=i[0],E=i[1],t=new B(function(A,I,g){return 3*(I+g)/4-g}(0,Q,E)),o=0,n=E>0?Q-4:Q;for(g=0;g>16&255,t[o++]=I>>8&255,t[o++]=255&I;return 2===E&&(I=C[A.charCodeAt(g)]<<2|C[A.charCodeAt(g+1)]>>4,t[o++]=255&I),1===E&&(I=C[A.charCodeAt(g)]<<10|C[A.charCodeAt(g+1)]<<4|C[A.charCodeAt(g+2)]>>2,t[o++]=I>>8&255,t[o++]=255&I),t},I.fromByteArray=function(A){for(var I,C=A.length,B=C%3,i=[],Q=16383,e=0,E=C-B;e E?E:e+Q));return 1===B?(I=A[C-1],i.push(g[I>>2]+g[I<<4&63]+"==")):2===B&&(I=(A[C-2]<<8)+A[C-1],i.push(g[I>>10]+g[I>>4&63]+g[I<<2&63]+"=")),i.join("")};for(var g=[],C=[],B="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Q=0;Q<64;++Q)g[Q]=i[Q],C[i.charCodeAt(Q)]=Q;function e(A){var I=A.length;if(I%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var g=A.indexOf("=");return-1===g&&(g=I),[g,g===I?0:4-g%4]}function E(A){return g[A>>18&63]+g[A>>12&63]+g[A>>6&63]+g[63&A]}function t(A,I,g){for(var C,B=[],i=I;i {"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.encodeRequest=async function*({request:A,encode:I}){for await(const g of A){const A=I(g);yield(0,C.encodeFrame)(A)}};const C=g(3564)},7640:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.composeServerMiddleware=void 0,I.composeServerMiddleware=function(A,I){return(g,C)=>A(Object.assign(Object.assign({},g),{next:(A,C)=>I(Object.assign(Object.assign({},g),{request:A}),C)}),C)}},7671:(A,I,g)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.normalizeServiceDefinition=function(A){return(0,C.isGrpcWebServiceDefinition)(A)?(0,C.fromGrpcWebServiceDefinition)(A):(0,B.isTsProtoServiceDefinition)(A)?(0,B.fromTsProtoServiceDefinition)(A):A};const C=g(700),B=g(5653)},7678:(A,I,g)=>{"use strict";I.wY=void 0;var C=g(469);I.wY=function(A,I,g){return(0,C.gcm)(A,I,g)}},7768:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.isAsyncIterable=function(A){return null!=A&&Symbol.asyncIterator in A}},8105:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0})},8127:function(A,I,g){var C=g(8287).hp;"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==g.g&&g.g,A.exports=function(){"use strict";var A,I="3.7.8",g=I,B="function"==typeof C,i="function"==typeof TextDecoder?new TextDecoder:void 0,Q="function"==typeof TextEncoder?new TextEncoder:void 0,e=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),E=(A={},e.forEach(function(I,g){return A[I]=g}),A),t=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,o=String.fromCharCode.bind(String),n="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(A){return new Uint8Array(Array.prototype.slice.call(A,0))},a=function(A){return A.replace(/=/g,"").replace(/[+\/]/g,function(A){return"+"==A?"-":"_"})},s=function(A){return A.replace(/[^A-Za-z0-9\+\/]/g,"")},r=function(A){for(var I,g,C,B,i="",Q=A.length%3,E=0;E 255||(C=A.charCodeAt(E++))>255||(B=A.charCodeAt(E++))>255)throw new TypeError("invalid character found");i+=e[(I=g<<16|C<<8|B)>>18&63]+e[I>>12&63]+e[I>>6&63]+e[63&I]}return Q?i.slice(0,Q-3)+"===".substring(Q):i},c="function"==typeof btoa?function(A){return btoa(A)}:B?function(A){return C.from(A,"binary").toString("base64")}:r,D=B?function(A){return C.from(A).toString("base64")}:function(A){for(var I=[],g=0,C=A.length;g >>6)+o(128|63&I):o(224|I>>>12&15)+o(128|I>>>6&63)+o(128|63&I);var I=65536+1024*(A.charCodeAt(0)-55296)+(A.charCodeAt(1)-56320);return o(240|I>>>18&7)+o(128|I>>>12&63)+o(128|I>>>6&63)+o(128|63&I)},h=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,y=function(A){return A.replace(h,d)},l=B?function(A){return C.from(A,"utf8").toString("base64")}:Q?function(A){return D(Q.encode(A))}:function(A){return c(y(A))},k=function(A,I){return void 0===I&&(I=!1),I?a(l(A)):l(A)},u=function(A){return k(A,!0)},N=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,G=function(A){switch(A.length){case 4:var I=((7&A.charCodeAt(0))<<18|(63&A.charCodeAt(1))<<12|(63&A.charCodeAt(2))<<6|63&A.charCodeAt(3))-65536;return o((I>>>10)+55296)+o(56320+(1023&I));case 3:return o((15&A.charCodeAt(0))<<12|(63&A.charCodeAt(1))<<6|63&A.charCodeAt(2));default:return o((31&A.charCodeAt(0))<<6|63&A.charCodeAt(1))}},p=function(A){return A.replace(N,G)},S=function(A){if(A=A.replace(/\s+/g,""),!t.test(A))throw new TypeError("malformed base64.");var I,g,C;A+="==".slice(2-(3&A.length));for(var B=[],i=0;i >16&255)):64===C?B.push(o(I>>16&255,I>>8&255)):B.push(o(I>>16&255,I>>8&255,255&I));return B.join("")},f="function"==typeof atob?function(A){return atob(s(A))}:B?function(A){return C.from(A,"base64").toString("binary")}:S,F=B?function(A){return n(C.from(A,"base64"))}:function(A){return n(f(A).split("").map(function(A){return A.charCodeAt(0)}))},R=function(A){return F(M(A))},U=B?function(A){return C.from(A,"base64").toString("utf8")}:i?function(A){return i.decode(F(A))}:function(A){return p(f(A))},M=function(A){return s(A.replace(/[-_]/g,function(A){return"-"==A?"+":"/"}))},K=function(A){return U(M(A))},m=function(A){return{value:A,enumerable:!1,writable:!0,configurable:!0}},J=function(){var A=function(A,I){return Object.defineProperty(String.prototype,A,m(I))};A("fromBase64",function(){return K(this)}),A("toBase64",function(A){return k(this,A)}),A("toBase64URI",function(){return k(this,!0)}),A("toBase64URL",function(){return k(this,!0)}),A("toUint8Array",function(){return R(this)})},b=function(){var A=function(A,I){return Object.defineProperty(Uint8Array.prototype,A,m(I))};A("toBase64",function(A){return w(this,A)}),A("toBase64URI",function(){return w(this,!0)}),A("toBase64URL",function(){return w(this,!0)})},H={version:I,VERSION:g,atob:f,atobPolyfill:S,btoa:c,btoaPolyfill:r,fromBase64:K,toBase64:k,encode:k,encodeURI:u,encodeURL:u,utob:y,btou:p,decode:K,isValid:function(A){if("string"!=typeof A)return!1;var I=A.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(I)||!/[^\s0-9a-zA-Z\-_]/.test(I)},fromUint8Array:w,toUint8Array:R,extendString:J,extendUint8Array:b,extendBuiltins:function(){J(),b()},Base64:{}};return Object.keys(H).forEach(function(A){return H.Base64[A]=H[A]}),H}()},8198:(A,I)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.makeInternalErrorMessage=function(A){return null==A||"object"!=typeof A?String(A):"string"==typeof A.message?A.message:JSON.stringify(A)}},8287:(A,I,g)=>{"use strict";const C=g(7526),B=g(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;I.hp=E,I.IS=50;const Q=2147483647;function e(A){if(A>Q)throw new RangeError('The value "'+A+'" is invalid for option "size"');const I=new Uint8Array(A);return Object.setPrototypeOf(I,E.prototype),I}function E(A,I,g){if("number"==typeof A){if("string"==typeof I)throw new TypeError('The "string" argument must be of type string. Received type number');return n(A)}return t(A,I,g)}function t(A,I,g){if("string"==typeof A)return function(A,I){if("string"==typeof I&&""!==I||(I="utf8"),!E.isEncoding(I))throw new TypeError("Unknown encoding: "+I);const g=0|c(A,I);let C=e(g);const B=C.write(A,I);return B!==g&&(C=C.slice(0,B)),C}(A,I);if(ArrayBuffer.isView(A))return function(A){if(X(A,Uint8Array)){const I=new Uint8Array(A);return s(I.buffer,I.byteOffset,I.byteLength)}return a(A)}(A);if(null==A)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof A);if(X(A,ArrayBuffer)||A&&X(A.buffer,ArrayBuffer))return s(A,I,g);if("undefined"!=typeof SharedArrayBuffer&&(X(A,SharedArrayBuffer)||A&&X(A.buffer,SharedArrayBuffer)))return s(A,I,g);if("number"==typeof A)throw new TypeError('The "value" argument must not be of type number. Received type number');const C=A.valueOf&&A.valueOf();if(null!=C&&C!==A)return E.from(C,I,g);const B=function(A){if(E.isBuffer(A)){const I=0|r(A.length),g=e(I);return 0===g.length||A.copy(g,0,0,I),g}return void 0!==A.length?"number"!=typeof A.length||j(A.length)?e(0):a(A):"Buffer"===A.type&&Array.isArray(A.data)?a(A.data):void 0}(A);if(B)return B;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof A[Symbol.toPrimitive])return E.from(A[Symbol.toPrimitive]("string"),I,g);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof A)}function o(A){if("number"!=typeof A)throw new TypeError('"size" argument must be of type number');if(A<0)throw new RangeError('The value "'+A+'" is invalid for option "size"')}function n(A){return o(A),e(A<0?0:0|r(A))}function a(A){const I=A.length<0?0:0|r(A.length),g=e(I);for(let C=0;C=Q)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return 0|A}function c(A,I){if(E.isBuffer(A))return A.length;if(ArrayBuffer.isView(A)||X(A,ArrayBuffer))return A.byteLength;if("string"!=typeof A)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof A);const g=A.length,C=arguments.length>2&&!0===arguments[2];if(!C&&0===g)return 0;let B=!1;for(;;)switch(I){case"ascii":case"latin1":case"binary":return g;case"utf8":case"utf-8":return W(A).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*g;case"hex":return g>>>1;case"base64":return P(A).length;default:if(B)return C?-1:W(A).length;I=(""+I).toLowerCase(),B=!0}}function D(A,I,g){let C=!1;if((void 0===I||I<0)&&(I=0),I>this.length)return"";if((void 0===g||g>this.length)&&(g=this.length),g<=0)return"";if((g>>>=0)<=(I>>>=0))return"";for(A||(A="utf8");;)switch(A){case"hex":return R(this,I,g);case"utf8":case"utf-8":return p(this,I,g);case"ascii":return f(this,I,g);case"latin1":case"binary":return F(this,I,g);case"base64":return G(this,I,g);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,I,g);default:if(C)throw new TypeError("Unknown encoding: "+A);A=(A+"").toLowerCase(),C=!0}}function w(A,I,g){const C=A[I];A[I]=A[g],A[g]=C}function d(A,I,g,C,B){if(0===A.length)return-1;if("string"==typeof g?(C=g,g=0):g>2147483647?g=2147483647:g<-2147483648&&(g=-2147483648),j(g=+g)&&(g=B?0:A.length-1),g<0&&(g=A.length+g),g>=A.length){if(B)return-1;g=A.length-1}else if(g<0){if(!B)return-1;g=0}if("string"==typeof I&&(I=E.from(I,C)),E.isBuffer(I))return 0===I.length?-1:h(A,I,g,C,B);if("number"==typeof I)return I&=255,"function"==typeof Uint8Array.prototype.indexOf?B?Uint8Array.prototype.indexOf.call(A,I,g):Uint8Array.prototype.lastIndexOf.call(A,I,g):h(A,[I],g,C,B);throw new TypeError("val must be string, number or Buffer")}function h(A,I,g,C,B){let i,Q=1,e=A.length,E=I.length;if(void 0!==C&&("ucs2"===(C=String(C).toLowerCase())||"ucs-2"===C||"utf16le"===C||"utf-16le"===C)){if(A.length<2||I.length<2)return-1;Q=2,e/=2,E/=2,g/=2}function t(A,I){return 1===Q?A[I]:A.readUInt16BE(I*Q)}if(B){let C=-1;for(i=g;i e&&(g=e-E),i=g;i>=0;i--){let g=!0;for(let C=0;C B&&(C=B):C=B;const i=I.length;let Q;for(C>i/2&&(C=i/2),Q=0;Q >8,B=g%256,i.push(B),i.push(C);return i}(I,A.length-g),A,g,C)}function G(A,I,g){return 0===I&&g===A.length?C.fromByteArray(A):C.fromByteArray(A.slice(I,g))}function p(A,I,g){g=Math.min(A.length,g);const C=[];let B=I;for(;B 239?4:I>223?3:I>191?2:1;if(B+Q<=g){let g,C,e,E;switch(Q){case 1:I<128&&(i=I);break;case 2:g=A[B+1],128==(192&g)&&(E=(31&I)<<6|63&g,E>127&&(i=E));break;case 3:g=A[B+1],C=A[B+2],128==(192&g)&&128==(192&C)&&(E=(15&I)<<12|(63&g)<<6|63&C,E>2047&&(E<55296||E>57343)&&(i=E));break;case 4:g=A[B+1],C=A[B+2],e=A[B+3],128==(192&g)&&128==(192&C)&&128==(192&e)&&(E=(15&I)<<18|(63&g)<<12|(63&C)<<6|63&e,E>65535&&E<1114112&&(i=E))}}null===i?(i=65533,Q=1):i>65535&&(i-=65536,C.push(i>>>10&1023|55296),i=56320|1023&i),C.push(i),B+=Q}return function(A){const I=A.length;if(I<=S)return String.fromCharCode.apply(String,A);let g="",C=0;for(;CC.length?(E.isBuffer(I)||(I=E.from(I)),I.copy(C,B)):Uint8Array.prototype.set.call(C,I,B);else{if(!E.isBuffer(I))throw new TypeError('"list" argument must be an Array of Buffers');I.copy(C,B)}B+=I.length}return C},E.byteLength=c,E.prototype._isBuffer=!0,E.prototype.swap16=function(){const A=this.length;if(A%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let I=0;Ig&&(A+=" ... ")," "},i&&(E.prototype[i]=E.prototype.inspect),E.prototype.compare=function(A,I,g,C,B){if(X(A,Uint8Array)&&(A=E.from(A,A.offset,A.byteLength)),!E.isBuffer(A))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof A);if(void 0===I&&(I=0),void 0===g&&(g=A?A.length:0),void 0===C&&(C=0),void 0===B&&(B=this.length),I<0||g>A.length||C<0||B>this.length)throw new RangeError("out of range index");if(C>=B&&I>=g)return 0;if(C>=B)return-1;if(I>=g)return 1;if(this===A)return 0;let i=(B>>>=0)-(C>>>=0),Q=(g>>>=0)-(I>>>=0);const e=Math.min(i,Q),t=this.slice(C,B),o=A.slice(I,g);for(let A=0;A >>=0,isFinite(g)?(g>>>=0,void 0===C&&(C="utf8")):(C=g,g=void 0)}const B=this.length-I;if((void 0===g||g>B)&&(g=B),A.length>0&&(g<0||I<0)||I>this.length)throw new RangeError("Attempt to write outside buffer bounds");C||(C="utf8");let i=!1;for(;;)switch(C){case"hex":return y(this,A,I,g);case"utf8":case"utf-8":return l(this,A,I,g);case"ascii":case"latin1":case"binary":return k(this,A,I,g);case"base64":return u(this,A,I,g);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,A,I,g);default:if(i)throw new TypeError("Unknown encoding: "+C);C=(""+C).toLowerCase(),i=!0}},E.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const S=4096;function f(A,I,g){let C="";g=Math.min(A.length,g);for(let B=I;B C)&&(g=C);let B="";for(let C=I;C g)throw new RangeError("Trying to access beyond buffer length")}function K(A,I,g,C,B,i){if(!E.isBuffer(A))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>B||IA.length)throw new RangeError("Index out of range")}function m(A,I,g,C,B){T(I,C,B,A,g,7);let i=Number(I&BigInt(4294967295));A[g++]=i,i>>=8,A[g++]=i,i>>=8,A[g++]=i,i>>=8,A[g++]=i;let Q=Number(I>>BigInt(32)&BigInt(4294967295));return A[g++]=Q,Q>>=8,A[g++]=Q,Q>>=8,A[g++]=Q,Q>>=8,A[g++]=Q,g}function J(A,I,g,C,B){T(I,C,B,A,g,7);let i=Number(I&BigInt(4294967295));A[g+7]=i,i>>=8,A[g+6]=i,i>>=8,A[g+5]=i,i>>=8,A[g+4]=i;let Q=Number(I>>BigInt(32)&BigInt(4294967295));return A[g+3]=Q,Q>>=8,A[g+2]=Q,Q>>=8,A[g+1]=Q,Q>>=8,A[g]=Q,g+8}function b(A,I,g,C,B,i){if(g+C>A.length)throw new RangeError("Index out of range");if(g<0)throw new RangeError("Index out of range")}function H(A,I,g,C,i){return I=+I,g>>>=0,i||b(A,0,g,4),B.write(A,I,g,C,23,4),g+4}function Y(A,I,g,C,i){return I=+I,g>>>=0,i||b(A,0,g,8),B.write(A,I,g,C,52,8),g+8}E.prototype.slice=function(A,I){const g=this.length;(A=~~A)<0?(A+=g)<0&&(A=0):A>g&&(A=g),(I=void 0===I?g:~~I)<0?(I+=g)<0&&(I=0):I>g&&(I=g),I>>=0,I>>>=0,g||M(A,I,this.length);let C=this[A],B=1,i=0;for(;++i>>=0,I>>>=0,g||M(A,I,this.length);let C=this[A+--I],B=1;for(;I>0&&(B*=256);)C+=this[A+--I]*B;return C},E.prototype.readUint8=E.prototype.readUInt8=function(A,I){return A>>>=0,I||M(A,1,this.length),this[A]},E.prototype.readUint16LE=E.prototype.readUInt16LE=function(A,I){return A>>>=0,I||M(A,2,this.length),this[A]|this[A+1]<<8},E.prototype.readUint16BE=E.prototype.readUInt16BE=function(A,I){return A>>>=0,I||M(A,2,this.length),this[A]<<8|this[A+1]},E.prototype.readUint32LE=E.prototype.readUInt32LE=function(A,I){return A>>>=0,I||M(A,4,this.length),(this[A]|this[A+1]<<8|this[A+2]<<16)+16777216*this[A+3]},E.prototype.readUint32BE=E.prototype.readUInt32BE=function(A,I){return A>>>=0,I||M(A,4,this.length),16777216*this[A]+(this[A+1]<<16|this[A+2]<<8|this[A+3])},E.prototype.readBigUInt64LE=_(function(A){v(A>>>=0,"offset");const I=this[A],g=this[A+7];void 0!==I&&void 0!==g||Z(A,this.length-8);const C=I+256*this[++A]+65536*this[++A]+this[++A]*2**24,B=this[++A]+256*this[++A]+65536*this[++A]+g*2**24;return BigInt(C)+(BigInt(B)< >>=0,"offset");const I=this[A],g=this[A+7];void 0!==I&&void 0!==g||Z(A,this.length-8);const C=I*2**24+65536*this[++A]+256*this[++A]+this[++A],B=this[++A]*2**24+65536*this[++A]+256*this[++A]+g;return(BigInt(C)< >>=0,I>>>=0,g||M(A,I,this.length);let C=this[A],B=1,i=0;for(;++i=B&&(C-=Math.pow(2,8*I)),C},E.prototype.readIntBE=function(A,I,g){A>>>=0,I>>>=0,g||M(A,I,this.length);let C=I,B=1,i=this[A+--C];for(;C>0&&(B*=256);)i+=this[A+--C]*B;return B*=128,i>=B&&(i-=Math.pow(2,8*I)),i},E.prototype.readInt8=function(A,I){return A>>>=0,I||M(A,1,this.length),128&this[A]?-1*(255-this[A]+1):this[A]},E.prototype.readInt16LE=function(A,I){A>>>=0,I||M(A,2,this.length);const g=this[A]|this[A+1]<<8;return 32768&g?4294901760|g:g},E.prototype.readInt16BE=function(A,I){A>>>=0,I||M(A,2,this.length);const g=this[A+1]|this[A]<<8;return 32768&g?4294901760|g:g},E.prototype.readInt32LE=function(A,I){return A>>>=0,I||M(A,4,this.length),this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24},E.prototype.readInt32BE=function(A,I){return A>>>=0,I||M(A,4,this.length),this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]},E.prototype.readBigInt64LE=_(function(A){v(A>>>=0,"offset");const I=this[A],g=this[A+7];void 0!==I&&void 0!==g||Z(A,this.length-8);const C=this[A+4]+256*this[A+5]+65536*this[A+6]+(g<<24);return(BigInt(C)< >>=0,"offset");const I=this[A],g=this[A+7];void 0!==I&&void 0!==g||Z(A,this.length-8);const C=(I<<24)+65536*this[++A]+256*this[++A]+this[++A];return(BigInt(C)< >>=0,I||M(A,4,this.length),B.read(this,A,!0,23,4)},E.prototype.readFloatBE=function(A,I){return A>>>=0,I||M(A,4,this.length),B.read(this,A,!1,23,4)},E.prototype.readDoubleLE=function(A,I){return A>>>=0,I||M(A,8,this.length),B.read(this,A,!0,52,8)},E.prototype.readDoubleBE=function(A,I){return A>>>=0,I||M(A,8,this.length),B.read(this,A,!1,52,8)},E.prototype.writeUintLE=E.prototype.writeUIntLE=function(A,I,g,C){A=+A,I>>>=0,g>>>=0,C||K(this,A,I,g,Math.pow(2,8*g)-1,0);let B=1,i=0;for(this[I]=255&A;++i >>=0,g>>>=0,C||K(this,A,I,g,Math.pow(2,8*g)-1,0);let B=g-1,i=1;for(this[I+B]=255&A;--B>=0&&(i*=256);)this[I+B]=A/i&255;return I+g},E.prototype.writeUint8=E.prototype.writeUInt8=function(A,I,g){return A=+A,I>>>=0,g||K(this,A,I,1,255,0),this[I]=255&A,I+1},E.prototype.writeUint16LE=E.prototype.writeUInt16LE=function(A,I,g){return A=+A,I>>>=0,g||K(this,A,I,2,65535,0),this[I]=255&A,this[I+1]=A>>>8,I+2},E.prototype.writeUint16BE=E.prototype.writeUInt16BE=function(A,I,g){return A=+A,I>>>=0,g||K(this,A,I,2,65535,0),this[I]=A>>>8,this[I+1]=255&A,I+2},E.prototype.writeUint32LE=E.prototype.writeUInt32LE=function(A,I,g){return A=+A,I>>>=0,g||K(this,A,I,4,4294967295,0),this[I+3]=A>>>24,this[I+2]=A>>>16,this[I+1]=A>>>8,this[I]=255&A,I+4},E.prototype.writeUint32BE=E.prototype.writeUInt32BE=function(A,I,g){return A=+A,I>>>=0,g||K(this,A,I,4,4294967295,0),this[I]=A>>>24,this[I+1]=A>>>16,this[I+2]=A>>>8,this[I+3]=255&A,I+4},E.prototype.writeBigUInt64LE=_(function(A,I=0){return m(this,A,I,BigInt(0),BigInt("0xffffffffffffffff"))}),E.prototype.writeBigUInt64BE=_(function(A,I=0){return J(this,A,I,BigInt(0),BigInt("0xffffffffffffffff"))}),E.prototype.writeIntLE=function(A,I,g,C){if(A=+A,I>>>=0,!C){const C=Math.pow(2,8*g-1);K(this,A,I,g,C-1,-C)}let B=0,i=1,Q=0;for(this[I]=255&A;++B >>=0,!C){const C=Math.pow(2,8*g-1);K(this,A,I,g,C-1,-C)}let B=g-1,i=1,Q=0;for(this[I+B]=255&A;--B>=0&&(i*=256);)A<0&&0===Q&&0!==this[I+B+1]&&(Q=1),this[I+B]=(A/i|0)-Q&255;return I+g},E.prototype.writeInt8=function(A,I,g){return A=+A,I>>>=0,g||K(this,A,I,1,127,-128),A<0&&(A=255+A+1),this[I]=255&A,I+1},E.prototype.writeInt16LE=function(A,I,g){return A=+A,I>>>=0,g||K(this,A,I,2,32767,-32768),this[I]=255&A,this[I+1]=A>>>8,I+2},E.prototype.writeInt16BE=function(A,I,g){return A=+A,I>>>=0,g||K(this,A,I,2,32767,-32768),this[I]=A>>>8,this[I+1]=255&A,I+2},E.prototype.writeInt32LE=function(A,I,g){return A=+A,I>>>=0,g||K(this,A,I,4,2147483647,-2147483648),this[I]=255&A,this[I+1]=A>>>8,this[I+2]=A>>>16,this[I+3]=A>>>24,I+4},E.prototype.writeInt32BE=function(A,I,g){return A=+A,I>>>=0,g||K(this,A,I,4,2147483647,-2147483648),A<0&&(A=4294967295+A+1),this[I]=A>>>24,this[I+1]=A>>>16,this[I+2]=A>>>8,this[I+3]=255&A,I+4},E.prototype.writeBigInt64LE=_(function(A,I=0){return m(this,A,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),E.prototype.writeBigInt64BE=_(function(A,I=0){return J(this,A,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),E.prototype.writeFloatLE=function(A,I,g){return H(this,A,I,!0,g)},E.prototype.writeFloatBE=function(A,I,g){return H(this,A,I,!1,g)},E.prototype.writeDoubleLE=function(A,I,g){return Y(this,A,I,!0,g)},E.prototype.writeDoubleBE=function(A,I,g){return Y(this,A,I,!1,g)},E.prototype.copy=function(A,I,g,C){if(!E.isBuffer(A))throw new TypeError("argument should be a Buffer");if(g||(g=0),C||0===C||(C=this.length),I>=A.length&&(I=A.length),I||(I=0),C>0&&C =this.length)throw new RangeError("Index out of range");if(C<0)throw new RangeError("sourceEnd out of bounds");C>this.length&&(C=this.length),A.length-I >>=0,g=void 0===g?this.length:g>>>0,A||(A=0),"number"==typeof A)for(B=I;B =C+4;g-=3)I=`_${A.slice(g-3,g)}${I}`;return`${A.slice(0,g)}${I}`}function T(A,I,g,C,B,i){if(A>g||A3?0===I||I===BigInt(0)?`>= 0${C} and < 2${C} ** ${8*(i+1)}${C}`:`>= -(2${C} ** ${8*(i+1)-1}${C}) and < 2 ** ${8*(i+1)-1}${C}`:`>= ${I}${C} and <= ${g}${C}`,new L.ERR_OUT_OF_RANGE("value",B,A)}!function(A,I,g){v(I,"offset"),void 0!==A[I]&&void 0!==A[I+g]||Z(I,A.length-(g+1))}(C,B,i)}function v(A,I){if("number"!=typeof A)throw new L.ERR_INVALID_ARG_TYPE(I,"number",A)}function Z(A,I,g){if(Math.floor(A)!==A)throw v(A,g),new L.ERR_OUT_OF_RANGE(g||"offset","an integer",A);if(I<0)throw new L.ERR_BUFFER_OUT_OF_BOUNDS;throw new L.ERR_OUT_OF_RANGE(g||"offset",`>= ${g?1:0} and <= ${I}`,A)}q("ERR_BUFFER_OUT_OF_BOUNDS",function(A){return A?`${A} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),q("ERR_INVALID_ARG_TYPE",function(A,I){return`The "${A}" argument must be of type number. Received type ${typeof I}`},TypeError),q("ERR_OUT_OF_RANGE",function(A,I,g){let C=`The value of "${A}" is out of range.`,B=g;return Number.isInteger(g)&&Math.abs(g)>2**32?B=V(String(g)):"bigint"==typeof g&&(B=String(g),(g>BigInt(2)**BigInt(32)||g<-(BigInt(2)**BigInt(32)))&&(B=V(B)),B+="n"),C+=` It must be ${I}. Received ${B}`,C},RangeError);const x=/[^+/0-9A-Za-z-_]/g;function W(A,I){let g;I=I||1/0;const C=A.length;let B=null;const i=[];for(let Q=0;Q 55295&&g<57344){if(!B){if(g>56319){(I-=3)>-1&&i.push(239,191,189);continue}if(Q+1===C){(I-=3)>-1&&i.push(239,191,189);continue}B=g;continue}if(g<56320){(I-=3)>-1&&i.push(239,191,189),B=g;continue}g=65536+(B-55296<<10|g-56320)}else B&&(I-=3)>-1&&i.push(239,191,189);if(B=null,g<128){if((I-=1)<0)break;i.push(g)}else if(g<2048){if((I-=2)<0)break;i.push(g>>6|192,63&g|128)}else if(g<65536){if((I-=3)<0)break;i.push(g>>12|224,g>>6&63|128,63&g|128)}else{if(!(g<1114112))throw new Error("Invalid code point");if((I-=4)<0)break;i.push(g>>18|240,g>>12&63|128,g>>6&63|128,63&g|128)}}return i}function P(A){return C.toByteArray(function(A){if((A=(A=A.split("=")[0]).trim().replace(x,"")).length<2)return"";for(;A.length%4!=0;)A+="=";return A}(A))}function O(A,I,g,C){let B;for(B=0;B =I.length||B>=A.length);++B)I[B+g]=A[B];return B}function X(A,I){return A instanceof I||null!=A&&null!=A.constructor&&null!=A.constructor.name&&A.constructor.name===I.name}function j(A){return A!=A}const z=function(){const A="0123456789abcdef",I=new Array(256);for(let g=0;g<16;++g){const C=16*g;for(let B=0;B<16;++B)I[C+B]=A[g]+A[B]}return I}();function _(A){return"undefined"==typeof BigInt?$:A}function $(){throw new Error("BigInt not supported")}},8632:(A,I,g)=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0}),I.createUnaryMethod=function(A,I,g,e){const E={path:A.path,requestStream:A.requestStream,responseStream:A.responseStream,options:A.options};async function*t(g,e){if((0,i.isAsyncIterable)(g))throw new Error("A middleware passed invalid request to next(): expected a single message for unary method");const E=(0,Q.makeCall)(A,I,(0,B.asyncIterableOf)(g),e);let t;for await(const I of E){if(null!=t)throw new C.ClientError(A.path,C.Status.INTERNAL,"Received more than one message from server for unary method");t=I}if(null==t)throw new C.ClientError(A.path,C.Status.INTERNAL,"Server did not return a response");return t}const o=null==g?t:(A,I)=>g({method:E,requestStream:!1,request:A,responseStream:!1,next:t},I);return async(A,I)=>{const g=o(A,{...e,...I})[Symbol.asyncIterator]();let C=await g.next();for(;;)if(C.done){if(null!=C.value)return C.value;C=await g.throw(new Error("A middleware returned void, but expected to return a message for unary method"))}else C=await g.throw(new Error("A middleware yielded a message, but expected to only return a message for unary method"))}};const C=g(91),B=g(213),i=g(7768),Q=g(2810)},9982:function(A,I,g){var C;!function(){var I={};!function(A){"use strict";A.__esModule=!0,A.digestLength=32,A.blockSize=64;var I=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function g(A,g,C,B,i){for(var Q,e,E,t,o,n,a,s,r,c,D,w,d;i>=64;){for(Q=g[0],e=g[1],E=g[2],t=g[3],o=g[4],n=g[5],a=g[6],s=g[7],c=0;c<16;c++)D=B+4*c,A[c]=(255&C[D])<<24|(255&C[D+1])<<16|(255&C[D+2])<<8|255&C[D+3];for(c=16;c<64;c++)w=((r=A[c-2])>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,d=((r=A[c-15])>>>7|r<<25)^(r>>>18|r<<14)^r>>>3,A[c]=(w+A[c-7]|0)+(d+A[c-16]|0);for(c=0;c<64;c++)w=(((o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7))+(o&n^~o&a)|0)+(s+(I[c]+A[c]|0)|0)|0,d=((Q>>>2|Q<<30)^(Q>>>13|Q<<19)^(Q>>>22|Q<<10))+(Q&e^Q&E^e&E)|0,s=a,a=n,n=o,o=t+w|0,t=E,E=e,e=Q,Q=w+d|0;g[0]+=Q,g[1]+=e,g[2]+=E,g[3]+=t,g[4]+=o,g[5]+=n,g[6]+=a,g[7]+=s,B+=64,i-=64}return B}var C=function(){function I(){this.digestLength=A.digestLength,this.blockSize=A.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return I.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},I.prototype.clean=function(){for(var A=0;A 0){for(;this.bufferLength<64&&I>0;)this.buffer[this.bufferLength++]=A[C++],I--;64===this.bufferLength&&(g(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(I>=64&&(C=g(this.temp,this.state,A,C,I),I%=64);I>0;)this.buffer[this.bufferLength++]=A[C++],I--;return this},I.prototype.finish=function(A){if(!this.finished){var I=this.bytesHashed,C=this.bufferLength,B=I/536870912|0,i=I<<3,Q=I%64<56?64:128;this.buffer[C]=128;for(var e=C+1;e >>24&255,this.buffer[Q-7]=B>>>16&255,this.buffer[Q-6]=B>>>8&255,this.buffer[Q-5]=B>>>0&255,this.buffer[Q-4]=i>>>24&255,this.buffer[Q-3]=i>>>16&255,this.buffer[Q-2]=i>>>8&255,this.buffer[Q-1]=i>>>0&255,g(this.temp,this.state,this.buffer,0,Q),this.finished=!0}for(e=0;e<8;e++)A[4*e+0]=this.state[e]>>>24&255,A[4*e+1]=this.state[e]>>>16&255,A[4*e+2]=this.state[e]>>>8&255,A[4*e+3]=this.state[e]>>>0&255;return this},I.prototype.digest=function(){var A=new Uint8Array(this.digestLength);return this.finish(A),A},I.prototype._saveState=function(A){for(var I=0;I this.blockSize)(new C).update(A).finish(I).clean();else for(var g=0;g 1&&I.update(A),g&&I.update(g),I.update(C),I.finish(A),C[0]++}A.HMAC=B,A.hash=i,A.default=i,A.hmac=Q;var E=new Uint8Array(A.digestLength);A.hkdf=function(A,I,g,C){void 0===I&&(I=E),void 0===C&&(C=32);for(var i=new Uint8Array([1]),t=Q(I,A),o=new B(t),n=new Uint8Array(o.digestLength),a=n.length,s=new Uint8Array(C),r=0;r >>24&255,e[1]=a>>>16&255,e[2]=a>>>8&255,e[3]=a>>>0&255,i.reset(),i.update(I),i.update(e),i.finish(t);for(var s=0;s Object.getPrototypeOf(A):A=>A.__proto__,Q.t=function(g,C){if(1&C&&(g=this(g)),8&C)return g;if("object"==typeof g&&g){if(4&C&&g.__esModule)return g;if(16&C&&"function"==typeof g.then)return g}var B=Object.create(null);Q.r(B);var i={};A=A||[null,I({}),I([]),I(I)];for(var e=2&C&&g;("object"==typeof e||"function"==typeof e)&&!~A.indexOf(e);e=I(e))Object.getOwnPropertyNames(e).forEach(A=>i[A]=()=>g[A]);return i.default=()=>g,Q.d(B,i),B},Q.d=(A,I)=>{for(var g in I)Q.o(I,g)&&!Q.o(A,g)&&Object.defineProperty(A,g,{enumerable:!0,get:I[g]})},Q.f={},Q.e=A=>Promise.all(Object.keys(Q.f).reduce((I,g)=>(Q.f[g](A,I),I),[])),Q.u=A=>A+".index.js",Q.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(A){if("object"==typeof window)return window}}(),Q.o=(A,I)=>Object.prototype.hasOwnProperty.call(A,I),g={},C="spark-web-context:",Q.l=(A,I,B,i)=>{if(g[A])g[A].push(I);else{var e,E;if(void 0!==B)for(var t=document.getElementsByTagName("script"),o=0;o{e.onerror=e.onload=null,clearTimeout(s);var B=g[A];if(delete g[A],e.parentNode&&e.parentNode.removeChild(e),B&&B.forEach(A=>A(C)),I)return I(C)},s=setTimeout(a.bind(null,void 0,{type:"timeout",target:e}),12e4);e.onerror=a.bind(null,e.onerror),e.onload=a.bind(null,e.onload),E&&document.head.appendChild(e)}},Q.r=A=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})},Q.p="/",(()=>{var A={792:0};Q.f.j=(I,g)=>{var C=Q.o(A,I)?A[I]:void 0;if(0!==C)if(C)g.push(C[2]);else{var B=new Promise((g,B)=>C=A[I]=[g,B]);g.push(C[2]=B);var i=Q.p+Q.u(I),e=new Error;Q.l(i,g=>{if(Q.o(A,I)&&(0!==(C=A[I])&&(A[I]=void 0),C)){var B=g&&("load"===g.type?"missing":g.type),i=g&&g.target&&g.target.src;e.message="Loading chunk "+I+" failed.\n("+B+": "+i+")",e.name="ChunkLoadError",e.type=B,e.request=i,C[1](e)}},"chunk-"+I,I)}};var I=(I,g)=>{var C,B,[i,e,E]=g,t=0;if(i.some(I=>0!==A[I])){for(C in e)Q.o(e,C)&&(Q.m[C]=e[C]);E&&E(Q)}for(I&&I(g);t {"use strict";var A=Q(8287).hp,I=(Object.defineProperty,I=>new Uint8Array(A.from(I,"base64")));function g(){let A=0,I=0;for(let g=0;g<28;g+=7){let C=this.buf[this.pos++];if(A|=(127&C)< >4,!(128&g))return this.assertBounds(),[A,I];for(let g=3;g<=31;g+=7){let C=this.buf[this.pos++];if(I|=(127&C)< >>C,i=!(B>>>7==0&&0==I),Q=255&(i?128|B:B);if(g.push(Q),!i)return}const C=A>>>28&15|(7&I)<<4,B=!!(I>>3);if(g.push(255&(B?128|C:C)),B){for(let A=3;A<31;A+=7){const C=I>>>A,B=!(C>>>7==0),i=255&(B?128|C:C);if(g.push(i),!B)return}g.push(I>>>31&1)}}const B=4294967296;function i(A){const I="-"===A[0];I&&(A=A.slice(1));const g=1e6;let C=0,i=0;function Q(I,Q){const e=Number(A.slice(I,Q));i*=g,C=C*g+e,C>=B&&(i+=C/B|0,C%=B)}return Q(-24,-18),Q(-18,-12),Q(-12,-6),Q(-6),I?t(C,i):E(C,i)}function e(A,I){if(({lo:A,hi:I}=function(A,I){return{lo:A>>>0,hi:I>>>0}}(A,I)),I<=2097151)return String(B*I+A);const g=16777215&(A>>>24|I<<8),C=I>>16&65535;let i=(16777215&A)+6777216*g+6710656*C,Q=g+8147497*C,e=2*C;const E=1e7;return i>=E&&(Q+=Math.floor(i/E),i%=E),Q>=E&&(e+=Math.floor(Q/E),Q%=E),e.toString()+o(Q)+o(i)}function E(A,I){return{lo:0|A,hi:0|I}}function t(A,I){return I=~I,A?A=1+~A:I+=1,E(A,I)}const o=A=>{const I=String(A);return"0000000".slice(I.length)+I};function n(A,I){if(A>=0){for(;A>127;)I.push(127&A|128),A>>>=7;I.push(A)}else{for(let g=0;g<9;g++)I.push(127&A|128),A>>=7;I.push(1)}}function a(){let A=this.buf[this.pos++],I=127&A;if(!(128&A))return this.assertBounds(),I;if(A=this.buf[this.pos++],I|=(127&A)<<7,!(128&A))return this.assertBounds(),I;if(A=this.buf[this.pos++],I|=(127&A)<<14,!(128&A))return this.assertBounds(),I;if(A=this.buf[this.pos++],I|=(127&A)<<21,!(128&A))return this.assertBounds(),I;A=this.buf[this.pos++],I|=(15&A)<<28;for(let I=5;128&A&&I<10;I++)A=this.buf[this.pos++];if(128&A)throw new Error("invalid varint");return this.assertBounds(),I>>>0}const s=r();function r(){const A=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof A.getBigInt64&&"function"==typeof A.getBigUint64&&"function"==typeof A.setBigInt64&&"function"==typeof A.setBigUint64&&(globalThis.Deno||"object"!=typeof process||"object"!=typeof process.env||"1"!==process.env.BUF_BIGINT_DISABLE)){const I=BigInt("-9223372036854775808"),g=BigInt("9223372036854775807"),C=BigInt("0"),B=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(A){const C="bigint"==typeof A?A:BigInt(A);if(C>g||CB||I (A.setInt32(0,I,!0),A.setInt32(4,g,!0),A.getBigInt64(0,!0)),uDec:(I,g)=>(A.setInt32(0,I,!0),A.setInt32(4,g,!0),A.getBigUint64(0,!0))}}return{zero:"0",supported:!1,parse:A=>("string"!=typeof A&&(A=A.toString()),c(A),A),uParse:A=>("string"!=typeof A&&(A=A.toString()),D(A),A),enc:A=>("string"!=typeof A&&(A=A.toString()),c(A),i(A)),uEnc:A=>("string"!=typeof A&&(A=A.toString()),D(A),i(A)),dec:(A,I)=>function(A,I){let g=E(A,I);const C=2147483648&g.hi;C&&(g=t(g.lo,g.hi));const B=e(g.lo,g.hi);return C?"-"+B:B}(A,I),uDec:(A,I)=>e(A,I)}}function c(A){if(!/^-?[0-9]+$/.test(A))throw new Error("invalid int64: "+A)}function D(A){if(!/^[0-9]+$/.test(A))throw new Error("invalid uint64: "+A)}const w=Symbol.for("@bufbuild/protobuf/text-encoding");function d(){if(null==globalThis[w]){const A=new globalThis.TextEncoder,I=new globalThis.TextDecoder;globalThis[w]={encodeUtf8:I=>A.encode(I),decodeUtf8:A=>I.decode(A),checkUtf8(A){try{return encodeURIComponent(A),!0}catch(A){return!1}}}}return globalThis[w]}var h;!function(A){A[A.Varint=0]="Varint",A[A.Bit64=1]="Bit64",A[A.LengthDelimited=2]="LengthDelimited",A[A.StartGroup=3]="StartGroup",A[A.EndGroup=4]="EndGroup",A[A.Bit32=5]="Bit32"}(h||(h={}));class y{constructor(A=d().encodeUtf8){this.encodeUtf8=A,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let A=0;for(let I=0;I >>0)}raw(A){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(A),this}uint32(A){for(u(A);A>127;)this.buf.push(127&A|128),A>>>=7;return this.buf.push(A),this}int32(A){return k(A),n(A,this.buf),this}bool(A){return this.buf.push(A?1:0),this}bytes(A){return this.uint32(A.byteLength),this.raw(A)}string(A){let I=this.encodeUtf8(A);return this.uint32(I.byteLength),this.raw(I)}float(A){!function(A){if("string"==typeof A){const I=A;if(A=Number(A),Number.isNaN(A)&&"NaN"!==I)throw new Error("invalid float32: "+I)}else if("number"!=typeof A)throw new Error("invalid float32: "+typeof A);if(Number.isFinite(A)&&(A>34028234663852886e22||A<-34028234663852886e22))throw new Error("invalid float32: "+A)}(A);let I=new Uint8Array(4);return new DataView(I.buffer).setFloat32(0,A,!0),this.raw(I)}double(A){let I=new Uint8Array(8);return new DataView(I.buffer).setFloat64(0,A,!0),this.raw(I)}fixed32(A){u(A);let I=new Uint8Array(4);return new DataView(I.buffer).setUint32(0,A,!0),this.raw(I)}sfixed32(A){k(A);let I=new Uint8Array(4);return new DataView(I.buffer).setInt32(0,A,!0),this.raw(I)}sint32(A){return k(A),n(A=(A<<1^A>>31)>>>0,this.buf),this}sfixed64(A){let I=new Uint8Array(8),g=new DataView(I.buffer),C=s.enc(A);return g.setInt32(0,C.lo,!0),g.setInt32(4,C.hi,!0),this.raw(I)}fixed64(A){let I=new Uint8Array(8),g=new DataView(I.buffer),C=s.uEnc(A);return g.setInt32(0,C.lo,!0),g.setInt32(4,C.hi,!0),this.raw(I)}int64(A){let I=s.enc(A);return C(I.lo,I.hi,this.buf),this}sint64(A){const I=s.enc(A),g=I.hi>>31;return C(I.lo<<1^g,(I.hi<<1|I.lo>>>31)^g,this.buf),this}uint64(A){const I=s.uEnc(A);return C(I.lo,I.hi,this.buf),this}}class l{constructor(A,I=d().decodeUtf8){this.decodeUtf8=I,this.varint64=g,this.uint32=a,this.buf=A,this.len=A.length,this.pos=0,this.view=new DataView(A.buffer,A.byteOffset,A.byteLength)}tag(){let A=this.uint32(),I=A>>>3,g=7&A;if(I<=0||g<0||g>5)throw new Error("illegal tag: field no "+I+" wire type "+g);return[I,g]}skip(A,I){let g=this.pos;switch(A){case h.Varint:for(;128&this.buf[this.pos++];);break;case h.Bit64:this.pos+=4;case h.Bit32:this.pos+=4;break;case h.LengthDelimited:let g=this.uint32();this.pos+=g;break;case h.StartGroup:for(;;){const[A,g]=this.tag();if(g===h.EndGroup){if(void 0!==I&&A!==I)throw new Error("invalid end group tag");break}this.skip(g,A)}break;default:throw new Error("cant skip wire type "+A)}return this.assertBounds(),this.buf.subarray(g,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let A=this.uint32();return A>>>1^-(1&A)}int64(){return s.dec(...this.varint64())}uint64(){return s.uDec(...this.varint64())}sint64(){let[A,I]=this.varint64(),g=-(1&A);return A=(A>>>1|(1&I)<<31)^g,I=I>>>1^g,s.dec(A,I)}bool(){let[A,I]=this.varint64();return 0!==A||0!==I}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return s.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return s.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let A=this.uint32(),I=this.pos;return this.pos+=A,this.assertBounds(),this.buf.subarray(I,I+A)}string(){return this.decodeUtf8(this.bytes())}}function k(A){if("string"==typeof A)A=Number(A);else if("number"!=typeof A)throw new Error("invalid int32: "+typeof A);if(!Number.isInteger(A)||A>2147483647||A<-2147483648)throw new Error("invalid int32: "+A)}function u(A){if("string"==typeof A)A=Number(A);else if("number"!=typeof A)throw new Error("invalid uint32: "+typeof A);if(!Number.isInteger(A)||A>4294967295||A<0)throw new Error("invalid uint32: "+A)}const N={encode:(A,I=new y)=>(0!==A.seconds&&I.uint32(8).int64(A.seconds),0!==A.nanos&&I.uint32(16).int32(A.nanos),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={seconds:0,nanos:0};for(;g.pos >>3){case 1:if(8!==A)break;B.seconds=G(g.int64());continue;case 2:if(16!==A)break;B.nanos=g.int32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({seconds:p(A.seconds)?globalThis.Number(A.seconds):0,nanos:p(A.nanos)?globalThis.Number(A.nanos):0}),toJSON(A){const I={};return 0!==A.seconds&&(I.seconds=Math.round(A.seconds)),0!==A.nanos&&(I.nanos=Math.round(A.nanos)),I},create:A=>N.fromPartial(A??{}),fromPartial(A){const I={seconds:0,nanos:0};return I.seconds=A.seconds??0,I.nanos=A.nanos??0,I}};function G(A){const I=globalThis.Number(A.toString());if(I>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(I (0!==A.hiding.length&&I.uint32(10).bytes(A.hiding),0!==A.binding.length&&I.uint32(18).bytes(A.binding),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=F();for(;g.pos >>3){case 1:if(10!==A)break;B.hiding=g.bytes();continue;case 2:if(18!==A)break;B.binding=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({hiding:K(A.hiding)?U(A.hiding):new Uint8Array(0),binding:K(A.binding)?U(A.binding):new Uint8Array(0)}),toJSON(A){const I={};return 0!==A.hiding.length&&(I.hiding=M(A.hiding)),0!==A.binding.length&&(I.binding=M(A.binding)),I},create:A=>R.fromPartial(A??{}),fromPartial(A){const I=F();return I.hiding=A.hiding??new Uint8Array(0),I.binding=A.binding??new Uint8Array(0),I}};function U(A){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(A,"base64"));{const I=globalThis.atob(A),g=new Uint8Array(I.length);for(let A=0;A {I.push(globalThis.String.fromCharCode(A))}),globalThis.btoa(I.join(""))}}function K(A){return null!=A}const m={encode:(A,I=new y)=>I,decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I;for(;g.pos ({}),toJSON:A=>({}),create:A=>m.fromPartial(A??{}),fromPartial:A=>({})};let J=function(A){return A[A.UNSPECIFIED=0]="UNSPECIFIED",A[A.MAINNET=1]="MAINNET",A[A.REGTEST=2]="REGTEST",A[A.TESTNET=3]="TESTNET",A[A.SIGNET=4]="SIGNET",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED",A}({});function b(A){switch(A){case 0:case"UNSPECIFIED":return J.UNSPECIFIED;case 1:case"MAINNET":return J.MAINNET;case 2:case"REGTEST":return J.REGTEST;case 3:case"TESTNET":return J.TESTNET;case 4:case"SIGNET":return J.SIGNET;default:return J.UNRECOGNIZED}}function H(A){switch(A){case J.UNSPECIFIED:return"UNSPECIFIED";case J.MAINNET:return"MAINNET";case J.REGTEST:return"REGTEST";case J.TESTNET:return"TESTNET";case J.SIGNET:return"SIGNET";case J.UNRECOGNIZED:default:return"UNRECOGNIZED"}}let Y=function(A){return A[A.NEXT=0]="NEXT",A[A.PREVIOUS=1]="PREVIOUS",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED",A}({});function L(A){switch(A){case 0:case"NEXT":return Y.NEXT;case 1:case"PREVIOUS":return Y.PREVIOUS;default:return Y.UNRECOGNIZED}}let q=function(A){return A[A.TRANSFER_STATUS_SENDER_INITIATED=0]="TRANSFER_STATUS_SENDER_INITIATED",A[A.TRANSFER_STATUS_SENDER_KEY_TWEAK_PENDING=1]="TRANSFER_STATUS_SENDER_KEY_TWEAK_PENDING",A[A.TRANSFER_STATUS_SENDER_KEY_TWEAKED=2]="TRANSFER_STATUS_SENDER_KEY_TWEAKED",A[A.TRANSFER_STATUS_RECEIVER_KEY_TWEAKED=3]="TRANSFER_STATUS_RECEIVER_KEY_TWEAKED",A[A.TRANSFER_STATUS_RECEIVER_REFUND_SIGNED=4]="TRANSFER_STATUS_RECEIVER_REFUND_SIGNED",A[A.TRANSFER_STATUS_COMPLETED=5]="TRANSFER_STATUS_COMPLETED",A[A.TRANSFER_STATUS_EXPIRED=6]="TRANSFER_STATUS_EXPIRED",A[A.TRANSFER_STATUS_RETURNED=7]="TRANSFER_STATUS_RETURNED",A[A.TRANSFER_STATUS_SENDER_INITIATED_COORDINATOR=8]="TRANSFER_STATUS_SENDER_INITIATED_COORDINATOR",A[A.TRANSFER_STATUS_RECEIVER_KEY_TWEAK_LOCKED=9]="TRANSFER_STATUS_RECEIVER_KEY_TWEAK_LOCKED",A[A.TRANSFER_STATUS_RECEIVER_KEY_TWEAK_APPLIED=10]="TRANSFER_STATUS_RECEIVER_KEY_TWEAK_APPLIED",A[A.TRANSFER_STATUS_APPLYING_SENDER_KEY_TWEAK=11]="TRANSFER_STATUS_APPLYING_SENDER_KEY_TWEAK",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED",A}({});function V(A){switch(A){case 0:case"TRANSFER_STATUS_SENDER_INITIATED":return q.TRANSFER_STATUS_SENDER_INITIATED;case 1:case"TRANSFER_STATUS_SENDER_KEY_TWEAK_PENDING":return q.TRANSFER_STATUS_SENDER_KEY_TWEAK_PENDING;case 2:case"TRANSFER_STATUS_SENDER_KEY_TWEAKED":return q.TRANSFER_STATUS_SENDER_KEY_TWEAKED;case 3:case"TRANSFER_STATUS_RECEIVER_KEY_TWEAKED":return q.TRANSFER_STATUS_RECEIVER_KEY_TWEAKED;case 4:case"TRANSFER_STATUS_RECEIVER_REFUND_SIGNED":return q.TRANSFER_STATUS_RECEIVER_REFUND_SIGNED;case 5:case"TRANSFER_STATUS_COMPLETED":return q.TRANSFER_STATUS_COMPLETED;case 6:case"TRANSFER_STATUS_EXPIRED":return q.TRANSFER_STATUS_EXPIRED;case 7:case"TRANSFER_STATUS_RETURNED":return q.TRANSFER_STATUS_RETURNED;case 8:case"TRANSFER_STATUS_SENDER_INITIATED_COORDINATOR":return q.TRANSFER_STATUS_SENDER_INITIATED_COORDINATOR;case 9:case"TRANSFER_STATUS_RECEIVER_KEY_TWEAK_LOCKED":return q.TRANSFER_STATUS_RECEIVER_KEY_TWEAK_LOCKED;case 10:case"TRANSFER_STATUS_RECEIVER_KEY_TWEAK_APPLIED":return q.TRANSFER_STATUS_RECEIVER_KEY_TWEAK_APPLIED;case 11:case"TRANSFER_STATUS_APPLYING_SENDER_KEY_TWEAK":return q.TRANSFER_STATUS_APPLYING_SENDER_KEY_TWEAK;default:return q.UNRECOGNIZED}}function T(A){switch(A){case q.TRANSFER_STATUS_SENDER_INITIATED:return"TRANSFER_STATUS_SENDER_INITIATED";case q.TRANSFER_STATUS_SENDER_KEY_TWEAK_PENDING:return"TRANSFER_STATUS_SENDER_KEY_TWEAK_PENDING";case q.TRANSFER_STATUS_SENDER_KEY_TWEAKED:return"TRANSFER_STATUS_SENDER_KEY_TWEAKED";case q.TRANSFER_STATUS_RECEIVER_KEY_TWEAKED:return"TRANSFER_STATUS_RECEIVER_KEY_TWEAKED";case q.TRANSFER_STATUS_RECEIVER_REFUND_SIGNED:return"TRANSFER_STATUS_RECEIVER_REFUND_SIGNED";case q.TRANSFER_STATUS_COMPLETED:return"TRANSFER_STATUS_COMPLETED";case q.TRANSFER_STATUS_EXPIRED:return"TRANSFER_STATUS_EXPIRED";case q.TRANSFER_STATUS_RETURNED:return"TRANSFER_STATUS_RETURNED";case q.TRANSFER_STATUS_SENDER_INITIATED_COORDINATOR:return"TRANSFER_STATUS_SENDER_INITIATED_COORDINATOR";case q.TRANSFER_STATUS_RECEIVER_KEY_TWEAK_LOCKED:return"TRANSFER_STATUS_RECEIVER_KEY_TWEAK_LOCKED";case q.TRANSFER_STATUS_RECEIVER_KEY_TWEAK_APPLIED:return"TRANSFER_STATUS_RECEIVER_KEY_TWEAK_APPLIED";case q.TRANSFER_STATUS_APPLYING_SENDER_KEY_TWEAK:return"TRANSFER_STATUS_APPLYING_SENDER_KEY_TWEAK";case q.UNRECOGNIZED:default:return"UNRECOGNIZED"}}let v=function(A){return A[A.TRANSFER_RECEIVER_STATUS_INITIATED=0]="TRANSFER_RECEIVER_STATUS_INITIATED",A[A.TRANSFER_RECEIVER_STATUS_CLAIM_PENDING=1]="TRANSFER_RECEIVER_STATUS_CLAIM_PENDING",A[A.TRANSFER_RECEIVER_STATUS_KEY_TWEAKED=2]="TRANSFER_RECEIVER_STATUS_KEY_TWEAKED",A[A.TRANSFER_RECEIVER_STATUS_KEY_TWEAK_LOCKED=3]="TRANSFER_RECEIVER_STATUS_KEY_TWEAK_LOCKED",A[A.TRANSFER_RECEIVER_STATUS_KEY_TWEAK_APPLIED=4]="TRANSFER_RECEIVER_STATUS_KEY_TWEAK_APPLIED",A[A.TRANSFER_RECEIVER_STATUS_REFUND_SIGNED=5]="TRANSFER_RECEIVER_STATUS_REFUND_SIGNED",A[A.TRANSFER_RECEIVER_STATUS_COMPLETED=6]="TRANSFER_RECEIVER_STATUS_COMPLETED",A[A.TRANSFER_RECEIVER_STATUS_CANCELLED=7]="TRANSFER_RECEIVER_STATUS_CANCELLED",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED",A}({});function Z(A){switch(A){case 0:case"TRANSFER_RECEIVER_STATUS_INITIATED":return v.TRANSFER_RECEIVER_STATUS_INITIATED;case 1:case"TRANSFER_RECEIVER_STATUS_CLAIM_PENDING":return v.TRANSFER_RECEIVER_STATUS_CLAIM_PENDING;case 2:case"TRANSFER_RECEIVER_STATUS_KEY_TWEAKED":return v.TRANSFER_RECEIVER_STATUS_KEY_TWEAKED;case 3:case"TRANSFER_RECEIVER_STATUS_KEY_TWEAK_LOCKED":return v.TRANSFER_RECEIVER_STATUS_KEY_TWEAK_LOCKED;case 4:case"TRANSFER_RECEIVER_STATUS_KEY_TWEAK_APPLIED":return v.TRANSFER_RECEIVER_STATUS_KEY_TWEAK_APPLIED;case 5:case"TRANSFER_RECEIVER_STATUS_REFUND_SIGNED":return v.TRANSFER_RECEIVER_STATUS_REFUND_SIGNED;case 6:case"TRANSFER_RECEIVER_STATUS_COMPLETED":return v.TRANSFER_RECEIVER_STATUS_COMPLETED;case 7:case"TRANSFER_RECEIVER_STATUS_CANCELLED":return v.TRANSFER_RECEIVER_STATUS_CANCELLED;default:return v.UNRECOGNIZED}}let x=function(A){return A[A.PREIMAGE_SWAP=0]="PREIMAGE_SWAP",A[A.COOPERATIVE_EXIT=1]="COOPERATIVE_EXIT",A[A.TRANSFER=2]="TRANSFER",A[A.UTXO_SWAP=3]="UTXO_SWAP",A[A.SWAP=30]="SWAP",A[A.COUNTER_SWAP=40]="COUNTER_SWAP",A[A.PRIMARY_SWAP_V3=4]="PRIMARY_SWAP_V3",A[A.COUNTER_SWAP_V3=5]="COUNTER_SWAP_V3",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED",A}({});function W(A){switch(A){case 0:case"PREIMAGE_SWAP":return x.PREIMAGE_SWAP;case 1:case"COOPERATIVE_EXIT":return x.COOPERATIVE_EXIT;case 2:case"TRANSFER":return x.TRANSFER;case 3:case"UTXO_SWAP":return x.UTXO_SWAP;case 30:case"SWAP":return x.SWAP;case 40:case"COUNTER_SWAP":return x.COUNTER_SWAP;case 4:case"PRIMARY_SWAP_V3":return x.PRIMARY_SWAP_V3;case 5:case"COUNTER_SWAP_V3":return x.COUNTER_SWAP_V3;default:return x.UNRECOGNIZED}}function P(A){switch(A){case x.PREIMAGE_SWAP:return"PREIMAGE_SWAP";case x.COOPERATIVE_EXIT:return"COOPERATIVE_EXIT";case x.TRANSFER:return"TRANSFER";case x.UTXO_SWAP:return"UTXO_SWAP";case x.SWAP:return"SWAP";case x.COUNTER_SWAP:return"COUNTER_SWAP";case x.PRIMARY_SWAP_V3:return"PRIMARY_SWAP_V3";case x.COUNTER_SWAP_V3:return"COUNTER_SWAP_V3";case x.UNRECOGNIZED:default:return"UNRECOGNIZED"}}let O=function(A){return A[A.DESCENDING=0]="DESCENDING",A[A.ASCENDING=1]="ASCENDING",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED",A}({});function X(A){switch(A){case 0:case"DESCENDING":return O.DESCENDING;case 1:case"ASCENDING":return O.ASCENDING;default:return O.UNRECOGNIZED}}function j(A){switch(A){case O.DESCENDING:return"DESCENDING";case O.ASCENDING:return"ASCENDING";case O.UNRECOGNIZED:default:return"UNRECOGNIZED"}}let z=function(A){return A[A.PREIMAGE_REQUEST_STATUS_WAITING_FOR_PREIMAGE=0]="PREIMAGE_REQUEST_STATUS_WAITING_FOR_PREIMAGE",A[A.PREIMAGE_REQUEST_STATUS_PREIMAGE_SHARED=1]="PREIMAGE_REQUEST_STATUS_PREIMAGE_SHARED",A[A.PREIMAGE_REQUEST_STATUS_RETURNED=2]="PREIMAGE_REQUEST_STATUS_RETURNED",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED",A}({});function _(A){switch(A){case 0:case"PREIMAGE_REQUEST_STATUS_WAITING_FOR_PREIMAGE":return z.PREIMAGE_REQUEST_STATUS_WAITING_FOR_PREIMAGE;case 1:case"PREIMAGE_REQUEST_STATUS_PREIMAGE_SHARED":return z.PREIMAGE_REQUEST_STATUS_PREIMAGE_SHARED;case 2:case"PREIMAGE_REQUEST_STATUS_RETURNED":return z.PREIMAGE_REQUEST_STATUS_RETURNED;default:return z.UNRECOGNIZED}}function $(A){switch(A){case z.PREIMAGE_REQUEST_STATUS_WAITING_FOR_PREIMAGE:return"PREIMAGE_REQUEST_STATUS_WAITING_FOR_PREIMAGE";case z.PREIMAGE_REQUEST_STATUS_PREIMAGE_SHARED:return"PREIMAGE_REQUEST_STATUS_PREIMAGE_SHARED";case z.PREIMAGE_REQUEST_STATUS_RETURNED:return"PREIMAGE_REQUEST_STATUS_RETURNED";case z.UNRECOGNIZED:default:return"UNRECOGNIZED"}}let AA=function(A){return A[A.PREIMAGE_REQUEST_ROLE_RECEIVER=0]="PREIMAGE_REQUEST_ROLE_RECEIVER",A[A.PREIMAGE_REQUEST_ROLE_SENDER=1]="PREIMAGE_REQUEST_ROLE_SENDER",A[A.PREIMAGE_REQUEST_ROLE_RECEIVER_AND_SENDER=2]="PREIMAGE_REQUEST_ROLE_RECEIVER_AND_SENDER",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED",A}({});function IA(A){switch(A){case 0:case"PREIMAGE_REQUEST_ROLE_RECEIVER":return AA.PREIMAGE_REQUEST_ROLE_RECEIVER;case 1:case"PREIMAGE_REQUEST_ROLE_SENDER":return AA.PREIMAGE_REQUEST_ROLE_SENDER;case 2:case"PREIMAGE_REQUEST_ROLE_RECEIVER_AND_SENDER":return AA.PREIMAGE_REQUEST_ROLE_RECEIVER_AND_SENDER;default:return AA.UNRECOGNIZED}}let gA=function(A){return A[A.Fixed=0]="Fixed",A[A.MaxFee=1]="MaxFee",A[A.Refund=2]="Refund",A[A.Instant=3]="Instant",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED",A}({}),CA=function(A){return A[A.HASH_VARIANT_UNSPECIFIED=0]="HASH_VARIANT_UNSPECIFIED",A[A.HASH_VARIANT_V2=1]="HASH_VARIANT_V2",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED",A}({});function BA(A){switch(A){case 0:case"HASH_VARIANT_UNSPECIFIED":return CA.HASH_VARIANT_UNSPECIFIED;case 1:case"HASH_VARIANT_V2":return CA.HASH_VARIANT_V2;default:return CA.UNRECOGNIZED}}function iA(A){switch(A){case CA.HASH_VARIANT_UNSPECIFIED:return"HASH_VARIANT_UNSPECIFIED";case CA.HASH_VARIANT_V2:return"HASH_VARIANT_V2";case CA.UNRECOGNIZED:default:return"UNRECOGNIZED"}}let QA=function(A){return A[A.NOT_FOUND=0]="NOT_FOUND",A[A.PENDING=1]="PENDING",A[A.FINALIZED=2]="FINALIZED",A[A.RETURNED=4]="RETURNED",A[A.MISMATCHED_INVOICE_FINALIZED=5]="MISMATCHED_INVOICE_FINALIZED",A[A.MISMATCHED_INVOICE_PENDING=6]="MISMATCHED_INVOICE_PENDING",A[A.MISMATCHED_INVOICE_RETURNED=7]="MISMATCHED_INVOICE_RETURNED",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED",A}({});function eA(A){switch(A){case 0:case"NOT_FOUND":return QA.NOT_FOUND;case 1:case"PENDING":return QA.PENDING;case 2:case"FINALIZED":return QA.FINALIZED;case 4:case"RETURNED":return QA.RETURNED;case 5:case"MISMATCHED_INVOICE_FINALIZED":return QA.MISMATCHED_INVOICE_FINALIZED;case 6:case"MISMATCHED_INVOICE_PENDING":return QA.MISMATCHED_INVOICE_PENDING;case 7:case"MISMATCHED_INVOICE_RETURNED":return QA.MISMATCHED_INVOICE_RETURNED;default:return QA.UNRECOGNIZED}}let EA=function(A){return A[A.TREE_NODE_STATUS_CREATING=0]="TREE_NODE_STATUS_CREATING",A[A.TREE_NODE_STATUS_AVAILABLE=1]="TREE_NODE_STATUS_AVAILABLE",A[A.TREE_NODE_STATUS_FROZEN_BY_ISSUER=2]="TREE_NODE_STATUS_FROZEN_BY_ISSUER",A[A.TREE_NODE_STATUS_TRANSFER_LOCKED=3]="TREE_NODE_STATUS_TRANSFER_LOCKED",A[A.TREE_NODE_STATUS_SPLIT_LOCKED=4]="TREE_NODE_STATUS_SPLIT_LOCKED",A[A.TREE_NODE_STATUS_SPLITTED=5]="TREE_NODE_STATUS_SPLITTED",A[A.TREE_NODE_STATUS_AGGREGATED=6]="TREE_NODE_STATUS_AGGREGATED",A[A.TREE_NODE_STATUS_ON_CHAIN=7]="TREE_NODE_STATUS_ON_CHAIN",A[A.TREE_NODE_STATUS_AGGREGATE_LOCK=8]="TREE_NODE_STATUS_AGGREGATE_LOCK",A[A.TREE_NODE_STATUS_EXITED=9]="TREE_NODE_STATUS_EXITED",A[A.TREE_NODE_STATUS_RENEW_LOCKED=10]="TREE_NODE_STATUS_RENEW_LOCKED",A[A.TREE_NODE_STATUS_UNAVAILABLE=11]="TREE_NODE_STATUS_UNAVAILABLE",A[A.TREE_NODE_STATUS_PARENT_EXITED=12]="TREE_NODE_STATUS_PARENT_EXITED",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED",A}({});function tA(A){switch(A){case 0:case"TREE_NODE_STATUS_CREATING":return EA.TREE_NODE_STATUS_CREATING;case 1:case"TREE_NODE_STATUS_AVAILABLE":return EA.TREE_NODE_STATUS_AVAILABLE;case 2:case"TREE_NODE_STATUS_FROZEN_BY_ISSUER":return EA.TREE_NODE_STATUS_FROZEN_BY_ISSUER;case 3:case"TREE_NODE_STATUS_TRANSFER_LOCKED":return EA.TREE_NODE_STATUS_TRANSFER_LOCKED;case 4:case"TREE_NODE_STATUS_SPLIT_LOCKED":return EA.TREE_NODE_STATUS_SPLIT_LOCKED;case 5:case"TREE_NODE_STATUS_SPLITTED":return EA.TREE_NODE_STATUS_SPLITTED;case 6:case"TREE_NODE_STATUS_AGGREGATED":return EA.TREE_NODE_STATUS_AGGREGATED;case 7:case"TREE_NODE_STATUS_ON_CHAIN":return EA.TREE_NODE_STATUS_ON_CHAIN;case 8:case"TREE_NODE_STATUS_AGGREGATE_LOCK":return EA.TREE_NODE_STATUS_AGGREGATE_LOCK;case 9:case"TREE_NODE_STATUS_EXITED":return EA.TREE_NODE_STATUS_EXITED;case 10:case"TREE_NODE_STATUS_RENEW_LOCKED":return EA.TREE_NODE_STATUS_RENEW_LOCKED;case 11:case"TREE_NODE_STATUS_UNAVAILABLE":return EA.TREE_NODE_STATUS_UNAVAILABLE;case 12:case"TREE_NODE_STATUS_PARENT_EXITED":return EA.TREE_NODE_STATUS_PARENT_EXITED;default:return EA.UNRECOGNIZED}}function oA(A){switch(A){case EA.TREE_NODE_STATUS_CREATING:return"TREE_NODE_STATUS_CREATING";case EA.TREE_NODE_STATUS_AVAILABLE:return"TREE_NODE_STATUS_AVAILABLE";case EA.TREE_NODE_STATUS_FROZEN_BY_ISSUER:return"TREE_NODE_STATUS_FROZEN_BY_ISSUER";case EA.TREE_NODE_STATUS_TRANSFER_LOCKED:return"TREE_NODE_STATUS_TRANSFER_LOCKED";case EA.TREE_NODE_STATUS_SPLIT_LOCKED:return"TREE_NODE_STATUS_SPLIT_LOCKED";case EA.TREE_NODE_STATUS_SPLITTED:return"TREE_NODE_STATUS_SPLITTED";case EA.TREE_NODE_STATUS_AGGREGATED:return"TREE_NODE_STATUS_AGGREGATED";case EA.TREE_NODE_STATUS_ON_CHAIN:return"TREE_NODE_STATUS_ON_CHAIN";case EA.TREE_NODE_STATUS_AGGREGATE_LOCK:return"TREE_NODE_STATUS_AGGREGATE_LOCK";case EA.TREE_NODE_STATUS_EXITED:return"TREE_NODE_STATUS_EXITED";case EA.TREE_NODE_STATUS_RENEW_LOCKED:return"TREE_NODE_STATUS_RENEW_LOCKED";case EA.TREE_NODE_STATUS_UNAVAILABLE:return"TREE_NODE_STATUS_UNAVAILABLE";case EA.TREE_NODE_STATUS_PARENT_EXITED:return"TREE_NODE_STATUS_PARENT_EXITED";case EA.UNRECOGNIZED:default:return"UNRECOGNIZED"}}let nA=function(A){return A[A.REASON_SEND=0]="REASON_SEND",A[A.REASON_RECEIVE=1]="REASON_RECEIVE",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED",A}({});function aA(A){switch(A){case 0:case"REASON_SEND":return nA.REASON_SEND;case 1:case"REASON_RECEIVE":return nA.REASON_RECEIVE;default:return nA.UNRECOGNIZED}}function sA(){return{identityPublicKey:new Uint8Array(0)}}const rA={encode:(A,I=new y)=>(0!==A.identityPublicKey.length&&I.uint32(82).bytes(A.identityPublicKey),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=sA();for(;g.pos >>3){case 10:if(82!==A)break;B.identityPublicKey=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0)}),toJSON(A){const I={};return 0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),I},create:A=>rA.fromPartial(A??{}),fromPartial(A){const I=sA();return I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I}},cA={encode(A,I=new y){switch(A.event?.$case){case"receiverTransfer":yA.encode(A.event.receiverTransfer,I.uint32(10).fork()).join();break;case"deposit":lA.encode(A.event.deposit,I.uint32(18).fork()).join();break;case"connected":dA.encode(A.event.connected,I.uint32(26).fork()).join();break;case"senderTransfer":yA.encode(A.event.senderTransfer,I.uint32(34).fork()).join();break;case"heartbeat":hA.encode(A.event.heartbeat,I.uint32(42).fork()).join();break;case"tokenTransaction":wA.encode(A.event.tokenTransaction,I.uint32(50).fork()).join()}return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={event:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.event={$case:"receiverTransfer",receiverTransfer:yA.decode(g,g.uint32())};continue;case 2:if(18!==A)break;B.event={$case:"deposit",deposit:lA.decode(g,g.uint32())};continue;case 3:if(26!==A)break;B.event={$case:"connected",connected:dA.decode(g,g.uint32())};continue;case 4:if(34!==A)break;B.event={$case:"senderTransfer",senderTransfer:yA.decode(g,g.uint32())};continue;case 5:if(42!==A)break;B.event={$case:"heartbeat",heartbeat:hA.decode(g,g.uint32())};continue;case 6:if(50!==A)break;B.event={$case:"tokenTransaction",tokenTransaction:wA.decode(g,g.uint32())};continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({event:lB(A.transfer)?{$case:"receiverTransfer",receiverTransfer:yA.fromJSON(A.transfer)}:lB(A.deposit)?{$case:"deposit",deposit:lA.fromJSON(A.deposit)}:lB(A.connected)?{$case:"connected",connected:dA.fromJSON(A.connected)}:lB(A.senderTransfer)?{$case:"senderTransfer",senderTransfer:yA.fromJSON(A.senderTransfer)}:lB(A.heartbeat)?{$case:"heartbeat",heartbeat:hA.fromJSON(A.heartbeat)}:lB(A.tokenTransaction)?{$case:"tokenTransaction",tokenTransaction:wA.fromJSON(A.tokenTransaction)}:void 0}),toJSON(A){const I={};return"receiverTransfer"===A.event?.$case?I.transfer=yA.toJSON(A.event.receiverTransfer):"deposit"===A.event?.$case?I.deposit=lA.toJSON(A.event.deposit):"connected"===A.event?.$case?I.connected=dA.toJSON(A.event.connected):"senderTransfer"===A.event?.$case?I.senderTransfer=yA.toJSON(A.event.senderTransfer):"heartbeat"===A.event?.$case?I.heartbeat=hA.toJSON(A.event.heartbeat):"tokenTransaction"===A.event?.$case&&(I.tokenTransaction=wA.toJSON(A.event.tokenTransaction)),I},create:A=>cA.fromPartial(A??{}),fromPartial(A){const I={event:void 0};switch(A.event?.$case){case"receiverTransfer":void 0!==A.event?.receiverTransfer&&null!==A.event?.receiverTransfer&&(I.event={$case:"receiverTransfer",receiverTransfer:yA.fromPartial(A.event.receiverTransfer)});break;case"deposit":void 0!==A.event?.deposit&&null!==A.event?.deposit&&(I.event={$case:"deposit",deposit:lA.fromPartial(A.event.deposit)});break;case"connected":void 0!==A.event?.connected&&null!==A.event?.connected&&(I.event={$case:"connected",connected:dA.fromPartial(A.event.connected)});break;case"senderTransfer":void 0!==A.event?.senderTransfer&&null!==A.event?.senderTransfer&&(I.event={$case:"senderTransfer",senderTransfer:yA.fromPartial(A.event.senderTransfer)});break;case"heartbeat":void 0!==A.event?.heartbeat&&null!==A.event?.heartbeat&&(I.event={$case:"heartbeat",heartbeat:hA.fromPartial(A.event.heartbeat)});break;case"tokenTransaction":void 0!==A.event?.tokenTransaction&&null!==A.event?.tokenTransaction&&(I.event={$case:"tokenTransaction",tokenTransaction:wA.fromPartial(A.event.tokenTransaction)})}return I}};function DA(){return{tokenTransactionHash:new Uint8Array(0),tokenIdentifiers:[],sparkInvoices:[]}}const wA={encode(A,I=new y){0!==A.tokenTransactionHash.length&&I.uint32(10).bytes(A.tokenTransactionHash);for(const g of A.tokenIdentifiers)I.uint32(18).bytes(g);for(const g of A.sparkInvoices)I.uint32(26).string(g);return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=DA();for(;g.pos >>3){case 1:if(10!==A)break;B.tokenTransactionHash=g.bytes();continue;case 2:if(18!==A)break;B.tokenIdentifiers.push(g.bytes());continue;case 3:if(26!==A)break;B.sparkInvoices.push(g.string());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({tokenTransactionHash:lB(A.tokenTransactionHash)?rB(A.tokenTransactionHash):new Uint8Array(0),tokenIdentifiers:globalThis.Array.isArray(A?.tokenIdentifiers)?A.tokenIdentifiers.map(A=>rB(A)):[],sparkInvoices:globalThis.Array.isArray(A?.sparkInvoices)?A.sparkInvoices.map(A=>globalThis.String(A)):[]}),toJSON(A){const I={};return 0!==A.tokenTransactionHash.length&&(I.tokenTransactionHash=cB(A.tokenTransactionHash)),A.tokenIdentifiers?.length&&(I.tokenIdentifiers=A.tokenIdentifiers.map(A=>cB(A))),A.sparkInvoices?.length&&(I.sparkInvoices=A.sparkInvoices),I},create:A=>wA.fromPartial(A??{}),fromPartial(A){const I=DA();return I.tokenTransactionHash=A.tokenTransactionHash??new Uint8Array(0),I.tokenIdentifiers=A.tokenIdentifiers?.map(A=>A)||[],I.sparkInvoices=A.sparkInvoices?.map(A=>A)||[],I}},dA={encode:(A,I=new y)=>I,decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I;for(;g.pos ({}),toJSON:A=>({}),create:A=>dA.fromPartial(A??{}),fromPartial:A=>({})},hA={encode:(A,I=new y)=>I,decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I;for(;g.pos ({}),toJSON:A=>({}),create:A=>hA.fromPartial(A??{}),fromPartial:A=>({})},yA={encode:(A,I=new y)=>(void 0!==A.transfer&&Bg.encode(A.transfer,I.uint32(82).fork()).join(),""!==A.traceId&&I.uint32(90).string(A.traceId),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={transfer:void 0,traceId:""};for(;g.pos >>3){case 10:if(82!==A)break;B.transfer=Bg.decode(g,g.uint32());continue;case 11:if(90!==A)break;B.traceId=g.string();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transfer:lB(A.transfer)?Bg.fromJSON(A.transfer):void 0,traceId:lB(A.traceId)?globalThis.String(A.traceId):""}),toJSON(A){const I={};return void 0!==A.transfer&&(I.transfer=Bg.toJSON(A.transfer)),""!==A.traceId&&(I.traceId=A.traceId),I},create:A=>yA.fromPartial(A??{}),fromPartial(A){const I={transfer:void 0,traceId:""};return I.transfer=void 0!==A.transfer&&null!==A.transfer?Bg.fromPartial(A.transfer):void 0,I.traceId=A.traceId??"",I}},lA={encode:(A,I=new y)=>(void 0!==A.deposit&&hI.encode(A.deposit,I.uint32(82).fork()).join(),""!==A.traceId&&I.uint32(90).string(A.traceId),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={deposit:void 0,traceId:""};for(;g.pos >>3){case 10:if(82!==A)break;B.deposit=hI.decode(g,g.uint32());continue;case 11:if(90!==A)break;B.traceId=g.string();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({deposit:lB(A.deposit)?hI.fromJSON(A.deposit):void 0,traceId:lB(A.traceId)?globalThis.String(A.traceId):""}),toJSON(A){const I={};return void 0!==A.deposit&&(I.deposit=hI.toJSON(A.deposit)),""!==A.traceId&&(I.traceId=A.traceId),I},create:A=>lA.fromPartial(A??{}),fromPartial(A){const I={deposit:void 0,traceId:""};return I.deposit=void 0!==A.deposit&&null!==A.deposit?hI.fromPartial(A.deposit):void 0,I.traceId=A.traceId??"",I}},kA={encode:(A,I=new y)=>(0!==A.unsafePageSize&&I.uint32(8).int32(A.unsafePageSize),0!==A.pageSize&&I.uint32(32).uint32(A.pageSize),""!==A.cursor&&I.uint32(18).string(A.cursor),0!==A.direction&&I.uint32(24).int32(A.direction),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={unsafePageSize:0,pageSize:0,cursor:"",direction:0};for(;g.pos >>3){case 1:if(8!==A)break;B.unsafePageSize=g.int32();continue;case 4:if(32!==A)break;B.pageSize=g.uint32();continue;case 2:if(18!==A)break;B.cursor=g.string();continue;case 3:if(24!==A)break;B.direction=g.int32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({unsafePageSize:lB(A.unsafePageSize)?globalThis.Number(A.unsafePageSize):0,pageSize:lB(A.pageSize)?globalThis.Number(A.pageSize):0,cursor:lB(A.cursor)?globalThis.String(A.cursor):"",direction:lB(A.direction)?L(A.direction):0}),toJSON(A){const I={};return 0!==A.unsafePageSize&&(I.unsafePageSize=Math.round(A.unsafePageSize)),0!==A.pageSize&&(I.pageSize=Math.round(A.pageSize)),""!==A.cursor&&(I.cursor=A.cursor),0!==A.direction&&(I.direction=function(A){switch(A){case Y.NEXT:return"NEXT";case Y.PREVIOUS:return"PREVIOUS";case Y.UNRECOGNIZED:default:return"UNRECOGNIZED"}}(A.direction)),I},create:A=>kA.fromPartial(A??{}),fromPartial(A){const I={unsafePageSize:0,pageSize:0,cursor:"",direction:0};return I.unsafePageSize=A.unsafePageSize??0,I.pageSize=A.pageSize??0,I.cursor=A.cursor??"",I.direction=A.direction??0,I}},uA={encode:(A,I=new y)=>(!1!==A.hasNextPage&&I.uint32(8).bool(A.hasNextPage),!1!==A.hasPreviousPage&&I.uint32(16).bool(A.hasPreviousPage),""!==A.nextCursor&&I.uint32(26).string(A.nextCursor),""!==A.previousCursor&&I.uint32(34).string(A.previousCursor),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={hasNextPage:!1,hasPreviousPage:!1,nextCursor:"",previousCursor:""};for(;g.pos >>3){case 1:if(8!==A)break;B.hasNextPage=g.bool();continue;case 2:if(16!==A)break;B.hasPreviousPage=g.bool();continue;case 3:if(26!==A)break;B.nextCursor=g.string();continue;case 4:if(34!==A)break;B.previousCursor=g.string();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({hasNextPage:!!lB(A.hasNextPage)&&globalThis.Boolean(A.hasNextPage),hasPreviousPage:!!lB(A.hasPreviousPage)&&globalThis.Boolean(A.hasPreviousPage),nextCursor:lB(A.nextCursor)?globalThis.String(A.nextCursor):"",previousCursor:lB(A.previousCursor)?globalThis.String(A.previousCursor):""}),toJSON(A){const I={};return!1!==A.hasNextPage&&(I.hasNextPage=A.hasNextPage),!1!==A.hasPreviousPage&&(I.hasPreviousPage=A.hasPreviousPage),""!==A.nextCursor&&(I.nextCursor=A.nextCursor),""!==A.previousCursor&&(I.previousCursor=A.previousCursor),I},create:A=>uA.fromPartial(A??{}),fromPartial(A){const I={hasNextPage:!1,hasPreviousPage:!1,nextCursor:"",previousCursor:""};return I.hasNextPage=A.hasNextPage??!1,I.hasPreviousPage=A.hasPreviousPage??!1,I.nextCursor=A.nextCursor??"",I.previousCursor=A.previousCursor??"",I}};function NA(){return{addressSignatures:{},proofOfPossessionSignature:new Uint8Array(0)}}const GA={encode:(A,I=new y)=>(Object.entries(A.addressSignatures).forEach(([A,g])=>{SA.encode({key:A,value:g},I.uint32(10).fork()).join()}),0!==A.proofOfPossessionSignature.length&&I.uint32(18).bytes(A.proofOfPossessionSignature),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=NA();for(;g.pos >>3){case 1:{if(10!==A)break;const I=SA.decode(g,g.uint32());void 0!==I.value&&(B.addressSignatures[I.key]=I.value);continue}case 2:if(18!==A)break;B.proofOfPossessionSignature=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({addressSignatures:yB(A.addressSignatures)?Object.entries(A.addressSignatures).reduce((A,[I,g])=>(A[I]=rB(g),A),{}):{},proofOfPossessionSignature:lB(A.proofOfPossessionSignature)?rB(A.proofOfPossessionSignature):new Uint8Array(0)}),toJSON(A){const I={};if(A.addressSignatures){const g=Object.entries(A.addressSignatures);g.length>0&&(I.addressSignatures={},g.forEach(([A,g])=>{I.addressSignatures[A]=cB(g)}))}return 0!==A.proofOfPossessionSignature.length&&(I.proofOfPossessionSignature=cB(A.proofOfPossessionSignature)),I},create:A=>GA.fromPartial(A??{}),fromPartial(A){const I=NA();return I.addressSignatures=Object.entries(A.addressSignatures??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=g),A),{}),I.proofOfPossessionSignature=A.proofOfPossessionSignature??new Uint8Array(0),I}};function pA(){return{key:"",value:new Uint8Array(0)}}const SA={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),0!==A.value.length&&I.uint32(18).bytes(A.value),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=pA();for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?rB(A.value):new Uint8Array(0)}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),0!==A.value.length&&(I.value=cB(A.value)),I},create:A=>SA.fromPartial(A??{}),fromPartial(A){const I=pA();return I.key=A.key??"",I.value=A.value??new Uint8Array(0),I}};function fA(){return{signingPublicKey:new Uint8Array(0),identityPublicKey:new Uint8Array(0),network:0,leafId:void 0,isStatic:void 0,hashVariant:0}}const FA={encode:(A,I=new y)=>(0!==A.signingPublicKey.length&&I.uint32(10).bytes(A.signingPublicKey),0!==A.identityPublicKey.length&&I.uint32(18).bytes(A.identityPublicKey),0!==A.network&&I.uint32(24).int32(A.network),void 0!==A.leafId&&I.uint32(34).string(A.leafId),void 0!==A.isStatic&&I.uint32(40).bool(A.isStatic),0!==A.hashVariant&&I.uint32(48).int32(A.hashVariant),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=fA();for(;g.pos >>3){case 1:if(10!==A)break;B.signingPublicKey=g.bytes();continue;case 2:if(18!==A)break;B.identityPublicKey=g.bytes();continue;case 3:if(24!==A)break;B.network=g.int32();continue;case 4:if(34!==A)break;B.leafId=g.string();continue;case 5:if(40!==A)break;B.isStatic=g.bool();continue;case 6:if(48!==A)break;B.hashVariant=g.int32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({signingPublicKey:lB(A.signingPublicKey)?rB(A.signingPublicKey):new Uint8Array(0),identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0),network:lB(A.network)?b(A.network):0,leafId:lB(A.leafId)?globalThis.String(A.leafId):void 0,isStatic:lB(A.isStatic)?globalThis.Boolean(A.isStatic):void 0,hashVariant:lB(A.hashVariant)?BA(A.hashVariant):0}),toJSON(A){const I={};return 0!==A.signingPublicKey.length&&(I.signingPublicKey=cB(A.signingPublicKey)),0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),0!==A.network&&(I.network=H(A.network)),void 0!==A.leafId&&(I.leafId=A.leafId),void 0!==A.isStatic&&(I.isStatic=A.isStatic),0!==A.hashVariant&&(I.hashVariant=iA(A.hashVariant)),I},create:A=>FA.fromPartial(A??{}),fromPartial(A){const I=fA();return I.signingPublicKey=A.signingPublicKey??new Uint8Array(0),I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I.network=A.network??0,I.leafId=A.leafId??void 0,I.isStatic=A.isStatic??void 0,I.hashVariant=A.hashVariant??0,I}};function RA(){return{address:"",verifyingKey:new Uint8Array(0),depositAddressProof:void 0,isStatic:!1}}const UA={encode:(A,I=new y)=>(""!==A.address&&I.uint32(10).string(A.address),0!==A.verifyingKey.length&&I.uint32(18).bytes(A.verifyingKey),void 0!==A.depositAddressProof&&GA.encode(A.depositAddressProof,I.uint32(26).fork()).join(),!1!==A.isStatic&&I.uint32(40).bool(A.isStatic),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=RA();for(;g.pos >>3){case 1:if(10!==A)break;B.address=g.string();continue;case 2:if(18!==A)break;B.verifyingKey=g.bytes();continue;case 3:if(26!==A)break;B.depositAddressProof=GA.decode(g,g.uint32());continue;case 5:if(40!==A)break;B.isStatic=g.bool();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({address:lB(A.address)?globalThis.String(A.address):"",verifyingKey:lB(A.verifyingKey)?rB(A.verifyingKey):new Uint8Array(0),depositAddressProof:lB(A.depositAddressProof)?GA.fromJSON(A.depositAddressProof):void 0,isStatic:!!lB(A.isStatic)&&globalThis.Boolean(A.isStatic)}),toJSON(A){const I={};return""!==A.address&&(I.address=A.address),0!==A.verifyingKey.length&&(I.verifyingKey=cB(A.verifyingKey)),void 0!==A.depositAddressProof&&(I.depositAddressProof=GA.toJSON(A.depositAddressProof)),!1!==A.isStatic&&(I.isStatic=A.isStatic),I},create:A=>UA.fromPartial(A??{}),fromPartial(A){const I=RA();return I.address=A.address??"",I.verifyingKey=A.verifyingKey??new Uint8Array(0),I.depositAddressProof=void 0!==A.depositAddressProof&&null!==A.depositAddressProof?GA.fromPartial(A.depositAddressProof):void 0,I.isStatic=A.isStatic??!1,I}},MA={encode:(A,I=new y)=>(void 0!==A.depositAddress&&UA.encode(A.depositAddress,I.uint32(10).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={depositAddress:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.depositAddress=UA.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({depositAddress:lB(A.depositAddress)?UA.fromJSON(A.depositAddress):void 0}),toJSON(A){const I={};return void 0!==A.depositAddress&&(I.depositAddress=UA.toJSON(A.depositAddress)),I},create:A=>MA.fromPartial(A??{}),fromPartial(A){const I={depositAddress:void 0};return I.depositAddress=void 0!==A.depositAddress&&null!==A.depositAddress?UA.fromPartial(A.depositAddress):void 0,I}};function KA(){return{signingPublicKey:new Uint8Array(0),identityPublicKey:new Uint8Array(0),network:0,hashVariant:0}}const mA={encode:(A,I=new y)=>(0!==A.signingPublicKey.length&&I.uint32(10).bytes(A.signingPublicKey),0!==A.identityPublicKey.length&&I.uint32(18).bytes(A.identityPublicKey),0!==A.network&&I.uint32(24).int32(A.network),0!==A.hashVariant&&I.uint32(32).int32(A.hashVariant),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=KA();for(;g.pos >>3){case 1:if(10!==A)break;B.signingPublicKey=g.bytes();continue;case 2:if(18!==A)break;B.identityPublicKey=g.bytes();continue;case 3:if(24!==A)break;B.network=g.int32();continue;case 4:if(32!==A)break;B.hashVariant=g.int32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({signingPublicKey:lB(A.signingPublicKey)?rB(A.signingPublicKey):new Uint8Array(0),identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0),network:lB(A.network)?b(A.network):0,hashVariant:lB(A.hashVariant)?BA(A.hashVariant):0}),toJSON(A){const I={};return 0!==A.signingPublicKey.length&&(I.signingPublicKey=cB(A.signingPublicKey)),0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),0!==A.network&&(I.network=H(A.network)),0!==A.hashVariant&&(I.hashVariant=iA(A.hashVariant)),I},create:A=>mA.fromPartial(A??{}),fromPartial(A){const I=KA();return I.signingPublicKey=A.signingPublicKey??new Uint8Array(0),I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I.network=A.network??0,I.hashVariant=A.hashVariant??0,I}},JA={encode:(A,I=new y)=>(void 0!==A.depositAddress&&UA.encode(A.depositAddress,I.uint32(10).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={depositAddress:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.depositAddress=UA.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({depositAddress:lB(A.depositAddress)?UA.fromJSON(A.depositAddress):void 0}),toJSON(A){const I={};return void 0!==A.depositAddress&&(I.depositAddress=UA.toJSON(A.depositAddress)),I},create:A=>JA.fromPartial(A??{}),fromPartial(A){const I={depositAddress:void 0};return I.depositAddress=void 0!==A.depositAddress&&null!==A.depositAddress?UA.fromPartial(A.depositAddress):void 0,I}};function bA(){return{signingPublicKey:new Uint8Array(0),network:0,hashVariant:0}}const HA={encode:(A,I=new y)=>(0!==A.signingPublicKey.length&&I.uint32(10).bytes(A.signingPublicKey),0!==A.network&&I.uint32(16).int32(A.network),0!==A.hashVariant&&I.uint32(24).int32(A.hashVariant),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=bA();for(;g.pos >>3){case 1:if(10!==A)break;B.signingPublicKey=g.bytes();continue;case 2:if(16!==A)break;B.network=g.int32();continue;case 3:if(24!==A)break;B.hashVariant=g.int32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({signingPublicKey:lB(A.signingPublicKey)?rB(A.signingPublicKey):new Uint8Array(0),network:lB(A.network)?b(A.network):0,hashVariant:lB(A.hashVariant)?BA(A.hashVariant):0}),toJSON(A){const I={};return 0!==A.signingPublicKey.length&&(I.signingPublicKey=cB(A.signingPublicKey)),0!==A.network&&(I.network=H(A.network)),0!==A.hashVariant&&(I.hashVariant=iA(A.hashVariant)),I},create:A=>HA.fromPartial(A??{}),fromPartial(A){const I=bA();return I.signingPublicKey=A.signingPublicKey??new Uint8Array(0),I.network=A.network??0,I.hashVariant=A.hashVariant??0,I}},YA={encode:(A,I=new y)=>(void 0!==A.newDepositAddress&&UA.encode(A.newDepositAddress,I.uint32(10).fork()).join(),void 0!==A.archivedDepositAddress&&UA.encode(A.archivedDepositAddress,I.uint32(18).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={newDepositAddress:void 0,archivedDepositAddress:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.newDepositAddress=UA.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.archivedDepositAddress=UA.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({newDepositAddress:lB(A.newDepositAddress)?UA.fromJSON(A.newDepositAddress):void 0,archivedDepositAddress:lB(A.archivedDepositAddress)?UA.fromJSON(A.archivedDepositAddress):void 0}),toJSON(A){const I={};return void 0!==A.newDepositAddress&&(I.newDepositAddress=UA.toJSON(A.newDepositAddress)),void 0!==A.archivedDepositAddress&&(I.archivedDepositAddress=UA.toJSON(A.archivedDepositAddress)),I},create:A=>YA.fromPartial(A??{}),fromPartial(A){const I={newDepositAddress:void 0,archivedDepositAddress:void 0};return I.newDepositAddress=void 0!==A.newDepositAddress&&null!==A.newDepositAddress?UA.fromPartial(A.newDepositAddress):void 0,I.archivedDepositAddress=void 0!==A.archivedDepositAddress&&null!==A.archivedDepositAddress?UA.fromPartial(A.archivedDepositAddress):void 0,I}};function LA(){return{rawTx:new Uint8Array(0),vout:0,network:0,txid:new Uint8Array(0)}}const qA={encode:(A,I=new y)=>(0!==A.rawTx.length&&I.uint32(10).bytes(A.rawTx),0!==A.vout&&I.uint32(16).uint32(A.vout),0!==A.network&&I.uint32(24).int32(A.network),0!==A.txid.length&&I.uint32(34).bytes(A.txid),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=LA();for(;g.pos >>3){case 1:if(10!==A)break;B.rawTx=g.bytes();continue;case 2:if(16!==A)break;B.vout=g.uint32();continue;case 3:if(24!==A)break;B.network=g.int32();continue;case 4:if(34!==A)break;B.txid=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({rawTx:lB(A.rawTx)?rB(A.rawTx):new Uint8Array(0),vout:lB(A.vout)?globalThis.Number(A.vout):0,network:lB(A.network)?b(A.network):0,txid:lB(A.txid)?rB(A.txid):new Uint8Array(0)}),toJSON(A){const I={};return 0!==A.rawTx.length&&(I.rawTx=cB(A.rawTx)),0!==A.vout&&(I.vout=Math.round(A.vout)),0!==A.network&&(I.network=H(A.network)),0!==A.txid.length&&(I.txid=cB(A.txid)),I},create:A=>qA.fromPartial(A??{}),fromPartial(A){const I=LA();return I.rawTx=A.rawTx??new Uint8Array(0),I.vout=A.vout??0,I.network=A.network??0,I.txid=A.txid??new Uint8Array(0),I}},VA={encode:(A,I=new y)=>(""!==A.address&&I.uint32(10).string(A.address),void 0!==A.utxo&&qA.encode(A.utxo,I.uint32(18).fork()).join(),!1!==A.isConfirmed&&I.uint32(24).bool(A.isConfirmed),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={address:"",utxo:void 0,isConfirmed:!1};for(;g.pos >>3){case 1:if(10!==A)break;B.address=g.string();continue;case 2:if(18!==A)break;B.utxo=qA.decode(g,g.uint32());continue;case 3:if(24!==A)break;B.isConfirmed=g.bool();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({address:lB(A.address)?globalThis.String(A.address):"",utxo:lB(A.utxo)?qA.fromJSON(A.utxo):void 0,isConfirmed:!!lB(A.isConfirmed)&&globalThis.Boolean(A.isConfirmed)}),toJSON(A){const I={};return""!==A.address&&(I.address=A.address),void 0!==A.utxo&&(I.utxo=qA.toJSON(A.utxo)),!1!==A.isConfirmed&&(I.isConfirmed=A.isConfirmed),I},create:A=>VA.fromPartial(A??{}),fromPartial(A){const I={address:"",utxo:void 0,isConfirmed:!1};return I.address=A.address??"",I.utxo=void 0!==A.utxo&&null!==A.utxo?qA.fromPartial(A.utxo):void 0,I.isConfirmed=A.isConfirmed??!1,I}};function TA(){return{signingPublicKey:new Uint8Array(0),rawTx:new Uint8Array(0),signingNonceCommitment:void 0}}const vA={encode:(A,I=new y)=>(0!==A.signingPublicKey.length&&I.uint32(10).bytes(A.signingPublicKey),0!==A.rawTx.length&&I.uint32(18).bytes(A.rawTx),void 0!==A.signingNonceCommitment&&R.encode(A.signingNonceCommitment,I.uint32(26).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=TA();for(;g.pos >>3){case 1:if(10!==A)break;B.signingPublicKey=g.bytes();continue;case 2:if(18!==A)break;B.rawTx=g.bytes();continue;case 3:if(26!==A)break;B.signingNonceCommitment=R.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({signingPublicKey:lB(A.signingPublicKey)?rB(A.signingPublicKey):new Uint8Array(0),rawTx:lB(A.rawTx)?rB(A.rawTx):new Uint8Array(0),signingNonceCommitment:lB(A.signingNonceCommitment)?R.fromJSON(A.signingNonceCommitment):void 0}),toJSON(A){const I={};return 0!==A.signingPublicKey.length&&(I.signingPublicKey=cB(A.signingPublicKey)),0!==A.rawTx.length&&(I.rawTx=cB(A.rawTx)),void 0!==A.signingNonceCommitment&&(I.signingNonceCommitment=R.toJSON(A.signingNonceCommitment)),I},create:A=>vA.fromPartial(A??{}),fromPartial(A){const I=TA();return I.signingPublicKey=A.signingPublicKey??new Uint8Array(0),I.rawTx=A.rawTx??new Uint8Array(0),I.signingNonceCommitment=void 0!==A.signingNonceCommitment&&null!==A.signingNonceCommitment?R.fromPartial(A.signingNonceCommitment):void 0,I}};function ZA(){return{ownerIdentifiers:[],threshold:0,publicKey:new Uint8Array(0),publicShares:{},updatedTime:void 0}}const xA={encode(A,I=new y){for(const g of A.ownerIdentifiers)I.uint32(10).string(g);return 0!==A.threshold&&I.uint32(16).uint32(A.threshold),0!==A.publicKey.length&&I.uint32(26).bytes(A.publicKey),Object.entries(A.publicShares).forEach(([A,g])=>{PA.encode({key:A,value:g},I.uint32(34).fork()).join()}),void 0!==A.updatedTime&&N.encode(DB(A.updatedTime),I.uint32(42).fork()).join(),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=ZA();for(;g.pos >>3){case 1:if(10!==A)break;B.ownerIdentifiers.push(g.string());continue;case 2:if(16!==A)break;B.threshold=g.uint32();continue;case 3:if(26!==A)break;B.publicKey=g.bytes();continue;case 4:{if(34!==A)break;const I=PA.decode(g,g.uint32());void 0!==I.value&&(B.publicShares[I.key]=I.value);continue}case 5:if(42!==A)break;B.updatedTime=wB(N.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({ownerIdentifiers:globalThis.Array.isArray(A?.ownerIdentifiers)?A.ownerIdentifiers.map(A=>globalThis.String(A)):[],threshold:lB(A.threshold)?globalThis.Number(A.threshold):0,publicKey:lB(A.publicKey)?rB(A.publicKey):new Uint8Array(0),publicShares:yB(A.publicShares)?Object.entries(A.publicShares).reduce((A,[I,g])=>(A[I]=rB(g),A),{}):{},updatedTime:lB(A.updatedTime)?dB(A.updatedTime):void 0}),toJSON(A){const I={};if(A.ownerIdentifiers?.length&&(I.ownerIdentifiers=A.ownerIdentifiers),0!==A.threshold&&(I.threshold=Math.round(A.threshold)),0!==A.publicKey.length&&(I.publicKey=cB(A.publicKey)),A.publicShares){const g=Object.entries(A.publicShares);g.length>0&&(I.publicShares={},g.forEach(([A,g])=>{I.publicShares[A]=cB(g)}))}return void 0!==A.updatedTime&&(I.updatedTime=A.updatedTime.toISOString()),I},create:A=>xA.fromPartial(A??{}),fromPartial(A){const I=ZA();return I.ownerIdentifiers=A.ownerIdentifiers?.map(A=>A)||[],I.threshold=A.threshold??0,I.publicKey=A.publicKey??new Uint8Array(0),I.publicShares=Object.entries(A.publicShares??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=g),A),{}),I.updatedTime=A.updatedTime??void 0,I}};function WA(){return{key:"",value:new Uint8Array(0)}}const PA={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),0!==A.value.length&&I.uint32(18).bytes(A.value),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=WA();for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?rB(A.value):new Uint8Array(0)}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),0!==A.value.length&&(I.value=cB(A.value)),I},create:A=>PA.fromPartial(A??{}),fromPartial(A){const I=WA();return I.key=A.key??"",I.value=A.value??new Uint8Array(0),I}},OA={encode:(A,I=new y)=>(Object.entries(A.publicKeys).forEach(([A,g])=>{jA.encode({key:A,value:g},I.uint32(10).fork()).join()}),Object.entries(A.signingNonceCommitments).forEach(([A,g])=>{zA.encode({key:A,value:g},I.uint32(18).fork()).join()}),Object.entries(A.signatureShares).forEach(([A,g])=>{$A.encode({key:A,value:g},I.uint32(26).fork()).join()}),void 0!==A.signingKeyshare&&xA.encode(A.signingKeyshare,I.uint32(34).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={publicKeys:{},signingNonceCommitments:{},signatureShares:{},signingKeyshare:void 0};for(;g.pos >>3){case 1:{if(10!==A)break;const I=jA.decode(g,g.uint32());void 0!==I.value&&(B.publicKeys[I.key]=I.value);continue}case 2:{if(18!==A)break;const I=zA.decode(g,g.uint32());void 0!==I.value&&(B.signingNonceCommitments[I.key]=I.value);continue}case 3:{if(26!==A)break;const I=$A.decode(g,g.uint32());void 0!==I.value&&(B.signatureShares[I.key]=I.value);continue}case 4:if(34!==A)break;B.signingKeyshare=xA.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({publicKeys:yB(A.publicKeys)?Object.entries(A.publicKeys).reduce((A,[I,g])=>(A[I]=rB(g),A),{}):{},signingNonceCommitments:yB(A.signingNonceCommitments)?Object.entries(A.signingNonceCommitments).reduce((A,[I,g])=>(A[I]=R.fromJSON(g),A),{}):{},signatureShares:yB(A.signatureShares)?Object.entries(A.signatureShares).reduce((A,[I,g])=>(A[I]=rB(g),A),{}):{},signingKeyshare:lB(A.signingKeyshare)?xA.fromJSON(A.signingKeyshare):void 0}),toJSON(A){const I={};if(A.publicKeys){const g=Object.entries(A.publicKeys);g.length>0&&(I.publicKeys={},g.forEach(([A,g])=>{I.publicKeys[A]=cB(g)}))}if(A.signingNonceCommitments){const g=Object.entries(A.signingNonceCommitments);g.length>0&&(I.signingNonceCommitments={},g.forEach(([A,g])=>{I.signingNonceCommitments[A]=R.toJSON(g)}))}if(A.signatureShares){const g=Object.entries(A.signatureShares);g.length>0&&(I.signatureShares={},g.forEach(([A,g])=>{I.signatureShares[A]=cB(g)}))}return void 0!==A.signingKeyshare&&(I.signingKeyshare=xA.toJSON(A.signingKeyshare)),I},create:A=>OA.fromPartial(A??{}),fromPartial(A){const I={publicKeys:{},signingNonceCommitments:{},signatureShares:{},signingKeyshare:void 0};return I.publicKeys=Object.entries(A.publicKeys??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=g),A),{}),I.signingNonceCommitments=Object.entries(A.signingNonceCommitments??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=R.fromPartial(g)),A),{}),I.signatureShares=Object.entries(A.signatureShares??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=g),A),{}),I.signingKeyshare=void 0!==A.signingKeyshare&&null!==A.signingKeyshare?xA.fromPartial(A.signingKeyshare):void 0,I}};function XA(){return{key:"",value:new Uint8Array(0)}}const jA={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),0!==A.value.length&&I.uint32(18).bytes(A.value),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=XA();for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?rB(A.value):new Uint8Array(0)}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),0!==A.value.length&&(I.value=cB(A.value)),I},create:A=>jA.fromPartial(A??{}),fromPartial(A){const I=XA();return I.key=A.key??"",I.value=A.value??new Uint8Array(0),I}},zA={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),void 0!==A.value&&R.encode(A.value,I.uint32(18).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={key:"",value:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=R.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?R.fromJSON(A.value):void 0}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),void 0!==A.value&&(I.value=R.toJSON(A.value)),I},create:A=>zA.fromPartial(A??{}),fromPartial(A){const I={key:"",value:void 0};return I.key=A.key??"",I.value=void 0!==A.value&&null!==A.value?R.fromPartial(A.value):void 0,I}};function _A(){return{key:"",value:new Uint8Array(0)}}const $A={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),0!==A.value.length&&I.uint32(18).bytes(A.value),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=_A();for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?rB(A.value):new Uint8Array(0)}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),0!==A.value.length&&(I.value=cB(A.value)),I},create:A=>$A.fromPartial(A??{}),fromPartial(A){const I=_A();return I.key=A.key??"",I.value=A.value??new Uint8Array(0),I}},AI={encode(A,I=new y){switch(""!==A.leafId&&I.uint32(10).string(A.leafId),A.signingJobs?.$case){case"renewNodeTimelockSigningJob":II.encode(A.signingJobs.renewNodeTimelockSigningJob,I.uint32(18).fork()).join();break;case"renewRefundTimelockSigningJob":gI.encode(A.signingJobs.renewRefundTimelockSigningJob,I.uint32(26).fork()).join();break;case"renewNodeZeroTimelockSigningJob":CI.encode(A.signingJobs.renewNodeZeroTimelockSigningJob,I.uint32(34).fork()).join()}return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={leafId:"",signingJobs:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.leafId=g.string();continue;case 2:if(18!==A)break;B.signingJobs={$case:"renewNodeTimelockSigningJob",renewNodeTimelockSigningJob:II.decode(g,g.uint32())};continue;case 3:if(26!==A)break;B.signingJobs={$case:"renewRefundTimelockSigningJob",renewRefundTimelockSigningJob:gI.decode(g,g.uint32())};continue;case 4:if(34!==A)break;B.signingJobs={$case:"renewNodeZeroTimelockSigningJob",renewNodeZeroTimelockSigningJob:CI.decode(g,g.uint32())};continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({leafId:lB(A.leafId)?globalThis.String(A.leafId):"",signingJobs:lB(A.renewNodeTimelockSigningJob)?{$case:"renewNodeTimelockSigningJob",renewNodeTimelockSigningJob:II.fromJSON(A.renewNodeTimelockSigningJob)}:lB(A.renewRefundTimelockSigningJob)?{$case:"renewRefundTimelockSigningJob",renewRefundTimelockSigningJob:gI.fromJSON(A.renewRefundTimelockSigningJob)}:lB(A.renewNodeZeroTimelockSigningJob)?{$case:"renewNodeZeroTimelockSigningJob",renewNodeZeroTimelockSigningJob:CI.fromJSON(A.renewNodeZeroTimelockSigningJob)}:void 0}),toJSON(A){const I={};return""!==A.leafId&&(I.leafId=A.leafId),"renewNodeTimelockSigningJob"===A.signingJobs?.$case?I.renewNodeTimelockSigningJob=II.toJSON(A.signingJobs.renewNodeTimelockSigningJob):"renewRefundTimelockSigningJob"===A.signingJobs?.$case?I.renewRefundTimelockSigningJob=gI.toJSON(A.signingJobs.renewRefundTimelockSigningJob):"renewNodeZeroTimelockSigningJob"===A.signingJobs?.$case&&(I.renewNodeZeroTimelockSigningJob=CI.toJSON(A.signingJobs.renewNodeZeroTimelockSigningJob)),I},create:A=>AI.fromPartial(A??{}),fromPartial(A){const I={leafId:"",signingJobs:void 0};switch(I.leafId=A.leafId??"",A.signingJobs?.$case){case"renewNodeTimelockSigningJob":void 0!==A.signingJobs?.renewNodeTimelockSigningJob&&null!==A.signingJobs?.renewNodeTimelockSigningJob&&(I.signingJobs={$case:"renewNodeTimelockSigningJob",renewNodeTimelockSigningJob:II.fromPartial(A.signingJobs.renewNodeTimelockSigningJob)});break;case"renewRefundTimelockSigningJob":void 0!==A.signingJobs?.renewRefundTimelockSigningJob&&null!==A.signingJobs?.renewRefundTimelockSigningJob&&(I.signingJobs={$case:"renewRefundTimelockSigningJob",renewRefundTimelockSigningJob:gI.fromPartial(A.signingJobs.renewRefundTimelockSigningJob)});break;case"renewNodeZeroTimelockSigningJob":void 0!==A.signingJobs?.renewNodeZeroTimelockSigningJob&&null!==A.signingJobs?.renewNodeZeroTimelockSigningJob&&(I.signingJobs={$case:"renewNodeZeroTimelockSigningJob",renewNodeZeroTimelockSigningJob:CI.fromPartial(A.signingJobs.renewNodeZeroTimelockSigningJob)})}return I}},II={encode:(A,I=new y)=>(void 0!==A.splitNodeTxSigningJob&&pI.encode(A.splitNodeTxSigningJob,I.uint32(10).fork()).join(),void 0!==A.splitNodeDirectTxSigningJob&&pI.encode(A.splitNodeDirectTxSigningJob,I.uint32(18).fork()).join(),void 0!==A.nodeTxSigningJob&&pI.encode(A.nodeTxSigningJob,I.uint32(26).fork()).join(),void 0!==A.refundTxSigningJob&&pI.encode(A.refundTxSigningJob,I.uint32(34).fork()).join(),void 0!==A.directNodeTxSigningJob&&pI.encode(A.directNodeTxSigningJob,I.uint32(42).fork()).join(),void 0!==A.directRefundTxSigningJob&&pI.encode(A.directRefundTxSigningJob,I.uint32(50).fork()).join(),void 0!==A.directFromCpfpRefundTxSigningJob&&pI.encode(A.directFromCpfpRefundTxSigningJob,I.uint32(58).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={splitNodeTxSigningJob:void 0,splitNodeDirectTxSigningJob:void 0,nodeTxSigningJob:void 0,refundTxSigningJob:void 0,directNodeTxSigningJob:void 0,directRefundTxSigningJob:void 0,directFromCpfpRefundTxSigningJob:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.splitNodeTxSigningJob=pI.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.splitNodeDirectTxSigningJob=pI.decode(g,g.uint32());continue;case 3:if(26!==A)break;B.nodeTxSigningJob=pI.decode(g,g.uint32());continue;case 4:if(34!==A)break;B.refundTxSigningJob=pI.decode(g,g.uint32());continue;case 5:if(42!==A)break;B.directNodeTxSigningJob=pI.decode(g,g.uint32());continue;case 6:if(50!==A)break;B.directRefundTxSigningJob=pI.decode(g,g.uint32());continue;case 7:if(58!==A)break;B.directFromCpfpRefundTxSigningJob=pI.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({splitNodeTxSigningJob:lB(A.splitNodeTxSigningJob)?pI.fromJSON(A.splitNodeTxSigningJob):void 0,splitNodeDirectTxSigningJob:lB(A.splitNodeDirectTxSigningJob)?pI.fromJSON(A.splitNodeDirectTxSigningJob):void 0,nodeTxSigningJob:lB(A.nodeTxSigningJob)?pI.fromJSON(A.nodeTxSigningJob):void 0,refundTxSigningJob:lB(A.refundTxSigningJob)?pI.fromJSON(A.refundTxSigningJob):void 0,directNodeTxSigningJob:lB(A.directNodeTxSigningJob)?pI.fromJSON(A.directNodeTxSigningJob):void 0,directRefundTxSigningJob:lB(A.directRefundTxSigningJob)?pI.fromJSON(A.directRefundTxSigningJob):void 0,directFromCpfpRefundTxSigningJob:lB(A.directFromCpfpRefundTxSigningJob)?pI.fromJSON(A.directFromCpfpRefundTxSigningJob):void 0}),toJSON(A){const I={};return void 0!==A.splitNodeTxSigningJob&&(I.splitNodeTxSigningJob=pI.toJSON(A.splitNodeTxSigningJob)),void 0!==A.splitNodeDirectTxSigningJob&&(I.splitNodeDirectTxSigningJob=pI.toJSON(A.splitNodeDirectTxSigningJob)),void 0!==A.nodeTxSigningJob&&(I.nodeTxSigningJob=pI.toJSON(A.nodeTxSigningJob)),void 0!==A.refundTxSigningJob&&(I.refundTxSigningJob=pI.toJSON(A.refundTxSigningJob)),void 0!==A.directNodeTxSigningJob&&(I.directNodeTxSigningJob=pI.toJSON(A.directNodeTxSigningJob)),void 0!==A.directRefundTxSigningJob&&(I.directRefundTxSigningJob=pI.toJSON(A.directRefundTxSigningJob)),void 0!==A.directFromCpfpRefundTxSigningJob&&(I.directFromCpfpRefundTxSigningJob=pI.toJSON(A.directFromCpfpRefundTxSigningJob)),I},create:A=>II.fromPartial(A??{}),fromPartial(A){const I={splitNodeTxSigningJob:void 0,splitNodeDirectTxSigningJob:void 0,nodeTxSigningJob:void 0,refundTxSigningJob:void 0,directNodeTxSigningJob:void 0,directRefundTxSigningJob:void 0,directFromCpfpRefundTxSigningJob:void 0};return I.splitNodeTxSigningJob=void 0!==A.splitNodeTxSigningJob&&null!==A.splitNodeTxSigningJob?pI.fromPartial(A.splitNodeTxSigningJob):void 0,I.splitNodeDirectTxSigningJob=void 0!==A.splitNodeDirectTxSigningJob&&null!==A.splitNodeDirectTxSigningJob?pI.fromPartial(A.splitNodeDirectTxSigningJob):void 0,I.nodeTxSigningJob=void 0!==A.nodeTxSigningJob&&null!==A.nodeTxSigningJob?pI.fromPartial(A.nodeTxSigningJob):void 0,I.refundTxSigningJob=void 0!==A.refundTxSigningJob&&null!==A.refundTxSigningJob?pI.fromPartial(A.refundTxSigningJob):void 0,I.directNodeTxSigningJob=void 0!==A.directNodeTxSigningJob&&null!==A.directNodeTxSigningJob?pI.fromPartial(A.directNodeTxSigningJob):void 0,I.directRefundTxSigningJob=void 0!==A.directRefundTxSigningJob&&null!==A.directRefundTxSigningJob?pI.fromPartial(A.directRefundTxSigningJob):void 0,I.directFromCpfpRefundTxSigningJob=void 0!==A.directFromCpfpRefundTxSigningJob&&null!==A.directFromCpfpRefundTxSigningJob?pI.fromPartial(A.directFromCpfpRefundTxSigningJob):void 0,I}},gI={encode:(A,I=new y)=>(void 0!==A.nodeTxSigningJob&&pI.encode(A.nodeTxSigningJob,I.uint32(10).fork()).join(),void 0!==A.refundTxSigningJob&&pI.encode(A.refundTxSigningJob,I.uint32(18).fork()).join(),void 0!==A.directNodeTxSigningJob&&pI.encode(A.directNodeTxSigningJob,I.uint32(26).fork()).join(),void 0!==A.directRefundTxSigningJob&&pI.encode(A.directRefundTxSigningJob,I.uint32(34).fork()).join(),void 0!==A.directFromCpfpRefundTxSigningJob&&pI.encode(A.directFromCpfpRefundTxSigningJob,I.uint32(42).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={nodeTxSigningJob:void 0,refundTxSigningJob:void 0,directNodeTxSigningJob:void 0,directRefundTxSigningJob:void 0,directFromCpfpRefundTxSigningJob:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.nodeTxSigningJob=pI.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.refundTxSigningJob=pI.decode(g,g.uint32());continue;case 3:if(26!==A)break;B.directNodeTxSigningJob=pI.decode(g,g.uint32());continue;case 4:if(34!==A)break;B.directRefundTxSigningJob=pI.decode(g,g.uint32());continue;case 5:if(42!==A)break;B.directFromCpfpRefundTxSigningJob=pI.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({nodeTxSigningJob:lB(A.nodeTxSigningJob)?pI.fromJSON(A.nodeTxSigningJob):void 0,refundTxSigningJob:lB(A.refundTxSigningJob)?pI.fromJSON(A.refundTxSigningJob):void 0,directNodeTxSigningJob:lB(A.directNodeTxSigningJob)?pI.fromJSON(A.directNodeTxSigningJob):void 0,directRefundTxSigningJob:lB(A.directRefundTxSigningJob)?pI.fromJSON(A.directRefundTxSigningJob):void 0,directFromCpfpRefundTxSigningJob:lB(A.directFromCpfpRefundTxSigningJob)?pI.fromJSON(A.directFromCpfpRefundTxSigningJob):void 0}),toJSON(A){const I={};return void 0!==A.nodeTxSigningJob&&(I.nodeTxSigningJob=pI.toJSON(A.nodeTxSigningJob)),void 0!==A.refundTxSigningJob&&(I.refundTxSigningJob=pI.toJSON(A.refundTxSigningJob)),void 0!==A.directNodeTxSigningJob&&(I.directNodeTxSigningJob=pI.toJSON(A.directNodeTxSigningJob)),void 0!==A.directRefundTxSigningJob&&(I.directRefundTxSigningJob=pI.toJSON(A.directRefundTxSigningJob)),void 0!==A.directFromCpfpRefundTxSigningJob&&(I.directFromCpfpRefundTxSigningJob=pI.toJSON(A.directFromCpfpRefundTxSigningJob)),I},create:A=>gI.fromPartial(A??{}),fromPartial(A){const I={nodeTxSigningJob:void 0,refundTxSigningJob:void 0,directNodeTxSigningJob:void 0,directRefundTxSigningJob:void 0,directFromCpfpRefundTxSigningJob:void 0};return I.nodeTxSigningJob=void 0!==A.nodeTxSigningJob&&null!==A.nodeTxSigningJob?pI.fromPartial(A.nodeTxSigningJob):void 0,I.refundTxSigningJob=void 0!==A.refundTxSigningJob&&null!==A.refundTxSigningJob?pI.fromPartial(A.refundTxSigningJob):void 0,I.directNodeTxSigningJob=void 0!==A.directNodeTxSigningJob&&null!==A.directNodeTxSigningJob?pI.fromPartial(A.directNodeTxSigningJob):void 0,I.directRefundTxSigningJob=void 0!==A.directRefundTxSigningJob&&null!==A.directRefundTxSigningJob?pI.fromPartial(A.directRefundTxSigningJob):void 0,I.directFromCpfpRefundTxSigningJob=void 0!==A.directFromCpfpRefundTxSigningJob&&null!==A.directFromCpfpRefundTxSigningJob?pI.fromPartial(A.directFromCpfpRefundTxSigningJob):void 0,I}},CI={encode:(A,I=new y)=>(void 0!==A.nodeTxSigningJob&&pI.encode(A.nodeTxSigningJob,I.uint32(10).fork()).join(),void 0!==A.refundTxSigningJob&&pI.encode(A.refundTxSigningJob,I.uint32(18).fork()).join(),void 0!==A.directNodeTxSigningJob&&pI.encode(A.directNodeTxSigningJob,I.uint32(26).fork()).join(),void 0!==A.directFromCpfpRefundTxSigningJob&&pI.encode(A.directFromCpfpRefundTxSigningJob,I.uint32(42).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={nodeTxSigningJob:void 0,refundTxSigningJob:void 0,directNodeTxSigningJob:void 0,directFromCpfpRefundTxSigningJob:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.nodeTxSigningJob=pI.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.refundTxSigningJob=pI.decode(g,g.uint32());continue;case 3:if(26!==A)break;B.directNodeTxSigningJob=pI.decode(g,g.uint32());continue;case 5:if(42!==A)break;B.directFromCpfpRefundTxSigningJob=pI.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({nodeTxSigningJob:lB(A.nodeTxSigningJob)?pI.fromJSON(A.nodeTxSigningJob):void 0,refundTxSigningJob:lB(A.refundTxSigningJob)?pI.fromJSON(A.refundTxSigningJob):void 0,directNodeTxSigningJob:lB(A.directNodeTxSigningJob)?pI.fromJSON(A.directNodeTxSigningJob):void 0,directFromCpfpRefundTxSigningJob:lB(A.directFromCpfpRefundTxSigningJob)?pI.fromJSON(A.directFromCpfpRefundTxSigningJob):void 0}),toJSON(A){const I={};return void 0!==A.nodeTxSigningJob&&(I.nodeTxSigningJob=pI.toJSON(A.nodeTxSigningJob)),void 0!==A.refundTxSigningJob&&(I.refundTxSigningJob=pI.toJSON(A.refundTxSigningJob)),void 0!==A.directNodeTxSigningJob&&(I.directNodeTxSigningJob=pI.toJSON(A.directNodeTxSigningJob)),void 0!==A.directFromCpfpRefundTxSigningJob&&(I.directFromCpfpRefundTxSigningJob=pI.toJSON(A.directFromCpfpRefundTxSigningJob)),I},create:A=>CI.fromPartial(A??{}),fromPartial(A){const I={nodeTxSigningJob:void 0,refundTxSigningJob:void 0,directNodeTxSigningJob:void 0,directFromCpfpRefundTxSigningJob:void 0};return I.nodeTxSigningJob=void 0!==A.nodeTxSigningJob&&null!==A.nodeTxSigningJob?pI.fromPartial(A.nodeTxSigningJob):void 0,I.refundTxSigningJob=void 0!==A.refundTxSigningJob&&null!==A.refundTxSigningJob?pI.fromPartial(A.refundTxSigningJob):void 0,I.directNodeTxSigningJob=void 0!==A.directNodeTxSigningJob&&null!==A.directNodeTxSigningJob?pI.fromPartial(A.directNodeTxSigningJob):void 0,I.directFromCpfpRefundTxSigningJob=void 0!==A.directFromCpfpRefundTxSigningJob&&null!==A.directFromCpfpRefundTxSigningJob?pI.fromPartial(A.directFromCpfpRefundTxSigningJob):void 0,I}},BI={encode(A,I=new y){switch(A.renewResult?.$case){case"renewNodeTimelockResult":iI.encode(A.renewResult.renewNodeTimelockResult,I.uint32(10).fork()).join();break;case"renewRefundTimelockResult":QI.encode(A.renewResult.renewRefundTimelockResult,I.uint32(18).fork()).join();break;case"renewNodeZeroTimelockResult":eI.encode(A.renewResult.renewNodeZeroTimelockResult,I.uint32(26).fork()).join()}return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={renewResult:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.renewResult={$case:"renewNodeTimelockResult",renewNodeTimelockResult:iI.decode(g,g.uint32())};continue;case 2:if(18!==A)break;B.renewResult={$case:"renewRefundTimelockResult",renewRefundTimelockResult:QI.decode(g,g.uint32())};continue;case 3:if(26!==A)break;B.renewResult={$case:"renewNodeZeroTimelockResult",renewNodeZeroTimelockResult:eI.decode(g,g.uint32())};continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({renewResult:lB(A.renewNodeTimelockResult)?{$case:"renewNodeTimelockResult",renewNodeTimelockResult:iI.fromJSON(A.renewNodeTimelockResult)}:lB(A.renewRefundTimelockResult)?{$case:"renewRefundTimelockResult",renewRefundTimelockResult:QI.fromJSON(A.renewRefundTimelockResult)}:lB(A.renewNodeZeroTimelockResult)?{$case:"renewNodeZeroTimelockResult",renewNodeZeroTimelockResult:eI.fromJSON(A.renewNodeZeroTimelockResult)}:void 0}),toJSON(A){const I={};return"renewNodeTimelockResult"===A.renewResult?.$case?I.renewNodeTimelockResult=iI.toJSON(A.renewResult.renewNodeTimelockResult):"renewRefundTimelockResult"===A.renewResult?.$case?I.renewRefundTimelockResult=QI.toJSON(A.renewResult.renewRefundTimelockResult):"renewNodeZeroTimelockResult"===A.renewResult?.$case&&(I.renewNodeZeroTimelockResult=eI.toJSON(A.renewResult.renewNodeZeroTimelockResult)),I},create:A=>BI.fromPartial(A??{}),fromPartial(A){const I={renewResult:void 0};switch(A.renewResult?.$case){case"renewNodeTimelockResult":void 0!==A.renewResult?.renewNodeTimelockResult&&null!==A.renewResult?.renewNodeTimelockResult&&(I.renewResult={$case:"renewNodeTimelockResult",renewNodeTimelockResult:iI.fromPartial(A.renewResult.renewNodeTimelockResult)});break;case"renewRefundTimelockResult":void 0!==A.renewResult?.renewRefundTimelockResult&&null!==A.renewResult?.renewRefundTimelockResult&&(I.renewResult={$case:"renewRefundTimelockResult",renewRefundTimelockResult:QI.fromPartial(A.renewResult.renewRefundTimelockResult)});break;case"renewNodeZeroTimelockResult":void 0!==A.renewResult?.renewNodeZeroTimelockResult&&null!==A.renewResult?.renewNodeZeroTimelockResult&&(I.renewResult={$case:"renewNodeZeroTimelockResult",renewNodeZeroTimelockResult:eI.fromPartial(A.renewResult.renewNodeZeroTimelockResult)})}return I}},iI={encode:(A,I=new y)=>(void 0!==A.splitNode&&hI.encode(A.splitNode,I.uint32(10).fork()).join(),void 0!==A.node&&hI.encode(A.node,I.uint32(18).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={splitNode:void 0,node:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.splitNode=hI.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.node=hI.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({splitNode:lB(A.splitNode)?hI.fromJSON(A.splitNode):void 0,node:lB(A.node)?hI.fromJSON(A.node):void 0}),toJSON(A){const I={};return void 0!==A.splitNode&&(I.splitNode=hI.toJSON(A.splitNode)),void 0!==A.node&&(I.node=hI.toJSON(A.node)),I},create:A=>iI.fromPartial(A??{}),fromPartial(A){const I={splitNode:void 0,node:void 0};return I.splitNode=void 0!==A.splitNode&&null!==A.splitNode?hI.fromPartial(A.splitNode):void 0,I.node=void 0!==A.node&&null!==A.node?hI.fromPartial(A.node):void 0,I}},QI={encode:(A,I=new y)=>(void 0!==A.node&&hI.encode(A.node,I.uint32(10).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={node:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.node=hI.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({node:lB(A.node)?hI.fromJSON(A.node):void 0}),toJSON(A){const I={};return void 0!==A.node&&(I.node=hI.toJSON(A.node)),I},create:A=>QI.fromPartial(A??{}),fromPartial(A){const I={node:void 0};return I.node=void 0!==A.node&&null!==A.node?hI.fromPartial(A.node):void 0,I}},eI={encode:(A,I=new y)=>(void 0!==A.splitNode&&hI.encode(A.splitNode,I.uint32(10).fork()).join(),void 0!==A.node&&hI.encode(A.node,I.uint32(18).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={splitNode:void 0,node:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.splitNode=hI.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.node=hI.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({splitNode:lB(A.splitNode)?hI.fromJSON(A.splitNode):void 0,node:lB(A.node)?hI.fromJSON(A.node):void 0}),toJSON(A){const I={};return void 0!==A.splitNode&&(I.splitNode=hI.toJSON(A.splitNode)),void 0!==A.node&&(I.node=hI.toJSON(A.node)),I},create:A=>eI.fromPartial(A??{}),fromPartial(A){const I={splitNode:void 0,node:void 0};return I.splitNode=void 0!==A.splitNode&&null!==A.splitNode?hI.fromPartial(A.splitNode):void 0,I.node=void 0!==A.node&&null!==A.node?hI.fromPartial(A.node):void 0,I}};function EI(){return{nodeId:"",nodeTxSigningResult:void 0,refundTxSigningResult:void 0,verifyingKey:new Uint8Array(0),directNodeTxSigningResult:void 0,directRefundTxSigningResult:void 0,directFromCpfpRefundTxSigningResult:void 0}}const tI={encode:(A,I=new y)=>(""!==A.nodeId&&I.uint32(10).string(A.nodeId),void 0!==A.nodeTxSigningResult&&OA.encode(A.nodeTxSigningResult,I.uint32(18).fork()).join(),void 0!==A.refundTxSigningResult&&OA.encode(A.refundTxSigningResult,I.uint32(26).fork()).join(),0!==A.verifyingKey.length&&I.uint32(34).bytes(A.verifyingKey),void 0!==A.directNodeTxSigningResult&&OA.encode(A.directNodeTxSigningResult,I.uint32(42).fork()).join(),void 0!==A.directRefundTxSigningResult&&OA.encode(A.directRefundTxSigningResult,I.uint32(50).fork()).join(),void 0!==A.directFromCpfpRefundTxSigningResult&&OA.encode(A.directFromCpfpRefundTxSigningResult,I.uint32(58).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=EI();for(;g.pos >>3){case 1:if(10!==A)break;B.nodeId=g.string();continue;case 2:if(18!==A)break;B.nodeTxSigningResult=OA.decode(g,g.uint32());continue;case 3:if(26!==A)break;B.refundTxSigningResult=OA.decode(g,g.uint32());continue;case 4:if(34!==A)break;B.verifyingKey=g.bytes();continue;case 5:if(42!==A)break;B.directNodeTxSigningResult=OA.decode(g,g.uint32());continue;case 6:if(50!==A)break;B.directRefundTxSigningResult=OA.decode(g,g.uint32());continue;case 7:if(58!==A)break;B.directFromCpfpRefundTxSigningResult=OA.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({nodeId:lB(A.nodeId)?globalThis.String(A.nodeId):"",nodeTxSigningResult:lB(A.nodeTxSigningResult)?OA.fromJSON(A.nodeTxSigningResult):void 0,refundTxSigningResult:lB(A.refundTxSigningResult)?OA.fromJSON(A.refundTxSigningResult):void 0,verifyingKey:lB(A.verifyingKey)?rB(A.verifyingKey):new Uint8Array(0),directNodeTxSigningResult:lB(A.directNodeTxSigningResult)?OA.fromJSON(A.directNodeTxSigningResult):void 0,directRefundTxSigningResult:lB(A.directRefundTxSigningResult)?OA.fromJSON(A.directRefundTxSigningResult):void 0,directFromCpfpRefundTxSigningResult:lB(A.directFromCpfpRefundTxSigningResult)?OA.fromJSON(A.directFromCpfpRefundTxSigningResult):void 0}),toJSON(A){const I={};return""!==A.nodeId&&(I.nodeId=A.nodeId),void 0!==A.nodeTxSigningResult&&(I.nodeTxSigningResult=OA.toJSON(A.nodeTxSigningResult)),void 0!==A.refundTxSigningResult&&(I.refundTxSigningResult=OA.toJSON(A.refundTxSigningResult)),0!==A.verifyingKey.length&&(I.verifyingKey=cB(A.verifyingKey)),void 0!==A.directNodeTxSigningResult&&(I.directNodeTxSigningResult=OA.toJSON(A.directNodeTxSigningResult)),void 0!==A.directRefundTxSigningResult&&(I.directRefundTxSigningResult=OA.toJSON(A.directRefundTxSigningResult)),void 0!==A.directFromCpfpRefundTxSigningResult&&(I.directFromCpfpRefundTxSigningResult=OA.toJSON(A.directFromCpfpRefundTxSigningResult)),I},create:A=>tI.fromPartial(A??{}),fromPartial(A){const I=EI();return I.nodeId=A.nodeId??"",I.nodeTxSigningResult=void 0!==A.nodeTxSigningResult&&null!==A.nodeTxSigningResult?OA.fromPartial(A.nodeTxSigningResult):void 0,I.refundTxSigningResult=void 0!==A.refundTxSigningResult&&null!==A.refundTxSigningResult?OA.fromPartial(A.refundTxSigningResult):void 0,I.verifyingKey=A.verifyingKey??new Uint8Array(0),I.directNodeTxSigningResult=void 0!==A.directNodeTxSigningResult&&null!==A.directNodeTxSigningResult?OA.fromPartial(A.directNodeTxSigningResult):void 0,I.directRefundTxSigningResult=void 0!==A.directRefundTxSigningResult&&null!==A.directRefundTxSigningResult?OA.fromPartial(A.directRefundTxSigningResult):void 0,I.directFromCpfpRefundTxSigningResult=void 0!==A.directFromCpfpRefundTxSigningResult&&null!==A.directFromCpfpRefundTxSigningResult?OA.fromPartial(A.directFromCpfpRefundTxSigningResult):void 0,I}};function oI(){return{nodeId:"",nodeTxSignature:new Uint8Array(0),refundTxSignature:new Uint8Array(0),directNodeTxSignature:new Uint8Array(0),directRefundTxSignature:new Uint8Array(0),directFromCpfpRefundTxSignature:new Uint8Array(0)}}const nI={encode:(A,I=new y)=>(""!==A.nodeId&&I.uint32(10).string(A.nodeId),0!==A.nodeTxSignature.length&&I.uint32(18).bytes(A.nodeTxSignature),0!==A.refundTxSignature.length&&I.uint32(26).bytes(A.refundTxSignature),0!==A.directNodeTxSignature.length&&I.uint32(34).bytes(A.directNodeTxSignature),0!==A.directRefundTxSignature.length&&I.uint32(42).bytes(A.directRefundTxSignature),0!==A.directFromCpfpRefundTxSignature.length&&I.uint32(50).bytes(A.directFromCpfpRefundTxSignature),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=oI();for(;g.pos >>3){case 1:if(10!==A)break;B.nodeId=g.string();continue;case 2:if(18!==A)break;B.nodeTxSignature=g.bytes();continue;case 3:if(26!==A)break;B.refundTxSignature=g.bytes();continue;case 4:if(34!==A)break;B.directNodeTxSignature=g.bytes();continue;case 5:if(42!==A)break;B.directRefundTxSignature=g.bytes();continue;case 6:if(50!==A)break;B.directFromCpfpRefundTxSignature=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({nodeId:lB(A.nodeId)?globalThis.String(A.nodeId):"",nodeTxSignature:lB(A.nodeTxSignature)?rB(A.nodeTxSignature):new Uint8Array(0),refundTxSignature:lB(A.refundTxSignature)?rB(A.refundTxSignature):new Uint8Array(0),directNodeTxSignature:lB(A.directNodeTxSignature)?rB(A.directNodeTxSignature):new Uint8Array(0),directRefundTxSignature:lB(A.directRefundTxSignature)?rB(A.directRefundTxSignature):new Uint8Array(0),directFromCpfpRefundTxSignature:lB(A.directFromCpfpRefundTxSignature)?rB(A.directFromCpfpRefundTxSignature):new Uint8Array(0)}),toJSON(A){const I={};return""!==A.nodeId&&(I.nodeId=A.nodeId),0!==A.nodeTxSignature.length&&(I.nodeTxSignature=cB(A.nodeTxSignature)),0!==A.refundTxSignature.length&&(I.refundTxSignature=cB(A.refundTxSignature)),0!==A.directNodeTxSignature.length&&(I.directNodeTxSignature=cB(A.directNodeTxSignature)),0!==A.directRefundTxSignature.length&&(I.directRefundTxSignature=cB(A.directRefundTxSignature)),0!==A.directFromCpfpRefundTxSignature.length&&(I.directFromCpfpRefundTxSignature=cB(A.directFromCpfpRefundTxSignature)),I},create:A=>nI.fromPartial(A??{}),fromPartial(A){const I=oI();return I.nodeId=A.nodeId??"",I.nodeTxSignature=A.nodeTxSignature??new Uint8Array(0),I.refundTxSignature=A.refundTxSignature??new Uint8Array(0),I.directNodeTxSignature=A.directNodeTxSignature??new Uint8Array(0),I.directRefundTxSignature=A.directRefundTxSignature??new Uint8Array(0),I.directFromCpfpRefundTxSignature=A.directFromCpfpRefundTxSignature??new Uint8Array(0),I}};function aI(){return{identityPublicKey:new Uint8Array(0),onChainUtxo:void 0,rootTxSigningJob:void 0,refundTxSigningJob:void 0,directRootTxSigningJob:void 0,directRefundTxSigningJob:void 0,directFromCpfpRefundTxSigningJob:void 0}}const sI={encode:(A,I=new y)=>(0!==A.identityPublicKey.length&&I.uint32(10).bytes(A.identityPublicKey),void 0!==A.onChainUtxo&&qA.encode(A.onChainUtxo,I.uint32(18).fork()).join(),void 0!==A.rootTxSigningJob&&vA.encode(A.rootTxSigningJob,I.uint32(26).fork()).join(),void 0!==A.refundTxSigningJob&&vA.encode(A.refundTxSigningJob,I.uint32(34).fork()).join(),void 0!==A.directRootTxSigningJob&&vA.encode(A.directRootTxSigningJob,I.uint32(42).fork()).join(),void 0!==A.directRefundTxSigningJob&&vA.encode(A.directRefundTxSigningJob,I.uint32(50).fork()).join(),void 0!==A.directFromCpfpRefundTxSigningJob&&vA.encode(A.directFromCpfpRefundTxSigningJob,I.uint32(58).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=aI();for(;g.pos >>3){case 1:if(10!==A)break;B.identityPublicKey=g.bytes();continue;case 2:if(18!==A)break;B.onChainUtxo=qA.decode(g,g.uint32());continue;case 3:if(26!==A)break;B.rootTxSigningJob=vA.decode(g,g.uint32());continue;case 4:if(34!==A)break;B.refundTxSigningJob=vA.decode(g,g.uint32());continue;case 5:if(42!==A)break;B.directRootTxSigningJob=vA.decode(g,g.uint32());continue;case 6:if(50!==A)break;B.directRefundTxSigningJob=vA.decode(g,g.uint32());continue;case 7:if(58!==A)break;B.directFromCpfpRefundTxSigningJob=vA.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0),onChainUtxo:lB(A.onChainUtxo)?qA.fromJSON(A.onChainUtxo):void 0,rootTxSigningJob:lB(A.rootTxSigningJob)?vA.fromJSON(A.rootTxSigningJob):void 0,refundTxSigningJob:lB(A.refundTxSigningJob)?vA.fromJSON(A.refundTxSigningJob):void 0,directRootTxSigningJob:lB(A.directRootTxSigningJob)?vA.fromJSON(A.directRootTxSigningJob):void 0,directRefundTxSigningJob:lB(A.directRefundTxSigningJob)?vA.fromJSON(A.directRefundTxSigningJob):void 0,directFromCpfpRefundTxSigningJob:lB(A.directFromCpfpRefundTxSigningJob)?vA.fromJSON(A.directFromCpfpRefundTxSigningJob):void 0}),toJSON(A){const I={};return 0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),void 0!==A.onChainUtxo&&(I.onChainUtxo=qA.toJSON(A.onChainUtxo)),void 0!==A.rootTxSigningJob&&(I.rootTxSigningJob=vA.toJSON(A.rootTxSigningJob)),void 0!==A.refundTxSigningJob&&(I.refundTxSigningJob=vA.toJSON(A.refundTxSigningJob)),void 0!==A.directRootTxSigningJob&&(I.directRootTxSigningJob=vA.toJSON(A.directRootTxSigningJob)),void 0!==A.directRefundTxSigningJob&&(I.directRefundTxSigningJob=vA.toJSON(A.directRefundTxSigningJob)),void 0!==A.directFromCpfpRefundTxSigningJob&&(I.directFromCpfpRefundTxSigningJob=vA.toJSON(A.directFromCpfpRefundTxSigningJob)),I},create:A=>sI.fromPartial(A??{}),fromPartial(A){const I=aI();return I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I.onChainUtxo=void 0!==A.onChainUtxo&&null!==A.onChainUtxo?qA.fromPartial(A.onChainUtxo):void 0,I.rootTxSigningJob=void 0!==A.rootTxSigningJob&&null!==A.rootTxSigningJob?vA.fromPartial(A.rootTxSigningJob):void 0,I.refundTxSigningJob=void 0!==A.refundTxSigningJob&&null!==A.refundTxSigningJob?vA.fromPartial(A.refundTxSigningJob):void 0,I.directRootTxSigningJob=void 0!==A.directRootTxSigningJob&&null!==A.directRootTxSigningJob?vA.fromPartial(A.directRootTxSigningJob):void 0,I.directRefundTxSigningJob=void 0!==A.directRefundTxSigningJob&&null!==A.directRefundTxSigningJob?vA.fromPartial(A.directRefundTxSigningJob):void 0,I.directFromCpfpRefundTxSigningJob=void 0!==A.directFromCpfpRefundTxSigningJob&&null!==A.directFromCpfpRefundTxSigningJob?vA.fromPartial(A.directFromCpfpRefundTxSigningJob):void 0,I}},rI={encode:(A,I=new y)=>(""!==A.treeId&&I.uint32(10).string(A.treeId),void 0!==A.rootNodeSignatureShares&&tI.encode(A.rootNodeSignatureShares,I.uint32(18).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={treeId:"",rootNodeSignatureShares:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.treeId=g.string();continue;case 2:if(18!==A)break;B.rootNodeSignatureShares=tI.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({treeId:lB(A.treeId)?globalThis.String(A.treeId):"",rootNodeSignatureShares:lB(A.rootNodeSignatureShares)?tI.fromJSON(A.rootNodeSignatureShares):void 0}),toJSON(A){const I={};return""!==A.treeId&&(I.treeId=A.treeId),void 0!==A.rootNodeSignatureShares&&(I.rootNodeSignatureShares=tI.toJSON(A.rootNodeSignatureShares)),I},create:A=>rI.fromPartial(A??{}),fromPartial(A){const I={treeId:"",rootNodeSignatureShares:void 0};return I.treeId=A.treeId??"",I.rootNodeSignatureShares=void 0!==A.rootNodeSignatureShares&&null!==A.rootNodeSignatureShares?tI.fromPartial(A.rootNodeSignatureShares):void 0,I}};function cI(){return{identityPublicKey:new Uint8Array(0),onChainUtxo:void 0,rootTxSigningJob:void 0,refundTxSigningJob:void 0,directFromCpfpRefundTxSigningJob:void 0,additionalOnChainUtxos:[]}}const DI={encode(A,I=new y){0!==A.identityPublicKey.length&&I.uint32(10).bytes(A.identityPublicKey),void 0!==A.onChainUtxo&&qA.encode(A.onChainUtxo,I.uint32(18).fork()).join(),void 0!==A.rootTxSigningJob&&pI.encode(A.rootTxSigningJob,I.uint32(26).fork()).join(),void 0!==A.refundTxSigningJob&&pI.encode(A.refundTxSigningJob,I.uint32(34).fork()).join(),void 0!==A.directFromCpfpRefundTxSigningJob&&pI.encode(A.directFromCpfpRefundTxSigningJob,I.uint32(42).fork()).join();for(const g of A.additionalOnChainUtxos)qA.encode(g,I.uint32(50).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=cI();for(;g.pos >>3){case 1:if(10!==A)break;B.identityPublicKey=g.bytes();continue;case 2:if(18!==A)break;B.onChainUtxo=qA.decode(g,g.uint32());continue;case 3:if(26!==A)break;B.rootTxSigningJob=pI.decode(g,g.uint32());continue;case 4:if(34!==A)break;B.refundTxSigningJob=pI.decode(g,g.uint32());continue;case 5:if(42!==A)break;B.directFromCpfpRefundTxSigningJob=pI.decode(g,g.uint32());continue;case 6:if(50!==A)break;B.additionalOnChainUtxos.push(qA.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0),onChainUtxo:lB(A.onChainUtxo)?qA.fromJSON(A.onChainUtxo):void 0,rootTxSigningJob:lB(A.rootTxSigningJob)?pI.fromJSON(A.rootTxSigningJob):void 0,refundTxSigningJob:lB(A.refundTxSigningJob)?pI.fromJSON(A.refundTxSigningJob):void 0,directFromCpfpRefundTxSigningJob:lB(A.directFromCpfpRefundTxSigningJob)?pI.fromJSON(A.directFromCpfpRefundTxSigningJob):void 0,additionalOnChainUtxos:globalThis.Array.isArray(A?.additionalOnChainUtxos)?A.additionalOnChainUtxos.map(A=>qA.fromJSON(A)):[]}),toJSON(A){const I={};return 0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),void 0!==A.onChainUtxo&&(I.onChainUtxo=qA.toJSON(A.onChainUtxo)),void 0!==A.rootTxSigningJob&&(I.rootTxSigningJob=pI.toJSON(A.rootTxSigningJob)),void 0!==A.refundTxSigningJob&&(I.refundTxSigningJob=pI.toJSON(A.refundTxSigningJob)),void 0!==A.directFromCpfpRefundTxSigningJob&&(I.directFromCpfpRefundTxSigningJob=pI.toJSON(A.directFromCpfpRefundTxSigningJob)),A.additionalOnChainUtxos?.length&&(I.additionalOnChainUtxos=A.additionalOnChainUtxos.map(A=>qA.toJSON(A))),I},create:A=>DI.fromPartial(A??{}),fromPartial(A){const I=cI();return I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I.onChainUtxo=void 0!==A.onChainUtxo&&null!==A.onChainUtxo?qA.fromPartial(A.onChainUtxo):void 0,I.rootTxSigningJob=void 0!==A.rootTxSigningJob&&null!==A.rootTxSigningJob?pI.fromPartial(A.rootTxSigningJob):void 0,I.refundTxSigningJob=void 0!==A.refundTxSigningJob&&null!==A.refundTxSigningJob?pI.fromPartial(A.refundTxSigningJob):void 0,I.directFromCpfpRefundTxSigningJob=void 0!==A.directFromCpfpRefundTxSigningJob&&null!==A.directFromCpfpRefundTxSigningJob?pI.fromPartial(A.directFromCpfpRefundTxSigningJob):void 0,I.additionalOnChainUtxos=A.additionalOnChainUtxos?.map(A=>qA.fromPartial(A))||[],I}},wI={encode:(A,I=new y)=>(void 0!==A.rootNode&&hI.encode(A.rootNode,I.uint32(10).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={rootNode:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.rootNode=hI.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({rootNode:lB(A.rootNode)?hI.fromJSON(A.rootNode):void 0}),toJSON(A){const I={};return void 0!==A.rootNode&&(I.rootNode=hI.toJSON(A.rootNode)),I},create:A=>wI.fromPartial(A??{}),fromPartial(A){const I={rootNode:void 0};return I.rootNode=void 0!==A.rootNode&&null!==A.rootNode?hI.fromPartial(A.rootNode):void 0,I}};function dI(){return{id:"",treeId:"",value:0,parentNodeId:void 0,nodeTx:new Uint8Array(0),refundTx:new Uint8Array(0),vout:0,verifyingPublicKey:new Uint8Array(0),ownerIdentityPublicKey:new Uint8Array(0),signingKeyshare:void 0,status:"",network:0,createdTime:void 0,updatedTime:void 0,ownerSigningPublicKey:new Uint8Array(0),directTx:new Uint8Array(0),directRefundTx:new Uint8Array(0),directFromCpfpRefundTx:new Uint8Array(0),treenodeStatus:0}}const hI={encode:(A,I=new y)=>(""!==A.id&&I.uint32(10).string(A.id),""!==A.treeId&&I.uint32(18).string(A.treeId),0!==A.value&&I.uint32(24).uint64(A.value),void 0!==A.parentNodeId&&I.uint32(34).string(A.parentNodeId),0!==A.nodeTx.length&&I.uint32(42).bytes(A.nodeTx),0!==A.refundTx.length&&I.uint32(50).bytes(A.refundTx),0!==A.vout&&I.uint32(56).uint32(A.vout),0!==A.verifyingPublicKey.length&&I.uint32(66).bytes(A.verifyingPublicKey),0!==A.ownerIdentityPublicKey.length&&I.uint32(74).bytes(A.ownerIdentityPublicKey),void 0!==A.signingKeyshare&&xA.encode(A.signingKeyshare,I.uint32(82).fork()).join(),""!==A.status&&I.uint32(90).string(A.status),0!==A.network&&I.uint32(96).int32(A.network),void 0!==A.createdTime&&N.encode(DB(A.createdTime),I.uint32(106).fork()).join(),void 0!==A.updatedTime&&N.encode(DB(A.updatedTime),I.uint32(114).fork()).join(),0!==A.ownerSigningPublicKey.length&&I.uint32(122).bytes(A.ownerSigningPublicKey),0!==A.directTx.length&&I.uint32(130).bytes(A.directTx),0!==A.directRefundTx.length&&I.uint32(138).bytes(A.directRefundTx),0!==A.directFromCpfpRefundTx.length&&I.uint32(146).bytes(A.directFromCpfpRefundTx),0!==A.treenodeStatus&&I.uint32(152).int32(A.treenodeStatus),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=dI();for(;g.pos >>3){case 1:if(10!==A)break;B.id=g.string();continue;case 2:if(18!==A)break;B.treeId=g.string();continue;case 3:if(24!==A)break;B.value=hB(g.uint64());continue;case 4:if(34!==A)break;B.parentNodeId=g.string();continue;case 5:if(42!==A)break;B.nodeTx=g.bytes();continue;case 6:if(50!==A)break;B.refundTx=g.bytes();continue;case 7:if(56!==A)break;B.vout=g.uint32();continue;case 8:if(66!==A)break;B.verifyingPublicKey=g.bytes();continue;case 9:if(74!==A)break;B.ownerIdentityPublicKey=g.bytes();continue;case 10:if(82!==A)break;B.signingKeyshare=xA.decode(g,g.uint32());continue;case 11:if(90!==A)break;B.status=g.string();continue;case 12:if(96!==A)break;B.network=g.int32();continue;case 13:if(106!==A)break;B.createdTime=wB(N.decode(g,g.uint32()));continue;case 14:if(114!==A)break;B.updatedTime=wB(N.decode(g,g.uint32()));continue;case 15:if(122!==A)break;B.ownerSigningPublicKey=g.bytes();continue;case 16:if(130!==A)break;B.directTx=g.bytes();continue;case 17:if(138!==A)break;B.directRefundTx=g.bytes();continue;case 18:if(146!==A)break;B.directFromCpfpRefundTx=g.bytes();continue;case 19:if(152!==A)break;B.treenodeStatus=g.int32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({id:lB(A.id)?globalThis.String(A.id):"",treeId:lB(A.treeId)?globalThis.String(A.treeId):"",value:lB(A.value)?globalThis.Number(A.value):0,parentNodeId:lB(A.parentNodeId)?globalThis.String(A.parentNodeId):void 0,nodeTx:lB(A.nodeTx)?rB(A.nodeTx):new Uint8Array(0),refundTx:lB(A.refundTx)?rB(A.refundTx):new Uint8Array(0),vout:lB(A.vout)?globalThis.Number(A.vout):0,verifyingPublicKey:lB(A.verifyingPublicKey)?rB(A.verifyingPublicKey):new Uint8Array(0),ownerIdentityPublicKey:lB(A.ownerIdentityPublicKey)?rB(A.ownerIdentityPublicKey):new Uint8Array(0),signingKeyshare:lB(A.signingKeyshare)?xA.fromJSON(A.signingKeyshare):void 0,status:lB(A.status)?globalThis.String(A.status):"",network:lB(A.network)?b(A.network):0,createdTime:lB(A.createdTime)?dB(A.createdTime):void 0,updatedTime:lB(A.updatedTime)?dB(A.updatedTime):void 0,ownerSigningPublicKey:lB(A.ownerSigningPublicKey)?rB(A.ownerSigningPublicKey):new Uint8Array(0),directTx:lB(A.directTx)?rB(A.directTx):new Uint8Array(0),directRefundTx:lB(A.directRefundTx)?rB(A.directRefundTx):new Uint8Array(0),directFromCpfpRefundTx:lB(A.directFromCpfpRefundTx)?rB(A.directFromCpfpRefundTx):new Uint8Array(0),treenodeStatus:lB(A.treenodeStatus)?tA(A.treenodeStatus):0}),toJSON(A){const I={};return""!==A.id&&(I.id=A.id),""!==A.treeId&&(I.treeId=A.treeId),0!==A.value&&(I.value=Math.round(A.value)),void 0!==A.parentNodeId&&(I.parentNodeId=A.parentNodeId),0!==A.nodeTx.length&&(I.nodeTx=cB(A.nodeTx)),0!==A.refundTx.length&&(I.refundTx=cB(A.refundTx)),0!==A.vout&&(I.vout=Math.round(A.vout)),0!==A.verifyingPublicKey.length&&(I.verifyingPublicKey=cB(A.verifyingPublicKey)),0!==A.ownerIdentityPublicKey.length&&(I.ownerIdentityPublicKey=cB(A.ownerIdentityPublicKey)),void 0!==A.signingKeyshare&&(I.signingKeyshare=xA.toJSON(A.signingKeyshare)),""!==A.status&&(I.status=A.status),0!==A.network&&(I.network=H(A.network)),void 0!==A.createdTime&&(I.createdTime=A.createdTime.toISOString()),void 0!==A.updatedTime&&(I.updatedTime=A.updatedTime.toISOString()),0!==A.ownerSigningPublicKey.length&&(I.ownerSigningPublicKey=cB(A.ownerSigningPublicKey)),0!==A.directTx.length&&(I.directTx=cB(A.directTx)),0!==A.directRefundTx.length&&(I.directRefundTx=cB(A.directRefundTx)),0!==A.directFromCpfpRefundTx.length&&(I.directFromCpfpRefundTx=cB(A.directFromCpfpRefundTx)),0!==A.treenodeStatus&&(I.treenodeStatus=oA(A.treenodeStatus)),I},create:A=>hI.fromPartial(A??{}),fromPartial(A){const I=dI();return I.id=A.id??"",I.treeId=A.treeId??"",I.value=A.value??0,I.parentNodeId=A.parentNodeId??void 0,I.nodeTx=A.nodeTx??new Uint8Array(0),I.refundTx=A.refundTx??new Uint8Array(0),I.vout=A.vout??0,I.verifyingPublicKey=A.verifyingPublicKey??new Uint8Array(0),I.ownerIdentityPublicKey=A.ownerIdentityPublicKey??new Uint8Array(0),I.signingKeyshare=void 0!==A.signingKeyshare&&null!==A.signingKeyshare?xA.fromPartial(A.signingKeyshare):void 0,I.status=A.status??"",I.network=A.network??0,I.createdTime=A.createdTime??void 0,I.updatedTime=A.updatedTime??void 0,I.ownerSigningPublicKey=A.ownerSigningPublicKey??new Uint8Array(0),I.directTx=A.directTx??new Uint8Array(0),I.directRefundTx=A.directRefundTx??new Uint8Array(0),I.directFromCpfpRefundTx=A.directFromCpfpRefundTx??new Uint8Array(0),I.treenodeStatus=A.treenodeStatus??0,I}},yI={encode(A,I=new y){0!==A.intent&&I.uint32(8).int32(A.intent);for(const g of A.nodeSignatures)nI.encode(g,I.uint32(18).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={intent:0,nodeSignatures:[]};for(;g.pos >>3){case 1:if(8!==A)break;B.intent=g.int32();continue;case 2:if(18!==A)break;B.nodeSignatures.push(nI.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({intent:lB(A.intent)?f(A.intent):0,nodeSignatures:globalThis.Array.isArray(A?.nodeSignatures)?A.nodeSignatures.map(A=>nI.fromJSON(A)):[]}),toJSON(A){const I={};return 0!==A.intent&&(I.intent=function(A){switch(A){case S.CREATION:return"CREATION";case S.TRANSFER:return"TRANSFER";case S.AGGREGATE:return"AGGREGATE";case S.REFRESH:return"REFRESH";case S.EXTEND:return"EXTEND";case S.UNRECOGNIZED:default:return"UNRECOGNIZED"}}(A.intent)),A.nodeSignatures?.length&&(I.nodeSignatures=A.nodeSignatures.map(A=>nI.toJSON(A))),I},create:A=>yI.fromPartial(A??{}),fromPartial(A){const I={intent:0,nodeSignatures:[]};return I.intent=A.intent??0,I.nodeSignatures=A.nodeSignatures?.map(A=>nI.fromPartial(A))||[],I}},lI={encode(A,I=new y){for(const g of A.nodes)hI.encode(g,I.uint32(10).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={nodes:[]};for(;g.pos >>3){case 1:if(10!==A)break;B.nodes.push(hI.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({nodes:globalThis.Array.isArray(A?.nodes)?A.nodes.map(A=>hI.fromJSON(A)):[]}),toJSON(A){const I={};return A.nodes?.length&&(I.nodes=A.nodes.map(A=>hI.toJSON(A))),I},create:A=>lI.fromPartial(A??{}),fromPartial(A){const I={nodes:[]};return I.nodes=A.nodes?.map(A=>hI.fromPartial(A))||[],I}};function kI(){return{secretShare:new Uint8Array(0),proofs:[]}}const uI={encode(A,I=new y){0!==A.secretShare.length&&I.uint32(10).bytes(A.secretShare);for(const g of A.proofs)I.uint32(18).bytes(g);return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=kI();for(;g.pos >>3){case 1:if(10!==A)break;B.secretShare=g.bytes();continue;case 2:if(18!==A)break;B.proofs.push(g.bytes());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({secretShare:lB(A.secretShare)?rB(A.secretShare):new Uint8Array(0),proofs:globalThis.Array.isArray(A?.proofs)?A.proofs.map(A=>rB(A)):[]}),toJSON(A){const I={};return 0!==A.secretShare.length&&(I.secretShare=cB(A.secretShare)),A.proofs?.length&&(I.proofs=A.proofs.map(A=>cB(A))),I},create:A=>uI.fromPartial(A??{}),fromPartial(A){const I=kI();return I.secretShare=A.secretShare??new Uint8Array(0),I.proofs=A.proofs?.map(A=>A)||[],I}},NI={encode:(A,I=new y)=>(""!==A.leafId&&I.uint32(10).string(A.leafId),void 0!==A.refundTxSigningJob&&vA.encode(A.refundTxSigningJob,I.uint32(18).fork()).join(),void 0!==A.directRefundTxSigningJob&&vA.encode(A.directRefundTxSigningJob,I.uint32(26).fork()).join(),void 0!==A.directFromCpfpRefundTxSigningJob&&vA.encode(A.directFromCpfpRefundTxSigningJob,I.uint32(34).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={leafId:"",refundTxSigningJob:void 0,directRefundTxSigningJob:void 0,directFromCpfpRefundTxSigningJob:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.leafId=g.string();continue;case 2:if(18!==A)break;B.refundTxSigningJob=vA.decode(g,g.uint32());continue;case 3:if(26!==A)break;B.directRefundTxSigningJob=vA.decode(g,g.uint32());continue;case 4:if(34!==A)break;B.directFromCpfpRefundTxSigningJob=vA.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({leafId:lB(A.leafId)?globalThis.String(A.leafId):"",refundTxSigningJob:lB(A.refundTxSigningJob)?vA.fromJSON(A.refundTxSigningJob):void 0,directRefundTxSigningJob:lB(A.directRefundTxSigningJob)?vA.fromJSON(A.directRefundTxSigningJob):void 0,directFromCpfpRefundTxSigningJob:lB(A.directFromCpfpRefundTxSigningJob)?vA.fromJSON(A.directFromCpfpRefundTxSigningJob):void 0}),toJSON(A){const I={};return""!==A.leafId&&(I.leafId=A.leafId),void 0!==A.refundTxSigningJob&&(I.refundTxSigningJob=vA.toJSON(A.refundTxSigningJob)),void 0!==A.directRefundTxSigningJob&&(I.directRefundTxSigningJob=vA.toJSON(A.directRefundTxSigningJob)),void 0!==A.directFromCpfpRefundTxSigningJob&&(I.directFromCpfpRefundTxSigningJob=vA.toJSON(A.directFromCpfpRefundTxSigningJob)),I},create:A=>NI.fromPartial(A??{}),fromPartial(A){const I={leafId:"",refundTxSigningJob:void 0,directRefundTxSigningJob:void 0,directFromCpfpRefundTxSigningJob:void 0};return I.leafId=A.leafId??"",I.refundTxSigningJob=void 0!==A.refundTxSigningJob&&null!==A.refundTxSigningJob?vA.fromPartial(A.refundTxSigningJob):void 0,I.directRefundTxSigningJob=void 0!==A.directRefundTxSigningJob&&null!==A.directRefundTxSigningJob?vA.fromPartial(A.directRefundTxSigningJob):void 0,I.directFromCpfpRefundTxSigningJob=void 0!==A.directFromCpfpRefundTxSigningJob&&null!==A.directFromCpfpRefundTxSigningJob?vA.fromPartial(A.directFromCpfpRefundTxSigningJob):void 0,I}};function GI(){return{leafId:"",signingPublicKey:new Uint8Array(0),rawTx:new Uint8Array(0),signingNonceCommitment:void 0,userSignature:new Uint8Array(0),signingCommitments:void 0,additionalInputs:[]}}const pI={encode(A,I=new y){""!==A.leafId&&I.uint32(10).string(A.leafId),0!==A.signingPublicKey.length&&I.uint32(18).bytes(A.signingPublicKey),0!==A.rawTx.length&&I.uint32(26).bytes(A.rawTx),void 0!==A.signingNonceCommitment&&R.encode(A.signingNonceCommitment,I.uint32(34).fork()).join(),0!==A.userSignature.length&&I.uint32(42).bytes(A.userSignature),void 0!==A.signingCommitments&&Jg.encode(A.signingCommitments,I.uint32(50).fork()).join();for(const g of A.additionalInputs)fI.encode(g,I.uint32(58).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=GI();for(;g.pos >>3){case 1:if(10!==A)break;B.leafId=g.string();continue;case 2:if(18!==A)break;B.signingPublicKey=g.bytes();continue;case 3:if(26!==A)break;B.rawTx=g.bytes();continue;case 4:if(34!==A)break;B.signingNonceCommitment=R.decode(g,g.uint32());continue;case 5:if(42!==A)break;B.userSignature=g.bytes();continue;case 6:if(50!==A)break;B.signingCommitments=Jg.decode(g,g.uint32());continue;case 7:if(58!==A)break;B.additionalInputs.push(fI.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({leafId:lB(A.leafId)?globalThis.String(A.leafId):"",signingPublicKey:lB(A.signingPublicKey)?rB(A.signingPublicKey):new Uint8Array(0),rawTx:lB(A.rawTx)?rB(A.rawTx):new Uint8Array(0),signingNonceCommitment:lB(A.signingNonceCommitment)?R.fromJSON(A.signingNonceCommitment):void 0,userSignature:lB(A.userSignature)?rB(A.userSignature):new Uint8Array(0),signingCommitments:lB(A.signingCommitments)?Jg.fromJSON(A.signingCommitments):void 0,additionalInputs:globalThis.Array.isArray(A?.additionalInputs)?A.additionalInputs.map(A=>fI.fromJSON(A)):[]}),toJSON(A){const I={};return""!==A.leafId&&(I.leafId=A.leafId),0!==A.signingPublicKey.length&&(I.signingPublicKey=cB(A.signingPublicKey)),0!==A.rawTx.length&&(I.rawTx=cB(A.rawTx)),void 0!==A.signingNonceCommitment&&(I.signingNonceCommitment=R.toJSON(A.signingNonceCommitment)),0!==A.userSignature.length&&(I.userSignature=cB(A.userSignature)),void 0!==A.signingCommitments&&(I.signingCommitments=Jg.toJSON(A.signingCommitments)),A.additionalInputs?.length&&(I.additionalInputs=A.additionalInputs.map(A=>fI.toJSON(A))),I},create:A=>pI.fromPartial(A??{}),fromPartial(A){const I=GI();return I.leafId=A.leafId??"",I.signingPublicKey=A.signingPublicKey??new Uint8Array(0),I.rawTx=A.rawTx??new Uint8Array(0),I.signingNonceCommitment=void 0!==A.signingNonceCommitment&&null!==A.signingNonceCommitment?R.fromPartial(A.signingNonceCommitment):void 0,I.userSignature=A.userSignature??new Uint8Array(0),I.signingCommitments=void 0!==A.signingCommitments&&null!==A.signingCommitments?Jg.fromPartial(A.signingCommitments):void 0,I.additionalInputs=A.additionalInputs?.map(A=>fI.fromPartial(A))||[],I}};function SI(){return{signingNonceCommitment:void 0,userSignature:new Uint8Array(0),signingCommitments:void 0}}const fI={encode:(A,I=new y)=>(void 0!==A.signingNonceCommitment&&R.encode(A.signingNonceCommitment,I.uint32(10).fork()).join(),0!==A.userSignature.length&&I.uint32(18).bytes(A.userSignature),void 0!==A.signingCommitments&&Jg.encode(A.signingCommitments,I.uint32(26).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=SI();for(;g.pos >>3){case 1:if(10!==A)break;B.signingNonceCommitment=R.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.userSignature=g.bytes();continue;case 3:if(26!==A)break;B.signingCommitments=Jg.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({signingNonceCommitment:lB(A.signingNonceCommitment)?R.fromJSON(A.signingNonceCommitment):void 0,userSignature:lB(A.userSignature)?rB(A.userSignature):new Uint8Array(0),signingCommitments:lB(A.signingCommitments)?Jg.fromJSON(A.signingCommitments):void 0}),toJSON(A){const I={};return void 0!==A.signingNonceCommitment&&(I.signingNonceCommitment=R.toJSON(A.signingNonceCommitment)),0!==A.userSignature.length&&(I.userSignature=cB(A.userSignature)),void 0!==A.signingCommitments&&(I.signingCommitments=Jg.toJSON(A.signingCommitments)),I},create:A=>fI.fromPartial(A??{}),fromPartial(A){const I=SI();return I.signingNonceCommitment=void 0!==A.signingNonceCommitment&&null!==A.signingNonceCommitment?R.fromPartial(A.signingNonceCommitment):void 0,I.userSignature=A.userSignature??new Uint8Array(0),I.signingCommitments=void 0!==A.signingCommitments&&null!==A.signingCommitments?Jg.fromPartial(A.signingCommitments):void 0,I}};function FI(){return{leafId:"",refundTxSigningResult:void 0,verifyingKey:new Uint8Array(0),directRefundTxSigningResult:void 0,directFromCpfpRefundTxSigningResult:void 0}}const RI={encode:(A,I=new y)=>(""!==A.leafId&&I.uint32(10).string(A.leafId),void 0!==A.refundTxSigningResult&&OA.encode(A.refundTxSigningResult,I.uint32(18).fork()).join(),0!==A.verifyingKey.length&&I.uint32(26).bytes(A.verifyingKey),void 0!==A.directRefundTxSigningResult&&OA.encode(A.directRefundTxSigningResult,I.uint32(34).fork()).join(),void 0!==A.directFromCpfpRefundTxSigningResult&&OA.encode(A.directFromCpfpRefundTxSigningResult,I.uint32(42).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=FI();for(;g.pos >>3){case 1:if(10!==A)break;B.leafId=g.string();continue;case 2:if(18!==A)break;B.refundTxSigningResult=OA.decode(g,g.uint32());continue;case 3:if(26!==A)break;B.verifyingKey=g.bytes();continue;case 4:if(34!==A)break;B.directRefundTxSigningResult=OA.decode(g,g.uint32());continue;case 5:if(42!==A)break;B.directFromCpfpRefundTxSigningResult=OA.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({leafId:lB(A.leafId)?globalThis.String(A.leafId):"",refundTxSigningResult:lB(A.refundTxSigningResult)?OA.fromJSON(A.refundTxSigningResult):void 0,verifyingKey:lB(A.verifyingKey)?rB(A.verifyingKey):new Uint8Array(0),directRefundTxSigningResult:lB(A.directRefundTxSigningResult)?OA.fromJSON(A.directRefundTxSigningResult):void 0,directFromCpfpRefundTxSigningResult:lB(A.directFromCpfpRefundTxSigningResult)?OA.fromJSON(A.directFromCpfpRefundTxSigningResult):void 0}),toJSON(A){const I={};return""!==A.leafId&&(I.leafId=A.leafId),void 0!==A.refundTxSigningResult&&(I.refundTxSigningResult=OA.toJSON(A.refundTxSigningResult)),0!==A.verifyingKey.length&&(I.verifyingKey=cB(A.verifyingKey)),void 0!==A.directRefundTxSigningResult&&(I.directRefundTxSigningResult=OA.toJSON(A.directRefundTxSigningResult)),void 0!==A.directFromCpfpRefundTxSigningResult&&(I.directFromCpfpRefundTxSigningResult=OA.toJSON(A.directFromCpfpRefundTxSigningResult)),I},create:A=>RI.fromPartial(A??{}),fromPartial(A){const I=FI();return I.leafId=A.leafId??"",I.refundTxSigningResult=void 0!==A.refundTxSigningResult&&null!==A.refundTxSigningResult?OA.fromPartial(A.refundTxSigningResult):void 0,I.verifyingKey=A.verifyingKey??new Uint8Array(0),I.directRefundTxSigningResult=void 0!==A.directRefundTxSigningResult&&null!==A.directRefundTxSigningResult?OA.fromPartial(A.directRefundTxSigningResult):void 0,I.directFromCpfpRefundTxSigningResult=void 0!==A.directFromCpfpRefundTxSigningResult&&null!==A.directFromCpfpRefundTxSigningResult?OA.fromPartial(A.directFromCpfpRefundTxSigningResult):void 0,I}};function UI(){return{transferId:"",ownerIdentityPublicKey:new Uint8Array(0),leavesToSend:[],receiverIdentityPublicKey:new Uint8Array(0),expiryTime:void 0,directLeavesToSend:[],directFromCpfpLeavesToSend:[]}}const MI={encode(A,I=new y){""!==A.transferId&&I.uint32(10).string(A.transferId),0!==A.ownerIdentityPublicKey.length&&I.uint32(18).bytes(A.ownerIdentityPublicKey);for(const g of A.leavesToSend)pI.encode(g,I.uint32(26).fork()).join();0!==A.receiverIdentityPublicKey.length&&I.uint32(34).bytes(A.receiverIdentityPublicKey),void 0!==A.expiryTime&&N.encode(DB(A.expiryTime),I.uint32(42).fork()).join();for(const g of A.directLeavesToSend)pI.encode(g,I.uint32(50).fork()).join();for(const g of A.directFromCpfpLeavesToSend)pI.encode(g,I.uint32(58).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=UI();for(;g.pos >>3){case 1:if(10!==A)break;B.transferId=g.string();continue;case 2:if(18!==A)break;B.ownerIdentityPublicKey=g.bytes();continue;case 3:if(26!==A)break;B.leavesToSend.push(pI.decode(g,g.uint32()));continue;case 4:if(34!==A)break;B.receiverIdentityPublicKey=g.bytes();continue;case 5:if(42!==A)break;B.expiryTime=wB(N.decode(g,g.uint32()));continue;case 6:if(50!==A)break;B.directLeavesToSend.push(pI.decode(g,g.uint32()));continue;case 7:if(58!==A)break;B.directFromCpfpLeavesToSend.push(pI.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transferId:lB(A.transferId)?globalThis.String(A.transferId):"",ownerIdentityPublicKey:lB(A.ownerIdentityPublicKey)?rB(A.ownerIdentityPublicKey):new Uint8Array(0),leavesToSend:globalThis.Array.isArray(A?.leavesToSend)?A.leavesToSend.map(A=>pI.fromJSON(A)):[],receiverIdentityPublicKey:lB(A.receiverIdentityPublicKey)?rB(A.receiverIdentityPublicKey):new Uint8Array(0),expiryTime:lB(A.expiryTime)?dB(A.expiryTime):void 0,directLeavesToSend:globalThis.Array.isArray(A?.directLeavesToSend)?A.directLeavesToSend.map(A=>pI.fromJSON(A)):[],directFromCpfpLeavesToSend:globalThis.Array.isArray(A?.directFromCpfpLeavesToSend)?A.directFromCpfpLeavesToSend.map(A=>pI.fromJSON(A)):[]}),toJSON(A){const I={};return""!==A.transferId&&(I.transferId=A.transferId),0!==A.ownerIdentityPublicKey.length&&(I.ownerIdentityPublicKey=cB(A.ownerIdentityPublicKey)),A.leavesToSend?.length&&(I.leavesToSend=A.leavesToSend.map(A=>pI.toJSON(A))),0!==A.receiverIdentityPublicKey.length&&(I.receiverIdentityPublicKey=cB(A.receiverIdentityPublicKey)),void 0!==A.expiryTime&&(I.expiryTime=A.expiryTime.toISOString()),A.directLeavesToSend?.length&&(I.directLeavesToSend=A.directLeavesToSend.map(A=>pI.toJSON(A))),A.directFromCpfpLeavesToSend?.length&&(I.directFromCpfpLeavesToSend=A.directFromCpfpLeavesToSend.map(A=>pI.toJSON(A))),I},create:A=>MI.fromPartial(A??{}),fromPartial(A){const I=UI();return I.transferId=A.transferId??"",I.ownerIdentityPublicKey=A.ownerIdentityPublicKey??new Uint8Array(0),I.leavesToSend=A.leavesToSend?.map(A=>pI.fromPartial(A))||[],I.receiverIdentityPublicKey=A.receiverIdentityPublicKey??new Uint8Array(0),I.expiryTime=A.expiryTime??void 0,I.directLeavesToSend=A.directLeavesToSend?.map(A=>pI.fromPartial(A))||[],I.directFromCpfpLeavesToSend=A.directFromCpfpLeavesToSend?.map(A=>pI.fromPartial(A))||[],I}};function KI(){return{transferId:"",ownerIdentityPublicKey:new Uint8Array(0),leavesToSend:[],receiverIdentityPublicKey:new Uint8Array(0),expiryTime:void 0,transferPackage:void 0,sparkInvoice:""}}const mI={encode(A,I=new y){""!==A.transferId&&I.uint32(10).string(A.transferId),0!==A.ownerIdentityPublicKey.length&&I.uint32(18).bytes(A.ownerIdentityPublicKey);for(const g of A.leavesToSend)NI.encode(g,I.uint32(26).fork()).join();return 0!==A.receiverIdentityPublicKey.length&&I.uint32(34).bytes(A.receiverIdentityPublicKey),void 0!==A.expiryTime&&N.encode(DB(A.expiryTime),I.uint32(42).fork()).join(),void 0!==A.transferPackage&&TI.encode(A.transferPackage,I.uint32(58).fork()).join(),""!==A.sparkInvoice&&I.uint32(82).string(A.sparkInvoice),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=KI();for(;g.pos >>3){case 1:if(10!==A)break;B.transferId=g.string();continue;case 2:if(18!==A)break;B.ownerIdentityPublicKey=g.bytes();continue;case 3:if(26!==A)break;B.leavesToSend.push(NI.decode(g,g.uint32()));continue;case 4:if(34!==A)break;B.receiverIdentityPublicKey=g.bytes();continue;case 5:if(42!==A)break;B.expiryTime=wB(N.decode(g,g.uint32()));continue;case 7:if(58!==A)break;B.transferPackage=TI.decode(g,g.uint32());continue;case 10:if(82!==A)break;B.sparkInvoice=g.string();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transferId:lB(A.transferId)?globalThis.String(A.transferId):"",ownerIdentityPublicKey:lB(A.ownerIdentityPublicKey)?rB(A.ownerIdentityPublicKey):new Uint8Array(0),leavesToSend:globalThis.Array.isArray(A?.leavesToSend)?A.leavesToSend.map(A=>NI.fromJSON(A)):[],receiverIdentityPublicKey:lB(A.receiverIdentityPublicKey)?rB(A.receiverIdentityPublicKey):new Uint8Array(0),expiryTime:lB(A.expiryTime)?dB(A.expiryTime):void 0,transferPackage:lB(A.transferPackage)?TI.fromJSON(A.transferPackage):void 0,sparkInvoice:lB(A.sparkInvoice)?globalThis.String(A.sparkInvoice):""}),toJSON(A){const I={};return""!==A.transferId&&(I.transferId=A.transferId),0!==A.ownerIdentityPublicKey.length&&(I.ownerIdentityPublicKey=cB(A.ownerIdentityPublicKey)),A.leavesToSend?.length&&(I.leavesToSend=A.leavesToSend.map(A=>NI.toJSON(A))),0!==A.receiverIdentityPublicKey.length&&(I.receiverIdentityPublicKey=cB(A.receiverIdentityPublicKey)),void 0!==A.expiryTime&&(I.expiryTime=A.expiryTime.toISOString()),void 0!==A.transferPackage&&(I.transferPackage=TI.toJSON(A.transferPackage)),""!==A.sparkInvoice&&(I.sparkInvoice=A.sparkInvoice),I},create:A=>mI.fromPartial(A??{}),fromPartial(A){const I=KI();return I.transferId=A.transferId??"",I.ownerIdentityPublicKey=A.ownerIdentityPublicKey??new Uint8Array(0),I.leavesToSend=A.leavesToSend?.map(A=>NI.fromPartial(A))||[],I.receiverIdentityPublicKey=A.receiverIdentityPublicKey??new Uint8Array(0),I.expiryTime=A.expiryTime??void 0,I.transferPackage=void 0!==A.transferPackage&&null!==A.transferPackage?TI.fromPartial(A.transferPackage):void 0,I.sparkInvoice=A.sparkInvoice??"",I}},JI={encode(A,I=new y){void 0!==A.transfer&&Bg.encode(A.transfer,I.uint32(10).fork()).join();for(const g of A.signingResults)RI.encode(g,I.uint32(18).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={transfer:void 0,signingResults:[]};for(;g.pos >>3){case 1:if(10!==A)break;B.transfer=Bg.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.signingResults.push(RI.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transfer:lB(A.transfer)?Bg.fromJSON(A.transfer):void 0,signingResults:globalThis.Array.isArray(A?.signingResults)?A.signingResults.map(A=>RI.fromJSON(A)):[]}),toJSON(A){const I={};return void 0!==A.transfer&&(I.transfer=Bg.toJSON(A.transfer)),A.signingResults?.length&&(I.signingResults=A.signingResults.map(A=>RI.toJSON(A))),I},create:A=>JI.fromPartial(A??{}),fromPartial(A){const I={transfer:void 0,signingResults:[]};return I.transfer=void 0!==A.transfer&&null!==A.transfer?Bg.fromPartial(A.transfer):void 0,I.signingResults=A.signingResults?.map(A=>RI.fromPartial(A))||[],I}};function bI(){return{ownerIdentityPublicKey:new Uint8Array(0),transferPackage:void 0,receiverIdentityPublicKeys:{}}}const HI={encode:(A,I=new y)=>(0!==A.ownerIdentityPublicKey.length&&I.uint32(10).bytes(A.ownerIdentityPublicKey),void 0!==A.transferPackage&&TI.encode(A.transferPackage,I.uint32(18).fork()).join(),Object.entries(A.receiverIdentityPublicKeys).forEach(([A,g])=>{LI.encode({key:A,value:g},I.uint32(26).fork()).join()}),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=bI();for(;g.pos >>3){case 1:if(10!==A)break;B.ownerIdentityPublicKey=g.bytes();continue;case 2:if(18!==A)break;B.transferPackage=TI.decode(g,g.uint32());continue;case 3:{if(26!==A)break;const I=LI.decode(g,g.uint32());void 0!==I.value&&(B.receiverIdentityPublicKeys[I.key]=I.value);continue}}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({ownerIdentityPublicKey:lB(A.ownerIdentityPublicKey)?rB(A.ownerIdentityPublicKey):new Uint8Array(0),transferPackage:lB(A.transferPackage)?TI.fromJSON(A.transferPackage):void 0,receiverIdentityPublicKeys:yB(A.receiverIdentityPublicKeys)?Object.entries(A.receiverIdentityPublicKeys).reduce((A,[I,g])=>(A[I]=rB(g),A),{}):{}}),toJSON(A){const I={};if(0!==A.ownerIdentityPublicKey.length&&(I.ownerIdentityPublicKey=cB(A.ownerIdentityPublicKey)),void 0!==A.transferPackage&&(I.transferPackage=TI.toJSON(A.transferPackage)),A.receiverIdentityPublicKeys){const g=Object.entries(A.receiverIdentityPublicKeys);g.length>0&&(I.receiverIdentityPublicKeys={},g.forEach(([A,g])=>{I.receiverIdentityPublicKeys[A]=cB(g)}))}return I},create:A=>HI.fromPartial(A??{}),fromPartial(A){const I=bI();return I.ownerIdentityPublicKey=A.ownerIdentityPublicKey??new Uint8Array(0),I.transferPackage=void 0!==A.transferPackage&&null!==A.transferPackage?TI.fromPartial(A.transferPackage):void 0,I.receiverIdentityPublicKeys=Object.entries(A.receiverIdentityPublicKeys??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=g),A),{}),I}};function YI(){return{key:"",value:new Uint8Array(0)}}const LI={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),0!==A.value.length&&I.uint32(18).bytes(A.value),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=YI();for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?rB(A.value):new Uint8Array(0)}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),0!==A.value.length&&(I.value=cB(A.value)),I},create:A=>LI.fromPartial(A??{}),fromPartial(A){const I=YI();return I.key=A.key??"",I.value=A.value??new Uint8Array(0),I}},qI={encode(A,I=new y){""!==A.transferId&&I.uint32(10).string(A.transferId);for(const g of A.senderPackages)HI.encode(g,I.uint32(18).fork()).join();return void 0!==A.expiryTime&&N.encode(DB(A.expiryTime),I.uint32(26).fork()).join(),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={transferId:"",senderPackages:[],expiryTime:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.transferId=g.string();continue;case 2:if(18!==A)break;B.senderPackages.push(HI.decode(g,g.uint32()));continue;case 3:if(26!==A)break;B.expiryTime=wB(N.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transferId:lB(A.transferId)?globalThis.String(A.transferId):"",senderPackages:globalThis.Array.isArray(A?.senderPackages)?A.senderPackages.map(A=>HI.fromJSON(A)):[],expiryTime:lB(A.expiryTime)?dB(A.expiryTime):void 0}),toJSON(A){const I={};return""!==A.transferId&&(I.transferId=A.transferId),A.senderPackages?.length&&(I.senderPackages=A.senderPackages.map(A=>HI.toJSON(A))),void 0!==A.expiryTime&&(I.expiryTime=A.expiryTime.toISOString()),I},create:A=>qI.fromPartial(A??{}),fromPartial(A){const I={transferId:"",senderPackages:[],expiryTime:void 0};return I.transferId=A.transferId??"",I.senderPackages=A.senderPackages?.map(A=>HI.fromPartial(A))||[],I.expiryTime=A.expiryTime??void 0,I}};function VI(){return{leavesToSend:[],keyTweakPackage:{},userSignature:new Uint8Array(0),directLeavesToSend:[],directFromCpfpLeavesToSend:[],hashVariant:0}}const TI={encode(A,I=new y){for(const g of A.leavesToSend)pI.encode(g,I.uint32(10).fork()).join();Object.entries(A.keyTweakPackage).forEach(([A,g])=>{ZI.encode({key:A,value:g},I.uint32(18).fork()).join()}),0!==A.userSignature.length&&I.uint32(26).bytes(A.userSignature);for(const g of A.directLeavesToSend)pI.encode(g,I.uint32(34).fork()).join();for(const g of A.directFromCpfpLeavesToSend)pI.encode(g,I.uint32(42).fork()).join();return 0!==A.hashVariant&&I.uint32(48).int32(A.hashVariant),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=VI();for(;g.pos >>3){case 1:if(10!==A)break;B.leavesToSend.push(pI.decode(g,g.uint32()));continue;case 2:{if(18!==A)break;const I=ZI.decode(g,g.uint32());void 0!==I.value&&(B.keyTweakPackage[I.key]=I.value);continue}case 3:if(26!==A)break;B.userSignature=g.bytes();continue;case 4:if(34!==A)break;B.directLeavesToSend.push(pI.decode(g,g.uint32()));continue;case 5:if(42!==A)break;B.directFromCpfpLeavesToSend.push(pI.decode(g,g.uint32()));continue;case 6:if(48!==A)break;B.hashVariant=g.int32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({leavesToSend:globalThis.Array.isArray(A?.leavesToSend)?A.leavesToSend.map(A=>pI.fromJSON(A)):[],keyTweakPackage:yB(A.keyTweakPackage)?Object.entries(A.keyTweakPackage).reduce((A,[I,g])=>(A[I]=rB(g),A),{}):{},userSignature:lB(A.userSignature)?rB(A.userSignature):new Uint8Array(0),directLeavesToSend:globalThis.Array.isArray(A?.directLeavesToSend)?A.directLeavesToSend.map(A=>pI.fromJSON(A)):[],directFromCpfpLeavesToSend:globalThis.Array.isArray(A?.directFromCpfpLeavesToSend)?A.directFromCpfpLeavesToSend.map(A=>pI.fromJSON(A)):[],hashVariant:lB(A.hashVariant)?BA(A.hashVariant):0}),toJSON(A){const I={};if(A.leavesToSend?.length&&(I.leavesToSend=A.leavesToSend.map(A=>pI.toJSON(A))),A.keyTweakPackage){const g=Object.entries(A.keyTweakPackage);g.length>0&&(I.keyTweakPackage={},g.forEach(([A,g])=>{I.keyTweakPackage[A]=cB(g)}))}return 0!==A.userSignature.length&&(I.userSignature=cB(A.userSignature)),A.directLeavesToSend?.length&&(I.directLeavesToSend=A.directLeavesToSend.map(A=>pI.toJSON(A))),A.directFromCpfpLeavesToSend?.length&&(I.directFromCpfpLeavesToSend=A.directFromCpfpLeavesToSend.map(A=>pI.toJSON(A))),0!==A.hashVariant&&(I.hashVariant=iA(A.hashVariant)),I},create:A=>TI.fromPartial(A??{}),fromPartial(A){const I=VI();return I.leavesToSend=A.leavesToSend?.map(A=>pI.fromPartial(A))||[],I.keyTweakPackage=Object.entries(A.keyTweakPackage??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=g),A),{}),I.userSignature=A.userSignature??new Uint8Array(0),I.directLeavesToSend=A.directLeavesToSend?.map(A=>pI.fromPartial(A))||[],I.directFromCpfpLeavesToSend=A.directFromCpfpLeavesToSend?.map(A=>pI.fromPartial(A))||[],I.hashVariant=A.hashVariant??0,I}};function vI(){return{key:"",value:new Uint8Array(0)}}const ZI={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),0!==A.value.length&&I.uint32(18).bytes(A.value),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=vI();for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?rB(A.value):new Uint8Array(0)}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),0!==A.value.length&&(I.value=cB(A.value)),I},create:A=>ZI.fromPartial(A??{}),fromPartial(A){const I=vI();return I.key=A.key??"",I.value=A.value??new Uint8Array(0),I}},xI={encode(A,I=new y){for(const g of A.leavesToSend)PI.encode(g,I.uint32(10).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={leavesToSend:[]};for(;g.pos >>3){case 1:if(10!==A)break;B.leavesToSend.push(PI.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({leavesToSend:globalThis.Array.isArray(A?.leavesToSend)?A.leavesToSend.map(A=>PI.fromJSON(A)):[]}),toJSON(A){const I={};return A.leavesToSend?.length&&(I.leavesToSend=A.leavesToSend.map(A=>PI.toJSON(A))),I},create:A=>xI.fromPartial(A??{}),fromPartial(A){const I={leavesToSend:[]};return I.leavesToSend=A.leavesToSend?.map(A=>PI.fromPartial(A))||[],I}};function WI(){return{leafId:"",secretShareTweak:void 0,pubkeySharesTweak:{},secretCipher:new Uint8Array(0),signature:new Uint8Array(0),refundSignature:new Uint8Array(0),directRefundSignature:new Uint8Array(0),directFromCpfpRefundSignature:new Uint8Array(0)}}const PI={encode:(A,I=new y)=>(""!==A.leafId&&I.uint32(10).string(A.leafId),void 0!==A.secretShareTweak&&uI.encode(A.secretShareTweak,I.uint32(18).fork()).join(),Object.entries(A.pubkeySharesTweak).forEach(([A,g])=>{XI.encode({key:A,value:g},I.uint32(26).fork()).join()}),0!==A.secretCipher.length&&I.uint32(34).bytes(A.secretCipher),0!==A.signature.length&&I.uint32(42).bytes(A.signature),0!==A.refundSignature.length&&I.uint32(50).bytes(A.refundSignature),0!==A.directRefundSignature.length&&I.uint32(58).bytes(A.directRefundSignature),0!==A.directFromCpfpRefundSignature.length&&I.uint32(66).bytes(A.directFromCpfpRefundSignature),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=WI();for(;g.pos >>3){case 1:if(10!==A)break;B.leafId=g.string();continue;case 2:if(18!==A)break;B.secretShareTweak=uI.decode(g,g.uint32());continue;case 3:{if(26!==A)break;const I=XI.decode(g,g.uint32());void 0!==I.value&&(B.pubkeySharesTweak[I.key]=I.value);continue}case 4:if(34!==A)break;B.secretCipher=g.bytes();continue;case 5:if(42!==A)break;B.signature=g.bytes();continue;case 6:if(50!==A)break;B.refundSignature=g.bytes();continue;case 7:if(58!==A)break;B.directRefundSignature=g.bytes();continue;case 8:if(66!==A)break;B.directFromCpfpRefundSignature=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({leafId:lB(A.leafId)?globalThis.String(A.leafId):"",secretShareTweak:lB(A.secretShareTweak)?uI.fromJSON(A.secretShareTweak):void 0,pubkeySharesTweak:yB(A.pubkeySharesTweak)?Object.entries(A.pubkeySharesTweak).reduce((A,[I,g])=>(A[I]=rB(g),A),{}):{},secretCipher:lB(A.secretCipher)?rB(A.secretCipher):new Uint8Array(0),signature:lB(A.signature)?rB(A.signature):new Uint8Array(0),refundSignature:lB(A.refundSignature)?rB(A.refundSignature):new Uint8Array(0),directRefundSignature:lB(A.directRefundSignature)?rB(A.directRefundSignature):new Uint8Array(0),directFromCpfpRefundSignature:lB(A.directFromCpfpRefundSignature)?rB(A.directFromCpfpRefundSignature):new Uint8Array(0)}),toJSON(A){const I={};if(""!==A.leafId&&(I.leafId=A.leafId),void 0!==A.secretShareTweak&&(I.secretShareTweak=uI.toJSON(A.secretShareTweak)),A.pubkeySharesTweak){const g=Object.entries(A.pubkeySharesTweak);g.length>0&&(I.pubkeySharesTweak={},g.forEach(([A,g])=>{I.pubkeySharesTweak[A]=cB(g)}))}return 0!==A.secretCipher.length&&(I.secretCipher=cB(A.secretCipher)),0!==A.signature.length&&(I.signature=cB(A.signature)),0!==A.refundSignature.length&&(I.refundSignature=cB(A.refundSignature)),0!==A.directRefundSignature.length&&(I.directRefundSignature=cB(A.directRefundSignature)),0!==A.directFromCpfpRefundSignature.length&&(I.directFromCpfpRefundSignature=cB(A.directFromCpfpRefundSignature)),I},create:A=>PI.fromPartial(A??{}),fromPartial(A){const I=WI();return I.leafId=A.leafId??"",I.secretShareTweak=void 0!==A.secretShareTweak&&null!==A.secretShareTweak?uI.fromPartial(A.secretShareTweak):void 0,I.pubkeySharesTweak=Object.entries(A.pubkeySharesTweak??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=g),A),{}),I.secretCipher=A.secretCipher??new Uint8Array(0),I.signature=A.signature??new Uint8Array(0),I.refundSignature=A.refundSignature??new Uint8Array(0),I.directRefundSignature=A.directRefundSignature??new Uint8Array(0),I.directFromCpfpRefundSignature=A.directFromCpfpRefundSignature??new Uint8Array(0),I}};function OI(){return{key:"",value:new Uint8Array(0)}}const XI={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),0!==A.value.length&&I.uint32(18).bytes(A.value),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=OI();for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?rB(A.value):new Uint8Array(0)}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),0!==A.value.length&&(I.value=cB(A.value)),I},create:A=>XI.fromPartial(A??{}),fromPartial(A){const I=OI();return I.key=A.key??"",I.value=A.value??new Uint8Array(0),I}};function jI(){return{transferId:"",ownerIdentityPublicKey:new Uint8Array(0),transferPackage:void 0}}const zI={encode:(A,I=new y)=>(""!==A.transferId&&I.uint32(10).string(A.transferId),0!==A.ownerIdentityPublicKey.length&&I.uint32(18).bytes(A.ownerIdentityPublicKey),void 0!==A.transferPackage&&TI.encode(A.transferPackage,I.uint32(26).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=jI();for(;g.pos >>3){case 1:if(10!==A)break;B.transferId=g.string();continue;case 2:if(18!==A)break;B.ownerIdentityPublicKey=g.bytes();continue;case 3:if(26!==A)break;B.transferPackage=TI.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transferId:lB(A.transferId)?globalThis.String(A.transferId):"",ownerIdentityPublicKey:lB(A.ownerIdentityPublicKey)?rB(A.ownerIdentityPublicKey):new Uint8Array(0),transferPackage:lB(A.transferPackage)?TI.fromJSON(A.transferPackage):void 0}),toJSON(A){const I={};return""!==A.transferId&&(I.transferId=A.transferId),0!==A.ownerIdentityPublicKey.length&&(I.ownerIdentityPublicKey=cB(A.ownerIdentityPublicKey)),void 0!==A.transferPackage&&(I.transferPackage=TI.toJSON(A.transferPackage)),I},create:A=>zI.fromPartial(A??{}),fromPartial(A){const I=jI();return I.transferId=A.transferId??"",I.ownerIdentityPublicKey=A.ownerIdentityPublicKey??new Uint8Array(0),I.transferPackage=void 0!==A.transferPackage&&null!==A.transferPackage?TI.fromPartial(A.transferPackage):void 0,I}},_I={encode:(A,I=new y)=>(void 0!==A.transfer&&Bg.encode(A.transfer,I.uint32(10).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={transfer:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.transfer=Bg.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transfer:lB(A.transfer)?Bg.fromJSON(A.transfer):void 0}),toJSON(A){const I={};return void 0!==A.transfer&&(I.transfer=Bg.toJSON(A.transfer)),I},create:A=>_I.fromPartial(A??{}),fromPartial(A){const I={transfer:void 0};return I.transfer=void 0!==A.transfer&&null!==A.transfer?Bg.fromPartial(A.transfer):void 0,I}};function $I(){return{identityPublicKey:new Uint8Array(0),amountSats:0,status:0,id:"",completionTime:void 0}}const Ag={encode:(A,I=new y)=>(0!==A.identityPublicKey.length&&I.uint32(10).bytes(A.identityPublicKey),0!==A.amountSats&&I.uint32(16).uint64(A.amountSats),0!==A.status&&I.uint32(24).int32(A.status),""!==A.id&&I.uint32(34).string(A.id),void 0!==A.completionTime&&N.encode(DB(A.completionTime),I.uint32(42).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=$I();for(;g.pos >>3){case 1:if(10!==A)break;B.identityPublicKey=g.bytes();continue;case 2:if(16!==A)break;B.amountSats=hB(g.uint64());continue;case 3:if(24!==A)break;B.status=g.int32();continue;case 4:if(34!==A)break;B.id=g.string();continue;case 5:if(42!==A)break;B.completionTime=wB(N.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0),amountSats:lB(A.amountSats)?globalThis.Number(A.amountSats):0,status:lB(A.status)?Z(A.status):0,id:lB(A.id)?globalThis.String(A.id):"",completionTime:lB(A.completionTime)?dB(A.completionTime):void 0}),toJSON(A){const I={};return 0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),0!==A.amountSats&&(I.amountSats=Math.round(A.amountSats)),0!==A.status&&(I.status=function(A){switch(A){case v.TRANSFER_RECEIVER_STATUS_INITIATED:return"TRANSFER_RECEIVER_STATUS_INITIATED";case v.TRANSFER_RECEIVER_STATUS_CLAIM_PENDING:return"TRANSFER_RECEIVER_STATUS_CLAIM_PENDING";case v.TRANSFER_RECEIVER_STATUS_KEY_TWEAKED:return"TRANSFER_RECEIVER_STATUS_KEY_TWEAKED";case v.TRANSFER_RECEIVER_STATUS_KEY_TWEAK_LOCKED:return"TRANSFER_RECEIVER_STATUS_KEY_TWEAK_LOCKED";case v.TRANSFER_RECEIVER_STATUS_KEY_TWEAK_APPLIED:return"TRANSFER_RECEIVER_STATUS_KEY_TWEAK_APPLIED";case v.TRANSFER_RECEIVER_STATUS_REFUND_SIGNED:return"TRANSFER_RECEIVER_STATUS_REFUND_SIGNED";case v.TRANSFER_RECEIVER_STATUS_COMPLETED:return"TRANSFER_RECEIVER_STATUS_COMPLETED";case v.TRANSFER_RECEIVER_STATUS_CANCELLED:return"TRANSFER_RECEIVER_STATUS_CANCELLED";case v.UNRECOGNIZED:default:return"UNRECOGNIZED"}}(A.status)),""!==A.id&&(I.id=A.id),void 0!==A.completionTime&&(I.completionTime=A.completionTime.toISOString()),I},create:A=>Ag.fromPartial(A??{}),fromPartial(A){const I=$I();return I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I.amountSats=A.amountSats??0,I.status=A.status??0,I.id=A.id??"",I.completionTime=A.completionTime??void 0,I}};function Ig(){return{id:"",identityPublicKey:new Uint8Array(0)}}const gg={encode:(A,I=new y)=>(""!==A.id&&I.uint32(10).string(A.id),0!==A.identityPublicKey.length&&I.uint32(18).bytes(A.identityPublicKey),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=Ig();for(;g.pos >>3){case 1:if(10!==A)break;B.id=g.string();continue;case 2:if(18!==A)break;B.identityPublicKey=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({id:lB(A.id)?globalThis.String(A.id):"",identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0)}),toJSON(A){const I={};return""!==A.id&&(I.id=A.id),0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),I},create:A=>gg.fromPartial(A??{}),fromPartial(A){const I=Ig();return I.id=A.id??"",I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I}};function Cg(){return{id:"",senderIdentityPublicKey:new Uint8Array(0),receiverIdentityPublicKey:new Uint8Array(0),status:0,totalValue:0,expiryTime:void 0,leaves:[],createdTime:void 0,updatedTime:void 0,type:0,sparkInvoice:"",network:0,receivers:[],senders:[]}}const Bg={encode(A,I=new y){""!==A.id&&I.uint32(10).string(A.id),0!==A.senderIdentityPublicKey.length&&I.uint32(18).bytes(A.senderIdentityPublicKey),0!==A.receiverIdentityPublicKey.length&&I.uint32(26).bytes(A.receiverIdentityPublicKey),0!==A.status&&I.uint32(32).int32(A.status),0!==A.totalValue&&I.uint32(40).uint64(A.totalValue),void 0!==A.expiryTime&&N.encode(DB(A.expiryTime),I.uint32(50).fork()).join();for(const g of A.leaves)Qg.encode(g,I.uint32(58).fork()).join();void 0!==A.createdTime&&N.encode(DB(A.createdTime),I.uint32(66).fork()).join(),void 0!==A.updatedTime&&N.encode(DB(A.updatedTime),I.uint32(74).fork()).join(),0!==A.type&&I.uint32(80).int32(A.type),""!==A.sparkInvoice&&I.uint32(90).string(A.sparkInvoice),0!==A.network&&I.uint32(96).int32(A.network);for(const g of A.receivers)Ag.encode(g,I.uint32(106).fork()).join();for(const g of A.senders)gg.encode(g,I.uint32(114).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=Cg();for(;g.pos >>3){case 1:if(10!==A)break;B.id=g.string();continue;case 2:if(18!==A)break;B.senderIdentityPublicKey=g.bytes();continue;case 3:if(26!==A)break;B.receiverIdentityPublicKey=g.bytes();continue;case 4:if(32!==A)break;B.status=g.int32();continue;case 5:if(40!==A)break;B.totalValue=hB(g.uint64());continue;case 6:if(50!==A)break;B.expiryTime=wB(N.decode(g,g.uint32()));continue;case 7:if(58!==A)break;B.leaves.push(Qg.decode(g,g.uint32()));continue;case 8:if(66!==A)break;B.createdTime=wB(N.decode(g,g.uint32()));continue;case 9:if(74!==A)break;B.updatedTime=wB(N.decode(g,g.uint32()));continue;case 10:if(80!==A)break;B.type=g.int32();continue;case 11:if(90!==A)break;B.sparkInvoice=g.string();continue;case 12:if(96!==A)break;B.network=g.int32();continue;case 13:if(106!==A)break;B.receivers.push(Ag.decode(g,g.uint32()));continue;case 14:if(114!==A)break;B.senders.push(gg.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({id:lB(A.id)?globalThis.String(A.id):"",senderIdentityPublicKey:lB(A.senderIdentityPublicKey)?rB(A.senderIdentityPublicKey):new Uint8Array(0),receiverIdentityPublicKey:lB(A.receiverIdentityPublicKey)?rB(A.receiverIdentityPublicKey):new Uint8Array(0),status:lB(A.status)?V(A.status):0,totalValue:lB(A.totalValue)?globalThis.Number(A.totalValue):0,expiryTime:lB(A.expiryTime)?dB(A.expiryTime):void 0,leaves:globalThis.Array.isArray(A?.leaves)?A.leaves.map(A=>Qg.fromJSON(A)):[],createdTime:lB(A.createdTime)?dB(A.createdTime):void 0,updatedTime:lB(A.updatedTime)?dB(A.updatedTime):void 0,type:lB(A.type)?W(A.type):0,sparkInvoice:lB(A.sparkInvoice)?globalThis.String(A.sparkInvoice):"",network:lB(A.network)?b(A.network):0,receivers:globalThis.Array.isArray(A?.receivers)?A.receivers.map(A=>Ag.fromJSON(A)):[],senders:globalThis.Array.isArray(A?.senders)?A.senders.map(A=>gg.fromJSON(A)):[]}),toJSON(A){const I={};return""!==A.id&&(I.id=A.id),0!==A.senderIdentityPublicKey.length&&(I.senderIdentityPublicKey=cB(A.senderIdentityPublicKey)),0!==A.receiverIdentityPublicKey.length&&(I.receiverIdentityPublicKey=cB(A.receiverIdentityPublicKey)),0!==A.status&&(I.status=T(A.status)),0!==A.totalValue&&(I.totalValue=Math.round(A.totalValue)),void 0!==A.expiryTime&&(I.expiryTime=A.expiryTime.toISOString()),A.leaves?.length&&(I.leaves=A.leaves.map(A=>Qg.toJSON(A))),void 0!==A.createdTime&&(I.createdTime=A.createdTime.toISOString()),void 0!==A.updatedTime&&(I.updatedTime=A.updatedTime.toISOString()),0!==A.type&&(I.type=P(A.type)),""!==A.sparkInvoice&&(I.sparkInvoice=A.sparkInvoice),0!==A.network&&(I.network=H(A.network)),A.receivers?.length&&(I.receivers=A.receivers.map(A=>Ag.toJSON(A))),A.senders?.length&&(I.senders=A.senders.map(A=>gg.toJSON(A))),I},create:A=>Bg.fromPartial(A??{}),fromPartial(A){const I=Cg();return I.id=A.id??"",I.senderIdentityPublicKey=A.senderIdentityPublicKey??new Uint8Array(0),I.receiverIdentityPublicKey=A.receiverIdentityPublicKey??new Uint8Array(0),I.status=A.status??0,I.totalValue=A.totalValue??0,I.expiryTime=A.expiryTime??void 0,I.leaves=A.leaves?.map(A=>Qg.fromPartial(A))||[],I.createdTime=A.createdTime??void 0,I.updatedTime=A.updatedTime??void 0,I.type=A.type??0,I.sparkInvoice=A.sparkInvoice??"",I.network=A.network??0,I.receivers=A.receivers?.map(A=>Ag.fromPartial(A))||[],I.senders=A.senders?.map(A=>gg.fromPartial(A))||[],I}};function ig(){return{leaf:void 0,secretCipher:new Uint8Array(0),signature:new Uint8Array(0),intermediateRefundTx:new Uint8Array(0),intermediateDirectRefundTx:new Uint8Array(0),intermediateDirectFromCpfpRefundTx:new Uint8Array(0),pendingKeyTweakPublicKey:new Uint8Array(0),transferReceiverId:"",transferSenderId:""}}const Qg={encode:(A,I=new y)=>(void 0!==A.leaf&&hI.encode(A.leaf,I.uint32(10).fork()).join(),0!==A.secretCipher.length&&I.uint32(18).bytes(A.secretCipher),0!==A.signature.length&&I.uint32(26).bytes(A.signature),0!==A.intermediateRefundTx.length&&I.uint32(34).bytes(A.intermediateRefundTx),0!==A.intermediateDirectRefundTx.length&&I.uint32(42).bytes(A.intermediateDirectRefundTx),0!==A.intermediateDirectFromCpfpRefundTx.length&&I.uint32(50).bytes(A.intermediateDirectFromCpfpRefundTx),0!==A.pendingKeyTweakPublicKey.length&&I.uint32(58).bytes(A.pendingKeyTweakPublicKey),""!==A.transferReceiverId&&I.uint32(66).string(A.transferReceiverId),""!==A.transferSenderId&&I.uint32(74).string(A.transferSenderId),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=ig();for(;g.pos >>3){case 1:if(10!==A)break;B.leaf=hI.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.secretCipher=g.bytes();continue;case 3:if(26!==A)break;B.signature=g.bytes();continue;case 4:if(34!==A)break;B.intermediateRefundTx=g.bytes();continue;case 5:if(42!==A)break;B.intermediateDirectRefundTx=g.bytes();continue;case 6:if(50!==A)break;B.intermediateDirectFromCpfpRefundTx=g.bytes();continue;case 7:if(58!==A)break;B.pendingKeyTweakPublicKey=g.bytes();continue;case 8:if(66!==A)break;B.transferReceiverId=g.string();continue;case 9:if(74!==A)break;B.transferSenderId=g.string();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({leaf:lB(A.leaf)?hI.fromJSON(A.leaf):void 0,secretCipher:lB(A.secretCipher)?rB(A.secretCipher):new Uint8Array(0),signature:lB(A.signature)?rB(A.signature):new Uint8Array(0),intermediateRefundTx:lB(A.intermediateRefundTx)?rB(A.intermediateRefundTx):new Uint8Array(0),intermediateDirectRefundTx:lB(A.intermediateDirectRefundTx)?rB(A.intermediateDirectRefundTx):new Uint8Array(0),intermediateDirectFromCpfpRefundTx:lB(A.intermediateDirectFromCpfpRefundTx)?rB(A.intermediateDirectFromCpfpRefundTx):new Uint8Array(0),pendingKeyTweakPublicKey:lB(A.pendingKeyTweakPublicKey)?rB(A.pendingKeyTweakPublicKey):new Uint8Array(0),transferReceiverId:lB(A.transferReceiverId)?globalThis.String(A.transferReceiverId):"",transferSenderId:lB(A.transferSenderId)?globalThis.String(A.transferSenderId):""}),toJSON(A){const I={};return void 0!==A.leaf&&(I.leaf=hI.toJSON(A.leaf)),0!==A.secretCipher.length&&(I.secretCipher=cB(A.secretCipher)),0!==A.signature.length&&(I.signature=cB(A.signature)),0!==A.intermediateRefundTx.length&&(I.intermediateRefundTx=cB(A.intermediateRefundTx)),0!==A.intermediateDirectRefundTx.length&&(I.intermediateDirectRefundTx=cB(A.intermediateDirectRefundTx)),0!==A.intermediateDirectFromCpfpRefundTx.length&&(I.intermediateDirectFromCpfpRefundTx=cB(A.intermediateDirectFromCpfpRefundTx)),0!==A.pendingKeyTweakPublicKey.length&&(I.pendingKeyTweakPublicKey=cB(A.pendingKeyTweakPublicKey)),""!==A.transferReceiverId&&(I.transferReceiverId=A.transferReceiverId),""!==A.transferSenderId&&(I.transferSenderId=A.transferSenderId),I},create:A=>Qg.fromPartial(A??{}),fromPartial(A){const I=ig();return I.leaf=void 0!==A.leaf&&null!==A.leaf?hI.fromPartial(A.leaf):void 0,I.secretCipher=A.secretCipher??new Uint8Array(0),I.signature=A.signature??new Uint8Array(0),I.intermediateRefundTx=A.intermediateRefundTx??new Uint8Array(0),I.intermediateDirectRefundTx=A.intermediateDirectRefundTx??new Uint8Array(0),I.intermediateDirectFromCpfpRefundTx=A.intermediateDirectFromCpfpRefundTx??new Uint8Array(0),I.pendingKeyTweakPublicKey=A.pendingKeyTweakPublicKey??new Uint8Array(0),I.transferReceiverId=A.transferReceiverId??"",I.transferSenderId=A.transferSenderId??"",I}},eg={encode(A,I=new y){switch(A.participant?.$case){case"receiverIdentityPublicKey":I.uint32(10).bytes(A.participant.receiverIdentityPublicKey);break;case"senderIdentityPublicKey":I.uint32(18).bytes(A.participant.senderIdentityPublicKey);break;case"senderOrReceiverIdentityPublicKey":I.uint32(482).bytes(A.participant.senderOrReceiverIdentityPublicKey)}for(const g of A.transferIds)I.uint32(26).string(g);0!==A.limit&&I.uint32(320).int64(A.limit),0!==A.offset&&I.uint32(400).int64(A.offset),I.uint32(562).fork();for(const g of A.types)I.int32(g);I.join(),0!==A.network&&I.uint32(32).int32(A.network),I.uint32(642).fork();for(const g of A.statuses)I.int32(g);switch(I.join(),0!==A.order&&I.uint32(40).int32(A.order),A.timeFilter?.$case){case"createdAfter":N.encode(DB(A.timeFilter.createdAfter),I.uint32(50).fork()).join();break;case"createdBefore":N.encode(DB(A.timeFilter.createdBefore),I.uint32(58).fork()).join()}return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={participant:void 0,transferIds:[],limit:0,offset:0,types:[],network:0,statuses:[],order:0,timeFilter:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.participant={$case:"receiverIdentityPublicKey",receiverIdentityPublicKey:g.bytes()};continue;case 2:if(18!==A)break;B.participant={$case:"senderIdentityPublicKey",senderIdentityPublicKey:g.bytes()};continue;case 60:if(482!==A)break;B.participant={$case:"senderOrReceiverIdentityPublicKey",senderOrReceiverIdentityPublicKey:g.bytes()};continue;case 3:if(26!==A)break;B.transferIds.push(g.string());continue;case 40:if(320!==A)break;B.limit=hB(g.int64());continue;case 50:if(400!==A)break;B.offset=hB(g.int64());continue;case 70:if(560===A){B.types.push(g.int32());continue}if(562===A){const A=g.uint32()+g.pos;for(;g.pos({participant:lB(A.receiverIdentityPublicKey)?{$case:"receiverIdentityPublicKey",receiverIdentityPublicKey:rB(A.receiverIdentityPublicKey)}:lB(A.senderIdentityPublicKey)?{$case:"senderIdentityPublicKey",senderIdentityPublicKey:rB(A.senderIdentityPublicKey)}:lB(A.senderOrReceiverIdentityPublicKey)?{$case:"senderOrReceiverIdentityPublicKey",senderOrReceiverIdentityPublicKey:rB(A.senderOrReceiverIdentityPublicKey)}:void 0,transferIds:globalThis.Array.isArray(A?.transferIds)?A.transferIds.map(A=>globalThis.String(A)):[],limit:lB(A.limit)?globalThis.Number(A.limit):0,offset:lB(A.offset)?globalThis.Number(A.offset):0,types:globalThis.Array.isArray(A?.types)?A.types.map(A=>W(A)):[],network:lB(A.network)?b(A.network):0,statuses:globalThis.Array.isArray(A?.statuses)?A.statuses.map(A=>V(A)):[],order:lB(A.order)?X(A.order):0,timeFilter:lB(A.createdAfter)?{$case:"createdAfter",createdAfter:dB(A.createdAfter)}:lB(A.createdBefore)?{$case:"createdBefore",createdBefore:dB(A.createdBefore)}:void 0}),toJSON(A){const I={};return"receiverIdentityPublicKey"===A.participant?.$case?I.receiverIdentityPublicKey=cB(A.participant.receiverIdentityPublicKey):"senderIdentityPublicKey"===A.participant?.$case?I.senderIdentityPublicKey=cB(A.participant.senderIdentityPublicKey):"senderOrReceiverIdentityPublicKey"===A.participant?.$case&&(I.senderOrReceiverIdentityPublicKey=cB(A.participant.senderOrReceiverIdentityPublicKey)),A.transferIds?.length&&(I.transferIds=A.transferIds),0!==A.limit&&(I.limit=Math.round(A.limit)),0!==A.offset&&(I.offset=Math.round(A.offset)),A.types?.length&&(I.types=A.types.map(A=>P(A))),0!==A.network&&(I.network=H(A.network)),A.statuses?.length&&(I.statuses=A.statuses.map(A=>T(A))),0!==A.order&&(I.order=j(A.order)),"createdAfter"===A.timeFilter?.$case?I.createdAfter=A.timeFilter.createdAfter.toISOString():"createdBefore"===A.timeFilter?.$case&&(I.createdBefore=A.timeFilter.createdBefore.toISOString()),I},create:A=>eg.fromPartial(A??{}),fromPartial(A){const I={participant:void 0,transferIds:[],limit:0,offset:0,types:[],network:0,statuses:[],order:0,timeFilter:void 0};switch(A.participant?.$case){case"receiverIdentityPublicKey":void 0!==A.participant?.receiverIdentityPublicKey&&null!==A.participant?.receiverIdentityPublicKey&&(I.participant={$case:"receiverIdentityPublicKey",receiverIdentityPublicKey:A.participant.receiverIdentityPublicKey});break;case"senderIdentityPublicKey":void 0!==A.participant?.senderIdentityPublicKey&&null!==A.participant?.senderIdentityPublicKey&&(I.participant={$case:"senderIdentityPublicKey",senderIdentityPublicKey:A.participant.senderIdentityPublicKey});break;case"senderOrReceiverIdentityPublicKey":void 0!==A.participant?.senderOrReceiverIdentityPublicKey&&null!==A.participant?.senderOrReceiverIdentityPublicKey&&(I.participant={$case:"senderOrReceiverIdentityPublicKey",senderOrReceiverIdentityPublicKey:A.participant.senderOrReceiverIdentityPublicKey})}switch(I.transferIds=A.transferIds?.map(A=>A)||[],I.limit=A.limit??0,I.offset=A.offset??0,I.types=A.types?.map(A=>A)||[],I.network=A.network??0,I.statuses=A.statuses?.map(A=>A)||[],I.order=A.order??0,A.timeFilter?.$case){case"createdAfter":void 0!==A.timeFilter?.createdAfter&&null!==A.timeFilter?.createdAfter&&(I.timeFilter={$case:"createdAfter",createdAfter:A.timeFilter.createdAfter});break;case"createdBefore":void 0!==A.timeFilter?.createdBefore&&null!==A.timeFilter?.createdBefore&&(I.timeFilter={$case:"createdBefore",createdBefore:A.timeFilter.createdBefore})}return I}},Eg={encode(A,I=new y){for(const g of A.transfers)Bg.encode(g,I.uint32(10).fork()).join();return 0!==A.offset&&I.uint32(16).int64(A.offset),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={transfers:[],offset:0};for(;g.pos >>3){case 1:if(10!==A)break;B.transfers.push(Bg.decode(g,g.uint32()));continue;case 2:if(16!==A)break;B.offset=hB(g.int64());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transfers:globalThis.Array.isArray(A?.transfers)?A.transfers.map(A=>Bg.fromJSON(A)):[],offset:lB(A.offset)?globalThis.Number(A.offset):0}),toJSON(A){const I={};return A.transfers?.length&&(I.transfers=A.transfers.map(A=>Bg.toJSON(A))),0!==A.offset&&(I.offset=Math.round(A.offset)),I},create:A=>Eg.fromPartial(A??{}),fromPartial(A){const I={transfers:[],offset:0};return I.transfers=A.transfers?.map(A=>Bg.fromPartial(A))||[],I.offset=A.offset??0,I}},tg={encode:(A,I=new y)=>(""!==A.leafId&&I.uint32(10).string(A.leafId),void 0!==A.secretShareTweak&&uI.encode(A.secretShareTweak,I.uint32(18).fork()).join(),Object.entries(A.pubkeySharesTweak).forEach(([A,g])=>{ng.encode({key:A,value:g},I.uint32(26).fork()).join()}),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={leafId:"",secretShareTweak:void 0,pubkeySharesTweak:{}};for(;g.pos >>3){case 1:if(10!==A)break;B.leafId=g.string();continue;case 2:if(18!==A)break;B.secretShareTweak=uI.decode(g,g.uint32());continue;case 3:{if(26!==A)break;const I=ng.decode(g,g.uint32());void 0!==I.value&&(B.pubkeySharesTweak[I.key]=I.value);continue}}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({leafId:lB(A.leafId)?globalThis.String(A.leafId):"",secretShareTweak:lB(A.secretShareTweak)?uI.fromJSON(A.secretShareTweak):void 0,pubkeySharesTweak:yB(A.pubkeySharesTweak)?Object.entries(A.pubkeySharesTweak).reduce((A,[I,g])=>(A[I]=rB(g),A),{}):{}}),toJSON(A){const I={};if(""!==A.leafId&&(I.leafId=A.leafId),void 0!==A.secretShareTweak&&(I.secretShareTweak=uI.toJSON(A.secretShareTweak)),A.pubkeySharesTweak){const g=Object.entries(A.pubkeySharesTweak);g.length>0&&(I.pubkeySharesTweak={},g.forEach(([A,g])=>{I.pubkeySharesTweak[A]=cB(g)}))}return I},create:A=>tg.fromPartial(A??{}),fromPartial(A){const I={leafId:"",secretShareTweak:void 0,pubkeySharesTweak:{}};return I.leafId=A.leafId??"",I.secretShareTweak=void 0!==A.secretShareTweak&&null!==A.secretShareTweak?uI.fromPartial(A.secretShareTweak):void 0,I.pubkeySharesTweak=Object.entries(A.pubkeySharesTweak??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=g),A),{}),I}};function og(){return{key:"",value:new Uint8Array(0)}}const ng={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),0!==A.value.length&&I.uint32(18).bytes(A.value),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=og();for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?rB(A.value):new Uint8Array(0)}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),0!==A.value.length&&(I.value=cB(A.value)),I},create:A=>ng.fromPartial(A??{}),fromPartial(A){const I=og();return I.key=A.key??"",I.value=A.value??new Uint8Array(0),I}},ag={encode(A,I=new y){for(const g of A.leavesToReceive)tg.encode(g,I.uint32(10).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={leavesToReceive:[]};for(;g.pos >>3){case 1:if(10!==A)break;B.leavesToReceive.push(tg.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({leavesToReceive:globalThis.Array.isArray(A?.leavesToReceive)?A.leavesToReceive.map(A=>tg.fromJSON(A)):[]}),toJSON(A){const I={};return A.leavesToReceive?.length&&(I.leavesToReceive=A.leavesToReceive.map(A=>tg.toJSON(A))),I},create:A=>ag.fromPartial(A??{}),fromPartial(A){const I={leavesToReceive:[]};return I.leavesToReceive=A.leavesToReceive?.map(A=>tg.fromPartial(A))||[],I}};function sg(){return{leavesToClaim:[],keyTweakPackage:{},userSignature:new Uint8Array(0),directLeavesToClaim:[],directFromCpfpLeavesToClaim:[],hashVariant:0}}const rg={encode(A,I=new y){for(const g of A.leavesToClaim)pI.encode(g,I.uint32(10).fork()).join();Object.entries(A.keyTweakPackage).forEach(([A,g])=>{Dg.encode({key:A,value:g},I.uint32(18).fork()).join()}),0!==A.userSignature.length&&I.uint32(26).bytes(A.userSignature);for(const g of A.directLeavesToClaim)pI.encode(g,I.uint32(34).fork()).join();for(const g of A.directFromCpfpLeavesToClaim)pI.encode(g,I.uint32(42).fork()).join();return 0!==A.hashVariant&&I.uint32(48).int32(A.hashVariant),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=sg();for(;g.pos >>3){case 1:if(10!==A)break;B.leavesToClaim.push(pI.decode(g,g.uint32()));continue;case 2:{if(18!==A)break;const I=Dg.decode(g,g.uint32());void 0!==I.value&&(B.keyTweakPackage[I.key]=I.value);continue}case 3:if(26!==A)break;B.userSignature=g.bytes();continue;case 4:if(34!==A)break;B.directLeavesToClaim.push(pI.decode(g,g.uint32()));continue;case 5:if(42!==A)break;B.directFromCpfpLeavesToClaim.push(pI.decode(g,g.uint32()));continue;case 6:if(48!==A)break;B.hashVariant=g.int32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({leavesToClaim:globalThis.Array.isArray(A?.leavesToClaim)?A.leavesToClaim.map(A=>pI.fromJSON(A)):[],keyTweakPackage:yB(A.keyTweakPackage)?Object.entries(A.keyTweakPackage).reduce((A,[I,g])=>(A[I]=rB(g),A),{}):{},userSignature:lB(A.userSignature)?rB(A.userSignature):new Uint8Array(0),directLeavesToClaim:globalThis.Array.isArray(A?.directLeavesToClaim)?A.directLeavesToClaim.map(A=>pI.fromJSON(A)):[],directFromCpfpLeavesToClaim:globalThis.Array.isArray(A?.directFromCpfpLeavesToClaim)?A.directFromCpfpLeavesToClaim.map(A=>pI.fromJSON(A)):[],hashVariant:lB(A.hashVariant)?BA(A.hashVariant):0}),toJSON(A){const I={};if(A.leavesToClaim?.length&&(I.leavesToClaim=A.leavesToClaim.map(A=>pI.toJSON(A))),A.keyTweakPackage){const g=Object.entries(A.keyTweakPackage);g.length>0&&(I.keyTweakPackage={},g.forEach(([A,g])=>{I.keyTweakPackage[A]=cB(g)}))}return 0!==A.userSignature.length&&(I.userSignature=cB(A.userSignature)),A.directLeavesToClaim?.length&&(I.directLeavesToClaim=A.directLeavesToClaim.map(A=>pI.toJSON(A))),A.directFromCpfpLeavesToClaim?.length&&(I.directFromCpfpLeavesToClaim=A.directFromCpfpLeavesToClaim.map(A=>pI.toJSON(A))),0!==A.hashVariant&&(I.hashVariant=iA(A.hashVariant)),I},create:A=>rg.fromPartial(A??{}),fromPartial(A){const I=sg();return I.leavesToClaim=A.leavesToClaim?.map(A=>pI.fromPartial(A))||[],I.keyTweakPackage=Object.entries(A.keyTweakPackage??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=g),A),{}),I.userSignature=A.userSignature??new Uint8Array(0),I.directLeavesToClaim=A.directLeavesToClaim?.map(A=>pI.fromPartial(A))||[],I.directFromCpfpLeavesToClaim=A.directFromCpfpLeavesToClaim?.map(A=>pI.fromPartial(A))||[],I.hashVariant=A.hashVariant??0,I}};function cg(){return{key:"",value:new Uint8Array(0)}}const Dg={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),0!==A.value.length&&I.uint32(18).bytes(A.value),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=cg();for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?rB(A.value):new Uint8Array(0)}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),0!==A.value.length&&(I.value=cB(A.value)),I},create:A=>Dg.fromPartial(A??{}),fromPartial(A){const I=cg();return I.key=A.key??"",I.value=A.value??new Uint8Array(0),I}};function wg(){return{transferId:"",ownerIdentityPublicKey:new Uint8Array(0),claimPackage:void 0}}const dg={encode:(A,I=new y)=>(""!==A.transferId&&I.uint32(10).string(A.transferId),0!==A.ownerIdentityPublicKey.length&&I.uint32(18).bytes(A.ownerIdentityPublicKey),void 0!==A.claimPackage&&rg.encode(A.claimPackage,I.uint32(26).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=wg();for(;g.pos >>3){case 1:if(10!==A)break;B.transferId=g.string();continue;case 2:if(18!==A)break;B.ownerIdentityPublicKey=g.bytes();continue;case 3:if(26!==A)break;B.claimPackage=rg.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transferId:lB(A.transferId)?globalThis.String(A.transferId):"",ownerIdentityPublicKey:lB(A.ownerIdentityPublicKey)?rB(A.ownerIdentityPublicKey):new Uint8Array(0),claimPackage:lB(A.claimPackage)?rg.fromJSON(A.claimPackage):void 0}),toJSON(A){const I={};return""!==A.transferId&&(I.transferId=A.transferId),0!==A.ownerIdentityPublicKey.length&&(I.ownerIdentityPublicKey=cB(A.ownerIdentityPublicKey)),void 0!==A.claimPackage&&(I.claimPackage=rg.toJSON(A.claimPackage)),I},create:A=>dg.fromPartial(A??{}),fromPartial(A){const I=wg();return I.transferId=A.transferId??"",I.ownerIdentityPublicKey=A.ownerIdentityPublicKey??new Uint8Array(0),I.claimPackage=void 0!==A.claimPackage&&null!==A.claimPackage?rg.fromPartial(A.claimPackage):void 0,I}},hg={encode:(A,I=new y)=>(void 0!==A.transfer&&Bg.encode(A.transfer,I.uint32(10).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={transfer:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.transfer=Bg.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transfer:lB(A.transfer)?Bg.fromJSON(A.transfer):void 0}),toJSON(A){const I={};return void 0!==A.transfer&&(I.transfer=Bg.toJSON(A.transfer)),I},create:A=>hg.fromPartial(A??{}),fromPartial(A){const I={transfer:void 0};return I.transfer=void 0!==A.transfer&&null!==A.transfer?Bg.fromPartial(A.transfer):void 0,I}};function yg(){return{transferId:"",ownerIdentityPublicKey:new Uint8Array(0),leavesToReceive:[]}}const lg={encode(A,I=new y){""!==A.transferId&&I.uint32(10).string(A.transferId),0!==A.ownerIdentityPublicKey.length&&I.uint32(18).bytes(A.ownerIdentityPublicKey);for(const g of A.leavesToReceive)tg.encode(g,I.uint32(26).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=yg();for(;g.pos >>3){case 1:if(10!==A)break;B.transferId=g.string();continue;case 2:if(18!==A)break;B.ownerIdentityPublicKey=g.bytes();continue;case 3:if(26!==A)break;B.leavesToReceive.push(tg.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transferId:lB(A.transferId)?globalThis.String(A.transferId):"",ownerIdentityPublicKey:lB(A.ownerIdentityPublicKey)?rB(A.ownerIdentityPublicKey):new Uint8Array(0),leavesToReceive:globalThis.Array.isArray(A?.leavesToReceive)?A.leavesToReceive.map(A=>tg.fromJSON(A)):[]}),toJSON(A){const I={};return""!==A.transferId&&(I.transferId=A.transferId),0!==A.ownerIdentityPublicKey.length&&(I.ownerIdentityPublicKey=cB(A.ownerIdentityPublicKey)),A.leavesToReceive?.length&&(I.leavesToReceive=A.leavesToReceive.map(A=>tg.toJSON(A))),I},create:A=>lg.fromPartial(A??{}),fromPartial(A){const I=yg();return I.transferId=A.transferId??"",I.ownerIdentityPublicKey=A.ownerIdentityPublicKey??new Uint8Array(0),I.leavesToReceive=A.leavesToReceive?.map(A=>tg.fromPartial(A))||[],I}};function kg(){return{transferId:"",ownerIdentityPublicKey:new Uint8Array(0),signingJobs:[]}}const ug={encode(A,I=new y){""!==A.transferId&&I.uint32(10).string(A.transferId),0!==A.ownerIdentityPublicKey.length&&I.uint32(18).bytes(A.ownerIdentityPublicKey);for(const g of A.signingJobs)NI.encode(g,I.uint32(26).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=kg();for(;g.pos >>3){case 1:if(10!==A)break;B.transferId=g.string();continue;case 2:if(18!==A)break;B.ownerIdentityPublicKey=g.bytes();continue;case 3:if(26!==A)break;B.signingJobs.push(NI.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transferId:lB(A.transferId)?globalThis.String(A.transferId):"",ownerIdentityPublicKey:lB(A.ownerIdentityPublicKey)?rB(A.ownerIdentityPublicKey):new Uint8Array(0),signingJobs:globalThis.Array.isArray(A?.signingJobs)?A.signingJobs.map(A=>NI.fromJSON(A)):[]}),toJSON(A){const I={};return""!==A.transferId&&(I.transferId=A.transferId),0!==A.ownerIdentityPublicKey.length&&(I.ownerIdentityPublicKey=cB(A.ownerIdentityPublicKey)),A.signingJobs?.length&&(I.signingJobs=A.signingJobs.map(A=>NI.toJSON(A))),I},create:A=>ug.fromPartial(A??{}),fromPartial(A){const I=kg();return I.transferId=A.transferId??"",I.ownerIdentityPublicKey=A.ownerIdentityPublicKey??new Uint8Array(0),I.signingJobs=A.signingJobs?.map(A=>NI.fromPartial(A))||[],I}},Ng={encode(A,I=new y){for(const g of A.signingResults)RI.encode(g,I.uint32(10).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={signingResults:[]};for(;g.pos >>3){case 1:if(10!==A)break;B.signingResults.push(RI.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({signingResults:globalThis.Array.isArray(A?.signingResults)?A.signingResults.map(A=>RI.fromJSON(A)):[]}),toJSON(A){const I={};return A.signingResults?.length&&(I.signingResults=A.signingResults.map(A=>RI.toJSON(A))),I},create:A=>Ng.fromPartial(A??{}),fromPartial(A){const I={signingResults:[]};return I.signingResults=A.signingResults?.map(A=>RI.fromPartial(A))||[],I}};function Gg(){return{paymentHash:new Uint8Array(0),preimageShare:void 0,threshold:0,invoiceString:"",userIdentityPublicKey:new Uint8Array(0)}}const pg={encode:(A,I=new y)=>(0!==A.paymentHash.length&&I.uint32(10).bytes(A.paymentHash),void 0!==A.preimageShare&&uI.encode(A.preimageShare,I.uint32(18).fork()).join(),0!==A.threshold&&I.uint32(24).uint32(A.threshold),""!==A.invoiceString&&I.uint32(34).string(A.invoiceString),0!==A.userIdentityPublicKey.length&&I.uint32(42).bytes(A.userIdentityPublicKey),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=Gg();for(;g.pos >>3){case 1:if(10!==A)break;B.paymentHash=g.bytes();continue;case 2:if(18!==A)break;B.preimageShare=uI.decode(g,g.uint32());continue;case 3:if(24!==A)break;B.threshold=g.uint32();continue;case 4:if(34!==A)break;B.invoiceString=g.string();continue;case 5:if(42!==A)break;B.userIdentityPublicKey=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({paymentHash:lB(A.paymentHash)?rB(A.paymentHash):new Uint8Array(0),preimageShare:lB(A.preimageShare)?uI.fromJSON(A.preimageShare):void 0,threshold:lB(A.threshold)?globalThis.Number(A.threshold):0,invoiceString:lB(A.invoiceString)?globalThis.String(A.invoiceString):"",userIdentityPublicKey:lB(A.userIdentityPublicKey)?rB(A.userIdentityPublicKey):new Uint8Array(0)}),toJSON(A){const I={};return 0!==A.paymentHash.length&&(I.paymentHash=cB(A.paymentHash)),void 0!==A.preimageShare&&(I.preimageShare=uI.toJSON(A.preimageShare)),0!==A.threshold&&(I.threshold=Math.round(A.threshold)),""!==A.invoiceString&&(I.invoiceString=A.invoiceString),0!==A.userIdentityPublicKey.length&&(I.userIdentityPublicKey=cB(A.userIdentityPublicKey)),I},create:A=>pg.fromPartial(A??{}),fromPartial(A){const I=Gg();return I.paymentHash=A.paymentHash??new Uint8Array(0),I.preimageShare=void 0!==A.preimageShare&&null!==A.preimageShare?uI.fromPartial(A.preimageShare):void 0,I.threshold=A.threshold??0,I.invoiceString=A.invoiceString??"",I.userIdentityPublicKey=A.userIdentityPublicKey??new Uint8Array(0),I}};function Sg(){return{paymentHash:new Uint8Array(0),encryptedPreimageShares:{},threshold:0,invoiceString:"",userIdentityPublicKey:new Uint8Array(0)}}const fg={encode:(A,I=new y)=>(0!==A.paymentHash.length&&I.uint32(10).bytes(A.paymentHash),Object.entries(A.encryptedPreimageShares).forEach(([A,g])=>{Rg.encode({key:A,value:g},I.uint32(18).fork()).join()}),0!==A.threshold&&I.uint32(24).uint32(A.threshold),""!==A.invoiceString&&I.uint32(34).string(A.invoiceString),0!==A.userIdentityPublicKey.length&&I.uint32(42).bytes(A.userIdentityPublicKey),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=Sg();for(;g.pos >>3){case 1:if(10!==A)break;B.paymentHash=g.bytes();continue;case 2:{if(18!==A)break;const I=Rg.decode(g,g.uint32());void 0!==I.value&&(B.encryptedPreimageShares[I.key]=I.value);continue}case 3:if(24!==A)break;B.threshold=g.uint32();continue;case 4:if(34!==A)break;B.invoiceString=g.string();continue;case 5:if(42!==A)break;B.userIdentityPublicKey=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({paymentHash:lB(A.paymentHash)?rB(A.paymentHash):new Uint8Array(0),encryptedPreimageShares:yB(A.encryptedPreimageShares)?Object.entries(A.encryptedPreimageShares).reduce((A,[I,g])=>(A[I]=rB(g),A),{}):{},threshold:lB(A.threshold)?globalThis.Number(A.threshold):0,invoiceString:lB(A.invoiceString)?globalThis.String(A.invoiceString):"",userIdentityPublicKey:lB(A.userIdentityPublicKey)?rB(A.userIdentityPublicKey):new Uint8Array(0)}),toJSON(A){const I={};if(0!==A.paymentHash.length&&(I.paymentHash=cB(A.paymentHash)),A.encryptedPreimageShares){const g=Object.entries(A.encryptedPreimageShares);g.length>0&&(I.encryptedPreimageShares={},g.forEach(([A,g])=>{I.encryptedPreimageShares[A]=cB(g)}))}return 0!==A.threshold&&(I.threshold=Math.round(A.threshold)),""!==A.invoiceString&&(I.invoiceString=A.invoiceString),0!==A.userIdentityPublicKey.length&&(I.userIdentityPublicKey=cB(A.userIdentityPublicKey)),I},create:A=>fg.fromPartial(A??{}),fromPartial(A){const I=Sg();return I.paymentHash=A.paymentHash??new Uint8Array(0),I.encryptedPreimageShares=Object.entries(A.encryptedPreimageShares??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=g),A),{}),I.threshold=A.threshold??0,I.invoiceString=A.invoiceString??"",I.userIdentityPublicKey=A.userIdentityPublicKey??new Uint8Array(0),I}};function Fg(){return{key:"",value:new Uint8Array(0)}}const Rg={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),0!==A.value.length&&I.uint32(18).bytes(A.value),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=Fg();for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?rB(A.value):new Uint8Array(0)}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),0!==A.value.length&&(I.value=cB(A.value)),I},create:A=>Rg.fromPartial(A??{}),fromPartial(A){const I=Fg();return I.key=A.key??"",I.value=A.value??new Uint8Array(0),I}},Ug={encode:(A,I=new y)=>(Object.entries(A.signingNonceCommitments).forEach(([A,g])=>{Mg.encode({key:A,value:g},I.uint32(10).fork()).join()}),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={signingNonceCommitments:{}};for(;g.pos >>3){case 1:{if(10!==A)break;const I=Mg.decode(g,g.uint32());void 0!==I.value&&(B.signingNonceCommitments[I.key]=I.value);continue}}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({signingNonceCommitments:yB(A.signingNonceCommitments)?Object.entries(A.signingNonceCommitments).reduce((A,[I,g])=>(A[I]=R.fromJSON(g),A),{}):{}}),toJSON(A){const I={};if(A.signingNonceCommitments){const g=Object.entries(A.signingNonceCommitments);g.length>0&&(I.signingNonceCommitments={},g.forEach(([A,g])=>{I.signingNonceCommitments[A]=R.toJSON(g)}))}return I},create:A=>Ug.fromPartial(A??{}),fromPartial(A){const I={signingNonceCommitments:{}};return I.signingNonceCommitments=Object.entries(A.signingNonceCommitments??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=R.fromPartial(g)),A),{}),I}},Mg={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),void 0!==A.value&&R.encode(A.value,I.uint32(18).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={key:"",value:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=R.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?R.fromJSON(A.value):void 0}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),void 0!==A.value&&(I.value=R.toJSON(A.value)),I},create:A=>Mg.fromPartial(A??{}),fromPartial(A){const I={key:"",value:void 0};return I.key=A.key??"",I.value=void 0!==A.value&&null!==A.value?R.fromPartial(A.value):void 0,I}},Kg={encode(A,I=new y){for(const g of A.nodeIds)I.uint32(10).string(g);return 0!==A.count&&I.uint32(16).uint32(A.count),0!==A.nodeIdCount&&I.uint32(24).uint32(A.nodeIdCount),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={nodeIds:[],count:0,nodeIdCount:0};for(;g.pos >>3){case 1:if(10!==A)break;B.nodeIds.push(g.string());continue;case 2:if(16!==A)break;B.count=g.uint32();continue;case 3:if(24!==A)break;B.nodeIdCount=g.uint32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({nodeIds:globalThis.Array.isArray(A?.nodeIds)?A.nodeIds.map(A=>globalThis.String(A)):[],count:lB(A.count)?globalThis.Number(A.count):0,nodeIdCount:lB(A.nodeIdCount)?globalThis.Number(A.nodeIdCount):0}),toJSON(A){const I={};return A.nodeIds?.length&&(I.nodeIds=A.nodeIds),0!==A.count&&(I.count=Math.round(A.count)),0!==A.nodeIdCount&&(I.nodeIdCount=Math.round(A.nodeIdCount)),I},create:A=>Kg.fromPartial(A??{}),fromPartial(A){const I={nodeIds:[],count:0,nodeIdCount:0};return I.nodeIds=A.nodeIds?.map(A=>A)||[],I.count=A.count??0,I.nodeIdCount=A.nodeIdCount??0,I}},mg={encode(A,I=new y){for(const g of A.signingCommitments)Ug.encode(g,I.uint32(10).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={signingCommitments:[]};for(;g.pos >>3){case 1:if(10!==A)break;B.signingCommitments.push(Ug.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({signingCommitments:globalThis.Array.isArray(A?.signingCommitments)?A.signingCommitments.map(A=>Ug.fromJSON(A)):[]}),toJSON(A){const I={};return A.signingCommitments?.length&&(I.signingCommitments=A.signingCommitments.map(A=>Ug.toJSON(A))),I},create:A=>mg.fromPartial(A??{}),fromPartial(A){const I={signingCommitments:[]};return I.signingCommitments=A.signingCommitments?.map(A=>Ug.fromPartial(A))||[],I}},Jg={encode:(A,I=new y)=>(Object.entries(A.signingCommitments).forEach(([A,g])=>{bg.encode({key:A,value:g},I.uint32(10).fork()).join()}),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={signingCommitments:{}};for(;g.pos >>3){case 1:{if(10!==A)break;const I=bg.decode(g,g.uint32());void 0!==I.value&&(B.signingCommitments[I.key]=I.value);continue}}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({signingCommitments:yB(A.signingCommitments)?Object.entries(A.signingCommitments).reduce((A,[I,g])=>(A[I]=R.fromJSON(g),A),{}):{}}),toJSON(A){const I={};if(A.signingCommitments){const g=Object.entries(A.signingCommitments);g.length>0&&(I.signingCommitments={},g.forEach(([A,g])=>{I.signingCommitments[A]=R.toJSON(g)}))}return I},create:A=>Jg.fromPartial(A??{}),fromPartial(A){const I={signingCommitments:{}};return I.signingCommitments=Object.entries(A.signingCommitments??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=R.fromPartial(g)),A),{}),I}},bg={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),void 0!==A.value&&R.encode(A.value,I.uint32(18).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={key:"",value:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=R.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?R.fromJSON(A.value):void 0}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),void 0!==A.value&&(I.value=R.toJSON(A.value)),I},create:A=>bg.fromPartial(A??{}),fromPartial(A){const I={key:"",value:void 0};return I.key=A.key??"",I.value=void 0!==A.value&&null!==A.value?R.fromPartial(A.value):void 0,I}};function Hg(){return{nodeId:"",refundTx:new Uint8Array(0),userSignature:new Uint8Array(0),signingCommitments:void 0,userSignatureCommitment:void 0,network:0}}const Yg={encode:(A,I=new y)=>(""!==A.nodeId&&I.uint32(10).string(A.nodeId),0!==A.refundTx.length&&I.uint32(18).bytes(A.refundTx),0!==A.userSignature.length&&I.uint32(26).bytes(A.userSignature),void 0!==A.signingCommitments&&Jg.encode(A.signingCommitments,I.uint32(34).fork()).join(),void 0!==A.userSignatureCommitment&&R.encode(A.userSignatureCommitment,I.uint32(42).fork()).join(),0!==A.network&&I.uint32(48).int32(A.network),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=Hg();for(;g.pos >>3){case 1:if(10!==A)break;B.nodeId=g.string();continue;case 2:if(18!==A)break;B.refundTx=g.bytes();continue;case 3:if(26!==A)break;B.userSignature=g.bytes();continue;case 4:if(34!==A)break;B.signingCommitments=Jg.decode(g,g.uint32());continue;case 5:if(42!==A)break;B.userSignatureCommitment=R.decode(g,g.uint32());continue;case 6:if(48!==A)break;B.network=g.int32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({nodeId:lB(A.nodeId)?globalThis.String(A.nodeId):"",refundTx:lB(A.refundTx)?rB(A.refundTx):new Uint8Array(0),userSignature:lB(A.userSignature)?rB(A.userSignature):new Uint8Array(0),signingCommitments:lB(A.signingCommitments)?Jg.fromJSON(A.signingCommitments):void 0,userSignatureCommitment:lB(A.userSignatureCommitment)?R.fromJSON(A.userSignatureCommitment):void 0,network:lB(A.network)?b(A.network):0}),toJSON(A){const I={};return""!==A.nodeId&&(I.nodeId=A.nodeId),0!==A.refundTx.length&&(I.refundTx=cB(A.refundTx)),0!==A.userSignature.length&&(I.userSignature=cB(A.userSignature)),void 0!==A.signingCommitments&&(I.signingCommitments=Jg.toJSON(A.signingCommitments)),void 0!==A.userSignatureCommitment&&(I.userSignatureCommitment=R.toJSON(A.userSignatureCommitment)),0!==A.network&&(I.network=H(A.network)),I},create:A=>Yg.fromPartial(A??{}),fromPartial(A){const I=Hg();return I.nodeId=A.nodeId??"",I.refundTx=A.refundTx??new Uint8Array(0),I.userSignature=A.userSignature??new Uint8Array(0),I.signingCommitments=void 0!==A.signingCommitments&&null!==A.signingCommitments?Jg.fromPartial(A.signingCommitments):void 0,I.userSignatureCommitment=void 0!==A.userSignatureCommitment&&null!==A.userSignatureCommitment?R.fromPartial(A.userSignatureCommitment):void 0,I.network=A.network??0,I}},Lg={encode:(A,I=new y)=>(""!==A.bolt11Invoice&&I.uint32(10).string(A.bolt11Invoice),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={bolt11Invoice:""};for(;g.pos >>3){case 1:if(10!==A)break;B.bolt11Invoice=g.string();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({bolt11Invoice:lB(A.bolt11Invoice)?globalThis.String(A.bolt11Invoice):""}),toJSON(A){const I={};return""!==A.bolt11Invoice&&(I.bolt11Invoice=A.bolt11Invoice),I},create:A=>Lg.fromPartial(A??{}),fromPartial(A){const I={bolt11Invoice:""};return I.bolt11Invoice=A.bolt11Invoice??"",I}},qg={encode:(A,I=new y)=>(0!==A.valueSats&&I.uint32(8).uint64(A.valueSats),void 0!==A.invoiceAmountProof&&Lg.encode(A.invoiceAmountProof,I.uint32(18).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={valueSats:0,invoiceAmountProof:void 0};for(;g.pos >>3){case 1:if(8!==A)break;B.valueSats=hB(g.uint64());continue;case 2:if(18!==A)break;B.invoiceAmountProof=Lg.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({valueSats:lB(A.valueSats)?globalThis.Number(A.valueSats):0,invoiceAmountProof:lB(A.invoiceAmountProof)?Lg.fromJSON(A.invoiceAmountProof):void 0}),toJSON(A){const I={};return 0!==A.valueSats&&(I.valueSats=Math.round(A.valueSats)),void 0!==A.invoiceAmountProof&&(I.invoiceAmountProof=Lg.toJSON(A.invoiceAmountProof)),I},create:A=>qg.fromPartial(A??{}),fromPartial(A){const I={valueSats:0,invoiceAmountProof:void 0};return I.valueSats=A.valueSats??0,I.invoiceAmountProof=void 0!==A.invoiceAmountProof&&null!==A.invoiceAmountProof?Lg.fromPartial(A.invoiceAmountProof):void 0,I}};function Vg(){return{paymentHash:new Uint8Array(0),invoiceAmount:void 0,reason:0,transfer:void 0,receiverIdentityPublicKey:new Uint8Array(0),feeSats:0,transferRequest:void 0}}const Tg={encode:(A,I=new y)=>(0!==A.paymentHash.length&&I.uint32(10).bytes(A.paymentHash),void 0!==A.invoiceAmount&&qg.encode(A.invoiceAmount,I.uint32(18).fork()).join(),0!==A.reason&&I.uint32(24).int32(A.reason),void 0!==A.transfer&&MI.encode(A.transfer,I.uint32(34).fork()).join(),0!==A.receiverIdentityPublicKey.length&&I.uint32(42).bytes(A.receiverIdentityPublicKey),0!==A.feeSats&&I.uint32(48).uint64(A.feeSats),void 0!==A.transferRequest&&mI.encode(A.transferRequest,I.uint32(58).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=Vg();for(;g.pos >>3){case 1:if(10!==A)break;B.paymentHash=g.bytes();continue;case 2:if(18!==A)break;B.invoiceAmount=qg.decode(g,g.uint32());continue;case 3:if(24!==A)break;B.reason=g.int32();continue;case 4:if(34!==A)break;B.transfer=MI.decode(g,g.uint32());continue;case 5:if(42!==A)break;B.receiverIdentityPublicKey=g.bytes();continue;case 6:if(48!==A)break;B.feeSats=hB(g.uint64());continue;case 7:if(58!==A)break;B.transferRequest=mI.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({paymentHash:lB(A.paymentHash)?rB(A.paymentHash):new Uint8Array(0),invoiceAmount:lB(A.invoiceAmount)?qg.fromJSON(A.invoiceAmount):void 0,reason:lB(A.reason)?aA(A.reason):0,transfer:lB(A.transfer)?MI.fromJSON(A.transfer):void 0,receiverIdentityPublicKey:lB(A.receiverIdentityPublicKey)?rB(A.receiverIdentityPublicKey):new Uint8Array(0),feeSats:lB(A.feeSats)?globalThis.Number(A.feeSats):0,transferRequest:lB(A.transferRequest)?mI.fromJSON(A.transferRequest):void 0}),toJSON(A){const I={};return 0!==A.paymentHash.length&&(I.paymentHash=cB(A.paymentHash)),void 0!==A.invoiceAmount&&(I.invoiceAmount=qg.toJSON(A.invoiceAmount)),0!==A.reason&&(I.reason=function(A){switch(A){case nA.REASON_SEND:return"REASON_SEND";case nA.REASON_RECEIVE:return"REASON_RECEIVE";case nA.UNRECOGNIZED:default:return"UNRECOGNIZED"}}(A.reason)),void 0!==A.transfer&&(I.transfer=MI.toJSON(A.transfer)),0!==A.receiverIdentityPublicKey.length&&(I.receiverIdentityPublicKey=cB(A.receiverIdentityPublicKey)),0!==A.feeSats&&(I.feeSats=Math.round(A.feeSats)),void 0!==A.transferRequest&&(I.transferRequest=mI.toJSON(A.transferRequest)),I},create:A=>Tg.fromPartial(A??{}),fromPartial(A){const I=Vg();return I.paymentHash=A.paymentHash??new Uint8Array(0),I.invoiceAmount=void 0!==A.invoiceAmount&&null!==A.invoiceAmount?qg.fromPartial(A.invoiceAmount):void 0,I.reason=A.reason??0,I.transfer=void 0!==A.transfer&&null!==A.transfer?MI.fromPartial(A.transfer):void 0,I.receiverIdentityPublicKey=A.receiverIdentityPublicKey??new Uint8Array(0),I.feeSats=A.feeSats??0,I.transferRequest=void 0!==A.transferRequest&&null!==A.transferRequest?mI.fromPartial(A.transferRequest):void 0,I}};function vg(){return{preimage:new Uint8Array(0),transfer:void 0}}const Zg={encode:(A,I=new y)=>(0!==A.preimage.length&&I.uint32(10).bytes(A.preimage),void 0!==A.transfer&&Bg.encode(A.transfer,I.uint32(18).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=vg();for(;g.pos >>3){case 1:if(10!==A)break;B.preimage=g.bytes();continue;case 2:if(18!==A)break;B.transfer=Bg.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({preimage:lB(A.preimage)?rB(A.preimage):new Uint8Array(0),transfer:lB(A.transfer)?Bg.fromJSON(A.transfer):void 0}),toJSON(A){const I={};return 0!==A.preimage.length&&(I.preimage=cB(A.preimage)),void 0!==A.transfer&&(I.transfer=Bg.toJSON(A.transfer)),I},create:A=>Zg.fromPartial(A??{}),fromPartial(A){const I=vg();return I.preimage=A.preimage??new Uint8Array(0),I.transfer=void 0!==A.transfer&&null!==A.transfer?Bg.fromPartial(A.transfer):void 0,I}};function xg(){return{transfer:void 0,exitId:"",exitTxid:new Uint8Array(0),connectorTx:new Uint8Array(0)}}const Wg={encode:(A,I=new y)=>(void 0!==A.transfer&&mI.encode(A.transfer,I.uint32(10).fork()).join(),""!==A.exitId&&I.uint32(18).string(A.exitId),0!==A.exitTxid.length&&I.uint32(26).bytes(A.exitTxid),0!==A.connectorTx.length&&I.uint32(34).bytes(A.connectorTx),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=xg();for(;g.pos >>3){case 1:if(10!==A)break;B.transfer=mI.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.exitId=g.string();continue;case 3:if(26!==A)break;B.exitTxid=g.bytes();continue;case 4:if(34!==A)break;B.connectorTx=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transfer:lB(A.transfer)?mI.fromJSON(A.transfer):void 0,exitId:lB(A.exitId)?globalThis.String(A.exitId):"",exitTxid:lB(A.exitTxid)?rB(A.exitTxid):new Uint8Array(0),connectorTx:lB(A.connectorTx)?rB(A.connectorTx):new Uint8Array(0)}),toJSON(A){const I={};return void 0!==A.transfer&&(I.transfer=mI.toJSON(A.transfer)),""!==A.exitId&&(I.exitId=A.exitId),0!==A.exitTxid.length&&(I.exitTxid=cB(A.exitTxid)),0!==A.connectorTx.length&&(I.connectorTx=cB(A.connectorTx)),I},create:A=>Wg.fromPartial(A??{}),fromPartial(A){const I=xg();return I.transfer=void 0!==A.transfer&&null!==A.transfer?mI.fromPartial(A.transfer):void 0,I.exitId=A.exitId??"",I.exitTxid=A.exitTxid??new Uint8Array(0),I.connectorTx=A.connectorTx??new Uint8Array(0),I}},Pg={encode(A,I=new y){void 0!==A.transfer&&Bg.encode(A.transfer,I.uint32(10).fork()).join();for(const g of A.signingResults)RI.encode(g,I.uint32(18).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={transfer:void 0,signingResults:[]};for(;g.pos >>3){case 1:if(10!==A)break;B.transfer=Bg.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.signingResults.push(RI.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transfer:lB(A.transfer)?Bg.fromJSON(A.transfer):void 0,signingResults:globalThis.Array.isArray(A?.signingResults)?A.signingResults.map(A=>RI.fromJSON(A)):[]}),toJSON(A){const I={};return void 0!==A.transfer&&(I.transfer=Bg.toJSON(A.transfer)),A.signingResults?.length&&(I.signingResults=A.signingResults.map(A=>RI.toJSON(A))),I},create:A=>Pg.fromPartial(A??{}),fromPartial(A){const I={transfer:void 0,signingResults:[]};return I.transfer=void 0!==A.transfer&&null!==A.transfer?Bg.fromPartial(A.transfer):void 0,I.signingResults=A.signingResults?.map(A=>RI.fromPartial(A))||[],I}};function Og(){return{index:0,identifier:"",publicKey:new Uint8Array(0),address:""}}const Xg={encode:(A,I=new y)=>(0!==A.index&&I.uint32(8).uint64(A.index),""!==A.identifier&&I.uint32(18).string(A.identifier),0!==A.publicKey.length&&I.uint32(26).bytes(A.publicKey),""!==A.address&&I.uint32(34).string(A.address),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=Og();for(;g.pos >>3){case 1:if(8!==A)break;B.index=hB(g.uint64());continue;case 2:if(18!==A)break;B.identifier=g.string();continue;case 3:if(26!==A)break;B.publicKey=g.bytes();continue;case 4:if(34!==A)break;B.address=g.string();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({index:lB(A.index)?globalThis.Number(A.index):0,identifier:lB(A.identifier)?globalThis.String(A.identifier):"",publicKey:lB(A.publicKey)?rB(A.publicKey):new Uint8Array(0),address:lB(A.address)?globalThis.String(A.address):""}),toJSON(A){const I={};return 0!==A.index&&(I.index=Math.round(A.index)),""!==A.identifier&&(I.identifier=A.identifier),0!==A.publicKey.length&&(I.publicKey=cB(A.publicKey)),""!==A.address&&(I.address=A.address),I},create:A=>Xg.fromPartial(A??{}),fromPartial(A){const I=Og();return I.index=A.index??0,I.identifier=A.identifier??"",I.publicKey=A.publicKey??new Uint8Array(0),I.address=A.address??"",I}},jg={encode:(A,I=new y)=>(Object.entries(A.signingOperators).forEach(([A,g])=>{zg.encode({key:A,value:g},I.uint32(10).fork()).join()}),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={signingOperators:{}};for(;g.pos >>3){case 1:{if(10!==A)break;const I=zg.decode(g,g.uint32());void 0!==I.value&&(B.signingOperators[I.key]=I.value);continue}}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({signingOperators:yB(A.signingOperators)?Object.entries(A.signingOperators).reduce((A,[I,g])=>(A[I]=Xg.fromJSON(g),A),{}):{}}),toJSON(A){const I={};if(A.signingOperators){const g=Object.entries(A.signingOperators);g.length>0&&(I.signingOperators={},g.forEach(([A,g])=>{I.signingOperators[A]=Xg.toJSON(g)}))}return I},create:A=>jg.fromPartial(A??{}),fromPartial(A){const I={signingOperators:{}};return I.signingOperators=Object.entries(A.signingOperators??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=Xg.fromPartial(g)),A),{}),I}},zg={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),void 0!==A.value&&Xg.encode(A.value,I.uint32(18).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={key:"",value:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=Xg.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?Xg.fromJSON(A.value):void 0}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),void 0!==A.value&&(I.value=Xg.toJSON(A.value)),I},create:A=>zg.fromPartial(A??{}),fromPartial(A){const I={key:"",value:void 0};return I.key=A.key??"",I.value=void 0!==A.value&&null!==A.value?Xg.fromPartial(A.value):void 0,I}};function _g(){return{paymentHash:new Uint8Array(0),identityPublicKey:new Uint8Array(0)}}const $g={encode:(A,I=new y)=>(0!==A.paymentHash.length&&I.uint32(10).bytes(A.paymentHash),0!==A.identityPublicKey.length&&I.uint32(18).bytes(A.identityPublicKey),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=_g();for(;g.pos >>3){case 1:if(10!==A)break;B.paymentHash=g.bytes();continue;case 2:if(18!==A)break;B.identityPublicKey=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({paymentHash:lB(A.paymentHash)?rB(A.paymentHash):new Uint8Array(0),identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0)}),toJSON(A){const I={};return 0!==A.paymentHash.length&&(I.paymentHash=cB(A.paymentHash)),0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),I},create:A=>$g.fromPartial(A??{}),fromPartial(A){const I=_g();return I.paymentHash=A.paymentHash??new Uint8Array(0),I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I}},AC={encode(A,I=new y){for(const g of A.userSignedRefunds)Yg.encode(g,I.uint32(10).fork()).join();return void 0!==A.transfer&&Bg.encode(A.transfer,I.uint32(26).fork()).join(),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={userSignedRefunds:[],transfer:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.userSignedRefunds.push(Yg.decode(g,g.uint32()));continue;case 3:if(26!==A)break;B.transfer=Bg.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({userSignedRefunds:globalThis.Array.isArray(A?.userSignedRefunds)?A.userSignedRefunds.map(A=>Yg.fromJSON(A)):[],transfer:lB(A.transfer)?Bg.fromJSON(A.transfer):void 0}),toJSON(A){const I={};return A.userSignedRefunds?.length&&(I.userSignedRefunds=A.userSignedRefunds.map(A=>Yg.toJSON(A))),void 0!==A.transfer&&(I.transfer=Bg.toJSON(A.transfer)),I},create:A=>AC.fromPartial(A??{}),fromPartial(A){const I={userSignedRefunds:[],transfer:void 0};return I.userSignedRefunds=A.userSignedRefunds?.map(A=>Yg.fromPartial(A))||[],I.transfer=void 0!==A.transfer&&null!==A.transfer?Bg.fromPartial(A.transfer):void 0,I}};function IC(){return{paymentHash:new Uint8Array(0),receiverIdentityPubkey:new Uint8Array(0),status:0,createdTime:void 0,transfer:void 0,preimage:void 0,senderIdentityPubkey:new Uint8Array(0)}}const gC={encode:(A,I=new y)=>(0!==A.paymentHash.length&&I.uint32(10).bytes(A.paymentHash),0!==A.receiverIdentityPubkey.length&&I.uint32(18).bytes(A.receiverIdentityPubkey),0!==A.status&&I.uint32(24).int32(A.status),void 0!==A.createdTime&&N.encode(DB(A.createdTime),I.uint32(34).fork()).join(),void 0!==A.transfer&&Bg.encode(A.transfer,I.uint32(42).fork()).join(),void 0!==A.preimage&&I.uint32(50).bytes(A.preimage),0!==A.senderIdentityPubkey.length&&I.uint32(58).bytes(A.senderIdentityPubkey),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=IC();for(;g.pos >>3){case 1:if(10!==A)break;B.paymentHash=g.bytes();continue;case 2:if(18!==A)break;B.receiverIdentityPubkey=g.bytes();continue;case 3:if(24!==A)break;B.status=g.int32();continue;case 4:if(34!==A)break;B.createdTime=wB(N.decode(g,g.uint32()));continue;case 5:if(42!==A)break;B.transfer=Bg.decode(g,g.uint32());continue;case 6:if(50!==A)break;B.preimage=g.bytes();continue;case 7:if(58!==A)break;B.senderIdentityPubkey=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({paymentHash:lB(A.paymentHash)?rB(A.paymentHash):new Uint8Array(0),receiverIdentityPubkey:lB(A.receiverIdentityPubkey)?rB(A.receiverIdentityPubkey):new Uint8Array(0),status:lB(A.status)?_(A.status):0,createdTime:lB(A.createdTime)?dB(A.createdTime):void 0,transfer:lB(A.transfer)?Bg.fromJSON(A.transfer):void 0,preimage:lB(A.preimage)?rB(A.preimage):void 0,senderIdentityPubkey:lB(A.senderIdentityPubkey)?rB(A.senderIdentityPubkey):new Uint8Array(0)}),toJSON(A){const I={};return 0!==A.paymentHash.length&&(I.paymentHash=cB(A.paymentHash)),0!==A.receiverIdentityPubkey.length&&(I.receiverIdentityPubkey=cB(A.receiverIdentityPubkey)),0!==A.status&&(I.status=$(A.status)),void 0!==A.createdTime&&(I.createdTime=A.createdTime.toISOString()),void 0!==A.transfer&&(I.transfer=Bg.toJSON(A.transfer)),void 0!==A.preimage&&(I.preimage=cB(A.preimage)),0!==A.senderIdentityPubkey.length&&(I.senderIdentityPubkey=cB(A.senderIdentityPubkey)),I},create:A=>gC.fromPartial(A??{}),fromPartial(A){const I=IC();return I.paymentHash=A.paymentHash??new Uint8Array(0),I.receiverIdentityPubkey=A.receiverIdentityPubkey??new Uint8Array(0),I.status=A.status??0,I.createdTime=A.createdTime??void 0,I.transfer=void 0!==A.transfer&&null!==A.transfer?Bg.fromPartial(A.transfer):void 0,I.preimage=A.preimage??void 0,I.senderIdentityPubkey=A.senderIdentityPubkey??new Uint8Array(0),I}};function CC(){return{paymentHashes:[],identityPublicKey:new Uint8Array(0),status:void 0,limit:0,offset:0,transferIds:[],matchRole:0}}const BC={encode(A,I=new y){for(const g of A.paymentHashes)I.uint32(10).bytes(g);0!==A.identityPublicKey.length&&I.uint32(18).bytes(A.identityPublicKey),void 0!==A.status&&I.uint32(24).int32(A.status),0!==A.limit&&I.uint32(32).int64(A.limit),0!==A.offset&&I.uint32(40).int64(A.offset);for(const g of A.transferIds)I.uint32(50).string(g);return 0!==A.matchRole&&I.uint32(56).int32(A.matchRole),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=CC();for(;g.pos >>3){case 1:if(10!==A)break;B.paymentHashes.push(g.bytes());continue;case 2:if(18!==A)break;B.identityPublicKey=g.bytes();continue;case 3:if(24!==A)break;B.status=g.int32();continue;case 4:if(32!==A)break;B.limit=hB(g.int64());continue;case 5:if(40!==A)break;B.offset=hB(g.int64());continue;case 6:if(50!==A)break;B.transferIds.push(g.string());continue;case 7:if(56!==A)break;B.matchRole=g.int32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({paymentHashes:globalThis.Array.isArray(A?.paymentHashes)?A.paymentHashes.map(A=>rB(A)):[],identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0),status:lB(A.status)?_(A.status):void 0,limit:lB(A.limit)?globalThis.Number(A.limit):0,offset:lB(A.offset)?globalThis.Number(A.offset):0,transferIds:globalThis.Array.isArray(A?.transferIds)?A.transferIds.map(A=>globalThis.String(A)):[],matchRole:lB(A.matchRole)?IA(A.matchRole):0}),toJSON(A){const I={};return A.paymentHashes?.length&&(I.paymentHashes=A.paymentHashes.map(A=>cB(A))),0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),void 0!==A.status&&(I.status=$(A.status)),0!==A.limit&&(I.limit=Math.round(A.limit)),0!==A.offset&&(I.offset=Math.round(A.offset)),A.transferIds?.length&&(I.transferIds=A.transferIds),0!==A.matchRole&&(I.matchRole=function(A){switch(A){case AA.PREIMAGE_REQUEST_ROLE_RECEIVER:return"PREIMAGE_REQUEST_ROLE_RECEIVER";case AA.PREIMAGE_REQUEST_ROLE_SENDER:return"PREIMAGE_REQUEST_ROLE_SENDER";case AA.PREIMAGE_REQUEST_ROLE_RECEIVER_AND_SENDER:return"PREIMAGE_REQUEST_ROLE_RECEIVER_AND_SENDER";case AA.UNRECOGNIZED:default:return"UNRECOGNIZED"}}(A.matchRole)),I},create:A=>BC.fromPartial(A??{}),fromPartial(A){const I=CC();return I.paymentHashes=A.paymentHashes?.map(A=>A)||[],I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I.status=A.status??void 0,I.limit=A.limit??0,I.offset=A.offset??0,I.transferIds=A.transferIds?.map(A=>A)||[],I.matchRole=A.matchRole??0,I}},iC={encode(A,I=new y){for(const g of A.preimageRequests)gC.encode(g,I.uint32(10).fork()).join();return 0!==A.offset&&I.uint32(16).int64(A.offset),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={preimageRequests:[],offset:0};for(;g.pos >>3){case 1:if(10!==A)break;B.preimageRequests.push(gC.decode(g,g.uint32()));continue;case 2:if(16!==A)break;B.offset=hB(g.int64());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({preimageRequests:globalThis.Array.isArray(A?.preimageRequests)?A.preimageRequests.map(A=>gC.fromJSON(A)):[],offset:lB(A.offset)?globalThis.Number(A.offset):0}),toJSON(A){const I={};return A.preimageRequests?.length&&(I.preimageRequests=A.preimageRequests.map(A=>gC.toJSON(A))),0!==A.offset&&(I.offset=Math.round(A.offset)),I},create:A=>iC.fromPartial(A??{}),fromPartial(A){const I={preimageRequests:[],offset:0};return I.preimageRequests=A.preimageRequests?.map(A=>gC.fromPartial(A))||[],I.offset=A.offset??0,I}};function QC(){return{paymentHash:new Uint8Array(0),preimage:new Uint8Array(0),identityPublicKey:new Uint8Array(0)}}const eC={encode:(A,I=new y)=>(0!==A.paymentHash.length&&I.uint32(10).bytes(A.paymentHash),0!==A.preimage.length&&I.uint32(18).bytes(A.preimage),0!==A.identityPublicKey.length&&I.uint32(26).bytes(A.identityPublicKey),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=QC();for(;g.pos >>3){case 1:if(10!==A)break;B.paymentHash=g.bytes();continue;case 2:if(18!==A)break;B.preimage=g.bytes();continue;case 3:if(26!==A)break;B.identityPublicKey=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({paymentHash:lB(A.paymentHash)?rB(A.paymentHash):new Uint8Array(0),preimage:lB(A.preimage)?rB(A.preimage):new Uint8Array(0),identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0)}),toJSON(A){const I={};return 0!==A.paymentHash.length&&(I.paymentHash=cB(A.paymentHash)),0!==A.preimage.length&&(I.preimage=cB(A.preimage)),0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),I},create:A=>eC.fromPartial(A??{}),fromPartial(A){const I=QC();return I.paymentHash=A.paymentHash??new Uint8Array(0),I.preimage=A.preimage??new Uint8Array(0),I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I}},EC={encode:(A,I=new y)=>(void 0!==A.transfer&&Bg.encode(A.transfer,I.uint32(10).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={transfer:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.transfer=Bg.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transfer:lB(A.transfer)?Bg.fromJSON(A.transfer):void 0}),toJSON(A){const I={};return void 0!==A.transfer&&(I.transfer=Bg.toJSON(A.transfer)),I},create:A=>EC.fromPartial(A??{}),fromPartial(A){const I={transfer:void 0};return I.transfer=void 0!==A.transfer&&null!==A.transfer?Bg.fromPartial(A.transfer):void 0,I}};function tC(){return{paymentHash:new Uint8Array(0),receiverIdentityPubkey:new Uint8Array(0)}}const oC={encode:(A,I=new y)=>(0!==A.paymentHash.length&&I.uint32(10).bytes(A.paymentHash),0!==A.receiverIdentityPubkey.length&&I.uint32(18).bytes(A.receiverIdentityPubkey),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=tC();for(;g.pos >>3){case 1:if(10!==A)break;B.paymentHash=g.bytes();continue;case 2:if(18!==A)break;B.receiverIdentityPubkey=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({paymentHash:lB(A.paymentHash)?rB(A.paymentHash):new Uint8Array(0),receiverIdentityPubkey:lB(A.receiverIdentityPubkey)?rB(A.receiverIdentityPubkey):new Uint8Array(0)}),toJSON(A){const I={};return 0!==A.paymentHash.length&&(I.paymentHash=cB(A.paymentHash)),0!==A.receiverIdentityPubkey.length&&(I.receiverIdentityPubkey=cB(A.receiverIdentityPubkey)),I},create:A=>oC.fromPartial(A??{}),fromPartial(A){const I=tC();return I.paymentHash=A.paymentHash??new Uint8Array(0),I.receiverIdentityPubkey=A.receiverIdentityPubkey??new Uint8Array(0),I}},nC={encode:(A,I=new y)=>(void 0!==A.preimage&&I.uint32(10).bytes(A.preimage),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={preimage:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.preimage=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({preimage:lB(A.preimage)?rB(A.preimage):void 0}),toJSON(A){const I={};return void 0!==A.preimage&&(I.preimage=cB(A.preimage)),I},create:A=>nC.fromPartial(A??{}),fromPartial(A){const I={preimage:void 0};return I.preimage=A.preimage??void 0,I}},aC={encode(A,I=new y){for(const g of A.nodeIds)I.uint32(10).string(g);return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={nodeIds:[]};for(;g.pos >>3){case 1:if(10!==A)break;B.nodeIds.push(g.string());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({nodeIds:globalThis.Array.isArray(A?.nodeIds)?A.nodeIds.map(A=>globalThis.String(A)):[]}),toJSON(A){const I={};return A.nodeIds?.length&&(I.nodeIds=A.nodeIds),I},create:A=>aC.fromPartial(A??{}),fromPartial(A){const I={nodeIds:[]};return I.nodeIds=A.nodeIds?.map(A=>A)||[],I}},sC={encode(A,I=new y){switch(A.source?.$case){case"ownerIdentityPubkey":I.uint32(10).bytes(A.source.ownerIdentityPubkey);break;case"nodeIds":aC.encode(A.source.nodeIds,I.uint32(18).fork()).join()}!1!==A.includeParents&&I.uint32(24).bool(A.includeParents),0!==A.limit&&I.uint32(32).int64(A.limit),0!==A.offset&&I.uint32(40).int64(A.offset),0!==A.network&&I.uint32(48).int32(A.network),I.uint32(58).fork();for(const g of A.statuses)I.int32(g);return I.join(),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={source:void 0,includeParents:!1,limit:0,offset:0,network:0,statuses:[]};for(;g.pos >>3){case 1:if(10!==A)break;B.source={$case:"ownerIdentityPubkey",ownerIdentityPubkey:g.bytes()};continue;case 2:if(18!==A)break;B.source={$case:"nodeIds",nodeIds:aC.decode(g,g.uint32())};continue;case 3:if(24!==A)break;B.includeParents=g.bool();continue;case 4:if(32!==A)break;B.limit=hB(g.int64());continue;case 5:if(40!==A)break;B.offset=hB(g.int64());continue;case 6:if(48!==A)break;B.network=g.int32();continue;case 7:if(56===A){B.statuses.push(g.int32());continue}if(58===A){const A=g.uint32()+g.pos;for(;g.pos({source:lB(A.ownerIdentityPubkey)?{$case:"ownerIdentityPubkey",ownerIdentityPubkey:rB(A.ownerIdentityPubkey)}:lB(A.nodeIds)?{$case:"nodeIds",nodeIds:aC.fromJSON(A.nodeIds)}:void 0,includeParents:!!lB(A.includeParents)&&globalThis.Boolean(A.includeParents),limit:lB(A.limit)?globalThis.Number(A.limit):0,offset:lB(A.offset)?globalThis.Number(A.offset):0,network:lB(A.network)?b(A.network):0,statuses:globalThis.Array.isArray(A?.statuses)?A.statuses.map(A=>tA(A)):[]}),toJSON(A){const I={};return"ownerIdentityPubkey"===A.source?.$case?I.ownerIdentityPubkey=cB(A.source.ownerIdentityPubkey):"nodeIds"===A.source?.$case&&(I.nodeIds=aC.toJSON(A.source.nodeIds)),!1!==A.includeParents&&(I.includeParents=A.includeParents),0!==A.limit&&(I.limit=Math.round(A.limit)),0!==A.offset&&(I.offset=Math.round(A.offset)),0!==A.network&&(I.network=H(A.network)),A.statuses?.length&&(I.statuses=A.statuses.map(A=>oA(A))),I},create:A=>sC.fromPartial(A??{}),fromPartial(A){const I={source:void 0,includeParents:!1,limit:0,offset:0,network:0,statuses:[]};switch(A.source?.$case){case"ownerIdentityPubkey":void 0!==A.source?.ownerIdentityPubkey&&null!==A.source?.ownerIdentityPubkey&&(I.source={$case:"ownerIdentityPubkey",ownerIdentityPubkey:A.source.ownerIdentityPubkey});break;case"nodeIds":void 0!==A.source?.nodeIds&&null!==A.source?.nodeIds&&(I.source={$case:"nodeIds",nodeIds:aC.fromPartial(A.source.nodeIds)})}return I.includeParents=A.includeParents??!1,I.limit=A.limit??0,I.offset=A.offset??0,I.network=A.network??0,I.statuses=A.statuses?.map(A=>A)||[],I}},rC={encode:(A,I=new y)=>(Object.entries(A.nodes).forEach(([A,g])=>{cC.encode({key:A,value:g},I.uint32(10).fork()).join()}),0!==A.offset&&I.uint32(16).int64(A.offset),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={nodes:{},offset:0};for(;g.pos >>3){case 1:{if(10!==A)break;const I=cC.decode(g,g.uint32());void 0!==I.value&&(B.nodes[I.key]=I.value);continue}case 2:if(16!==A)break;B.offset=hB(g.int64());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({nodes:yB(A.nodes)?Object.entries(A.nodes).reduce((A,[I,g])=>(A[I]=hI.fromJSON(g),A),{}):{},offset:lB(A.offset)?globalThis.Number(A.offset):0}),toJSON(A){const I={};if(A.nodes){const g=Object.entries(A.nodes);g.length>0&&(I.nodes={},g.forEach(([A,g])=>{I.nodes[A]=hI.toJSON(g)}))}return 0!==A.offset&&(I.offset=Math.round(A.offset)),I},create:A=>rC.fromPartial(A??{}),fromPartial(A){const I={nodes:{},offset:0};return I.nodes=Object.entries(A.nodes??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=hI.fromPartial(g)),A),{}),I.offset=A.offset??0,I}},cC={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),void 0!==A.value&&hI.encode(A.value,I.uint32(18).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={key:"",value:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(18!==A)break;B.value=hI.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?hI.fromJSON(A.value):void 0}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),void 0!==A.value&&(I.value=hI.toJSON(A.value)),I},create:A=>cC.fromPartial(A??{}),fromPartial(A){const I={key:"",value:void 0};return I.key=A.key??"",I.value=void 0!==A.value&&null!==A.value?hI.fromPartial(A.value):void 0,I}};function DC(){return{identityPublicKey:new Uint8Array(0),network:0,limit:0,offset:0}}const wC={encode:(A,I=new y)=>(0!==A.identityPublicKey.length&&I.uint32(10).bytes(A.identityPublicKey),0!==A.network&&I.uint32(16).int32(A.network),0!==A.limit&&I.uint32(24).int64(A.limit),0!==A.offset&&I.uint32(32).int64(A.offset),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=DC();for(;g.pos >>3){case 1:if(10!==A)break;B.identityPublicKey=g.bytes();continue;case 2:if(16!==A)break;B.network=g.int32();continue;case 3:if(24!==A)break;B.limit=hB(g.int64());continue;case 4:if(32!==A)break;B.offset=hB(g.int64());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0),network:lB(A.network)?b(A.network):0,limit:lB(A.limit)?globalThis.Number(A.limit):0,offset:lB(A.offset)?globalThis.Number(A.offset):0}),toJSON(A){const I={};return 0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),0!==A.network&&(I.network=H(A.network)),0!==A.limit&&(I.limit=Math.round(A.limit)),0!==A.offset&&(I.offset=Math.round(A.offset)),I},create:A=>wC.fromPartial(A??{}),fromPartial(A){const I=DC();return I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I.network=A.network??0,I.limit=A.limit??0,I.offset=A.offset??0,I}};function dC(){return{identityPublicKey:new Uint8Array(0),network:0,limit:0,offset:0,depositAddress:void 0,hashVariant:0}}const hC={encode:(A,I=new y)=>(0!==A.identityPublicKey.length&&I.uint32(10).bytes(A.identityPublicKey),0!==A.network&&I.uint32(16).int32(A.network),0!==A.limit&&I.uint32(32).int64(A.limit),0!==A.offset&&I.uint32(40).int64(A.offset),void 0!==A.depositAddress&&I.uint32(50).string(A.depositAddress),0!==A.hashVariant&&I.uint32(56).int32(A.hashVariant),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=dC();for(;g.pos >>3){case 1:if(10!==A)break;B.identityPublicKey=g.bytes();continue;case 2:if(16!==A)break;B.network=g.int32();continue;case 4:if(32!==A)break;B.limit=hB(g.int64());continue;case 5:if(40!==A)break;B.offset=hB(g.int64());continue;case 6:if(50!==A)break;B.depositAddress=g.string();continue;case 7:if(56!==A)break;B.hashVariant=g.int32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0),network:lB(A.network)?b(A.network):0,limit:lB(A.limit)?globalThis.Number(A.limit):0,offset:lB(A.offset)?globalThis.Number(A.offset):0,depositAddress:lB(A.depositAddress)?globalThis.String(A.depositAddress):void 0,hashVariant:lB(A.hashVariant)?BA(A.hashVariant):0}),toJSON(A){const I={};return 0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),0!==A.network&&(I.network=H(A.network)),0!==A.limit&&(I.limit=Math.round(A.limit)),0!==A.offset&&(I.offset=Math.round(A.offset)),void 0!==A.depositAddress&&(I.depositAddress=A.depositAddress),0!==A.hashVariant&&(I.hashVariant=iA(A.hashVariant)),I},create:A=>hC.fromPartial(A??{}),fromPartial(A){const I=dC();return I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I.network=A.network??0,I.limit=A.limit??0,I.offset=A.offset??0,I.depositAddress=A.depositAddress??void 0,I.hashVariant=A.hashVariant??0,I}};function yC(){return{depositAddress:"",userSigningPublicKey:new Uint8Array(0),verifyingPublicKey:new Uint8Array(0),leafId:void 0,proofOfPossession:void 0}}const lC={encode:(A,I=new y)=>(""!==A.depositAddress&&I.uint32(10).string(A.depositAddress),0!==A.userSigningPublicKey.length&&I.uint32(18).bytes(A.userSigningPublicKey),0!==A.verifyingPublicKey.length&&I.uint32(26).bytes(A.verifyingPublicKey),void 0!==A.leafId&&I.uint32(34).string(A.leafId),void 0!==A.proofOfPossession&&GA.encode(A.proofOfPossession,I.uint32(42).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=yC();for(;g.pos >>3){case 1:if(10!==A)break;B.depositAddress=g.string();continue;case 2:if(18!==A)break;B.userSigningPublicKey=g.bytes();continue;case 3:if(26!==A)break;B.verifyingPublicKey=g.bytes();continue;case 4:if(34!==A)break;B.leafId=g.string();continue;case 5:if(42!==A)break;B.proofOfPossession=GA.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({depositAddress:lB(A.depositAddress)?globalThis.String(A.depositAddress):"",userSigningPublicKey:lB(A.userSigningPublicKey)?rB(A.userSigningPublicKey):new Uint8Array(0),verifyingPublicKey:lB(A.verifyingPublicKey)?rB(A.verifyingPublicKey):new Uint8Array(0),leafId:lB(A.leafId)?globalThis.String(A.leafId):void 0,proofOfPossession:lB(A.proofOfPossession)?GA.fromJSON(A.proofOfPossession):void 0}),toJSON(A){const I={};return""!==A.depositAddress&&(I.depositAddress=A.depositAddress),0!==A.userSigningPublicKey.length&&(I.userSigningPublicKey=cB(A.userSigningPublicKey)),0!==A.verifyingPublicKey.length&&(I.verifyingPublicKey=cB(A.verifyingPublicKey)),void 0!==A.leafId&&(I.leafId=A.leafId),void 0!==A.proofOfPossession&&(I.proofOfPossession=GA.toJSON(A.proofOfPossession)),I},create:A=>lC.fromPartial(A??{}),fromPartial(A){const I=yC();return I.depositAddress=A.depositAddress??"",I.userSigningPublicKey=A.userSigningPublicKey??new Uint8Array(0),I.verifyingPublicKey=A.verifyingPublicKey??new Uint8Array(0),I.leafId=A.leafId??void 0,I.proofOfPossession=void 0!==A.proofOfPossession&&null!==A.proofOfPossession?GA.fromPartial(A.proofOfPossession):void 0,I}},kC={encode(A,I=new y){for(const g of A.depositAddresses)lC.encode(g,I.uint32(10).fork()).join();return 0!==A.offset&&I.uint32(16).int64(A.offset),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={depositAddresses:[],offset:0};for(;g.pos >>3){case 1:if(10!==A)break;B.depositAddresses.push(lC.decode(g,g.uint32()));continue;case 2:if(16!==A)break;B.offset=hB(g.int64());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({depositAddresses:globalThis.Array.isArray(A?.depositAddresses)?A.depositAddresses.map(A=>lC.fromJSON(A)):[],offset:lB(A.offset)?globalThis.Number(A.offset):0}),toJSON(A){const I={};return A.depositAddresses?.length&&(I.depositAddresses=A.depositAddresses.map(A=>lC.toJSON(A))),0!==A.offset&&(I.offset=Math.round(A.offset)),I},create:A=>kC.fromPartial(A??{}),fromPartial(A){const I={depositAddresses:[],offset:0};return I.depositAddresses=A.depositAddresses?.map(A=>lC.fromPartial(A))||[],I.offset=A.offset??0,I}},uC={encode(A,I=new y){for(const g of A.depositAddresses)lC.encode(g,I.uint32(10).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={depositAddresses:[]};for(;g.pos >>3){case 1:if(10!==A)break;B.depositAddresses.push(lC.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({depositAddresses:globalThis.Array.isArray(A?.depositAddresses)?A.depositAddresses.map(A=>lC.fromJSON(A)):[]}),toJSON(A){const I={};return A.depositAddresses?.length&&(I.depositAddresses=A.depositAddresses.map(A=>lC.toJSON(A))),I},create:A=>uC.fromPartial(A??{}),fromPartial(A){const I={depositAddresses:[]};return I.depositAddresses=A.depositAddresses?.map(A=>lC.fromPartial(A))||[],I}};function NC(){return{identityPublicKey:new Uint8Array(0),network:0}}const GC={encode:(A,I=new y)=>(0!==A.identityPublicKey.length&&I.uint32(10).bytes(A.identityPublicKey),0!==A.network&&I.uint32(16).int32(A.network),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=NC();for(;g.pos >>3){case 1:if(10!==A)break;B.identityPublicKey=g.bytes();continue;case 2:if(16!==A)break;B.network=g.int32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0),network:lB(A.network)?b(A.network):0}),toJSON(A){const I={};return 0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),0!==A.network&&(I.network=H(A.network)),I},create:A=>GC.fromPartial(A??{}),fromPartial(A){const I=NC();return I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I.network=A.network??0,I}},pC={encode:(A,I=new y)=>(0!==A.balance&&I.uint32(8).uint64(A.balance),Object.entries(A.nodeBalances).forEach(([A,g])=>{SC.encode({key:A,value:g},I.uint32(18).fork()).join()}),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={balance:0,nodeBalances:{}};for(;g.pos >>3){case 1:if(8!==A)break;B.balance=hB(g.uint64());continue;case 2:{if(18!==A)break;const I=SC.decode(g,g.uint32());void 0!==I.value&&(B.nodeBalances[I.key]=I.value);continue}}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({balance:lB(A.balance)?globalThis.Number(A.balance):0,nodeBalances:yB(A.nodeBalances)?Object.entries(A.nodeBalances).reduce((A,[I,g])=>(A[I]=Number(g),A),{}):{}}),toJSON(A){const I={};if(0!==A.balance&&(I.balance=Math.round(A.balance)),A.nodeBalances){const g=Object.entries(A.nodeBalances);g.length>0&&(I.nodeBalances={},g.forEach(([A,g])=>{I.nodeBalances[A]=Math.round(g)}))}return I},create:A=>pC.fromPartial(A??{}),fromPartial(A){const I={balance:0,nodeBalances:{}};return I.balance=A.balance??0,I.nodeBalances=Object.entries(A.nodeBalances??{}).reduce((A,[I,g])=>(void 0!==g&&(A[I]=globalThis.Number(g)),A),{}),I}},SC={encode:(A,I=new y)=>(""!==A.key&&I.uint32(10).string(A.key),0!==A.value&&I.uint32(16).uint64(A.value),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={key:"",value:0};for(;g.pos >>3){case 1:if(10!==A)break;B.key=g.string();continue;case 2:if(16!==A)break;B.value=hB(g.uint64());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({key:lB(A.key)?globalThis.String(A.key):"",value:lB(A.value)?globalThis.Number(A.value):0}),toJSON(A){const I={};return""!==A.key&&(I.key=A.key),0!==A.value&&(I.value=Math.round(A.value)),I},create:A=>SC.fromPartial(A??{}),fromPartial(A){const I={key:"",value:0};return I.key=A.key??"",I.value=A.value??0,I}};function fC(){return{identityPublicKey:new Uint8Array(0),sparkInvoiceFields:void 0,signature:void 0}}const FC={encode:(A,I=new y)=>(0!==A.identityPublicKey.length&&I.uint32(10).bytes(A.identityPublicKey),void 0!==A.sparkInvoiceFields&&UC.encode(A.sparkInvoiceFields,I.uint32(18).fork()).join(),void 0!==A.signature&&I.uint32(26).bytes(A.signature),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=fC();for(;g.pos >>3){case 1:if(10!==A)break;B.identityPublicKey=g.bytes();continue;case 2:if(18!==A)break;B.sparkInvoiceFields=UC.decode(g,g.uint32());continue;case 3:if(26!==A)break;B.signature=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0),sparkInvoiceFields:lB(A.sparkInvoiceFields)?UC.fromJSON(A.sparkInvoiceFields):void 0,signature:lB(A.signature)?rB(A.signature):void 0}),toJSON(A){const I={};return 0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),void 0!==A.sparkInvoiceFields&&(I.sparkInvoiceFields=UC.toJSON(A.sparkInvoiceFields)),void 0!==A.signature&&(I.signature=cB(A.signature)),I},create:A=>FC.fromPartial(A??{}),fromPartial(A){const I=fC();return I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I.sparkInvoiceFields=void 0!==A.sparkInvoiceFields&&null!==A.sparkInvoiceFields?UC.fromPartial(A.sparkInvoiceFields):void 0,I.signature=A.signature??void 0,I}};function RC(){return{version:0,id:new Uint8Array(0),paymentType:void 0,memo:void 0,senderPublicKey:void 0,expiryTime:void 0}}const UC={encode(A,I=new y){switch(0!==A.version&&I.uint32(8).uint32(A.version),0!==A.id.length&&I.uint32(18).bytes(A.id),A.paymentType?.$case){case"tokensPayment":KC.encode(A.paymentType.tokensPayment,I.uint32(26).fork()).join();break;case"satsPayment":MC.encode(A.paymentType.satsPayment,I.uint32(34).fork()).join()}return void 0!==A.memo&&I.uint32(42).string(A.memo),void 0!==A.senderPublicKey&&I.uint32(50).bytes(A.senderPublicKey),void 0!==A.expiryTime&&N.encode(DB(A.expiryTime),I.uint32(58).fork()).join(),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=RC();for(;g.pos >>3){case 1:if(8!==A)break;B.version=g.uint32();continue;case 2:if(18!==A)break;B.id=g.bytes();continue;case 3:if(26!==A)break;B.paymentType={$case:"tokensPayment",tokensPayment:KC.decode(g,g.uint32())};continue;case 4:if(34!==A)break;B.paymentType={$case:"satsPayment",satsPayment:MC.decode(g,g.uint32())};continue;case 5:if(42!==A)break;B.memo=g.string();continue;case 6:if(50!==A)break;B.senderPublicKey=g.bytes();continue;case 7:if(58!==A)break;B.expiryTime=wB(N.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({version:lB(A.version)?globalThis.Number(A.version):0,id:lB(A.id)?rB(A.id):new Uint8Array(0),paymentType:lB(A.tokensPayment)?{$case:"tokensPayment",tokensPayment:KC.fromJSON(A.tokensPayment)}:lB(A.satsPayment)?{$case:"satsPayment",satsPayment:MC.fromJSON(A.satsPayment)}:void 0,memo:lB(A.memo)?globalThis.String(A.memo):void 0,senderPublicKey:lB(A.senderPublicKey)?rB(A.senderPublicKey):void 0,expiryTime:lB(A.expiryTime)?dB(A.expiryTime):void 0}),toJSON(A){const I={};return 0!==A.version&&(I.version=Math.round(A.version)),0!==A.id.length&&(I.id=cB(A.id)),"tokensPayment"===A.paymentType?.$case?I.tokensPayment=KC.toJSON(A.paymentType.tokensPayment):"satsPayment"===A.paymentType?.$case&&(I.satsPayment=MC.toJSON(A.paymentType.satsPayment)),void 0!==A.memo&&(I.memo=A.memo),void 0!==A.senderPublicKey&&(I.senderPublicKey=cB(A.senderPublicKey)),void 0!==A.expiryTime&&(I.expiryTime=A.expiryTime.toISOString()),I},create:A=>UC.fromPartial(A??{}),fromPartial(A){const I=RC();switch(I.version=A.version??0,I.id=A.id??new Uint8Array(0),A.paymentType?.$case){case"tokensPayment":void 0!==A.paymentType?.tokensPayment&&null!==A.paymentType?.tokensPayment&&(I.paymentType={$case:"tokensPayment",tokensPayment:KC.fromPartial(A.paymentType.tokensPayment)});break;case"satsPayment":void 0!==A.paymentType?.satsPayment&&null!==A.paymentType?.satsPayment&&(I.paymentType={$case:"satsPayment",satsPayment:MC.fromPartial(A.paymentType.satsPayment)})}return I.memo=A.memo??void 0,I.senderPublicKey=A.senderPublicKey??void 0,I.expiryTime=A.expiryTime??void 0,I}},MC={encode:(A,I=new y)=>(void 0!==A.amount&&I.uint32(8).uint64(A.amount),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={amount:void 0};for(;g.pos >>3){case 1:if(8!==A)break;B.amount=hB(g.uint64());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({amount:lB(A.amount)?globalThis.Number(A.amount):void 0}),toJSON(A){const I={};return void 0!==A.amount&&(I.amount=Math.round(A.amount)),I},create:A=>MC.fromPartial(A??{}),fromPartial(A){const I={amount:void 0};return I.amount=A.amount??void 0,I}},KC={encode:(A,I=new y)=>(void 0!==A.tokenIdentifier&&I.uint32(10).bytes(A.tokenIdentifier),void 0!==A.amount&&I.uint32(18).bytes(A.amount),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={tokenIdentifier:void 0,amount:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.tokenIdentifier=g.bytes();continue;case 2:if(18!==A)break;B.amount=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({tokenIdentifier:lB(A.tokenIdentifier)?rB(A.tokenIdentifier):void 0,amount:lB(A.amount)?rB(A.amount):void 0}),toJSON(A){const I={};return void 0!==A.tokenIdentifier&&(I.tokenIdentifier=cB(A.tokenIdentifier)),void 0!==A.amount&&(I.amount=cB(A.amount)),I},create:A=>KC.fromPartial(A??{}),fromPartial(A){const I={tokenIdentifier:void 0,amount:void 0};return I.tokenIdentifier=A.tokenIdentifier??void 0,I.amount=A.amount??void 0,I}};function mC(){return{onChainUtxo:void 0,refundTxSigningJob:void 0,userSignature:new Uint8Array(0),hashVariant:0}}const JC={encode:(A,I=new y)=>(void 0!==A.onChainUtxo&&qA.encode(A.onChainUtxo,I.uint32(10).fork()).join(),void 0!==A.refundTxSigningJob&&vA.encode(A.refundTxSigningJob,I.uint32(26).fork()).join(),0!==A.userSignature.length&&I.uint32(34).bytes(A.userSignature),0!==A.hashVariant&&I.uint32(40).int32(A.hashVariant),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=mC();for(;g.pos >>3){case 1:if(10!==A)break;B.onChainUtxo=qA.decode(g,g.uint32());continue;case 3:if(26!==A)break;B.refundTxSigningJob=vA.decode(g,g.uint32());continue;case 4:if(34!==A)break;B.userSignature=g.bytes();continue;case 5:if(40!==A)break;B.hashVariant=g.int32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({onChainUtxo:lB(A.onChainUtxo)?qA.fromJSON(A.onChainUtxo):void 0,refundTxSigningJob:lB(A.refundTxSigningJob)?vA.fromJSON(A.refundTxSigningJob):void 0,userSignature:lB(A.userSignature)?rB(A.userSignature):new Uint8Array(0),hashVariant:lB(A.hashVariant)?BA(A.hashVariant):0}),toJSON(A){const I={};return void 0!==A.onChainUtxo&&(I.onChainUtxo=qA.toJSON(A.onChainUtxo)),void 0!==A.refundTxSigningJob&&(I.refundTxSigningJob=vA.toJSON(A.refundTxSigningJob)),0!==A.userSignature.length&&(I.userSignature=cB(A.userSignature)),0!==A.hashVariant&&(I.hashVariant=iA(A.hashVariant)),I},create:A=>JC.fromPartial(A??{}),fromPartial(A){const I=mC();return I.onChainUtxo=void 0!==A.onChainUtxo&&null!==A.onChainUtxo?qA.fromPartial(A.onChainUtxo):void 0,I.refundTxSigningJob=void 0!==A.refundTxSigningJob&&null!==A.refundTxSigningJob?vA.fromPartial(A.refundTxSigningJob):void 0,I.userSignature=A.userSignature??new Uint8Array(0),I.hashVariant=A.hashVariant??0,I}},bC={encode:(A,I=new y)=>(void 0!==A.refundTxSigningResult&&OA.encode(A.refundTxSigningResult,I.uint32(10).fork()).join(),void 0!==A.depositAddress&&lC.encode(A.depositAddress,I.uint32(18).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={refundTxSigningResult:void 0,depositAddress:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.refundTxSigningResult=OA.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.depositAddress=lC.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({refundTxSigningResult:lB(A.refundTxSigningResult)?OA.fromJSON(A.refundTxSigningResult):void 0,depositAddress:lB(A.depositAddress)?lC.fromJSON(A.depositAddress):void 0}),toJSON(A){const I={};return void 0!==A.refundTxSigningResult&&(I.refundTxSigningResult=OA.toJSON(A.refundTxSigningResult)),void 0!==A.depositAddress&&(I.depositAddress=lC.toJSON(A.depositAddress)),I},create:A=>bC.fromPartial(A??{}),fromPartial(A){const I={refundTxSigningResult:void 0,depositAddress:void 0};return I.refundTxSigningResult=void 0!==A.refundTxSigningResult&&null!==A.refundTxSigningResult?OA.fromPartial(A.refundTxSigningResult):void 0,I.depositAddress=void 0!==A.depositAddress&&null!==A.depositAddress?lC.fromPartial(A.depositAddress):void 0,I}},HC={encode:(A,I=new y)=>(""!==A.treeId&&I.uint32(10).string(A.treeId),void 0!==A.userSigningCommitment&&R.encode(A.userSigningCommitment,I.uint32(18).fork()).join(),0!==A.vin&&I.uint32(24).uint32(A.vin),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={treeId:"",userSigningCommitment:void 0,vin:0};for(;g.pos >>3){case 1:if(10!==A)break;B.treeId=g.string();continue;case 2:if(18!==A)break;B.userSigningCommitment=R.decode(g,g.uint32());continue;case 3:if(24!==A)break;B.vin=g.uint32();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({treeId:lB(A.treeId)?globalThis.String(A.treeId):"",userSigningCommitment:lB(A.userSigningCommitment)?R.fromJSON(A.userSigningCommitment):void 0,vin:lB(A.vin)?globalThis.Number(A.vin):0}),toJSON(A){const I={};return""!==A.treeId&&(I.treeId=A.treeId),void 0!==A.userSigningCommitment&&(I.userSigningCommitment=R.toJSON(A.userSigningCommitment)),0!==A.vin&&(I.vin=Math.round(A.vin)),I},create:A=>HC.fromPartial(A??{}),fromPartial(A){const I={treeId:"",userSigningCommitment:void 0,vin:0};return I.treeId=A.treeId??"",I.userSigningCommitment=void 0!==A.userSigningCommitment&&null!==A.userSigningCommitment?R.fromPartial(A.userSigningCommitment):void 0,I.vin=A.vin??0,I}};function YC(){return{treeId:"",signingResult:void 0,verifyingKey:new Uint8Array(0)}}const LC={encode:(A,I=new y)=>(""!==A.treeId&&I.uint32(10).string(A.treeId),void 0!==A.signingResult&&OA.encode(A.signingResult,I.uint32(18).fork()).join(),0!==A.verifyingKey.length&&I.uint32(26).bytes(A.verifyingKey),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=YC();for(;g.pos >>3){case 1:if(10!==A)break;B.treeId=g.string();continue;case 2:if(18!==A)break;B.signingResult=OA.decode(g,g.uint32());continue;case 3:if(26!==A)break;B.verifyingKey=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({treeId:lB(A.treeId)?globalThis.String(A.treeId):"",signingResult:lB(A.signingResult)?OA.fromJSON(A.signingResult):void 0,verifyingKey:lB(A.verifyingKey)?rB(A.verifyingKey):new Uint8Array(0)}),toJSON(A){const I={};return""!==A.treeId&&(I.treeId=A.treeId),void 0!==A.signingResult&&(I.signingResult=OA.toJSON(A.signingResult)),0!==A.verifyingKey.length&&(I.verifyingKey=cB(A.verifyingKey)),I},create:A=>LC.fromPartial(A??{}),fromPartial(A){const I=YC();return I.treeId=A.treeId??"",I.signingResult=void 0!==A.signingResult&&null!==A.signingResult?OA.fromPartial(A.signingResult):void 0,I.verifyingKey=A.verifyingKey??new Uint8Array(0),I}};function qC(){return{value:0,pkScript:new Uint8Array(0)}}const VC={encode:(A,I=new y)=>(0!==A.value&&I.uint32(8).int64(A.value),0!==A.pkScript.length&&I.uint32(18).bytes(A.pkScript),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=qC();for(;g.pos >>3){case 1:if(8!==A)break;B.value=hB(g.int64());continue;case 2:if(18!==A)break;B.pkScript=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({value:lB(A.value)?globalThis.Number(A.value):0,pkScript:lB(A.pkScript)?rB(A.pkScript):new Uint8Array(0)}),toJSON(A){const I={};return 0!==A.value&&(I.value=Math.round(A.value)),0!==A.pkScript.length&&(I.pkScript=cB(A.pkScript)),I},create:A=>VC.fromPartial(A??{}),fromPartial(A){const I=qC();return I.value=A.value??0,I.pkScript=A.pkScript??new Uint8Array(0),I}};function TC(){return{ownerIdentityPublicKey:new Uint8Array(0),exitingTrees:[],rawTx:new Uint8Array(0),previousOutputs:[]}}const vC={encode(A,I=new y){0!==A.ownerIdentityPublicKey.length&&I.uint32(10).bytes(A.ownerIdentityPublicKey);for(const g of A.exitingTrees)HC.encode(g,I.uint32(18).fork()).join();0!==A.rawTx.length&&I.uint32(26).bytes(A.rawTx);for(const g of A.previousOutputs)VC.encode(g,I.uint32(34).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=TC();for(;g.pos >>3){case 1:if(10!==A)break;B.ownerIdentityPublicKey=g.bytes();continue;case 2:if(18!==A)break;B.exitingTrees.push(HC.decode(g,g.uint32()));continue;case 3:if(26!==A)break;B.rawTx=g.bytes();continue;case 4:if(34!==A)break;B.previousOutputs.push(VC.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({ownerIdentityPublicKey:lB(A.ownerIdentityPublicKey)?rB(A.ownerIdentityPublicKey):new Uint8Array(0),exitingTrees:globalThis.Array.isArray(A?.exitingTrees)?A.exitingTrees.map(A=>HC.fromJSON(A)):[],rawTx:lB(A.rawTx)?rB(A.rawTx):new Uint8Array(0),previousOutputs:globalThis.Array.isArray(A?.previousOutputs)?A.previousOutputs.map(A=>VC.fromJSON(A)):[]}),toJSON(A){const I={};return 0!==A.ownerIdentityPublicKey.length&&(I.ownerIdentityPublicKey=cB(A.ownerIdentityPublicKey)),A.exitingTrees?.length&&(I.exitingTrees=A.exitingTrees.map(A=>HC.toJSON(A))),0!==A.rawTx.length&&(I.rawTx=cB(A.rawTx)),A.previousOutputs?.length&&(I.previousOutputs=A.previousOutputs.map(A=>VC.toJSON(A))),I},create:A=>vC.fromPartial(A??{}),fromPartial(A){const I=TC();return I.ownerIdentityPublicKey=A.ownerIdentityPublicKey??new Uint8Array(0),I.exitingTrees=A.exitingTrees?.map(A=>HC.fromPartial(A))||[],I.rawTx=A.rawTx??new Uint8Array(0),I.previousOutputs=A.previousOutputs?.map(A=>VC.fromPartial(A))||[],I}},ZC={encode(A,I=new y){for(const g of A.signingResults)LC.encode(g,I.uint32(10).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={signingResults:[]};for(;g.pos >>3){case 1:if(10!==A)break;B.signingResults.push(LC.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({signingResults:globalThis.Array.isArray(A?.signingResults)?A.signingResults.map(A=>LC.fromJSON(A)):[]}),toJSON(A){const I={};return A.signingResults?.length&&(I.signingResults=A.signingResults.map(A=>LC.toJSON(A))),I},create:A=>ZC.fromPartial(A??{}),fromPartial(A){const I={signingResults:[]};return I.signingResults=A.signingResults?.map(A=>LC.fromPartial(A))||[],I}},xC={encode:(A,I=new y)=>(""!==A.address&&I.uint32(10).string(A.address),0!==A.offset&&I.uint32(16).uint64(A.offset),0!==A.limit&&I.uint32(24).uint64(A.limit),0!==A.network&&I.uint32(32).int32(A.network),!1!==A.excludeClaimed&&I.uint32(40).bool(A.excludeClaimed),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={address:"",offset:0,limit:0,network:0,excludeClaimed:!1};for(;g.pos >>3){case 1:if(10!==A)break;B.address=g.string();continue;case 2:if(16!==A)break;B.offset=hB(g.uint64());continue;case 3:if(24!==A)break;B.limit=hB(g.uint64());continue;case 4:if(32!==A)break;B.network=g.int32();continue;case 5:if(40!==A)break;B.excludeClaimed=g.bool();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({address:lB(A.address)?globalThis.String(A.address):"",offset:lB(A.offset)?globalThis.Number(A.offset):0,limit:lB(A.limit)?globalThis.Number(A.limit):0,network:lB(A.network)?b(A.network):0,excludeClaimed:!!lB(A.excludeClaimed)&&globalThis.Boolean(A.excludeClaimed)}),toJSON(A){const I={};return""!==A.address&&(I.address=A.address),0!==A.offset&&(I.offset=Math.round(A.offset)),0!==A.limit&&(I.limit=Math.round(A.limit)),0!==A.network&&(I.network=H(A.network)),!1!==A.excludeClaimed&&(I.excludeClaimed=A.excludeClaimed),I},create:A=>xC.fromPartial(A??{}),fromPartial(A){const I={address:"",offset:0,limit:0,network:0,excludeClaimed:!1};return I.address=A.address??"",I.offset=A.offset??0,I.limit=A.limit??0,I.network=A.network??0,I.excludeClaimed=A.excludeClaimed??!1,I}},WC={encode(A,I=new y){for(const g of A.utxos)qA.encode(g,I.uint32(10).fork()).join();return 0!==A.offset&&I.uint32(16).uint64(A.offset),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={utxos:[],offset:0};for(;g.pos >>3){case 1:if(10!==A)break;B.utxos.push(qA.decode(g,g.uint32()));continue;case 2:if(16!==A)break;B.offset=hB(g.uint64());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({utxos:globalThis.Array.isArray(A?.utxos)?A.utxos.map(A=>qA.fromJSON(A)):[],offset:lB(A.offset)?globalThis.Number(A.offset):0}),toJSON(A){const I={};return A.utxos?.length&&(I.utxos=A.utxos.map(A=>qA.toJSON(A))),0!==A.offset&&(I.offset=Math.round(A.offset)),I},create:A=>WC.fromPartial(A??{}),fromPartial(A){const I={utxos:[],offset:0};return I.utxos=A.utxos?.map(A=>qA.fromPartial(A))||[],I.offset=A.offset??0,I}};function PC(){return{identityPublicKey:new Uint8Array(0),network:0,excludeClaimed:!1,page:void 0,includePending:!1}}const OC={encode:(A,I=new y)=>(0!==A.identityPublicKey.length&&I.uint32(10).bytes(A.identityPublicKey),0!==A.network&&I.uint32(16).int32(A.network),!1!==A.excludeClaimed&&I.uint32(24).bool(A.excludeClaimed),void 0!==A.page&&kA.encode(A.page,I.uint32(34).fork()).join(),!1!==A.includePending&&I.uint32(40).bool(A.includePending),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=PC();for(;g.pos >>3){case 1:if(10!==A)break;B.identityPublicKey=g.bytes();continue;case 2:if(16!==A)break;B.network=g.int32();continue;case 3:if(24!==A)break;B.excludeClaimed=g.bool();continue;case 4:if(34!==A)break;B.page=kA.decode(g,g.uint32());continue;case 5:if(40!==A)break;B.includePending=g.bool();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({identityPublicKey:lB(A.identityPublicKey)?rB(A.identityPublicKey):new Uint8Array(0),network:lB(A.network)?b(A.network):0,excludeClaimed:!!lB(A.excludeClaimed)&&globalThis.Boolean(A.excludeClaimed),page:lB(A.page)?kA.fromJSON(A.page):void 0,includePending:!!lB(A.includePending)&&globalThis.Boolean(A.includePending)}),toJSON(A){const I={};return 0!==A.identityPublicKey.length&&(I.identityPublicKey=cB(A.identityPublicKey)),0!==A.network&&(I.network=H(A.network)),!1!==A.excludeClaimed&&(I.excludeClaimed=A.excludeClaimed),void 0!==A.page&&(I.page=kA.toJSON(A.page)),!1!==A.includePending&&(I.includePending=A.includePending),I},create:A=>OC.fromPartial(A??{}),fromPartial(A){const I=PC();return I.identityPublicKey=A.identityPublicKey??new Uint8Array(0),I.network=A.network??0,I.excludeClaimed=A.excludeClaimed??!1,I.page=void 0!==A.page&&null!==A.page?kA.fromPartial(A.page):void 0,I.includePending=A.includePending??!1,I}},XC={encode(A,I=new y){for(const g of A.utxos)VA.encode(g,I.uint32(10).fork()).join();return void 0!==A.page&&uA.encode(A.page,I.uint32(18).fork()).join(),I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={utxos:[],page:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.utxos.push(VA.decode(g,g.uint32()));continue;case 2:if(18!==A)break;B.page=uA.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({utxos:globalThis.Array.isArray(A?.utxos)?A.utxos.map(A=>VA.fromJSON(A)):[],page:lB(A.page)?uA.fromJSON(A.page):void 0}),toJSON(A){const I={};return A.utxos?.length&&(I.utxos=A.utxos.map(A=>VA.toJSON(A))),void 0!==A.page&&(I.page=uA.toJSON(A.page)),I},create:A=>XC.fromPartial(A??{}),fromPartial(A){const I={utxos:[],page:void 0};return I.utxos=A.utxos?.map(A=>VA.fromPartial(A))||[],I.page=void 0!==A.page&&null!==A.page?uA.fromPartial(A.page):void 0,I}},jC={encode(A,I=new y){0!==A.limit&&I.uint32(8).int64(A.limit),0!==A.offset&&I.uint32(16).int64(A.offset);for(const g of A.invoice)I.uint32(26).string(g);return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={limit:0,offset:0,invoice:[]};for(;g.pos >>3){case 1:if(8!==A)break;B.limit=hB(g.int64());continue;case 2:if(16!==A)break;B.offset=hB(g.int64());continue;case 3:if(26!==A)break;B.invoice.push(g.string());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({limit:lB(A.limit)?globalThis.Number(A.limit):0,offset:lB(A.offset)?globalThis.Number(A.offset):0,invoice:globalThis.Array.isArray(A?.invoice)?A.invoice.map(A=>globalThis.String(A)):[]}),toJSON(A){const I={};return 0!==A.limit&&(I.limit=Math.round(A.limit)),0!==A.offset&&(I.offset=Math.round(A.offset)),A.invoice?.length&&(I.invoice=A.invoice),I},create:A=>jC.fromPartial(A??{}),fromPartial(A){const I={limit:0,offset:0,invoice:[]};return I.limit=A.limit??0,I.offset=A.offset??0,I.invoice=A.invoice?.map(A=>A)||[],I}},zC={encode(A,I=new y){0!==A.offset&&I.uint32(8).int64(A.offset);for(const g of A.invoiceStatuses)_C.encode(g,I.uint32(18).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={offset:0,invoiceStatuses:[]};for(;g.pos >>3){case 1:if(8!==A)break;B.offset=hB(g.int64());continue;case 2:if(18!==A)break;B.invoiceStatuses.push(_C.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({offset:lB(A.offset)?globalThis.Number(A.offset):0,invoiceStatuses:globalThis.Array.isArray(A?.invoiceStatuses)?A.invoiceStatuses.map(A=>_C.fromJSON(A)):[]}),toJSON(A){const I={};return 0!==A.offset&&(I.offset=Math.round(A.offset)),A.invoiceStatuses?.length&&(I.invoiceStatuses=A.invoiceStatuses.map(A=>_C.toJSON(A))),I},create:A=>zC.fromPartial(A??{}),fromPartial(A){const I={offset:0,invoiceStatuses:[]};return I.offset=A.offset??0,I.invoiceStatuses=A.invoiceStatuses?.map(A=>_C.fromPartial(A))||[],I}},_C={encode(A,I=new y){switch(""!==A.invoice&&I.uint32(10).string(A.invoice),0!==A.status&&I.uint32(16).int32(A.status),A.transferType?.$case){case"satsTransfer":AB.encode(A.transferType.satsTransfer,I.uint32(26).fork()).join();break;case"tokenTransfer":gB.encode(A.transferType.tokenTransfer,I.uint32(34).fork()).join()}return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={invoice:"",status:0,transferType:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.invoice=g.string();continue;case 2:if(16!==A)break;B.status=g.int32();continue;case 3:if(26!==A)break;B.transferType={$case:"satsTransfer",satsTransfer:AB.decode(g,g.uint32())};continue;case 4:if(34!==A)break;B.transferType={$case:"tokenTransfer",tokenTransfer:gB.decode(g,g.uint32())};continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({invoice:lB(A.invoice)?globalThis.String(A.invoice):"",status:lB(A.status)?eA(A.status):0,transferType:lB(A.satsTransfer)?{$case:"satsTransfer",satsTransfer:AB.fromJSON(A.satsTransfer)}:lB(A.tokenTransfer)?{$case:"tokenTransfer",tokenTransfer:gB.fromJSON(A.tokenTransfer)}:void 0}),toJSON(A){const I={};return""!==A.invoice&&(I.invoice=A.invoice),0!==A.status&&(I.status=function(A){switch(A){case QA.NOT_FOUND:return"NOT_FOUND";case QA.PENDING:return"PENDING";case QA.FINALIZED:return"FINALIZED";case QA.RETURNED:return"RETURNED";case QA.MISMATCHED_INVOICE_FINALIZED:return"MISMATCHED_INVOICE_FINALIZED";case QA.MISMATCHED_INVOICE_PENDING:return"MISMATCHED_INVOICE_PENDING";case QA.MISMATCHED_INVOICE_RETURNED:return"MISMATCHED_INVOICE_RETURNED";case QA.UNRECOGNIZED:default:return"UNRECOGNIZED"}}(A.status)),"satsTransfer"===A.transferType?.$case?I.satsTransfer=AB.toJSON(A.transferType.satsTransfer):"tokenTransfer"===A.transferType?.$case&&(I.tokenTransfer=gB.toJSON(A.transferType.tokenTransfer)),I},create:A=>_C.fromPartial(A??{}),fromPartial(A){const I={invoice:"",status:0,transferType:void 0};switch(I.invoice=A.invoice??"",I.status=A.status??0,A.transferType?.$case){case"satsTransfer":void 0!==A.transferType?.satsTransfer&&null!==A.transferType?.satsTransfer&&(I.transferType={$case:"satsTransfer",satsTransfer:AB.fromPartial(A.transferType.satsTransfer)});break;case"tokenTransfer":void 0!==A.transferType?.tokenTransfer&&null!==A.transferType?.tokenTransfer&&(I.transferType={$case:"tokenTransfer",tokenTransfer:gB.fromPartial(A.transferType.tokenTransfer)})}return I}};function $C(){return{transferId:new Uint8Array(0)}}const AB={encode:(A,I=new y)=>(0!==A.transferId.length&&I.uint32(10).bytes(A.transferId),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=$C();for(;g.pos >>3){case 1:if(10!==A)break;B.transferId=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transferId:lB(A.transferId)?rB(A.transferId):new Uint8Array(0)}),toJSON(A){const I={};return 0!==A.transferId.length&&(I.transferId=cB(A.transferId)),I},create:A=>AB.fromPartial(A??{}),fromPartial(A){const I=$C();return I.transferId=A.transferId??new Uint8Array(0),I}};function IB(){return{finalTokenTransactionHash:new Uint8Array(0)}}const gB={encode:(A,I=new y)=>(0!==A.finalTokenTransactionHash.length&&I.uint32(10).bytes(A.finalTokenTransactionHash),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=IB();for(;g.pos >>3){case 1:if(10!==A)break;B.finalTokenTransactionHash=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({finalTokenTransactionHash:lB(A.finalTokenTransactionHash)?rB(A.finalTokenTransactionHash):new Uint8Array(0)}),toJSON(A){const I={};return 0!==A.finalTokenTransactionHash.length&&(I.finalTokenTransactionHash=cB(A.finalTokenTransactionHash)),I},create:A=>gB.fromPartial(A??{}),fromPartial(A){const I=IB();return I.finalTokenTransactionHash=A.finalTokenTransactionHash??new Uint8Array(0),I}},CB={encode:(A,I=new y)=>(void 0!==A.transfer&&mI.encode(A.transfer,I.uint32(10).fork()).join(),void 0!==A.adaptorPublicKeys&&QB.encode(A.adaptorPublicKeys,I.uint32(18).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={transfer:void 0,adaptorPublicKeys:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.transfer=mI.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.adaptorPublicKeys=QB.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transfer:lB(A.transfer)?mI.fromJSON(A.transfer):void 0,adaptorPublicKeys:lB(A.adaptorPublicKeys)?QB.fromJSON(A.adaptorPublicKeys):void 0}),toJSON(A){const I={};return void 0!==A.transfer&&(I.transfer=mI.toJSON(A.transfer)),void 0!==A.adaptorPublicKeys&&(I.adaptorPublicKeys=QB.toJSON(A.adaptorPublicKeys)),I},create:A=>CB.fromPartial(A??{}),fromPartial(A){const I={transfer:void 0,adaptorPublicKeys:void 0};return I.transfer=void 0!==A.transfer&&null!==A.transfer?mI.fromPartial(A.transfer):void 0,I.adaptorPublicKeys=void 0!==A.adaptorPublicKeys&&null!==A.adaptorPublicKeys?QB.fromPartial(A.adaptorPublicKeys):void 0,I}},BB={encode(A,I=new y){void 0!==A.transfer&&Bg.encode(A.transfer,I.uint32(10).fork()).join();for(const g of A.signingResults)RI.encode(g,I.uint32(18).fork()).join();return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={transfer:void 0,signingResults:[]};for(;g.pos >>3){case 1:if(10!==A)break;B.transfer=Bg.decode(g,g.uint32());continue;case 2:if(18!==A)break;B.signingResults.push(RI.decode(g,g.uint32()));continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({transfer:lB(A.transfer)?Bg.fromJSON(A.transfer):void 0,signingResults:globalThis.Array.isArray(A?.signingResults)?A.signingResults.map(A=>RI.fromJSON(A)):[]}),toJSON(A){const I={};return void 0!==A.transfer&&(I.transfer=Bg.toJSON(A.transfer)),A.signingResults?.length&&(I.signingResults=A.signingResults.map(A=>RI.toJSON(A))),I},create:A=>BB.fromPartial(A??{}),fromPartial(A){const I={transfer:void 0,signingResults:[]};return I.transfer=void 0!==A.transfer&&null!==A.transfer?Bg.fromPartial(A.transfer):void 0,I.signingResults=A.signingResults?.map(A=>RI.fromPartial(A))||[],I}};function iB(){return{adaptorPublicKey:new Uint8Array(0),directAdaptorPublicKey:new Uint8Array(0),directFromCpfpAdaptorPublicKey:new Uint8Array(0)}}const QB={encode:(A,I=new y)=>(0!==A.adaptorPublicKey.length&&I.uint32(10).bytes(A.adaptorPublicKey),0!==A.directAdaptorPublicKey.length&&I.uint32(18).bytes(A.directAdaptorPublicKey),0!==A.directFromCpfpAdaptorPublicKey.length&&I.uint32(26).bytes(A.directFromCpfpAdaptorPublicKey),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=iB();for(;g.pos >>3){case 1:if(10!==A)break;B.adaptorPublicKey=g.bytes();continue;case 2:if(18!==A)break;B.directAdaptorPublicKey=g.bytes();continue;case 3:if(26!==A)break;B.directFromCpfpAdaptorPublicKey=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({adaptorPublicKey:lB(A.adaptorPublicKey)?rB(A.adaptorPublicKey):new Uint8Array(0),directAdaptorPublicKey:lB(A.directAdaptorPublicKey)?rB(A.directAdaptorPublicKey):new Uint8Array(0),directFromCpfpAdaptorPublicKey:lB(A.directFromCpfpAdaptorPublicKey)?rB(A.directFromCpfpAdaptorPublicKey):new Uint8Array(0)}),toJSON(A){const I={};return 0!==A.adaptorPublicKey.length&&(I.adaptorPublicKey=cB(A.adaptorPublicKey)),0!==A.directAdaptorPublicKey.length&&(I.directAdaptorPublicKey=cB(A.directAdaptorPublicKey)),0!==A.directFromCpfpAdaptorPublicKey.length&&(I.directFromCpfpAdaptorPublicKey=cB(A.directFromCpfpAdaptorPublicKey)),I},create:A=>QB.fromPartial(A??{}),fromPartial(A){const I=iB();return I.adaptorPublicKey=A.adaptorPublicKey??new Uint8Array(0),I.directAdaptorPublicKey=A.directAdaptorPublicKey??new Uint8Array(0),I.directFromCpfpAdaptorPublicKey=A.directFromCpfpAdaptorPublicKey??new Uint8Array(0),I}};function eB(){return{ownerIdentityPublicKey:new Uint8Array(0),privateEnabled:!1,masterIdentityPublicKey:void 0}}const EB={encode:(A,I=new y)=>(0!==A.ownerIdentityPublicKey.length&&I.uint32(10).bytes(A.ownerIdentityPublicKey),!1!==A.privateEnabled&&I.uint32(16).bool(A.privateEnabled),void 0!==A.masterIdentityPublicKey&&I.uint32(26).bytes(A.masterIdentityPublicKey),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B=eB();for(;g.pos >>3){case 1:if(10!==A)break;B.ownerIdentityPublicKey=g.bytes();continue;case 2:if(16!==A)break;B.privateEnabled=g.bool();continue;case 3:if(26!==A)break;B.masterIdentityPublicKey=g.bytes();continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({ownerIdentityPublicKey:lB(A.ownerIdentityPublicKey)?rB(A.ownerIdentityPublicKey):new Uint8Array(0),privateEnabled:!!lB(A.privateEnabled)&&globalThis.Boolean(A.privateEnabled),masterIdentityPublicKey:lB(A.masterIdentityPublicKey)?rB(A.masterIdentityPublicKey):void 0}),toJSON(A){const I={};return 0!==A.ownerIdentityPublicKey.length&&(I.ownerIdentityPublicKey=cB(A.ownerIdentityPublicKey)),!1!==A.privateEnabled&&(I.privateEnabled=A.privateEnabled),void 0!==A.masterIdentityPublicKey&&(I.masterIdentityPublicKey=cB(A.masterIdentityPublicKey)),I},create:A=>EB.fromPartial(A??{}),fromPartial(A){const I=eB();return I.ownerIdentityPublicKey=A.ownerIdentityPublicKey??new Uint8Array(0),I.privateEnabled=A.privateEnabled??!1,I.masterIdentityPublicKey=A.masterIdentityPublicKey??void 0,I}},tB={encode(A,I=new y){switch(void 0!==A.privateEnabled&&I.uint32(8).bool(A.privateEnabled),A.masterIdentityPublicKey?.$case){case"setMasterIdentityPublicKey":I.uint32(18).bytes(A.masterIdentityPublicKey.setMasterIdentityPublicKey);break;case"clearMasterIdentityPublicKey":I.uint32(24).bool(A.masterIdentityPublicKey.clearMasterIdentityPublicKey)}return I},decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={privateEnabled:void 0,masterIdentityPublicKey:void 0};for(;g.pos >>3){case 1:if(8!==A)break;B.privateEnabled=g.bool();continue;case 2:if(18!==A)break;B.masterIdentityPublicKey={$case:"setMasterIdentityPublicKey",setMasterIdentityPublicKey:g.bytes()};continue;case 3:if(24!==A)break;B.masterIdentityPublicKey={$case:"clearMasterIdentityPublicKey",clearMasterIdentityPublicKey:g.bool()};continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({privateEnabled:lB(A.privateEnabled)?globalThis.Boolean(A.privateEnabled):void 0,masterIdentityPublicKey:lB(A.setMasterIdentityPublicKey)?{$case:"setMasterIdentityPublicKey",setMasterIdentityPublicKey:rB(A.setMasterIdentityPublicKey)}:lB(A.clearMasterIdentityPublicKey)?{$case:"clearMasterIdentityPublicKey",clearMasterIdentityPublicKey:globalThis.Boolean(A.clearMasterIdentityPublicKey)}:void 0}),toJSON(A){const I={};return void 0!==A.privateEnabled&&(I.privateEnabled=A.privateEnabled),"setMasterIdentityPublicKey"===A.masterIdentityPublicKey?.$case?I.setMasterIdentityPublicKey=cB(A.masterIdentityPublicKey.setMasterIdentityPublicKey):"clearMasterIdentityPublicKey"===A.masterIdentityPublicKey?.$case&&(I.clearMasterIdentityPublicKey=A.masterIdentityPublicKey.clearMasterIdentityPublicKey),I},create:A=>tB.fromPartial(A??{}),fromPartial(A){const I={privateEnabled:void 0,masterIdentityPublicKey:void 0};switch(I.privateEnabled=A.privateEnabled??void 0,A.masterIdentityPublicKey?.$case){case"setMasterIdentityPublicKey":void 0!==A.masterIdentityPublicKey?.setMasterIdentityPublicKey&&null!==A.masterIdentityPublicKey?.setMasterIdentityPublicKey&&(I.masterIdentityPublicKey={$case:"setMasterIdentityPublicKey",setMasterIdentityPublicKey:A.masterIdentityPublicKey.setMasterIdentityPublicKey});break;case"clearMasterIdentityPublicKey":void 0!==A.masterIdentityPublicKey?.clearMasterIdentityPublicKey&&null!==A.masterIdentityPublicKey?.clearMasterIdentityPublicKey&&(I.masterIdentityPublicKey={$case:"clearMasterIdentityPublicKey",clearMasterIdentityPublicKey:A.masterIdentityPublicKey.clearMasterIdentityPublicKey})}return I}},oB={encode:(A,I=new y)=>(void 0!==A.walletSetting&&EB.encode(A.walletSetting,I.uint32(10).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={walletSetting:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.walletSetting=EB.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({walletSetting:lB(A.walletSetting)?EB.fromJSON(A.walletSetting):void 0}),toJSON(A){const I={};return void 0!==A.walletSetting&&(I.walletSetting=EB.toJSON(A.walletSetting)),I},create:A=>oB.fromPartial(A??{}),fromPartial(A){const I={walletSetting:void 0};return I.walletSetting=void 0!==A.walletSetting&&null!==A.walletSetting?EB.fromPartial(A.walletSetting):void 0,I}},nB={encode:(A,I=new y)=>I,decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I;for(;g.pos ({}),toJSON:A=>({}),create:A=>nB.fromPartial(A??{}),fromPartial:A=>({})},aB={encode:(A,I=new y)=>(void 0!==A.walletSetting&&EB.encode(A.walletSetting,I.uint32(10).fork()).join(),I),decode(A,I){const g=A instanceof l?A:new l(A),C=void 0===I?g.len:g.pos+I,B={walletSetting:void 0};for(;g.pos >>3){case 1:if(10!==A)break;B.walletSetting=EB.decode(g,g.uint32());continue}if(4==(7&A)||0===A)break;g.skip(7&A)}return B},fromJSON:A=>({walletSetting:lB(A.walletSetting)?EB.fromJSON(A.walletSetting):void 0}),toJSON(A){const I={};return void 0!==A.walletSetting&&(I.walletSetting=EB.toJSON(A.walletSetting)),I},create:A=>aB.fromPartial(A??{}),fromPartial(A){const I={walletSetting:void 0};return I.walletSetting=void 0!==A.walletSetting&&null!==A.walletSetting?EB.fromPartial(A.walletSetting):void 0,I}},sB={name:"SparkService",fullName:"spark.SparkService",methods:{generate_deposit_address:{name:"generate_deposit_address",requestType:FA,requestStream:!1,responseType:MA,responseStream:!1,options:{}},generate_static_deposit_address:{name:"generate_static_deposit_address",requestType:mA,requestStream:!1,responseType:JA,responseStream:!1,options:{}},rotate_static_deposit_address:{name:"rotate_static_deposit_address",requestType:HA,requestStream:!1,responseType:YA,responseStream:!1,options:{}},start_deposit_tree_creation:{name:"start_deposit_tree_creation",requestType:sI,requestStream:!1,responseType:rI,responseStream:!1,options:{}},finalize_deposit_tree_creation:{name:"finalize_deposit_tree_creation",requestType:DI,requestStream:!1,responseType:wI,responseStream:!1,options:{}},finalize_transfer_with_transfer_package:{name:"finalize_transfer_with_transfer_package",requestType:zI,requestStream:!1,responseType:_I,responseStream:!1,options:{}},query_pending_transfers:{name:"query_pending_transfers",requestType:eg,requestStream:!1,responseType:Eg,responseStream:!1,options:{}},query_all_transfers:{name:"query_all_transfers",requestType:eg,requestStream:!1,responseType:Eg,responseStream:!1,options:{}},claim_transfer_tweak_keys:{name:"claim_transfer_tweak_keys",requestType:lg,requestStream:!1,responseType:m,responseStream:!1,options:{}},store_preimage_share:{name:"store_preimage_share",requestType:pg,requestStream:!1,responseType:m,responseStream:!1,options:{}},store_preimage_share_v2:{name:"store_preimage_share_v2",requestType:fg,requestStream:!1,responseType:m,responseStream:!1,options:{}},get_signing_commitments:{name:"get_signing_commitments",requestType:Kg,requestStream:!1,responseType:mg,responseStream:!1,options:{}},provide_preimage:{name:"provide_preimage",requestType:eC,requestStream:!1,responseType:EC,responseStream:!1,options:{}},query_preimage:{name:"query_preimage",requestType:oC,requestStream:!1,responseType:nC,responseStream:!1,options:{}},query_htlc:{name:"query_htlc",requestType:BC,requestStream:!1,responseType:iC,responseStream:!1,options:{}},renew_leaf:{name:"renew_leaf",requestType:AI,requestStream:!1,responseType:BI,responseStream:!1,options:{}},get_signing_operator_list:{name:"get_signing_operator_list",requestType:m,requestStream:!1,responseType:jg,responseStream:!1,options:{}},query_nodes:{name:"query_nodes",requestType:sC,requestStream:!1,responseType:rC,responseStream:!1,options:{}},query_balance:{name:"query_balance",requestType:GC,requestStream:!1,responseType:pC,responseStream:!1,options:{}},query_user_signed_refunds:{name:"query_user_signed_refunds",requestType:$g,requestStream:!1,responseType:AC,responseStream:!1,options:{}},query_unused_deposit_addresses:{name:"query_unused_deposit_addresses",requestType:wC,requestStream:!1,responseType:kC,responseStream:!1,options:{}},query_static_deposit_addresses:{name:"query_static_deposit_addresses",requestType:hC,requestStream:!1,responseType:uC,responseStream:!1,options:{}},subscribe_to_events:{name:"subscribe_to_events",requestType:rA,requestStream:!1,responseType:cA,responseStream:!0,options:{}},initiate_static_deposit_utxo_refund:{name:"initiate_static_deposit_utxo_refund",requestType:JC,requestStream:!1,responseType:bC,responseStream:!1,options:{}},exit_single_node_trees:{name:"exit_single_node_trees",requestType:vC,requestStream:!1,responseType:ZC,responseStream:!1,options:{}},cooperative_exit_v2:{name:"cooperative_exit_v2",requestType:Wg,requestStream:!1,responseType:Pg,responseStream:!1,options:{}},claim_transfer_sign_refunds_v2:{name:"claim_transfer_sign_refunds_v2",requestType:ug,requestStream:!1,responseType:Ng,responseStream:!1,options:{}},finalize_node_signatures_v2:{name:"finalize_node_signatures_v2",requestType:yI,requestStream:!1,responseType:lI,responseStream:!1,options:{}},initiate_preimage_swap_v2:{name:"initiate_preimage_swap_v2",requestType:Tg,requestStream:!1,responseType:Zg,responseStream:!1,options:{}},initiate_preimage_swap_v3:{name:"initiate_preimage_swap_v3",requestType:Tg,requestStream:!1,responseType:Zg,responseStream:!1,options:{}},start_leaf_swap_v2:{name:"start_leaf_swap_v2",requestType:mI,requestStream:!1,responseType:JI,responseStream:!1,options:{}},start_transfer_v2:{name:"start_transfer_v2",requestType:mI,requestStream:!1,responseType:JI,responseStream:!1,options:{}},start_transfer_v3:{name:"start_transfer_v3",requestType:qI,requestStream:!1,responseType:JI,responseStream:!1,options:{}},claim_transfer:{name:"claim_transfer",requestType:dg,requestStream:!1,responseType:hg,responseStream:!1,options:{}},get_utxos_for_address:{name:"get_utxos_for_address",requestType:xC,requestStream:!1,responseType:WC,responseStream:!1,options:{}},get_utxos_for_identity:{name:"get_utxos_for_identity",requestType:OC,requestStream:!1,responseType:XC,responseStream:!1,options:{}},query_spark_invoices:{name:"query_spark_invoices",requestType:jC,requestStream:!1,responseType:zC,responseStream:!1,options:{}},initiate_swap_primary_transfer:{name:"initiate_swap_primary_transfer",requestType:CB,requestStream:!1,responseType:BB,responseStream:!1,options:{}},update_wallet_setting:{name:"update_wallet_setting",requestType:tB,requestStream:!1,responseType:oB,responseStream:!1,options:{}},query_wallet_setting:{name:"query_wallet_setting",requestType:nB,requestStream:!1,responseType:aB,responseStream:!1,options:{}}}};function rB(A){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(A,"base64"));{const I=globalThis.atob(A),g=new Uint8Array(I.length);for(let A=0;A {I.push(globalThis.String.fromCharCode(A))}),globalThis.btoa(I.join(""))}}function DB(A){return{seconds:Math.trunc(A.getTime()/1e3),nanos:A.getTime()%1e3*1e6}}function wB(A){let I=1e3*(A.seconds||0);return I+=(A.nanos||0)/1e6,new globalThis.Date(I)}function dB(A){return A instanceof globalThis.Date?A:"string"==typeof A?new globalThis.Date(A):wB(N.fromJSON(A))}function hB(A){const I=globalThis.Number(A.toString());if(I>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(I 0&&!I.includes(A.length))throw new Error("Uint8Array expected of length "+I+", got length="+A.length)}function pB(A){if("function"!=typeof A||"function"!=typeof A.create)throw new Error("Hash should be wrapped by utils.createHasher");NB(A.outputLen),NB(A.blockLen)}function SB(A,I=!0){if(A.destroyed)throw new Error("Hash instance has been destroyed");if(I&&A.finished)throw new Error("Hash#digest() has already been called")}function fB(...A){for(let I=0;I >>I}const UB=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),MB=Array.from({length:256},(A,I)=>I.toString(16).padStart(2,"0"));function KB(A){if(GB(A),UB)return A.toHex();let I="";for(let g=0;g =48&&A<=57?A-48:A>=65&&A<=70?A-55:A>=97&&A<=102?A-87:void 0}function JB(A){if("string"!=typeof A)throw new Error("hex string expected, got "+typeof A);if(UB)return Uint8Array.fromHex(A);const I=A.length,g=I/2;if(I%2)throw new Error("hex string expected, got unpadded hex of length "+I);const C=new Uint8Array(g);for(let I=0,B=0;I A().update(HB(I)).digest(),g=A();return I.outputLen=g.outputLen,I.blockLen=g.blockLen,I.create=()=>A(),I}function VB(A=32){if(kB&&"function"==typeof kB.getRandomValues)return kB.getRandomValues(new Uint8Array(A));if(kB&&"function"==typeof kB.randomBytes)return Uint8Array.from(kB.randomBytes(A));throw new Error("crypto.getRandomValues must be defined")}const TB="undefined"!=typeof window&&void 0!==window.document,vB="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,ZB=vB&&!1,xB="undefined"!=typeof Bare;"undefined"!=typeof navigator&&navigator.product;var WB=class extends Error{code;message;extraInfo;constructor(A,I,g){super(I),this.code=A,this.message=I,this.extraInfo=g}};const PB="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",OB=A=>Uint8Array.from(((A="")=>{const I=A.replace(/=+$/,"");let g="";if(I.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(let A,C=0,B=0,i=0;A=I.charAt(i++);~A&&(B=C%4?64*B+A:A,C++%4)&&(g+=String.fromCharCode(255&B>>(-2*C&6))))A=PB.indexOf(A);return g})(A),A=>A.charCodeAt(0));const XB=A=>A.reduce((A,I)=>A+("0"+I.toString(16)).slice(-2),""),jB=A=>{const I=[];for(let g=0;g Boolean("object"==typeof A&&null!==A&&"name"in A&&"string"==typeof A.name&&"message"in A&&"string"==typeof A.message);var _B="object"==typeof global&&global&&global.Object===Object&&global,$B="object"==typeof self&&self&&self.Object===Object&&self,Ai=(_B||$B||Function("return this")()).Symbol,Ii=Object.prototype;Ii.hasOwnProperty,Ii.toString,Ai&&Ai.toStringTag,Object.prototype.toString,Ai&&Ai.toStringTag;var gi=Q(4353),Ci=Q(3826);function Bi(A,I){(null==I||I>A.length)&&(I=A.length);for(var g=0,C=new Array(I);g1,B=!1,i=arguments[1];return new g(function(g){return I.subscribe({next:function(I){var Q=!B;if(B=!0,!Q||C)try{i=A(i,I)}catch(A){return g.error(A)}else i=I},error:function(A){g.error(A)},complete:function(){if(!B&&!C)return g.error(new TypeError("Cannot reduce an empty sequence"));g.next(i),g.complete()}})})},I.concat=function(){for(var A=this,I=arguments.length,g=new Array(I),C=0;C=0&&B.splice(A,1),Q()}});B.push(i)},error:function(A){C.error(A)},complete:function(){Q()}});function Q(){i.closed&&0===B.length&&C.complete()}return function(){B.forEach(function(A){return A.unsubscribe()}),i.unsubscribe()}})},I[ni]=function(){return this},A.from=function(I){var g="function"==typeof this?this:A;if(null==I)throw new TypeError(I+" is not an object");var C=si(I,ni);if(C){var B=C.call(I);if(Object(B)!==B)throw new TypeError(B+" is not an object");return ci(B)&&B.constructor===g?B:new g(function(A){return B.subscribe(A)})}if(Ei("iterator")&&(C=si(I,oi)))return new g(function(A){wi(function(){if(!A.closed){for(var g,B=function(A,I){var g="undefined"!=typeof Symbol&&A[Symbol.iterator]||A["@@iterator"];if(g)return(g=g.call(A)).next.bind(g);if(Array.isArray(A)||(g=function(A,I){if(A){if("string"==typeof A)return Bi(A,I);var g=Object.prototype.toString.call(A).slice(8,-1);return"Object"===g&&A.constructor&&(g=A.constructor.name),"Map"===g||"Set"===g?Array.from(A):"Arguments"===g||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g)?Bi(A,I):void 0}}(A))||I&&A&&"number"==typeof A.length){g&&(A=g);var C=0;return function(){return C>=A.length?{done:!0}:{done:!1,value:A[C++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(C.call(I));!(g=B()).done;){var i=g.value;if(A.next(i),A.closed)return}A.complete()}})});if(Array.isArray(I))return new g(function(A){wi(function(){if(!A.closed){for(var g=0;g C-i&&(this.process(g,0),i=0);for(let A=i;A >B&i),e=Number(g&i),E=C?4:0,t=C?0:4;A.setUint32(I+E,Q,C),A.setUint32(I+t,e,C)}(g,C-8,BigInt(8*this.length),B),this.process(g,0);const Q=FB(A),e=this.outputLen;if(e%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const E=e/4,t=this.get();if(E>t.length)throw new Error("_sha2: outputLen bigger than state");for(let A=0;A >>3,B=RB(g,17)^RB(g,19)^g>>>10;Ri[A]=B+Ri[A-7]+C+Ri[A-16]|0}let{A:g,B:C,C:B,D:i,E:Q,F:e,G:E,H:t}=this;for(let A=0;A<64;A++){const I=t+(RB(Q,6)^RB(Q,11)^RB(Q,25))+Gi(Q,e,E)+Fi[A]+Ri[A]|0,o=(RB(g,2)^RB(g,13)^RB(g,22))+pi(g,C,B)|0;t=E,E=e,e=Q,Q=i+I|0,i=B,B=C,C=g,g=I+o|0}g=g+this.A|0,C=C+this.B|0,B=B+this.C|0,i=i+this.D|0,Q=Q+this.E|0,e=e+this.F|0,E=E+this.G|0,t=t+this.H|0,this.set(g,C,B,i,Q,e,E,t)}roundClean(){fB(Ri)}destroy(){this.set(0,0,0,0,0,0,0,0),fB(this.buffer)}}const Mi=qB(()=>new Ui);class Ki extends LB{constructor(A,I){super(),this.finished=!1,this.destroyed=!1,pB(A);const g=HB(I);if(this.iHash=A.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const C=this.blockLen,B=new Uint8Array(C);B.set(g.length>C?A.create().update(g).digest():g);for(let A=0;A new Ki(A,I).update(g).digest();mi.create=(A,I)=>new Ki(A,I);const Ji=BigInt(0),bi=BigInt(1);function Hi(A,I=""){if("boolean"!=typeof A)throw new Error((I&&`"${I}"`)+"expected boolean, got type="+typeof A);return A}function Yi(A,I,g=""){const C=uB(A),B=A?.length,i=void 0!==I;if(!C||i&&B!==I)throw new Error((g&&`"${g}" `)+"expected Uint8Array"+(i?` of length ${I}`:"")+", got "+(C?`length=${B}`:"type="+typeof A));return A}function Li(A){const I=A.toString(16);return 1&I.length?"0"+I:I}function qi(A){if("string"!=typeof A)throw new Error("hex string expected, got "+typeof A);return""===A?Ji:BigInt("0x"+A)}function Vi(A){return qi(KB(A))}function Ti(A){return GB(A),qi(KB(Uint8Array.from(A).reverse()))}function vi(A,I){return JB(A.toString(16).padStart(2*I,"0"))}function Zi(A,I){return vi(A,I).reverse()}function xi(A){return JB(Li(A))}function Wi(A,I,g){let C;if("string"==typeof I)try{C=JB(I)}catch(I){throw new Error(A+" must be hex string or Uint8Array, cause: "+I)}else{if(!uB(I))throw new Error(A+" must be hex string or Uint8Array");C=Uint8Array.from(I)}const B=C.length;if("number"==typeof g&&B!==g)throw new Error(A+" of length "+g+" expected, got "+B);return C}function Pi(A,I){if(A.length!==I.length)return!1;let g=0;for(let C=0;C "bigint"==typeof A&&Ji<=A;function Xi(A,I,g){return Oi(A)&&Oi(I)&&Oi(g)&&I<=A&&A Ji;A>>=bi,I+=1);return I}const zi=A=>(bi< C(A,I,!1)),Object.entries(g).forEach(([A,I])=>C(A,I,!0))}function $i(A){const I=new WeakMap;return(g,...C)=>{const B=I.get(g);if(void 0!==B)return B;const i=A(g,...C);return I.set(g,i),i}}const AQ=BigInt(0),IQ=BigInt(1),gQ=BigInt(2),CQ=BigInt(3),BQ=BigInt(4),iQ=BigInt(5),QQ=BigInt(7),eQ=BigInt(8),EQ=BigInt(9),tQ=BigInt(16);function oQ(A,I){const g=A%I;return g>=AQ?g:I+g}function nQ(A,I,g){let C=A;for(;I-- >AQ;)C*=C,C%=g;return C}function aQ(A,I){if(A===AQ)throw new Error("invert: expected non-zero number");if(I<=AQ)throw new Error("invert: expected positive modulus, got "+I);let g=oQ(A,I),C=I,B=AQ,i=IQ,Q=IQ,e=AQ;for(;g!==AQ;){const A=C/g,I=C%g,E=B-Q*A,t=i-e*A;C=g,g=I,B=Q,i=e,Q=E,e=t}if(C!==IQ)throw new Error("invert: does not exist");return oQ(B,I)}function sQ(A,I,g){if(!A.eql(A.sqr(I),g))throw new Error("Cannot find square root")}function rQ(A,I){const g=(A.ORDER+IQ)/BQ,C=A.pow(I,g);return sQ(A,C,I),C}function cQ(A,I){const g=(A.ORDER-iQ)/eQ,C=A.mul(I,gQ),B=A.pow(C,g),i=A.mul(I,B),Q=A.mul(A.mul(i,gQ),B),e=A.mul(i,A.sub(Q,A.ONE));return sQ(A,e,I),e}function DQ(A){if(A 1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===g)return rQ;let i=B.pow(C,I);const Q=(I+IQ)/gQ;return function(A,C){if(A.is0(C))return C;if(1!==hQ(A,C))throw new Error("Cannot find square root");let B=g,e=A.mul(A.ONE,i),E=A.pow(C,I),t=A.pow(C,Q);for(;!A.eql(E,A.ONE);){if(A.is0(E))return A.ZERO;let I=1,g=A.sqr(E);for(;!A.eql(g,A.ONE);)if(I++,g=A.sqr(g),I===B)throw new Error("Cannot find square root");const C=IQ< A.is0(g)?I:(C[B]=I,A.mul(I,g)),A.ONE),i=A.inv(B);return I.reduceRight((I,g,B)=>A.is0(g)?I:(C[B]=A.mul(I,C[B]),A.mul(I,g)),i),C}function hQ(A,I){const g=(A.ORDER-IQ)/gQ,C=A.pow(I,g),B=A.eql(C,A.ONE),i=A.eql(C,A.ZERO),Q=A.eql(C,A.neg(A.ONE));if(!B&&!i&&!Q)throw new Error("invalid Legendre symbol result");return B?1:i?0:-1}function yQ(A,I){void 0!==I&&NB(I);const g=void 0!==I?I:A.toString(2).length;return{nBitLength:g,nByteLength:Math.ceil(g/8)}}function lQ(A,I,g=!1,C={}){if(A<=AQ)throw new Error("invalid field: expected ORDER > 0, got "+A);let B,i,Q,e=!1;if("object"==typeof I&&null!=I){if(C.sqrt||g)throw new Error("cannot specify opts in two arguments");const A=I;A.BITS&&(B=A.BITS),A.sqrt&&(i=A.sqrt),"boolean"==typeof A.isLE&&(g=A.isLE),"boolean"==typeof A.modFromBytes&&(e=A.modFromBytes),Q=A.allowedLengths}else"number"==typeof I&&(B=I),C.sqrt&&(i=C.sqrt);const{nBitLength:E,nByteLength:t}=yQ(A,B);if(t>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const n=Object.freeze({ORDER:A,isLE:g,BITS:E,BYTES:t,MASK:zi(E),ZERO:AQ,ONE:IQ,allowedLengths:Q,create:I=>oQ(I,A),isValid:I=>{if("bigint"!=typeof I)throw new Error("invalid field element: expected bigint, got "+typeof I);return AQ<=I&&I