diff --git a/assets/index-DkhCkWTd.js b/assets/index-BQaOgDH3.js similarity index 96% rename from assets/index-DkhCkWTd.js rename to assets/index-BQaOgDH3.js index 2f45cf6..4935d58 100644 --- a/assets/index-DkhCkWTd.js +++ b/assets/index-BQaOgDH3.js @@ -1 +1 @@ -(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))u(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const t of r.addedNodes)t.tagName==="LINK"&&t.rel==="modulepreload"&&u(t)}).observe(document,{childList:!0,subtree:!0});function c(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?r.credentials="include":e.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function u(e){if(e.ep)return;e.ep=!0;const r=c(e);fetch(e.href,r)}})();const y="modulepreload",g=function(l){return"/"+l},d={},E=function(i,c,u){let e=Promise.resolve();if(c&&c.length>0){document.getElementsByTagName("link");const t=document.querySelector("meta[property=csp-nonce]"),o=(t==null?void 0:t.nonce)||(t==null?void 0:t.getAttribute("nonce"));e=Promise.allSettled(c.map(n=>{if(n=g(n),n in d)return;d[n]=!0;const a=n.endsWith(".css"),m=a?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${n}"]${m}`))return;const s=document.createElement("link");if(s.rel=a?"stylesheet":y,a||(s.as="script"),s.crossOrigin="",s.href=n,o&&s.setAttribute("nonce",o),document.head.appendChild(s),a)return new Promise((p,h)=>{s.addEventListener("load",p),s.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${n}`)))})}))}function r(t){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=t,window.dispatchEvent(o),!o.defaultPrevented)throw t}return e.then(t=>{for(const o of t||[])o.status==="rejected"&&r(o.reason);return i().catch(r)})},f=document.getElementsByTagName("button"),b=document.getElementById("progress"),v=E(()=>import("./main-CZ9daoBf.js"),[]);for(const l of f)l.addEventListener("click",async i=>{for(const u of f)u.disabled=!0;b.classList.replace("hidden","flex");const{startApp:c}=await v;c(i.target.id)},!1); +(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))u(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const t of r.addedNodes)t.tagName==="LINK"&&t.rel==="modulepreload"&&u(t)}).observe(document,{childList:!0,subtree:!0});function c(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?r.credentials="include":e.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function u(e){if(e.ep)return;e.ep=!0;const r=c(e);fetch(e.href,r)}})();const y="modulepreload",g=function(l){return"/"+l},d={},E=function(i,c,u){let e=Promise.resolve();if(c&&c.length>0){document.getElementsByTagName("link");const t=document.querySelector("meta[property=csp-nonce]"),o=(t==null?void 0:t.nonce)||(t==null?void 0:t.getAttribute("nonce"));e=Promise.allSettled(c.map(n=>{if(n=g(n),n in d)return;d[n]=!0;const a=n.endsWith(".css"),m=a?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${n}"]${m}`))return;const s=document.createElement("link");if(s.rel=a?"stylesheet":y,a||(s.as="script"),s.crossOrigin="",s.href=n,o&&s.setAttribute("nonce",o),document.head.appendChild(s),a)return new Promise((p,h)=>{s.addEventListener("load",p),s.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${n}`)))})}))}function r(t){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=t,window.dispatchEvent(o),!o.defaultPrevented)throw t}return e.then(t=>{for(const o of t||[])o.status==="rejected"&&r(o.reason);return i().catch(r)})},f=document.getElementsByTagName("button"),b=document.getElementById("progress"),v=E(()=>import("./main-BYrhMSj6.js"),[]);for(const l of f)l.addEventListener("click",async i=>{for(const u of f)u.disabled=!0;b.classList.replace("hidden","flex");const{startApp:c}=await v;c(i.target.id)},!1); diff --git a/assets/index-DrcgzvlW.css b/assets/index-DPkGGzzV.css similarity index 63% rename from assets/index-DrcgzvlW.css rename to assets/index-DPkGGzzV.css index 7d0bf9d..f938433 100644 --- a/assets/index-DrcgzvlW.css +++ b/assets/index-DPkGGzzV.css @@ -1 +1 @@ -/*! tailwindcss v4.0.0-beta.2 | MIT License | https://tailwindcss.com */@layer theme{:root{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-serif:ui-serif,Georgia,Cambria,"Times New Roman",Times,serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(.971 .013 17.38);--color-red-100:oklch(.936 .032 17.717);--color-red-200:oklch(.885 .062 18.334);--color-red-300:oklch(.808 .114 19.571);--color-red-400:oklch(.704 .191 22.216);--color-red-500:oklch(.637 .237 25.331);--color-red-600:oklch(.577 .245 27.325);--color-red-700:oklch(.505 .213 27.518);--color-red-800:oklch(.444 .177 26.899);--color-red-900:oklch(.396 .141 25.723);--color-red-950:oklch(.258 .092 26.042);--color-orange-50:oklch(.98 .016 73.684);--color-orange-100:oklch(.954 .038 75.164);--color-orange-200:oklch(.901 .076 70.697);--color-orange-300:oklch(.837 .128 66.29);--color-orange-400:oklch(.75 .183 55.934);--color-orange-500:oklch(.705 .213 47.604);--color-orange-600:oklch(.646 .222 41.116);--color-orange-700:oklch(.553 .195 38.402);--color-orange-800:oklch(.47 .157 37.304);--color-orange-900:oklch(.408 .123 38.172);--color-orange-950:oklch(.266 .079 36.259);--color-amber-50:oklch(.987 .022 95.277);--color-amber-100:oklch(.962 .059 95.617);--color-amber-200:oklch(.924 .12 95.746);--color-amber-300:oklch(.879 .169 91.605);--color-amber-400:oklch(.828 .189 84.429);--color-amber-500:oklch(.769 .188 70.08);--color-amber-600:oklch(.666 .179 58.318);--color-amber-700:oklch(.555 .163 48.998);--color-amber-800:oklch(.473 .137 46.201);--color-amber-900:oklch(.414 .112 45.904);--color-amber-950:oklch(.279 .077 45.635);--color-yellow-50:oklch(.987 .026 102.212);--color-yellow-100:oklch(.973 .071 103.193);--color-yellow-200:oklch(.945 .129 101.54);--color-yellow-300:oklch(.905 .182 98.111);--color-yellow-400:oklch(.852 .199 91.936);--color-yellow-500:oklch(.795 .184 86.047);--color-yellow-600:oklch(.681 .162 75.834);--color-yellow-700:oklch(.554 .135 66.442);--color-yellow-800:oklch(.476 .114 61.907);--color-yellow-900:oklch(.421 .095 57.708);--color-yellow-950:oklch(.286 .066 53.813);--color-lime-50:oklch(.986 .031 120.757);--color-lime-100:oklch(.967 .067 122.328);--color-lime-200:oklch(.938 .127 124.321);--color-lime-300:oklch(.897 .196 126.665);--color-lime-400:oklch(.841 .238 128.85);--color-lime-500:oklch(.768 .233 130.85);--color-lime-600:oklch(.648 .2 131.684);--color-lime-700:oklch(.532 .157 131.589);--color-lime-800:oklch(.453 .124 130.933);--color-lime-900:oklch(.405 .101 131.063);--color-lime-950:oklch(.274 .072 132.109);--color-green-50:oklch(.982 .018 155.826);--color-green-100:oklch(.962 .044 156.743);--color-green-200:oklch(.925 .084 155.995);--color-green-300:oklch(.871 .15 154.449);--color-green-400:oklch(.792 .209 151.711);--color-green-500:oklch(.723 .219 149.579);--color-green-600:oklch(.627 .194 149.214);--color-green-700:oklch(.527 .154 150.069);--color-green-800:oklch(.448 .119 151.328);--color-green-900:oklch(.393 .095 152.535);--color-green-950:oklch(.266 .065 152.934);--color-emerald-50:oklch(.979 .021 166.113);--color-emerald-100:oklch(.95 .052 163.051);--color-emerald-200:oklch(.905 .093 164.15);--color-emerald-300:oklch(.845 .143 164.978);--color-emerald-400:oklch(.765 .177 163.223);--color-emerald-500:oklch(.696 .17 162.48);--color-emerald-600:oklch(.596 .145 163.225);--color-emerald-700:oklch(.508 .118 165.612);--color-emerald-800:oklch(.432 .095 166.913);--color-emerald-900:oklch(.378 .077 168.94);--color-emerald-950:oklch(.262 .051 172.552);--color-teal-50:oklch(.984 .014 180.72);--color-teal-100:oklch(.953 .051 180.801);--color-teal-200:oklch(.91 .096 180.426);--color-teal-300:oklch(.855 .138 181.071);--color-teal-400:oklch(.777 .152 181.912);--color-teal-500:oklch(.704 .14 182.503);--color-teal-600:oklch(.6 .118 184.704);--color-teal-700:oklch(.511 .096 186.391);--color-teal-800:oklch(.437 .078 188.216);--color-teal-900:oklch(.386 .063 188.416);--color-teal-950:oklch(.277 .046 192.524);--color-cyan-50:oklch(.984 .019 200.873);--color-cyan-100:oklch(.956 .045 203.388);--color-cyan-200:oklch(.917 .08 205.041);--color-cyan-300:oklch(.865 .127 207.078);--color-cyan-400:oklch(.789 .154 211.53);--color-cyan-500:oklch(.715 .143 215.221);--color-cyan-600:oklch(.609 .126 221.723);--color-cyan-700:oklch(.52 .105 223.128);--color-cyan-800:oklch(.45 .085 224.283);--color-cyan-900:oklch(.398 .07 227.392);--color-cyan-950:oklch(.302 .056 229.695);--color-sky-50:oklch(.977 .013 236.62);--color-sky-100:oklch(.951 .026 236.824);--color-sky-200:oklch(.901 .058 230.902);--color-sky-300:oklch(.828 .111 230.318);--color-sky-400:oklch(.746 .16 232.661);--color-sky-500:oklch(.685 .169 237.323);--color-sky-600:oklch(.588 .158 241.966);--color-sky-700:oklch(.5 .134 242.749);--color-sky-800:oklch(.443 .11 240.79);--color-sky-900:oklch(.391 .09 240.876);--color-sky-950:oklch(.293 .066 243.157);--color-blue-50:oklch(.97 .014 254.604);--color-blue-100:oklch(.932 .032 255.585);--color-blue-200:oklch(.882 .059 254.128);--color-blue-300:oklch(.809 .105 251.813);--color-blue-400:oklch(.707 .165 254.624);--color-blue-500:oklch(.623 .214 259.815);--color-blue-600:oklch(.546 .245 262.881);--color-blue-700:oklch(.488 .243 264.376);--color-blue-800:oklch(.424 .199 265.638);--color-blue-900:oklch(.379 .146 265.522);--color-blue-950:oklch(.282 .091 267.935);--color-indigo-50:oklch(.962 .018 272.314);--color-indigo-100:oklch(.93 .034 272.788);--color-indigo-200:oklch(.87 .065 274.039);--color-indigo-300:oklch(.785 .115 274.713);--color-indigo-400:oklch(.673 .182 276.935);--color-indigo-500:oklch(.585 .233 277.117);--color-indigo-600:oklch(.511 .262 276.966);--color-indigo-700:oklch(.457 .24 277.023);--color-indigo-800:oklch(.398 .195 277.366);--color-indigo-900:oklch(.359 .144 278.697);--color-indigo-950:oklch(.257 .09 281.288);--color-violet-50:oklch(.969 .016 293.756);--color-violet-100:oklch(.943 .029 294.588);--color-violet-200:oklch(.894 .057 293.283);--color-violet-300:oklch(.811 .111 293.571);--color-violet-400:oklch(.702 .183 293.541);--color-violet-500:oklch(.606 .25 292.717);--color-violet-600:oklch(.541 .281 293.009);--color-violet-700:oklch(.491 .27 292.581);--color-violet-800:oklch(.432 .232 292.759);--color-violet-900:oklch(.38 .189 293.745);--color-violet-950:oklch(.283 .141 291.089);--color-purple-50:oklch(.977 .014 308.299);--color-purple-100:oklch(.946 .033 307.174);--color-purple-200:oklch(.902 .063 306.703);--color-purple-300:oklch(.827 .119 306.383);--color-purple-400:oklch(.714 .203 305.504);--color-purple-500:oklch(.627 .265 303.9);--color-purple-600:oklch(.558 .288 302.321);--color-purple-700:oklch(.496 .265 301.924);--color-purple-800:oklch(.438 .218 303.724);--color-purple-900:oklch(.381 .176 304.987);--color-purple-950:oklch(.291 .149 302.717);--color-fuchsia-50:oklch(.977 .017 320.058);--color-fuchsia-100:oklch(.952 .037 318.852);--color-fuchsia-200:oklch(.903 .076 319.62);--color-fuchsia-300:oklch(.833 .145 321.434);--color-fuchsia-400:oklch(.74 .238 322.16);--color-fuchsia-500:oklch(.667 .295 322.15);--color-fuchsia-600:oklch(.591 .293 322.896);--color-fuchsia-700:oklch(.518 .253 323.949);--color-fuchsia-800:oklch(.452 .211 324.591);--color-fuchsia-900:oklch(.401 .17 325.612);--color-fuchsia-950:oklch(.293 .136 325.661);--color-pink-50:oklch(.971 .014 343.198);--color-pink-100:oklch(.948 .028 342.258);--color-pink-200:oklch(.899 .061 343.231);--color-pink-300:oklch(.823 .12 346.018);--color-pink-400:oklch(.718 .202 349.761);--color-pink-500:oklch(.656 .241 354.308);--color-pink-600:oklch(.592 .249 .584);--color-pink-700:oklch(.525 .223 3.958);--color-pink-800:oklch(.459 .187 3.815);--color-pink-900:oklch(.408 .153 2.432);--color-pink-950:oklch(.284 .109 3.907);--color-rose-50:oklch(.969 .015 12.422);--color-rose-100:oklch(.941 .03 12.58);--color-rose-200:oklch(.892 .058 10.001);--color-rose-300:oklch(.81 .117 11.638);--color-rose-400:oklch(.712 .194 13.428);--color-rose-500:oklch(.645 .246 16.439);--color-rose-600:oklch(.586 .253 17.585);--color-rose-700:oklch(.514 .222 16.935);--color-rose-800:oklch(.455 .188 13.697);--color-rose-900:oklch(.41 .159 10.272);--color-rose-950:oklch(.271 .105 12.094);--color-slate-50:oklch(.984 .003 247.858);--color-slate-100:oklch(.968 .007 247.896);--color-slate-200:oklch(.929 .013 255.508);--color-slate-300:oklch(.869 .022 252.894);--color-slate-400:oklch(.704 .04 256.788);--color-slate-500:oklch(.554 .046 257.417);--color-slate-600:oklch(.446 .043 257.281);--color-slate-700:oklch(.372 .044 257.287);--color-slate-800:oklch(.279 .041 260.031);--color-slate-900:oklch(.208 .042 265.755);--color-slate-950:oklch(.129 .042 264.695);--color-gray-50:oklch(.985 .002 247.839);--color-gray-100:oklch(.967 .003 264.542);--color-gray-200:oklch(.928 .006 264.531);--color-gray-300:oklch(.872 .01 258.338);--color-gray-400:oklch(.707 .022 261.325);--color-gray-500:oklch(.551 .027 264.364);--color-gray-600:oklch(.446 .03 256.802);--color-gray-700:oklch(.373 .034 259.733);--color-gray-800:oklch(.278 .033 256.848);--color-gray-900:oklch(.21 .034 264.665);--color-gray-950:oklch(.13 .028 261.692);--color-zinc-50:oklch(.985 0 0);--color-zinc-100:oklch(.967 .001 286.375);--color-zinc-200:oklch(.92 .004 286.32);--color-zinc-300:oklch(.871 .006 286.286);--color-zinc-400:oklch(.705 .015 286.067);--color-zinc-500:oklch(.552 .016 285.938);--color-zinc-600:oklch(.442 .017 285.786);--color-zinc-700:oklch(.37 .013 285.805);--color-zinc-800:oklch(.274 .006 286.033);--color-zinc-900:oklch(.21 .006 285.885);--color-zinc-950:oklch(.141 .005 285.823);--color-neutral-50:oklch(.985 0 0);--color-neutral-100:oklch(.97 0 0);--color-neutral-200:oklch(.922 0 0);--color-neutral-300:oklch(.87 0 0);--color-neutral-400:oklch(.708 0 0);--color-neutral-500:oklch(.556 0 0);--color-neutral-600:oklch(.439 0 0);--color-neutral-700:oklch(.371 0 0);--color-neutral-800:oklch(.269 0 0);--color-neutral-900:oklch(.205 0 0);--color-neutral-950:oklch(.145 0 0);--color-stone-50:oklch(.985 .001 106.423);--color-stone-100:oklch(.97 .001 106.424);--color-stone-200:oklch(.923 .003 48.717);--color-stone-300:oklch(.869 .005 56.366);--color-stone-400:oklch(.709 .01 56.259);--color-stone-500:oklch(.553 .013 58.071);--color-stone-600:oklch(.444 .011 73.639);--color-stone-700:oklch(.374 .01 67.558);--color-stone-800:oklch(.268 .007 34.298);--color-stone-900:oklch(.216 .006 56.043);--color-stone-950:oklch(.147 .004 49.25);--color-black:#000;--color-white:#fff;--spacing:.25rem;--breakpoint-sm:40rem;--breakpoint-md:48rem;--breakpoint-lg:64rem;--breakpoint-xl:80rem;--breakpoint-2xl:96rem;--container-3xs:16rem;--container-2xs:18rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--container-prose:65ch;--text-xs:.75rem;--text-xs--line-height:1rem;--text-sm:.875rem;--text-sm--line-height:1.25rem;--text-base:1rem;--text-base--line-height:1.5rem;--text-lg:1.125rem;--text-lg--line-height:1.75rem;--text-xl:1.25rem;--text-xl--line-height:1.75rem;--text-2xl:1.5rem;--text-2xl--line-height:2rem;--text-3xl:1.875rem;--text-3xl--line-height:2.25rem;--text-4xl:2.25rem;--text-4xl--line-height:2.5rem;--text-5xl:3rem;--text-5xl--line-height:1;--text-6xl:3.75rem;--text-6xl--line-height:1;--text-7xl:4.5rem;--text-7xl--line-height:1;--text-8xl:6rem;--text-8xl--line-height:1;--text-9xl:8rem;--text-9xl--line-height:1;--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tighter:-.05em;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--leading-loose:2;--radius-xs:.125rem;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--radius-4xl:2rem;--shadow-2xs:0 1px #0000000d;--shadow-xs:0 1px 2px 0 #0000000d;--shadow-sm:0 1px 3px 0 #0000001a,0 1px 2px -1px #0000001a;--shadow-md:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--shadow-lg:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--shadow-xl:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;--shadow-2xl:0 25px 50px -12px #00000040;--inset-shadow-2xs:inset 0 1px #0000000d;--inset-shadow-xs:inset 0 1px 1px #0000000d;--inset-shadow-sm:inset 0 2px 4px #0000000d;--drop-shadow-xs:0 1px 1px #0000000d;--drop-shadow-sm:0 1px 2px #00000026;--drop-shadow-md:0 3px 3px #0000001f;--drop-shadow-lg:0 4px 4px #00000026;--drop-shadow-xl:0 9px 7px #0000001a;--drop-shadow-2xl:0 25px 25px #00000026;--ease-in:cubic-bezier(.4,0,1,1);--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0,0,.2,1)infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--animate-bounce:bounce 1s infinite;--blur-xs:4px;--blur-sm:8px;--blur-md:12px;--blur-lg:16px;--blur-xl:24px;--blur-2xl:40px;--blur-3xl:64px;--perspective-dramatic:100px;--perspective-near:300px;--perspective-normal:500px;--perspective-midrange:800px;--perspective-distant:1200px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-font-feature-settings:var(--font-sans--font-feature-settings);--default-font-variation-settings:var(--font-sans--font-variation-settings);--default-mono-font-family:var(--font-mono);--default-mono-font-feature-settings:var(--font-mono--font-feature-settings);--default-mono-font-variation-settings:var(--font-mono--font-variation-settings)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}body{line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1;color:color-mix(in oklch,currentColor 50%,transparent)}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.collapse{visibility:collapse}.visible{visibility:visible}.\!relative{position:relative!important}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.isolate{isolation:isolate}.col-span-2{grid-column:span 2/span 2}.col-span-3{grid-column:span 3/span 3}.col-span-full{grid-column:1/-1}.\!container{width:100%!important}@media (width>=40rem){.\!container{max-width:40rem!important}}@media (width>=48rem){.\!container{max-width:48rem!important}}@media (width>=64rem){.\!container{max-width:64rem!important}}@media (width>=80rem){.\!container{max-width:80rem!important}}@media (width>=96rem){.\!container{max-width:96rem!important}}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-2{margin:calc(var(--spacing)*2)}.m-4{margin:calc(var(--spacing)*4)}.m-auto{margin:auto}.mr-2{margin-right:calc(var(--spacing)*2)}.-ml-3{margin-left:calc(var(--spacing)*-3)}.ml-2{margin-left:calc(var(--spacing)*2)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-flex{display:inline-flex}.table{display:table}.size-full{width:100%;height:100%}.h-1{height:calc(var(--spacing)*1)}.h-2{height:calc(var(--spacing)*2)}.min-h-12{min-height:calc(var(--spacing)*12)}.min-h-screen{min-height:100vh}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.grow{flex-grow:1}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x)var(--tw-rotate-y)var(--tw-rotate-z)var(--tw-skew-x)var(--tw-skew-y)}.animate-pulse{animation:var(--animate-pulse)}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.resize{resize:both}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.items-center{align-items:center}.justify-center{justify-content:center}.justify-items-center{justify-items:center}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}.gap-y-4{row-gap:calc(var(--spacing)*4)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-amber-400{border-color:var(--color-amber-400)}.bg-amber-400{background-color:var(--color-amber-400)}.bg-transparent{background-color:#0000}.bg-gradient-to-r{--tw-gradient-position:to right in oklch,;background-image:linear-gradient(var(--tw-gradient-stops))}.from-zinc-950{--tw-gradient-from:var(--color-zinc-950);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position,)var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-zinc-800{--tw-gradient-to:var(--color-zinc-800);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position,)var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.p-1{padding:calc(var(--spacing)*1)}.p-8{padding:calc(var(--spacing)*8)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-8{padding-block:calc(var(--spacing)*8)}.pt-8{padding-top:calc(var(--spacing)*8)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pb-10{padding-bottom:calc(var(--spacing)*10)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-amber-400{color:var(--color-amber-400)}.text-slate-300{color:var(--color-slate-300)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.underline{text-decoration-line:underline}.decoration-amber-400{-webkit-text-decoration-color:var(--color-amber-400);text-decoration-color:var(--color-amber-400)}.decoration-wavy{text-decoration-style:wavy}.underline-offset-4{text-underline-offset:4px}.mix-blend-hard-light{mix-blend-mode:hard-light}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,-webkit-backdrop-filter,-webkit-backdrop-filter,backdrop-filter;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.\[animation-delay\:-0\.15s\]{animation-delay:-.15s}.\[animation-delay\:-0\.30s\]{animation-delay:-.3s}.\[animation-delay\:-0\.45s\]{animation-delay:-.45s}.\[animation-delay\:-0\.60s\]{animation-delay:-.6s}.\[animation-delay\:-0\.75s\]{animation-delay:-.75s}.\[animation-delay\:-0\.90s\]{animation-delay:-.9s}.\[animation-delay\:-1\.05s\]{animation-delay:-1.05s}.\[animation-delay\:-1\.20s\]{animation-delay:-1.2s}.\[animation-delay\:-1\.35s\]{animation-delay:-1.35s}.\[animation-delay\:-1\.50s\]{animation-delay:-1.5s}.\[animation-delay\:-1\.65s\]{animation-delay:-1.65s}.\[animation-delay\:-1\.80s\]{animation-delay:-1.8s}.\[animation-delay\:-1\.95s\]{animation-delay:-1.95s}.\[animation-delay\:-2\.10s\]{animation-delay:-2.1s}.\[animation-delay\:-2\.25s\]{animation-delay:-2.25s}.\[animation-delay\:-2\.40s\]{animation-delay:-2.4s}.\[animation-delay\:-2\.55s\]{animation-delay:-2.55s}.\[animation-delay\:-2\.70s\]{animation-delay:-2.7s}.\[animation-delay\:-2\.85s\]{animation-delay:-2.85s}.\[animation-delay\:-3\.00s\]{animation-delay:-3s}.\[animation-duration\:6s\]{animation-duration:6s}.outline-none{--tw-outline-style:none;outline-style:none}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:block{display:block}.sm\:hidden{display:none}.sm\:shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.sm\:shadow-black{--tw-shadow-color:var(--color-black)}}}@media (resolution>=200dpi){html{font-size:18px}.text-sm{font-size:.9rem}}::selection{background-color:var(--color-amber-400);color:var(--color-zinc-500)}@supports (-moz-orient:inline){@layer base{*,:before,:after,::backdrop{--tw-rotate-x:rotateX(0);--tw-rotate-y:rotateY(0);--tw-rotate-z:rotateZ(0);--tw-skew-x:skewX(0);--tw-skew-y:skewY(0);--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}@property --tw-rotate-x{syntax:"";inherits:false;initial-value:rotateX(0)}@property --tw-rotate-y{syntax:"";inherits:false;initial-value:rotateY(0)}@property --tw-rotate-z{syntax:"";inherits:false;initial-value:rotate(0)}@property --tw-skew-x{syntax:"";inherits:false;initial-value:skew(0deg)}@property --tw-skew-y{syntax:"";inherits:false;initial-value:skewY(0)}@property --tw-space-y-reverse{syntax:"";inherits:false;initial-value:0}@property --tw-border-style{syntax:"";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"|";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"|";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"|";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000} +/*! tailwindcss v4.0.0-beta.2 | MIT License | https://tailwindcss.com */@layer theme{:root{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-serif:ui-serif,Georgia,Cambria,"Times New Roman",Times,serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(.971 .013 17.38);--color-red-100:oklch(.936 .032 17.717);--color-red-200:oklch(.885 .062 18.334);--color-red-300:oklch(.808 .114 19.571);--color-red-400:oklch(.704 .191 22.216);--color-red-500:oklch(.637 .237 25.331);--color-red-600:oklch(.577 .245 27.325);--color-red-700:oklch(.505 .213 27.518);--color-red-800:oklch(.444 .177 26.899);--color-red-900:oklch(.396 .141 25.723);--color-red-950:oklch(.258 .092 26.042);--color-orange-50:oklch(.98 .016 73.684);--color-orange-100:oklch(.954 .038 75.164);--color-orange-200:oklch(.901 .076 70.697);--color-orange-300:oklch(.837 .128 66.29);--color-orange-400:oklch(.75 .183 55.934);--color-orange-500:oklch(.705 .213 47.604);--color-orange-600:oklch(.646 .222 41.116);--color-orange-700:oklch(.553 .195 38.402);--color-orange-800:oklch(.47 .157 37.304);--color-orange-900:oklch(.408 .123 38.172);--color-orange-950:oklch(.266 .079 36.259);--color-amber-50:oklch(.987 .022 95.277);--color-amber-100:oklch(.962 .059 95.617);--color-amber-200:oklch(.924 .12 95.746);--color-amber-300:oklch(.879 .169 91.605);--color-amber-400:oklch(.828 .189 84.429);--color-amber-500:oklch(.769 .188 70.08);--color-amber-600:oklch(.666 .179 58.318);--color-amber-700:oklch(.555 .163 48.998);--color-amber-800:oklch(.473 .137 46.201);--color-amber-900:oklch(.414 .112 45.904);--color-amber-950:oklch(.279 .077 45.635);--color-yellow-50:oklch(.987 .026 102.212);--color-yellow-100:oklch(.973 .071 103.193);--color-yellow-200:oklch(.945 .129 101.54);--color-yellow-300:oklch(.905 .182 98.111);--color-yellow-400:oklch(.852 .199 91.936);--color-yellow-500:oklch(.795 .184 86.047);--color-yellow-600:oklch(.681 .162 75.834);--color-yellow-700:oklch(.554 .135 66.442);--color-yellow-800:oklch(.476 .114 61.907);--color-yellow-900:oklch(.421 .095 57.708);--color-yellow-950:oklch(.286 .066 53.813);--color-lime-50:oklch(.986 .031 120.757);--color-lime-100:oklch(.967 .067 122.328);--color-lime-200:oklch(.938 .127 124.321);--color-lime-300:oklch(.897 .196 126.665);--color-lime-400:oklch(.841 .238 128.85);--color-lime-500:oklch(.768 .233 130.85);--color-lime-600:oklch(.648 .2 131.684);--color-lime-700:oklch(.532 .157 131.589);--color-lime-800:oklch(.453 .124 130.933);--color-lime-900:oklch(.405 .101 131.063);--color-lime-950:oklch(.274 .072 132.109);--color-green-50:oklch(.982 .018 155.826);--color-green-100:oklch(.962 .044 156.743);--color-green-200:oklch(.925 .084 155.995);--color-green-300:oklch(.871 .15 154.449);--color-green-400:oklch(.792 .209 151.711);--color-green-500:oklch(.723 .219 149.579);--color-green-600:oklch(.627 .194 149.214);--color-green-700:oklch(.527 .154 150.069);--color-green-800:oklch(.448 .119 151.328);--color-green-900:oklch(.393 .095 152.535);--color-green-950:oklch(.266 .065 152.934);--color-emerald-50:oklch(.979 .021 166.113);--color-emerald-100:oklch(.95 .052 163.051);--color-emerald-200:oklch(.905 .093 164.15);--color-emerald-300:oklch(.845 .143 164.978);--color-emerald-400:oklch(.765 .177 163.223);--color-emerald-500:oklch(.696 .17 162.48);--color-emerald-600:oklch(.596 .145 163.225);--color-emerald-700:oklch(.508 .118 165.612);--color-emerald-800:oklch(.432 .095 166.913);--color-emerald-900:oklch(.378 .077 168.94);--color-emerald-950:oklch(.262 .051 172.552);--color-teal-50:oklch(.984 .014 180.72);--color-teal-100:oklch(.953 .051 180.801);--color-teal-200:oklch(.91 .096 180.426);--color-teal-300:oklch(.855 .138 181.071);--color-teal-400:oklch(.777 .152 181.912);--color-teal-500:oklch(.704 .14 182.503);--color-teal-600:oklch(.6 .118 184.704);--color-teal-700:oklch(.511 .096 186.391);--color-teal-800:oklch(.437 .078 188.216);--color-teal-900:oklch(.386 .063 188.416);--color-teal-950:oklch(.277 .046 192.524);--color-cyan-50:oklch(.984 .019 200.873);--color-cyan-100:oklch(.956 .045 203.388);--color-cyan-200:oklch(.917 .08 205.041);--color-cyan-300:oklch(.865 .127 207.078);--color-cyan-400:oklch(.789 .154 211.53);--color-cyan-500:oklch(.715 .143 215.221);--color-cyan-600:oklch(.609 .126 221.723);--color-cyan-700:oklch(.52 .105 223.128);--color-cyan-800:oklch(.45 .085 224.283);--color-cyan-900:oklch(.398 .07 227.392);--color-cyan-950:oklch(.302 .056 229.695);--color-sky-50:oklch(.977 .013 236.62);--color-sky-100:oklch(.951 .026 236.824);--color-sky-200:oklch(.901 .058 230.902);--color-sky-300:oklch(.828 .111 230.318);--color-sky-400:oklch(.746 .16 232.661);--color-sky-500:oklch(.685 .169 237.323);--color-sky-600:oklch(.588 .158 241.966);--color-sky-700:oklch(.5 .134 242.749);--color-sky-800:oklch(.443 .11 240.79);--color-sky-900:oklch(.391 .09 240.876);--color-sky-950:oklch(.293 .066 243.157);--color-blue-50:oklch(.97 .014 254.604);--color-blue-100:oklch(.932 .032 255.585);--color-blue-200:oklch(.882 .059 254.128);--color-blue-300:oklch(.809 .105 251.813);--color-blue-400:oklch(.707 .165 254.624);--color-blue-500:oklch(.623 .214 259.815);--color-blue-600:oklch(.546 .245 262.881);--color-blue-700:oklch(.488 .243 264.376);--color-blue-800:oklch(.424 .199 265.638);--color-blue-900:oklch(.379 .146 265.522);--color-blue-950:oklch(.282 .091 267.935);--color-indigo-50:oklch(.962 .018 272.314);--color-indigo-100:oklch(.93 .034 272.788);--color-indigo-200:oklch(.87 .065 274.039);--color-indigo-300:oklch(.785 .115 274.713);--color-indigo-400:oklch(.673 .182 276.935);--color-indigo-500:oklch(.585 .233 277.117);--color-indigo-600:oklch(.511 .262 276.966);--color-indigo-700:oklch(.457 .24 277.023);--color-indigo-800:oklch(.398 .195 277.366);--color-indigo-900:oklch(.359 .144 278.697);--color-indigo-950:oklch(.257 .09 281.288);--color-violet-50:oklch(.969 .016 293.756);--color-violet-100:oklch(.943 .029 294.588);--color-violet-200:oklch(.894 .057 293.283);--color-violet-300:oklch(.811 .111 293.571);--color-violet-400:oklch(.702 .183 293.541);--color-violet-500:oklch(.606 .25 292.717);--color-violet-600:oklch(.541 .281 293.009);--color-violet-700:oklch(.491 .27 292.581);--color-violet-800:oklch(.432 .232 292.759);--color-violet-900:oklch(.38 .189 293.745);--color-violet-950:oklch(.283 .141 291.089);--color-purple-50:oklch(.977 .014 308.299);--color-purple-100:oklch(.946 .033 307.174);--color-purple-200:oklch(.902 .063 306.703);--color-purple-300:oklch(.827 .119 306.383);--color-purple-400:oklch(.714 .203 305.504);--color-purple-500:oklch(.627 .265 303.9);--color-purple-600:oklch(.558 .288 302.321);--color-purple-700:oklch(.496 .265 301.924);--color-purple-800:oklch(.438 .218 303.724);--color-purple-900:oklch(.381 .176 304.987);--color-purple-950:oklch(.291 .149 302.717);--color-fuchsia-50:oklch(.977 .017 320.058);--color-fuchsia-100:oklch(.952 .037 318.852);--color-fuchsia-200:oklch(.903 .076 319.62);--color-fuchsia-300:oklch(.833 .145 321.434);--color-fuchsia-400:oklch(.74 .238 322.16);--color-fuchsia-500:oklch(.667 .295 322.15);--color-fuchsia-600:oklch(.591 .293 322.896);--color-fuchsia-700:oklch(.518 .253 323.949);--color-fuchsia-800:oklch(.452 .211 324.591);--color-fuchsia-900:oklch(.401 .17 325.612);--color-fuchsia-950:oklch(.293 .136 325.661);--color-pink-50:oklch(.971 .014 343.198);--color-pink-100:oklch(.948 .028 342.258);--color-pink-200:oklch(.899 .061 343.231);--color-pink-300:oklch(.823 .12 346.018);--color-pink-400:oklch(.718 .202 349.761);--color-pink-500:oklch(.656 .241 354.308);--color-pink-600:oklch(.592 .249 .584);--color-pink-700:oklch(.525 .223 3.958);--color-pink-800:oklch(.459 .187 3.815);--color-pink-900:oklch(.408 .153 2.432);--color-pink-950:oklch(.284 .109 3.907);--color-rose-50:oklch(.969 .015 12.422);--color-rose-100:oklch(.941 .03 12.58);--color-rose-200:oklch(.892 .058 10.001);--color-rose-300:oklch(.81 .117 11.638);--color-rose-400:oklch(.712 .194 13.428);--color-rose-500:oklch(.645 .246 16.439);--color-rose-600:oklch(.586 .253 17.585);--color-rose-700:oklch(.514 .222 16.935);--color-rose-800:oklch(.455 .188 13.697);--color-rose-900:oklch(.41 .159 10.272);--color-rose-950:oklch(.271 .105 12.094);--color-slate-50:oklch(.984 .003 247.858);--color-slate-100:oklch(.968 .007 247.896);--color-slate-200:oklch(.929 .013 255.508);--color-slate-300:oklch(.869 .022 252.894);--color-slate-400:oklch(.704 .04 256.788);--color-slate-500:oklch(.554 .046 257.417);--color-slate-600:oklch(.446 .043 257.281);--color-slate-700:oklch(.372 .044 257.287);--color-slate-800:oklch(.279 .041 260.031);--color-slate-900:oklch(.208 .042 265.755);--color-slate-950:oklch(.129 .042 264.695);--color-gray-50:oklch(.985 .002 247.839);--color-gray-100:oklch(.967 .003 264.542);--color-gray-200:oklch(.928 .006 264.531);--color-gray-300:oklch(.872 .01 258.338);--color-gray-400:oklch(.707 .022 261.325);--color-gray-500:oklch(.551 .027 264.364);--color-gray-600:oklch(.446 .03 256.802);--color-gray-700:oklch(.373 .034 259.733);--color-gray-800:oklch(.278 .033 256.848);--color-gray-900:oklch(.21 .034 264.665);--color-gray-950:oklch(.13 .028 261.692);--color-zinc-50:oklch(.985 0 0);--color-zinc-100:oklch(.967 .001 286.375);--color-zinc-200:oklch(.92 .004 286.32);--color-zinc-300:oklch(.871 .006 286.286);--color-zinc-400:oklch(.705 .015 286.067);--color-zinc-500:oklch(.552 .016 285.938);--color-zinc-600:oklch(.442 .017 285.786);--color-zinc-700:oklch(.37 .013 285.805);--color-zinc-800:oklch(.274 .006 286.033);--color-zinc-900:oklch(.21 .006 285.885);--color-zinc-950:oklch(.141 .005 285.823);--color-neutral-50:oklch(.985 0 0);--color-neutral-100:oklch(.97 0 0);--color-neutral-200:oklch(.922 0 0);--color-neutral-300:oklch(.87 0 0);--color-neutral-400:oklch(.708 0 0);--color-neutral-500:oklch(.556 0 0);--color-neutral-600:oklch(.439 0 0);--color-neutral-700:oklch(.371 0 0);--color-neutral-800:oklch(.269 0 0);--color-neutral-900:oklch(.205 0 0);--color-neutral-950:oklch(.145 0 0);--color-stone-50:oklch(.985 .001 106.423);--color-stone-100:oklch(.97 .001 106.424);--color-stone-200:oklch(.923 .003 48.717);--color-stone-300:oklch(.869 .005 56.366);--color-stone-400:oklch(.709 .01 56.259);--color-stone-500:oklch(.553 .013 58.071);--color-stone-600:oklch(.444 .011 73.639);--color-stone-700:oklch(.374 .01 67.558);--color-stone-800:oklch(.268 .007 34.298);--color-stone-900:oklch(.216 .006 56.043);--color-stone-950:oklch(.147 .004 49.25);--color-black:#000;--color-white:#fff;--spacing:.25rem;--breakpoint-sm:40rem;--breakpoint-md:48rem;--breakpoint-lg:64rem;--breakpoint-xl:80rem;--breakpoint-2xl:96rem;--container-3xs:16rem;--container-2xs:18rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--container-prose:65ch;--text-xs:.75rem;--text-xs--line-height:1rem;--text-sm:.875rem;--text-sm--line-height:1.25rem;--text-base:1rem;--text-base--line-height:1.5rem;--text-lg:1.125rem;--text-lg--line-height:1.75rem;--text-xl:1.25rem;--text-xl--line-height:1.75rem;--text-2xl:1.5rem;--text-2xl--line-height:2rem;--text-3xl:1.875rem;--text-3xl--line-height:2.25rem;--text-4xl:2.25rem;--text-4xl--line-height:2.5rem;--text-5xl:3rem;--text-5xl--line-height:1;--text-6xl:3.75rem;--text-6xl--line-height:1;--text-7xl:4.5rem;--text-7xl--line-height:1;--text-8xl:6rem;--text-8xl--line-height:1;--text-9xl:8rem;--text-9xl--line-height:1;--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tighter:-.05em;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--leading-loose:2;--radius-xs:.125rem;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--radius-4xl:2rem;--shadow-2xs:0 1px #0000000d;--shadow-xs:0 1px 2px 0 #0000000d;--shadow-sm:0 1px 3px 0 #0000001a,0 1px 2px -1px #0000001a;--shadow-md:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--shadow-lg:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--shadow-xl:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;--shadow-2xl:0 25px 50px -12px #00000040;--inset-shadow-2xs:inset 0 1px #0000000d;--inset-shadow-xs:inset 0 1px 1px #0000000d;--inset-shadow-sm:inset 0 2px 4px #0000000d;--drop-shadow-xs:0 1px 1px #0000000d;--drop-shadow-sm:0 1px 2px #00000026;--drop-shadow-md:0 3px 3px #0000001f;--drop-shadow-lg:0 4px 4px #00000026;--drop-shadow-xl:0 9px 7px #0000001a;--drop-shadow-2xl:0 25px 25px #00000026;--ease-in:cubic-bezier(.4,0,1,1);--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0,0,.2,1)infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--animate-bounce:bounce 1s infinite;--blur-xs:4px;--blur-sm:8px;--blur-md:12px;--blur-lg:16px;--blur-xl:24px;--blur-2xl:40px;--blur-3xl:64px;--perspective-dramatic:100px;--perspective-near:300px;--perspective-normal:500px;--perspective-midrange:800px;--perspective-distant:1200px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-font-feature-settings:var(--font-sans--font-feature-settings);--default-font-variation-settings:var(--font-sans--font-variation-settings);--default-mono-font-family:var(--font-mono);--default-mono-font-feature-settings:var(--font-mono--font-feature-settings);--default-mono-font-variation-settings:var(--font-mono--font-variation-settings)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}body{line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1;color:color-mix(in oklch,currentColor 50%,transparent)}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.collapse{visibility:collapse}.visible{visibility:visible}.\!relative{position:relative!important}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.isolate{isolation:isolate}.col-span-2{grid-column:span 2/span 2}.col-span-3{grid-column:span 3/span 3}.col-span-full{grid-column:1/-1}.\!container{width:100%!important}@media (width>=40rem){.\!container{max-width:40rem!important}}@media (width>=48rem){.\!container{max-width:48rem!important}}@media (width>=64rem){.\!container{max-width:64rem!important}}@media (width>=80rem){.\!container{max-width:80rem!important}}@media (width>=96rem){.\!container{max-width:96rem!important}}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-2{margin:calc(var(--spacing)*2)}.m-4{margin:calc(var(--spacing)*4)}.m-auto{margin:auto}.mr-2{margin-right:calc(var(--spacing)*2)}.-ml-3{margin-left:calc(var(--spacing)*-3)}.ml-2{margin-left:calc(var(--spacing)*2)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-flex{display:inline-flex}.table{display:table}.size-full{width:100%;height:100%}.h-1{height:calc(var(--spacing)*1)}.h-2{height:calc(var(--spacing)*2)}.min-h-12{min-height:calc(var(--spacing)*12)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.grow{flex-grow:1}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x)var(--tw-rotate-y)var(--tw-rotate-z)var(--tw-skew-x)var(--tw-skew-y)}.animate-pulse{animation:var(--animate-pulse)}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.items-center{align-items:center}.justify-center{justify-content:center}.justify-items-center{justify-items:center}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}.gap-y-4{row-gap:calc(var(--spacing)*4)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-amber-400{border-color:var(--color-amber-400)}.bg-amber-400{background-color:var(--color-amber-400)}.bg-transparent{background-color:#0000}.bg-gradient-to-r{--tw-gradient-position:to right in oklch,;background-image:linear-gradient(var(--tw-gradient-stops))}.from-zinc-950{--tw-gradient-from:var(--color-zinc-950);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position,)var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-zinc-800{--tw-gradient-to:var(--color-zinc-800);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position,)var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.p-1{padding:calc(var(--spacing)*1)}.p-8{padding:calc(var(--spacing)*8)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-4{padding-block:calc(var(--spacing)*4)}.pt-8{padding-top:calc(var(--spacing)*8)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pb-10{padding-bottom:calc(var(--spacing)*10)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-amber-400{color:var(--color-amber-400)}.text-slate-300{color:var(--color-slate-300)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.underline{text-decoration-line:underline}.decoration-amber-400{-webkit-text-decoration-color:var(--color-amber-400);text-decoration-color:var(--color-amber-400)}.decoration-wavy{text-decoration-style:wavy}.underline-offset-4{text-underline-offset:4px}.mix-blend-hard-light{mix-blend-mode:hard-light}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,-webkit-backdrop-filter,-webkit-backdrop-filter,backdrop-filter;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.\[animation-delay\:-0\.15s\]{animation-delay:-.15s}.\[animation-delay\:-0\.30s\]{animation-delay:-.3s}.\[animation-delay\:-0\.45s\]{animation-delay:-.45s}.\[animation-delay\:-0\.60s\]{animation-delay:-.6s}.\[animation-delay\:-0\.75s\]{animation-delay:-.75s}.\[animation-delay\:-0\.90s\]{animation-delay:-.9s}.\[animation-delay\:-1\.05s\]{animation-delay:-1.05s}.\[animation-delay\:-1\.20s\]{animation-delay:-1.2s}.\[animation-delay\:-1\.35s\]{animation-delay:-1.35s}.\[animation-delay\:-1\.50s\]{animation-delay:-1.5s}.\[animation-delay\:-1\.65s\]{animation-delay:-1.65s}.\[animation-delay\:-1\.80s\]{animation-delay:-1.8s}.\[animation-delay\:-1\.95s\]{animation-delay:-1.95s}.\[animation-delay\:-2\.10s\]{animation-delay:-2.1s}.\[animation-delay\:-2\.25s\]{animation-delay:-2.25s}.\[animation-delay\:-2\.40s\]{animation-delay:-2.4s}.\[animation-delay\:-2\.55s\]{animation-delay:-2.55s}.\[animation-delay\:-2\.70s\]{animation-delay:-2.7s}.\[animation-delay\:-2\.85s\]{animation-delay:-2.85s}.\[animation-delay\:-3\.00s\]{animation-delay:-3s}.\[animation-duration\:6s\]{animation-duration:6s}.outline-none{--tw-outline-style:none;outline-style:none}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:block{display:block}.sm\:hidden{display:none}.sm\:min-h-screen{min-height:100vh}.sm\:shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.sm\:shadow-black{--tw-shadow-color:var(--color-black)}}}@media (resolution>=200dpi){html{font-size:18px}.text-sm{font-size:.9rem}}::selection{background-color:var(--color-amber-400);color:var(--color-zinc-500)}@supports (-moz-orient:inline){@layer base{*,:before,:after,::backdrop{--tw-rotate-x:rotateX(0);--tw-rotate-y:rotateY(0);--tw-rotate-z:rotateZ(0);--tw-skew-x:skewX(0);--tw-skew-y:skewY(0);--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}@property --tw-rotate-x{syntax:"";inherits:false;initial-value:rotateX(0)}@property --tw-rotate-y{syntax:"";inherits:false;initial-value:rotateY(0)}@property --tw-rotate-z{syntax:"";inherits:false;initial-value:rotate(0)}@property --tw-skew-x{syntax:"";inherits:false;initial-value:skew(0deg)}@property --tw-skew-y{syntax:"";inherits:false;initial-value:skewY(0)}@property --tw-space-y-reverse{syntax:"";inherits:false;initial-value:0}@property --tw-border-style{syntax:"";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"|";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"|";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"|";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000} diff --git a/assets/main-CZ9daoBf.js b/assets/main-BYrhMSj6.js similarity index 99% rename from assets/main-CZ9daoBf.js rename to assets/main-BYrhMSj6.js index 86cde5d..09a0e6e 100644 --- a/assets/main-CZ9daoBf.js +++ b/assets/main-BYrhMSj6.js @@ -58,7 +58,7 @@ Error generating stack: `+r.message+` ${(r=this.origin.stack)===null||r===void 0?void 0:r.replace(/Error:.+?\n/,"")} `}}ya.CodecExecuteError=Ek;Object.defineProperty(Ia,"__esModule",{value:!0});Ia.assertBufferLength=Rk;Ia.assertHexDecimal=Bk;Ia.assertHexString=Dk;Ia.assertMinBufferLength=Lk;Ia.assertUtf8String=Mk;Ia.isObjectLike=Hk;Ia.trackCodeExecuteError=Pk;var u9=ya;const xk=48,Sk=57,Ik=65,Ck=70,Tk=97,Ok=102;function cT(t){if(!t||!t.startsWith("0x"))throw new Error("Invalid hex string, expect starts with 0x")}function uT(t){const e=t.length;for(let r=2;r=xk&&n<=Sk||n>=Tk&&n<=Ok||n>=Ik&&n<=Ck))throw new Error(`Invalid hex character ${t[r]} in the string ${t}`)}}function Bk(t,e){if(cT(t),t.length===2)throw new Error("Invalid hex decimal length, should be at least 1 character, the '0x' is incorrect, should be '0x0'");const r=t.length;if(typeof e=="number"&&r>e*2+2)throw new Error(`Invalid hex decimal length, should be less than ${e} bytes, got ${r/2-1} bytes`);uT(t)}function Dk(t,e){cT(t);const r=t.length;if(r%2)throw new Error("Invalid hex string length, must be even!");if(typeof e=="number"&&r!==e*2+2)throw new Error("Invalid hex string length, not match with byteLength!");uT(t)}function Mk(t){for(let e=0;e255)throw new Error("Invalid UTF-8 raw string!")}function Rk(t,e){if(t.byteLength!==e)throw new Error(`Invalid buffer length: ${t.byteLength}, should be ${e}`)}function Lk(t,e){if(t.byteLength255||!Number.isInteger(r))throw new Error("invalid ArrayLike, all elements must be 0-255")}return Uint8Array.from(t)}function Sp(t){if(t instanceof ArrayBuffer)return new Uint8Array(t);if(t instanceof Uint8Array)return Uint8Array.from(t);if(typeof t=="string")return Uk(t);if(Array.isArray(t))return kk(t);throw new Error(`Cannot convert ${t}`)}function zk(t,e){const r=Sp(t),n=Sp(e);return $k(r,n)}function $k(t,e){if(t.length!==e.length)return!1;for(let r=t.length;-1e.toString(16).padStart(2,"0"));function Fk(t){let e="";const r=Sp(t);for(let n=0;na+s.length,0),n=new Uint8Array(r);let i=0;return e.forEach(a=>{n.set(a,i),i+=a.length}),n}Object.defineProperty(Go,"__esModule",{value:!0});Go.createBytesCodec=dT;Go.createFixedBytesCodec=Yk;Go.isFixedCodec=Qk;var z3=Ia,Kk=Ca;function dT(t){return{pack:e=>t.pack(e),unpack:e=>t.unpack((0,Kk.bytify)(e))}}function Qk(t){return(0,z3.isObjectLike)(t)&&!!t.__isFixedCodec__}function Yk(t){const e=t.byteLength;return{__isFixedCodec__:!0,byteLength:e,...dT({pack:r=>{const n=t.pack(r);return(0,z3.assertBufferLength)(n,e),n},unpack:r=>((0,z3.assertBufferLength)(r,e),t.unpack(r))})}}var z4={},t0={};Object.defineProperty(t0,"__esModule",{value:!0});t0.createArrayCodec=Xk;t0.createNullableCodec=Gk;t0.createObjectCodec=Wk;t0.enhancePack=Zk;var $4=Ia,Vk=ya;function Gk(t){return{pack:e=>e==null?e:(0,$4.trackCodeExecuteError)(Vk.CODEC_OPTIONAL_PATH,()=>t.pack(e)),unpack:e=>e==null?e:t.unpack(e)}}function Wk(t){const e=Object.entries(t);return{pack:r=>{const n={};return e.forEach(([i,a])=>{Object.assign(n,{[i]:(0,$4.trackCodeExecuteError)(i,()=>a.pack(r[i]))})}),n},unpack:r=>{const n={};return e.forEach(([i,a])=>{Object.assign(n,{[i]:a.unpack(r[i])})}),n}}}function Xk(t){return{pack:e=>e.map((r,n)=>(0,$4.trackCodeExecuteError)(n,()=>t.pack(r))),unpack:e=>e.map(r=>t.unpack(r))}}function Zk(t,e,r){return{pack:n=>e(t.pack(n)),unpack:n=>t.unpack(r(n))}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createArrayCodec",{enumerable:!0,get:function(){return e.createArrayCodec}}),Object.defineProperty(t,"createNullableCodec",{enumerable:!0,get:function(){return e.createNullableCodec}}),Object.defineProperty(t,"createObjectCodec",{enumerable:!0,get:function(){return e.createObjectCodec}}),Object.defineProperty(t,"enhancePack",{enumerable:!0,get:function(){return e.enhancePack}});var e=t0})(z4);var r0={},zo={},wt={},hT={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(Fn,function(){var r=Math.imul,n=Math.clz32;function i(W){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(R){return typeof R}:function(R){return R&&typeof Symbol=="function"&&R.constructor===Symbol&&R!==Symbol.prototype?"symbol":typeof R},i(W)}function a(W,R){if(!(W instanceof R))throw new TypeError("Cannot call a class as a function")}function s(W,R){for(var _,I=0;I"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function p(){return p=l()?Reflect.construct:function(W,R,_){var I=[null];I.push.apply(I,R);var b=Function.bind.apply(W,I),v=new b;return _&&u(v,_.prototype),v},p.apply(null,arguments)}function y(W){return Function.toString.call(W).indexOf("[native code]")!==-1}function m(W){var R=typeof Map=="function"?new Map:void 0;return m=function(_){function I(){return p(_,arguments,c(this).constructor)}if(_===null||!y(_))return _;if(typeof _!="function")throw new TypeError("Super expression must either be null or a function");if(typeof R<"u"){if(R.has(_))return R.get(_);R.set(_,I)}return I.prototype=Object.create(_.prototype,{constructor:{value:I,enumerable:!1,writable:!0,configurable:!0}}),u(I,_)},m(W)}function A(W){if(W===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return W}function S(W,R){if(R&&(typeof R=="object"||typeof R=="function"))return R;if(R!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return A(W)}function w(W){var R=l();return function(){var _,I=c(W);if(R){var b=c(this).constructor;_=Reflect.construct(I,arguments,b)}else _=I.apply(this,arguments);return S(this,_)}}function C(W,R){return O(W)||M(W,R)||U(W,R)||Q()}function O(W){if(Array.isArray(W))return W}function M(W,R){var _=W==null?null:typeof Symbol<"u"&&W[Symbol.iterator]||W["@@iterator"];if(_!=null){var I,b,v=[],d=!0,g=!1;try{for(_=_.call(W);!(d=(I=_.next()).done)&&(v.push(I.value),!(R&&v.length===R));d=!0);}catch(x){g=!0,b=x}finally{try{d||_.return==null||_.return()}finally{if(g)throw b}}return v}}function U(W,R){if(W){if(typeof W=="string")return K(W,R);var _=Object.prototype.toString.call(W).slice(8,-1);return _==="Object"&&W.constructor&&(_=W.constructor.name),_==="Map"||_==="Set"?Array.from(W):_==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_)?K(W,R):void 0}}function K(W,R){(R==null||R>W.length)&&(R=W.length);for(var _=0,I=Array(R);_=W.length?{done:!0}:{done:!1,value:W[I++]}},e:function(x){throw x},f:b}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var v,d=!0,g=!1;return{s:function(){_=_.call(W)},n:function(){var x=_.next();return d=x.done,x},e:function(x){g=!0,v=x},f:function(){try{d||_.return==null||_.return()}finally{if(g)throw v}}}}var G=function(W){var R=Math.abs,_=Math.max,I=Math.floor;function b(d,g){var x;if(a(this,b),x=v.call(this,d),x.sign=g,Object.setPrototypeOf(A(x),b.prototype),d>b.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return x}f(b,W);var v=w(b);return o(b,[{key:"toDebugString",value:function(){var d,g=["BigInt["],x=k(this);try{for(x.s();!(d=x.n()).done;){var E=d.value;g.push((E&&(E>>>0).toString(16))+", ")}}catch(h){x.e(h)}finally{x.f()}return g.push("]"),g.join("")}},{key:"toString",value:function(){var d=0d||36this.length&&(x=this.length);for(var E=32767&d,h=d>>>15,T=0,$=g,L=0;L>>15,q=b.__imul(F,E),X=b.__imul(F,h),te=b.__imul(H,E),ne=b.__imul(H,h),N=$+q+T;T=N>>>30,N&=1073741823,N+=((32767&X)<<15)+((32767&te)<<15),T+=N>>>30,$=ne+(X>>>15)+(te>>>15),this.__setDigit(L,1073741823&N)}if(T!==0||$!==0)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(d,g,x){for(var E,h=0,T=0;T>>15,this.__setHalfDigit(g+T,32767&E);return h}},{key:"__inplaceSub",value:function(d,g,x){var E=0;if(1&g){g>>=1;for(var h=this.__digit(g),T=32767&h,$=0;$>>1;$++){var L=d.__digit($),j=(h>>>15)-(32767&L)-E;E=1&j>>>15,this.__setDigit(g+$,(32767&j)<<15|32767&T),h=this.__digit(g+$+1),T=(32767&h)-(L>>>15)-E,E=1&T>>>15}var F=d.__digit($),H=(h>>>15)-(32767&F)-E;if(E=1&H>>>15,this.__setDigit(g+$,(32767&H)<<15|32767&T),g+$+1>=this.length)throw new RangeError("out of bounds");!(1&x)&&(h=this.__digit(g+$+1),T=(32767&h)-(F>>>15)-E,E=1&T>>>15,this.__setDigit(g+d.length,1073709056&h|32767&T))}else{g>>=1;for(var q=0;q>>15;var N=(X>>>15)-(te>>>15)-E;E=1&N>>>15,this.__setDigit(g+q,(32767&N)<<15|32767&ne)}var P=this.__digit(g+q),re=d.__digit(q),ue=(32767&P)-(32767&re)-E;E=1&ue>>>15;var de=0;!(1&x)&&(de=(P>>>15)-(re>>>15)-E,E=1&de>>>15),this.__setDigit(g+q,(32767&de)<<15|32767&ue)}return E}},{key:"__inplaceRightShift",value:function(d){if(d!==0){for(var g,x=this.__digit(0)>>>d,E=this.length-1,h=0;h>>d;this.__setDigit(E,x)}}},{key:"__digit",value:function(d){return this[d]}},{key:"__unsignedDigit",value:function(d){return this[d]>>>0}},{key:"__setDigit",value:function(d,g){this[d]=0|g}},{key:"__setDigitGrow",value:function(d,g){this[d]=0|g}},{key:"__halfDigitLength",value:function(){var d=this.length;return 32767>=this.__unsignedDigit(d-1)?2*d-1:2*d}},{key:"__halfDigit",value:function(d){return 32767&this[d>>>1]>>>15*(1&d)}},{key:"__setHalfDigit",value:function(d,g){var x=d>>>1,E=this.__digit(x),h=1&d?32767&E|g<<15:1073709056&E|32767&g;this.__setDigit(x,h)}}],[{key:"BigInt",value:function(d){var g=Number.isFinite;if(typeof d=="number"){if(d===0)return b.__zero();if(b.__isOneDigitInt(d))return 0>d?b.__oneDigit(-d,!0):b.__oneDigit(d,!1);if(!g(d)||I(d)!==d)throw new RangeError("The number "+d+" cannot be converted to BigInt because it is not an integer");return b.__fromDouble(d)}if(typeof d=="string"){var x=b.__fromString(d);if(x===null)throw new SyntaxError("Cannot convert "+d+" to a BigInt");return x}if(typeof d=="boolean")return d===!0?b.__oneDigit(1,!1):b.__zero();if(i(d)==="object"){if(d.constructor===b)return d;var E=b.__toPrimitive(d);return b.BigInt(E)}throw new TypeError("Cannot convert "+d+" to a BigInt")}},{key:"toNumber",value:function(d){var g=d.length;if(g===0)return 0;if(g===1){var x=d.__unsignedDigit(0);return d.sign?-x:x}var E=d.__digit(g-1),h=b.__clz30(E),T=30*g-h;if(1024>>=12;var q=F-12,X=12<=F?0:L<<20+F,te=20+F;for(0>>30-q,X=L<>>30-te,te-=30;var ne=b.__decideRounding(d,te,j,L);if((ne===1||ne===0&&(1&X)==1)&&(X=X+1>>>0,X===0&&(H++,H>>>20!=0&&(H=0,$++,1023<$))))return d.sign?-1/0:1/0;var N=d.sign?-2147483648:0;return $=$+1023<<20,b.__kBitConversionInts[1]=N|$|H,b.__kBitConversionInts[0]=X,b.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(d){if(d.length===0)return d;var g=d.__copy();return g.sign=!d.sign,g}},{key:"bitwiseNot",value:function(d){return d.sign?b.__absoluteSubOne(d).__trim():b.__absoluteAddOne(d,!0)}},{key:"exponentiate",value:function(d,g){if(g.sign)throw new RangeError("Exponent must be positive");if(g.length===0)return b.__oneDigit(1,!1);if(d.length===0)return d;if(d.length===1&&d.__digit(0)===1)return d.sign&&!(1&g.__digit(0))?b.unaryMinus(d):d;if(1=b.__kMaxLengthBits)throw new RangeError("BigInt too big");if(d.length===1&&d.__digit(0)===2){var E=1+(0|x/30),h=d.sign&&(1&x)!=0,T=new b(E,h);T.__initializeDigits();var $=1<>=1;x!==0;x>>=1)j=b.multiply(j,j),1&x&&(L===null?L=j:L=b.multiply(L,j));return L}},{key:"multiply",value:function(d,g){if(d.length===0)return d;if(g.length===0)return g;var x=d.length+g.length;30<=d.__clzmsd()+g.__clzmsd()&&x--;var E=new b(x,d.sign!==g.sign);E.__initializeDigits();for(var h=0;hb.__absoluteCompare(d,g))return b.__zero();var x,E=d.sign!==g.sign,h=g.__unsignedDigit(0);if(g.length===1&&32767>=h){if(h===1)return E===d.sign?d:b.unaryMinus(d);x=b.__absoluteDivSmall(d,h,null)}else x=b.__absoluteDivLarge(d,g,!0,!1);return x.sign=E,x.__trim()}},{key:"remainder",value:function(g,x){if(x.length===0)throw new RangeError("Division by zero");if(0>b.__absoluteCompare(g,x))return g;var E=x.__unsignedDigit(0);if(x.length===1&&32767>=E){if(E===1)return b.__zero();var h=b.__absoluteModSmall(g,E);return h===0?b.__zero():b.__oneDigit(h,g.sign)}var T=b.__absoluteDivLarge(g,x,!1,!0);return T.sign=g.sign,T.__trim()}},{key:"add",value:function(d,g){var x=d.sign;return x===g.sign?b.__absoluteAdd(d,g,x):0<=b.__absoluteCompare(d,g)?b.__absoluteSub(d,g,x):b.__absoluteSub(g,d,!x)}},{key:"subtract",value:function(d,g){var x=d.sign;return x===g.sign?0<=b.__absoluteCompare(d,g)?b.__absoluteSub(d,g,x):b.__absoluteSub(g,d,!x):b.__absoluteAdd(d,g,x)}},{key:"leftShift",value:function(d,g){return g.length===0||d.length===0?d:g.sign?b.__rightShiftByAbsolute(d,g):b.__leftShiftByAbsolute(d,g)}},{key:"signedRightShift",value:function(d,g){return g.length===0||d.length===0?d:g.sign?b.__leftShiftByAbsolute(d,g):b.__rightShiftByAbsolute(d,g)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(d,g){return 0>b.__compareToBigInt(d,g)}},{key:"lessThanOrEqual",value:function(d,g){return 0>=b.__compareToBigInt(d,g)}},{key:"greaterThan",value:function(d,g){return 0d)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(d===0)return b.__zero();if(d>=b.__kMaxLengthBits)return g;var x=0|(d+29)/30;if(g.lengthd)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(d===0)return b.__zero();if(g.sign){if(d>b.__kMaxLengthBits)throw new RangeError("BigInt too big");return b.__truncateAndSubFromPowerOfTwo(d,g,!1)}if(d>=b.__kMaxLengthBits)return g;var x=0|(d+29)/30;if(g.length>>E))return g}return b.__truncateToNBits(d,g)}},{key:"ADD",value:function(d,g){if(d=b.__toPrimitive(d),g=b.__toPrimitive(g),typeof d=="string")return typeof g!="string"&&(g=g.toString()),d+g;if(typeof g=="string")return d.toString()+g;if(d=b.__toNumeric(d),g=b.__toNumeric(g),b.__isBigInt(d)&&b.__isBigInt(g))return b.add(d,g);if(typeof d=="number"&&typeof g=="number")return d+g;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(d,g){return b.__compare(d,g,0)}},{key:"LE",value:function(d,g){return b.__compare(d,g,1)}},{key:"GT",value:function(d,g){return b.__compare(d,g,2)}},{key:"GE",value:function(d,g){return b.__compare(d,g,3)}},{key:"EQ",value:function(d,g){for(;;){if(b.__isBigInt(d))return b.__isBigInt(g)?b.equal(d,g):b.EQ(g,d);if(typeof d=="number"){if(b.__isBigInt(g))return b.__equalToNumber(g,d);if(i(g)!=="object")return d==g;g=b.__toPrimitive(g)}else if(typeof d=="string"){if(b.__isBigInt(g))return d=b.__fromString(d),d!==null&&b.equal(d,g);if(i(g)!=="object")return d==g;g=b.__toPrimitive(g)}else if(typeof d=="boolean"){if(b.__isBigInt(g))return b.__equalToNumber(g,+d);if(i(g)!=="object")return d==g;g=b.__toPrimitive(g)}else if(i(d)==="symbol"){if(b.__isBigInt(g))return!1;if(i(g)!=="object")return d==g;g=b.__toPrimitive(g)}else if(i(d)==="object"){if(i(g)==="object"&&g.constructor!==b)return d==g;d=b.__toPrimitive(d)}else return d==g}}},{key:"NE",value:function(d,g){return!b.EQ(d,g)}},{key:"DataViewGetBigInt64",value:function(d,g){var x=2>>30),F.__setDigit(2,L>>>28),F.__trim()}},{key:"DataViewSetBigInt64",value:function(d,g,x){var E=3>>2,2g)h=-g-1;else{if(x===0)return-1;x--,E=d.__digit(x),h=29}var T=1<>>20,E=x-1023,h=(0|E/30)+1,T=new b(h,0>d),$=1048575&b.__kBitConversionInts[1]|1048576,L=b.__kBitConversionInts[0],j=20,F=E%30,H=0;if(F>>q,$=$<<32-q|L>>>q,L<<=32-q}else if(F===j)H=32,g=$,$=L,L=0;else{var X=F-j;H=32-X,g=$<>>32-X,$=L<>>2,$=$<<30|L>>>2,L<<=30):g=0,T.__setDigit(te,g);return T.__trim()}},{key:"__isWhitespace",value:function(d){return 13>=d&&9<=d||(159>=d?d==32:131071>=d?d==160||d==5760:196607>=d?(d&=131071,10>=d||d==40||d==41||d==47||d==95||d==4096):d==65279)}},{key:"__fromString",value:function(d){var g=11073741824/L)return null;var F=L*$+j>>>b.__kBitsPerCharTableShift,H=new b(0|(F+29)/30,!1),q=10>g?g:10,X=10>>0>>0>>b.__kBitsPerCharTableShift)/30;H.__inplaceMultiplyAdd(ce,ie,ge)}while(!de)}else{L>>=b.__kBitsPerCharTableShift;var te=[],ne=[],N=!1;do{for(var P,re=0,ue=0;;){if(P=void 0,T-48>>>0>>0>>j-T)}if(h!==0){if(E>=d.length)throw new Error("implementation bug");d.__setDigit(E++,h)}for(;E>>1)+(85&E),E=(51&E>>>2)+(51&E),E=(15&E>>>4)+(15&E);var h=E,T=g-1,$=d.__digit(x-1),L=b.__clz30($),j=0|(30*x-L+h-1)/h;if(d.sign&&j++,268435456>>P,X=30-P;X>=h;)F[H--]=b.__kConversionChars[q&T],q>>>=h,X-=h}var re=(q|$<>>h-X;q!==0;)F[H--]=b.__kConversionChars[q&T],q>>>=h;if(d.sign&&(F[H--]="-"),H!==-1)throw new Error("implementation bug");return F.join("")}},{key:"__toStringGeneric",value:function(d,g,x){var E=d.length;if(E===0)return"";if(E===1){var h=d.__unsignedDigit(0).toString(g);return x===!1&&d.sign&&(h="-"+h),h}var T=30*E-b.__clz30(d.__digit(E-1)),$=b.__kMaxBitsPerChar[g],L=$-1,j=T*b.__kBitsPerCharTableMultiplier;j+=L-1,j=0|j/L;var F,H,q=j+1>>1,X=b.exponentiate(b.__oneDigit(g,!1),b.__oneDigit(q,!1)),te=X.__unsignedDigit(0);if(X.length===1&&32767>=te){F=new b(d.length,!1),F.__initializeDigits();for(var ne,N=0,P=2*d.length-1;0<=P;P--)ne=N<<15|d.__halfDigit(P),F.__setHalfDigit(P,0|ne/te),N=0|ne%te;H=N.toString(g)}else{var re=b.__absoluteDivLarge(d,X,!0,!0);F=re.quotient;var ue=re.remainder.__trim();H=b.__toStringGeneric(ue,g,!0)}F.__trim();for(var de=b.__toStringGeneric(F,g,!0);H.lengthE?b.__absoluteLess(x):0}},{key:"__compareToNumber",value:function(d,g){if(b.__isOneDigitInt(g)){var x=d.sign,E=0>g;if(x!==E)return b.__unequalSign(x);if(d.length===0){if(E)throw new Error("implementation bug");return g===0?0:-1}if(1h?b.__absoluteGreater(x):Tg)return b.__unequalSign(x);if(g===0)throw new Error("implementation bug: should be handled elsewhere");if(d.length===0)return-1;b.__kBitConversionDouble[0]=g;var E=2047&b.__kBitConversionInts[1]>>>20;if(E==2047)throw new Error("implementation bug: handled elsewhere");var h=E-1023;if(0>h)return b.__absoluteGreater(x);var T=d.length,$=d.__digit(T-1),L=b.__clz30($),j=30*T-L,F=h+1;if(jF)return b.__absoluteGreater(x);var H=1048576|1048575&b.__kBitConversionInts[1],q=b.__kBitConversionInts[0],X=20,te=29-L;if(te!==(0|(j-1)%30))throw new Error("implementation bug");var ne,N=0;if(te>>P,H=H<<32-P|q>>>P,q<<=32-P}else if(te===X)N=32,ne=H,H=q,q=0;else{var re=te-X;N=32-re,ne=H<>>32-re,H=q<>>=0,ne>>>=0,$>ne)return b.__absoluteGreater(x);if($>>2,H=H<<30|q>>>2,q<<=30):ne=0;var de=d.__unsignedDigit(ue);if(de>ne)return b.__absoluteGreater(x);if(deg&&d.__unsignedDigit(0)===R(g):b.__compareToDouble(d,g)===0}},{key:"__comparisonResultToBool",value:function(d,g){return g===0?0>d:g===1?0>=d:g===2?0g;case 3:return d>=g}if(b.__isBigInt(d)&&typeof g=="string")return g=b.__fromString(g),g!==null&&b.__comparisonResultToBool(b.__compareToBigInt(d,g),x);if(typeof d=="string"&&b.__isBigInt(g))return d=b.__fromString(d),d!==null&&b.__comparisonResultToBool(b.__compareToBigInt(d,g),x);if(d=b.__toNumeric(d),g=b.__toNumeric(g),b.__isBigInt(d)){if(b.__isBigInt(g))return b.__comparisonResultToBool(b.__compareToBigInt(d,g),x);if(typeof g!="number")throw new Error("implementation bug");return b.__comparisonResultToBool(b.__compareToNumber(d,g),x)}if(typeof d!="number")throw new Error("implementation bug");if(b.__isBigInt(g))return b.__comparisonResultToBool(b.__compareToNumber(g,d),2^x);if(typeof g!="number")throw new Error("implementation bug");return x===0?dg:x===3?d>=g:void 0}},{key:"__absoluteAdd",value:function(d,g,x){if(d.length>>30,T.__setDigit(L,1073741823&h);for(;L>>30,T.__setDigit(L,1073741823&j)}return L>>30,h.__setDigit($,1073741823&E);for(;$>>30,h.__setDigit($,1073741823&L)}return h.__trim()}},{key:"__absoluteAddOne",value:function(d,g){var x=2>>30,x.__setDigit($,1073741823&h);return T!==0&&x.__setDigitGrow(E,1),x}},{key:"__absoluteSubOne",value:function(d,g){var x=d.length;g=g||x;for(var E,h=new b(g,!1),T=1,$=0;$>>30,h.__setDigit($,1073741823&E);if(T!==0)throw new Error("implementation bug");for(var L=x;LE?0:d.__unsignedDigit(E)>g.__unsignedDigit(E)?1:-1}},{key:"__multiplyAccumulate",value:function(d,g,x,E){if(g!==0){for(var h=32767&g,T=g>>>15,$=0,L=0,j=0;j>>15,te=b.__imul(q,h),ne=b.__imul(q,T),N=b.__imul(X,h),P=b.__imul(X,T);F+=L+te+$,$=F>>>30,F&=1073741823,F+=((32767&ne)<<15)+((32767&N)<<15),$+=F>>>30,L=P+(ne>>>15)+(N>>>15),x.__setDigit(E,1073741823&F)}for(;$!==0||L!==0;E++){var re=x.__digit(E);re+=$+L,L=0,$=re>>>30,x.__setDigit(E,1073741823&re)}}}},{key:"__internalMultiplyAdd",value:function(d,g,x,E,h){for(var T=x,$=0,L=0;L>>15,g),q=F+((32767&H)<<15)+$+T;T=q>>>30,$=H>>>15,h.__setDigit(L,1073741823&q)}if(h.length>E)for(h.__setDigit(E++,T+$);E>>0,$=0|T/g;E=0|T%g,T=(E<<15|d.__halfDigit(h-1))>>>0;var L=0|T/g;E=0|T%g,x.__setDigit(h>>>1,$<<15|L)}return x}},{key:"__absoluteModSmall",value:function(d,g){for(var x,E=0,h=2*d.length-1;0<=h;h--)x=(E<<15|d.__halfDigit(h))>>>0,E=0|x%g;return E}},{key:"__absoluteDivLarge",value:function(d,g,x,E){var h=g.__halfDigitLength(),T=g.length,$=d.__halfDigitLength()-h,L=null;x&&(L=new b($+2>>>1,!1),L.__initializeDigits());var j=new b(h+2>>>1,!1);j.__initializeDigits();var F=b.__clz15(g.__halfDigit(h-1));0>>0;ne=0|P/q;for(var re=0|P%q,ue=g.__halfDigit(h-2),de=H.__halfDigit(te+h-2);b.__imul(ne,ue)>>>0>(re<<16|de)>>>0&&(ne--,re+=q,!(32767>>1,X|ne))}if(E)return H.__inplaceRightShift(F),x?{quotient:L,remainder:H}:H;if(x)return L;throw new Error("unreachable")}},{key:"__clz15",value:function(d){return b.__clz30(d)-15}},{key:"__specialLeftShift",value:function(d,g,x){var E=d.length,h=new b(E+x,!1);if(g===0){for(var T=0;T>>30-g;return 0x)throw new RangeError("BigInt too big");var E=0|x/30,h=x%30,T=d.length,$=h!==0&&d.__digit(T-1)>>>30-h!=0,L=T+E+($?1:0),j=new b(L,d.sign);if(h===0){for(var F=0;F>>30-h;if($)j.__setDigit(T+E,H);else if(H!==0)throw new Error("implementation bug")}return j.__trim()}},{key:"__rightShiftByAbsolute",value:function(d,g){var x=d.length,E=d.sign,h=b.__toShiftAmount(g);if(0>h)return b.__rightShiftByMaximum(E);var T=0|h/30,$=h%30,L=x-T;if(0>=L)return b.__rightShiftByMaximum(E);var j=!1;if(E){if(d.__digit(T)&(1<<$)-1)j=!0;else for(var F=0;F>>$,N=x-T-1,P=0;P>>$;q.__setDigit(N,ne)}return j&&(q=b.__absoluteAddOne(q,!0,q)),q.__trim()}},{key:"__rightShiftByMaximum",value:function(d){return d?b.__oneDigit(1,!0):b.__zero()}},{key:"__toShiftAmount",value:function(d){if(1b.__kMaxLengthBits?-1:g}},{key:"__toPrimitive",value:function(d){var g=1>>L}return E.__setDigit(h,$),E.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(d,g,x){for(var E=Math.min,h,T=0|(d+29)/30,$=new b(T,x),L=0,j=T-1,F=0,H=E(j,g.length);L>>30,$.__setDigit(L,1073741823&h);for(;L>>ne;var N=1<<32-ne;q=N-X-F,q&=N-1}return $.__setDigit(j,q),$.__trim()}},{key:"__digitPow",value:function(d,g){for(var x=1;0>>=1,d*=d;return x}},{key:"__isOneDigitInt",value:function(d){return(1073741823&d)===d}}]),b}(m(Array));return G.__kMaxLength=33554432,G.__kMaxLengthBits=G.__kMaxLength<<5,G.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],G.__kBitsPerCharTableShift=5,G.__kBitsPerCharTableMultiplier=1<>>0)/R)},G.__imul=r||function(W,R){return 0|W*R},G})})(hT);var Jk=hT.exports;Object.defineProperty(wt,"__esModule",{value:!0});wt.ckbDecimals=wt.BI=void 0;wt.formatUnit=nz;wt.isBIish=pT;wt.parseUnit=iz;wt.toJSBI=dt;var Xe=ez(Jk);function ez(t){return t&&t.__esModule?t:{default:t}}function pT(t){return t!==null&&(typeof t=="number"&&t%1===0||typeof t=="string"&&(!!t.match(/^0x(0|[0-9a-fA-F]+)$/)||!!t.match(/^-?[0-9]+$/))||typeof t=="bigint"||$o.isBI(t))}class $o{constructor(e){this.jsbi=e,this._isBI=!0}add(e){return Or(Xe.default.add(this.jsbi,dt(e)))}sub(e){return Or(Xe.default.subtract(this.jsbi,dt(e)))}div(e){return Or(Xe.default.divide(this.jsbi,dt(e)))}mul(e){return Or(Xe.default.multiply(this.jsbi,dt(e)))}mod(e){return Or(Xe.default.remainder(this.jsbi,dt(e)))}abs(){return Xe.default.greaterThanOrEqual(this.jsbi,dt(0))?Or(this.jsbi):Or(Xe.default.unaryMinus(this.jsbi))}pow(e){return Or(Xe.default.exponentiate(this.jsbi,dt(e)))}and(e){return Or(Xe.default.bitwiseAnd(this.jsbi,dt(e)))}or(e){return Or(Xe.default.bitwiseOr(this.jsbi,dt(e)))}xor(e){return Or(Xe.default.bitwiseXor(this.jsbi,dt(e)))}not(){return Or(Xe.default.bitwiseNot(this.jsbi))}mask(e){const r=dt(e);if(Xe.default.lessThan(r,dt(0))||Xe.default.lessThan(this.jsbi,dt(0)))throw new Error("mask works only with positive numbers");const n=dt(this.jsbi.toString(2).length);if(Xe.default.lessThanOrEqual(n,r))return Or(this.jsbi);{const i=Xe.default.leftShift(Xe.default.signedRightShift(this.jsbi,r),r);return Or(Xe.default.bitwiseXor(this.jsbi,i))}}shl(e){return Or(Xe.default.leftShift(this.jsbi,dt(e)))}shr(e){return Or(Xe.default.signedRightShift(this.jsbi,dt(e)))}eq(e){return Xe.default.equal(this.jsbi,dt(e))}lt(e){return Xe.default.lessThan(this.jsbi,dt(e))}lte(e){return Xe.default.lessThanOrEqual(this.jsbi,dt(e))}gt(e){return Xe.default.greaterThan(this.jsbi,dt(e))}gte(e){return Xe.default.greaterThanOrEqual(this.jsbi,dt(e))}isNegative(){return Xe.default.lessThan(this.jsbi,dt(0))}isZero(){return Xe.default.equal(this.jsbi,dt(0))}toNumber(){return Xe.default.toNumber(this.jsbi)}toBigInt(){try{return BigInt(this.jsbi.toString(10))}catch{throw new Error("this platform does not support BigInt")}}toString(e){return e=e||10,this.jsbi.toString(e)}toHexString(){return Xe.default.lessThan(this.jsbi,dt(0))?"-0x"+Xe.default.unaryMinus(this.jsbi).toString(16):"0x"+this.jsbi.toString(16)}static from(e){if(e instanceof $o)return e;if(pT(e))return Or(dt(e));if(e instanceof Xe.default)return Or(dt(e.toString()));throw new Error(`invalid type: ${e} can't be converted into BI`)}static isBI(e){return tz(e)&&!!e._isBI}}wt.BI=$o;function tz(t){return t==null?!1:typeof t=="object"}function Or(t){return new $o(t)}function dt(t){return typeof t=="number"||typeof t=="string"?Xe.default.BigInt(t):Xe.default.BigInt(t.toString())}const g9=["shannon","ckb"],rz=wt.ckbDecimals=8,bT=$o.from(-1);function nz(t,e){const r=gT(e);return az(t,r)}function iz(t,e){const r=gT(e);return sz(t,r)}function az(t,e){if(!j4(e))throw new Error("decimal size must be a non-negative integer");const r="1"+Array(e).fill("0").join("");t=$o.from(t);const n=t.isNegative();n&&(t=t.mul(bT));let a=t.div(r).toString();if(r.length>1){let s=t.mod(r).toString();for(;s.length0&&i[0]==="0";)i=i.substring(1);for(i===""&&(i="0");a.length>0&&a[a.length-1]==="0";)a=a.substring(0,a.length-1);if(a.length>r.length-1)throw new Error("decimal part exceeds max decimals");for(a===""&&(a="0");a.length=0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BI",{enumerable:!0,get:function(){return e.BI}}),Object.defineProperty(t,"BIish",{enumerable:!0,get:function(){return e.BIish}}),t.Uint8=t.Uint64LE=t.Uint64BE=t.Uint64=t.Uint512LE=t.Uint512BE=t.Uint512=t.Uint32LE=t.Uint32BE=t.Uint32=t.Uint256LE=t.Uint256BE=t.Uint256=t.Uint16LE=t.Uint16BE=t.Uint16=t.Uint128LE=t.Uint128BE=t.Uint128=void 0;var e=wt,r=Go,n=ya;function i(y,m,A,S){if(y=e.BI.from(y),y.lt(m)||y.gt(A))throw new n.CodecBaseParseError(`Value must be between ${m.toString()} and ${A.toString()}, but got ${y.toString()}`,S)}function a(y,m=!1){const A=s(y,m);return{__isFixedCodec__:!0,byteLength:y,pack:S=>A.pack(S),unpack:S=>A.unpack(S).toNumber()}}const s=(y,m=!1)=>{const A=e.BI.from(1).shl(y*8).sub(1);return(0,r.createFixedBytesCodec)({byteLength:y,pack(S){let w=m?"LE":"BE";y<=1&&(w="");const C=`Uint${y*8}${w}`;if(typeof S=="number"&&!Number.isSafeInteger(S))throw new n.CodecBaseParseError(`${S} is not a safe integer`,C);let O=e.BI.from(S);i(O,0,A,C);const M=new DataView(new ArrayBuffer(y));for(let U=0;U{const w=new DataView(Uint8Array.from(S).buffer);let C=e.BI.from(0);for(let O=0;Ot.pack(r),unpack:r=>t.unpack(r)})}function fz(t){return vT({...t,byteLength:1})}function cz(t){return(0,yT.createBytesCodec)({pack(e){const r=t.pack(e),n=v9.Uint32LE.pack(r.byteLength);return(0,oz.concat)(n,r)},unpack(e){(0,y9.assertMinBufferLength)(e,4);const r=v9.Uint32LE.unpack(e.slice(0,4));return(0,y9.assertBufferLength)(e.slice(4),r),t.unpack(e.slice(4))}})}var Ys={};Object.defineProperty(Ys,"__esModule",{value:!0});Ys.array=_T;Ys.dynvec=wT;Ys.fixvec=mT;Ys.option=pz;Ys.struct=uz;Ys.table=dz;Ys.union=hz;Ys.vector=lz;var yc=Go,Si=r0,ts=Ca,_9=ya,n0=z4;function _T(t,e){const r=(0,n0.createArrayCodec)(t);return(0,yc.createFixedBytesCodec)({byteLength:t.byteLength*e,pack(n){const i=r.pack(n);return(0,ts.concat)(...i)},unpack(n){const i=[],a=t.byteLength;for(let s=0;s!e.includes(r))}function F4(t,e){const r=Object.keys(t),n=m9(r,e),i=m9(e,r);if(n.length>0||i.length>0)throw new Error(`Invalid shape: missing fields ${n.join(", ")} or shape ${i.join(", ")}`)}function uz(t,e){F4(t,e);const r=(0,n0.createObjectCodec)(t);return(0,yc.createFixedBytesCodec)({byteLength:e.reduce((n,i)=>n+t[i].byteLength,0),pack(n){const i=r.pack(n);return e.reduce((a,s)=>(0,ts.concat)(a,i[s]),Uint8Array.from([]))},unpack(n){const i={};let a=0;return e.forEach(s=>{const o=t[s],f=n.slice(a,a+o.byteLength);Object.assign(i,{[s]:o.unpack(f)}),a=a+o.byteLength}),i}})}function mT(t){return(0,yc.createBytesCodec)({pack(e){const r=(0,n0.createArrayCodec)(t);return(0,ts.concat)(Si.Uint32LE.pack(e.length),r.pack(e).reduce((n,i)=>(0,ts.concat)(n,i),new ArrayBuffer(0)))},unpack(e){if(e.byteLength<4)throw new Error(`fixvec: buffer is too short, expected at least 4 bytes, got ${e.byteLength}`);const r=Si.Uint32LE.unpack(e.slice(0,4));return _T(t,r).unpack(e.slice(4))}})}function wT(t){return(0,yc.createBytesCodec)({pack(e){const n=(0,n0.createArrayCodec)(t).pack(e).reduce((a,s)=>{const o=Si.Uint32LE.pack(a.offset);return{header:(0,ts.concat)(a.header,o),body:(0,ts.concat)(a.body,s),offset:a.offset+s.byteLength}},{header:new ArrayBuffer(0),body:new ArrayBuffer(0),offset:4+e.length*4}),i=Si.Uint32LE.pack(n.header.byteLength+n.body.byteLength+4);return(0,ts.concat)(i,n.header,n.body)},unpack(e){const r=Si.Uint32LE.unpack(e.slice(0,4));if(r!==e.byteLength)throw new Error(`Invalid buffer size, read from header: ${r}, actual: ${e.byteLength}`);const n=[];if(r<=4)return n;{const a=(Si.Uint32LE.unpack(e.slice(4,8))-4)/4,s=new Array(a).fill(1).map((f,c)=>Si.Uint32LE.unpack(e.slice(4+c*4,8+c*4)));s.push(r);const o=[];for(let f=0;f{const u=a[c],l=Si.Uint32LE.pack(f.offset);return{header:(0,ts.concat)(f.header,l),body:(0,ts.concat)(f.body,u),offset:f.offset+u.byteLength}},{header:new ArrayBuffer(0),body:new ArrayBuffer(0),offset:n}),o=Si.Uint32LE.pack(s.header.byteLength+s.body.byteLength+4);return(0,ts.concat)(o,s.header,s.body)},unpack(r){const n=Si.Uint32LE.unpack(r.slice(0,4));if(n!==r.byteLength)throw new Error(`Invalid buffer size, read from header: ${n}, actual: ${r.byteLength}`);if(n<=4||e.length===0)return{};{const i=e.map((s,o)=>Si.Uint32LE.unpack(r.slice(4+o*4,8+o*4)));i.push(n);const a={};for(let s=0;s{if(Array.isArray(e))return e[n];const a=Object.entries(e).find(([,s])=>s===n);return a==null?void 0:a[0]})();if(!i)throw new Error(`Unknown union field id: ${n}, only ${e} are allowed`);return{type:i,value:t[i].unpack(r.slice(4))}}})}function pz(t){return(0,yc.createBytesCodec)({pack(e){const r=(0,n0.createNullableCodec)(t);return e!=null?r.pack(e):Uint8Array.from([])},unpack(e){if(e.byteLength!==0)return t.unpack(e)}})}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"array",{enumerable:!0,get:function(){return r.array}}),Object.defineProperty(t,"byteArrayOf",{enumerable:!0,get:function(){return e.byteArrayOf}}),Object.defineProperty(t,"byteOf",{enumerable:!0,get:function(){return e.byteOf}}),Object.defineProperty(t,"byteVecOf",{enumerable:!0,get:function(){return e.byteVecOf}}),Object.defineProperty(t,"option",{enumerable:!0,get:function(){return r.option}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return r.struct}}),Object.defineProperty(t,"table",{enumerable:!0,get:function(){return r.table}}),Object.defineProperty(t,"union",{enumerable:!0,get:function(){return r.union}}),Object.defineProperty(t,"vector",{enumerable:!0,get:function(){return r.vector}});var e=u1,r=Ys})(c1);(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e={createBytesCodec:!0,createFixedBytesCodec:!0,isFixedCodec:!0,bytes:!0,number:!0,molecule:!0};t.bytes=void 0,Object.defineProperty(t,"createBytesCodec",{enumerable:!0,get:function(){return r.createBytesCodec}}),Object.defineProperty(t,"createFixedBytesCodec",{enumerable:!0,get:function(){return r.createFixedBytesCodec}}),Object.defineProperty(t,"isFixedCodec",{enumerable:!0,get:function(){return r.isFixedCodec}}),t.number=t.molecule=void 0;var r=Go,n=z4;Object.keys(n).forEach(function(c){c==="default"||c==="__esModule"||Object.prototype.hasOwnProperty.call(e,c)||c in t&&t[c]===n[c]||Object.defineProperty(t,c,{enumerable:!0,get:function(){return n[c]}})});var i=f(Ca);t.bytes=i;var a=f(r0);t.number=a;var s=f(c1);t.molecule=s;function o(c){if(typeof WeakMap!="function")return null;var u=new WeakMap,l=new WeakMap;return(o=function(p){return p?l:u})(c)}function f(c,u){if(c&&c.__esModule)return c;if(c===null||typeof c!="object"&&typeof c!="function")return{default:c};var l=o(u);if(l&&l.has(c))return l.get(c);var p={__proto__:null},y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var m in c)if(m!=="default"&&{}.hasOwnProperty.call(c,m)){var A=y?Object.getOwnPropertyDescriptor(c,m):null;A&&(A.get||A.set)?Object.defineProperty(p,m,A):p[m]=c[m]}return p.default=c,l&&l.set(c,p),p}})(st);var Ir={},Wa={},q4={},K4={},AT={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(i){const a=[],s=new Array(4),o=[0,192,224,240],f=[127,63,63,63],c=[0,128,128,128];for(const u of i){const l=s,p=u.codePointAt(0),y=0-(-(p&4294967168)>>31)-(-(p&4294965248)>>31)-(-(p&4294901760)>>31),m=f[y],A=c[y];l[3]=A|p&m,l[2]=A|p>>>6&m,l[1]=A|p>>>12&m,l[0]=A|p>>>18&m;const S=3-y;l[S]|=o[y],Array.prototype.push.apply(a,l.slice(S))}return new Uint8Array(a)}t.toUtf8_1=e;function r(i){const a=[];for(const s of i){const o=s.codePointAt(0);o<128?a.push(o):o<2048?a.push(192|o>>6&31,128|o&63):o<65536?a.push(224|o>>12&15,128|o>>6&63,128|o&63):a.push(240|o>>18&7,128|o>>12&63,128|o>>6&63,128|o&63)}return new Uint8Array(a)}t.toUtf8_2=r;function n(i){const a=[];for(let s=0,o=i.length;s>6,128|f&63);else if(f<55296||f>=57344)a.push(224|f>>12,128|f>>6&63,128|f&63);else{let c=65536+((f&1023)<<10|i.charCodeAt(++s)&1023);a.push(240|c>>18&7,128|c>>12&63,128|c>>6&63,128|c&63)}}return new Uint8Array(a)}t.toUtf8_3=n,t.toUtf8=n,t.default=t.toUtf8})(AT);Object.defineProperty(K4,"__esModule",{value:!0});const bz=AT,el=2654435761,tl=2246822519,Mb=3266489917,w9=668265263,A9=374761393;function gz(t,e=0){t=typeof t=="string"?bz.default(t):t;const r=t;let n=e+A9&4294967295,i=0;if(r.length>=16){const s=[e+el+tl&4294967295,e+tl&4294967295,e+0&4294967295,e-el&4294967295],o=t,f=o.length-16;let c=0;for(i=0;(i&4294967280)<=f;i+=4){const u=i,l=o[u+0]+(o[u+1]<<8),p=o[u+2]+(o[u+3]<<8),y=l*tl+(p*tl<<16);let m=s[c]+y&4294967295;m=m<<13|m>>>19;const A=m&65535,S=m>>>16;s[c]=A*el+(S*el<<16)&4294967295,c=c+1&3}n=(s[0]<<1|s[0]>>>31)+(s[1]<<7|s[1]>>>25)+(s[2]<<12|s[2]>>>20)+(s[3]<<18|s[3]>>>14)&4294967295}n=n+t.length&4294967295;let a=t.length-4;for(;i<=a;i+=4){const s=i,o=r[s+0]+(r[s+1]<<8),f=r[s+2]+(r[s+3]<<8),c=o*Mb+(f*Mb<<16);n=n+c&4294967295,n=n<<17|n>>>15,n=(n&65535)*w9+((n>>>16)*w9<<16)&4294967295}for(;i>>21,n=(n&65535)*el+((n>>>16)*el<<16)&4294967295}return n=n^n>>>15,n=((n&65535)*tl&4294967295)+((n>>>16)*tl<<16),n=n^n>>>13,n=((n&65535)*Mb&4294967295)+((n>>>16)*Mb<<16),n=n^n>>>16,n<0?n+4294967296:n}K4.xxHash32=gz;(function(t){function e(r){for(var n in r)t.hasOwnProperty(n)||(t[n]=r[n])}Object.defineProperty(t,"__esModule",{value:!0}),e(K4)})(q4);var St={},Vn={exports:{}},ET=ST;class xT extends Error{}xT.prototype.name="AssertionError";function ST(t,e){if(!t){var r=new xT(e);throw Error.captureStackTrace&&Error.captureStackTrace(r,ST),r}}var Vs={exports:{}},$3={exports:{}};function IT(t){return t.length}function yz(t){const e=t.byteLength;let r="";for(let n=0;n1&&t.charCodeAt(e-1)===61&&e--,e*3>>>2}function mz(t){const e=t.byteLength;let r="";for(let n=0;n>2]+xl[(t[n]&3)<<4|t[n+1]>>4]+xl[(t[n+1]&15)<<2|t[n+2]>>6]+xl[t[n+2]&63];return e%3===2?r=r.substring(0,r.length-1)+"=":e%3===1&&(r=r.substring(0,r.length-2)+"=="),r}function wz(t,e,r=0,n=CT(e)){const i=Math.min(n,t.byteLength-r);for(let a=0,s=0;s>4,t[s++]=(f&15)<<4|c>>2,t[s++]=(c&3)<<6|u&63}return i}var Az={byteLength:CT,toString:mz,write:wz};function TT(t){return t.length>>>1}function Ez(t){const e=t.byteLength;t=new DataView(t.buffer,t.byteOffset,e);let r="",n=0;for(let i=e-e%4;n=48&&t<=57)return t-48;if(t>=65&&t<=70)return t-65+10;if(t>=97&&t<=102)return t-97+10}function j3(t){let e=0;for(let r=0,n=t.length;r=55296&&i<=56319&&r+1=56320&&a<=57343){e+=4,r++;continue}}i<=127?e+=1:i<=2047?e+=2:e+=3}return e}let F3;if(typeof TextDecoder<"u"){const t=new TextDecoder;F3=function(r){return t.decode(r)}}else F3=function(e){const r=e.byteLength;let n="",i=0;for(;i0){let f=0;for(;f>c,c-=6;c>=0;)e[o++]=128|f>>c&63,c-=6;s+=f>=65536?2:1}return a};var Iz={byteLength:j3,toString:F3,write:q3};function OT(t){return t.length*2}function Cz(t){const e=t.byteLength;let r="";for(let n=0;n>8,c=o%256;t[r+s*2]=c,t[r+s*2+1]=f}return i}var Oz={byteLength:OT,toString:Cz,write:Tz};(function(t,e){const r=_z,n=Az,i=Sz,a=Iz,s=Oz,o=new Uint8Array(Uint16Array.of(255).buffer)[0]===255;function f(V){switch(V){case"ascii":return r;case"base64":return n;case"hex":return i;case"utf8":case"utf-8":case void 0:case null:return a;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s;default:throw new Error(`Unknown encoding: ${V}`)}}function c(V){return V instanceof Uint8Array}function u(V){try{return f(V),!0}catch{return!1}}function l(V,J,ie){const ce=new Uint8Array(V);return J!==void 0&&e.fill(ce,J,0,ce.byteLength,ie),ce}function p(V){return new Uint8Array(V)}function y(V){return new Uint8Array(V)}function m(V,J){return f(J).byteLength(V)}function A(V,J){if(V===J)return 0;const ie=Math.min(V.byteLength,J.byteLength);V=new DataView(V.buffer,V.byteOffset,V.byteLength),J=new DataView(J.buffer,J.byteOffset,J.byteLength);let ce=0;for(let ye=ie-ie%4;cege)return 1}return V.byteLength>J.byteLength?1:V.byteLengthye+ge.byteLength,0));const ie=new Uint8Array(J);let ce=0;for(const ye of V){if(ce+ye.byteLength>ie.byteLength){const ge=ye.subarray(0,ie.byteLength-ce);return ie.set(ge,ce),ie}ie.set(ye,ce),ce+=ye.byteLength}return ie}function w(V,J,ie=0,ce=0,ye=V.byteLength){if(ye>0&&ye=V.byteLength)throw new RangeError("sourceStart is out of range");if(ye<0)throw new RangeError("sourceEnd is out of range");ie>=J.byteLength&&(ie=J.byteLength),ye>V.byteLength&&(ye=V.byteLength),J.byteLength-ie=V.byteLength){if(ye)return-1;ie=V.byteLength-1}else if(ie<0)if(ye)ie=0;else return-1;if(typeof J=="string")J=M(J,ce);else if(typeof J=="number")return J=J&255,ye?V.indexOf(J,ie):V.lastIndexOf(J,ie);if(J.byteLength===0)return-1;if(ye){let ge=-1;for(let Se=ie;SeV.byteLength&&(ie=V.byteLength-J.byteLength);for(let ge=ie;ge>=0;ge--){let Se=!0;for(let kt=0;kt=ye||ce<=ie?"":(ie<0&&(ie=0),ce>ye&&(ce=ye),(ie!==0||cefunction(){return s||(0,a[Object.keys(a)[0]])((s={exports:{}}).exports,s),s.exports},e=(()=>{for(var a=new Uint8Array(128),s=0;s<64;s++)a[s<26?s+65:s<52?s+71:s<62?s-4:s*4-205]=s;return o=>{for(var f=o.length,c=new Uint8Array((f-(o[f-1]=="=")-(o[f-2]=="="))*3/4|0),u=0,l=0;u>4,c[l++]=y<<4|m>>2,c[l++]=m<<6|A}return c}})(),r=t({"wasm-binary:./blake2b.wat"(a,s){s.exports=e("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMKvz8EwAIAIABCADcDACAAQgA3AwggAEIANwMQIABCADcDGCAAQgA3AyAgAEIANwMoIABCADcDMCAAQgA3AzggAEIANwNAIABCADcDSCAAQgA3A1AgAEIANwNYIABCADcDYCAAQgA3A2ggAEIANwNwIABCADcDeCAAQoiS853/zPmE6gBBACkDAIU3A4ABIABCu86qptjQ67O7f0EIKQMAhTcDiAEgAEKr8NP0r+68tzxBECkDAIU3A5ABIABC8e30+KWn/aelf0EYKQMAhTcDmAEgAELRhZrv+s+Uh9EAQSApAwCFNwOgASAAQp/Y+dnCkdqCm39BKCkDAIU3A6gBIABC6/qG2r+19sEfQTApAwCFNwOwASAAQvnC+JuRo7Pw2wBBOCkDAIU3A7gBIABCADcDwAEgAEIANwPIASAAQgA3A9ABC20BA38gAEHAAWohAyAAQcgBaiEEIAQpAwCnIQUCQANAIAEgAkYNASAFQYABRgRAIAMgAykDACAFrXw3AwBBACEFIAAQAwsgACAFaiABLQAAOgAAIAVBAWohBSABQQFqIQEMAAsLIAQgBa03AwALYQEDfyAAQcABaiEBIABByAFqIQIgASABKQMAIAIpAwB8NwMAIABCfzcD0AEgAikDAKchAwJAA0AgA0GAAUYNASAAIANqQQA6AAAgA0EBaiEDDAALCyACIAOtNwMAIAAQAwuqOwIgfgl/IABBgAFqISEgAEGIAWohIiAAQZABaiEjIABBmAFqISQgAEGgAWohJSAAQagBaiEmIABBsAFqIScgAEG4AWohKCAhKQMAIQEgIikDACECICMpAwAhAyAkKQMAIQQgJSkDACEFICYpAwAhBiAnKQMAIQcgKCkDACEIQoiS853/zPmE6gAhCUK7zqqm2NDrs7t/IQpCq/DT9K/uvLc8IQtC8e30+KWn/aelfyEMQtGFmu/6z5SH0QAhDUKf2PnZwpHagpt/IQ5C6/qG2r+19sEfIQ9C+cL4m5Gjs/DbACEQIAApAwAhESAAKQMIIRIgACkDECETIAApAxghFCAAKQMgIRUgACkDKCEWIAApAzAhFyAAKQM4IRggACkDQCEZIAApA0ghGiAAKQNQIRsgACkDWCEcIAApA2AhHSAAKQNoIR4gACkDcCEfIAApA3ghICANIAApA8ABhSENIA8gACkD0AGFIQ8gASAFIBF8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSASfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgE3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBR8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAVfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFnx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBd8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAYfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgGXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBp8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAbfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgHHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIB18fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAefHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgH3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFICB8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAffHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgG3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBV8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAZfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHICB8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAefHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggF3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBJ8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAdfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgEXx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBN8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAcfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggGHx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBZ8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAUfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHHx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBl8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAdfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgEXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBZ8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByATfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggIHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIB58fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAbfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgH3x8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBR8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAXfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBJ8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAafHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFXx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBh8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAafHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFHx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBJ8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAefHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHXx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBx8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAffHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgE3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBd8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAWfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgG3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBV8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCARfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgIHx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBl8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAafHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEXx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBZ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAYfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgE3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBV8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAbfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggIHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIB98fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiASfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgHHx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB18fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAXfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggGXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBR8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAefHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgE3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIB18fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAXfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgG3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBF8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAcfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggGXx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBR8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAVfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBh8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAWfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggIHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB98fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSASfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgGnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB18fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAWfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgEnx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGICB8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAffHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHnx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBV8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAbfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBh8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAXfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBp8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCATfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGXx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBx8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAefHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgHHx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBh8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAffHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBJ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAUfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBZ8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiARfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgIHx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBV8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAZfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggF3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBN8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAbfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgF3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFICB8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAffHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGnx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBx8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAUfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggEXx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBl8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAdfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgE3x8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIB58fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAYfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggEnx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBV8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAbfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBt8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSATfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgGXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBV8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAYfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgF3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBJ8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAWfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgIHx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBx8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAafHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgH3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBR8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAdfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgHnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBF8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgISAhKQMAIAEgCYWFNwMAICIgIikDACACIAqFhTcDACAjICMpAwAgAyALhYU3AwAgJCAkKQMAIAQgDIWFNwMAICUgJSkDACAFIA2FhTcDACAmICYpAwAgBiAOhYU3AwAgJyAnKQMAIAcgD4WFNwMAICggKCkDACAIIBCFhTcDAAs=")}}),n=r(),i=WebAssembly.compile(n);return E_=async a=>(await WebAssembly.instantiate(await i,a)).exports,E_}var Ai=ET,Mz=Bz,Do=null,S9=typeof WebAssembly<"u"&&Dz()().then(t=>{Do=t}),bo=64,hg=[];Vs.exports=Gn;var I9=Vs.exports.BYTES_MIN=16,C9=Vs.exports.BYTES_MAX=64;Vs.exports.BYTES=32;var T9=Vs.exports.KEYBYTES_MIN=16,O9=Vs.exports.KEYBYTES_MAX=64;Vs.exports.KEYBYTES=32;var B9=Vs.exports.SALTBYTES=16,D9=Vs.exports.PERSONALBYTES=16;function Gn(t,e,r,n,i){if(!(this instanceof Gn))return new Gn(t,e,r,n,i);if(!Do)throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(Ai(t>=I9,"digestLength must be at least "+I9+", was given "+t),Ai(t<=C9,"digestLength must be at most "+C9+", was given "+t),e!=null&&(Ai(e instanceof Uint8Array,"key must be Uint8Array or Buffer"),Ai(e.length>=T9,"key must be at least "+T9+", was given "+e.length),Ai(e.length<=O9,"key must be at least "+O9+", was given "+e.length)),r!=null&&(Ai(r instanceof Uint8Array,"salt must be Uint8Array or Buffer"),Ai(r.length===B9,"salt must be exactly "+B9+", was given "+r.length)),n!=null&&(Ai(n instanceof Uint8Array,"personal must be Uint8Array or Buffer"),Ai(n.length===D9,"personal must be exactly "+D9+", was given "+n.length))),hg.length||(hg.push(bo),bo+=216),this.digestLength=t,this.finalized=!1,this.pointer=hg.pop(),this._memory=new Uint8Array(Do.memory.buffer),this._memory.fill(0,0,64),this._memory[0]=this.digestLength,this._memory[1]=e?e.length:0,this._memory[2]=1,this._memory[3]=1,r&&this._memory.set(r,32),n&&this._memory.set(n,48),this.pointer+216>this._memory.length&&this._realloc(this.pointer+216),Do.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),this._memory.fill(0,bo,bo+e.length),this._memory[this.pointer+200]=128)}Gn.prototype._realloc=function(t){Do.memory.grow(Math.max(0,Math.ceil(Math.abs(t-this._memory.length)/65536))),this._memory=new Uint8Array(Do.memory.buffer)};Gn.prototype.update=function(t){return Ai(this.finalized===!1,"Hash instance finalized"),Ai(t instanceof Uint8Array,"input must be Uint8Array or Buffer"),bo+t.length>this._memory.length&&this._realloc(bo+t.length),this._memory.set(t,bo),Do.blake2b_update(this.pointer,bo,bo+t.length),this};Gn.prototype.digest=function(t){if(Ai(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,hg.push(this.pointer),Do.blake2b_final(this.pointer),!t||t==="binary")return this._memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(typeof t=="string")return Mz.toString(this._memory,t,this.pointer+128,this.pointer+128+this.digestLength);Ai(t instanceof Uint8Array&&t.length>=this.digestLength,"input must be Uint8Array or Buffer");for(var e=0;et(),t):t(new Error("WebAssembly not supported"))};Gn.prototype.ready=Gn.ready;Gn.prototype.getPartialHash=function(){return this._memory.slice(this.pointer,this.pointer+216)};Gn.prototype.setPartialHash=function(t){this._memory.set(t,this.pointer)};function Rz(){}var Lz=Vs.exports,Xi=ET,Ip=Lz;function Rb(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function M9(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var a=t[e+1]+n;i>=4294967296&&a++,t[e]=i,t[e+1]=a}function BT(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function ff(t,e,r,n,i,a){var s=xh[i],o=xh[i+1],f=xh[a],c=xh[a+1];Rb(Ue,t,e),M9(Ue,t,s,o);var u=Ue[n]^Ue[t],l=Ue[n+1]^Ue[t+1];Ue[n]=l,Ue[n+1]=u,Rb(Ue,r,n),u=Ue[e]^Ue[r],l=Ue[e+1]^Ue[r+1],Ue[e]=u>>>24^l<<8,Ue[e+1]=l>>>24^u<<8,Rb(Ue,t,e),M9(Ue,t,f,c),u=Ue[n]^Ue[t],l=Ue[n+1]^Ue[t+1],Ue[n]=u>>>16^l<<16,Ue[n+1]=l>>>16^u<<16,Rb(Ue,r,n),u=Ue[e]^Ue[r],l=Ue[e+1]^Ue[r+1],Ue[e]=l>>>31^u<<1,Ue[e+1]=u>>>31^l<<1}var DT=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Hz=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],un=new Uint8Array(Hz.map(function(t){return t*2})),Ue=new Uint32Array(32),xh=new Uint32Array(32);function MT(t,e){var r=0;for(r=0;r<16;r++)Ue[r]=t.h[r],Ue[r+16]=DT[r];for(Ue[24]=Ue[24]^t.t,Ue[25]=Ue[25]^t.t/4294967296,e&&(Ue[28]=~Ue[28],Ue[29]=~Ue[29]),r=0;r<32;r++)xh[r]=BT(t.b,4*r);for(r=0;r<12;r++)ff(0,8,16,24,un[r*16+0],un[r*16+1]),ff(2,10,18,26,un[r*16+2],un[r*16+3]),ff(4,12,20,28,un[r*16+4],un[r*16+5]),ff(6,14,22,30,un[r*16+6],un[r*16+7]),ff(0,10,20,30,un[r*16+8],un[r*16+9]),ff(2,12,22,24,un[r*16+10],un[r*16+11]),ff(4,14,16,26,un[r*16+12],un[r*16+13]),ff(6,8,18,28,un[r*16+14],un[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Ue[r]^Ue[r+16]}var cf=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function vd(t,e,r,n){cf.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,cf[0]=t,e&&(cf[1]=e.length),cf[2]=1,cf[3]=1,r&&cf.set(r,32),n&&cf.set(n,48);for(var i=0;i<16;i++)this.h[i]=DT[i]^BT(cf,i*4);e&&(RT(this,e),this.c=128)}vd.prototype.update=function(t){return Xi(t instanceof Uint8Array,"input must be Uint8Array or Buffer"),RT(this,t),this};vd.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Xi(e instanceof Uint8Array,'out must be "binary", "hex", Uint8Array, or Buffer'),Xi(e.length>=this.outlen,"out must have at least outlen bytes of space"),Pz(this,e),t==="hex"?Nz(e):e};vd.prototype.final=vd.prototype.digest;vd.ready=function(t){Ip.ready(function(){t()})};function RT(t,e){for(var r=0;r>2]>>8*(r&3);return e}function Nz(t){for(var e="",r=0;r=R9,"outlen must be at least "+R9+", was given "+e),Xi(e<=L9,"outlen must be at most "+L9+", was given "+e),r!=null&&(Xi(r instanceof Uint8Array,"key must be Uint8Array or Buffer"),Xi(r.length>=H9,"key must be at least "+H9+", was given "+r.length),Xi(r.length<=P9,"key must be at most "+P9+", was given "+r.length)),n!=null&&(Xi(n instanceof Uint8Array,"salt must be Uint8Array or Buffer"),Xi(n.length===N9,"salt must be exactly "+N9+", was given "+n.length)),i!=null&&(Xi(i instanceof Uint8Array,"personal must be Uint8Array or Buffer"),Xi(i.length===U9,"personal must be exactly "+U9+", was given "+i.length))),new kz(e,r,n,i)};Vn.exports.ready=function(t){Ip.ready(function(){t()})};Vn.exports.WASM_SUPPORTED=Ip.SUPPORTED;Vn.exports.WASM_LOADED=!1;var R9=Vn.exports.BYTES_MIN=16,L9=Vn.exports.BYTES_MAX=64;Vn.exports.BYTES=32;var H9=Vn.exports.KEYBYTES_MIN=16,P9=Vn.exports.KEYBYTES_MAX=64;Vn.exports.KEYBYTES=32;var N9=Vn.exports.SALTBYTES=16,U9=Vn.exports.PERSONALBYTES=16;Ip.ready(function(t){t||(Vn.exports.WASM_LOADED=!0,Vn.exports=Ip)});var zz=Vn.exports,Jg={exports:{}};Jg.exports;(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,a=2,s=9007199254740991,o="[object Arguments]",f="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",l="[object Date]",p="[object Error]",y="[object Function]",m="[object GeneratorFunction]",A="[object Map]",S="[object Number]",w="[object Null]",C="[object Object]",O="[object Promise]",M="[object Proxy]",U="[object RegExp]",K="[object Set]",Q="[object String]",k="[object Symbol]",G="[object Undefined]",W="[object WeakMap]",R="[object ArrayBuffer]",_="[object DataView]",I="[object Float32Array]",b="[object Float64Array]",v="[object Int8Array]",d="[object Int16Array]",g="[object Int32Array]",x="[object Uint8Array]",E="[object Uint8ClampedArray]",h="[object Uint16Array]",T="[object Uint32Array]",$=/[\\^$.*+?()[\]{}|]/g,L=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,F={};F[I]=F[b]=F[v]=F[d]=F[g]=F[x]=F[E]=F[h]=F[T]=!0,F[o]=F[f]=F[R]=F[u]=F[_]=F[l]=F[p]=F[y]=F[A]=F[S]=F[C]=F[U]=F[K]=F[Q]=F[W]=!1;var H=typeof Fn=="object"&&Fn&&Fn.Object===Object&&Fn,q=typeof self=="object"&&self&&self.Object===Object&&self,X=H||q||Function("return this")(),te=e&&!e.nodeType&&e,ne=te&&!0&&t&&!t.nodeType&&t,N=ne&&ne.exports===te,P=N&&H.process,re=function(){try{return P&&P.binding&&P.binding("util")}catch{}}(),ue=re&&re.isTypedArray;function de(Z,oe){for(var be=-1,Ce=Z==null?0:Z.length,It=0,ze=[];++be-1}function H0(Z,oe){var be=this.__data__,Ce=cb(be,Z);return Ce<0?(++this.size,be.push([Z,oe])):be[Ce][1]=oe,this}bi.prototype.clear=D0,bi.prototype.delete=M0,bi.prototype.get=R0,bi.prototype.has=L0,bi.prototype.set=H0;function Pa(Z){var oe=-1,be=Z==null?0:Z.length;for(this.clear();++oeTr))return!1;var jt=ze.get(Z);if(jt&&ze.get(oe))return jt==oe;var gi=-1,Na=!0,cn=be&a?new rf:void 0;for(ze.set(Z,oe),ze.set(oe,Z);++gi-1&&Z%1==0&&Z-1&&Z%1==0&&Z<=s}function Tw(Z){var oe=typeof Z;return Z!=null&&(oe=="object"||oe=="function")}function Y0(Z){return Z!=null&&typeof Z=="object"}var Ow=ue?ce(ue):IH;function zH(Z){return UH(Z)?AH(Z):CH(Z)}function $H(){return[]}function jH(){return!1}t.exports=kH})(Jg,Jg.exports);var $z=Jg.exports,Ee={},Q4,Y4;Object.defineProperty(Ee,"__esModule",{value:!0});var ey=Ee.WitnessArgs=Ee.UncleBlockVec=Ee.UncleBlock=Ee.TransactionVec=Y4=Ee.Transaction=Ee.ScriptOpt=Ee.Script=Ee.RawTransaction=Ee.RawHeader=Ee.ProposalShortIdVec=Ee.ProposalShortId=Q4=Ee.OutPoint=Ee.Header=Ee.HashType=Ee.DepType=Ee.CellbaseWitness=Ee.CellOutputVec=Ee.CellOutput=Ee.CellInputVec=Ee.CellInput=Ee.CellDepVec=Ee.CellDep=Ee.BytesVec=Ee.BytesOptVec=Ee.BytesOpt=Ee.Bytes=Ee.Byte32Vec=Ee.Byte32=Ee.BlockV1=Ee.Block=Ee.BaseHeader=void 0;Ee.WitnessArgsOf=HT;Ee.createFixedHexBytesCodec=W4;Ee.deTransformHeaderCodecType=jT;Ee.deTransformTransactionCodecType=zT;Ee.transformHeaderCodecType=$T;Ee.transformTransactionCodecType=kT;var Hr=st,jz=wt;function i2(t){return{...t,unpack:e=>jz.BI.from(t.unpack(e)).toHexString()}}const k9=i2(Hr.number.Uint8),ty=i2(Hr.number.Uint32LE),Wh=i2(Hr.number.Uint64LE),Fz=i2(Hr.number.Uint128LE),{byteVecOf:pg,option:Xh,table:Wo,vector:Xo,struct:l1}=Hr.molecule,{bytify:V4,hexify:G4}=Hr.bytes;function W4(t){return(0,Hr.createFixedBytesCodec)({byteLength:t,pack:e=>V4(e),unpack:e=>G4(e)})}const d1=Ee.Bytes=pg({pack:V4,unpack:G4}),qz=Ee.BytesOpt=Xh(d1),LT=Ee.BytesVec=Xo(d1);Ee.BytesOptVec=Xo(qz);const Bf=Ee.Byte32=W4(32),Kz=Ee.Byte32Vec=Xo(Bf);function HT(t){return Wo({lock:Xh(pg(t.lock)),inputType:Xh(pg(t.inputType)),outputType:Xh(pg(t.outputType))},["lock","inputType","outputType"])}const x_=(0,Hr.createBytesCodec)({pack:V4,unpack:G4});ey=Ee.WitnessArgs=HT({lock:x_,inputType:x_,outputType:x_});const Qz=Ee.HashType=(0,Hr.createFixedBytesCodec)({byteLength:1,pack:t=>{if(t==="type")return Hr.number.Uint8.pack(1);if(t==="data")return Hr.number.Uint8.pack(0);if(t==="data1")return Hr.number.Uint8.pack(2);if(t==="data2")return Hr.number.Uint8.pack(4);throw new Error(`Invalid hash type: ${t}`)},unpack:t=>{const e=Hr.number.Uint8.unpack(t);if(e===1)return"type";if(e===0)return"data";if(e===2)return"data1";if(e===4)return"data2";throw new Error(`Invalid hash type: ${e}`)}}),Yz=Ee.DepType=(0,Hr.createFixedBytesCodec)({byteLength:1,pack:t=>{if(t==="code")return k9.pack(0);if(t==="depGroup")return k9.pack(1);throw new Error(`Invalid dep type: ${t}`)},unpack:t=>{const e=Hr.number.Uint8.unpack(t);if(e===0)return"code";if(e===1)return"depGroup";throw new Error(`Invalid dep type: ${e}`)}}),X4=Ee.Script=Wo({codeHash:Bf,hashType:Qz,args:d1},["codeHash","hashType","args"]),Vz=Ee.ScriptOpt=Xh(X4),PT=Q4=Ee.OutPoint=l1({txHash:Bf,index:ty},["txHash","index"]),Gz=Ee.CellInput=l1({since:Wh,previousOutput:PT},["since","previousOutput"]),Wz=Ee.CellInputVec=Xo(Gz),Xz=Ee.CellOutput=Wo({capacity:Wh,lock:X4,type:Vz},["capacity","lock","type"]),Zz=Ee.CellOutputVec=Xo(Xz),Jz=Ee.CellDep=l1({outPoint:PT,depType:Yz},["outPoint","depType"]),e$=Ee.CellDepVec=Xo(Jz),t$=Ee.RawTransaction=Wo({version:ty,cellDeps:e$,headerDeps:Kz,inputs:Wz,outputs:Zz,outputsData:LT},["version","cellDeps","headerDeps","inputs","outputs","outputsData"]),z9=Wo({raw:t$,witnesses:LT},["raw","witnesses"]),r$=Y4=Ee.Transaction=(0,Hr.createBytesCodec)({pack:t=>z9.pack(kT(t)),unpack:t=>zT(z9.unpack(t))}),NT=Ee.TransactionVec=Xo(r$),n$=Ee.RawHeader=l1({version:ty,compactTarget:ty,timestamp:Wh,number:Wh,epoch:Wh,parentHash:Bf,transactionsRoot:Bf,proposalsHash:Bf,extraHash:Bf,dao:Bf},["version","compactTarget","timestamp","number","epoch","parentHash","transactionsRoot","proposalsHash","extraHash","dao"]),$9=Ee.BaseHeader=l1({raw:n$,nonce:Fz},["raw","nonce"]),Z4=Ee.Header=(0,Hr.createBytesCodec)({pack:t=>$9.pack($T(t)),unpack:t=>jT($9.unpack(t))}),i$=Ee.ProposalShortId=W4(10),J4=Ee.ProposalShortIdVec=Xo(i$),a$=Ee.UncleBlock=Wo({header:Z4,proposals:J4},["header","proposals"]),UT=Ee.UncleBlockVec=Xo(a$);Ee.Block=Wo({header:Z4,uncles:UT,transactions:NT,proposals:J4},["header","uncles","transactions","proposals"]);Ee.BlockV1=Wo({header:Z4,uncles:UT,transactions:NT,proposals:J4,extension:d1},["header","uncles","transactions","proposals","extension"]);Ee.CellbaseWitness=Wo({lock:X4,message:d1},["lock","message"]);function kT(t){return{raw:{version:t.version,cellDeps:t.cellDeps,headerDeps:t.headerDeps,inputs:t.inputs,outputs:t.outputs,outputsData:t.outputsData},witnesses:t.witnesses}}function zT(t){return{cellDeps:t.raw.cellDeps.map(e=>({outPoint:{txHash:e.outPoint.txHash,index:e.outPoint.index},depType:e.depType})),headerDeps:t.raw.headerDeps,inputs:t.raw.inputs.map(e=>({previousOutput:{txHash:e.previousOutput.txHash,index:e.previousOutput.index},since:e.since})),outputs:t.raw.outputs.map(e=>({capacity:e.capacity,lock:e.lock,type:e.type})),outputsData:t.raw.outputsData,version:t.raw.version,witnesses:t.witnesses}}function $T(t){return{raw:{timestamp:t.timestamp,number:t.number,epoch:t.epoch,compactTarget:Number(t.compactTarget),dao:t.dao,parentHash:t.parentHash,proposalsHash:t.proposalsHash,transactionsRoot:t.transactionsRoot,extraHash:t.extraHash,version:t.version},nonce:t.nonce}}function jT(t){return{timestamp:t.raw.timestamp,number:t.raw.number,epoch:t.raw.epoch,compactTarget:t.raw.compactTarget,dao:t.raw.dao,parentHash:t.raw.parentHash,proposalsHash:t.raw.proposalsHash,transactionsRoot:t.raw.transactionsRoot,extraHash:t.raw.extraHash,version:t.raw.version,nonce:t.nonce,hash:""}}Object.defineProperty(St,"__esModule",{value:!0});St.CKBHasher=void 0;St.assertHexString=w$;St.assertHexadecimal=GT;St.ckbHash=r8;St.ckbHash160=p$;var s$=St.computeScriptHash=b$;St.deepCamel=ry;St.deepCamelizeTransaction=I$;St.generateTypeIdScript=S$;St.hashCode=g$;St.isDeepEqual=A$;St.readBigUInt128LE=m$;St.readBigUInt128LECompatible=VT;St.readBigUInt64LE=v$;St.readBigUInt64LECompatible=QT;St.toBigUInt128LE=_$;St.toBigUInt128LECompatible=YT;St.toBigUInt64LE=y$;St.toBigUInt64LECompatible=KT;var o$=qT(zz),f$=qT($z),c$=q4,_d=st,e8=u$(Ee),a2=r0;function FT(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(FT=function(n){return n?r:e})(t)}function u$(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=FT(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}function qT(t){return t&&t.__esModule?t:{default:t}}const{bytify:l$,hexify:d$,bytifyRawString:h$}=_d.bytes;let t8=class{constructor(e={}){const{outLength:r=32}=e;this.outLength=r,this.hasher=(0,o$.default)(r,void 0,void 0,h$("ckb-default-hash"))}update(e){return this.hasher.update(l$(e)),this}digestHex(){const e=new Uint8Array(this.outLength);return this.hasher.digest(e),d$(e.buffer)}};St.CKBHasher=t8;function r8(t){const e=new t8;return e.update(_d.bytes.bytify(t)),e.digestHex()}function p$(t){return r8(t).slice(0,42)}function b$(t){return r8(e8.Script.pack(t))}function g$(t){return(0,c$.xxHash32)(t,0)}function y$(t){return KT(t)}function KT(t){return _d.bytes.hexify(a2.Uint64LE.pack(t))}function v$(t){return QT(t).toBigInt()}function QT(t){return a2.Uint64LE.unpack(t)}function _$(t){return YT(t)}function YT(t){return _d.bytes.hexify(a2.Uint128LE.pack(t))}function m$(t){return VT(t).toBigInt()}function VT(t){return a2.Uint128LE.unpack(t)}function w$(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(`${t} must be a hex string!`)}function GT(t,e){if(!/^0x(0|[0-9a-fA-F]+)$/.test(e))throw new Error(`${t} must be a hexadecimal!`)}function A$(t,e){return(0,f$.default)(t,e)}const E$="0x00000000000000000000000000000000000000000000000000545950455f4944";function x$(t,e){const r=e8.CellInput.pack(t),n=_d.bytes.hexify(_d.number.Uint64LE.pack(e)),i=new t8;return i.update(r),i.update(n),i.digestHex()}function S$(t,e="0x0"){e8.CellInput.pack(t),GT("outputIndex",e);const r=x$(t,e);return{codeHash:E$,hashType:"type",args:r}}function j9(t){return t.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace("-","").replace("_",""))}function ry(t){if(Object.prototype.toString.call(t)==="[object Array]")return t.length===0?t:t.map(r=>ry(r));const e={};if(Object.prototype.toString.call(t)==="[object Object]"){for(const r in t){const n=t[r];Object.prototype.toString.call(n)==="[object Object]"||Object.prototype.toString.call(n)==="[object Array]"?e[j9(r)]=ry(n):e[j9(r)]=n}return e}return t}function K3(t){if(Object.prototype.toString.call(t)==="[object Array]")return t.length===0?t:t.map(r=>K3(r));const e={};if(Object.prototype.toString.call(t)==="[object Object]"){for(const r in t){const n=t[r];Object.prototype.toString.call(n)==="[object Object]"||Object.prototype.toString.call(n)==="[object Array]"?e[r]=K3(n):e[r]=n==="dep_group"?"depGroup":n}return e}return t}function I$(t){return K3(ry(t))}Object.defineProperty(Wa,"__esModule",{value:!0});Wa.TransactionValue=Wa.ScriptValue=Wa.RawTransactionValue=Wa.OutPointValue=void 0;var C$=q4,T$=St,O$=st,s2=B$(Ee);function WT(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(WT=function(n){return n?r:e})(t)}function B$(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=WT(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}const{hexify:F9}=O$.bytes;class o2{constructor(e){this.buffer=e}equals(e){return F9(this.buffer)===F9(e.buffer)}hashCode(){return(0,C$.xxHash32)(Buffer.from(this.buffer),0)}hash(){return(0,T$.ckbHash)(this.buffer)}}let D$=class extends o2{constructor(e,r={}){super(s2.Script.pack(e))}};Wa.ScriptValue=D$;class M$ extends o2{constructor(e,r={}){super(s2.OutPoint.pack(e))}}Wa.OutPointValue=M$;class R$ extends o2{constructor(e,r={}){super(s2.RawTransaction.pack(e))}}Wa.RawTransactionValue=R$;class L$ extends o2{constructor(e,r={}){super(s2.Transaction.pack(e))}}Wa.TransactionValue=L$;var Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});Pi.generateAbsoluteEpochSince=ZT;var H$=Pi.generateHeaderEpoch=JT;Pi.generateSince=XT;Pi.maximumAbsoluteEpochSince=N$;var Cp=Pi.parseAbsoluteEpochSince=eO,h1=Pi.parseEpoch=ny;Pi.parseSince=P$;Pi.parseSinceCompatible=p1;Pi.validateAbsoluteEpochSince=tO;Pi.validateSince=U$;var Je=wt;function P$(t){const e=p1(t);return e.type==="epochNumber"?e:{...e,value:e.value.toBigInt()}}function p1(t){const e=Je.BI.from(t),r=e.shr(56),n=r.shr(5).and("0b11");let i,a;if(n.eq(0))i="blockNumber",a=e.and("0xFFFFFFFFFFFFFF");else if(n.eq(1))i="epochNumber",a={length:e.shr(40).and(65535).toNumber(),index:e.shr(24).and(65535).toNumber(),number:e.and(16777215).toNumber()};else if(n.eq(2))i="blockTimestamp",a=e.and("0xFFFFFFFFFFFFFF");else throw new Error("Invalid metric flag!");return{relative:!r.and("0x80").eq(0),type:i,value:a}}function XT({relative:t,type:e,value:r}){let n=Je.BI.from(0);t&&(n=n.add(128)),e==="epochNumber"?n=n.add(32):e==="blockTimestamp"&&(n=n.add(64));let i;return(0,Je.isBIish)(r)?i=Je.BI.from(r):typeof r=="object"?i=JT(r):i=Je.BI.from(r),rO(n.shl(56).add(i))}function ny(t){const e=Je.BI.from(t);return{length:e.shr(40).and(65535).toNumber(),index:e.shr(24).and(65535).toNumber(),number:e.and(16777215).toNumber()}}function N$(...t){const e=t.map(a=>eO(a)),r=Math.max(...e.map(a=>a.number)),n=e.filter(a=>a.number===r);let i=n[0];for(let a=1;a=0){const c=o.argsLen*2+2,u=o.script.args.length,l=Math.min(c,u),p=t.cellOutput.lock;if(p.args.length!==c||!(p.codeHash===o.script.codeHash&&p.hashType===o.script.hashType&&p.args.slice(0,l)===o.script.args.slice(0,l)))return!1}return!(f&&f==="empty"&&t.cellOutput.type||f&&typeof f=="object"&&(!t.cellOutput.type||!new Lb.ScriptValue(t.cellOutput.type,{validate:!1}).equals(new Lb.ScriptValue(f.script,{validate:!1})))||i&&i!=="any"&&t.data!==i||a&&t.blockNumber&&Hb.BI.from(t.blockNumber).lt(Hb.BI.from(a))||s&&t.blockNumber&&Hb.BI.from(t.blockNumber).gt(Hb.BI.from(s)))}var Xf={},n8={},g1={};Object.defineProperty(g1,"__esModule",{value:!0});g1.Reader=void 0;class y1{constructor(){this.__isByteLikeReader__=!0}static isReader(e){return e==null?!1:e instanceof y1?!0:e.__isByteLikeReader__===!0}}class Pb extends y1{constructor(e){super(),this.view=new DataView(e)}length(){return this.view.byteLength}indexAt(e){return this.view.getUint8(e)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),e=>("00"+e.toString(16)).slice(-2)).join("")}}class q9 extends y1{constructor(e){super(),this.string=e}length(){return this.string.length/2-1}indexAt(e){return parseInt(this.string.substr(2+e*2,2),16)}toArrayBuffer(){const e=new ArrayBuffer(this.length()),r=new DataView(e);for(let n=0;n255)throw new Error("fromRawString can only accept UTF-8 raw string!");n.setUint8(i,a)}return new Pb(r)}}g1.Reader=i8;var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.NormalizeBlock=j$;Jn.NormalizeCellDep=aO;Jn.NormalizeCellInput=nO;Jn.NormalizeCellOutput=iO;Jn.NormalizeCellbaseWitness=F$;Jn.NormalizeHeader=s8;Jn.NormalizeOutPoint=a8;Jn.NormalizeRawHeader=fO;Jn.NormalizeRawTransaction=sO;Jn.NormalizeScript=iy;Jn.NormalizeTransaction=oO;Jn.NormalizeUncleBlock=cO;Jn.NormalizeWitnessArgs=q$;var z$=wt,$$=g1;function xs(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=z$.BI.from(r).toString(16);if(n.length%2!==0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let a=0;a0&&r.byteLength!==t)throw new Error(`${e} has invalid length ${r.byteLength}, required: ${t}`);return r}}function Ta(t,e,r){const n={};for(const[i,a]of Object.entries(r)){const s=e[i];if(s==null)throw new Error(`${t} is missing ${i}!`);n[i]=a(`${t}.${i}`,s)}return n}function iy(t,{debugPath:e="script"}={}){return Ta(e,t,{codeHash:Jr(32),hashType:function(r,n){switch(n){case"data":return 0;case"type":return 1;case"data1":return 2;case"data2":return 4;case 0:return n;case 1:return n;case 2:return n;case 4:return n;default:throw new Error(`${r}.hashType has invalid value: ${n}`)}},args:Jr(-1)})}function a8(t,{debugPath:e="outPoint"}={}){return Ta(e,t,{txHash:Jr(32),index:xs(4)})}function rs(t){return function(e,r){return t(r,{debugPath:e})}}function nO(t,{debugPath:e="cell_input"}={}){return Ta(e,t,{since:xs(8),previousOutput:rs(a8)})}function iO(t,{debugPath:e="cellOutput"}={}){const r=Ta(e,t,{capacity:xs(8),lock:rs(iy)});return t.type&&(r.type_=iy(t.type,{debugPath:`${e}.type`})),r}function aO(t,{debugPath:e="cell_dep"}={}){return Ta(e,t,{outPoint:rs(a8),depType:function(r,n){switch(n){case"code":return 0;case"depGroup":return 1;case 0:return n;case 1:return n;default:throw new Error(`${r}.depType has invalid value: ${n}`)}}})}function Ss(t){return function(e,r){return r.map((n,i)=>t(`${e}[${i}]`,n))}}function sO(t,{debugPath:e="raw_transaction"}={}){return Ta(e,t,{version:xs(4),cellDeps:Ss(rs(aO)),headerDeps:Ss(Jr(32)),inputs:Ss(rs(nO)),outputs:Ss(rs(iO)),outputsData:Ss(Jr(-1))})}function oO(t,{debugPath:e="transaction"}={}){const r=sO(t,{debugPath:`(raw)${e}`}),n=Ta(e,t,{witnesses:Ss(Jr(-1))});return n.raw=r,n}function fO(t,{debugPath:e="raw_header"}={}){return Ta(e,t,{version:xs(4),compactTarget:xs(4),timestamp:xs(8),number:xs(8),epoch:xs(8),parentHash:Jr(32),transactionsRoot:Jr(32),proposalsHash:Jr(32),extraHash:Jr(32),dao:Jr(32)})}function s8(t,{debugPath:e="header"}={}){const r=fO(t,{debugPath:`(raw)${e}`}),n=Ta(e,t,{nonce:xs(16)});return n.raw=r,n}function cO(t,{debugPath:e="uncle_block"}={}){return Ta(e,t,{header:rs(s8),proposals:Ss(Jr(10))})}function j$(t,{debugPath:e="block"}={}){return Ta(e,t,{header:rs(s8),uncles:Ss(rs(cO)),transactions:Ss(rs(oO)),proposals:Ss(Jr(10))})}function F$(t,{debugPath:e="cellbase_witness"}={}){return Ta(e,t,{lock:rs(iy),message:Jr(-1)})}function q$(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=Jr(-1)(`${e}.lock`,t.lock)),t.inputType&&(r.inputType=Jr(-1)(`${e}.inputType`,t.inputType)),t.outputType&&(r.outputType=Jr(-1)(`${e}.outputType`,t.outputType)),r}var hi={},Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.ValidateBlock=G$;Mn.ValidateCellDep=dO;Mn.ValidateCellInput=uO;Mn.ValidateCellOutput=lO;Mn.ValidateCellbaseWitness=W$;Mn.ValidateHeader=f8;Mn.ValidateOutPoint=o8;Mn.ValidateRawHeader=V$;Mn.ValidateRawTransaction=Q$;Mn.ValidateScript=ay;Mn.ValidateTransaction=pO;Mn.ValidateUncleBlock=gO;Mn.ValidateWitnessArgs=X$;function K$(t,e){if(!(e instanceof Object))throw new Error(`${t} is not an object!`)}function Ni(t,e,r,n=[]){K$(t,e);const i=Object.keys(e).sort(),a=r.length,s=r.length+n.length,o=`${t} does not have correct keys! Required keys: [${r.sort().join(", ")}], optional keys: [${n.sort().join(", ")}], actual keys: [${i.join(", ")}]`;if(i.lengths)throw new Error(o);let f=i.filter(c=>!r.includes(c));if(i.length-f.length!==a)throw new Error(o);if(f.find(c=>!n.includes(c)))throw new Error(o)}function Ls(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(`${t} must be a hex string!`)}function Df(t,e){if(Ls(t,e),e.length!==66)throw new Error(`${t} must be a hex string of 66 bytes long!`)}function go(t,e){if(e!=="0x0"&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(`${t} must be a hex integer!`)}function ay(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(Ni(r,t,["codeHash","hashType","args"],[]),Df(`${r}.codeHash`,t.codeHash),Ls(`${r}.args`,t.args),t.hashType!=="data"&&t.hashType!=="type"&&t.hashType!=="data1"&&t.hashType!=="data2")throw new Error(`${r}.hashType must be either data or type!`)}function o8(t,{nestedValidation:e=!0,debugPath:r="outPoint"}={}){Ni(r,t,["txHash","index"],[]),Df(`${r}.txHash`,t.txHash),go(`${r}.index`,t.index)}function uO(t,{nestedValidation:e=!0,debugPath:r="cellInput"}={}){Ni(r,t,["since","previousOutput"],[]),go(`${r}.since`,t.since),e&&o8(t.previousOutput,{debugPath:`${r}.previousOutput`})}function lO(t,{nestedValidation:e=!0,debugPath:r="cellOutput"}={}){Ni(r,t,["capacity","lock"],["type"]),go(`${r}.capacity`,t.capacity),e&&(ay(t.lock,{debugPath:`${r}.lock`}),t.type&&ay(t.type,{debugPath:`${r}.type`}))}function dO(t,{nestedValidation:e=!0,debugPath:r="cellDep"}={}){if(Ni(r,t,["outPoint","depType"],[]),t.depType!=="code"&&t.depType!=="depGroup")throw new Error(`${r}.depType must be either code or depGroup!`);e&&o8(t.outPoint,{debugPath:`${r}.outPoint`})}function Is(t,e,r,n){if(!Array.isArray(e))throw new Error(`${t} is not an array!`);if(n)for(let i=0;if.toUpperCase().replace("_",""));s=e[o]}s&&(n[i]=a(`${t}.${i}`,s))}return n}function sy(t,{validation:e=!0,debugPath:r="script"}={}){return t=ki(r,t,{codeHash:Ne,hashType:Ne,args:Ne}),e&&Ui.ValidateScript(t,{debugPath:`(transformed) ${r}`}),t}function c8(t,{validation:e=!0,debugPath:r="outPoint"}={}){return t=ki(r,t,{txHash:Ne,index:Ne}),e&&Ui.ValidateOutPoint(t,{debugPath:`(transformed) ${r}`}),t}function Yn(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function u8(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=ki(r,t,{since:Ne,previousOutput:Yn(c8)}),e&&Ui.ValidateCellInput(t,{debugPath:`(transformed) ${r}`}),t}function l8(t,{validation:e=!0,debugPath:r="cellOutput"}={}){return t=ki(r,t,{capacity:Ne,lock:Yn(sy),type:Yn(sy)}),e&&Ui.ValidateCellOutput(t,{debugPath:`(transformed) ${r}`}),t}function vO(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=ki(r,t,{outPoint:Yn(c8),depType:Ne}),e&&Ui.ValidateCellDep(t,{debugPath:`(transformed) ${r}`}),t}function zn(t){return function(e,r){return r.map((n,i)=>t(`${e}[${i}]`,n))}}function J$(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=ki(r,t,{version:Ne,cellDeps:zn(Yn(vO)),headerDeps:zn(Ne),inputs:zn(Yn(u8)),outputs:zn(Yn(l8)),outputsData:zn(Ne)}),e&&Ui.ValidateRawTransaction(t,{debugPath:`(transformed) ${r}`}),t}function _O(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=ki(r,t,{version:Ne,cellDeps:zn(Yn(vO)),headerDeps:zn(Ne),inputs:zn(Yn(u8)),outputs:zn(Yn(l8)),outputsData:zn(Ne),witnesses:zn(Ne)}),e&&Ui.ValidateTransaction(t,{debugPath:`(transformed) ${r}`}),t}function ej(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=ki(r,t,{version:Ne,compactTarget:Ne,timestamp:Ne,number:Ne,epoch:Ne,parentHash:Ne,transactionsRoot:Ne,proposalsHash:Ne,extraHash:Ne,dao:Ne}),e&&Ui.ValidateRawHeader(t,{debugPath:`(transformed) ${r}`}),t}function d8(t,{validation:e=!0,debugPath:r="header"}={}){return t=ki(r,t,{version:Ne,compactTarget:Ne,timestamp:Ne,number:Ne,epoch:Ne,parentHash:Ne,transactionsRoot:Ne,proposalsHash:Ne,extraHash:Ne,dao:Ne,nonce:Ne}),e&&Ui.ValidateHeader(t,{debugPath:`(transformed) ${r}`}),t}function mO(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=ki(r,t,{header:Yn(d8),proposals:zn(Ne)}),e&&Ui.ValidateUncleBlock(t,{debugPath:`(transformed) ${r}`}),t}function tj(t,{validation:e=!0,debugPath:r="block"}={}){return t=ki(r,t,{header:Yn(d8),uncles:zn(Yn(mO)),transactions:zn(Yn(_O)),proposals:zn(Ne)}),e&&Ui.ValidateBlock(t,{debugPath:`(transformed) ${r}`}),t}function rj(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=ki(r,t,{lock:Yn(sy),message:Ne}),e&&Ui.ValidateCellbaseWitness(t,{debugPath:`(transformed) ${r}`}),t}function nj(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=ki(r,t,{lock:Ne,inputType:Ne,outputType:Ne}),e&&Ui.ValidateWitnessArgs(t,{debugPath:`(transformed) ${r}`}),t}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Reader",{enumerable:!0,get:function(){return e.Reader}}),t.validators=t.transformers=t.normalizers=t.VERSION=void 0;var e=g1,r=s(Jn);t.normalizers=r;var n=s(hi);t.transformers=n;var i=s(Mn);t.validators=i;function a(o){if(typeof WeakMap!="function")return null;var f=new WeakMap,c=new WeakMap;return(a=function(u){return u?c:f})(o)}function s(o,f){if(o&&o.__esModule)return o;if(o===null||typeof o!="object"&&typeof o!="function")return{default:o};var c=a(f);if(c&&c.has(o))return c.get(o);var u={__proto__:null},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in o)if(p!=="default"&&{}.hasOwnProperty.call(o,p)){var y=l?Object.getOwnPropertyDescriptor(o,p):null;y&&(y.get||y.set)?Object.defineProperty(u,p,y):u[p]=o[p]}return u.default=o,c&&c.set(o,u),u}t.VERSION="__development_build__"})(n8);Object.defineProperty(Xf,"__esModule",{value:!0});Xf.default=Xf.TransactionCollector=Xf.Indexer=void 0;var Nb=n8,K9=St,Q9=b1;class ij{}Xf.Indexer=ij;class wO{constructor(e,{lock:r,type:n,argsLen:i=-1,fromBlock:a,toBlock:s,order:o="asc",skip:f}={},{skipMissing:c=!1,includeStatus:u=!0}={}){if(!r&&(!n||n==="empty"))throw new Error("Either lock or type script must be provided!");if(r&&!(0,Q9.isScriptWrapper)(r)?(Nb.validators.ValidateScript(r),this.lock={script:r,ioType:"both",argsLen:i}):r&&r.script&&(Nb.validators.ValidateScript(r.script),this.lock=r,r.argsLen||(this.lock.argsLen=i),r.ioType||(this.lock.ioType="both")),n==="empty"?this.type=n:n&&!(0,Q9.isScriptWrapper)(n)?(Nb.validators.ValidateScript(n),this.type={script:n,ioType:"both",argsLen:i}):n&&n.script&&(Nb.validators.ValidateScript(n.script),this.type=n,n.argsLen||(this.type.argsLen=i),n.ioType||(this.type.ioType="both")),a&&(0,K9.assertHexadecimal)("fromBlock",a),s&&(0,K9.assertHexadecimal)("toBlock",s),o!=="asc"&&o!=="desc")throw new Error("Order must be either asc or desc!");this.indexer=e,this.skipMissing=c,this.includeStatus=u,this.fromBlock=a,this.toBlock=s,this.order=o,this.skip=f,this.rpc=e.rpc}async getTransactionHashes(){throw new Error("Not implement!")}async count(){return(await this.getTransactionHashes()).length}async*collect(){const e=await this.getTransactionHashes();for(const r of e){const n=await this.rpc.get_transaction(r);if(!this.skipMissing&&!n)throw new Error(`Transaction ${r} is missing!`);this.includeStatus?yield n:yield n.transaction}}}Xf.TransactionCollector=wO;const aj={TransactionCollector:wO};Xf.default=aj;var f2={};Object.defineProperty(f2,"__esModule",{value:!0});f2.defaultLogger=AO;f2.deprecated=sj;function AO(t,e){const r=`[${t}] ${e}`;if(t==="error"||t==="warn")return console.warn(r);console.log(`[${t}] ${e}`)}function sj(t){AO("deprecated",t)}var EO={};Object.defineProperty(EO,"__esModule",{value:!0});var xO={};Object.defineProperty(xO,"__esModule",{value:!0});(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e={values:!0,utils:!0,since:!0,helpers:!0,indexer:!0,logger:!0,blockchain:!0};t.values=t.utils=t.since=t.logger=t.indexer=t.helpers=t.blockchain=void 0;var r=p(Wa);t.values=r;var n=p(St);t.utils=n;var i=p(Pi);t.since=i;var a=p(b1);t.helpers=a;var s=p(Xf);t.indexer=s,Object.keys(s).forEach(function(y){y==="default"||y==="__esModule"||Object.prototype.hasOwnProperty.call(e,y)||y in t&&t[y]===s[y]||Object.defineProperty(t,y,{enumerable:!0,get:function(){return s[y]}})});var o=p(f2);t.logger=o;var f=p(Ee);t.blockchain=f;var c=EO;Object.keys(c).forEach(function(y){y==="default"||y==="__esModule"||Object.prototype.hasOwnProperty.call(e,y)||y in t&&t[y]===c[y]||Object.defineProperty(t,y,{enumerable:!0,get:function(){return c[y]}})});var u=xO;Object.keys(u).forEach(function(y){y==="default"||y==="__esModule"||Object.prototype.hasOwnProperty.call(e,y)||y in t&&t[y]===u[y]||Object.defineProperty(t,y,{enumerable:!0,get:function(){return u[y]}})});function l(y){if(typeof WeakMap!="function")return null;var m=new WeakMap,A=new WeakMap;return(l=function(S){return S?A:m})(y)}function p(y,m){if(y&&y.__esModule)return y;if(y===null||typeof y!="object"&&typeof y!="function")return{default:y};var A=l(m);if(A&&A.has(y))return A.get(y);var S={__proto__:null},w=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var C in y)if(C!=="default"&&{}.hasOwnProperty.call(y,C)){var O=w?Object.getOwnPropertyDescriptor(y,C):null;O&&(O.get||O.set)?Object.defineProperty(S,C,O):S[C]=y[C]}return S.default=y,A&&A.set(y,S),S}})(Ir);var sc={};Object.defineProperty(sc,"__esModule",{value:!0});var Tp=sc.bech32m=wu=sc.bech32=void 0;const oy="qpzry9x8gf2tvdw0s3jn54khce6mua7l",SO={};for(let t=0;t>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function Y9(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=zl(e)^n>>5}e=zl(e);for(let r=0;r=r;)a-=r,o.push(i>>a&s);if(n)a>0&&o.push(i<=e)return"Excess padding";if(i<f)throw new TypeError("Exceeds length limit");s=s.toLowerCase();let c=Y9(s);if(typeof c=="string")throw new Error(c);let u=s+"1";for(let l=0;l>5)throw new Error("Non 5-bit word");c=zl(c)^p,u+=oy.charAt(p)}for(let l=0;l<6;++l)c=zl(c);c^=e;for(let l=0;l<6;++l){const p=c>>(5-l)*5&31;u+=oy.charAt(p)}return u}function n(s,o){if(o=o||90,s.length<8)return s+" too short";if(s.length>o)return"Exceeds length limit";const f=s.toLowerCase(),c=s.toUpperCase();if(s!==f&&s!==c)return"Mixed-case string "+s;s=f;const u=s.lastIndexOf("1");if(u===-1)return"No separator character for "+s;if(u===0)return"Missing prefix for "+s;const l=s.slice(0,u),p=s.slice(u+1);if(p.length<6)return"Data too short";let y=Y9(l);if(typeof y=="string")return y;const m=[];for(let A=0;A=p.length)&&m.push(w)}return y!==e?"Invalid checksum for "+s:{prefix:l,words:m}}function i(s,o){const f=n(s,o);if(typeof f=="object")return f}function a(s,o){const f=n(s,o);if(typeof f=="object")return f;throw new Error(f)}return{decodeUnsafe:i,decode:a,encode:r,toWords:oj,fromWordsUnsafe:fj,fromWords:cj}}var wu=sc.bech32=IO("bech32");Tp=sc.bech32m=IO("bech32m");var v1="delete",Ct=5,ha=1<>>0;if(""+r!==e||r===4294967295)return NaN;e=r}return e<0?md(t)+e:e}function CO(){return!0}function _1(t,e,r){return(t===0&&!OO(t)||r!==void 0&&t<=-r)&&(e===void 0||r!==void 0&&e>=r)}function i0(t,e){return TO(t,e,0)}function m1(t,e){return TO(t,e,e)}function TO(t,e,r){return t===void 0?r:OO(t)?e===1/0?e:Math.max(0,e+t)|0:e===void 0||e===t?t:Math.min(e,t)|0}function OO(t){return t<0||t===0&&1/t===-1/0}var BO="@@__IMMUTABLE_ITERABLE__@@";function Tn(t){return!!(t&&t[BO])}var DO="@@__IMMUTABLE_KEYED__@@";function gt(t){return!!(t&&t[DO])}var MO="@@__IMMUTABLE_INDEXED__@@";function tn(t){return!!(t&&t[MO])}function a0(t){return gt(t)||tn(t)}var Ot=function(e){return Tn(e)?e:On(e)},Oa=function(t){function e(r){return gt(r)?r:_c(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ot),Nu=function(t){function e(r){return tn(r)?r:Ba(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ot),s0=function(t){function e(r){return Tn(r)&&!a0(r)?r:c0(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ot);Ot.Keyed=Oa;Ot.Indexed=Nu;Ot.Set=s0;var RO="@@__IMMUTABLE_SEQ__@@";function w1(t){return!!(t&&t[RO])}var LO="@@__IMMUTABLE_RECORD__@@";function vc(t){return!!(t&&t[LO])}function zi(t){return Tn(t)||vc(t)}var o0="@@__IMMUTABLE_ORDERED__@@";function Ri(t){return!!(t&&t[o0])}var A1=0,ss=1,wa=2,Y3=typeof Symbol=="function"&&Symbol.iterator,HO="@@iterator",c2=Y3||HO,tt=function(e){this.next=e};tt.prototype.toString=function(){return"[Iterator]"};tt.KEYS=A1;tt.VALUES=ss;tt.ENTRIES=wa;tt.prototype.inspect=tt.prototype.toSource=function(){return this.toString()};tt.prototype[c2]=function(){return this};function Bt(t,e,r,n){var i=t===0?e:t===1?r:[e,r];return n?n.value=i:n={value:i,done:!1},n}function Wn(){return{value:void 0,done:!0}}function b8(t){return Array.isArray(t)?!0:!!u2(t)}function V9(t){return t&&typeof t.next=="function"}function V3(t){var e=u2(t);return e&&e.call(t)}function u2(t){var e=t&&(Y3&&t[Y3]||t[HO]);if(typeof e=="function")return e}function uj(t){var e=u2(t);return e&&e===t.entries}function lj(t){var e=u2(t);return e&&e===t.keys}var f0=Object.prototype.hasOwnProperty;function g8(t){return Array.isArray(t)||typeof t=="string"?!0:t&&typeof t=="object"&&Number.isInteger(t.length)&&t.length>=0&&(t.length===0?Object.keys(t).length===1:t.hasOwnProperty(t.length-1))}var On=function(t){function e(r){return r==null?v8():zi(r)?r.toSeq():hj(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq {","}")},e.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},e.prototype.__iterate=function(n,i){var a=this._cache;if(a){for(var s=a.length,o=0;o!==s;){var f=a[i?s-++o:o++];if(n(f[1],f[0],this)===!1)break}return o}return this.__iterateUncached(n,i)},e.prototype.__iterator=function(n,i){var a=this._cache;if(a){var s=a.length,o=0;return new tt(function(){if(o===s)return Wn();var f=a[i?s-++o:o++];return Bt(n,f[0],f[1])})}return this.__iteratorUncached(n,i)},e}(Ot),_c=function(t){function e(r){return r==null?v8().toKeyedSeq():Tn(r)?gt(r)?r.toSeq():r.fromEntrySeq():vc(r)?r.toSeq():_8(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toKeyedSeq=function(){return this},e}(On),Ba=function(t){function e(r){return r==null?v8():Tn(r)?gt(r)?r.entrySeq():r.toIndexedSeq():vc(r)?r.toSeq().entrySeq():PO(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toIndexedSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq [","]")},e}(On),c0=function(t){function e(r){return(Tn(r)&&!a0(r)?r:Ba(r)).toSetSeq()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toSetSeq=function(){return this},e}(On);On.isSeq=w1;On.Keyed=_c;On.Set=c0;On.Indexed=Ba;On.prototype[RO]=!0;var Au=function(t){function e(r){this._array=r,this.size=r.length}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n,i){return this.has(n)?this._array[oc(this,n)]:i},e.prototype.__iterate=function(n,i){for(var a=this._array,s=a.length,o=0;o!==s;){var f=i?s-++o:o++;if(n(a[f],f,this)===!1)break}return o},e.prototype.__iterator=function(n,i){var a=this._array,s=a.length,o=0;return new tt(function(){if(o===s)return Wn();var f=i?s-++o:o++;return Bt(n,f,a[f])})},e}(Ba),y8=function(t){function e(r){var n=Object.keys(r).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(r):[]);this._object=r,this._keys=n,this.size=n.length}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n,i){return i!==void 0&&!this.has(n)?i:this._object[n]},e.prototype.has=function(n){return f0.call(this._object,n)},e.prototype.__iterate=function(n,i){for(var a=this._object,s=this._keys,o=s.length,f=0;f!==o;){var c=s[i?o-++f:f++];if(n(a[c],c,this)===!1)break}return f},e.prototype.__iterator=function(n,i){var a=this._object,s=this._keys,o=s.length,f=0;return new tt(function(){if(f===o)return Wn();var c=s[i?o-++f:f++];return Bt(n,c,a[c])})},e}(_c);y8.prototype[o0]=!0;var dj=function(t){function e(r){this._collection=r,this.size=r.length||r.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__iterateUncached=function(n,i){if(i)return this.cacheResult().__iterate(n,i);var a=this._collection,s=V3(a),o=0;if(V9(s))for(var f;!(f=s.next()).done&&n(f.value,o++,this)!==!1;);return o},e.prototype.__iteratorUncached=function(n,i){if(i)return this.cacheResult().__iterator(n,i);var a=this._collection,s=V3(a);if(!V9(s))return new tt(Wn);var o=0;return new tt(function(){var f=s.next();return f.done?f:Bt(n,o++,f.value)})},e}(Ba),G9;function v8(){return G9||(G9=new Au([]))}function _8(t){var e=m8(t);if(e)return e.fromEntrySeq();if(typeof t=="object")return new y8(t);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+t)}function PO(t){var e=m8(t);if(e)return e;throw new TypeError("Expected Array or collection object of values: "+t)}function hj(t){var e=m8(t);if(e)return uj(t)?e.fromEntrySeq():lj(t)?e.toSetSeq():e;if(typeof t=="object")return new y8(t);throw new TypeError("Expected Array or collection object of values, or keyed object: "+t)}function m8(t){return g8(t)?new Au(t):b8(t)?new dj(t):void 0}var NO="@@__IMMUTABLE_MAP__@@";function E1(t){return!!(t&&t[NO])}function l2(t){return E1(t)&&Ri(t)}function fy(t){return!!(t&&typeof t.equals=="function"&&typeof t.hashCode=="function")}function xr(t,e){if(t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1;if(typeof t.valueOf=="function"&&typeof e.valueOf=="function"){if(t=t.valueOf(),e=e.valueOf(),t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1}return!!(fy(t)&&fy(e)&&t.equals(e))}var rh=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(e,r){e|=0,r|=0;var n=e&65535,i=r&65535;return n*i+((e>>>16)*i+n*(r>>>16)<<16>>>0)|0};function d2(t){return t>>>1&1073741824|t&3221225471}var pj=Object.prototype.valueOf;function $n(t){if(t==null)return W9(t);if(typeof t.hashCode=="function")return d2(t.hashCode(t));var e=mj(t);if(e==null)return W9(e);switch(typeof e){case"boolean":return e?1108378657:1108378656;case"number":return bj(e);case"string":return e.length>wj?gj(e):G3(e);case"object":case"function":return vj(e);case"symbol":return yj(e);default:if(typeof e.toString=="function")return G3(e.toString());throw new Error("Value type "+typeof e+" cannot be hashed.")}}function W9(t){return t===null?1108378658:1108378659}function bj(t){if(t!==t||t===1/0)return 0;var e=t|0;for(e!==t&&(e^=t*4294967295);t>4294967295;)t/=4294967295,e^=t;return d2(e)}function gj(t){var e=C_[t];return e===void 0&&(e=G3(t),I_===Aj&&(I_=0,C_={}),I_++,C_[t]=e),e}function G3(t){for(var e=0,r=0;r0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function mj(t){return t.valueOf!==pj&&typeof t.valueOf=="function"?t.valueOf(t):t}function UO(){var t=++S_;return S_&1073741824&&(S_=0),t}var W3=typeof WeakMap=="function",X3;W3&&(X3=new WeakMap);var J9=Object.create(null),S_=0,Nc="__immutablehash__";typeof Symbol=="function"&&(Nc=Symbol(Nc));var wj=16,Aj=255,I_=0,C_={},h2=function(t){function e(r,n){this._iter=r,this._useKeys=n,this.size=r.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n,i){return this._iter.get(n,i)},e.prototype.has=function(n){return this._iter.has(n)},e.prototype.valueSeq=function(){return this._iter.valueSeq()},e.prototype.reverse=function(){var n=this,i=w8(this,!0);return this._useKeys||(i.valueSeq=function(){return n._iter.toSeq().reverse()}),i},e.prototype.map=function(n,i){var a=this,s=FO(this,n,i);return this._useKeys||(s.valueSeq=function(){return a._iter.toSeq().map(n,i)}),s},e.prototype.__iterate=function(n,i){var a=this;return this._iter.__iterate(function(s,o){return n(s,o,a)},i)},e.prototype.__iterator=function(n,i){return this._iter.__iterator(n,i)},e}(_c);h2.prototype[o0]=!0;var kO=function(t){function e(r){this._iter=r,this.size=r.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.includes=function(n){return this._iter.includes(n)},e.prototype.__iterate=function(n,i){var a=this,s=0;return i&&md(this),this._iter.__iterate(function(o){return n(o,i?a.size-++s:s++,a)},i)},e.prototype.__iterator=function(n,i){var a=this,s=this._iter.__iterator(ss,i),o=0;return i&&md(this),new tt(function(){var f=s.next();return f.done?f:Bt(n,i?a.size-++o:o++,f.value,f)})},e}(Ba),zO=function(t){function e(r){this._iter=r,this.size=r.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.has=function(n){return this._iter.includes(n)},e.prototype.__iterate=function(n,i){var a=this;return this._iter.__iterate(function(s){return n(s,s,a)},i)},e.prototype.__iterator=function(n,i){var a=this._iter.__iterator(ss,i);return new tt(function(){var s=a.next();return s.done?s:Bt(n,s.value,s.value,s)})},e}(c0),$O=function(t){function e(r){this._iter=r,this.size=r.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.entrySeq=function(){return this._iter.toSeq()},e.prototype.__iterate=function(n,i){var a=this;return this._iter.__iterate(function(s){if(s){tA(s);var o=Tn(s);return n(o?s.get(1):s[1],o?s.get(0):s[0],a)}},i)},e.prototype.__iterator=function(n,i){var a=this._iter.__iterator(ss,i);return new tt(function(){for(;;){var s=a.next();if(s.done)return s;var o=s.value;if(o){tA(o);var f=Tn(o);return Bt(n,f?o.get(0):o[0],f?o.get(1):o[1],s)}}})},e}(_c);kO.prototype.cacheResult=h2.prototype.cacheResult=zO.prototype.cacheResult=$O.prototype.cacheResult=x8;function jO(t){var e=Gs(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){var r=t.reverse.apply(this);return r.flip=function(){return t.reverse()},r},e.has=function(r){return t.includes(r)},e.includes=function(r){return t.has(r)},e.cacheResult=x8,e.__iterateUncached=function(r,n){var i=this;return t.__iterate(function(a,s){return r(s,a,i)!==!1},n)},e.__iteratorUncached=function(r,n){if(r===wa){var i=t.__iterator(r,n);return new tt(function(){var a=i.next();if(!a.done){var s=a.value[0];a.value[0]=a.value[1],a.value[1]=s}return a})}return t.__iterator(r===ss?A1:ss,n)},e}function FO(t,e,r){var n=Gs(t);return n.size=t.size,n.has=function(i){return t.has(i)},n.get=function(i,a){var s=t.get(i,Ge);return s===Ge?a:e.call(r,s,i,t)},n.__iterateUncached=function(i,a){var s=this;return t.__iterate(function(o,f,c){return i(e.call(r,o,f,c),f,s)!==!1},a)},n.__iteratorUncached=function(i,a){var s=t.__iterator(wa,a);return new tt(function(){var o=s.next();if(o.done)return o;var f=o.value,c=f[0];return Bt(i,c,e.call(r,f[1],c,t),o)})},n}function w8(t,e){var r=this,n=Gs(t);return n._iter=t,n.size=t.size,n.reverse=function(){return t},t.flip&&(n.flip=function(){var i=jO(t);return i.reverse=function(){return t.flip()},i}),n.get=function(i,a){return t.get(e?i:-1-i,a)},n.has=function(i){return t.has(e?i:-1-i)},n.includes=function(i){return t.includes(i)},n.cacheResult=x8,n.__iterate=function(i,a){var s=this,o=0;return a&&md(t),t.__iterate(function(f,c){return i(f,e?c:a?s.size-++o:o++,s)},!a)},n.__iterator=function(i,a){var s=0;a&&md(t);var o=t.__iterator(wa,!a);return new tt(function(){var f=o.next();if(f.done)return f;var c=f.value;return Bt(i,e?c[0]:a?r.size-++s:s++,c[1],f)})},n}function qO(t,e,r,n){var i=Gs(t);return n&&(i.has=function(a){var s=t.get(a,Ge);return s!==Ge&&!!e.call(r,s,a,t)},i.get=function(a,s){var o=t.get(a,Ge);return o!==Ge&&e.call(r,o,a,t)?o:s}),i.__iterateUncached=function(a,s){var o=this,f=0;return t.__iterate(function(c,u,l){if(e.call(r,c,u,l))return f++,a(c,n?u:f-1,o)},s),f},i.__iteratorUncached=function(a,s){var o=t.__iterator(wa,s),f=0;return new tt(function(){for(;;){var c=o.next();if(c.done)return c;var u=c.value,l=u[0],p=u[1];if(e.call(r,p,l,t))return Bt(a,n?l:f++,p,c)}})},i}function Ej(t,e,r){var n=Zo().asMutable();return t.__iterate(function(i,a){n.update(e.call(r,i,a,t),0,function(s){return s+1})}),n.asImmutable()}function xj(t,e,r){var n=gt(t),i=(Ri(t)?os():Zo()).asMutable();t.__iterate(function(s,o){i.update(e.call(r,s,o,t),function(f){return f=f||[],f.push(n?[o,s]:s),f})});var a=E8(t);return i.map(function(s){return ht(t,a(s))}).asImmutable()}function Sj(t,e,r){var n=gt(t),i=[[],[]];t.__iterate(function(s,o){i[e.call(r,s,o,t)?1:0].push(n?[o,s]:s)});var a=E8(t);return i.map(function(s){return ht(t,a(s))})}function A8(t,e,r,n){var i=t.size;if(_1(e,r,i))return t;if(typeof i>"u"&&(e<0||r<0))return A8(t.toSeq().cacheResult(),e,r,n);var a=i0(e,i),s=m1(r,i),o=s-a,f;o===o&&(f=o<0?0:o);var c=Gs(t);return c.size=f===0?f:t.size&&f||void 0,!n&&w1(t)&&f>=0&&(c.get=function(u,l){return u=oc(this,u),u>=0&&uf)return Wn();var A=p.next();return n||u===ss||A.done?A:u===A1?Bt(u,m-1,void 0,A):Bt(u,m-1,A.value[1],A)})},c}function Ij(t,e,r){var n=Gs(t);return n.__iterateUncached=function(i,a){var s=this;if(a)return this.cacheResult().__iterate(i,a);var o=0;return t.__iterate(function(f,c,u){return e.call(r,f,c,u)&&++o&&i(f,c,s)}),o},n.__iteratorUncached=function(i,a){var s=this;if(a)return this.cacheResult().__iterator(i,a);var o=t.__iterator(wa,a),f=!0;return new tt(function(){if(!f)return Wn();var c=o.next();if(c.done)return c;var u=c.value,l=u[0],p=u[1];return e.call(r,p,l,s)?i===wa?c:Bt(i,l,p,c):(f=!1,Wn())})},n}function KO(t,e,r,n){var i=Gs(t);return i.__iterateUncached=function(a,s){var o=this;if(s)return this.cacheResult().__iterate(a,s);var f=!0,c=0;return t.__iterate(function(u,l,p){if(!(f&&(f=e.call(r,u,l,p))))return c++,a(u,n?l:c-1,o)}),c},i.__iteratorUncached=function(a,s){var o=this;if(s)return this.cacheResult().__iterator(a,s);var f=t.__iterator(wa,s),c=!0,u=0;return new tt(function(){var l,p,y;do{if(l=f.next(),l.done)return n||a===ss?l:a===A1?Bt(a,u++,void 0,l):Bt(a,u++,l.value[1],l);var m=l.value;p=m[0],y=m[1],c&&(c=e.call(r,y,p,o))}while(c);return a===wa?l:Bt(a,p,y,l)})},i}function Cj(t,e){var r=gt(t),n=[t].concat(e).map(function(s){return Tn(s)?r&&(s=Oa(s)):s=r?_8(s):PO(Array.isArray(s)?s:[s]),s}).filter(function(s){return s.size!==0});if(n.length===0)return t;if(n.length===1){var i=n[0];if(i===t||r&>(i)||tn(t)&&tn(i))return i}var a=new Au(n);return r?a=a.toKeyedSeq():tn(t)||(a=a.toSetSeq()),a=a.flatten(!0),a.size=n.reduce(function(s,o){if(s!==void 0){var f=o.size;if(f!==void 0)return s+f}},0),a}function QO(t,e,r){var n=Gs(t);return n.__iterateUncached=function(i,a){if(a)return this.cacheResult().__iterate(i,a);var s=0,o=!1;function f(c,u){c.__iterate(function(l,p){return(!e||u0}function kb(t,e,r,n){var i=Gs(t),a=new Au(r).map(function(s){return s.size});return i.size=n?a.max():a.min(),i.__iterate=function(s,o){for(var f=this.__iterator(ss,o),c,u=0;!(c=f.next()).done&&s(c.value,u++,this)!==!1;);return u},i.__iteratorUncached=function(s,o){var f=r.map(function(l){return l=Ot(l),V3(o?l.reverse():l)}),c=0,u=!1;return new tt(function(){var l;return u||(l=f.map(function(p){return p.next()}),u=n?l.every(function(p){return p.done}):l.some(function(p){return p.done})),u?Wn():Bt(s,c++,e.apply(null,l.map(function(p){return p.value})))})},i}function ht(t,e){return t===e?t:w1(t)?e:t.constructor(e)}function tA(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function E8(t){return gt(t)?Oa:tn(t)?Nu:s0}function Gs(t){return Object.create((gt(t)?_c:tn(t)?Ba:c0).prototype)}function x8(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):On.prototype.cacheResult.call(this)}function YO(t,e){return t===void 0&&e===void 0?0:t===void 0?1:e===void 0?-1:t>e?1:t0;)e[r]=arguments[r+1];if(typeof t!="function")throw new TypeError("Invalid merger function: "+t);return ZO(this,e,t)}function ZO(t,e,r){for(var n=[],i=0;i0;)e[r]=arguments[r+1];return S1(t,e)}function eB(t,e){for(var r=[],n=arguments.length-2;n-- >0;)r[n]=arguments[n+2];return S1(e,r,t)}function tB(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];return x1(t,e)}function rB(t,e){for(var r=[],n=arguments.length-2;n-- >0;)r[n]=arguments[n+2];return x1(e,r,t)}function x1(t,e,r){return S1(t,e,Dj(r))}function S1(t,e,r){if(!fc(t))throw new TypeError("Cannot merge into non-data-structure value: "+t);if(zi(t))return typeof r=="function"&&t.mergeWith?t.mergeWith.apply(t,[r].concat(e)):t.merge?t.merge.apply(t,e):t.concat.apply(t,e);for(var n=Array.isArray(t),i=t,a=n?Nu:Oa,s=n?function(f){i===t&&(i=cy(i)),i.push(f)}:function(f,c){var u=f0.call(i,c),l=u&&r?r(i[c],f,c):f;(!u||l!==i[c])&&(i===t&&(i=cy(i)),i[c]=l)},o=0;o0;)e[r]=arguments[r+1];return x1(this,e,t)}function H8(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];return mc(this,t,Ya(),function(n){return S1(n,e)})}function P8(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];return mc(this,t,Ya(),function(n){return x1(n,e)})}function I1(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this}function C1(){return this.__ownerID?this:this.__ensureOwner(new p8)}function T1(){return this.__ensureOwner()}function N8(){return this.__altered}var Zo=function(t){function e(r){return r==null?Ya():E1(r)&&!Ri(r)?r:Ya().withMutations(function(n){var i=t(r);Ii(i.size),i.forEach(function(a,s){return n.set(s,a)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return Ya().withMutations(function(a){for(var s=0;s=n.length)throw new Error("Missing value for key: "+n[s]);a.set(n[s],n[s+1])}})},e.prototype.toString=function(){return this.__toString("Map {","}")},e.prototype.get=function(n,i){return this._root?this._root.get(0,void 0,n,i):i},e.prototype.set=function(n,i){return iA(this,n,i)},e.prototype.remove=function(n){return iA(this,n,Ge)},e.prototype.deleteAll=function(n){var i=Ot(n);return i.size===0?this:this.withMutations(function(a){i.forEach(function(s){return a.remove(s)})})},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Ya()},e.prototype.sort=function(n){return os(wd(this,n))},e.prototype.sortBy=function(n,i){return os(wd(this,i,n))},e.prototype.map=function(n,i){var a=this;return this.withMutations(function(s){s.forEach(function(o,f){s.set(f,n.call(i,o,f,a))})})},e.prototype.__iterator=function(n,i){return new Rj(this,n,i)},e.prototype.__iterate=function(n,i){var a=this,s=0;return this._root&&this._root.iterate(function(o){return s++,n(o[1],o[0],a)},i),s},e.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?U8(this.size,this._root,n,this.__hash):this.size===0?Ya():(this.__ownerID=n,this.__altered=!1,this)},e}(Oa);Zo.isMap=E1;var Mt=Zo.prototype;Mt[NO]=!0;Mt[v1]=Mt.remove;Mt.removeAll=Mt.deleteAll;Mt.setIn=B8;Mt.removeIn=Mt.deleteIn=M8;Mt.update=R8;Mt.updateIn=L8;Mt.merge=Mt.concat=WO;Mt.mergeWith=XO;Mt.mergeDeep=nB;Mt.mergeDeepWith=iB;Mt.mergeIn=H8;Mt.mergeDeepIn=P8;Mt.withMutations=I1;Mt.wasAltered=N8;Mt.asImmutable=T1;Mt["@@transducer/init"]=Mt.asMutable=C1;Mt["@@transducer/step"]=function(t,e){return t.set(e[0],e[1])};Mt["@@transducer/result"]=function(t){return t.asImmutable()};var Bp=function(e,r){this.ownerID=e,this.entries=r};Bp.prototype.get=function(e,r,n,i){for(var a=this.entries,s=0,o=a.length;s=kj)return Lj(e,c,i,a);var y=e&&e===this.ownerID,m=y?c:Cs(c);return p?f?u===l-1?m.pop():m[u]=m.pop():m[u]=[i,a]:m.push([i,a]),y?(this.entries=m,this):new Bp(e,m)}};var Ad=function(e,r,n){this.ownerID=e,this.bitmap=r,this.nodes=n};Ad.prototype.get=function(e,r,n,i){r===void 0&&(r=$n(n));var a=1<<((e===0?r:r>>>e)&Kn),s=this.bitmap;return s&a?this.nodes[aB(s&a-1)].get(e+Ct,r,n,i):i};Ad.prototype.update=function(e,r,n,i,a,s,o){n===void 0&&(n=$n(i));var f=(r===0?n:n>>>r)&Kn,c=1<=zj)return Pj(e,y,u,f,A);if(l&&!A&&y.length===2&&aA(y[p^1]))return y[p^1];if(l&&A&&y.length===1&&aA(A))return A;var S=e&&e===this.ownerID,w=l?A?u:u^c:u|c,C=l?A?sB(y,p,A,S):Uj(y,p,S):Nj(y,p,A,S);return S?(this.bitmap=w,this.nodes=C,this):new Ad(e,w,C)};var Dp=function(e,r,n){this.ownerID=e,this.count=r,this.nodes=n};Dp.prototype.get=function(e,r,n,i){r===void 0&&(r=$n(n));var a=(e===0?r:r>>>e)&Kn,s=this.nodes[a];return s?s.get(e+Ct,r,n,i):i};Dp.prototype.update=function(e,r,n,i,a,s,o){n===void 0&&(n=$n(i));var f=(r===0?n:n>>>r)&Kn,c=a===Ge,u=this.nodes,l=u[f];if(c&&!l)return this;var p=k8(l,e,r+Ct,n,i,a,s,o);if(p===l)return this;var y=this.count;if(!l)y++;else if(!p&&(y--,y<$j))return Hj(e,u,y,f);var m=e&&e===this.ownerID,A=sB(u,f,p,m);return m?(this.count=y,this.nodes=A,this):new Dp(e,y,A)};var Ed=function(e,r,n){this.ownerID=e,this.keyHash=r,this.entries=n};Ed.prototype.get=function(e,r,n,i){for(var a=this.entries,s=0,o=a.length;s>>r)&Kn,s=(r===0?n:n>>>r)&Kn,o,f=a===s?[z8(t,e,r+Ct,n,i)]:(o=new jo(e,n,i),a>>=1)s[o]=r&1?e[a++]:void 0;return s[n]=i,new Dp(t,a+1,s)}function aB(t){return t-=t>>1&1431655765,t=(t&858993459)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,t&127}function sB(t,e,r,n){var i=n?t:Cs(t);return i[e]=r,i}function Nj(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var a=new Array(i),s=0,o=0;o0&&a=0&&n>>r&Kn;if(i>=this.array.length)return new Zf([],e);var a=i===0,s;if(r>0){var o=this.array[i];if(s=o&&o.removeBefore(e,r-Ct,n),s===o&&a)return this}if(a&&!s)return this;var f=xd(this,e);if(!a)for(var c=0;c>>r&Kn;if(i>=this.array.length)return this;var a;if(r>0){var s=this.array[i];if(a=s&&s.removeAfter(e,r-Ct,n),a===s&&i===this.array.length-1)return this}var o=xd(this,e);return o.array.splice(i+1),a&&(o.array[i]=a),o};var Jh={};function sA(t,e){var r=t._origin,n=t._capacity,i=Rp(n),a=t._tail;return s(t._root,t._level,0);function s(c,u,l){return u===0?o(c,l):f(c,u,l)}function o(c,u){var l=u===i?a&&a.array:c&&c.array,p=u>r?0:r-u,y=n-u;return y>ha&&(y=ha),function(){if(p===y)return Jh;var m=e?--y:p++;return l&&l[m]}}function f(c,u,l){var p,y=c&&c.array,m=l>r?0:r-l>>u,A=(n-l>>u)+1;return A>ha&&(A=ha),function(){for(;;){if(p){var S=p();if(S!==Jh)return S;p=null}if(m===A)return Jh;var w=e?--A:m++;p=s(y&&y[w],u-Ct,l+(w<=t.size||e<0)return t.withMutations(function(s){e<0?Ef(s,e).set(0,r):Ef(s,0,e+1).set(e,r)});e+=t._origin;var n=t._tail,i=t._root,a=Q3();return e>=Rp(t._capacity)?n=Z3(n,t.__ownerID,0,e,r,a):i=Z3(i,t.__ownerID,t._level,e,r,a),a.value?t.__ownerID?(t._root=i,t._tail=n,t.__hash=void 0,t.__altered=!0,t):Mp(t._origin,t._capacity,t._level,i,n):t}function Z3(t,e,r,n,i,a){var s=n>>>r&Kn,o=t&&s0){var c=t&&t.array[s],u=Z3(c,e,r-Ct,n,i,a);return u===c?t:(f=xd(t,e),f.array[s]=u,f)}return o&&t.array[s]===i?t:(a&&pa(a),f=xd(t,e),i===void 0&&s===f.array.length-1?f.array.pop():f.array[s]=i,f)}function xd(t,e){return e&&t&&e===t.ownerID?t:new Zf(t?t.array.slice():[],e)}function fB(t,e){if(e>=Rp(t._capacity))return t._tail;if(e<1<0;)r=r.array[e>>>n&Kn],n-=Ct;return r}}function Ef(t,e,r){e!==void 0&&(e|=0),r!==void 0&&(r|=0);var n=t.__ownerID||new p8,i=t._origin,a=t._capacity,s=i+e,o=r===void 0?a:r<0?a+r:i+r;if(s===i&&o===a)return t;if(s>=o)return t.clear();for(var f=t._level,c=t._root,u=0;s+u<0;)c=new Zf(c&&c.array.length?[void 0,c]:[],n),f+=Ct,u+=1<=1<l?new Zf([],n):y;if(y&&p>l&&sCt;S-=Ct){var w=l>>>S&Kn;A=A.array[w]=xd(A.array[w],n)}A.array[l>>>Ct&Kn]=y}if(o=p)s-=p,o-=p,f=Ct,c=null,m=m&&m.removeBefore(n,0,s);else if(s>i||p>>f&Kn;if(C!==p>>>f&Kn)break;C&&(u+=(1<i&&(c=c.removeBefore(n,f,s-u)),c&&p>>Ct<=ha&&i.size>=n.size*2?(f=i.filter(function(c,u){return c!==void 0&&a!==u}),o=f.toKeyedSeq().map(function(c){return c[0]}).flip().toMap(),t.__ownerID&&(o.__ownerID=f.__ownerID=t.__ownerID)):(o=n.remove(e),f=a===i.size-1?i.pop():i.set(a,void 0))}else if(s){if(r===i.get(a)[1])return t;o=n,f=i.set(a,[e,r])}else o=n.set(e,i.size),f=i.set(i.size,[e,r]);return t.__ownerID?(t.size=o.size,t._map=o,t._list=f,t.__hash=void 0,t.__altered=!0,t):$8(o,f)}var cB="@@__IMMUTABLE_STACK__@@";function Lp(t){return!!(t&&t[cB])}var O1=function(t){function e(r){return r==null?zb():Lp(r)?r:zb().pushAll(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("Stack [","]")},e.prototype.get=function(n,i){var a=this._head;for(n=oc(this,n);a&&n--;)a=a.next;return a?a.value:i},e.prototype.peek=function(){return this._head&&this._head.value},e.prototype.push=function(){var n=arguments;if(arguments.length===0)return this;for(var i=this.size+arguments.length,a=this._head,s=arguments.length-1;s>=0;s--)a={value:n[s],next:a};return this.__ownerID?(this.size=i,this._head=a,this.__hash=void 0,this.__altered=!0,this):Ih(i,a)},e.prototype.pushAll=function(n){if(n=t(n),n.size===0)return this;if(this.size===0&&Lp(n))return n;Ii(n.size);var i=this.size,a=this._head;return n.__iterate(function(s){i++,a={value:s,next:a}},!0),this.__ownerID?(this.size=i,this._head=a,this.__hash=void 0,this.__altered=!0,this):Ih(i,a)},e.prototype.pop=function(){return this.slice(1)},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):zb()},e.prototype.slice=function(n,i){if(_1(n,i,this.size))return this;var a=i0(n,this.size),s=m1(i,this.size);if(s!==this.size)return t.prototype.slice.call(this,n,i);for(var o=this.size-a,f=this._head;a--;)f=f.next;return this.__ownerID?(this.size=o,this._head=f,this.__hash=void 0,this.__altered=!0,this):Ih(o,f)},e.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?Ih(this.size,this._head,n,this.__hash):this.size===0?zb():(this.__ownerID=n,this.__altered=!1,this)},e.prototype.__iterate=function(n,i){var a=this;if(i)return new Au(this.toArray()).__iterate(function(f,c){return n(f,c,a)},i);for(var s=0,o=this._head;o&&n(o.value,s++,this)!==!1;)o=o.next;return s},e.prototype.__iterator=function(n,i){if(i)return new Au(this.toArray()).__iterator(n,i);var a=0,s=this._head;return new tt(function(){if(s){var o=s.value;return s=s.next,Bt(n,a++,o)}return Wn()})},e}(Nu);O1.isStack=Lp;var Xn=O1.prototype;Xn[cB]=!0;Xn.shift=Xn.pop;Xn.unshift=Xn.push;Xn.unshiftAll=Xn.pushAll;Xn.withMutations=I1;Xn.wasAltered=N8;Xn.asImmutable=T1;Xn["@@transducer/init"]=Xn.asMutable=C1;Xn["@@transducer/step"]=function(t,e){return t.unshift(e)};Xn["@@transducer/result"]=function(t){return t.asImmutable()};function Ih(t,e,r,n){var i=Object.create(Xn);return i.size=t,i._head=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}var uA;function zb(){return uA||(uA=Ih(0))}var uB="@@__IMMUTABLE_SET__@@";function B1(t){return!!(t&&t[uB])}function v2(t){return B1(t)&&Ri(t)}function j8(t,e){if(t===e)return!0;if(!Tn(e)||t.size!==void 0&&e.size!==void 0&&t.size!==e.size||t.__hash!==void 0&&e.__hash!==void 0&&t.__hash!==e.__hash||gt(t)!==gt(e)||tn(t)!==tn(e)||Ri(t)!==Ri(e))return!1;if(t.size===0&&e.size===0)return!0;var r=!a0(t);if(Ri(t)){var n=t.entries();return e.every(function(f,c){var u=n.next().value;return u&&xr(u[1],f)&&(r||xr(u[0],c))})&&n.next().done}var i=!1;if(t.size===void 0)if(e.size===void 0)typeof t.cacheResult=="function"&&t.cacheResult();else{i=!0;var a=t;t=e,e=a}var s=!0,o=e.__iterate(function(f,c){if(r?!t.has(f):i?!xr(f,t.get(c,Ge)):!xr(t.get(c,Ge),f))return s=!1,!1});return s&&t.size===o}function Uu(t,e){var r=function(n){t.prototype[n]=e[n]};return Object.keys(e).forEach(r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(r),t}function uy(t){if(!t||typeof t!="object")return t;if(!Tn(t)){if(!fc(t))return t;t=On(t)}if(gt(t)){var e={};return t.__iterate(function(n,i){e[i]=uy(n)}),e}var r=[];return t.__iterate(function(n){r.push(uy(n))}),r}var u0=function(t){function e(r){return r==null?Ch():B1(r)&&!Ri(r)?r:Ch().withMutations(function(n){var i=t(r);Ii(i.size),i.forEach(function(a){return n.add(a)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(n){return this(Oa(n).keySeq())},e.intersect=function(n){return n=Ot(n).toArray(),n.length?rn.intersect.apply(e(n.pop()),n):Ch()},e.union=function(n){return n=Ot(n).toArray(),n.length?rn.union.apply(e(n.pop()),n):Ch()},e.prototype.toString=function(){return this.__toString("Set {","}")},e.prototype.has=function(n){return this._map.has(n)},e.prototype.add=function(n){return $b(this,this._map.set(n,n))},e.prototype.remove=function(n){return $b(this,this._map.remove(n))},e.prototype.clear=function(){return $b(this,this._map.clear())},e.prototype.map=function(n,i){var a=this,s=!1,o=$b(this,this._map.mapEntries(function(f){var c=f[1],u=n.call(i,c,c,a);return u!==c&&(s=!0),[u,u]},i));return s?o:this},e.prototype.union=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return n=n.filter(function(a){return a.size!==0}),n.length===0?this:this.size===0&&!this.__ownerID&&n.length===1?this.constructor(n[0]):this.withMutations(function(a){for(var s=0;s=0&&i=0&&athis.size?r:this.find(function(n,i){return i===e},void 0,r)},has:function(e){return e=oc(this,e),e>=0&&(this.size!==void 0?this.size===1/0||ee?-1:0}function Qj(t){if(t.size===1/0)return 0;var e=Ri(t),r=gt(t),n=e?1:0,i=t.__iterate(r?e?function(a,s){n=31*n+gA($n(a),$n(s))|0}:function(a,s){n=n+gA($n(a),$n(s))|0}:e?function(a){n=31*n+$n(a)|0}:function(a){n=n+$n(a)|0});return Yj(i,n)}function Yj(t,e){return e=rh(e,3432918353),e=rh(e<<15|e>>>-15,461845907),e=rh(e<<13|e>>>-13,5),e=(e+3864292196|0)^t,e=rh(e^e>>>16,2246822507),e=rh(e^e>>>13,3266489909),e=d2(e^e>>>16),e}function gA(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}var Eu=function(t){function e(r){return r==null?J3():v2(r)?r:J3().withMutations(function(n){var i=s0(r);Ii(i.size),i.forEach(function(a){return n.add(a)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(n){return this(Oa(n).keySeq())},e.prototype.toString=function(){return this.__toString("OrderedSet {","}")},e}(u0);Eu.isOrderedSet=v2;var ku=Eu.prototype;ku[o0]=!0;ku.zip=l0.zip;ku.zipWith=l0.zipWith;ku.zipAll=l0.zipAll;ku.__empty=J3;ku.__make=pB;function pB(t,e){var r=Object.create(ku);return r.size=t?t.size:0,r._map=t,r.__ownerID=e,r}var yA;function J3(){return yA||(yA=pB(Sh()))}var bB={LeftThenRight:-1,RightThenLeft:1};function Vj(t){if(vc(t))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(zi(t))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(t===null||typeof t!="object")throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}var pr=function(e,r){var n;Vj(e);var i=function(o){var f=this;if(o instanceof i)return o;if(!(this instanceof i))return new i(o);if(!n){n=!0;var c=Object.keys(e),u=a._indices={};a._name=r,a._keys=c,a._defaultValues=e;for(var l=0;l2?[]:void 0,{"":t})}function vB(t,e,r,n,i,a){if(typeof r!="string"&&!zi(r)&&(g8(r)||b8(r)||p2(r))){if(~t.indexOf(r))throw new TypeError("Cannot convert circular structure to Immutable");t.push(r),i&&n!==""&&i.push(n);var s=e.call(a,n,On(r).map(function(o,f){return vB(t,e,o,f,i,r)}),i&&i.slice());return t.pop(),i&&i.pop(),s}return r}function Wj(t,e){return tn(e)?e.toList():gt(e)?e.toMap():e.toSet()}var _B="4.3.7",Xj={version:_B,Collection:Ot,Iterable:Ot,Seq:On,Map:Zo,OrderedMap:os,List:Aa,Stack:O1,Set:u0,OrderedSet:Eu,PairSorting:bB,Record:pr,Range:F8,Repeat:gB,is:xr,fromJS:yB,hash:$n,isImmutable:zi,isCollection:Tn,isKeyed:gt,isIndexed:tn,isAssociative:a0,isOrdered:Ri,isValueObject:fy,isPlainObject:p2,isSeq:w1,isList:y2,isMap:E1,isOrderedMap:l2,isStack:Lp,isSet:B1,isOrderedSet:v2,isRecord:vc,get:b2,getIn:_2,has:I8,hasIn:q8,merge:JO,mergeDeep:tB,mergeWith:eB,mergeDeepWith:rB,remove:C8,removeIn:D8,set:T8,setIn:O8,update:g2,updateIn:mc},Zj=Ot;const Jj=Object.freeze(Object.defineProperty({__proto__:null,Collection:Ot,Iterable:Zj,List:Aa,Map:Zo,OrderedMap:os,OrderedSet:Eu,PairSorting:bB,Range:F8,Record:pr,Repeat:gB,Seq:On,Set:u0,Stack:O1,default:Xj,fromJS:yB,get:b2,getIn:_2,has:I8,hasIn:q8,hash:$n,is:xr,isAssociative:a0,isCollection:Tn,isImmutable:zi,isIndexed:tn,isKeyed:gt,isList:y2,isMap:E1,isOrdered:Ri,isOrderedMap:l2,isOrderedSet:v2,isPlainObject:p2,isRecord:vc,isSeq:w1,isSet:B1,isStack:Lp,isValueObject:fy,merge:JO,mergeDeep:tB,mergeDeepWith:rB,mergeWith:eB,remove:C8,removeIn:D8,set:T8,setIn:O8,update:g2,updateIn:mc,version:_B},Symbol.toStringTag,{value:"Module"})),Jo=eS(Jj);var Nr={},mB={};Object.defineProperty(mB,"__esModule",{value:!0});var zu={},wB=function t(e){Object.freeze(e);var r=typeof e=="function",n=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach(function(i){n.call(e,i)&&(!r||i!=="caller"&&i!=="callee"&&i!=="arguments")&&e[i]!==null&&(typeof e[i]=="object"||typeof e[i]=="function")&&!Object.isFrozen(e[i])&&t(e[i])}),e},d0={};Object.defineProperty(d0,"__esModule",{value:!0});d0.createConfig=Y8;d0.predefined=void 0;var eF=tF(wB);function tF(t){return t&&t.__esModule?t:{default:t}}function Y8(t){return(0,eF.default)(t)}const rF=Y8({PREFIX:"ckb",SCRIPTS:{SECP256K1_BLAKE160:{CODE_HASH:"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",HASH_TYPE:"type",TX_HASH:"0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c",INDEX:"0x0",DEP_TYPE:"depGroup",SHORT_ID:0},SECP256K1_BLAKE160_MULTISIG:{CODE_HASH:"0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8",HASH_TYPE:"type",TX_HASH:"0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c",INDEX:"0x1",DEP_TYPE:"depGroup",SHORT_ID:1},DAO:{CODE_HASH:"0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e",HASH_TYPE:"type",TX_HASH:"0xe2fb199810d49a4d8beec56718ba2593b665db9d52299a0f9e6e75416d73ff5c",INDEX:"0x2",DEP_TYPE:"code"},SUDT:{CODE_HASH:"0x5e7a36a77e68eecc013dfa2fe6a23f3b6c344b04005808694ae6dd45eea4cfd5",HASH_TYPE:"type",TX_HASH:"0xc7813f6a415144643970c2e88e0bb6ca6a8edc5dd7c1022746f628284a9936d5",INDEX:"0x0",DEP_TYPE:"code"},ANYONE_CAN_PAY:{CODE_HASH:"0xd369597ff47f29fbc0d47d2e3775370d1250b85140c670e4718af712983a2354",HASH_TYPE:"type",TX_HASH:"0x4153a2014952d7cac45f285ce9a7c5c0c0e1b21f2d378b82ac1433cb11c25c4d",INDEX:"0x0",DEP_TYPE:"depGroup",SHORT_ID:2},OMNILOCK:{CODE_HASH:"0x9b819793a64463aed77c615d6cb226eea5487ccfc0783043a587254cda2b6f26",HASH_TYPE:"type",TX_HASH:"0xc76edf469816aa22f416503c38d0b533d2a018e253e379f134c3985b3472c842",INDEX:"0x0",DEP_TYPE:"code"},XUDT:{CODE_HASH:"0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95",HASH_TYPE:"data1",TX_HASH:"0xc07844ce21b38e4b071dd0e1ee3b0e27afd8d7532491327f39b786343f558ab7",INDEX:"0x0",DEP_TYPE:"code"}}}),nF=Y8({PREFIX:"ckt",SCRIPTS:{SECP256K1_BLAKE160:{CODE_HASH:"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",HASH_TYPE:"type",TX_HASH:"0xf8de3bb47d055cdf460d93a2a6e1b05f7432f9777c8c474abf4eec1d4aee5d37",INDEX:"0x0",DEP_TYPE:"depGroup",SHORT_ID:0},SECP256K1_BLAKE160_MULTISIG:{CODE_HASH:"0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8",HASH_TYPE:"type",TX_HASH:"0xf8de3bb47d055cdf460d93a2a6e1b05f7432f9777c8c474abf4eec1d4aee5d37",INDEX:"0x1",DEP_TYPE:"depGroup",SHORT_ID:1},DAO:{CODE_HASH:"0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e",HASH_TYPE:"type",TX_HASH:"0x8f8c79eb6671709633fe6a46de93c0fedc9c1b8a6527a18d3983879542635c9f",INDEX:"0x2",DEP_TYPE:"code"},SUDT:{CODE_HASH:"0xc5e5dcf215925f7ef4dfaf5f4b4f105bc321c02776d6e7d52a1db3fcd9d011a4",HASH_TYPE:"type",TX_HASH:"0xe12877ebd2c3c364dc46c5c992bcfaf4fee33fa13eebdf82c591fc9825aab769",INDEX:"0x0",DEP_TYPE:"code"},ANYONE_CAN_PAY:{CODE_HASH:"0x3419a1c09eb2567f6552ee7a8ecffd64155cffe0f1796e6e61ec088d740c1356",HASH_TYPE:"type",TX_HASH:"0xec26b0f85ed839ece5f11c4c4e837ec359f5adc4420410f6453b1f6b60fb96a6",INDEX:"0x0",DEP_TYPE:"depGroup",SHORT_ID:2},OMNILOCK:{CODE_HASH:"0xf329effd1c475a2978453c8600e1eaf0bc2087ee093c3ee64cc96ec6847752cb",HASH_TYPE:"type",TX_HASH:"0xec18bf0d857c981c3d1f4e17999b9b90c484b303378e94de1a57b0872f5d4602",INDEX:"0x0",DEP_TYPE:"code"},XUDT:{CODE_HASH:"0x25c29dc317811a6f6f3985a7a9ebc4838bd388d19d0feeecf0bcd60f6c0975bb",HASH_TYPE:"type",TX_HASH:"0xbf6fb538763efec2a70a6a3dcb7242787087e1030c4e7d86585bc63a9d337f5f",INDEX:"0x0",DEP_TYPE:"code"}}});d0.predefined={LINA:rF,AGGRON4:nF};Object.defineProperty(zu,"__esModule",{value:!0});zu.assertHashType=AB;zu.getConfig=cF;zu.initializeConfig=uF;zu.validateConfig=EB;var iF=sF(wB),aF=d0;function sF(t){return t&&t.__esModule?t:{default:t}}function oF(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(`${t} must be a hex string!`)}function vA(t,e){if(oF(t,e),e.length!==66)throw new Error(`${t} must be a hex string of 66 characters long!`)}function fF(t,e){if(e!=="0x0"&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(`${t} must be a hex integer!`)}function AB(t,e){if(e!=="type"&&e!=="data"&&e!=="data1"&&e!=="data2")throw new Error(`${t} must one of type, data, data1, data2!`)}function _A(t,e="variable"){if(!t)throw new Error(`${e} is not valid`)}function EB(t){_A(typeof t.SCRIPTS=="object"&&t.SCRIPTS!=null,"config.SCRIPT");for(const e of Object.keys(t.SCRIPTS)){const r=t.SCRIPTS[e];_A(r==null?void 0:r.CODE_HASH),vA(`SCRIPTS.${e}.CODE_HASH`,r.CODE_HASH),AB(`SCRIPTS.${e}.HASH_TYPE`,r.HASH_TYPE),vA(`SCRIPTS.${e}.TX_HASH`,r.TX_HASH),fF(`SCRIPTS.${e}.INDEX`,r.INDEX);const n=r.DEP_TYPE;if(n!=="depGroup"&&n!=="code")throw new Error(`SCRIPTS.${e}.DEP_TYPE must either be depGroup or code!`);const i=r.SHORT_ID;if(i!=null&&typeof i!="number")throw new Error("SHORT_ID must be a number!")}}let xB=aF.predefined.LINA;function cF(){return xB}function uF(t){EB(t),xB=(0,iF.default)(t)}var m2={};Object.defineProperty(m2,"__esModule",{value:!0});m2.findConfigByScript=lF;m2.nameOfScript=dF;var SB=zu;function lF(t,e){const r=e||(0,SB.getConfig)().SCRIPTS;return Object.values(r).find(n=>(n==null?void 0:n.CODE_HASH)===t.codeHash&&(n==null?void 0:n.HASH_TYPE)===t.hashType)}function dF(t,e){const r=e||(0,SB.getConfig)().SCRIPTS,n=Object.entries(r).find(([,i])=>(i==null?void 0:i.CODE_HASH)===t.codeHash&&(i==null?void 0:i.HASH_TYPE)===t.hashType);if(n)return n[0]}var Ci={};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.SIGHASH_OUTPUT_LOC=Ci.SIGHASH_GROUP_OUTPUT_LOC=Ci.MULTISIG_OUTPUT_LOC=Ci.MULTISIG_GROUP_OUTPUT_LOC=Ci.DAO_OUTPUT_LOC=void 0;Ci.generateGenesisScriptConfigs=pF;var hF=Ir;const mA=Ci.SIGHASH_OUTPUT_LOC=[0,1],wA=Ci.MULTISIG_OUTPUT_LOC=[0,4],AA=Ci.DAO_OUTPUT_LOC=[0,2],EA=Ci.SIGHASH_GROUP_OUTPUT_LOC=[1,0],xA=Ci.MULTISIG_GROUP_OUTPUT_LOC=[1,1];function pF(t){if(!t||Number(t.header.number)!==0)throw new Error("The block must be a genesis block");const e=t.transactions;return{SECP256K1_BLAKE160:{...M_({transaction:e[mA[0]],outputIndex:mA[1],depGroupTransaction:e[EA[0]],depGroupOutputIndex:EA[1]}),SHORT_ID:0},SECP256K1_BLAKE160_MULTISIG:{...M_({transaction:e[wA[0]],outputIndex:wA[1],depGroupTransaction:e[xA[0]],depGroupOutputIndex:xA[1]}),SHORT_ID:1},DAO:M_({transaction:e[AA[0]],outputIndex:AA[1]})}}function M_(t){var e;const{transaction:r,outputIndex:n}=t,i=hF.utils.computeScriptHash(R_((e=r.outputs[n])===null||e===void 0?void 0:e.type));if("depGroupTransaction"in t){const{depGroupOutputIndex:a,depGroupTransaction:s}=t;return{HASH_TYPE:"type",CODE_HASH:i,DEP_TYPE:"depGroup",TX_HASH:R_(s.hash),INDEX:SA(a)}}return{HASH_TYPE:"type",CODE_HASH:i,DEP_TYPE:"code",INDEX:SA(n),TX_HASH:R_(r.hash)}}function R_(t){if(t==null)throw new Error("The block must be a genesis block");return t}function SA(t){return`0x${t.toString(16)}`}var M1={};Object.defineProperty(M1,"__esModule",{value:!0});M1.createLatestTypeIdResolver=IB;M1.createRpcResolver=bF;M1.refreshScriptConfigs=gF;function bF(t){return IB(async n=>{const i=await t.createBatchRequest(n.map(a=>["getTransaction",a])).exec();return ly(n,i,(a,s)=>{if(!(s!=null&&s.transaction))throw new Error(`Cannot find transaction ${a}`);return s.transaction})},async n=>(await t.createBatchRequest(n.map(a=>["getCells",{script:a,scriptType:"type",scriptSearchMode:"exact",withData:!1},"asc","0x1"])).exec()).map(a=>a.objects[0]))}function IB(t,e){return async r=>{const n=await t(r.map(s=>s.txHash)),i=ly(r,n,(s,o)=>(ep(s),ep(o,`Cannot find the OutPoint ${s.txHash}#${s.index}`),o.outputs[Number(s.index)].type)),a=await e(i.filter(Boolean));return ly(r,i,(s,o)=>{if(ep(s),!o)return s;const[f]=a.splice(0,1);return f.outPoint})}}async function gF(t,{resolve:e,skip:r=["SECP256K1_BLAKE160","SECP256K1_BLAKE160_MULTISIG","DAO"]}){const n=Object.entries(t).filter(([o,f])=>!r.includes(o)&&(f==null?void 0:f.HASH_TYPE)==="type"),i=n.map(([o,f])=>({txHash:f.TX_HASH,index:f.INDEX})),a=await e(i),s=Object.fromEntries(ly(n,a,(o,f)=>{ep(o);const[c,u]=o;return ep(f,`Refreshing failed, cannot load config of ${c}, please check whether the scriptConfig is correct`),[c,{...u,TX_HASH:f.txHash,INDEX:f.index}]}));return Object.assign({},t,s)}function ly(t,e,r){return t.map((n,i)=>r(t[i],e[i]))}function ep(t,e="Not nullable"){if(t==null)throw new Error(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e={initializeConfig:!0,getConfig:!0,validateConfig:!0,nameOfScript:!0,findConfigByScript:!0,helpers:!0,predefined:!0,createConfig:!0,generateGenesisScriptConfigs:!0,refreshScriptConfigs:!0,createRpcResolver:!0,createLatestTypeIdResolver:!0};Object.defineProperty(t,"createConfig",{enumerable:!0,get:function(){return a.createConfig}}),Object.defineProperty(t,"createLatestTypeIdResolver",{enumerable:!0,get:function(){return o.createLatestTypeIdResolver}}),Object.defineProperty(t,"createRpcResolver",{enumerable:!0,get:function(){return o.createRpcResolver}}),Object.defineProperty(t,"findConfigByScript",{enumerable:!0,get:function(){return i.findConfigByScript}}),Object.defineProperty(t,"generateGenesisScriptConfigs",{enumerable:!0,get:function(){return s.generateGenesisScriptConfigs}}),Object.defineProperty(t,"getConfig",{enumerable:!0,get:function(){return n.getConfig}}),t.helpers=void 0,Object.defineProperty(t,"initializeConfig",{enumerable:!0,get:function(){return n.initializeConfig}}),Object.defineProperty(t,"nameOfScript",{enumerable:!0,get:function(){return i.nameOfScript}}),Object.defineProperty(t,"predefined",{enumerable:!0,get:function(){return a.predefined}}),Object.defineProperty(t,"refreshScriptConfigs",{enumerable:!0,get:function(){return o.refreshScriptConfigs}}),Object.defineProperty(t,"validateConfig",{enumerable:!0,get:function(){return n.validateConfig}});var r=mB;Object.keys(r).forEach(function(u){u==="default"||u==="__esModule"||Object.prototype.hasOwnProperty.call(e,u)||u in t&&t[u]===r[u]||Object.defineProperty(t,u,{enumerable:!0,get:function(){return r[u]}})});var n=zu,i=c(m2);t.helpers=i;var a=d0,s=Ci,o=M1;function f(u){if(typeof WeakMap!="function")return null;var l=new WeakMap,p=new WeakMap;return(f=function(y){return y?p:l})(u)}function c(u,l){if(u&&u.__esModule)return u;if(u===null||typeof u!="object"&&typeof u!="function")return{default:u};var p=f(l);if(p&&p.has(u))return p.get(u);var y={__proto__:null},m=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var A in u)if(A!=="default"&&{}.hasOwnProperty.call(u,A)){var S=m?Object.getOwnPropertyDescriptor(u,A):null;S&&(S.get||S.set)?Object.defineProperty(y,A,S):y[A]=u[A]}return y.default=u,p&&p.set(u,y),y}})(Nr);var ba={};Object.defineProperty(ba,"__esModule",{value:!0});ba.ADDRESS_FORMAT_SHORT=ba.ADDRESS_FORMAT_FULLTYPE=ba.ADDRESS_FORMAT_FULLDATA=ba.ADDRESS_FORMAT_FULL=void 0;ba.parseDeprecatedCkb2019Address=EF;ba.parseFullFormatAddress=AF;var yF=Ir,Uc=st,CB=Nr,dy=sc;const TB=1023,vF=ba.ADDRESS_FORMAT_FULL=0,_F=ba.ADDRESS_FORMAT_SHORT=1,mF=ba.ADDRESS_FORMAT_FULLDATA=2,wF=ba.ADDRESS_FORMAT_FULLTYPE=4;function AF(t,{config:e}){e=e||(0,CB.getConfig)();const{words:r,prefix:n}=dy.bech32m.decode(t,TB);if(n!==e.PREFIX)throw Error(`Invalid prefix! Expected: ${e.PREFIX}, actual: ${n}`);const[i,...a]=dy.bech32m.fromWords(r);if(i!==vF)throw new Error("Invalid address format type");if(a.length<33)throw new Error("Invalid payload length, too short!");const s=Uc.bytes.hexify(a.slice(0,32)),o=yF.blockchain.HashType.unpack(a.slice(32,33)),f=Uc.bytes.hexify(a.slice(33));return{codeHash:s,hashType:o,args:f}}function EF(t,{config:e}){e=e||(0,CB.getConfig)();const{prefix:r,words:n}=dy.bech32.decode(t,TB);if(r!==e.PREFIX)throw Error(`Invalid prefix! Expected: ${e.PREFIX}, actual: ${r}`);const[i,...a]=dy.bech32.fromWords(n);switch(i){case _F:{const[s,...o]=a;if(o.length!==20)throw Error("Invalid payload length!");const f=Object.values(e.SCRIPTS).find(c=>c&&c.SHORT_ID===s);if(!f)throw Error(`Invalid code hash index: ${s}!`);return{codeHash:f.CODE_HASH,hashType:f.HASH_TYPE,args:Uc.bytes.hexify(o)}}case mF:{if(a.length<32)throw Error("Invalid payload length!");return{codeHash:Uc.bytes.hexify(a.slice(0,32)),hashType:"data",args:Uc.bytes.hexify(a.slice(32))}}case wF:{if(a.length<32)throw Error("Invalid payload length!");return{codeHash:Uc.bytes.hexify(a.slice(0,32)),hashType:"type",args:Uc.bytes.hexify(a.slice(32))}}}throw Error(`Invalid payload format type: ${i}`)}var V8={};Object.defineProperty(V8,"__esModule",{value:!0});V8.hexToByteArray=xF;function xF(t){if(!/^(0x)?([0-9a-fA-F][0-9a-fA-F])*$/.test(t))throw new Error("Invalid hex string!");t.startsWith("0x")&&(t=t.slice(2));const e=[];for(;t.length>=2;)e.push(parseInt(t.slice(0,2),16)),t=t.slice(2);return e}var G8={};Object.defineProperty(G8,"__esModule",{value:!0});G8.refreshTypeIdCellDeps=SF;async function SF(t,{resolve:e}){const r=t.cellDeps.map(({outPoint:i})=>i).toArray(),n=await e(r);return t.update("cellDeps",i=>i.map((a,s)=>({...a,outPoint:n[s]})))}var L_={},$u={};Object.defineProperty($u,"__esModule",{value:!0});$u.createModelHelper=CF;$u.defaultDeepClone=hy;var IA=st,IF=St;function CF(t){return{create:e=>t.unpack(t.pack(e)),hash:e=>IA.bytes.bytify((0,IF.ckbHash)(t.pack(e))),equals:(e,r)=>IA.bytes.equal(t.pack(e),t.pack(r)),clone:hy}}function hy(t){const e=typeof t;if(e==="number"||e==="string"||e==="boolean"||e==="bigint"||t==null)return t;if(Array.isArray(t))return t.map(hy);if(e==="object")return Object.entries(t).reduce((r,[n,i])=>Object.assign(r,{[n]:hy(i)}),{});throw new Error("Cannot clone the value: "+String(t))}var nh={},ih={},CA;function OB(){if(CA)return ih;CA=1,Object.defineProperty(ih,"__esModule",{value:!0}),ih.scriptHelper=void 0;var t=Ir,e=Nr,r=pi(),n=$u;function i(a){if(a.startsWith("ckb"))return(0,r.parseAddress)(a,{config:e.predefined.LINA});if(a.startsWith("ckt"))return(0,r.parseAddress)(a,{config:e.predefined.AGGRON4});throw new Error(`The address prefix ${a} is unknown`)}return ih.scriptHelper=(0,n.createModelHelper)({pack:a=>t.blockchain.Script.pack(typeof a=="string"?i(a):a),unpack:a=>t.blockchain.Script.unpack(a)}),ih}var R1={};Object.defineProperty(R1,"__esModule",{value:!0});R1.outPointHelper=void 0;var TF=Ir,OF=$u;R1.outPointHelper=(0,OF.createModelHelper)(TF.blockchain.OutPoint);var TA;function BF(){if(TA)return nh;TA=1,Object.defineProperty(nh,"__esModule",{value:!0}),nh.cellHelper=void 0;var t=$u,e=Ir,r=OB(),n=wt,i=st,a=c1,s=R1,o=pi();function f(u){return!u||typeof u!="object"?!1:"lock"in u}const c=(0,a.table)({cellOutput:e.blockchain.CellOutput,data:e.blockchain.Bytes,outPoint:(0,a.option)(e.blockchain.OutPoint)},["cellOutput","data","outPoint"]);return nh.cellHelper=(0,t.createModelHelper)({pack:u=>{const l=f(u)?{cellOutput:{capacity:n.BI.from(u.capacity||"0x0").toHexString(),lock:r.scriptHelper.create(u.lock),type:u.type&&r.scriptHelper.create(u.type)},outPoint:u.outPoint&&s.outPointHelper.create(u.outPoint),data:i.bytes.hexify(u.data||"0x")}:u;return n.BI.from(l.cellOutput.capacity).eq(0)&&(l.cellOutput.capacity=(0,o.minimalCellCapacityCompatible)(l).toHexString()),c.pack(l)},unpack:u=>c.unpack(u)}),nh}var OA;function DF(){return OA||(OA=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"cellHelper",{enumerable:!0,get:function(){return r.cellHelper}}),Object.defineProperty(t,"createModelHelper",{enumerable:!0,get:function(){return e.createModelHelper}}),Object.defineProperty(t,"outPointHelper",{enumerable:!0,get:function(){return i.outPointHelper}}),Object.defineProperty(t,"scriptHelper",{enumerable:!0,get:function(){return n.scriptHelper}});var e=$u,r=BF(),n=OB(),i=R1}(L_)),L_}var BA;function pi(){return BA||(BA=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e={minimalScriptCapacity:!0,minimalScriptCapacityCompatible:!0,minimalCellCapacity:!0,minimalCellCapacityCompatible:!0,locateCellDep:!0,generateAddress:!0,scriptToAddress:!0,generateSecp256k1Blake160Address:!0,generateSecp256k1Blake160MultisigAddress:!0,parseAddress:!0,addressToScript:!0,encodeToAddress:!0,encodeToConfigAddress:!0,TransactionSkeleton:!0,createTransactionFromSkeleton:!0,createTransactionSkeleton:!0,sealTransaction:!0,transactionSkeletonToObject:!0,objectToTransactionSkeleton:!0,refreshTypeIdCellDeps:!0};t.addressToScript=t.TransactionSkeleton=void 0,t.createTransactionFromSkeleton=x,t.createTransactionSkeleton=E,t.encodeToAddress=v,t.encodeToConfigAddress=d,t.generateAddress=W,t.generateSecp256k1Blake160Address=_,t.generateSecp256k1Blake160MultisigAddress=I,t.locateCellDep=K,t.minimalCellCapacity=M,t.minimalCellCapacityCompatible=U,t.minimalScriptCapacity=w,t.minimalScriptCapacityCompatible=O,t.objectToTransactionSkeleton=$,t.parseAddress=b,Object.defineProperty(t,"refreshTypeIdCellDeps",{enumerable:!0,get:function(){return p.refreshTypeIdCellDeps}}),t.scriptToAddress=void 0,t.sealTransaction=h,t.transactionSkeletonToObject=T;var r=st,n=Ir,i=sc,a=Jo,s=Nr,o=wt,f=ba,c=V8,u=n8,l=Ee,p=G8,y=DF();Object.keys(y).forEach(function(L){L==="default"||L==="__esModule"||Object.prototype.hasOwnProperty.call(e,L)||L in t&&t[L]===y[L]||Object.defineProperty(t,L,{enumerable:!0,get:function(){return y[L]}})});const{bytify:m,hexify:A}=r.bytes,S=1023;function w(L,{validate:j=!0}={}){const F=O(L,{validate:j});return BigInt(F.toString())}const C=1e8;function O(L,{validate:j=!0}={}){j&&u.validators.ValidateScript(L);let F=0;return F+=m(L.codeHash).length,F+=m(L.args).length,F+=1,o.BI.from(F).mul(C)}function M(L,{validate:j=!0}={}){const F=U(L,{validate:j});return BigInt(F.toString())}function U(L,{validate:j=!0}={}){j&&n.blockchain.CellOutput.pack(L.cellOutput);let F=8;return F+=m(L.cellOutput.lock.codeHash).length,F+=m(L.cellOutput.lock.args).length,F+=1,L.cellOutput.type&&(F+=m(L.cellOutput.type.codeHash).length,F+=m(L.cellOutput.type.args).length,F+=1),L.data&&(F+=m(L.data).length),o.BI.from(F).mul(C)}function K(L,{config:j=void 0}={}){j=j||(0,s.getConfig)();const F=Object.values(j.SCRIPTS).find(H=>H&&H.CODE_HASH===L.codeHash&&H.HASH_TYPE===L.hashType);return F?{depType:F.DEP_TYPE,outPoint:{txHash:F.TX_HASH,index:F.INDEX}}:null}let Q=!1;const k=2,G=4;function W(L,{config:j=void 0}={}){j=j||(0,s.getConfig)(),Q||(console.warn("The address format generated by generateAddress or scriptToAddress will be deprecated, please migrate to encodeToAddress to generate the new ckb2021 full format address as soon as possible"),Q=!0),u.validators.ValidateScript(L);const F=Object.values(j.SCRIPTS).find(X=>X&&X.CODE_HASH===L.codeHash&&X.HASH_TYPE===L.hashType),H=[];if(F&&F.SHORT_ID!==void 0)H.push(1,F.SHORT_ID),H.push(...(0,c.hexToByteArray)(L.args));else{if(L.hashType==="type")H.push(G);else if(L.hashType==="data")H.push(k);else throw new Error(`Invalid hashType ${L.hashType}`);H.push(...(0,c.hexToByteArray)(L.codeHash)),H.push(...(0,c.hexToByteArray)(L.args))}const q=i.bech32.toWords(H);return i.bech32.encode(j.PREFIX,q,S)}t.scriptToAddress=W;function R(L,j,{config:F=void 0}={}){F=F||(0,s.getConfig)();const H=F.SCRIPTS[j];if(!H){const X=Object.keys(F.SCRIPTS);throw new Error(`Invalid script type: ${j}, only support: ${X}`)}const q={codeHash:H.CODE_HASH,hashType:H.HASH_TYPE,args:L};return W(q,{config:F})}function _(L,{config:j=void 0}={}){return R(L,"SECP256K1_BLAKE160",{config:j})}function I(L,{config:j=void 0}={}){return R(L,"SECP256K1_BLAKE160_MULTISIG",{config:j})}function b(L,{config:j=void 0}={}){j=j||(0,s.getConfig)();try{return(0,f.parseFullFormatAddress)(L,{config:j})}catch{return(0,f.parseDeprecatedCkb2019Address)(L,{config:j})}}t.addressToScript=b;function v(L,{config:j=void 0}={}){u.validators.ValidateScript(L),j=j||(0,s.getConfig)();const F=r.bytes.concat([0],L.codeHash,l.HashType.pack(L.hashType),L.args);return i.bech32m.encode(j.PREFIX,i.bech32m.toWords(F),S)}function d(L,j,F){const H=(F==null?void 0:F.config)||(0,s.getConfig)(),q=H.SCRIPTS[j];if(!q){const te=Object.keys(H.SCRIPTS);throw new Error(`Invalid script type: ${String(j)}, only support: ${te}`)}const X={codeHash:q.CODE_HASH,hashType:q.HASH_TYPE,args:L};return v(X,{config:H})}const g=t.TransactionSkeleton=(0,a.Record)({cellProvider:null,cellDeps:(0,a.List)(),headerDeps:(0,a.List)(),inputs:(0,a.List)(),outputs:(0,a.List)(),witnesses:(0,a.List)(),fixedEntries:(0,a.List)(),signingEntries:(0,a.List)(),inputSinces:(0,a.Map)()});function x(L,{validate:j=!0}={}){const F={version:"0x0",cellDeps:L.get("cellDeps").toArray(),headerDeps:L.get("headerDeps").toArray(),inputs:L.get("inputs").map((H,q)=>{if(!H.outPoint)throw new Error(`cannot find OutPoint in Inputs[${q}] when createTransactionFromSkeleton`);return{since:L.get("inputSinces").get(q,"0x0"),previousOutput:H.outPoint}}).toArray(),outputs:L.get("outputs").map(H=>H.cellOutput).toArray(),outputsData:L.get("outputs").map(H=>H.data||"0x0").toArray(),witnesses:L.get("witnesses").toArray()};return j&&u.validators.ValidateTransaction(F),F}async function E(L,j){let F=g();F=F.update("cellDeps",X=>X.push(...L.cellDeps)),F=F.update("headerDeps",X=>X.push(...L.headerDeps));const H=await Promise.all(L.inputs.map(X=>j(X.previousOutput)));F=F.update("inputs",X=>X.push(...H)),F=F.update("inputSinces",X=>L.inputs.reduce((te,ne,N)=>te.set(N,ne.since),X));const q=L.outputs.map((X,te)=>{var ne;return{cellOutput:X,data:(ne=L.outputsData[te])!==null&&ne!==void 0?ne:"0x"}});return F=F.update("outputs",X=>X.push(...q)),F=F.update("witnesses",X=>X.push(...L.witnesses)),F}function h(L,j){const F=x(L);if(j.length!==L.get("signingEntries").size)throw new Error(`Requiring ${L.get("signingEntries").size} sealing contents but provided ${j.length}!`);return L.get("signingEntries").forEach((H,q)=>{switch(H.type){case"witness_args_lock":{const X=F.witnesses[H.index],te=n.blockchain.WitnessArgs.unpack(m(X)),ne={lock:j[q]},N=te.inputType;N&&(ne.inputType=N);const P=te.outputType;P&&(ne.outputType=P),F.witnesses[H.index]=A(n.blockchain.WitnessArgs.pack(ne));break}default:throw new Error(`Invalid signing entry type: ${H.type}`)}}),F}function T(L){return L.toJS()}function $(L){let j=(0,a.Map)();for(const[H,q]of Object.entries(L.inputSinces))j=j.set(+H,q);return g({cellProvider:L.cellProvider,cellDeps:(0,a.List)(L.cellDeps),headerDeps:(0,a.List)(L.headerDeps),inputs:(0,a.List)(L.inputs),outputs:(0,a.List)(L.outputs),witnesses:(0,a.List)(L.witnesses),fixedEntries:(0,a.List)(L.fixedEntries),signingEntries:(0,a.List)(L.signingEntries),inputSinces:j})}}(A_)),A_}var w2=pi(),BB,DB,MB,RB,LB,HB;const h0=Symbol("immutable"),Oi=Symbol("cellDeps"),fi=Symbol("headerDeps"),uu=Symbol("witness"),Hs=Symbol("since");class xn{constructor(e){this[BB]=!0,this.codeHash=e.codeHash,this.hashType=e.hashType,this.args=e.args,this[Oi]=Object.freeze(e[Oi]),this[fi]=Object.freeze(e[fi]),this[uu]=e[uu],this[Hs]=e[Hs]}static from(e){return Object.freeze(e instanceof xn?e:new xn(e))}}BB=h0;const va=xn.from({codeHash:"0x0000000000000000000000000000000000000000000000000000000000000000",hashType:"data",args:"0x",[Oi]:[],[fi]:[],[uu]:void 0,[Hs]:"0x0"});class Fo{constructor(e){this[DB]=!0,this.txHash=e.txHash,this.index=e.index}static from(e){return Object.freeze(e instanceof Fo?e:new Fo(e))}}DB=h0;class Hp{constructor(e){this[MB]=!0,this.capacity=e.capacity,this.lock=xn.from(e.lock),this.type=e.type?xn.from(e.type):void 0}static from(e){return Object.freeze(e instanceof Hp?e:new Hp(e))}}MB=h0;class Yt{constructor(e){this[RB]=!0;const{capacity:r,lock:n,type:i}={lock:va,capacity:"0x0",...e.cellOutput,...e};this.cellOutput=Hp.from({capacity:r,lock:n,type:i}),this.data=e.data??"0x",this.outPoint=e.outPoint?Fo.from(e.outPoint):void 0,this.blockHash=e.blockHash,this.blockNumber=e.blockNumber,this.txIndex=e.txIndex,BigInt(r)<=0n&&(this.cellOutput=Hp.from({capacity:w2.minimalCellCapacityCompatible(this,{validate:!1}).toHexString(),lock:n,type:i}))}static from(e){return Object.freeze(e instanceof Yt?e:new Yt(e))}}RB=h0;class lu{constructor(e){this[LB]=!0,this.outPoint=Fo.from(e.outPoint),this.depType=e.depType}static from(e){return Object.freeze(e instanceof lu?e:new lu(e))}}LB=h0;class Cd{constructor(e){this[HB]=!0,this.timestamp=e.timestamp,this.number=e.number,this.epoch=e.epoch,this.compactTarget=e.compactTarget,this.dao=e.dao,this.hash=e.hash,this.nonce=e.nonce,this.parentHash=e.parentHash,this.proposalsHash=e.proposalsHash,this.transactionsRoot=e.transactionsRoot,this.extraHash=e.extraHash,this.version=e.version}static from(e){return Object.freeze(e instanceof Cd?e:new Cd(e))}}HB=h0;const MF=Object.freeze(zo.Uint8);Object.freeze(zo.Uint16);const RF=Object.freeze(zo.Uint32),Td=Object.freeze({...zo.Uint64,unpack:t=>zo.Uint64.unpack(t).toBigInt()}),e6=Object.freeze({...zo.Uint128,unpack:t=>zo.Uint128.unpack(t).toBigInt()}),PB=Object.freeze(st.createFixedBytesCodec({byteLength:4,pack:t=>{const e=new Uint8Array([0,0,0,0]);return new DataView(e.buffer).setInt32(0,t,!0),e},unpack:t=>new DataView(t.buffer).getInt32(0,!0)})),LF=Object.freeze(Q4);var yi={},Od={},A2={},ef={},E2={},yn={},cc={};Object.defineProperty(cc,"__esModule",{value:!0});cc.default=cc.ErrorCode=void 0;let HF=cc.ErrorCode=function(t){return t[t.ParameterInvalid=101]="ParameterInvalid",t[t.IdNotMatch=201]="IdNotMatch",t[t.MethodNotFound=202]="MethodNotFound",t[t.PayloadMessage=203]="PayloadMessage",t[t.ResponseMessage=204]="ResponseMessage",t}({});cc.default=HF;Object.defineProperty(yn,"__esModule",{value:!0});yn.default=yn.StringHashTypeException=yn.PageSizeTooSmallException=yn.PageSizeTooLargeException=yn.OutputsValidatorTypeException=yn.HexStringWithout0xException=yn.BigintOrHexStringTypeException=void 0;var p0=PF(cc);function PF(t){return t&&t.__esModule?t:{default:t}}class NB extends RangeError{constructor(r,n){super(`Expect page size to be at most ${n}, but ${r} received`);Vr(this,"code",p0.default.ParameterInvalid)}}yn.PageSizeTooLargeException=NB;class UB extends RangeError{constructor(r,n){super(`Expect page size to be at least ${n}, but ${r} received`);Vr(this,"code",p0.default.ParameterInvalid)}}yn.PageSizeTooSmallException=UB;class kB extends TypeError{constructor(){super("Expect outputs validator to be 'default' or 'passthrough'");Vr(this,"code",p0.default.ParameterInvalid)}}yn.OutputsValidatorTypeException=kB;class zB extends TypeError{constructor(r){super(`Expect number to be bigint or hex string, but ${r} received`);Vr(this,"code",p0.default.ParameterInvalid)}}yn.BigintOrHexStringTypeException=zB;class $B extends TypeError{constructor(r){super(`Expect hash to be string, but ${r} received`);Vr(this,"code",p0.default.ParameterInvalid)}}yn.StringHashTypeException=$B;class jB extends Error{constructor(r){super(`Hex string ${r} should start with 0x`);Vr(this,"code",p0.default.ParameterInvalid)}}yn.HexStringWithout0xException=jB;yn.default={PageSizeTooLargeException:NB,PageSizeTooSmallException:UB,OutputsValidatorTypeException:kB,BigintOrHexStringTypeException:zB,StringHashTypeException:$B,HexStringWithout0xException:jB};var Mo={};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.default=Mo.ResponseException=Mo.IdNotMatchException=void 0;var FB=NF(cc);function NF(t){return t&&t.__esModule?t:{default:t}}class qB extends Error{constructor(r,n){super(`Expect json rpc id to be ${r}, but ${n} received`);Vr(this,"code",FB.default.IdNotMatch)}}Mo.IdNotMatchException=qB;class KB extends Error{constructor(){super(...arguments);Vr(this,"code",FB.default.ResponseMessage)}}Mo.ResponseException=KB;Mo.default={IdNotMatchException:qB,ResponseException:KB};var Os={};Object.defineProperty(Os,"__esModule",{value:!0});Os.default=Os.PayloadInBatchException=Os.MethodInBatchNotFoundException=Os.IdNotMatchedInBatchException=void 0;var QB=kF(cc),UF=Mo;function kF(t){return t&&t.__esModule?t:{default:t}}const W8="Batch Request";class YB extends Error{constructor(r){super(`[${W8}]: Method ${r} is not found`);Vr(this,"code",QB.default.MethodNotFound)}}Os.MethodInBatchNotFoundException=YB;class VB extends Error{constructor(r,n){super(`[${W8} ${r}]: ${n}`);Vr(this,"code",QB.default.PayloadMessage);this.index=r}}Os.PayloadInBatchException=VB;class GB extends UF.IdNotMatchException{constructor(e,r,n){super(r,n),this.message=`[${W8} ${e}]: ${this.message}`,this.index=e}}Os.IdNotMatchedInBatchException=GB;Os.default={MethodInBatchNotFoundException:YB,PayloadInBatchException:VB,IdNotMatchedInBatchException:GB};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=yn;Object.keys(e).forEach(function(i){i==="default"||i==="__esModule"||i in t&&t[i]===e[i]||Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[i]}})});var r=Mo;Object.keys(r).forEach(function(i){i==="default"||i==="__esModule"||i in t&&t[i]===r[i]||Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[i]}})});var n=Os;Object.keys(n).forEach(function(i){i==="default"||i==="__esModule"||i in t&&t[i]===n[i]||Object.defineProperty(t,i,{enumerable:!0,get:function(){return n[i]}})})})(E2);Object.defineProperty(ef,"__esModule",{value:!0});ef.formatter=void 0;var rl=E2,H_=wt;const ur=ef.formatter={toOptional:t=>e=>!t||e===void 0||e===null?e:t(e),toArray:t=>e=>typeof t!="function"||!Array.isArray(e)?e:e.map(t),toHash:t=>{if(typeof t!="string")throw new rl.StringHashTypeException(t);return t.startsWith("0x")?t:`0x${t}`},toNumber:t=>{if(typeof t=="bigint")return`0x${t.toString(16)}`;if(typeof t!="string")throw new rl.BigintOrHexStringTypeException(t);if(!t.startsWith("0x"))throw new rl.HexStringWithout0xException(t);return t},toScript:t=>{const{codeHash:e,hashType:r,...n}=t;return{code_hash:ur.toHash(e),hash_type:r,...n}},toOutPoint:t=>{const{txHash:e,index:r,...n}=t;return{tx_hash:ur.toHash(e),index:ur.toNumber(r),...n}},toInput:t=>{if(!t)return t;const{previousOutput:e,since:r,...n}=t;return{previous_output:ur.toOutPoint(e),since:ur.toNumber(r),...n}},toOutput:t=>{if(!t)return t;const{capacity:e,lock:r,type:n=void 0,...i}=t;return{capacity:ur.toNumber(e),lock:ur.toScript(r),type:n&&ur.toScript(n),...i}},toDepType:t=>t==="depGroup"?"dep_group":t,toOrder:t=>t,toCellDep:t=>{if(!t)return t;const{outPoint:e,depType:r="code",...n}=t;return{out_point:ur.toOutPoint(e),dep_type:ur.toDepType(r),...n}},toRawTransaction:t=>{if(!t)return t;const{version:e,cellDeps:r=[],inputs:n=[],outputs:i=[],outputsData:a=[],headerDeps:s=[],...o}=t,f=n.map(p=>ur.toInput(p)),c=i.map(p=>ur.toOutput(p)),u=r.map(p=>ur.toCellDep(p));return{version:ur.toNumber(e),cell_deps:u,inputs:f,outputs:c,outputs_data:a,header_deps:s,...o}},toPageNumber:(t="0x1")=>ur.toNumber(t),toPageSize:(t="0x32")=>{const e=H_.BI.from(t),r=50,n=0;if(H_.BI.from(e).gt(r))throw new rl.PageSizeTooLargeException(t,r);if(H_.BI.from(e).lt(n))throw new rl.PageSizeTooSmallException(t,n);return ur.toNumber(`0x${e.toString(16)}`)},toReverseOrder:(t=!1)=>!!t,toOutputsValidator:t=>{if(!t)return;if(["default","passthrough"].indexOf(t)>-1)return t;throw new rl.OutputsValidatorTypeException},toBoolean:t=>!!t,toTransactionProof:t=>{if(!t)return t;const{blockHash:e,witnessesRoot:r,...n}=t;return{block_hash:e,witnesses_root:r,...n}},toTransactionAndWitnessProof:t=>({block_hash:t.blockHash,witnesses_proof:t.witnessesProof,transactions_proof:t.transactionsProof}),toSearchFilter:t=>t&&{script:t.script?ur.toScript(t.script):t.script,output_data_len_range:t.outputDataLenRange,output_capacity_range:t.outputCapacityRange,block_range:t.blockRange,script_len_range:t.scriptLenRange},toSearchKey:t=>t&&{script:ur.toScript(t.script),script_type:t.scriptType,filter:t.filter?ur.toSearchFilter(t.filter):t.filter,script_search_mode:t.scriptSearchMode?t.scriptSearchMode:"prefix"},toGetCellsSearchKey:t=>t&&{...ur.toSearchKey(t),with_data:t.withData},toGetTransactionsSearchKey:t=>t&&{...ur.toSearchKey(t),group_by_transaction:t.groupByTransaction}};var he={};Object.defineProperty(he,"__esModule",{value:!0});he.toBannedAddresses=he.toBannedAddress=he.toArray=he.toAlertMessage=void 0;he.toBlock=JB;he.toHash=he.toGetTransactionsResult=he.toGetCellsResult=he.toForkBlockResult=he.toFeeRateStatistics=he.toFeeRate=he.toEstimateCycles=he.toEpoch=he.toDeploymentsInfo=he.toDeploymentInfo=he.toDeployment=he.toDeployState=he.toDepType=he.toConsensus=he.toCellsIncludingOutPoint=he.toCellsCapacity=he.toCells=he.toCellbaseOutputCapacityDetails=he.toCellIncludingOutPoint=he.toCellDep=he.toCell=he.toCapacityByLockHash=he.toBlockchainInfo=he.toBlockFilter=he.toBlockEconomicState=void 0;he.toHeader=x2;he.toTip=he.toSyncState=he.toScript=he.toRemoteNodeInfo=he.toRawTxPool=he.toPeers=he.toOutput=he.toOutPoint=he.toNumber=he.toNullable=he.toLockHashIndexStates=he.toLockHashIndexState=he.toLocalNodeInfo=he.toLiveCellsByLockHash=he.toLiveCellWithStatus=he.toLiveCell=he.toInput=void 0;he.toTransaction=I2;he.toUncleBlock=he.toTxPoolInfo=he.toTransactionsByLockHash=he.toTransactionWithStatus=he.toTransactionProof=he.toTransactionPoint=he.toTransactionAndWitnessProof=void 0;const zF=t=>Array.isArray(t.pending),$F=t=>e=>typeof t!="function"||!Array.isArray(e)?e:e.map(t);he.toArray=$F;const jF=t=>e=>!t||e===null?e:t(e);he.toNullable=jF;const FF=t=>t.toString();he.toNumber=FF;const qF=t=>t;he.toHash=qF;function x2(t){if(typeof t=="string"||!t)return t;const{compact_target:e,transactions_root:r,proposals_hash:n,extra_hash:i,parent_hash:a,...s}=t;return{compactTarget:e,parentHash:a,transactionsRoot:r,proposalsHash:n,extraHash:i,...s}}const Bd=t=>{if(!t)return t;const{code_hash:e,hash_type:r,...n}=t;return{codeHash:e,hashType:r,...n}};he.toScript=Bd;const WB=t=>{if(!t)return t;const{previous_output:e,...r}=t;return{previousOutput:e&&L1(e),...r}};he.toInput=WB;const S2=t=>{if(!t)return t;const{lock:e,type:r,...n}=t;return{lock:Bd(e),type:r&&Bd(r),...n}};he.toOutput=S2;const L1=t=>{const{tx_hash:e,...r}=t;return{txHash:e,...r}};he.toOutPoint=L1;const XB=t=>t==="dep_group"?"depGroup":t;he.toDepType=XB;const ZB=t=>{if(!t)return t;const{out_point:e,dep_type:r="code",...n}=t;return{outPoint:L1(e),depType:XB(r),...n}};he.toCellDep=ZB;function I2(t){if(!t||typeof t!="object")return t;const{cell_deps:e=[],inputs:r=[],outputs:n=[],outputs_data:i=[],header_deps:a=[],...s}=t;return{cellDeps:e.map(ZB),inputs:r.map(WB),outputs:n.map(S2),outputsData:i,headerDeps:a,...s}}const X8=t=>{if(!t)return t;const{header:e,...r}=t;return{header:x2(e),...r}};he.toUncleBlock=X8;const KF=t=>({blockHash:t.block_hash,blockNumber:t.block_number});he.toTip=KF;function JB(t){if(!t||typeof t=="string")return t;if("block"in t&&"cycles"in t)return{cycles:t.cycles,block:JB(t.block)};const{header:e,uncles:r=[],transactions:n=[],...i}=t;return{header:x2(e),uncles:r.map(X8),transactions:n.map(I2),...i}}const eD=t=>{if(!t)return t;const{notice_until:e,...r}=t;return{noticeUntil:e,...r}};he.toAlertMessage=eD;const QF=t=>{if(!t)return t;const{is_initial_block_download:e,median_time:r,alerts:n,...i}=t;return{isInitialBlockDownload:e,medianTime:r,alerts:n.map(eD),...i}};he.toBlockchainInfo=QF;const YF=t=>{if(!t)return t;const{node_id:e,protocols:r,...n}=t;return{nodeId:e,protocols:r.map(({id:i,name:a,support_versions:s})=>({id:i,name:a,supportVersions:s})),...n}};he.toLocalNodeInfo=YF;const tD=t=>{if(!t)return t;const{node_id:e,connected_duration:r,is_outbound:n,last_ping_duration:i,sync_state:a,...s}=t;return{nodeId:e,connectedDuration:r,isOutbound:n,lastPingDuration:i,syncState:{bestKnownHeaderHash:a.best_known_header_hash,bestKnownHeaderNumber:a.best_known_header_number,canFetchCount:a.can_fetch_count,inflightCount:a.inflight_count,lastCommonHeaderHash:a.last_common_header_hash,lastCommonHeaderNumber:a.last_common_header_number,unknownHeaderListSize:a.unknown_header_list_size},...s}};he.toRemoteNodeInfo=tD;const VF=t=>{if(!t)return t;const{last_txs_updated_at:e,tip_hash:r,tip_number:n,total_tx_cycles:i,total_tx_size:a,min_fee_rate:s,min_rbf_rate:o,tx_size_limit:f,max_tx_pool_size:c,...u}=t;return{lastTxsUpdatedAt:e,tipHash:r,tipNumber:n,totalTxCycles:i,totalTxSize:a,minFeeRate:s,minRbfRate:o,txSizeLimit:f,maxTxPoolSize:c,...u}};he.toTxPoolInfo=VF;const GF=t=>Array.isArray(t)?t.map(tD):[];he.toPeers=GF;const Z8=t=>{if(!t)return t;const{lock:e,type:r,...n}=t;return{lock:Bd(e),type:r?Bd(r):void 0,...n}};he.toCell=Z8;const rD=t=>{if(!t)return t;const{data:e,output:r,...n}=t;return{data:e,output:S2(r),...n}};he.toLiveCell=rD;const WF=t=>{if(!t)return t;const{cell:e,...r}=t;return{cell:rD(e),...r}};he.toLiveCellWithStatus=WF;const XF=t=>Array.isArray(t)?t.map(Z8):[];he.toCells=XF;const nD=t=>{if(!t)return t;const{lock:e,block_hash:r,out_point:n,output_data_len:i,...a}=t;return{blockHash:r,lock:Bd(e),outPoint:L1(n),outputDataLen:i,...a}};he.toCellIncludingOutPoint=nD;const ZF=t=>Array.isArray(t)?t.map(nD):[];he.toCellsIncludingOutPoint=ZF;const JF=t=>{if(!t)return t;const{transaction:e,tx_status:{block_hash:r,status:n},time_added_to_pool:i,min_replace_fee:a,fee:s,...o}=t;return{transaction:I2(e),txStatus:{blockHash:r,status:n,..."reason"in t.tx_status?{reason:t.tx_status.reason}:{}},timeAddedToPool:i,minReplaceFee:a,fee:s,...o}};he.toTransactionWithStatus=JF;const eq=t=>{if(!t)return t;const{start_number:e,compact_target:r,...n}=t;return{compactTarget:r,startNumber:e,...n}};he.toEpoch=eq;const py=t=>{if(!t)return t;const{block_number:e,tx_hash:r,...n}=t;return{blockNumber:e,txHash:r,...n}};he.toTransactionPoint=py;const tq=t=>t&&t.map(e=>({consumedBy:e.consumed_by?py(e.consumed_by):e.consumed_by,createdBy:py(e.created_by)}));he.toTransactionsByLockHash=tq;const rq=t=>t&&t.map(e=>({cellOutput:Z8(e.cell_output),createdBy:py(e.created_by),cellbase:e.cellbase,outputDataLen:e.output_data_len}));he.toLiveCellsByLockHash=rq;const iD=t=>{if(!t)return t;const{block_hash:e,block_number:r,lock_hash:n,...i}=t;return{blockHash:e,blockNumber:r,lockHash:n,...i}};he.toLockHashIndexState=iD;const nq=t=>t&&t.map(iD);he.toLockHashIndexStates=nq;const aD=t=>{if(!t)return t;const{ban_reason:e,ban_until:r,created_at:n,...i}=t;return{banReason:e,banUntil:r,createdAt:n,...i}};he.toBannedAddress=aD;const iq=t=>t&&t.map(e=>aD(e));he.toBannedAddresses=iq;const aq=t=>{if(!t)return t;const{proposal_reward:e,tx_fee:r,...n}=t;return{proposalReward:e,txFee:r,...n}};he.toCellbaseOutputCapacityDetails=aq;const sq=t=>{if(!t)return t;const{fee_rate:e,...r}=t;return{feeRate:e,...r}};he.toFeeRate=sq;const oq=t=>{if(!t)return t;const{cells_count:e,block_number:r,capacity:n,...i}=t;return{blockNumber:r,capacity:n,cellsCount:e,...i}};he.toCapacityByLockHash=oq;const fq=t=>{if(!t)return t;const{finalized_at:e,miner_reward:r,txs_fee:n,...i}=t;return{finalizedAt:e,minerReward:r,txsFee:n,...i}};he.toBlockEconomicState=fq;const cq=t=>t&&{bestKnownBlockNumber:t.best_known_block_number,bestKnownBlockTimestamp:t.best_known_block_timestamp,fastTime:t.fast_time,ibd:t.ibd,inflightBlocksCount:t.inflight_blocks_count,lowTime:t.low_time,normalTime:t.normal_time,orphanBlocksCount:t.orphan_blocks_count};he.toSyncState=cq;const uq=t=>{if(!t)return t;const{block_hash:e,witnesses_root:r,...n}=t;return{blockHash:e,witnessesRoot:r,...n}};he.toTransactionProof=uq;const lq=t=>({rfc:t.rfc,epochNumber:t.epoch_number}),sD=t=>({bit:t.bit,start:t.start,timeout:t.timeout,minActivationEpoch:t.min_activation_epoch,period:t.period,threshold:t.threshold});he.toDeployment=sD;const DA=t=>"rfc0043"in t?{status:t.status,rfc0043:sD(t.rfc0043)}:t,dq=t=>{if(!t)return t;const e=t.hardfork_features,r=t.softforks,n=r.light_client&&DA(r.light_client),i=r.testdummy&&DA(r.testdummy);return{blockVersion:t.block_version,cellbaseMaturity:t.cellbase_maturity,daoTypeHash:t.dao_type_hash,epochDurationTarget:t.epoch_duration_target,genesisHash:t.genesis_hash,id:t.id,initialPrimaryEpochReward:t.initial_primary_epoch_reward,maxBlockBytes:t.max_block_bytes,maxBlockCycles:t.max_block_cycles,maxBlockProposalsLimit:t.max_block_proposals_limit,maxUnclesNum:t.max_uncles_num,medianTimeBlockCount:t.median_time_block_count,orphanRateTarget:t.orphan_rate_target,permanentDifficultyInDummy:t.permanent_difficulty_in_dummy,primaryEpochRewardHalvingInterval:t.primary_epoch_reward_halving_interval,proposerRewardRatio:t.proposer_reward_ratio,secondaryEpochReward:t.secondary_epoch_reward,secp256k1Blake160MultisigAllTypeHash:t.secp256k1_blake160_multisig_all_type_hash,secp256k1Blake160SighashAllTypeHash:t.secp256k1_blake160_sighash_all_type_hash,txProposalWindow:t.tx_proposal_window,txVersion:t.tx_version,typeIdCodeHash:t.type_id_code_hash,hardforkFeatures:e.map(lq),softforks:{...n&&{lightClient:n},...i&&{testdummy:i}}}};he.toConsensus=dq;const hq=t=>{if(!t||zF(t))return t;const e=({ancestors_count:i,ancestors_cycles:a,ancestors_size:s,...o})=>({ancestorsCount:i,ancestorsCycles:a,ancestorsSize:s,...o}),r={},n={};return Object.keys(t.proposed).forEach(i=>{r[i]=e(t.proposed[i])}),Object.keys(t.pending).forEach(i=>{n[i]=e(t.pending[i])}),{proposed:r,pending:n}};he.toRawTxPool=hq;const pq=t=>t&&{blockNumber:t.block_number,outPoint:L1(t.out_point),output:S2(t.output),outputData:t.output_data,txIndex:t.tx_index},bq=t=>({lastCursor:t.last_cursor,objects:t.objects.map(e=>pq(e))});he.toGetCellsResult=bq;const gq=t=>!t.cells,yq=t=>t&&(gq(t)?{txHash:t.tx_hash,blockNumber:t.block_number,ioIndex:t.io_index,ioType:t.io_type,txIndex:t.tx_index}:{txHash:t.tx_hash,txIndex:t.tx_index,blockNumber:t.block_number,cells:t.cells}),vq=t=>t&&{lastCursor:t.last_cursor,objects:t.objects.map(e=>yq(e))};he.toGetTransactionsResult=vq;const _q=t=>t&&{capacity:t.capacity,blockHash:t.block_hash,blockNumber:t.block_number};he.toCellsCapacity=_q;const mq=t=>({hash:t.hash,data:t.data});he.toBlockFilter=mq;const wq=t=>({blockHash:t.block_hash,transactionsProof:t.transactions_proof,witnessesProof:t.witnesses_proof});he.toTransactionAndWitnessProof=wq;const Aq=t=>({mean:t.mean,median:t.median});he.toFeeRateStatistics=Aq;const Eq=t=>typeof t=="string"?t:{header:x2(t.header),uncles:t.uncles.map(X8),transactions:t.transactions.map(I2),proposals:t.proposals,extension:t.extension};he.toForkBlockResult=Eq;const xq=t=>({cycles:t.cycles});he.toEstimateCycles=xq;const oD=t=>t==="locked_in"?"lockedIn":t;he.toDeployState=oD;const t6=t=>({bit:t.bit,start:t.start,timeout:t.timeout,minActivationEpoch:t.min_activation_epoch,period:t.period,threshold:t.threshold,since:t.since,state:oD(t.state)});he.toDeploymentInfo=t6;const Sq=t=>{const{light_client:e,testdummy:r}=t.deployments;return{hash:t.hash,epoch:t.epoch,deployments:{...e?{lightClient:t6(e)}:{},...r?{testdummy:t6(r)}:{}}}};he.toDeploymentsInfo=Sq;Object.defineProperty(A2,"__esModule",{value:!0});A2.default=void 0;var Ln=ef,ti=Iq(he);function fD(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(fD=function(n){return n?r:e})(t)}function Iq(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=fD(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}A2.default={getTipBlockNumber:{method:"get_tip_block_number",paramsFormatters:[],resultFormatters:ti.toNumber},getTipHeader:{method:"get_tip_header",paramsFormatters:[],resultFormatters:ti.toHeader},getCurrentEpoch:{method:"get_current_epoch",paramsFormatters:[],resultFormatters:ti.toEpoch},getEpochByNumber:{method:"get_epoch_by_number",paramsFormatters:[Ln.formatter.toNumber],resultFormatters:ti.toEpoch},getBlockHash:{method:"get_block_hash",paramsFormatters:[Ln.formatter.toNumber]},getBlock:{method:"get_block",paramsFormatters:[Ln.formatter.toHash],resultFormatters:ti.toBlock},getBlockByNumber:{method:"get_block_by_number",paramsFormatters:[Ln.formatter.toNumber],resultFormatters:ti.toBlock},getHeader:{method:"get_header",paramsFormatters:[Ln.formatter.toHash],resultFormatters:ti.toHeader},getHeaderByNumber:{method:"get_header_by_number",paramsFormatters:[Ln.formatter.toNumber],resultFormatters:ti.toHeader},getLiveCell:{method:"get_live_cell",paramsFormatters:[Ln.formatter.toOutPoint],resultFormatters:ti.toLiveCellWithStatus},getTransaction:{method:"get_transaction",paramsFormatters:[Ln.formatter.toHash],resultFormatters:ti.toTransactionWithStatus},getCellbaseOutputCapacityDetails:{method:"get_cellbase_output_capacity_details",paramsFormatters:[Ln.formatter.toHash],resultFormatters:ti.toCellbaseOutputCapacityDetails},getBlockEconomicState:{method:"get_block_economic_state",paramsFormatters:[Ln.formatter.toHash],resultFormatters:ti.toBlockEconomicState},getTransactionProof:{method:"get_transaction_proof",paramsFormatters:[Ln.formatter.toArray(Ln.formatter.toHash),Ln.formatter.toOptional(Ln.formatter.toHash)],resultFormatters:ti.toTransactionProof},verifyTransactionProof:{method:"verify_transaction_proof",paramsFormatters:[Ln.formatter.toTransactionProof]},getConsensus:{method:"get_consensus",paramsFormatters:[],resultFormatters:ti.toConsensus}};var C2={};Object.defineProperty(C2,"__esModule",{value:!0});C2.default=void 0;var P_=ef;C2.default={dryRunTransaction:{method:"dry_run_transaction",paramsFormatters:[P_.formatter.toRawTransaction]},calculateDaoMaximumWithdraw:{method:"calculate_dao_maximum_withdraw",paramsFormatters:[P_.formatter.toOutPoint,P_.formatter.toHash]}};var T2={};Object.defineProperty(T2,"__esModule",{value:!0});T2.default=void 0;var Cq=ef,jb=Tq(he);function cD(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(cD=function(n){return n?r:e})(t)}function Tq(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=cD(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}T2.default={localNodeInfo:{method:"local_node_info",paramsFormatters:[],resultFormatters:jb.toLocalNodeInfo},getPeers:{method:"get_peers",paramsFormatters:[],resultFormatters:jb.toPeers},getBannedAddresses:{method:"get_banned_addresses",paramsFormatters:[],resultFormatters:jb.toBannedAddresses},clearBannedAddresses:{method:"clear_banned_addresses",paramsFormatters:[]},setBan:{method:"set_ban",paramsFormatters:[]},syncState:{method:"sync_state",paramsFormatters:[],resultFormatters:jb.toSyncState},setNetworkActive:{method:"set_network_active",paramsFormatters:[Cq.formatter.toBoolean]},addNode:{method:"add_node",paramsFormatters:[]},removeNode:{method:"remove_node",paramsFormatters:[]},pingPeers:{method:"ping_peers",paramsFormatters:[]}};var O2={};Object.defineProperty(O2,"__esModule",{value:!0});O2.default=void 0;var MA=ef,N_=Oq(he);function uD(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(uD=function(n){return n?r:e})(t)}function Oq(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=uD(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}O2.default={sendTransaction:{method:"send_transaction",paramsFormatters:[MA.formatter.toRawTransaction,MA.formatter.toOutputsValidator],resultFormatters:N_.toHash},txPoolInfo:{method:"tx_pool_info",paramsFormatters:[],resultFormatters:N_.toTxPoolInfo},clearTxPool:{method:"clear_tx_pool",paramsFormatters:[]},getRawTxPool:{method:"get_raw_tx_pool",paramsFormatters:[],resultFormatters:N_.toRawTxPool}};var B2={};Object.defineProperty(B2,"__esModule",{value:!0});B2.default=void 0;var RA=Bq(he);function lD(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(lD=function(n){return n?r:e})(t)}function Bq(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=lD(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}B2.default={getBlockchainInfo:{method:"get_blockchain_info",paramsFormatters:[],resultFormatters:RA.toBlockchainInfo},getDeploymentsInfo:{method:"get_deployments_info",paramsFormatters:[],resultFormatters:RA.toDeploymentsInfo}};var D2={};Object.defineProperty(D2,"__esModule",{value:!0});D2.default=void 0;var vt=ef,Br=Dq(he);function dD(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(dD=function(n){return n?r:e})(t)}function Dq(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=dD(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}const Mq={getIndexerTip:{method:"get_indexer_tip",paramsFormatters:[],resultFormatters:Br.toTip},getCells:{method:"get_cells",paramsFormatters:[vt.formatter.toGetCellsSearchKey,vt.formatter.toOrder,vt.formatter.toNumber,vt.formatter.toOptional(vt.formatter.toHash)],resultFormatters:Br.toGetCellsResult},getTransactions:{method:"get_transactions",paramsFormatters:[vt.formatter.toGetTransactionsSearchKey,vt.formatter.toOrder,vt.formatter.toNumber,vt.formatter.toOptional(vt.formatter.toHash)],resultFormatters:Br.toGetTransactionsResult},getCellsCapacity:{method:"get_cells_capacity",paramsFormatters:[vt.formatter.toSearchKey],resultFormatters:Br.toCellsCapacity},getBlockFilter:{method:"get_block_filter",paramsFormatters:[vt.formatter.toHash],resultFormatters:Br.toNullable(Br.toBlockFilter)},getTransactionAndWitnessProof:{method:"get_transaction_and_witness_proof",paramsFormatters:[vt.formatter.toArray(vt.formatter.toHash),vt.formatter.toOptional(vt.formatter.toHash)],resultFormatters:Br.toTransactionAndWitnessProof},verifyTransactionAndWitnessProof:{method:"verify_transaction_and_witness_proof",paramsFormatters:[vt.formatter.toTransactionAndWitnessProof],resultFormatters:Br.toArray(Br.toHash)},getForkBlock:{method:"get_fork_block",paramsFormatters:[vt.formatter.toHash,vt.formatter.toOptional(vt.formatter.toNumber)],resultFormatters:Br.toNullable(Br.toForkBlockResult)},getBlockMedianTime:{method:"get_block_median_time",paramsFormatters:[vt.formatter.toHash],resultFormatters:Br.toNullable(Br.toNumber)},estimateCycles:{method:"estimate_cycles",paramsFormatters:[vt.formatter.toRawTransaction],resultFormatters:Br.toEstimateCycles},getFeeRateStatistics:{method:"get_fee_rate_statistics",paramsFormatters:[vt.formatter.toOptional(vt.formatter.toNumber)],resultFormatters:Br.toNullable(Br.toFeeRateStatistics)},getFeeRateStatics:{method:"get_fee_rate_statics",paramsFormatters:[vt.formatter.toOptional(vt.formatter.toNumber)],resultFormatters:Br.toNullable(Br.toFeeRateStatistics)}};D2.default=Mq;Object.defineProperty(Od,"__esModule",{value:!0});Od.rpcProperties=Od.Base=void 0;var Rq=b0(A2),Lq=b0(C2),Hq=b0(T2),Pq=b0(O2),Nq=b0(B2),Uq=b0(D2);function b0(t){return t&&t.__esModule?t:{default:t}}const kq=Od.rpcProperties={...Rq.default,...Lq.default,...Uq.default,...Hq.default,...Pq.default,...Nq.default};var ky,Zx;let zq=(Zx=class{constructor(){Be(this,ky,kq)}get rpcProperties(){return se(this,ky)}},ky=new WeakMap,Zx);Od.Base=zq;var ah={},M2={exports:{}};const{AbortController:hD,AbortSignal:$q}=typeof self<"u"?self:typeof window<"u"?window:void 0;M2.exports=hD;M2.exports.AbortSignal=$q;M2.exports.default=hD;var pD=M2.exports,r6={exports:{}};(function(t,e){var r=typeof self<"u"?self:Fn,n=function(){function a(){this.fetch=!1,this.DOMException=r.DOMException}return a.prototype=r,new a}();(function(a){(function(s){var o={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function f(b){return b&&DataView.prototype.isPrototypeOf(b)}if(o.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(b){return b&&c.indexOf(Object.prototype.toString.call(b))>-1};function l(b){if(typeof b!="string"&&(b=String(b)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(b))throw new TypeError("Invalid character in header field name");return b.toLowerCase()}function p(b){return typeof b!="string"&&(b=String(b)),b}function y(b){var v={next:function(){var d=b.shift();return{done:d===void 0,value:d}}};return o.iterable&&(v[Symbol.iterator]=function(){return v}),v}function m(b){this.map={},b instanceof m?b.forEach(function(v,d){this.append(d,v)},this):Array.isArray(b)?b.forEach(function(v){this.append(v[0],v[1])},this):b&&Object.getOwnPropertyNames(b).forEach(function(v){this.append(v,b[v])},this)}m.prototype.append=function(b,v){b=l(b),v=p(v);var d=this.map[b];this.map[b]=d?d+", "+v:v},m.prototype.delete=function(b){delete this.map[l(b)]},m.prototype.get=function(b){return b=l(b),this.has(b)?this.map[b]:null},m.prototype.has=function(b){return this.map.hasOwnProperty(l(b))},m.prototype.set=function(b,v){this.map[l(b)]=p(v)},m.prototype.forEach=function(b,v){for(var d in this.map)this.map.hasOwnProperty(d)&&b.call(v,this.map[d],d,this)},m.prototype.keys=function(){var b=[];return this.forEach(function(v,d){b.push(d)}),y(b)},m.prototype.values=function(){var b=[];return this.forEach(function(v){b.push(v)}),y(b)},m.prototype.entries=function(){var b=[];return this.forEach(function(v,d){b.push([d,v])}),y(b)},o.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function A(b){if(b.bodyUsed)return Promise.reject(new TypeError("Already read"));b.bodyUsed=!0}function S(b){return new Promise(function(v,d){b.onload=function(){v(b.result)},b.onerror=function(){d(b.error)}})}function w(b){var v=new FileReader,d=S(v);return v.readAsArrayBuffer(b),d}function C(b){var v=new FileReader,d=S(v);return v.readAsText(b),d}function O(b){for(var v=new Uint8Array(b),d=new Array(v.length),g=0;g-1?v:b}function k(b,v){v=v||{};var d=v.body;if(b instanceof k){if(b.bodyUsed)throw new TypeError("Already read");this.url=b.url,this.credentials=b.credentials,v.headers||(this.headers=new m(b.headers)),this.method=b.method,this.mode=b.mode,this.signal=b.signal,!d&&b._bodyInit!=null&&(d=b._bodyInit,b.bodyUsed=!0)}else this.url=String(b);if(this.credentials=v.credentials||this.credentials||"same-origin",(v.headers||!this.headers)&&(this.headers=new m(v.headers)),this.method=Q(v.method||this.method||"GET"),this.mode=v.mode||this.mode||null,this.signal=v.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&d)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(d)}k.prototype.clone=function(){return new k(this,{body:this._bodyInit})};function G(b){var v=new FormData;return b.trim().split("&").forEach(function(d){if(d){var g=d.split("="),x=g.shift().replace(/\+/g," "),E=g.join("=").replace(/\+/g," ");v.append(decodeURIComponent(x),decodeURIComponent(E))}}),v}function W(b){var v=new m,d=b.replace(/\r?\n[\t ]+/g," ");return d.split(/\r?\n/).forEach(function(g){var x=g.split(":"),E=x.shift().trim();if(E){var h=x.join(":").trim();v.append(E,h)}}),v}U.call(k.prototype);function R(b,v){v||(v={}),this.type="default",this.status=v.status===void 0?200:v.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in v?v.statusText:"OK",this.headers=new m(v.headers),this.url=v.url||"",this._initBody(b)}U.call(R.prototype),R.prototype.clone=function(){return new R(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},R.error=function(){var b=new R(null,{status:0,statusText:""});return b.type="error",b};var _=[301,302,303,307,308];R.redirect=function(b,v){if(_.indexOf(v)===-1)throw new RangeError("Invalid status code");return new R(null,{status:v,headers:{location:b}})},s.DOMException=a.DOMException;try{new s.DOMException}catch{s.DOMException=function(v,d){this.message=v,this.name=d;var g=Error(v);this.stack=g.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function I(b,v){return new Promise(function(d,g){var x=new k(b,v);if(x.signal&&x.signal.aborted)return g(new s.DOMException("Aborted","AbortError"));var E=new XMLHttpRequest;function h(){E.abort()}E.onload=function(){var T={status:E.status,statusText:E.statusText,headers:W(E.getAllResponseHeaders()||"")};T.url="responseURL"in E?E.responseURL:T.headers.get("X-Request-URL");var $="response"in E?E.response:E.responseText;d(new R($,T))},E.onerror=function(){g(new TypeError("Network request failed"))},E.ontimeout=function(){g(new TypeError("Network request failed"))},E.onabort=function(){g(new s.DOMException("Aborted","AbortError"))},E.open(x.method,x.url,!0),x.credentials==="include"?E.withCredentials=!0:x.credentials==="omit"&&(E.withCredentials=!1),"responseType"in E&&o.blob&&(E.responseType="blob"),x.headers.forEach(function(T,$){E.setRequestHeader($,T)}),x.signal&&(x.signal.addEventListener("abort",h),E.onreadystatechange=function(){E.readyState===4&&x.signal.removeEventListener("abort",h)}),E.send(typeof x._bodyInit>"u"?null:x._bodyInit)})}return I.polyfill=!0,a.fetch||(a.fetch=I,a.Headers=m,a.Request=k,a.Response=R),s.Headers=m,s.Request=k,s.Response=R,s.fetch=I,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(r6,r6.exports);var bD=r6.exports,LA;function jq(){var s,o,f,c;if(LA)return ah;LA=1,Object.defineProperty(ah,"__esModule",{value:!0}),ah.Method=void 0;var t=E2,e=R2(),r=i(pD),n=i(bD);function i(u){return u&&u.__esModule?u:{default:u}}class a{constructor(l,p,y={}){Be(this,s);Be(this,o);Be(this,f,{name:"",method:"",paramsFormatters:[],resultFormatters:void 0});Be(this,c);Vr(this,"call",async(...l)=>{const p=this.getPayload(...l),y=new r.default,m=y.signal,A=setTimeout(()=>y.abort(),se(this,o).timeout),S=await se(this,o).fetch(se(this,c).url,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(p),signal:m}).then(w=>w.json()).then(w=>{var C,O,M;if(w.id!==p.id)throw new t.IdNotMatchException(p.id,w.id);if(w.error)throw new t.ResponseException(JSON.stringify(w.error));return(C=(O=(M=se(this,f)).resultFormatters)===null||O===void 0?void 0:O.call(M,w.result))!==null&&C!==void 0?C:w.result});return clearTimeout(A),S});Vr(this,"getPayload",(...l)=>{const p=l.map((A,S)=>se(this,f).paramsFormatters[S]&&se(this,f).paramsFormatters[S](A)||A);return{id:Math.round(Math.random()*1e4),method:se(this,f).method,params:p,jsonrpc:"2.0"}});ve(this,c,l),ve(this,f,p),ve(this,s,p.name);const{timeout:m=e.DEFAULT_RPC_TIMEOUT,fetch:A=n.default}=y;ve(this,o,{timeout:m,fetch:A}),Object.defineProperty(this.call,"name",{value:p.name,configurable:!1,writable:!1})}get name(){return se(this,s)}}return s=new WeakMap,o=new WeakMap,f=new WeakMap,c=new WeakMap,ah.Method=a,ah}var HA;function R2(){var p,y,m,A;if(HA)return yi;HA=1,Object.defineProperty(yi,"__esModule",{value:!0}),yi.ResultFormatter=yi.RPC=yi.ParamsFormatter=yi.DEFAULT_RPC_TIMEOUT=yi.CKBRPC=void 0;var t=Od,e=jq(),r=ef,n=c(he),i=E2,a=o(bD),s=o(pD);function o(S){return S&&S.__esModule?S:{default:S}}function f(S){if(typeof WeakMap!="function")return null;var w=new WeakMap,C=new WeakMap;return(f=function(O){return O?C:w})(S)}function c(S,w){if(S&&S.__esModule)return S;if(S===null||typeof S!="object"&&typeof S!="function")return{default:S};var C=f(w);if(C&&C.has(S))return C.get(S);var O={__proto__:null},M=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var U in S)if(U!=="default"&&{}.hasOwnProperty.call(S,U)){var K=M?Object.getOwnPropertyDescriptor(S,U):null;K&&(K.get||K.set)?Object.defineProperty(O,U,K):O[U]=S[U]}return O.default=S,C&&C.set(S,O),O}yi.ParamsFormatter=r.formatter,yi.ResultFormatter=n;const u=yi.DEFAULT_RPC_TIMEOUT=3e4;class l extends t.Base{constructor(C,O={}){super();Be(this,p);Be(this,y,{url:""});Be(this,m,r.formatter);Be(this,A,n);Vr(this,"addMethod",(C,O)=>{const M=new e.Method(this.node,C,O);Object.defineProperty(this,C.name,{value:M.call,enumerable:!0})});Vr(this,"createBatchRequest",(C=[])=>{const O=this,M=new Proxy([],{set(...U){const K=Object.keys(O);if(U[1]!=="length"){var Q;const k=U==null||(Q=U[2])===null||Q===void 0?void 0:Q[0];if(K.indexOf(k)===-1)throw new i.MethodInBatchNotFoundException(k)}return Reflect.set(...U)}});return Object.defineProperties(M,{add:{value(...U){return this.push(U),this}},remove:{value(U){return this.splice(U,1),this}},exec:{async value(){const U=M.map(([W,...R],_)=>{try{return new e.Method(O.node,{...O.rpcProperties[W],name:W}).getPayload(...R)}catch(I){throw new i.PayloadInBatchException(_,I.message)}}),K=new s.default,Q=K.signal,k=setTimeout(()=>K.abort(),se(O,p).timeout),G=await se(O,p).fetch(se(O,y).url,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(U),signal:Q}).then(W=>W.json());return clearTimeout(k),G.map((W,R)=>{var _,I,b;return W.id!==U[R].id?new i.IdNotMatchedInBatchException(R,U[R].id,W.id):(_=(I=(b=O.rpcProperties[M[R][0]]).resultFormatters)===null||I===void 0?void 0:I.call(b,W.result))!==null&&_!==void 0?_:W.result})}}}),C.forEach(U=>M.push(U)),M});this.setNode({url:C});const{timeout:M=u,fetch:U=a.default}=O;ve(this,p,{timeout:M,fetch:U}),Object.defineProperties(this,{addMethod:{value:this.addMethod,enumerable:!1,writable:!1,configurable:!1},setNode:{value:this.setNode,enumerable:!1,writable:!1,configurable:!1}}),Object.keys(this.rpcProperties).forEach(K=>{this.addMethod({name:K,...this.rpcProperties[K]},se(this,p))})}get node(){return se(this,y)}get paramsFormatter(){return se(this,m)}get resultFormatter(){return se(this,A)}setNode(C){return Object.assign(this.node,C),this.node}}return p=new WeakMap,y=new WeakMap,m=new WeakMap,A=new WeakMap,yi.RPC=yi.CKBRPC=l,yi}var U_=R2();async function gD(t,e=qq(t),r=!1,...n){const i=Kq(e);let a=Vq(t==="mainnet"?Nr.predefined.LINA:t==="testnet"?Nr.predefined.AGGRON4:{PREFIX:"ckt",SCRIPTS:Nr.generateGenesisScriptConfigs(await i.getBlockByNumber("0x0"))}),s=a.SCRIPTS;for(const o of n)s=Object.freeze({...s,...o(t,s)});return a=new yD(a.prefix,s),Nr.initializeConfig(r?{PREFIX:"",SCRIPTS:{}}:a),{chain:t,rpcUrl:e,rpc:i,config:a}}const Fq=Object.freeze({mainnet:"https://rpc.ankr.com/nervos_ckb",testnet:"https://testnet.ckb.dev",devnet:"http://127.0.0.1:8114/"});function qq(t){return Fq[t]}function Kq(t){const e=new U_.RPC(t);return e.addMethod({name:"getCellsByLock",method:"get_cells",paramsFormatters:[r=>({script:{code_hash:r.codeHash,hash_type:r.hashType,args:r.args},script_type:"lock",script_search_mode:"exact"}),r=>r,r=>r==="max"?"0xffffffff":U_.ParamsFormatter.toNumber(r)],resultFormatters:r=>r.objects.map(({output:{capacity:n,lock:i,type:a},block_number:s,out_point:o,output_data:f,tx_index:c})=>({cellOutput:{capacity:n,lock:{codeHash:i.code_hash,hashType:i.hash_type,args:i.args},type:a?{codeHash:a.code_hash,hashType:a.hash_type,args:a.args}:void 0},data:f??"0x",outPoint:{index:o.index,txHash:o.tx_hash},blockNumber:s,txIndex:c}))}),e.addMethod({name:"getFeeRate",method:"get_fee_rate_statistics",paramsFormatters:[r=>U_.ParamsFormatter.toNumber(r)],resultFormatters:r=>!r||!r.median?1000n:BigInt(r.median)}),e}class J8 extends Error{constructor(e){super(Qq),this.missingScriptName=e,Object.setPrototypeOf(this,J8.prototype)}}const Qq="Script name not found";class yD{constructor(e,r){return this.prefix=e,this.scripts=Object.freeze(r),Object.freeze(this)}defaultScript(e){const r=this.scripts[e];if(!r)throw new J8(e);return r.defaultScript}get PREFIX(){return this.prefix}get SCRIPTS(){return this.scripts}}class tp{constructor(e,r=0){return e[Oi][r].depType,this.defaultScript=e,this.index=r,Object.freeze(this)}get CODE_HASH(){return this.defaultScript.codeHash}get HASH_TYPE(){return this.defaultScript.hashType}get TX_HASH(){return this.defaultScript[Oi][this.index].outPoint.txHash}get INDEX(){return this.defaultScript[Oi][this.index].outPoint.index}get DEP_TYPE(){return this.defaultScript[Oi][this.index].depType}}function Yq(t){if(t instanceof tp)return t;const e=lu.from({outPoint:Fo.from({txHash:t.TX_HASH,index:t.INDEX}),depType:t.DEP_TYPE});return new tp(xn.from({...va,codeHash:t.CODE_HASH,hashType:t.HASH_TYPE,[Oi]:[e]}))}function Vq(t){const e={};for(const r in t.SCRIPTS)e[r]=Yq(t.SCRIPTS[r]);return new yD(t.PREFIX,e)}var Hn={},Dn={},lt={};Object.defineProperty(lt,"__esModule",{value:!0});lt.SECP_SIGNATURE_PLACEHOLDER=void 0;lt.addCellDep=vD;lt.default=void 0;lt.ensureScript=CD;lt.generateDaoScript=_D;lt.hashWitness=yg;lt.isAcpAddress=SD;lt.isAcpScript=r5;lt.isDaoScript=ED;lt.isOmnilockAddress=Jq;lt.isOmnilockScript=wD;lt.isSecp256k1Blake160Address=mD;lt.isSecp256k1Blake160MultisigAddress=AD;lt.isSecp256k1Blake160MultisigScript=t5;lt.isSecp256k1Blake160Script=e5;lt.isSudtScript=xD;lt.prepareSigningEntries=ID;var Gq=Jo,H1=pi(),PA=st,$l=Ir,Wq=r0;const{CKBHasher:Xq,ckbHash:Zq}=$l.utils;function vD(t,e){return t.get("cellDeps").find(n=>n.depType===e.depType&&new $l.values.OutPointValue(n.outPoint,{validate:!1}).equals(new $l.values.OutPointValue(e.outPoint,{validate:!1})))||(t=t.update("cellDeps",n=>n.push({outPoint:e.outPoint,depType:e.depType}))),t}function _D(t){const e=t.SCRIPTS.DAO;return{codeHash:e.CODE_HASH,hashType:e.HASH_TYPE,args:"0x"}}function e5(t,e){const r=e.SCRIPTS.SECP256K1_BLAKE160;return t.codeHash===r.CODE_HASH&&t.hashType===r.HASH_TYPE}function mD(t,e){const r=(0,H1.parseAddress)(t,{config:e});return e5(r,e)}function wD(t,e){const r=e.SCRIPTS.OMNILOCK;return t.codeHash===r.CODE_HASH&&t.hashType===r.HASH_TYPE}function Jq(t,e){const r=(0,H1.parseAddress)(t,{config:e});return wD(r,e)}function t5(t,e){const r=e.SCRIPTS.SECP256K1_BLAKE160_MULTISIG;return t.codeHash===r.CODE_HASH&&t.hashType===r.HASH_TYPE}function AD(t,e){const r=(0,H1.parseAddress)(t,{config:e});return t5(r,e)}function ED(t,e){const r=e.SCRIPTS.DAO;return!!t&&t.codeHash===r.CODE_HASH&&t.hashType===r.HASH_TYPE}function xD(t,e){const r=e.SCRIPTS.SUDT;if(!r)throw new Error("SUDT script not defined in config!");return!!t&&t.codeHash===r.CODE_HASH&&t.hashType===r.HASH_TYPE}function r5(t,e){const r=e.SCRIPTS.ANYONE_CAN_PAY;if(!r)throw new Error("ANYONE_CAN_PAY script not defined in config!");return!!t&&t.codeHash===r.CODE_HASH&&t.hashType===r.HASH_TYPE}function SD(t,e){const r=(0,H1.parseAddress)(t,{config:e});return r5(r,e)}function yg(t,e){const r=PA.bytes.hexify(Wq.Uint64.pack(PA.bytes.bytify(e).length));t.update(r),t.update(e)}function ID(t,e,r){const n=e.SCRIPTS[r];if(!n)throw new Error(`Provided config does not have ${r} script setup!`);let i=(0,Gq.Set)();const a=(0,H1.createTransactionFromSkeleton)(t),s=Zq($l.blockchain.RawTransaction.pack(a)),o=t.get("inputs"),f=t.get("witnesses");let c=t.get("signingEntries");for(let u=0;u=f.size)throw new Error(`The first witness in the script group starting at input index ${u} does not exist, maybe some other part has invalidly tampered the transaction?`);yg(y,f.get(u));for(let A=u+1;A255)throw new Error("`R` should be less than 256!");if(e<0||e>255)throw new Error("`M` should be less than 256!");return"0x00"+("00"+t.toString(16)).slice(-2)+("00"+e.toString(16)).slice(-2)+("00"+r.length.toString(16)).slice(-2)+r.map(n=>n.slice(2)).join("")}function OD(t,e){let r="0x";return e!=null&&(r=UA.bytes.hexify(UA.number.Uint64LE.pack(e))),new rK().update(t).digestHex().slice(0,42)+r.slice(2)}function iK(t,{config:e=void 0}={}){e=e||(0,tK.getConfig)();let r,n,i,a;if(typeof t=="string")r=(0,NA.parseAddress)(t,{config:e});else if("R"in t){const s=e.SCRIPTS.SECP256K1_BLAKE160_MULTISIG;if(!s)throw new Error("Provided config does not have SECP256K1_BLAKE16_MULTISIG script setup!");n=TD(t);const o=OD(n,t.since);r={codeHash:s.CODE_HASH,hashType:s.HASH_TYPE,args:o}}else if("address"in t){const s=e.SCRIPTS.ANYONE_CAN_PAY;if(!s)throw new Error("Provided config does not have ANYONE_CAN_PAY script setup!");const o=t.address;if(r=(0,NA.parseAddress)(o,{config:e}),i=t.destroyable,r.codeHash!==s.CODE_HASH||r.hashType!==s.HASH_TYPE)throw new Error("fromInfo.address is not ANYONE_CAN_PAY address!")}else if("script"in t)r=t.script,a=t.customData;else throw new Error("Invalid fromInfo format!");return{fromScript:r,multisigScript:n,destroyable:i,customData:a}}Object.defineProperty(Dn,"__esModule",{value:!0});Dn.default=Dn.CellCollector=void 0;Dn.injectCapacity=RD;Dn.payFee=MD;Dn.prepareSigningEntries=LD;Dn.setupInputCell=BD;Dn.transfer=DD;Dn.transferCompatible=P1;var aK=Jo,Fb=pi(),jl=st,Pp=Ir,g0=Nr,Jf=lt,sK=ei,xf=wt;const{ScriptValue:Sl}=Pp.values,oK=Dn.CellCollector=class{constructor(e,r,{config:n=void 0,queryOptions:i={}}={}){if(!r)throw new Error("Cell provider is missing!");n=n||(0,g0.getConfig)(),this.fromScript=(0,sK.parseFromInfo)(e,{config:n}).fromScript,this.config=n,i={...i,lock:this.fromScript,type:i.type||"empty"},this.cellCollector=r.collector(i)}async*collect(){if((0,Jf.isSecp256k1Blake160Script)(this.fromScript,this.config))for await(const e of this.cellCollector.collect())yield e}};async function BD(t,e,r,{config:n=void 0,defaultWitness:i="0x",since:a=void 0}={}){n=n||(0,g0.getConfig)();const s=e.cellOutput.lock;if(!(0,Jf.isSecp256k1Blake160Script)(s,n))throw new Error("Not SECP256K1_BLAKE160 input!");t=t.update("inputs",l=>l.push(e));const o={cellOutput:{capacity:e.cellOutput.capacity,lock:e.cellOutput.lock,type:e.cellOutput.type},data:e.data};t=t.update("outputs",l=>l.push(o)),a&&(t=t.update("inputSinces",l=>l.set(t.get("inputs").size-1,a))),t=t.update("witnesses",l=>l.push(i));const f=n.SCRIPTS.SECP256K1_BLAKE160;if(!f)throw new Error("SECP256K1_BLAKE160 script not defined in config!");const c={txHash:f.TX_HASH,index:f.INDEX};t=(0,Jf.addCellDep)(t,{outPoint:c,depType:f.DEP_TYPE});const u=t.get("inputs").findIndex(l=>new Sl(l.cellOutput.lock,{validate:!1}).equals(new Sl(s,{validate:!1})));if(u!==-1){for(;u>=t.get("witnesses").size;)t=t.update("witnesses",y=>y.push("0x"));let l=t.get("witnesses").get(u);const p={lock:Jf.SECP_SIGNATURE_PLACEHOLDER};if(l!=="0x"){const y=Pp.blockchain.WitnessArgs.unpack(jl.bytes.bytify(l)),m=y.lock;if(m&&p.lock&&!jl.bytes.equal(m,p.lock))throw new Error("Lock field in first witness is set aside for signature!");const A=y.inputType;A&&(p.inputType=A);const S=y.outputType;S&&(p.outputType=S)}l=jl.bytes.hexify(Pp.blockchain.WitnessArgs.pack(p)),t=t.update("witnesses",y=>y.set(u,l))}return t}async function DD(t,e,r,n,{config:i=void 0,requireToAddress:a=!0,assertAmountEnough:s=!0}={}){const o=await P1(t,e,r,n,{config:i,requireToAddress:a,assertAmountEnough:s});let f,c;return o instanceof Array?(f=o[0],c=BigInt(o[1].toString()),[f,c]):(f=o,f)}async function P1(t,e,r,n,{config:i=void 0,requireToAddress:a=!0,assertAmountEnough:s=!0}={}){i=i||(0,g0.getConfig)();const o=i.SCRIPTS.SECP256K1_BLAKE160;if(!o)throw new Error("Provided config does not have SECP256K1_BLAKE160 script setup!");const f={txHash:o.TX_HASH,index:o.INDEX};t=(0,Jf.addCellDep)(t,{outPoint:f,depType:o.DEP_TYPE});const c=(0,Fb.parseAddress)(e,{config:i});if((0,Jf.ensureScript)(c,i,"SECP256K1_BLAKE160"),a&&!r)throw new Error("You must provide a to address!");let u=xf.BI.from(n);if(r){const m=(0,Fb.parseAddress)(r,{config:i});t=t.update("outputs",A=>A.push({cellOutput:{capacity:"0x"+u.toString(16),lock:m,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0}))}const l=t.get("fixedEntries").filter(({field:m})=>m==="outputs").maxBy(({index:m})=>m);let p=l?l.index+1:0;for(;pm.filter(A=>!xf.BI.from(A.cellOutput.capacity).eq(0))),u.gt(0)){const m=t.get("cellProvider");if(!m)throw new Error("Cell provider is missing!");const A=m.collector({lock:c}),S={cellOutput:{capacity:"0x0",lock:c,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0};let w=xf.BI.from(0),C=(0,aK.Set)();for(const O of t.get("inputs"))C=C.add(`${O.outPoint.txHash}_${O.outPoint.index}`);for await(const O of A.collect()){if(C.has(`${O.outPoint.txHash}_${O.outPoint.index}`))continue;t=t.update("inputs",K=>K.push(O)),t=t.update("witnesses",K=>K.push("0x"));const M=xf.BI.from(O.cellOutput.capacity);let U=M;if(U.gt(u)&&(U=u),u=u.sub(U),w=w.add(M).sub(U),u.eq(0)&&(w.eq(0)||w.gt((0,Fb.minimalCellCapacityCompatible)(S))))break}w.gt(0)&&(S.cellOutput.capacity="0x"+w.toString(16),t=t.update("outputs",O=>O.push(S)))}if(u.gt(0)&&s)throw new Error("Not enough capacity in from address!");const y=t.get("inputs").findIndex(m=>new Sl(m.cellOutput.lock,{validate:!1}).equals(new Sl(c,{validate:!1})));if(y!==-1){for(;y>=t.get("witnesses").size;)t=t.update("witnesses",S=>S.push("0x"));let m=t.get("witnesses").get(y);const A={lock:Jf.SECP_SIGNATURE_PLACEHOLDER};if(m!=="0x"){const S=Pp.blockchain.WitnessArgs.unpack(jl.bytes.bytify(m)),w=S.lock;if(w&&A.lock&&!jl.bytes.equal(w,A.lock))throw new Error("Lock field in first witness is set aside for signature!");const C=S.inputType;C&&(A.inputType=C);const O=S.outputType;O&&(A.outputType=O)}m=jl.bytes.hexify(Pp.blockchain.WitnessArgs.pack(A)),t=t.update("witnesses",S=>S.set(y,m))}return s?t:[t,xf.BI.from(u)]}async function MD(t,e,r,{config:n=void 0}={}){return n=n||(0,g0.getConfig)(),await P1(t,e,null,r,{config:n,requireToAddress:!1})}async function RD(t,e,r,{config:n=void 0}={}){if(n=n||(0,g0.getConfig)(),e>=t.get("outputs").size)throw new Error("Invalid output index!");const i=xf.BI.from(t.get("outputs").get(e).cellOutput.capacity);return await P1(t,r,null,xf.BI.from(i),{config:n,requireToAddress:!1})}function LD(t,{config:e=void 0}={}){return e=e||(0,g0.getConfig)(),(0,Jf.prepareSigningEntries)(t,e,"SECP256K1_BLAKE160")}Dn.default={transfer:DD,transferCompatible:P1,payFee:MD,prepareSigningEntries:LD,injectCapacity:RD,setupInputCell:BD,CellCollector:oK};var N1={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.CellCollector=void 0,t.injectCapacity=A,Object.defineProperty(t,"multisigArgs",{enumerable:!0,get:function(){return o.multisigArgs}}),t.payFee=m,t.prepareSigningEntries=S,Object.defineProperty(t,"serializeMultisigScript",{enumerable:!0,get:function(){return o.serializeMultisigScript}}),t.setupInputCell=l,t.transfer=p,t.transferCompatible=y;var e=pi(),r=st,n=Ir,i=Nr,a=Jo,s=lt,o=ei,f=wt;const{ScriptValue:c}=n.values,u=t.CellCollector=class{constructor(C,O,{config:M=void 0,queryOptions:U={}}={}){if(!O)throw new Error("Cell provider is missing!");M=M||(0,i.getConfig)();const K=(0,o.parseFromInfo)(C,{config:M});this.fromScript=K.fromScript,this.multisigScript=K.multisigScript,this.config=M,U={...U,lock:this.fromScript,type:U.type||"empty"},this.cellCollector=O.collector(U)}async*collect(){if((0,s.isSecp256k1Blake160MultisigScript)(this.fromScript,this.config))for await(const C of this.cellCollector.collect())yield C}};async function l(w,C,O,{config:M=void 0,defaultWitness:U="0x",since:K=void 0,requireMultisigScript:Q=!0}={}){if(M=M||(0,i.getConfig)(),Q&&typeof O!="object")throw new Error("`fromInfo` must be MultisigScript format!");const k=C.cellOutput.lock;if(O){const I=(0,o.parseFromInfo)(O,{config:M}).fromScript;if(!new c(I,{validate:!1}).equals(new c(k,{validate:!1})))throw new Error("`fromInfo` not match to input lock!")}if(!(0,s.isSecp256k1Blake160MultisigScript)(k,M))throw new Error("Not SECP256K1_BLAKE160_MULTISIG input!");w=w.update("inputs",I=>I.push(C)),K&&(w=w.update("inputSinces",I=>I.set(w.get("inputs").size-1,K))),w=w.update("witnesses",I=>I.push(U));const G={cellOutput:{capacity:C.cellOutput.capacity,lock:C.cellOutput.lock,type:C.cellOutput.type},data:C.data};w=w.update("outputs",I=>I.push(G));const W=M.SCRIPTS.SECP256K1_BLAKE160_MULTISIG;if(!W)throw new Error("SECP256K1_BLAKE160_MULTISIG script not defined in config!");const R={txHash:W.TX_HASH,index:W.INDEX};w=(0,s.addCellDep)(w,{outPoint:R,depType:W.DEP_TYPE});const _=w.get("inputs").findIndex(I=>new c(I.cellOutput.lock,{validate:!1}).equals(new c(k,{validate:!1})));if(_!==-1){for(;_>=w.get("witnesses").size;)w=w.update("witnesses",b=>b.push("0x"));if(w.get("witnesses").get(_)==="0x"&&typeof O!="object")throw new Error("`fromInfo` must be MultisigScript format!");if(typeof O=="object"){const b=(0,o.parseFromInfo)(O,{config:M}).multisigScript;let v=w.get("witnesses").get(_);const d={lock:"0x"+b.slice(2)+s.SECP_SIGNATURE_PLACEHOLDER.slice(2).repeat(O.M)};if(v!=="0x"){const g=n.blockchain.WitnessArgs.unpack(r.bytes.bytify(v)),x=g.lock;if(x&&d.lock&&!r.bytes.equal(x,d.lock))throw new Error("Lock field in first witness is set aside for signature!");const E=g.inputType;E&&(d.inputType=E);const h=g.outputType;h&&(d.outputType=h)}v=r.bytes.hexify(n.blockchain.WitnessArgs.pack(d)),w=w.update("witnesses",g=>g.set(_,v))}}return w}async function p(w,C,O,M,{config:U=void 0,requireToAddress:K=!0,assertAmountEnough:Q=!0}={}){const k=await y(w,C,O,M,{config:U,requireToAddress:K,assertAmountEnough:Q});let G,W;return k instanceof Array?(G=k[0],W=BigInt(k[1].toString()),[G,W]):(G=k,G)}async function y(w,C,O,M,{config:U=void 0,requireToAddress:K=!0,assertAmountEnough:Q=!0}={}){U=U||(0,i.getConfig)();const k=U.SCRIPTS.SECP256K1_BLAKE160_MULTISIG;if(!k)throw new Error("Provided config does not have SECP256K1_BLAKE16_MULTISIG script setup!");const G={txHash:k.TX_HASH,index:k.INDEX};w=(0,s.addCellDep)(w,{outPoint:G,depType:k.DEP_TYPE});const{fromScript:W,multisigScript:R}=(0,o.parseFromInfo)(C,{config:U});(0,s.ensureScript)(W,U,"SECP256K1_BLAKE160_MULTISIG");const _=!w.get("inputs").find(g=>new c(g.cellOutput.lock,{validate:!1}).equals(new c(W,{validate:!1})));if(_&&C==="string")throw new Error("MultisigScript is required for witness!");if(K&&!O)throw new Error("You must provide a to address!");let I=M?f.BI.from(M):f.BI.from(0);if(O){const g=(0,e.parseAddress)(O,{config:U});w=w.update("outputs",x=>x.push({cellOutput:{capacity:"0x"+I.toString(16),lock:g,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0}))}const b=w.get("fixedEntries").filter(({field:g})=>g==="outputs").maxBy(({index:g})=>g);let v=b?b.index+1:0;for(;vg.filter(x=>!f.BI.from(x.cellOutput.capacity).eq(0))),I.gt(0)){const g=w.get("cellProvider");if(!g)throw new Error("cell provider is missing!");const x=g.collector({lock:W}),E={cellOutput:{capacity:"0x0",lock:W,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0};let h=f.BI.from(0),T=(0,a.Set)();for(const $ of w.get("inputs"))T=T.add(`${$.outPoint.txHash}_${$.outPoint.index}`);for await(const $ of x.collect()){if(T.has(`${$.outPoint.txHash}_${$.outPoint.index}`))continue;w=w.update("inputs",F=>F.push($)),w=w.update("witnesses",F=>F.push("0x"));const L=f.BI.from($.cellOutput.capacity);let j=L;if(j.gt(I)&&(j=I),I=I.sub(j),h=h.add(L.sub(j)),I.eq(0)&&(h.eq(0)||h.gt((0,e.minimalCellCapacityCompatible)(E))))break}h.gt(0)&&(E.cellOutput.capacity="0x"+h.toString(16),w=w.update("outputs",$=>$.push(E)))}if(I.gt(0)&&Q)throw new Error("Not enough capacity in from address!");const d=w.get("inputs").findIndex(g=>new c(g.cellOutput.lock,{validate:!1}).equals(new c(W,{validate:!1})));if(d!==-1){for(;f.BI.from(d).gte(w.get("witnesses").size);)w=w.update("witnesses",g=>g.push("0x"));if(_||typeof C!="string"){let g=w.get("witnesses").get(d);const x={lock:"0x"+R.slice(2)+s.SECP_SIGNATURE_PLACEHOLDER.slice(2).repeat(C.M)};if(g!=="0x"){const E=n.blockchain.WitnessArgs.unpack(r.bytes.bytify(g)),h=E.lock;if(h&&x.lock&&!r.bytes.equal(h,x.lock))throw new Error("Lock field in first witness is set aside for signature!");const T=E.inputType;T&&(x.inputType=T);const $=E.outputType;$&&(x.outputType=$)}g=r.bytes.hexify(n.blockchain.WitnessArgs.pack(x)),w=w.update("witnesses",E=>E.set(d,g))}}return Q?w:[w,f.BI.from(I)]}async function m(w,C,O,{config:M=void 0}={}){return M=M||(0,i.getConfig)(),y(w,C,void 0,O,{config:M,requireToAddress:!1})}async function A(w,C,O,{config:M=void 0}={}){if(M=M||(0,i.getConfig)(),C>=w.get("outputs").size)throw new Error("Invalid output index!");const U=f.BI.from(w.get("outputs").get(C).cellOutput.capacity);return y(w,O,void 0,U,{config:M,requireToAddress:!1})}function S(w,{config:C=void 0}={}){return C=C||(0,i.getConfig)(),(0,s.prepareSigningEntries)(w,C,"SECP256K1_BLAKE160_MULTISIG")}t.default={transfer:p,transferCompatible:y,payFee:m,prepareSigningEntries:S,serializeMultisigScript:o.serializeMultisigScript,multisigArgs:o.multisigArgs,injectCapacity:A,setupInputCell:l,CellCollector:u}})(N1);var Vi={},vi={},k_={},bs={},_i={},kA;function n5(){if(kA)return _i;kA=1,Object.defineProperty(_i,"__esModule",{value:!0}),_i.CellCollector=void 0,_i.checkLimit=m,_i.default=void 0,_i.injectCapacity=S,_i.prepareSigningEntries=w,_i.setupInputCell=y,_i.setupOutputCell=A,_i.withdraw=C;var t=Ir,e=st,r=Nr,n=pi(),i=Jo,a=wt,s=ei,o=lt,f=HD();const{ScriptValue:c}=t.values,{CKBHasher:u,ckbHash:l}=t.utils,p=_i.CellCollector=class{constructor(M,U,{config:K=void 0,queryOptions:Q={}}={}){if(!U)throw new Error("Cell provider is missing!");K=K||(0,r.getConfig)(),this.fromScript=(0,s.parseFromInfo)(M,{config:K}).fromScript,this.config=K,Q={...Q,lock:this.fromScript,type:Q.type||"empty"},this.cellCollector=U.collector(Q)}async*collect(){if((0,o.isAcpScript)(this.fromScript,this.config))for await(const M of this.cellCollector.collect())yield M}};async function y(O,M,U,{config:K=void 0,defaultWitness:Q="0x",since:k=void 0}={}){K=K||(0,r.getConfig)();const G=M.cellOutput.lock;if(!(0,o.isAcpScript)(G,K))throw new Error("Not anyone-can-pay input!");O=O.update("inputs",b=>b.push(M)),k&&(O=O.update("inputSinces",b=>b.set(O.get("inputs").size-1,k))),O=O.update("witnesses",b=>b.push(Q));const W={cellOutput:{capacity:M.cellOutput.capacity,lock:M.cellOutput.lock,type:M.cellOutput.type},data:M.data};O=O.update("outputs",b=>b.push(W)),O=O.update("fixedEntries",b=>b.push({field:"outputs",index:O.get("outputs").size-1}));const R=K.SCRIPTS.ANYONE_CAN_PAY;if(!R)throw new Error("ANYONE_CAN_PAY script not defined in config!");const _={txHash:R.TX_HASH,index:R.INDEX};O=(0,o.addCellDep)(O,{outPoint:_,depType:R.DEP_TYPE});const I=O.get("inputs").findIndex(b=>new c(b.cellOutput.lock,{validate:!1}).equals(new c(G,{validate:!1})));if(I!==-1){for(;I>=O.get("witnesses").size;)O=O.update("witnesses",d=>d.push("0x"));let b=O.get("witnesses").get(I);const v={lock:o.SECP_SIGNATURE_PLACEHOLDER};if(b!=="0x"){const d=t.blockchain.WitnessArgs.unpack(e.bytes.bytify(b)),g=d.lock;if(g&&v.lock&&!e.bytes.equal(g,v.lock))throw new Error("Lock field in first witness is set aside for signature!");const x=d.inputType;x&&(v.inputType=x);const E=d.outputType;E&&(v.outputType=E)}b=e.bytes.hexify(t.blockchain.WitnessArgs.pack(v)),O=O.update("witnesses",d=>d.set(I,b))}return O}function m(O,M){const U=a.BI.from(M);let K,Q;if(O.length>=46&&(K=a.BI.from(10).pow("0x"+O.slice(44,46))),O.length>=44){const k=a.BI.from(10).pow("0x"+O.slice(42,44)),G=a.BI.from(10).pow(8);Q=k.mul(G)}if(Q&&K){if(U.lt(Q))throw new Error(`capacity(${M}) less than toAddress minimal capacity limit(${Q}), and amount less then toAddress minimal amount limit(${K})! If you want to transfer sudt, maybe sudt.transfer can help you.`)}else if(Q&&U.lt(Q))throw new Error(`capacity(${M}) less than toAddress minimal capacity limit(${Q})!`)}async function A(O,M,{config:U=void 0}={}){U=U||(0,r.getConfig)();const K=M.cellOutput.lock,Q=a.BI.from(M.cellOutput.capacity);m(K.args,Q.toString());const k=O.get("cellProvider");if(!k)throw new Error("Cell Provider is missing!");const G=(0,n.generateAddress)(K,{config:U}),R=(await new p(G,k,{config:U}).collect().next()).value;let _=Q;if(R&&(_=Q.add(R.cellOutput.capacity),O=O.update("inputs",I=>I.push(R)),O=O.update("witnesses",I=>I.push("0x"))),M.cellOutput.capacity="0x"+_.toString(16),O=O.update("outputs",I=>I.push(M)),R){const I=U.SCRIPTS.ANYONE_CAN_PAY;if(!I)throw new Error("ANYONE_CAN_PAY script not defined in config!");const b={txHash:I.TX_HASH,index:I.INDEX};O=(0,o.addCellDep)(O,{outPoint:b,depType:I.DEP_TYPE})}return O}async function S(O,M,U,K,{config:Q=void 0}={}){if(Q=Q||(0,r.getConfig)(),U>=M.get("outputs").size)throw new Error("Invalid output index!");let k=a.BI.from(K);if(!Q.SCRIPTS.ANYONE_CAN_PAY)throw new Error("Provided config does not have ANYONE_CAN_PAY script setup!");const W=O.fromScript,R=M.get("fixedEntries").filter(({field:b})=>b==="outputs").maxBy(({index:b})=>b);let _=R?R.index+1:0;for(;_b.filter(v=>!a.BI.from(v.cellOutput.capacity).eq(0)));const I=b=>`${b.outPoint.txHash}_${b.outPoint.index}`;if(k.gt(0)){const b={cellOutput:{capacity:"0x0",lock:W,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0};let v=a.BI.from(0);const d=a.BI.from((0,n.minimalCellCapacityCompatible)(b));let g=(0,i.Set)();for(const x of M.get("inputs"))g=g.add(I(x));for await(const x of O.collect()){if(g.has(I(x)))continue;M=await y(M,x,void 0,{config:Q});const E=M.get("outputs").size-1;M=M.update("outputs",L=>L.remove(E));const h=M.get("fixedEntries").findIndex(L=>L.field==="outputs"&&L.index===E);h>=0&&(M=M.update("fixedEntries",L=>L.remove(h)));const T=a.BI.from(x.cellOutput.capacity);let $=T;if($.gt(k)&&($=k),k=k.sub($),v=v.add(T.sub($)),k.eq(0)&&v.gte(d))break;b.cellOutput.capacity="0x"+v.toString(16),M=M.update("outputs",L=>L.push(b))}if(k.gt(0)||vx.push(b))}return M}function w(O,{config:M=void 0}={}){M=M||(0,r.getConfig)();const U="ANYONE_CAN_PAY",K=M.SCRIPTS[U];if(!K)throw new Error(`Provided config does not have ${U} script setup!`);let Q=(0,i.Set)();const k=(0,n.createTransactionFromSkeleton)(O),G=l(t.blockchain.RawTransaction.pack(k)),W=O.get("inputs"),R=O.get("witnesses");let _=O.get("signingEntries");for(let I=0;Inew c(j.cellOutput.lock,{validate:!1}).equals(new c(b.cellOutput.lock,{validate:!1}))),d=v.map(j=>a.BI.from(j.cellOutput.capacity)).reduce((j,F)=>j.add(F),a.BI.from(0)),g=v.filter(j=>j.data!=="0x").map(j=>(0,f.unpackAmount)(j.data)).reduce((j,F)=>j.add(F),a.BI.from(0)),x=W.filter(j=>new c(j.cellOutput.lock,{validate:!1}).equals(new c(b.cellOutput.lock,{validate:!1}))),E=x.map(j=>a.BI.from(j.cellOutput.capacity)).reduce((j,F)=>j.add(F),a.BI.from(0)),h=x.filter(j=>j.data!=="0x").map(j=>a.BI.from((0,f.unpackAmount)(j.data))).reduce((j,F)=>j.add(F),a.BI.from(0));if(E.lte(d)&&h.lte(g))continue;const T=new t.values.ScriptValue(b.cellOutput.lock,{validate:!1}),$=new u;if($.update(G),I>=R.size)throw new Error(`The first witness in the script group starting at input index ${I} does not exist, maybe some other part has invalidly tampered the transaction?`);(0,o.hashWitness)($,R.get(I));for(let j=I+1;jE.push(g)),O=O.update("witnesses",E=>E.push("0x"))}O=O.update("outputs",v=>v.push(_)),O=await y(O,M,(0,n.generateAddress)(M.cellOutput.lock,{config:Q}),{config:Q});const I=O.get("outputs").size-1;O=O.update("outputs",v=>v.remove(I));const b=O.get("fixedEntries").findIndex(v=>v.field==="outputs"&&v.index===I);return b>=0&&(O=O.update("fixedEntries",v=>v.remove(b))),k.eq(G)||(O=O.update("outputs",v=>v.push({cellOutput:{capacity:"0x"+G.sub(K).toString(16),lock:M.cellOutput.lock,type:M.cellOutput.type},data:M.data}))),O}return _i.default={CellCollector:p,setupInputCell:y,setupOutputCell:A,injectCapacity:S,prepareSigningEntries:w,withdraw:C},_i}var zA;function HD(){if(zA)return bs;zA=1,Object.defineProperty(bs,"__esModule",{value:!0}),bs.default=void 0,bs.issueToken=C,bs.ownerForSudt=U,bs.packAmount=Q,bs.transfer=O,bs.unpackAmount=K;var t=lt,e=Ir,r=A(N1),n=ei,i=A(h5()),a=pi(),s=Jo,o=Nr,f=d5(),c=m(n5()),u=A(Dn),l=wt,p=st;function y(k){if(typeof WeakMap!="function")return null;var G=new WeakMap,W=new WeakMap;return(y=function(R){return R?W:G})(k)}function m(k,G){if(k&&k.__esModule)return k;if(k===null||typeof k!="object"&&typeof k!="function")return{default:k};var W=y(G);if(W&&W.has(k))return W.get(k);var R={__proto__:null},_=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var I in k)if(I!=="default"&&{}.hasOwnProperty.call(k,I)){var b=_?Object.getOwnPropertyDescriptor(k,I):null;b&&(b.get||b.set)?Object.defineProperty(R,I,b):R[I]=k[I]}return R.default=k,W&&W.set(k,R),R}function A(k){return k&&k.__esModule?k:{default:k}}const{computeScriptHash:S}=e.utils,{ScriptValue:w}=e.values;async function C(k,G,W,R,_,{config:I=void 0}={}){I=I||(0,o.getConfig)();const b=I.SCRIPTS.SUDT;if(!b)throw new Error("Provided config does not have SUDT script setup!");k=(0,t.addCellDep)(k,{outPoint:{txHash:b.TX_HASH,index:b.INDEX},depType:b.DEP_TYPE});const v=(0,n.parseFromInfo)(G,{config:I}).fromScript,d=v,g={codeHash:b.CODE_HASH,hashType:b.HASH_TYPE,args:S(v)},x={cellOutput:{capacity:"0x0",lock:d,type:g},data:p.bytes.hexify(p.number.Uint128LE.pack(W)),outPoint:void 0,blockHash:void 0};R||(R=(0,a.minimalCellCapacityCompatible)(x));const E=l.BI.from(R);x.cellOutput.capacity="0x"+E.toString(16),k=k.update("outputs",T=>T.push(x));const h=k.get("outputs").size-1;return k=k.update("fixedEntries",T=>T.push({field:"outputs",index:h})),k=await i.default.injectCapacity(k,[G],l.BI.from(l.BI.from(x.cellOutput.capacity)),void 0,_,{config:I}),k}async function O(k,G,W,R,_,I,b,v,{config:d=void 0,LocktimePoolCellCollector:g=f.CellCollector,splitChangeCell:x=!1}={}){d=d||(0,o.getConfig)();let E=l.BI.from(_),h=b?l.BI.from(b):void 0;const T=d.SCRIPTS.SUDT;if(!T)throw new Error("Provided config does not have SUDT script setup!");if(G.length===0)throw new Error("`fromInfos` can't be empty!");if(!R)throw new Error("You must provide a to address!");const $=(0,a.parseAddress)(R,{config:d}),L=G.map(J=>(0,n.parseFromInfo)(J,{config:d}).fromScript),j=I?(0,a.parseAddress)(I,{config:d}):L[0];if(E.lte(0))throw new Error("amount must be greater than 0");const F=M(W,d),H=k.get("cellProvider");if(!H)throw new Error("Cell provider is missing!");let q=l.BI.from(0),X=l.BI.from(0);if((0,t.isAcpScript)($,d)){const ie=(await new c.CellCollector(R,H,{config:d,queryOptions:{type:F,data:"any"}}).collect().next()).value;if(!ie)throw new Error("toAddress ANYONE_CAN_PAY input not found!");k=k.update("inputs",ce=>ce.push(ie)),k=k.update("witnesses",ce=>ce.push("0x")),q=l.BI.from(ie.cellOutput.capacity),X=K(ie.data)}const te={cellOutput:{capacity:"0x0",lock:$,type:F},data:p.bytes.hexify(p.number.Uint128LE.pack(E)),outPoint:void 0,blockHash:void 0};(0,t.isAcpScript)($,d)?(h||(h=l.BI.from(0)),te.cellOutput.capacity="0x"+q.add(h).toString(16),te.data=p.bytes.hexify(p.number.Uint128LE.pack(X.add(E)))):(h||(h=l.BI.from((0,a.minimalCellCapacityCompatible)(te))),te.cellOutput.capacity="0x"+h.toString(16)),k=k.update("outputs",J=>J.push(te)),k=k.update("fixedEntries",J=>J.push({field:"outputs",index:k.get("outputs").size-1})),k=(0,t.addCellDep)(k,{outPoint:{txHash:T.TX_HASH,index:T.INDEX},depType:T.DEP_TYPE});const ne={cellOutput:{capacity:"0x0",lock:j,type:F},data:p.bytes.hexify(p.number.Uint128LE.pack(0)),outPoint:void 0,blockHash:void 0},N={cellOutput:{capacity:"0x0",lock:j,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0};let P=l.BI.from(0),re=l.BI.from(0),ue=(0,s.Set)();for(const J of k.get("inputs"))ue=ue.add(`${J.outPoint.txHash}_${J.outPoint.index}`);let de=(0,s.List)();v&&G.forEach((J,ie)=>{const ce=new g(J,H,{config:d,tipHeader:v,queryOptions:{type:F,data:"any"}});de=de.push({cellCollector:ce,index:ie})}),G.forEach((J,ie)=>{const ce=new u.default.CellCollector(J,H,{config:d,queryOptions:{type:F,data:"any"}}),ye=new r.default.CellCollector(J,H,{config:d,queryOptions:{type:F,data:"any"}}),ge=new c.default.CellCollector(J,H,{config:d,queryOptions:{type:F,data:"any"}});de=de.push({cellCollector:ce,index:ie},{cellCollector:ye,index:ie},{cellCollector:ge,index:ie,isAnyoneCanPay:!0,destroyable:(0,n.parseFromInfo)(J,{config:d}).destroyable})}),v&&G.forEach((J,ie)=>{const ce=new g(J,H,{config:d,tipHeader:v});de=de.push({cellCollector:ce,index:ie})}),G.forEach((J,ie)=>{const ce=new u.default.CellCollector(J,H,{config:d}),ye=new r.default.CellCollector(J,H,{config:d}),ge=new c.default.CellCollector(J,H,{config:d});de=de.push({cellCollector:ce,index:ie},{cellCollector:ye,index:ie},{cellCollector:ge,index:ie,isAnyoneCanPay:!0,destroyable:(0,n.parseFromInfo)(J,{config:d}).destroyable})});for(const{index:J,cellCollector:ie,isAnyoneCanPay:ce,destroyable:ye}of de)for await(const ge of ie.collect()){const Se=`${ge.outPoint.txHash}_${ge.outPoint.index}`;if(ue.has(Se))continue;ue=ue.add(Se);const kt=G[J];k=await i.default.setupInputCell(k,ge,kt,{config:d});const He=k.get("outputs").size-1;k=k.update("outputs",fe=>fe.remove(He));const Fe=k.get("fixedEntries").findIndex(fe=>fe.field==="outputs"&&fe.index===He);Fe>=0&&(k=k.update("fixedEntries",fe=>fe.remove(Fe)));const fn=l.BI.from(ge.cellOutput.capacity),z=ge.cellOutput.type?K(ge.data):l.BI.from(0);let B=ce&&!ye?fn.sub((0,a.minimalCellCapacityCompatible)(ge)):fn,D=z;B.gt(h)&&(B=l.BI.from(h)),h=h.sub(B);const Y=fn.sub(B);(!ce||ce&&ye)&&(P=P.add(Y)),D.gt(E)&&(D=E),E=E.sub(D);const ae=z.sub(D);if((!ce||ce&&ye)&&(re=re.add(ae)),ce&&!ye){const fe={cellOutput:{capacity:"0x"+Y.toString(16),lock:ge.cellOutput.lock,type:ge.cellOutput.type},data:ge.cellOutput.type?p.bytes.hexify(p.number.Uint128LE.pack(ae)):"0x"};k=k.update("outputs",le=>le.push(fe)),ge.cellOutput.type&&(k=k.update("fixedEntries",le=>le.push({field:"outputs",index:k.get("outputs").size-1})))}if(h.eq(0)&&E.eq(0)&&(P.eq(0)&&re.eq(0)||P.gt((0,a.minimalCellCapacityCompatible)(N))&&re.eq(0))){ne.cellOutput.type=void 0,ne.data="0x";break}if(h.eq(0)&&E.eq(0)&&P.gt((0,a.minimalCellCapacityCompatible)(N))&&re.gt(0))break}let V=-1;if((0,t.isAcpScript)(ne.cellOutput.lock,d)&&(V=k.get("outputs").findIndex(J=>new w(ne.cellOutput.lock,{validate:!1}).equals(new w(J.cellOutput.lock,{validate:!1}))&&(re.eq(0)&&!ne.cellOutput.type&&!J.cellOutput.type||re.gte(0)&&!!ne.cellOutput.type&&!!J.cellOutput.type&&new w(ne.cellOutput.type,{validate:!1}).equals(new w(J.cellOutput.type,{validate:!1})))))!==-1&&k.get("fixedEntries").findIndex(J=>J.field==="output"&&J.index===V)===-1){const J=k.get("outputs").get(V),ie=JSON.parse(JSON.stringify(J));ie.cellOutput.capacity="0x"+l.BI.from(J.cellOutput.capacity).add(P).toString(16),re.gt(0)&&(ie.data=p.bytes.hexify(p.number.Uint128LE.pack(K(J.data).add(re))));const ce=l.BI.from((0,a.minimalCellCapacityCompatible)(ne)),ye=l.BI.from((0,a.minimalCellCapacityCompatible)(N));let ge=!1;re.gt(0)&&x&&P.gte(ce.add(ye))&&(ie.cellOutput.capacity=J.cellOutput.capacity,N.cellOutput.capacity="0x"+P.toString(16),ge=!0),k=k.update("outputs",Se=>Se.set(V,ie)),ge&&(k=k.update("outputs",Se=>Se.push(N)))}else if(P.gte((0,a.minimalCellCapacityCompatible)(ne))){ne.cellOutput.capacity="0x"+P.toString(16),re.gt(0)&&(ne.data=p.bytes.hexify(p.number.Uint128LE.pack(re)));const J=l.BI.from((0,a.minimalCellCapacityCompatible)(ne)),ie=l.BI.from((0,a.minimalCellCapacityCompatible)(N));let ce=!1;re.gt(0)&&x&&P.gte(J.add(ie))&&(ne.cellOutput.capacity="0x"+J.toString(16),N.cellOutput.capacity="0x"+P.sub(J).toString(16),ce=!0),k=k.update("outputs",ye=>ye.push(ne)),re.gt(0)&&(k=k.update("fixedEntries",ye=>ye.push({field:"outputs",index:k.get("outputs").size-1}))),ce&&(k=k.update("outputs",ye=>ye.push(N)))}else if(re.gt(0)&&P.lt((0,a.minimalCellCapacityCompatible)(ne)))throw new Error("Not enough capacity for change in from infos!");if(h.gt(0))throw new Error("Not enough capacity in from infos!");if(E.gt(0))throw new Error("Not enough amount in from infos!");return k}function M(k,G){const W=G.SCRIPTS.SUDT;return{codeHash:W.CODE_HASH,hashType:W.HASH_TYPE,args:k}}function U(k,{config:G=void 0}={}){G=G||(0,o.getConfig)();const{fromScript:W}=(0,n.parseFromInfo)(k,{config:G});return S(W)}function K(k){return p.number.Uint128LE.unpack(p.bytes.bytify(k).slice(0,16))}function Q(k){return p.bytes.hexify(p.number.Uint128LE.pack(k))}return bs.default={issueToken:C,transfer:O,ownerForSudt:U,packAmount:Q,unpackAmount:K},bs}var i5={};Object.defineProperty(i5,"__esModule",{value:!0});i5.createP2PKHMessageGroup=pK;var Yc=Ir,fK=pi(),ll=st,cK=wt;function uK(t,e){const r=new Set;for(const i of e){const a=Yc.utils.ckbHash(Yc.blockchain.Script.pack(i));r.add(a)}const n=new Map;for(let i=0;i{const t=new Yc.utils.CKBHasher;return{update:e=>t.update(e.buffer),digest:()=>ll.bytes.bytify(t.digestHex())}};function hK(t){return t instanceof Function?t():t}function pK(t,e,{hasher:r=dK}={}){const n=uK(t.inputs.toArray(),e),i=lK(t);if(e.length>1&&!(r instanceof Function))throw new Error("Must provide hasher producer when you have multiple locks to group.");const a=[];for(const s of n.keys()){const o=hK(r),f=n.get(s),c=f[0],u=t.witnesses.get(c);if(u===void 0)throw new Error("Please fill witnesses with 0 first!");o.update(ll.bytes.bytify(i));const l=new ArrayBuffer(8),p=new DataView(l),y=cK.BI.from(ll.bytes.bytify(u).length).toString(16);y.length<=8&&(p.setUint32(0,+("0x"+y),!0),p.setUint32(4,+"0x00000000",!0)),y.length>8&&y.length<=16&&(p.setUint32(0,+("0x"+y.slice(-8)),!0),p.setUint32(4,+("0x"+y.slice(0,-8)),!0)),o.update(new Uint8Array(l)),o.update(ll.bytes.bytify(u));for(let S=1;S("00"+S.toString(16)).slice(-2)).join("")};a.push(A)}return a}var wc={};Object.defineProperty(wc,"__esModule",{value:!0});wc.compareScriptBinaryWithOnChainData=$D;wc.default=void 0;wc.generateDeployWithDataTx=UD;wc.generateDeployWithTypeIdTx=kD;wc.generateUpgradeTypeIdDataTx=zD;var fs=Ir,rp=st,by=Nr,Ac=pi(),bK=Jo,L2=ei,vn=wt;const{ScriptValue:$A}=fs.values;function a5(t){let e="0x";for(let r=0;rn.push(e)),t}function o5(t,e){t=t.update("cellDeps",i=>i.clear()),e=e||(0,by.getConfig)();const r=e.SCRIPTS.SECP256K1_BLAKE160,n=e.SCRIPTS.SECP256K1_BLAKE160_MULTISIG;if(!r||!n)throw new Error("Provided config does not have SECP256K1_BLAKE160 or SECP256K1_BLAKE160_MULTISIG script setup!");return t=t.update("cellDeps",i=>i.push({outPoint:{txHash:r.TX_HASH,index:r.INDEX},depType:r.DEP_TYPE},{outPoint:{txHash:n.TX_HASH,index:n.INDEX},depType:n.DEP_TYPE})),t}async function f5(t,e,r,n){const i=t.get("inputs").map(o=>vn.BI.from(o.cellOutput.capacity)).reduce((o,f)=>o.add(f),vn.BI.from(0)),s=t.get("outputs").map(o=>vn.BI.from(o.cellOutput.capacity)).reduce((o,f)=>o.add(f),vn.BI.from(0)).sub(i);return t=await yK(t,e,vn.BI.from(s),{config:r,feeRate:n}),t}async function yK(t,e,r,{config:n=void 0,feeRate:i=void 0}){n=n||(0,by.getConfig)();const a=i||1e3;let s=vn.BI.from(r);const{fromScript:o,multisigScript:f}=(0,L2.parseFromInfo)(e,{config:n});s=s.add(vn.BI.from(10).pow(8));let c=vn.BI.from(10).pow(8);const u={cellOutput:{capacity:"0x0",lock:o,type:void 0},data:"0x"},l=vn.BI.from((0,Ac.minimalCellCapacityCompatible)(u)).add(vn.BI.from(10).pow(8));if(s.lt(0)&&(c=c.sub(s),s=vn.BI.from(0)),s.gt(0)||c.lt(l)){const m=t.get("cellProvider");if(!m)throw new Error("Cell provider is missing!");const A=m.collector({lock:o,type:"empty",data:"0x"});let S=(0,bK.Set)();for(const w of t.get("inputs"))S=S.add(`${w.outPoint.txHash}_${w.outPoint.index}`);for await(const w of A.collect()){if(S.has(`${w.outPoint.txHash}_${w.outPoint.index}`))continue;t=t.update("inputs",M=>M.push(w)),t=t.update("witnesses",M=>M.push("0x"));const C=vn.BI.from(w.cellOutput.capacity);let O=C;if(O.gt(s)&&(O=s),s=s.sub(O),c=c.add(C).sub(O),s.eq(0)&&(c.eq(0)||c.gte(l)))break}}if(c.gt(0)&&(u.cellOutput.capacity="0x"+c.toString(16),t=t.update("outputs",m=>m.push(u))),s.gt(0)||c.lt(l))throw new Error("Not enough capacity in from address!");const p=t.get("inputs").findIndex(m=>new $A(m.cellOutput.lock,{validate:!1}).equals(new $A(o,{validate:!1})));if(p!==-1){for(;p>=t.get("witnesses").size;)t=t.update("witnesses",w=>w.push("0x"));let m=t.get("witnesses").get(p),A;const S="0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";if(typeof e!="string"?A={lock:"0x"+f.slice(2)+S.slice(2).repeat(e.M)}:A={lock:S},m!=="0x"){const w=fs.blockchain.WitnessArgs.unpack(rp.bytes.bytify(m)),C=w.lock;if(C&&A.lock&&!rp.bytes.equal(C,A.lock))throw new Error("Lock field in first witness is set aside for signature!");const O=w.inputType;O&&(A.inputType=O);const M=w.outputType;M&&(A.outputType=M)}m=rp.bytes.hexify(fs.blockchain.WitnessArgs.pack(A)),t=t.update("witnesses",w=>w.set(p,m))}const y=PD(t,a);return c=c.sub(y),t=t.update("outputs",m=>m.pop()),c.gt(0)&&(u.cellOutput.capacity="0x"+c.toString(16),t=t.update("outputs",m=>m.push(u))),t}function vK(t){const e=(0,Ac.createTransactionFromSkeleton)(t);return _K(e)}function _K(t){return fs.blockchain.Transaction.pack(t).byteLength+4}function mK(t,e){const r=vn.BI.from(1e3),n=vn.BI.from(t).mul(e),i=n.div(r);return i.mul(r).lt(n)?i.add(1):vn.BI.from(i)}function PD(t,e){const r=vK(t);return vn.BI.from(mK(r,e))}function wK(t){const e=t.valueOf();return new fs.utils.CKBHasher().update(e.buffer.slice(e.byteOffset,e.byteLength+e.byteOffset)).digestHex()}async function AK(t,e){const r=t.txHash,n=parseInt(t.index,10),i=await e.getTransaction(r);if(!i)throw new Error(`TxHash(${r}) is not found`);const a=i.transaction.outputsData[n];if(!a)throw new Error("cannot find output data");return new fs.utils.CKBHasher().update(rp.bytes.bytify(a)).digestHex()}function ND(t){const e=(0,Ac.createTransactionFromSkeleton)(t);return fs.utils.ckbHash(fs.blockchain.RawTransaction.pack(e))}function EK(t,e){const r=t.outputs.get(e).data,n=fs.utils.ckbHash(rp.bytes.bytify(r)),i=ND(t);return{CODE_HASH:n,HASH_TYPE:"data2",TX_HASH:i,INDEX:"0x0",DEP_TYPE:"code"}}function xK(t,e){const r=t.outputs.get(e).cellOutput.type,n=fs.utils.computeScriptHash(r),i=ND(t);return{CODE_HASH:n,HASH_TYPE:"type",TX_HASH:i,INDEX:"0x0",DEP_TYPE:"code"}}function c5(t,e){const r=t.outputs.get(e);if(r==null)throw new Error("Invalid txSkeleton or outputIndex");return r.cellOutput.type!==void 0?xK(t,e):EK(t,e)}function SK(t){return typeof t!="object"?!1:"M"in t&&"R"in t&&Array.isArray(t.publicKeyHashes)}function u5(t,{config:e=void 0}={}){if(e=e||(0,by.getConfig)(),typeof t=="string"){if(by.helpers.nameOfScript((0,Ac.parseAddress)(t,{config:e}),e.SCRIPTS)!=="SECP256K1_BLAKE160")throw new Error("only SECP256K1_BLAKE160 or SECP256K1_MULTISIG is supported")}else if(!SK(t))throw new Error("only SECP256K1_BLAKE160 or SECP256K1_MULTISIG is supported")}async function UD(t){u5(t.fromInfo,{config:t.config});let e=(0,Ac.TransactionSkeleton)({cellProvider:t.cellProvider});const{fromScript:r}=(0,L2.parseFromInfo)(t.fromInfo,{config:t.config}),n={cellOutput:{capacity:"0x0",lock:r},data:a5(t.scriptBinary)};e=s5(e,n),e=o5(e,t.config),e=await f5(e,t.fromInfo,t.config,t.feeRate);const i=c5(e,0);return{txSkeleton:e,scriptConfig:i}}async function kD(t){u5(t.fromInfo,{config:t.config});let e=(0,Ac.TransactionSkeleton)({cellProvider:t.cellProvider});const{fromScript:r}=(0,L2.parseFromInfo)(t.fromInfo,{config:t.config}),[n]=await gK(r,t.cellProvider);if(!n)throw new Error("fromAddress has no live ckb");const i=fs.utils.generateTypeIdScript({previousOutput:n.outPoint,since:"0x0"},"0x0"),a={cellOutput:{capacity:"0x0",lock:r,type:i},data:a5(t.scriptBinary)};e=s5(e,a),e=o5(e,t.config),e=await f5(e,t.fromInfo,t.config,t.feeRate);const s=c5(e,0);return{txSkeleton:e,scriptConfig:s,typeId:i}}async function zD(t){u5(t.fromInfo,{config:t.config});let e=(0,Ac.TransactionSkeleton)({cellProvider:t.cellProvider});const{fromScript:r}=(0,L2.parseFromInfo)(t.fromInfo,{config:t.config}),n=t.cellProvider.collector({type:t.typeId}),i=[];for await(const f of n.collect())i.push(f);if(i.length!==1)throw new Error("the typeid maybe wrong");const a=i[0];e=e.update("inputs",f=>f.push(a));const s={cellOutput:{capacity:"0x0",lock:r,type:t.typeId},data:a5(t.scriptBinary)};e=s5(e,s),e=o5(e,t.config),e=await f5(e,t.fromInfo,t.config,t.feeRate);const o=c5(e,0);return{txSkeleton:e,scriptConfig:o}}async function $D(t,e,r){const n=wK(t),i=await AK(e,r);return n===i}wc.default={generateDeployWithDataTx:UD,generateDeployWithTypeIdTx:kD,generateUpgradeTypeIdDataTx:zD,compareScriptBinaryWithOnChainData:$D,__tests__:{calculateTxFee:PD}};var Sn={},_n={};Object.defineProperty(_n,"__esModule",{value:!0});_n.WitnessArgs=_n.BytesVec=_n.BytesOpt=_n.Bytes=_n.Byte32Vec=_n.Byte32=void 0;_n.WitnessArgsOf=KD;_n.createFixedHexBytesCodec=FD;var jD=Go,Dd=Ca,Fa=c1;function FD(t){return(0,jD.createFixedBytesCodec)({byteLength:t,pack:e=>(0,Dd.bytify)(e),unpack:e=>(0,Dd.hexify)(e)})}const qD=_n.Bytes=(0,Fa.byteVecOf)({pack:Dd.bytify,unpack:Dd.hexify});_n.BytesOpt=(0,Fa.option)(qD);_n.BytesVec=(0,Fa.vector)(qD);const IK=_n.Byte32=FD(32);_n.Byte32Vec=(0,Fa.vector)(IK);function KD(t){return(0,Fa.table)({lock:(0,Fa.option)((0,Fa.byteVecOf)(t.lock)),input_type:(0,Fa.option)((0,Fa.byteVecOf)(t.input_type)),output_type:(0,Fa.option)((0,Fa.byteVecOf)(t.output_type))},["lock","input_type","output_type"])}const z_=(0,jD.createBytesCodec)({pack:Dd.bytify,unpack:Dd.hexify});_n.WitnessArgs=KD({lock:z_,input_type:z_,output_type:z_});var H2={};function CK(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,O=new Uint8Array(C);S!==w;){for(var M=y[S],U=0,K=C-1;(M!==0||U>>0,O[K]=M%s>>>0,M=M/s>>>0;if(M!==0)throw new Error("Non-zero carry");A=U,S++}for(var Q=C-A;Q!==C&&O[Q]===0;)Q++;for(var k=o.repeat(m);Q>>0,C=new Uint8Array(w);y[m];){var O=e[y.charCodeAt(m)];if(O===255)return;for(var M=0,U=w-1;(O!==0||M>>0,C[U]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");S=M,m++}for(var K=w-S;K!==w&&C[K]===0;)K++;for(var Q=new Uint8Array(A+(w-K)),k=A;K!==w;)Q[k++]=C[K++];return Q}function p(y){var m=l(y);if(m)return m;throw new Error("Non-base"+s+" character")}return{encode:u,decodeUnsafe:l,decode:p}}var TK=CK;const OK=TK,BK="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var QD=OK(BK);Object.defineProperty(H2,"__esModule",{value:!0});H2.decodeAddress=RK;H2.signMessage=LK;var $_=st,jA=sc,FA=DK(QD);function DK(t){return t&&t.__esModule?t:{default:t}}const MK="CKB (Bitcoin Layer) transaction: 0x";function RK(t){try{if(t.startsWith("bc1q"))return jA.bech32.fromWords(jA.bech32.decode(t).words.slice(1));if(t.startsWith("1")||t.startsWith("3"))return FA.default.decode(t).slice(1,21)}catch{if(t.startsWith("bc1p"))throw new Error("Taproot address is not supported yet.")}throw new Error(`Unsupported bitcoin address ${t}, only 1...(P2PKH) 3...(P2SH), and bc1...(Bech32) are supported.`)}async function LK(t,e,r){const n=(()=>{if(r)return r;if(typeof window<"u"){if("unisat"in window)return window.unisat;if("okxwallet"in window&&"bitcoin"in window.okxwallet)return window.okxwallet.bitcoin}throw new Error("No provider found, make sure you have installed UniSat Wallet")})(),i=await n.requestAccounts(),a=$_.bytes.hexify(t).slice(2),s=await n.signMessage(`${MK}${a}`,e),o=$_.bytes.bytify(HK(s)),f=i[0];if(f.startsWith("bc1q"))o[0]=39+(o[0]-27)%4;else if(f.startsWith("3"))o[0]=35+(o[0]-27)%4;else if(f.startsWith("1"))o[0]=31+(o[0]-27)%4;else throw new Error(`Unsupported bitcoin address ${f}, only 1...(P2PKH) 3...(P2SH), and bc1...(Bech32) are supported.`);return $_.bytes.hexify(o)}function HK(t){const e=atob(t);let r="";for(let n=0;n{if(e)return e;if(typeof window<"u"&&"phantom"in window&&window.phantom&&"solana"in window.phantom)return window.phantom.solana;throw new Error("No provider found, make sure you have installed Phantom or other Solana wallet")})(),i=j_.bytes.hexify(t).slice(2),a=await r.signMessage(new TextEncoder().encode(`${PK}${i}`));return j_.bytes.hexify(j_.bytes.concat(a.signature,a.publicKey.toBytes()))}Object.defineProperty(Sn,"__esModule",{value:!0});Sn.bitcoin=Sn.OmnilockWitnessLock=Sn.CellCollector=void 0;Sn.createOmnilockScript=XD;Sn.default=void 0;Sn.prepareSigningEntries=tM;Sn.setupInputCell=eM;Sn.solana=void 0;var Zi=st,YD=Ir,P2=Nr,np=lt,UK=ei,xu=c1,n6=_n,qA=Ca,VD=WD(H2);Sn.bitcoin=VD;var kK=WD(l5);Sn.solana=kK;var zK=QD,$K=St;function GD(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(GD=function(n){return n?r:e})(t)}function WD(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=GD(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}const{ScriptValue:KA}=YD.values;var So=function(t){return t[t.IdentityFlagsCkb=0]="IdentityFlagsCkb",t[t.IdentityFlagsEthereum=1]="IdentityFlagsEthereum",t[t.IdentityFlagsEos=2]="IdentityFlagsEos",t[t.IdentityFlagsTron=3]="IdentityFlagsTron",t[t.IdentityFlagsBitcoin=4]="IdentityFlagsBitcoin",t[t.IdentityFlagsDogecoin=5]="IdentityFlagsDogecoin",t[t.IdentityCkbMultisig=6]="IdentityCkbMultisig",t[t.IdentityFlagsEthereumDisplaying=18]="IdentityFlagsEthereumDisplaying",t[t.IdentityFlagsSolana=19]="IdentityFlagsSolana",t[t.IdentityFlagsOwnerLock=252]="IdentityFlagsOwnerLock",t[t.IdentityFlagsExec=253]="IdentityFlagsExec",t[t.IdentityFlagsDl=254]="IdentityFlagsDl",t}(So||{});const jK=20,FK=65,qK=96;function XD(t,e){const n=((e==null?void 0:e.config)||(0,P2.getConfig)()).SCRIPTS.OMNILOCK;if(!n)throw new Error("OMNILOCK script config not found.");const a=[0],s=(()=>{const o=t.auth.flag;switch(o){case"ETHEREUM":return Zi.bytes.hexify(Zi.bytes.concat([So.IdentityFlagsEthereum],t.auth.content,a));case"SECP256K1_BLAKE160":return Zi.bytes.hexify(Zi.bytes.concat([So.IdentityFlagsCkb],t.auth.content,a));case"BITCOIN":return Zi.bytes.hexify(Zi.bytes.concat([So.IdentityFlagsBitcoin],VD.decodeAddress(t.auth.content),a));case"SOLANA":{const f=Zi.bytes.bytify((0,$K.ckbHash)((0,zK.decode)(t.auth.content))).slice(0,jK);return Zi.bytes.hexify(Zi.bytes.concat([So.IdentityFlagsSolana],f,a))}default:throw new Error(`Not supported flag: ${o}.`)}})();return{codeHash:n.CODE_HASH,hashType:n.HASH_TYPE,args:s}}const ZD={pack:qA.bytify,unpack:qA.hexify},KK=21,QK=(0,n6.createFixedHexBytesCodec)(KK),YK=(0,xu.byteVecOf)(ZD),VK=(0,xu.table)({mask:(0,xu.byteOf)(ZD),proof:YK},["mask","proof"]),GK=(0,xu.vector)(VK),WK=(0,xu.table)({identity:QK,proofs:GK},["identity","proofs"]),XK=(0,xu.option)(WK),JD=Sn.OmnilockWitnessLock=(0,xu.table)({signature:n6.BytesOpt,omni_identity:XK,preimage:n6.BytesOpt},["signature","omni_identity","preimage"]),ZK=Sn.CellCollector=class{constructor(e,r,{config:n=void 0,queryOptions:i={}}={}){if(!r)throw new Error("Cell provider is missing!");n=n||(0,P2.getConfig)(),this.fromScript=(0,UK.parseFromInfo)(e,{config:n}).fromScript,this.config=n,i={...i,lock:this.fromScript,type:i.type||"empty"},this.cellCollector=r.collector(i)}async*collect(){if((0,np.isOmnilockScript)(this.fromScript,this.config))for await(const e of this.cellCollector.collect())yield e}};async function eM(t,e,r,{config:n=void 0,defaultWitness:i="0x",since:a=void 0}={}){n=n||(0,P2.getConfig)();const s=e.cellOutput.lock;if(!(0,np.isOmnilockScript)(s,n))throw new Error("Not OMNILOCK input!");t=t.update("inputs",y=>y.push(e));const o={cellOutput:{capacity:e.cellOutput.capacity,lock:e.cellOutput.lock,type:e.cellOutput.type},data:e.data};t=t.update("outputs",y=>y.push(o)),a&&(t=t.update("inputSinces",y=>y.set(t.get("inputs").size-1,a))),t=t.update("witnesses",y=>y.push(i));const f=n.SCRIPTS.OMNILOCK,c=n.SCRIPTS.SECP256K1_BLAKE160;if(!f)throw new Error("OMNILOCK script not defined in config!");if(!c)throw new Error("SECP256K1_BLAKE160 script not defined in config!");const u={txHash:f.TX_HASH,index:f.INDEX},l={txHash:c.TX_HASH,index:c.INDEX};t=(0,np.addCellDep)(t,{outPoint:u,depType:f.DEP_TYPE}),t=(0,np.addCellDep)(t,{outPoint:l,depType:c.DEP_TYPE});const p=t.get("inputs").findIndex(y=>new KA(y.cellOutput.lock,{validate:!1}).equals(new KA(s,{validate:!1})));if(p!==-1){for(;p>=t.get("witnesses").size;)t=t.update("witnesses",S=>S.push("0x"));let y=t.get("witnesses").get(p);const m=(()=>{const S=Zi.bytes.bytify(e.cellOutput.lock.args)[0];switch(S){case So.IdentityFlagsSolana:return qK;case So.IdentityFlagsCkb:case So.IdentityFlagsEthereum:case So.IdentityFlagsBitcoin:return FK;default:throw new Error(`Unsupported flag: ${S}, please check if the script.args is expected`)}})(),A={lock:JK(m)};y=Zi.bytes.hexify(YD.blockchain.WitnessArgs.pack(A)),t=t.update("witnesses",S=>S.set(p,y))}return t}function JK(t){const e=JD.pack({signature:new Uint8Array(t)}).byteLength;return Zi.bytes.hexify(new Uint8Array(e))}function tM(t,{config:e=void 0}={}){return e=e||(0,P2.getConfig)(),(0,np.prepareSigningEntries)(t,e,"OMNILOCK")}Sn.default={prepareSigningEntries:tM,setupInputCell:eM,CellCollector:ZK,OmnilockWitnessLock:JD,createOmnilockScript:XD};var QA;function eQ(){return QA||(QA=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"anyoneCanPay",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(t,"common",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"createP2PKHMessageGroup",{enumerable:!0,get:function(){return c.createP2PKHMessageGroup}}),Object.defineProperty(t,"dao",{enumerable:!0,get:function(){return i.default}}),t.default=void 0,Object.defineProperty(t,"deploy",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"locktimePool",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"omnilock",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"parseFromInfo",{enumerable:!0,get:function(){return n.parseFromInfo}}),Object.defineProperty(t,"secp256k1Blake160",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(t,"secp256k1Blake160Multisig",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"sudt",{enumerable:!0,get:function(){return o.default}});var e=p(Dn),r=p(N1),n=ei,i=p(p5()),a=p(d5()),s=p(h5()),o=p(HD()),f=p(n5()),c=i5,u=p(wc),l=p(Sn);function p(y){return y&&y.__esModule?y:{default:y}}t.default={secp256k1Blake160:e.default,secp256k1Blake160Multisig:r.default,dao:i.default,locktimePool:a.default,common:s.default,sudt:o.default,anyoneCanPay:f.default}}(k_)),k_}var YA;function d5(){if(YA)return vi;YA=1,Object.defineProperty(vi,"__esModule",{value:!0}),vi.default=vi.CellCollector=void 0,vi.injectCapacity=R,vi.payFee=G,vi.prepareSigningEntries=W,vi.setupInputCell=I,vi.transfer=M,vi.transferCompatible=U;var t=pi(),e=st,r=ei,n=y(Dn),i=p5(),a=Ir,s=lt,o=Jo,f=Nr,c=eQ(),u=Pi,l=wt,p=R2();function y(v){return v&&v.__esModule?v:{default:v}}const{ScriptValue:m}=a.values,{parseEpoch:A,maximumAbsoluteEpochSince:S,generateAbsoluteEpochSince:w,validateSince:C}=a.since,O=vi.CellCollector=class{constructor(d,g,{config:x=void 0,queryOptions:E={},tipHeader:h=void 0,NodeRPC:T=p.RPC}={}){if(!g)throw new Error("Cell provider is missing!");x=x||(0,f.getConfig)();const $=(0,r.parseFromInfo)(d,{config:x}),L=$.fromScript;this.multisigScript=$.multisigScript,this.fromScript=L,this.config=x,this.tipHeader=h,h&&(this.tipSinceValidationInfo={blockNumber:h.number,epoch:h.epoch,median_timestamp:""}),this.rpc=new T(g.uri),E={...E,lock:this.fromScript};let j=(0,o.List)([]);if((0,s.isSecp256k1Blake160MultisigScript)(L,x)){const F={codeHash:L.codeHash,hashType:L.hashType,args:L.args.slice(0,42)};j=j.push(g.collector({lock:F,argsLen:E.argsLen||28,type:E.type||"empty",data:E.data||"0x"})),!E.type&&(!E.data||E.data==="any")&&(j=j.push(g.collector({lock:F,type:(0,s.generateDaoScript)(x),data:"any"})),j=j.push(g.collector({lock:F,argsLen:28,type:(0,s.generateDaoScript)(x),data:"any"})))}else(0,s.isSecp256k1Blake160Script)(L,x)&&!E.type&&(!E.data||E.data==="any")&&(j=j.push(g.collector({lock:L,type:(0,s.generateDaoScript)(x),data:"any"})));this.cellCollectors=j}async*collect(){for(const d of this.cellCollectors)for await(const g of d.collect()){const x=g.cellOutput.lock;let E,h,T,$,L;if(x.args.length===58){const F=await this.rpc.getHeader(g.blockHash);E="0x"+b(x.args).toString(16),L={epoch:F.epoch,blockNumber:F.number,median_timestamp:""}}if((0,s.isDaoScript)(g.cellOutput.type,this.config)){if(g.data==="0x0000000000000000")continue;const F=await this.rpc.getTransaction(g.outPoint.txHash);$=F.txStatus.blockHash;const q=F.transaction.inputs[+g.outPoint.index].previousOutput;T=(await this.rpc.getTransaction(q.txHash)).txStatus.blockHash;const X=await this.rpc.getHeader(T),te=await this.rpc.getHeader($);let ne="0x"+(0,i.calculateDaoEarliestSinceCompatible)(X.epoch,te.epoch).toString(16);h=(0,i.calculateMaximumWithdrawCompatible)(g,X.dao,te.dao);const N=A(te.epoch),P={number:N.number+4,length:N.length,index:N.index};if(ne=S(ne,w(P)),E){const re=(0,u.parseSinceCompatible)(E);if(!(re.relative===!1&&re.type==="epochNumber"))continue;try{E=S(ne,E)}catch{E=ne}}else E=ne}if((0,u.parseSinceCompatible)(E).type==="blockTimestamp"||this.tipHeader&&!C(E,this.tipSinceValidationInfo,L))continue;const j={...g,since:E,depositBlockHash:T,withdrawBlockHash:$,sinceValidationInfo:L};j.cellOutput.capacity="0x"+(h||l.BI.from(g.cellOutput.capacity)).toString(16),yield j}}};async function M(v,d,g,x,E,{config:h=void 0,requireToAddress:T=!0,assertAmountEnough:$=!0,LocktimeCellCollector:L=O}={}){const j=await U(v,d,g,x,E,{config:h,requireToAddress:T,assertAmountEnough:$,LocktimeCellCollector:L});let F,H;return j instanceof Array?(F=j[0],H=BigInt(j[1].toString()),[F,H]):(F=j,F)}async function U(v,d,g,x,E,{config:h=void 0,requireToAddress:T=!0,assertAmountEnough:$=!0,LocktimeCellCollector:L=O}={}){let j=l.BI.from(x);for(const[F,H]of d.entries()){const q=await K(v,H,F===0?g:void 0,j,E,{config:h,requireToAddress:F===0?T:!1,assertAmountEnough:!1,LocktimeCellCollector:L});if(v=q[0],j=q[1],j.eq(0))return $?v:[v,l.BI.from(j)]}if($)throw new Error("Not enough capacity in from addresses!");return[v,l.BI.from(j)]}async function K(v,d,g,x,E,{config:h=void 0,requireToAddress:T=!0,assertAmountEnough:$=!0,LocktimeCellCollector:L=O,changeAddress:j=void 0}){h=h||(0,f.getConfig)();const{fromScript:F}=(0,r.parseFromInfo)(d,{config:h});if(!(0,s.isSecp256k1Blake160MultisigScript)(F,h)&&!(0,s.isSecp256k1Blake160Script)(F,h))throw new Error("fromInfo not supported!");if(T&&!g)throw new Error("You must provide a to address!");let H=l.BI.from(x||0);if(g){const te=(0,t.parseAddress)(g,{config:h});v=v.update("outputs",ne=>ne.push({cellOutput:{capacity:"0x"+H.toString(16),lock:te,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0}))}const q=v.get("fixedEntries").filter(({field:te})=>te==="outputs").maxBy(({index:te})=>te);let X=q?q.index+1:0;for(;Xre.update(X,()=>P))}}if(v=v.update("outputs",te=>te.filter(ne=>!l.BI.from(ne.cellOutput.capacity).eq(0))),H.gt(0)){const te=v.get("cellProvider");if(!te)throw new Error("cell provider is missing!");const N={cellOutput:{capacity:"0x0",lock:j?(0,t.parseAddress)(j,{config:h}):F,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0};let P=l.BI.from(0),re=(0,o.Set)();for(const de of v.get("inputs"))re=re.add(`${de.outPoint.txHash}_${de.outPoint.index}`);const ue=new L(d,te,{config:h,tipHeader:E});for await(const de of ue.collect()){const V=de;if(re.has(`${V.outPoint.txHash}_${V.outPoint.index}`))continue;let J;if((0,s.isSecp256k1Blake160MultisigScript)(F,h)){const ge=V.cellOutput.lock.args;J=ge.length===58?l.BI.from(b(ge)):void 0}let ie="0x";if((0,s.isDaoScript)(V.cellOutput.type,h)){const ge=h.SCRIPTS.DAO;v=(0,s.addCellDep)(v,{depType:ge.DEP_TYPE,outPoint:{txHash:ge.TX_HASH,index:ge.INDEX}}),v=v.update("headerDeps",He=>He.push(V.depositBlockHash,V.withdrawBlockHash));const Se=v.get("headerDeps").size-2,kt={inputType:e.bytes.hexify(e.number.Uint64.pack(Se))};ie=e.bytes.hexify(a.blockchain.WitnessArgs.pack(kt))}v=await _(v,V,(0,s.isSecp256k1Blake160MultisigScript)(F,h)?Object.assign({},d,{since:J}):d,{config:h,defaultWitness:ie,since:V.since});const ce=l.BI.from(V.cellOutput.capacity);let ye=ce;if(ye.gt(H)&&(ye=H),H=H.sub(ye),P=P.add(ce).sub(ye),(0,s.isDaoScript)(V.cellOutput.type,h)&&(v=v.update("fixedEntries",ge=>ge.push({field:"inputs",index:v.get("inputs").size-1},{field:"witnesses",index:v.get("witnesses").size-1},{field:"headerDeps",index:v.get("headerDeps").size-2}))),H.eq(0)&&(P.eq(0)||P.gt((0,t.minimalCellCapacityCompatible)(N))))break}P.gt(0)&&(N.cellOutput.capacity="0x"+P.toString(16),v=v.update("outputs",de=>de.push(N)))}if(!$)return[v,H];if(H.gt(0))throw new Error("Not enough capacity in from address!");return v}async function Q(v,d,g,x,E,{config:h=void 0,LocktimeCellCollector:T=O,enableDeductCapacity:$=!0}){h=h||(0,f.getConfig)();let L=l.BI.from(g);const j=l.BI.from(E);if($)for(const H of d){const q=(0,r.parseFromInfo)(H,{config:h}).fromScript;if(!(0,s.isSecp256k1Blake160MultisigScript)(q,h)&&!(0,s.isSecp256k1Blake160Script)(q,h))continue;const X=v.get("fixedEntries").filter(({field:ne})=>ne==="outputs").maxBy(({index:ne})=>ne);let te=X?X.index+1:0;for(;teue.update(te,()=>N))}}v=v.update("outputs",ne=>ne.filter(N=>!l.BI.from(N.cellOutput.capacity).eq(0)))}let F=l.BI.from(0);if(L.gt(0)){const H=v.get("cellProvider");if(!H)throw new Error("cell provider is missing!");const q=te=>`${te.outPoint.txHash}_${te.outPoint.index}`;let X=(0,o.Set)();for(const te of v.get("inputs"))X=X.add(q(te));for(const te of d){const ne=(0,r.parseFromInfo)(te,{config:h}).fromScript,N=new T(te,H,{config:h,tipHeader:x});for await(const P of N.collect()){const re=P;if(X.has(q(re)))continue;let ue="0x";if((0,s.isDaoScript)(re.cellOutput.type,h)){const ie=h.SCRIPTS.DAO;v=(0,s.addCellDep)(v,{depType:ie.DEP_TYPE,outPoint:{txHash:ie.TX_HASH,index:ie.INDEX}}),v=v.update("headerDeps",ge=>ge.push(re.depositBlockHash,re.withdrawBlockHash));const ce=v.get("headerDeps").size-2,ye={inputType:e.bytes.hexify(e.number.Uint64.pack(ce))};ue=e.bytes.hexify(a.blockchain.WitnessArgs.pack(ye))}let de;if((0,s.isSecp256k1Blake160MultisigScript)(ne,h)){const ie=re.cellOutput.lock.args;de=ie.length===58?l.BI.from(b(ie)):void 0}v=await _(v,re,Object.assign({},te,{since:de}),{config:h,defaultWitness:ue,since:re.since});const V=l.BI.from(re.cellOutput.capacity);let J=V;if(J.gt(L)&&(J=L),L=L.sub(J),F=F.add(V).sub(J),(0,s.isDaoScript)(re.cellOutput.type,h)&&(v=v.update("fixedEntries",ie=>ie.push({field:"inputs",index:v.get("inputs").size-1},{field:"witnesses",index:v.get("witnesses").size-1},{field:"headerDeps",index:v.get("headerDeps").size-2}))),L.eq(0)&&(F.eq(0)||F.gt(j)))break}}}return{txSkeleton:v,capacity:l.BI.from(L.toString()),changeCapacity:l.BI.from(F.toString())}}async function k(v,d,g,x,E,{config:h=void 0,LocktimeCellCollector:T=O,enableDeductCapacity:$=!0}){const L=await Q(v,d,g,x,E,{config:h,LocktimeCellCollector:T,enableDeductCapacity:$});return{txSkeleton:L.txSkeleton,capacity:L.capacity.toBigInt(),changeCapacity:L.changeCapacity.toBigInt()}}async function G(v,d,g,x,{config:E=void 0,LocktimeCellCollector:h=O}={}){return U(v,d,void 0,g,x,{config:E,requireToAddress:!1,LocktimeCellCollector:h})}function W(v,{config:d=void 0}={}){return d=d||(0,f.getConfig)(),v=(0,s.prepareSigningEntries)(v,d,"SECP256K1_BLAKE160"),v=(0,s.prepareSigningEntries)(v,d,"SECP256K1_BLAKE160_MULTISIG"),v}async function R(v,d,g,x,{config:E=void 0,LocktimeCellCollector:h=O}={}){if(E=E||(0,f.getConfig)(),d>=v.get("outputs").size)throw new Error("Invalid output index!");const T=l.BI.from(v.get("outputs").get(d).cellOutput.capacity);return U(v,g,void 0,l.BI.from(T),x,{config:E,requireToAddress:!1,LocktimeCellCollector:h})}async function _(v,d,g,{config:x=void 0,since:E=void 0,defaultWitness:h="0x"}={}){return x=x||(0,f.getConfig)(),v=await I(v,d,g,{config:x,since:E,defaultWitness:h}),v=v.update("outputs",T=>T.remove(T.size-1)),v}async function I(v,d,g,{config:x=void 0,since:E=void 0,defaultWitness:h="0x"}={}){x=x||(0,f.getConfig)();const T=d.cellOutput.lock;if((0,s.isSecp256k1Blake160Script)(T,x))return n.default.setupInputCell(v,d,g,{config:x,defaultWitness:h,since:E});if((0,s.isSecp256k1Blake160MultisigScript)(T,x))return c.secp256k1Blake160Multisig.setupInputCell(v,d,g,{config:x,defaultWitness:h,since:E});throw new Error("Not supported input lock!")}function b(v){if(v.length!==58)throw new Error("Invalid multisig with since args!");return e.number.Uint64LE.unpack("0x"+v.slice(42))}return vi.default={CellCollector:O,transfer:M,transferCompatible:U,payFee:G,prepareSigningEntries:W,injectCapacity:R,setupInputCell:I,injectCapacityWithoutChange:k,injectCapacityWithoutChangeCompatible:Q},vi}var VA;function h5(){if(VA)return Vi;VA=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.default=void 0,Vi.injectCapacity=Q,Vi.payFee=k,Vi.payFeeByFeeRate=v,Vi.prepareSigningEntries=G,Vi.registerCustomLockScriptInfos=M,Vi.setupInputCell=b,Vi.transfer=K;var t=pi(),e=m(N1),r=ei,n=m(Dn),i=Nr,a=y(d5()),s=Ir,o=m(n5()),f=Jo,c=lt,u=wt,l=m(Sn);function p(h){if(typeof WeakMap!="function")return null;var T=new WeakMap,$=new WeakMap;return(p=function(L){return L?$:T})(h)}function y(h,T){if(h&&h.__esModule)return h;if(h===null||typeof h!="object"&&typeof h!="function")return{default:h};var $=p(T);if($&&$.has(h))return $.get(h);var L={__proto__:null},j=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var F in h)if(F!=="default"&&{}.hasOwnProperty.call(h,F)){var H=j?Object.getOwnPropertyDescriptor(h,F):null;H&&(H.get||H.set)?Object.defineProperty(L,F,H):L[F]=h[F]}return L.default=h,$&&$.set(h,L),L}function m(h){return h&&h.__esModule?h:{default:h}}const{ScriptValue:A}=s.values;function S(h,T){console.log(`[${h}] ${T}`)}const w={configHashCode:0,_predefinedInfos:[],_customInfos:[],get infos(){return[...this._predefinedInfos,...this._customInfos]}};function C(){w.configHashCode=0,w._predefinedInfos=[],w._customInfos=[]}function O(){return w}function M(h){w._customInfos=h}function U({config:h=void 0}={}){h=h||(0,i.getConfig)();const T=()=>{var L,j,F,H;const q=(L=h)===null||L===void 0?void 0:L.SCRIPTS.SECP256K1_BLAKE160,X=(j=h)===null||j===void 0?void 0:j.SCRIPTS.SECP256K1_BLAKE160_MULTISIG,te=(F=h)===null||F===void 0?void 0:F.SCRIPTS.ANYONE_CAN_PAY,ne=(H=h)===null||H===void 0?void 0:H.SCRIPTS.OMNILOCK,N=[];return q?N.push({codeHash:q.CODE_HASH,hashType:q.HASH_TYPE,lockScriptInfo:n.default}):S("warn","SECP256K1_BLAKE160 script info not found in config!"),X?N.push({codeHash:X.CODE_HASH,hashType:X.HASH_TYPE,lockScriptInfo:e.default}):S("warn","SECP256K1_BLAKE160_MULTISIG script info not found in config!"),te?N.push({codeHash:te.CODE_HASH,hashType:te.HASH_TYPE,lockScriptInfo:o.default}):S("warn","ANYONE_CAN_PAY script info not found in config!"),ne?N.push({codeHash:ne.CODE_HASH,hashType:ne.HASH_TYPE,lockScriptInfo:l.default}):S("warn","OMNILOCK script info not found in config!"),N},$=s.utils.hashCode(Buffer.from(JSON.stringify(h)));w.infos.length===0?(w._predefinedInfos=T(),w.configHashCode=$):$!==w.configHashCode&&(S("warn","`config` changed, regenerate lockScriptInfos!"),w._predefinedInfos=T(),w.configHashCode=$)}async function K(h,T,$,L,j,F,{config:H=void 0,useLocktimeCellsFirst:q=!0,LocktimePoolCellCollector:X=a.CellCollector}={}){var te;H=H||(0,i.getConfig)();const ne=u.BI.from(L);if(!$)throw new Error("You must provide a to address!");const N=(0,t.parseAddress)($,{config:H}),P={cellOutput:{capacity:"0x"+ne.toString(16),lock:N,type:void 0},data:"0x"};U({config:H});const re=w.infos.find(ue=>ue.codeHash===N.codeHash&&ue.hashType===N.hashType);return re&&(te=re.lockScriptInfo)!==null&&te!==void 0&&te.setupOutputCell?h=await re.lockScriptInfo.setupOutputCell(h,P,{config:H}):h=h.update("outputs",ue=>ue.push(P)),h=await Q(h,T,ne.toString(),j,F,{config:H,useLocktimeCellsFirst:q,LocktimePoolCellCollector:X}),h}async function Q(h,T,$,L,j,{config:F=void 0,useLocktimeCellsFirst:H=!0,LocktimePoolCellCollector:q=a.CellCollector,enableDeductCapacity:X=!0}={}){F=F||(0,i.getConfig)();let ne=u.BI.from($);if(T.length===0)throw new Error("No from info provided!");const P={cellOutput:{capacity:"0x0",lock:(0,r.parseFromInfo)(L||T[0],{config:F}).fromScript,type:void 0},data:"0x"},re=u.BI.from((0,t.minimalCellCapacityCompatible)(P));let ue=u.BI.from(0);if(H){if(j){const de=await a.default.injectCapacityWithoutChangeCompatible(h,T,ne.toString(),j,re.toString(),{config:F,LocktimeCellCollector:q,enableDeductCapacity:X});h=de.txSkeleton,ne=u.BI.from(de.capacity),ue=u.BI.from(de.changeCapacity)}if(ne.gt(0)){const de=await R(h,T,ne,re,{config:F,enableDeductCapacity:X});h=de.txSkeleton,ne=de.capacity,ue=de.changeCapacity}else if(ne.eq(0)&&ue.gt(0)&&ue.lt(re)){const de=await R(h,T,re.sub(ue),u.BI.from(0),{config:F,enableDeductCapacity:X});h=de.txSkeleton,ne=de.capacity,ue=de.changeCapacity}}else{const de=await R(h,T,ne,re,{config:F,enableDeductCapacity:X});if(h=de.txSkeleton,ne=de.capacity,ue=de.changeCapacity,j){if(ne.gt(0)){const V=await a.default.injectCapacityWithoutChangeCompatible(h,T,ne.toString(),j,re.toString(),{config:F,LocktimeCellCollector:q,enableDeductCapacity:X});h=V.txSkeleton,ne=u.BI.from(V.capacity),ue=u.BI.from(V.changeCapacity)}else if(ne.eq(0)&&ue.gt(0)&&ue.lt(re)){const V=await a.default.injectCapacityWithoutChangeCompatible(h,T,re.sub(ue).toString(),j,0,{config:F,LocktimeCellCollector:q,enableDeductCapacity:X});h=V.txSkeleton,ne=u.BI.from(V.capacity),ue=u.BI.from(V.changeCapacity)}}}if(ne.gt(0))throw new Error("Not enough capacity in from infos!");if(ue.gt(0)&&ue.lt(re))throw new Error("Not enough capacity in from infos for change!");return ue.gt(0)&&(P.cellOutput.capacity="0x"+ue.toString(16),h=h.update("outputs",de=>de.push(P))),h}async function k(h,T,$,L,{config:j=void 0,useLocktimeCellsFirst:F=!0,enableDeductCapacity:H=!0}={}){return Q(h,T,$,void 0,L,{config:j,useLocktimeCellsFirst:F,enableDeductCapacity:H})}function G(h,{config:T=void 0}={}){T=T||(0,i.getConfig)(),U({config:T});for(const $ of w.infos)h=$.lockScriptInfo.prepareSigningEntries(h,{config:T});return h}async function W(h,T,$,L,{config:j=void 0,enableDeductCapacity:F=!0}={}){const H=await R(h,T,$,L,{config:j,enableDeductCapacity:F});return{txSkeleton:H.txSkeleton,capacity:BigInt(H.capacity.toString()),changeCapacity:BigInt(H.changeCapacity.toString())}}async function R(h,T,$,L,{config:j=void 0,enableDeductCapacity:F=!0}={}){j=j||(0,i.getConfig)();let H=u.BI.from($);const q=h.get("cellProvider");if(!q)throw new Error("Cell Provider is missing!");const X=P=>{var re,ue;return`${(re=P.outPoint)===null||re===void 0?void 0:re.txHash}_${(ue=P.outPoint)===null||ue===void 0?void 0:ue.index}`};let te=(0,f.Set)();for(const P of h.get("inputs"))te=te.add(X(P));const ne=T.map(P=>(0,r.parseFromInfo)(P,{config:j}).fromScript);for(const P of ne)F&&H.gt(0)&&([h,H]=_(h,P,H));U({config:j});let N=u.BI.from(0);if(H.gt(0))e:for(const P of T){const re=w.infos.map(ue=>new ue.lockScriptInfo.CellCollector(P,q,{config:j}));for(const ue of re)for await(const de of ue.collect()){const V=X(de);if(te.has(V))continue;te=te.add(V);const J=await I(h,de,P,{config:j,needCapacity:H});h=J.txSkeleton;const ie=u.BI.from(J.availableCapacity);let ce=ie;if(ce.gt(H)&&(ce=H),H=H.sub(ce),N=N.add(ie.sub(ce)),H.eq(0)&&(N.eq(0)||N.gt(L)))break e}}return{txSkeleton:h,capacity:H,changeCapacity:N}}function _(h,T,$){let L=u.BI.from($);const j=h.get("fixedEntries").filter(({field:H})=>H==="outputs").maxBy(({index:H})=>H);let F=j?j.index+1:0;for(;FN.update(F,()=>q))}}return h=h.update("outputs",H=>H.filter(q=>u.BI.from(q.cellOutput.capacity).toString()!==u.BI.from(0).toString())),[h,L]}async function I(h,T,$,{config:L=void 0,since:j=void 0,defaultWitness:F="0x",needCapacity:H=void 0}={}){L=L||(0,i.getConfig)(),h=await b(h,T,$,{config:L,since:j,defaultWitness:F});const q=h.get("outputs").size-1,X=h.get("outputs").get(q);if(!X)throw new Error("Impossible: can not find last output");const te=u.BI.from(X.cellOutput.capacity),ne=h.get("fixedEntries").findIndex(ue=>ue.field==="outputs"&&ue.index===q),N=T.cellOutput.lock;let P=u.BI.from(0);if(L.SCRIPTS.ANYONE_CAN_PAY&&(0,c.isAcpScript)(N,L)){const ue=!!($&&typeof $=="object"&&"destroyable"in $&&$.destroyable),de=H?u.BI.from(H):te;if(ue)P=te,h=h.update("outputs",V=>V.remove(q)),ne>=0&&(h=h.update("fixedEntries",V=>V.remove(ne)));else{const V=u.BI.from((0,t.minimalCellCapacityCompatible)(X)),J=te.sub(V),ie=JSON.parse(JSON.stringify(X));let ce=V;P=J,de.lt(J)&&(ce=te.sub(de),P=de),ie.cellOutput.capacity="0x"+ce.toString(16),h=h.update("outputs",ye=>ye.update(q,()=>ie))}}else if(ne<0){var re;P=u.BI.from((re=h.get("outputs").get(q))===null||re===void 0?void 0:re.cellOutput.capacity),h=h.update("outputs",ue=>ue.remove(q))}return{txSkeleton:h,availableCapacity:P}}async function b(h,T,$,{config:L=void 0,since:j=void 0,defaultWitness:F=void 0}={}){L=L||(0,i.getConfig)(),U({config:L});const H=T.cellOutput.lock,q=w.infos.find(X=>X.codeHash===H.codeHash&&X.hashType===H.hashType);if(!q)throw new Error("No LockScriptInfo found for setupInputCell!");return q.lockScriptInfo.setupInputCell(h,T,$,{config:L,since:j,defaultWitness:F})}async function v(h,T,$,L,{config:j=void 0,useLocktimeCellsFirst:F=!0,enableDeductCapacity:H=!0}={}){let q=0,X=h,te=x(X);for(;te>q;){q=te;const ne=g(q,$);X=await k(h,T,ne,L,{config:j,useLocktimeCellsFirst:F,enableDeductCapacity:H}),te=x(X)}return X}function d(h,T){const $=g(h,T);return BigInt($.toString())}function g(h,T){const $=u.BI.from(1e3),L=u.BI.from(h).mul(T),j=L.div($);return j.mul($).lt(L)?j.add(1):u.BI.from(j)}function x(h){const T=(0,t.createTransactionFromSkeleton)(h);return E(T)}function E(h){return s.blockchain.Transaction.pack(h).byteLength+4}return Vi.default={transfer:K,payFee:k,prepareSigningEntries:G,injectCapacity:Q,setupInputCell:b,registerCustomLockScriptInfos:M,payFeeByFeeRate:v,__tests__:{_commonTransfer:W,resetLockScriptInfos:C,getLockScriptInfos:O,generateLockScriptInfos:U,getTransactionSizeByTx:E,getTransactionSize:x,calculateFee:d,calculateFeeCompatible:g}},Vi}var GA;function p5(){if(GA)return Hn;GA=1,Object.defineProperty(Hn,"__esModule",{value:!0}),Hn.CellCollector=void 0,Hn.calculateDaoEarliestSince=Q,Hn.calculateDaoEarliestSinceCompatible=k,Hn.calculateMaximumWithdraw=_,Hn.calculateMaximumWithdrawCompatible=I,Hn.default=void 0,Hn.deposit=w,Hn.extractDaoDataCompatible=R,Hn.listDaoCells=S,Hn.unlock=K;var t=pi(),e=Ir,r=st,n=Nr,i=l(Dn),a=l(N1),s=ei,o=lt,f=wt,c=R2(),u=l(h5());function l(b){return b&&b.__esModule?b:{default:b}}const{parseSince:p}=e.since,y="0x0000000000000000",m=f.BI.from(180);class A{constructor(v,d,g,{config:x=void 0}={}){if(!d)throw new Error("Cell Provider is missing!");x=x||(0,n.getConfig)();const E=(0,s.parseFromInfo)(v,{config:x}).fromScript,h=(0,o.generateDaoScript)(x),T=g==="deposit"?y:"any";this.cellType=g,this.cellCollector=d.collector({lock:E,type:h,data:T})}async*collect(){for await(const v of this.cellCollector.collect())this.cellType==="withdraw"&&v.data===y||(yield v)}}Hn.CellCollector=A;async function*S(b,v,d,{config:g=void 0}={}){const x=new A(v,b,d,{config:g});for await(const E of x.collect())yield E}async function w(b,v,d,g,{config:x=void 0,enableNonSystemScript:E=!1}={}){x=x||(0,n.getConfig)();const h=x.SCRIPTS.DAO;if(!h)throw new Error("Provided config does not have DAO script setup!");if(C(v,x),b=W(b,x),!d)throw new Error("You must provide a to address!");const T=(0,t.parseAddress)(d,{config:x}),$={codeHash:h.CODE_HASH,hashType:h.HASH_TYPE,args:"0x"};b=b.update("outputs",j=>j.push({cellOutput:{capacity:"0x"+f.BI.from(g).toString(16),lock:T,type:$},data:y,outPoint:void 0,blockHash:void 0}));const L=b.get("outputs").size-1;if(b=b.update("fixedEntries",j=>j.push({field:"outputs",index:L})),typeof v=="string"){const j=(0,t.parseAddress)(v,{config:x});(0,o.isSecp256k1Blake160Script)(j,x)?b=await i.default.injectCapacity(b,L,v,{config:x}):(0,o.isSecp256k1Blake160MultisigScript)(j,x)?b=await a.default.injectCapacity(b,L,v,{config:x}):E&&(b=await u.default.injectCapacity(b,[v],g,(0,t.encodeToAddress)((0,s.parseFromInfo)(v).fromScript,{config:x}),void 0,{config:x}))}else v&&((0,s.isMultisigFromInfo)(v)?b=await a.default.injectCapacity(b,L,v,{config:x}):E&&(b=await u.default.injectCapacity(b,[v],g,(0,t.encodeToAddress)((0,s.parseFromInfo)(v).fromScript,{config:x}),void 0,{config:x})));return b}function C(b,v){let d;if(typeof b=="string"){const x=(0,t.parseAddress)(b,{config:v}).args;x.length===58&&(d=r.number.Uint64LE.unpack("0x"+x.slice(42)).toHexString())}else"R"in b&&(d=b.since);if(d!=null){const{relative:g,type:x}=p(d);if(!(!g&&x==="epochNumber"))throw new Error("Can't deposit a dao cell with multisig locktime which not using absolute-epoch-number format!")}}async function O(b,v,d,{config:g=void 0,enableNonSystemScript:x=!1}={}){if(g=g||(0,n.getConfig)(),G(g),b=W(b,g),b.get("inputs").size!==b.get("outputs").size)throw new Error("Input size must equals to output size in txSkeleton!");if(!g.SCRIPTS.DAO)throw new Error("Provided config does not have DAO script setup!");if(!b.get("cellProvider"))throw new Error("Cell provider is missing!");const h=v.cellOutput.type,T=g.SCRIPTS.DAO;if(!h||h.codeHash!==T.CODE_HASH||h.hashType!==T.HASH_TYPE||v.data!==y)throw new Error("fromInput is not a DAO deposit cell.");const $=v.cellOutput.lock;(0,o.isSecp256k1Blake160Script)($,g)?b=await i.default.setupInputCell(b,v,void 0,{config:g}):(0,o.isSecp256k1Blake160MultisigScript)($,g)?b=await a.default.setupInputCell(b,v,d||(0,t.generateAddress)($,{config:g}),{config:g}):x&&(b=await u.default.setupInputCell(b,v,d||(0,t.encodeToAddress)($,{config:g}),{config:g}));const L=b.get("outputs").size-1,j=b.get("outputs").get(L),F=JSON.parse(JSON.stringify(j));if(v.blockNumber)F.data=r.bytes.hexify(r.number.Uint64.pack(v.blockNumber));else throw new Error("fromInput has no blockNumber!");return b=b.update("outputs",H=>H.update(L,()=>F)),b=b.update("headerDeps",H=>H.push(v.blockHash)),b=b.update("fixedEntries",H=>H.push({field:"inputs",index:b.get("inputs").size-1},{field:"outputs",index:b.get("outputs").size-1})),b}function M(b){const v=f.BI.from(b);return{length:v.shr(40).and(4095),index:v.shr(24).and(4095),number:v.and(16777215)}}function U({length:b,index:v,number:d}){const g=f.BI.from(b),x=f.BI.from(v),E=f.BI.from(d);return f.BI.from(32).shl(56).add(g.shl(40)).add(x.shl(24)).add(E)}async function K(b,v,d,g,x,{config:E=void 0,RpcClient:h=c.RPC}={}){if(E=E||(0,n.getConfig)(),G(E),b=W(b,E),!E.SCRIPTS.DAO)throw new Error("Provided config does not have DAO script setup!");const T=b.get("cellProvider");if(!T)throw new Error("Cell provider is missing!");const $=new h(T.uri),L=v.cellOutput.type,j=E.SCRIPTS.DAO;if(!L||L.codeHash!==j.CODE_HASH||L.hashType!==j.HASH_TYPE||v.data!==y)throw new Error("depositInput is not a DAO deposit cell.");const F=d.cellOutput.type;if(!F||F.codeHash!==j.CODE_HASH||F.hashType!==j.HASH_TYPE||d.data===y)throw new Error("withdrawInput is not a DAO withdraw cell.");const H=await $.getHeader(v.blockHash),q=M(H.epoch),X=await $.getHeader(d.blockHash),te=M(X.epoch),ne=te.index.mul(q.length),N=q.index.mul(te.length);let P=te.number.sub(q.number);ne.gt(N)&&(P=P.add(1));const re=P.add(m).sub(1).div(m).mul(m),ue={number:f.BI.from(q.number.add(re)),index:f.BI.from(q.index),length:f.BI.from(q.length)},de=U(ue),V="0x"+I(d,H.dao,X.dao).toString(16),J=(0,t.parseAddress)(g,{config:E});b=b.update("outputs",He=>He.push({cellOutput:{capacity:V,lock:J,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0}));const ie="0x"+de.toString(16);for(;b.get("witnesses").sizeHe.push("0x"));b=b.update("headerDeps",He=>He.push(v.blockHash,d.blockHash));const ce=b.get("headerDeps").size-2,ye={inputType:r.bytes.hexify(r.number.Uint64LE.pack(ce))},ge=r.bytes.hexify(e.blockchain.WitnessArgs.pack(ye)),Se=d.cellOutput.lock;(0,o.isSecp256k1Blake160Script)(Se,E)?b=await i.default.setupInputCell(b,d,void 0,{config:E,since:ie,defaultWitness:ge}):(0,o.isSecp256k1Blake160MultisigScript)(Se,E)&&(b=await a.default.setupInputCell(b,d,x||(0,t.generateAddress)(Se,{config:E}),{config:E,since:ie,defaultWitness:ge}));const kt=b.get("outputs").size-1;return b=b.update("outputs",He=>He.remove(kt)),b=b.update("fixedEntries",He=>He.push({field:"inputs",index:b.get("inputs").size-1},{field:"outputs",index:b.get("outputs").size-1},{field:"witnesses",index:b.get("witnesses").size-1},{field:"headerDeps",index:b.get("headerDeps").size-2})),b}function Q(b,v){const d=k(b,v);return BigInt(d.toString())}function k(b,v){const d=M(b),g=M(v),x=g.index.mul(d.length),E=d.index.mul(g.length);let h=g.number.sub(d.number);x.gt(E)&&(h=h.add(1));const T=h.add(m).sub(1).div(m).mul(m),$={number:f.BI.from(d.number.add(T)),index:f.BI.from(d.index),length:f.BI.from(d.length)};return U($)}function G(b){if(!b.SCRIPTS.DAO)throw new Error("Provided config does not have DAO script setup!")}function W(b,v){const d=v.SCRIPTS.DAO;return(0,o.addCellDep)(b,{outPoint:{txHash:d.TX_HASH,index:d.INDEX},depType:d.DEP_TYPE})}function R(b){if(!/^(0x)?([0-9a-fA-F]){64}$/.test(b))throw new Error("Invalid dao format!");const v=8*2,d=b.startsWith("0x")?b.slice(2):b;return["c","ar","s","u"].map((g,x)=>({[g]:r.number.Uint64LE.unpack("0x"+d.slice(v*x,v*(x+1)))})).reduce((g,x)=>({...g,...x}),{})}function _(b,v,d){return I(b,v,d).toBigInt()}function I(b,v,d){const g=f.BI.from(R(v).ar),x=f.BI.from(R(d).ar),E=f.BI.from((0,t.minimalCellCapacityCompatible)(b));return f.BI.from(b.cellOutput.capacity).sub(E).mul(x).div(g).add(E)}return Hn.default={deposit:w,withdraw:O,unlock:K,calculateMaximumWithdraw:_,calculateMaximumWithdrawCompatible:I,calculateDaoEarliestSince:Q,calculateDaoEarliestSinceCompatible:k,CellCollector:A,listDaoCells:S},Hn}var N2=p5();const qt=100000000n;function Ec(t){return"0x"+t.toString(16)}function Np(...t){return t.reduce((e,r)=>e>r?e:r)}function tQ(...t){return t.reduce((e,r)=>eEn(e.cellOutput.lock,t)?t:void 0}function rQ(t,e){const r=[],n=[];for(const i of t){if(i.cellOutput.type!==void 0||i.data!=="0x"){n.push(i);continue}const a=e(i);if(!a){n.push(i);continue}r.push(Yt.from({...i,cellOutput:{lock:a,capacity:i.cellOutput.capacity}}))}return{capacities:r,notCapacities:n}}function nQ(t,e,r){const n=[],i=[];for(const a of t){if(!En(a.cellOutput.type,e)){i.push(a);continue}const s=r(a);if(!s){i.push(a);continue}n.push(Yt.from({...a,cellOutput:{lock:s,type:e,capacity:a.cellOutput.capacity}}))}return{types:n,notTypes:i}}function iQ(t,e,r){const n=h1(r.epoch),i=[],a=[];for(const s of t)U2(n,Cp(e(s)))>=0?i.push(s):a.push(s);return{mature:i,notMature:a}}const aQ="Comparing two Scripts that both are undefined";function En(t,e){if(!t&&!e)throw Error(aQ);return!t||!e?!1:t.codeHash===e.codeHash&&t.hashType===e.hashType&&t.args===e.args}function U2(t,e){if(t.numbere.number)return 1;const r=t.index*e.length,n=e.index*t.length;return rn?1:0}const sQ="Zero EpochSinceValue length";function rM(t,e){if(t.length===0||e.length===0)throw Error(sQ);t.length!==e.length&&(e={length:t.length,index:Math.ceil(e.index*t.length/e.length),number:e.number});const r=t.index+e.index,n=t.length,i=r%n,a=t.number+(r-i)/n;return{length:n,index:i,number:a}}function oQ(t){const e=[...t];for(let r=e.length-1;r>0;r--){const n=Math.floor(Math.random()*(r+1));[e[r],e[n]]=[e[n],e[r]]}return e}function fQ(t,e){let[r,n]=[0,t];for(;r0)throw Error(lQ)}const o=e=="matched",f=o?i.inputs+1:t.inputs.size,c=o?i.outputs+1:t.outputs.size;return t=bQ(t,a,s),t=pQ(t,a,s),t=hQ(t,f,a),t=dQ(t,f,a,c,s),t=t.update("inputs",u=>u.splice(f,0,...a)),t=t.update("outputs",u=>u.splice(c,0,...s)),o&&(t=g5(t,i.set("inputs",i.inputs+a.size).set("outputs",i.outputs+s.size))),t}const WA=gc(ey.pack({lock:void 0,inputType:void 0,outputType:void 0}));function dQ(t,e,r,n,i){const a=Np(t.inputs.size,t.outputs.size,t.witnesses.size,e,n),s=[],o=[],f=[];for(let l=0;ll.cellOutput.lock[uu])),o.splice(e,0,...r.map(l=>{var p;return(p=l.cellOutput.type)==null?void 0:p[uu]})),f.splice(n,0,...i.map(l=>{var p;return(p=l.cellOutput.type)==null?void 0:p[uu]}));const c=Np(o.length,f.length),u=[];for(let l=0;lt.inputSinces.get(o,n)),a=[];for(const s of r){const o=s.cellOutput.lock[Hs],f=s.cellOutput.type?s.cellOutput.type[Hs]:o;o===n||o===f?a.push(f):f===n?a.push(o):U2(Cp(o),Cp(f))==-1?a.push(f):a.push(o)}return i.splice(e,0,...a),t.set("inputSinces",Zo(i.map((s,o)=>[o,s]).filter(({1:s})=>s!==n)))}function pQ(t,e,r){const n=[];for(const i of e){const a=i.cellOutput.lock;n.push(...a[fi])}for(const i of[...e,...r]){const a=i.cellOutput.type;a!==void 0&&n.push(...a[fi])}return nM(t,...n.map(i=>i.hash))}function nM(t,...e){const r=b5(t);let n=t.headerDeps.push(...e);return n=Aa(new Set(n)),t=g5(t,r.set("headerDeps",n.size-1)),t.set("headerDeps",n)}function bQ(t,e,r){const n=[];for(const i of e){const a=i.cellOutput.lock;n.push(...a[Oi])}for(const i of[...e,...r]){const a=i.cellOutput.type;a!==void 0&&n.push(...a[Oi])}return yQ(t,...n)}const gQ=t=>`${t.outPoint.txHash}-${t.outPoint.index}-${t.depType}`;function yQ(t,...e){const r=b5(t);let n=t.cellDeps.push(...e);return n=Aa(new Map(n.map(i=>[gQ(i),i])).values()),t=g5(t,r.set("cellDeps",n.size-1)),t.set("cellDeps",n)}function b5(t){return AQ(t.fixedEntries.sort((e,r)=>e.index-r.index).map(e=>[e.field,e.index]))}const vQ=Aa(["cellDeps","headerDeps","inputs","outputs"]);function g5(t,e){return t.set("fixedEntries",vQ.map(r=>Object.freeze({field:r,index:e[r]})).filter(({index:r})=>r>=0))}function _Q(t){return t.inputs.size>0&&t.outputs.size>0}function mQ(t){return Y4.pack(w2.createTransactionFromSkeleton(t)).byteLength+4}function wQ(t,e){const r=1000n,n=BigInt(t)*e,i=n/r;return i*rYt.from({...c,cellOutput:{lock:u,type:xn.from({...o,[fi]:p?[l,p]:[l],[Hs]:y??o[Hs]}),capacity:c.cellOutput.capacity},blockHash:l.hash});for(const c of t){const u=e(c);if(!u||!y5(c,n)){s.push(c);continue}if(!c.blockNumber)throw Error(iM);const l=r(c.blockNumber,c);if(c.data===k2)i.push(f(c,u,l));else{const p=r(Ec(Td.unpack(c.data)),c),y=N2.calculateDaoEarliestSinceCompatible(p.epoch,l.epoch).toHexString();a.push(f(c,u,l,p,y))}}return{deposits:i,withdrawalRequests:a,notDaos:s}}const k2="0x0000000000000000";function y5(t,e){return En(t.cellOutput.type,e.defaultScript("DAO"))}function aM(t,e){return y5(t,e)&&t.data===k2}function sM(t,e){return y5(t,e)&&t.data!==k2}function EQ(t,e,r,n){const i=Yt.from({lock:r,type:n.defaultScript("DAO"),data:k2}),a=e.map(s=>Yt.from({...i,capacity:Ec(s)}));return Ea(t,"append",[],a)}const xQ="Withdrawal request lock has different size";function SQ(t,e,r){const n=[];for(const i of e){if(i.cellOutput.lock.args.length!=r.args.length)throw Error(xQ);n.push(Yt.from({...i.cellOutput,lock:r,data:gc(Td.pack(BigInt(i.blockNumber)))}))}return Ea(t,"matched",e,n)}function IQ(t,e){const r=[];for(const a of e)r.push(...a.cellOutput.type[fi].map(s=>s.hash));t=nM(t,...r);const n=[],i=new Map(t.headerDeps.map((a,s)=>[a,s]));for(const a of e){const s=a.cellOutput.type[fi][1];n.push(Yt.from({...a,type:xn.from({...a.cellOutput.type,[uu]:gc(Td.pack(i.get(s.hash)))})}))}return Ea(t,"append",n,[])}function CQ(t,e){const r=H$(e),n=t.cellOutput.type[fi][0].epoch;return Cp(N2.calculateDaoEarliestSinceCompatible(n,r).toHexString())}function vg(t,e){let r=0n;for(const n of t.inputs)if(sM(n,e)){const i=n,[a,s]=i.cellOutput.type[fi],o=N2.calculateMaximumWithdraw(n,s.dao,a.dao);r+=o}else r+=BigInt(n.cellOutput.capacity);return t.outputs.forEach(n=>r-=BigInt(n.cellOutput.capacity)),r}function TQ(t,e,r,n){let i=Yt.from({lock:e});const a=BigInt(i.cellOutput.capacity),s=Ea(t,"append",[],[i]),o=r(s),f=vg(s,n)-o;return f>0n?(i=Yt.from({...i,capacity:Ec(a+f)}),t=Ea(t,"append",[],[i])):t=s,{tx:t,txFee:o,freeCkb:f}}function OQ(){const t=n2.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=_e.jsx(_e.Fragment,{children:_e.jsxs("h1",{className:"flex flex-row items-center justify-center py-8 text-5xl font-medium",children:[_e.jsx("span",{className:"mr-2 text-5xl text-amber-400",children:"{"}),_e.jsx("span",{children:"iCKB DApp"}),_e.jsx("span",{className:"ml-2 text-5xl text-amber-400",children:"}"})]})}),t[0]=e):e=t[0],e}function ZA(t){const e=n2.c(8),{walletConfig:r}=t,{chain:n,address:i}=r,a=`https://${n!=="mainnet"?"testnet.":""}explorer.nervos.org/address/${i}`;let s,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=_e.jsx("span",{className:"mr-2 text-5xl text-amber-400",children:"{"}),o={direction:"rtl"},e[0]=s,e[1]=o):(s=e[0],o=e[1]);let f;e[2]!==i?(f=_e.jsx("h1",{style:o,className:"-ml-3 truncate text-3xl",children:i}),e[2]=i,e[3]=f):f=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=_e.jsx("span",{className:"ml-2 text-5xl text-amber-400",children:"}"}),e[4]=c):c=e[4];let u;return e[5]!==a||e[6]!==f?(u=_e.jsxs("a",{href:a,target:"_blank",className:"flex flex-row items-center justify-center rounded-2xl py-8 font-medium",children:[s,f,c]}),e[5]=a,e[6]=f,e[7]=u):u=e[7],u}function oM(t){return t==="C"}function a6(t){return t?"C":"I"}function BQ(t){let e=0;for(;eU2(e,r)===-1?r:e)}const uM=Object.freeze({number:0,index:0,length:1}),Fl=Object.freeze({tx:w2.TransactionSkeleton(),error:"",fee:0n,estimatedMaturity:uM}),lM=1000n*qt,{union:MQ,struct:ju}=st.molecule;function RQ(t){return st.createFixedBytesCodec({pack:st.bytes.bytify,unpack:st.bytes.hexify,byteLength:t})}const LQ=RQ(32),dM=ju({depositQuantity:RF,depositAmount:Td},["depositQuantity","depositAmount"]),hM=ju({ownedDistance:PB},["ownedDistance"]),JA=ju({ckbMultiplier:Td,udtMultiplier:Td},["ckbMultiplier","udtMultiplier"]),pM=ju({ckbToUdt:JA,udtToCkb:JA,ckbMinMatchLog:MF},["ckbToUdt","udtToCkb","ckbMinMatchLog"]),HQ=ju({padding:LQ,masterDistance:PB,orderInfo:pM},["padding","masterDistance","orderInfo"]),PQ=ju({masterOutpoint:LF,orderInfo:pM},["masterOutpoint","orderInfo"]),eE=MQ({MintOrderData:HQ,MatchOrderData:PQ},["MintOrderData","MatchOrderData"]),Th=ju({udtAmount:e6},["udtAmount"]),v5=st.createBytesCodec({pack:t=>st.bytes.concat(Th.pack(t),eE.pack(t)),unpack:t=>{const e=t.slice(0,Th.byteLength),r=t.slice(Th.byteLength),n=Th.unpack(e),i=eE.unpack(r);return{...n,...i}}}),NQ=[{name:"ICKB_LOGIC",tx_hash:"0x80930f4b12169ce124840aeb42a9d3105d592584382e95d1ada111da8347e337",index:0,occupied_capacity:54717e8,data_hash:"0x2a8100ab5990fa055ab1b50891702e1e895c7bd1df6322cd725c1a6115873bd3",type_id:null},{name:"LIMIT_ORDER",tx_hash:"0x80930f4b12169ce124840aeb42a9d3105d592584382e95d1ada111da8347e337",index:1,occupied_capacity:34261e8,data_hash:"0x49dfb6afee5cc8ac4225aeea8cb8928b150caf3cd92fea33750683c74b13254a",type_id:null},{name:"OWNED_OWNER",tx_hash:"0x80930f4b12169ce124840aeb42a9d3105d592584382e95d1ada111da8347e337",index:2,occupied_capacity:27981e8,data_hash:"0xacc79e07d107831feef4c70c9e683dac5644d5993b9cb106dca6e74baa381bd0",type_id:null},{name:"XUDT",tx_hash:"0x80930f4b12169ce124840aeb42a9d3105d592584382e95d1ada111da8347e337",index:3,occupied_capacity:33757e8,data_hash:"0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95",type_id:null}],UQ=[{name:"ickb_dep_group",tx_hash:"0x0152f73978779b99eb5aeed9ae9879a7004bd7c69fd858da443b535cb2c9df1d",index:0,data_hash:"0xb208b98b17ff0f740464299171f2285cbd4dcf6792a4058a9ff365eed15e19e3",occupied_capacity:353e8}],kQ={cell_recipes:NQ,dep_group_recipes:UQ},zQ=[{name:"ICKB_LOGIC",tx_hash:"0x9ac989b3355764f76cdce02c69dedb819fdfbcbda49a7db1a2c9facdfdb9a7fe",index:0,occupied_capacity:54717e8,data_hash:"0x2a8100ab5990fa055ab1b50891702e1e895c7bd1df6322cd725c1a6115873bd3",type_id:null},{name:"LIMIT_ORDER",tx_hash:"0x9ac989b3355764f76cdce02c69dedb819fdfbcbda49a7db1a2c9facdfdb9a7fe",index:1,occupied_capacity:34261e8,data_hash:"0x49dfb6afee5cc8ac4225aeea8cb8928b150caf3cd92fea33750683c74b13254a",type_id:null},{name:"OWNED_OWNER",tx_hash:"0x9ac989b3355764f76cdce02c69dedb819fdfbcbda49a7db1a2c9facdfdb9a7fe",index:2,occupied_capacity:27981e8,data_hash:"0xacc79e07d107831feef4c70c9e683dac5644d5993b9cb106dca6e74baa381bd0",type_id:null}],$Q=[{name:"ickb_dep_group",tx_hash:"0xf7ece4fb33d8378344cab11fcd6a4c6f382fd4207ac921cf5821f30712dcd311",index:0,data_hash:"0x8d3a9737808fc4a3c7f9e554be9045333c5082bf3b82f8a33873c367a2b2307f",occupied_capacity:353e8}],jQ={cell_recipes:zQ,dep_group_recipes:$Q},FQ=[{name:"ICKB_LOGIC",tx_hash:"0xd7309191381f5a8a2904b8a79958a9be2752dbba6871fa193dab6aeb29dc8f44",index:0,occupied_capacity:54717e8,data_hash:"0x2a8100ab5990fa055ab1b50891702e1e895c7bd1df6322cd725c1a6115873bd3",type_id:null},{name:"LIMIT_ORDER",tx_hash:"0xd7309191381f5a8a2904b8a79958a9be2752dbba6871fa193dab6aeb29dc8f44",index:1,occupied_capacity:34261e8,data_hash:"0x49dfb6afee5cc8ac4225aeea8cb8928b150caf3cd92fea33750683c74b13254a",type_id:null},{name:"OWNED_OWNER",tx_hash:"0xd7309191381f5a8a2904b8a79958a9be2752dbba6871fa193dab6aeb29dc8f44",index:2,occupied_capacity:27981e8,data_hash:"0xacc79e07d107831feef4c70c9e683dac5644d5993b9cb106dca6e74baa381bd0",type_id:null}],qQ=[{name:"ickb_dep_group",tx_hash:"0x621a6f38de3b9f453016780edac3b26bfcbfa3e2ecb47c2da275471a5d3ed165",index:0,data_hash:"0x94d59795c742dfb381c8e8d8beee0362d0bf8f8921212ed15f87acd89a3ce78b",occupied_capacity:353e8}],KQ={cell_recipes:FQ,dep_group_recipes:qQ},QQ="The requested script is missing in the old config";function bM(t,e){const{cell_recipes:r,dep_group_recipes:n}=t==="mainnet"?KQ:t==="testnet"?jQ:kQ,{tx_hash:i,index:a}=n[0],s=Fo.from({txHash:i,index:Ec(a)}),o={};for(const c of r)o[c.name]=new tp(xn.from({...va,codeHash:c.type_id??c.data_hash,hashType:c.type_id?"type":"data1",[Oi]:[lu.from({outPoint:s,depType:"depGroup"})]}));const f=["SECP256K1_BLAKE160","DAO","SECP256K1_BLAKE160_MULTISIG"];if(t!=="devnet")if(t==="testnet")f.push("XUDT"),e={...e,XUDT:new tp(xn.from({...va,codeHash:"0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95",hashType:"data1",[Oi]:[lu.from({outPoint:Fo.from({txHash:"0xbf6fb538763efec2a70a6a3dcb7242787087e1030c4e7d86585bc63a9d337f5f",index:"0x0"}),depType:"code"})]}))};else{if(e.XUDT.HASH_TYPE!=="data1")throw Error("Expected data1 hashType for XUDT");f.push("XUDT")}for(const c of f){const u=e[c];if(!u)throw Error(QQ);o[c]=new tp(xn.from({...u.defaultScript,[Oi]:[lu.from({outPoint:s,depType:"depGroup"})]}))}return o}function tE(t,e,r,n){const i=U1(n),a=y0(n),s=[],o=[];let f=[],c=[],u=[];for(const w of t){const C=e(w);if(!C){u.push(w);continue}if(En(w.cellOutput.type,i)){s.push(Yt.from({...w,cellOutput:{lock:C,type:i,capacity:w.cellOutput.capacity}}));continue}if(!En(w.cellOutput.type,a)){u.push(w);continue}if(!w.blockNumber)throw Error(iM);o.push(Yt.from({...w,cellOutput:{lock:C,type:xn.from({...a,[fi]:[r(w.blockNumber,w)]}),capacity:w.cellOutput.capacity}}))}let l;({deposits:c,withdrawalRequests:l,notDaos:u}=XA(u,i6(a),r,n)),u=u.concat(l);const p=j2(n);({deposits:l,withdrawalRequests:f,notDaos:u}=XA(u,i6(p),r,n)),u=u.concat(l);let y;({types:y,notTypes:u}=nQ(u,p,e));const m=w=>w.txHash+w.index,A=new Map(f.map(w=>[m(w.outPoint),w])),S=[];for(const w of y){const{ownedDistance:C}=hM.unpack(w.data),O=Ec(Number(w.outPoint.index)+C),M=m({...w.outPoint,index:O}),U=A.get(M);U?(S.push(Object.freeze({owner:w,ownedWithdrawalRequest:U})),A.delete(M)):u.push(w)}return u=u.concat(Array.from(A.values())),{udts:s,receipts:o,withdrawalRequestGroups:S,ickbPool:c,notIckbs:u}}function YQ(t,e,r,n){let i=t.map(a=>Object.freeze({deposit:a,ickbValue:s6(BigInt(a.cellOutput.capacity)-$2,a.cellOutput.type[fi][0]),estimatedMaturity:{length:1,index:0,number:0}}));if(r){const a=rM(h1(e.epoch),r);i=i.map(s=>Object.freeze({...s,estimatedMaturity:CQ(s.deposit,a)})).sort((s,o)=>U2(s.estimatedMaturity,o.estimatedMaturity))}return i}function VQ(t,e,r,n){return EQ(t,Array(e).fill(r),y0(n),n)}function GQ(t,e,r){return SQ(t,e,j2(r))}function WQ(t,e){const r=[],n=[];for(const{ownedWithdrawalRequest:i,owner:a}of e)r.push(i),n.push(a);return r.length>0&&(t=IQ(t,r),t=Ea(t,"append",n,[])),t}function _g(t,e){const r=U1(e),n=y0(e);let i=0n;for(const a of t.inputs){if(En(a.cellOutput.type,r)){i+=e6.unpack(a.data.slice(0,2+16*2));continue}if(En(a.cellOutput.lock,n)&&aM(a,e)){const s=a.cellOutput.type[fi][0],o=BigInt(a.cellOutput.capacity)-$2;i-=s6(o,s);continue}if(En(a.cellOutput.type,n)){const s=a.cellOutput.type[fi][0],{depositQuantity:o,depositAmount:f}=dM.unpack(a.data);i+=s6(f,s)*BigInt(o)}}for(const a of t.outputs)En(a.cellOutput.type,r)&&(i-=e6.unpack(a.data.slice(0,2+16*2)));return i}function s6(t,e){let r=gM(t,e,!1);return gy0n){const i=Yt.from({lock:e,type:U1(r),data:gc(Th.pack({udtAmount:n}))});t=Ea(t,"append",[],[i])}return{tx:t,freeIckbUdt:n}}function ZQ(t,e,r){const n=[],i=j2(r);for(const[a,s]of t.outputs.entries()){if(!sM(s,r)||!En(s.cellOutput.lock,i))continue;const o=t.outputs.size+n.length,f=a-o;n.push(Yt.from({lock:e,type:i,data:gc(hM.pack({ownedDistance:f}))}))}return n.length>0?Ea(t,"append",[],n):t}function JQ(t,e,r){const n=y0(r),i=new Map;for(const s of t.outputs){if(!aM(s,r)||!En(s.cellOutput.lock,n))continue;const o=BigInt(s.cellOutput.capacity)-$2;let f=i.get(o);f?f.depositQuantity+=1:i.set(o,{depositQuantity:1,depositAmount:o})}const a=[];for(const s of i.values())a.push(Yt.from({lock:e,type:n,data:gc(dM.pack(s))}));return a.length>0?Ea(t,"append",[],a):t}const gy=100000n*qt;function eY(t){return yy(gy,t)}function gM(t,e,r=!0){const{ckbMultiplier:n,udtMultiplier:i}=_5(e,r);return t*n/i}function yy(t,e,r=!0){const{ckbMultiplier:n,udtMultiplier:i}=_5(e,r);return t*i/n}const yM=10000000000000000n,$2=82n*qt,tY=$2*yM/gy;function _5(t,e=!0){const n=N2.extractDaoDataCompatible(t.dao).ar.toBigInt();return{ckbMultiplier:yM,udtMultiplier:e?n+tY:n}}function U1(t){return xn.from({...t.defaultScript("XUDT"),args:s$(y0(t))+"00000080"})}function y0(t){return t.defaultScript("ICKB_LOGIC")}function j2(t){return t.defaultScript("OWNED_OWNER")}function rE(t,e){return t.ckbMultiplier===e.ckbMultiplier&&t.udtMultiplier===e.udtMultiplier}function vM(t,e){return rE(t.ckbToUdt,e.ckbToUdt)&&rE(t.udtToCkb,e.udtToCkb)&&t.ckbMinMatchLog===e.ckbMinMatchLog}function nE(t,e,r,n,i=U1(n)){const a=m5(n),{groups:s,unknowns:o}=_M(t,e,a,i),f=rY([...s.values()].map(l=>{var p;return((p=l.master)==null?void 0:p.outPoint)??l.orders[0].info.masterOutpoint}),r,a,i),c=[],u=[];for(const[l,p]of s){const y=f.get(l);if(y===void 0){const S=p.master===void 0?[]:[p.master];o.push(...S,...p.orders.map(w=>w.cell));continue}let m=-1,A=y;for(let S=0;S=0&&o.push(A.cell),m=S,A=w}if(m===-1){p.master!==void 0&&o.push(p.master);continue}p.master!==void 0?u.push(Object.freeze({...A,master:p.master})):c.push(Object.freeze(A))}return{myOrders:u,orders:c,notOrders:o}}function rY(t,e,r,n){const i=new Map,a=s=>xn.from({...va,...s.cellOutput.lock});for(const s of new Set(t.map(o=>o.txHash)))for(const[o,f]of _M(e(s),a,r,n).groups)f.master===void 0||f.orders.length!==1||!f.orders[0].info.isMint||i.set(o,{...f.orders[0],master:f.master});return i}function _M(t,e,r,n){const i=new Map,a=o=>{const f=o.txHash+o.index;let c=i.get(f);return c===void 0&&(c={master:void 0,orders:[]},i.set(f,c)),c},s=[];for(const o of t){const{lock:f,type:c}=o.cellOutput;if(En(c,r)){const u=e(o);if(u){a(o.outPoint).master=Yt.from({...o,cellOutput:{lock:u,type:r,capacity:o.cellOutput.capacity}});continue}}else if(En(f,r)&&En(c,n)){const u=nY(o);if(u!==void 0){a(u.masterOutpoint).orders.push({cell:Yt.from({...o,cellOutput:{lock:r,type:n,capacity:o.cellOutput.capacity}}),info:u});continue}}s.push(o)}return{groups:i,unknowns:s}}function nY(t){let e;try{e=v5.unpack(t.data)}catch{return}const r=e.value.orderInfo,n=vy(r.ckbToUdt),i=vy(r.udtToCkb),a=mM(r.ckbMinMatchLog);if(!vM({ckbToUdt:n,udtToCkb:i,ckbMinMatchLog:a},r)||e.type==="MintOrderData"&&e.value.padding!==w5||t.cellOutput.type===void 0||t.cellOutput.type.args.length<2)return;const s=e.type==="MintOrderData",o=Fo.from(e.type==="MintOrderData"?{txHash:t.outPoint.txHash,index:Ec(Number(t.outPoint.index)+e.value.masterDistance)}:e.value.masterOutpoint),f=1n<>1n,O=A?C:y?c*n.udtMultiplier:p*i.ckbMultiplier,M=y&&p>0n,U=m&&c>0n;return Object.freeze({isMint:s,masterOutpoint:o,ckbToUdt:n,udtToCkb:i,ckbMinMatchLog:a,ckbMinMatch:f,udtAmount:c,ckbAmount:u,ckbOccupied:l,ckbUnoccupied:p,absTotal:C,absProgress:O,isCkb2Udt:y,isUdt2Ckb:m,isDualRatio:A,isCkb2UdtMatchable:M,isUdt2CkbMatchable:U,isMatchable:M||U})}const iY=33;function aY(t,...e){const{master:r,order:n}=sY(...e);return Ea(t,"append",[],[r,n])}const iE="Order ratio are invalid";function sY(t,e,r=0n,n=0n,i=Io,a=Io,s=iY,o=U1(e)){if(i=vy(i),a=vy(a),s=mM(s),i===Io&&a===Io||i.ckbMultiplier*a.udtMultiplier0n&&(u=Yt.from({...u,capacity:Ec(BigInt(u.cellOutput.capacity)+r)})),{master:c,order:u}}function oY(t,e){return Ea(t,"append",e.flatMap(r=>[r.cell,r.master]),[])}function m5(t){return t.defaultScript("LIMIT_ORDER")}function mM(t){return t>64?64:t}function vy(t){return t.ckbMultiplier===0n||t.udtMultiplier===0n?Io:Object.freeze({...t})}const Io=Object.freeze({ckbMultiplier:0n,udtMultiplier:0n}),w5="0x0000000000000000000000000000000000000000000000000000000000000000",fY=BigInt(Yt.from({lock:va,type:va,data:gc(v5.pack({udtAmount:0n,type:"MintOrderData",value:{masterDistance:0,padding:w5,orderInfo:{ckbToUdt:Io,udtToCkb:Io,ckbMinMatchLog:0}}}))}).cellOutput.capacity);function cY({rawText:t,setRawText:e,amount:r,tipHeader:n,isFrozen:i,ckbNative:a,ickbNative:s,ckbAvailable:o,ickbAvailable:f,ckbBalance:c,ickbBalance:u}){const l=t[0],p=t.slice(1),y=oM(l),m=()=>e(a6(!y)+p),A=tQ(Np(o-lM,0n),a);let S={name:"CKB",native:A,locked:c-A,status:c===a?"✅":c===o?"⌛️":"⏳"},w={name:"ICKB",native:s,locked:u-s,status:u===s?"✅":u===f?"⌛️":"⏳"};return y||([S,w]=[w,S]),_e.jsx(_e.Fragment,{children:_e.jsxs("span",{className:"grid grid-cols-3 items-center justify-items-center gap-y-4 leading-relaxed font-bold tracking-wider uppercase",children:[_e.jsx("span",{className:"text-amber-400",children:qb(S.native,"✅")}),_e.jsx("span",{className:"text-2xl text-amber-400",children:S.name}),_e.jsx("span",{className:"cursor-wait text-amber-400",children:qb(S.locked,S.status)}),_e.jsx("input",{placeholder:"0",disabled:i,autoFocus:!0,value:p,onChange:C=>e(l+C.target.value),autoComplete:"off",inputMode:"decimal",type:"text",className:"col-span-3 w-full rounded border-0 bg-transparent text-center text-3xl text-amber-400 outline-none disabled:cursor-default","aria-label":"Amount to be converted"}),_e.jsx("span",{className:"",children:"1 "+S.name}),_e.jsx("button",{className:"rotate-90 cursor-pointer border-0 bg-transparent text-5xl text-slate-300 disabled:cursor-default",disabled:i,onClick:m,children:"⇌"}),_e.jsx("span",{className:"text-center",children:aE(y,qt,n)+" "+w.name}),_e.jsxs("span",{className:"col-span-3 text-center text-3xl text-amber-400",children:["⏳",aE(y,r,n)]}),_e.jsx("span",{className:"text-amber-400",children:qb(w.native,"✅")}),_e.jsx("span",{className:"text-2xl text-amber-400",children:w.name}),_e.jsx("span",{className:"cursor-wait text-amber-400",children:qb(w.locked,w.status)})]})})}function qb(t,e){const r=e==="⏳";return _e.jsxs("span",{className:"flex flex-row "+(r?"cursor-wait":""),children:[_e.jsx("span",{className:r?"animate-pulse":"",children:e}),_e.jsx("span",{className:"sm:hidden",children:String(t/qt)}),_e.jsx("span",{className:"hidden sm:block",children:z2(t)})]})}function aE(t,e,r){let n=t?gM(e,r):yy(e,r);return n-=n/1000n,z2(n)}function F_({txInfo:t=Fl,capacities:e=new Array,udts:r=new Array,receipts:n=new Array,wrGroups:i=new Array,myOrders:a=new Array,tipHeader:s=F2}){let{tx:o}=t;const f=[t.estimatedMaturity,h1(s.epoch)];if(a.length>0){o=oY(o,a);for(const{info:l}of a){if(!l.isMatchable||l.isDualRatio)continue;const p=l.isCkb2UdtMatchable;f.push(fM(p,p?l.ckbUnoccupied:l.udtAmount,s))}}const c=[e,r,n].flat();c.length>0&&(o=Ea(o,"append",c,[])),i.length>0&&(o=WQ(o,i),f.push(...i.map(l=>Cp(l.ownedWithdrawalRequest.cellOutput.type[Hs]))));const u=Object.freeze(cM(f));return Object.freeze({...t,tx:o,estimatedMaturity:u})}function uY(t,e,r,n,i,a,s){if(t.error!=="")return t;const o=[];if(!e){let A=0n;for(const S of n){const w=A+S.ickbValue;if(!(w>r)&&(A=w,o.push(Object.freeze({...S,ickbCumulative:A})),o.length>=30))break}}Object.freeze(o);const{ckbMultiplier:f,udtMultiplier:c}=_5(i),u={ckbMultiplier:f,udtMultiplier:c+(e?1n:-1n)*(c/1000n)},l=eY(i),p=e?Number(r/l):o.length,y=Array(p),m=A=>(A=p-A,y[A]=y[A]??lY(A,e,r,t,u,l,o,i,a,s));return Object.freeze(m(fQ(p,A=>m(A).error==="")))}function lY(t,e,r,n,i,a,s,o,f,c){let{tx:u}=n;const{accountLocks:l,config:p}=c,y=[n.estimatedMaturity];if(t>0)if(e){if(r-=a*BigInt(t),r<0n)return{...n,error:"Too many Deposits respectfully to the amount"};u=VQ(u,t,a,p),u=JQ(u,l[0],p)}else{if(s.lengthw.deposit);u=GQ(u,S,p),u=ZQ(u,l[0],p),y.push(...s.map(w=>w.estimatedMaturity))}let m=n.fee;r>0n&&(u=aY(u,l[0],p,e?r:void 0,e?void 0:r,e?i:void 0,e?void 0:i),m+=e?r-yy(r*i.ckbMultiplier/i.udtMultiplier,o):yy(r,o)-r*i.udtMultiplier/i.ckbMultiplier,y.push(fM(e,r,o)));const A=cM(y);return wM({...n,tx:u,estimatedMaturity:A,fee:m},f,c)}function wM(t,e,r){let{tx:n}=t;const{accountLocks:i,config:a}=r;let s,o,f;({tx:n,freeIckbUdt:f}=XQ(n,i[0],a)),{tx:n,txFee:s,freeCkb:o}=TQ(n,i[0],e,a);const c=t.fee+s;return t={...t,tx:n,fee:c},o<0n?{...t,error:"Not enough CKB"}:f<0n?{...t,error:"Not enough iCKB"}:n.outputs.size>64?{...t,error:"More than 64 output cells"}:t}function A5(t,e){return{retry:!0,refetchInterval:({state:r})=>{var n;return 6e4*((n=r.data)!=null&&n.hasMatchable?1:10)},staleTime:1e4,queryKey:[t.chain,t.address,"l1State"],queryFn:async()=>{try{return await dY(t)}catch(r){throw console.log(r),r}},placeholderData:{ckbNative:6n*qt*qt,ickbNative:3n*qt*qt,ckbAvailable:6n*qt*qt,ickbAvailable:3n*qt*qt,ckbBalance:6n*qt*qt,ickbBalance:3n*qt*qt,tipHeader:F2,txBuilder:()=>Fl,hasMatchable:!1},enabled:!e}}async function dY(t){const{rpc:e,config:r,expander:n,getTxSizeOverhead:i}=t,a=await hY(t),s=e.getFeeRate(61n),o=e.getTipHeader(),f=new Set;tE(a,n,ne=>(f.add(ne),F2),r);const u=bY(f,t),l=new Set;nE(a,n,ne=>(l.add(ne),[]),r);const y=pY(l,t),{capacities:m,notCapacities:A}=rQ(a,n),S=await u,{udts:w,receipts:C,withdrawalRequestGroups:O,ickbPool:M,notIckbs:U}=tE(A,n,ne=>S.get(ne),r),K=Cd.from(await o),{mature:Q,notMature:k}=iQ(O,ne=>ne.ownedWithdrawalRequest.cellOutput.type[Hs],K);let W=YQ(M,K,{length:4,index:1,number:0});if(W.length>40){const ne=Np(Math.round(W.length/180),40);W=oQ(W.slice(0,ne).map((N,P)=>({d:N,i:P}))).slice(0,40).sort((N,P)=>N.i-P.i).map(N=>N.d)}const R=await y,{myOrders:_}=nE(U,n,ne=>R.get(ne)??[],r),I=[],b=[];for(const ne of _){const{isMatchable:N,isDualRatio:P}=ne.info;N&&!P?I.push(ne):b.push(ne)}const v=I.length>0,d=Q.length>0||C.length>0||b.length>0;let g=F_({capacities:m,udts:w,tipHeader:K});const x=vg(g.tx,r),E=_g(g.tx,r);g=F_({txInfo:g,myOrders:b,receipts:C,wrGroups:Q,tipHeader:K});const h=i(g.tx),T=vg(g.tx,r),$=_g(g.tx,r),L=F_({txInfo:g,myOrders:I,wrGroups:k,tipHeader:K}),j=vg(L.tx,r),F=_g(L.tx,r);g=Object.freeze({...g,estimatedMaturity:L.estimatedMaturity});const[H,q]=await Promise.all([h,s]),X=ne=>{const N=wQ(mQ(ne)+H,q),P=1249n;return(N+(P-1n))/P*P};return{ckbNative:x,ickbNative:E,ckbBalance:j,ickbBalance:F,ckbAvailable:T,ickbAvailable:$,tipHeader:K,txBuilder:(ne,N)=>N>0n?uY(g,ne,N,W,K,X,t):d?wM(g,X,t):Object.freeze({...g,error:"Nothing to do"}),hasMatchable:v}}async function AM(t){const{queryClient:e}=t,r={...t,accountLocks:[va],address:w2.encodeToAddress(va,t),expander:i6(va),getTxSizeOverhead:()=>Promise.resolve(0),sendSigned:()=>Promise.resolve("0x0")};return e.prefetchQuery(A5(r,!1))}async function hY(t){const{accountLocks:e,config:r,rpc:n}=t;return Object.freeze((await Promise.all([...e,y0(r),j2(r),m5(r)].map(i=>n.getCellsByLock(i,"desc","max")))).flat())}async function pY(t,e){const{chain:r,rpc:n,queryClient:i}=e,a=i.getQueryData([r,"txsOutputs"])??Object.freeze(new Map),s=new Map,o=n.createBatchRequest();for(const c of t){const u=a.get(c);if(u!==void 0){s.set(c,u);continue}o.add("getTransaction",c)}if(o.length===0)return a;for(const c of(await o.exec()).map(({transaction:u})=>u))s.set(c.hash,Object.freeze(c.outputs.map(({lock:u,type:l,capacity:p},y)=>Object.freeze({cellOutput:Object.freeze({lock:Object.freeze(u),type:Object.freeze(l),capacity:Object.freeze(p)}),data:Object.freeze(c.outputsData[y]??"0x"),outPoint:Object.freeze({txHash:c.hash,index:Ec(y)})}))));const f=Object.freeze(s);return i.setQueryData([r,"txsOutputs"],f),f}async function bY(t,e){const{chain:r,rpc:n,queryClient:i}=e,a=i.getQueryData([r,"headers"])??Object.freeze(new Map),s=new Map,o=n.createBatchRequest();for(const c of t){const u=a.get(c);if(u!==void 0){s.set(c,u);continue}o.add("getHeaderByNumber",c)}if(o.length===0)return a;for(const c of await o.exec())s.set(c.number,Cd.from(c));const f=Object.freeze(s);return i.setQueryData([r,"headers"],f),f}const F2=Cd.from({compactTarget:"0x1a08a97e",parentHash:"0x0000000000000000000000000000000000000000000000000000000000000000",transactionsRoot:"0x31bf3fdf4bc16d6ea195dbae808e2b9a8eca6941d589f6959b1d070d51ac28f7",proposalsHash:"0x0000000000000000000000000000000000000000000000000000000000000000",extraHash:"0x0000000000000000000000000000000000000000000000000000000000000000",dao:"0x8874337e541ea12e0000c16ff286230029bfa3320800000000710b00c0fefe06",epoch:"0x0",hash:"0x92b197aa1fba0f63633922c61c92375c9c074a93e85963554f5499fe1450d0e5",nonce:"0x0",number:"0x0",timestamp:"0x16e70e6985c",version:"0x0"});function E5(t){const e=n2.c(7),{children:r,isDone:n}=t;if(n){let o;return e[0]!==r?(o=_e.jsx("span",{className:"col-span-full w-full pb-4",children:r}),e[0]=r,e[1]=o):o=e[1],o}let i;e[2]!==r?(i=_e.jsx("span",{className:"pb-2",children:r}),e[2]=r,e[3]=i):i=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=_e.jsxs("span",{className:"flex h-2 w-full flex-row overflow-hidden rounded",children:[_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-3.00s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-2.85s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-2.70s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-2.55s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-2.40s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-2.25s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-2.10s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.95s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.80s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.65s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.50s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.35s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.20s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.05s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-0.90s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-0.75s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-0.60s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-0.45s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-0.30s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-0.15s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-duration:6s]"})]}),e[4]=a):a=e[4];let s;return e[5]!==i?(s=_e.jsxs("span",{className:"col-span-full flex w-full flex-col",children:[i,a]}),e[5]=i,e[6]=s):s=e[6],s}function gY({isCkb2Udt:t,amount:e,freeze:r,formReset:n,walletConfig:i}){const[a,s]=yr.useState(Fl),o=C=>{s(C),r(C!=Fl)},f=a!==Fl,{data:c,isStale:u,isFetching:l}=k4(A5(i,f)),{txBuilder:p,tipHeader:y}=c,m=f?a:p(t,e),A=_Q(m.tx)&&m.fee>0n&&m.estimatedMaturity!==uM&&m.error==="",{maturity:S,isReady:w}=vY(m.estimatedMaturity,y);return _e.jsxs("span",{className:"grid grid-cols-2 items-center justify-items-center gap-y-4",children:[_e.jsx(E5,{isDone:!l&&!f,children:_e.jsx("button",{className:"text-s col-span-2 min-h-12 w-full cursor-pointer rounded border-2 border-amber-400 px-8 leading-relaxed font-bold tracking-wider text-amber-400 uppercase disabled:cursor-default disabled:opacity-50",onClick:u?()=>i.queryClient.invalidateQueries({queryKey:[i.chain,i.address,"l1State"]}):()=>yY(m,o,n,i),disabled:l||f||!A,children:l?"refreshing...":m.error!==""?m.error:A?u?`refresh before ${e>0?`converting to ${t?"iCKB":"CKB"}`:"withdrawing converted"}`:f?"waiting transaction confirmation...":e>0?`convert to ${t?"iCKB":"CKB"}`:`${w?"fully":"partially"} withdraw converted`:"finding a goose egg"})}),_e.jsx("span",{className:"leading-relaxed font-bold tracking-wider",children:"Fee:"}),_e.jsxs("span",{children:[z2(m.fee)," CKB"]}),_e.jsx("span",{className:"leading-relaxed font-bold tracking-wider",children:"Maturity:"}),_e.jsx("span",{children:S})]})}async function yY(t,e,r,n){const{rpc:i,sendSigned:a}=n;try{e(t);const s=await a(t.tx);let o="pending";for(;o==="pending"||o==="proposed";)await new Promise(f=>setTimeout(f,1e4)),o=(await i.getTransaction(s)).txStatus.status;r(),console.log(s,o)}finally{e(Fl)}}function vY(t,e){const r=h1(e.epoch),n=t.index/t.length-r.index/r.length+t.number-r.number;return n<=0?{maturity:"⌛️ Ready",isReady:!0}:n<=.375?{maturity:`⏳ ${String(Math.ceil(n*4*60))} minutes`,isReady:!1}:n<=6?{maturity:`⏳ ${String(1+Math.ceil(n*4))} hours`,isReady:!1}:{maturity:`⏳ ${String(1+Math.ceil(n/6))} days`,isReady:!1}}function _Y({walletConfig:t}){const[e,r]=yr.useState(!1),[n,i]=yr.useState(a6(!0)),a=n[0],s=oM(a);let o=BQ(n),f=DQ(o);const{ckbNative:c,ickbNative:u,ckbAvailable:l,ickbAvailable:p,ckbBalance:y,ickbBalance:m,tipHeader:A}=k4(A5(t,e)).data,S=s?Np(l-lM,0n):p;f>S&&(f=S,o=z2(S));const w=()=>i(a6(s)),C=yr.useDeferredValue({isCkb2Udt:s,amount:f,freeze:r,formReset:w,walletConfig:t});return A===F2?_e.jsxs(_e.Fragment,{children:[_e.jsx(ZA,{walletConfig:t}),_e.jsx(E5,{children:"Downloading the latest L1 Cell data, just for you. Hang tight!"})]}):_e.jsxs(_e.Fragment,{children:[_e.jsx(ZA,{walletConfig:t}),_e.jsx(cY,{rawText:a+o,setRawText:i,amount:f,tipHeader:A,isFrozen:e,ckbNative:c,ickbNative:u,ckbAvailable:l,ickbAvailable:p,ckbBalance:y,ickbBalance:m}),_e.jsx(gY,{...C})]})}var qo={},q2={};q2.byteLength=AY;q2.toByteArray=xY;q2.fromByteArray=CY;var Ts=[],Ji=[],mY=typeof Uint8Array<"u"?Uint8Array:Array,q_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var nl=0,wY=q_.length;nl0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function AY(t){var e=EM(t),r=e[0],n=e[1];return(r+n)*3/4-n}function EY(t,e,r){return(e+r)*3/4-r}function xY(t){var e,r=EM(t),n=r[0],i=r[1],a=new mY(EY(t,n,i)),s=0,o=i>0?n-4:n,f;for(f=0;f>16&255,a[s++]=e>>8&255,a[s++]=e&255;return i===2&&(e=Ji[t.charCodeAt(f)]<<2|Ji[t.charCodeAt(f+1)]>>4,a[s++]=e&255),i===1&&(e=Ji[t.charCodeAt(f)]<<10|Ji[t.charCodeAt(f+1)]<<4|Ji[t.charCodeAt(f+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function SY(t){return Ts[t>>18&63]+Ts[t>>12&63]+Ts[t>>6&63]+Ts[t&63]}function IY(t,e,r){for(var n,i=[],a=e;ao?o:s+a));return n===1?(e=t[r-1],i.push(Ts[e>>2]+Ts[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Ts[e>>10]+Ts[e>>4&63]+Ts[e<<2&63]+"=")),i.join("")}var x5={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */x5.read=function(t,e,r,n,i){var a,s,o=i*8-n-1,f=(1<>1,u=-7,l=r?i-1:0,p=r?-1:1,y=t[e+l];for(l+=p,a=y&(1<<-u)-1,y>>=-u,u+=o;u>0;a=a*256+t[e+l],l+=p,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=n;u>0;s=s*256+t[e+l],l+=p,u-=8);if(a===0)a=1-c;else{if(a===f)return s?NaN:(y?-1:1)*(1/0);s=s+Math.pow(2,n),a=a-c}return(y?-1:1)*s*Math.pow(2,a-n)};x5.write=function(t,e,r,n,i,a){var s,o,f,c=a*8-i-1,u=(1<>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:a-1,m=n?1:-1,A=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-s))<1&&(s--,f*=2),s+l>=1?e+=p/f:e+=p*Math.pow(2,1-l),e*f>=2&&(s++,f/=2),s+l>=u?(o=0,s=u):s+l>=1?(o=(e*f-1)*Math.pow(2,i),s=s+l):(o=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+y]=o&255,y+=m,o/=256,i-=8);for(s=s<0;t[r+y]=s&255,y+=m,s/=256,c-=8);t[r+y-m]|=A*128};/*! +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var v,d=!0,g=!1;return{s:function(){_=_.call(W)},n:function(){var x=_.next();return d=x.done,x},e:function(x){g=!0,v=x},f:function(){try{d||_.return==null||_.return()}finally{if(g)throw v}}}}var G=function(W){var R=Math.abs,_=Math.max,I=Math.floor;function b(d,g){var x;if(a(this,b),x=v.call(this,d),x.sign=g,Object.setPrototypeOf(A(x),b.prototype),d>b.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return x}f(b,W);var v=w(b);return o(b,[{key:"toDebugString",value:function(){var d,g=["BigInt["],x=k(this);try{for(x.s();!(d=x.n()).done;){var E=d.value;g.push((E&&(E>>>0).toString(16))+", ")}}catch(h){x.e(h)}finally{x.f()}return g.push("]"),g.join("")}},{key:"toString",value:function(){var d=0d||36this.length&&(x=this.length);for(var E=32767&d,h=d>>>15,T=0,$=g,L=0;L>>15,q=b.__imul(F,E),X=b.__imul(F,h),te=b.__imul(H,E),ne=b.__imul(H,h),N=$+q+T;T=N>>>30,N&=1073741823,N+=((32767&X)<<15)+((32767&te)<<15),T+=N>>>30,$=ne+(X>>>15)+(te>>>15),this.__setDigit(L,1073741823&N)}if(T!==0||$!==0)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(d,g,x){for(var E,h=0,T=0;T>>15,this.__setHalfDigit(g+T,32767&E);return h}},{key:"__inplaceSub",value:function(d,g,x){var E=0;if(1&g){g>>=1;for(var h=this.__digit(g),T=32767&h,$=0;$>>1;$++){var L=d.__digit($),j=(h>>>15)-(32767&L)-E;E=1&j>>>15,this.__setDigit(g+$,(32767&j)<<15|32767&T),h=this.__digit(g+$+1),T=(32767&h)-(L>>>15)-E,E=1&T>>>15}var F=d.__digit($),H=(h>>>15)-(32767&F)-E;if(E=1&H>>>15,this.__setDigit(g+$,(32767&H)<<15|32767&T),g+$+1>=this.length)throw new RangeError("out of bounds");!(1&x)&&(h=this.__digit(g+$+1),T=(32767&h)-(F>>>15)-E,E=1&T>>>15,this.__setDigit(g+d.length,1073709056&h|32767&T))}else{g>>=1;for(var q=0;q>>15;var N=(X>>>15)-(te>>>15)-E;E=1&N>>>15,this.__setDigit(g+q,(32767&N)<<15|32767&ne)}var P=this.__digit(g+q),re=d.__digit(q),ue=(32767&P)-(32767&re)-E;E=1&ue>>>15;var de=0;!(1&x)&&(de=(P>>>15)-(re>>>15)-E,E=1&de>>>15),this.__setDigit(g+q,(32767&de)<<15|32767&ue)}return E}},{key:"__inplaceRightShift",value:function(d){if(d!==0){for(var g,x=this.__digit(0)>>>d,E=this.length-1,h=0;h>>d;this.__setDigit(E,x)}}},{key:"__digit",value:function(d){return this[d]}},{key:"__unsignedDigit",value:function(d){return this[d]>>>0}},{key:"__setDigit",value:function(d,g){this[d]=0|g}},{key:"__setDigitGrow",value:function(d,g){this[d]=0|g}},{key:"__halfDigitLength",value:function(){var d=this.length;return 32767>=this.__unsignedDigit(d-1)?2*d-1:2*d}},{key:"__halfDigit",value:function(d){return 32767&this[d>>>1]>>>15*(1&d)}},{key:"__setHalfDigit",value:function(d,g){var x=d>>>1,E=this.__digit(x),h=1&d?32767&E|g<<15:1073709056&E|32767&g;this.__setDigit(x,h)}}],[{key:"BigInt",value:function(d){var g=Number.isFinite;if(typeof d=="number"){if(d===0)return b.__zero();if(b.__isOneDigitInt(d))return 0>d?b.__oneDigit(-d,!0):b.__oneDigit(d,!1);if(!g(d)||I(d)!==d)throw new RangeError("The number "+d+" cannot be converted to BigInt because it is not an integer");return b.__fromDouble(d)}if(typeof d=="string"){var x=b.__fromString(d);if(x===null)throw new SyntaxError("Cannot convert "+d+" to a BigInt");return x}if(typeof d=="boolean")return d===!0?b.__oneDigit(1,!1):b.__zero();if(i(d)==="object"){if(d.constructor===b)return d;var E=b.__toPrimitive(d);return b.BigInt(E)}throw new TypeError("Cannot convert "+d+" to a BigInt")}},{key:"toNumber",value:function(d){var g=d.length;if(g===0)return 0;if(g===1){var x=d.__unsignedDigit(0);return d.sign?-x:x}var E=d.__digit(g-1),h=b.__clz30(E),T=30*g-h;if(1024>>=12;var q=F-12,X=12<=F?0:L<<20+F,te=20+F;for(0>>30-q,X=L<>>30-te,te-=30;var ne=b.__decideRounding(d,te,j,L);if((ne===1||ne===0&&(1&X)==1)&&(X=X+1>>>0,X===0&&(H++,H>>>20!=0&&(H=0,$++,1023<$))))return d.sign?-1/0:1/0;var N=d.sign?-2147483648:0;return $=$+1023<<20,b.__kBitConversionInts[1]=N|$|H,b.__kBitConversionInts[0]=X,b.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(d){if(d.length===0)return d;var g=d.__copy();return g.sign=!d.sign,g}},{key:"bitwiseNot",value:function(d){return d.sign?b.__absoluteSubOne(d).__trim():b.__absoluteAddOne(d,!0)}},{key:"exponentiate",value:function(d,g){if(g.sign)throw new RangeError("Exponent must be positive");if(g.length===0)return b.__oneDigit(1,!1);if(d.length===0)return d;if(d.length===1&&d.__digit(0)===1)return d.sign&&!(1&g.__digit(0))?b.unaryMinus(d):d;if(1=b.__kMaxLengthBits)throw new RangeError("BigInt too big");if(d.length===1&&d.__digit(0)===2){var E=1+(0|x/30),h=d.sign&&(1&x)!=0,T=new b(E,h);T.__initializeDigits();var $=1<>=1;x!==0;x>>=1)j=b.multiply(j,j),1&x&&(L===null?L=j:L=b.multiply(L,j));return L}},{key:"multiply",value:function(d,g){if(d.length===0)return d;if(g.length===0)return g;var x=d.length+g.length;30<=d.__clzmsd()+g.__clzmsd()&&x--;var E=new b(x,d.sign!==g.sign);E.__initializeDigits();for(var h=0;hb.__absoluteCompare(d,g))return b.__zero();var x,E=d.sign!==g.sign,h=g.__unsignedDigit(0);if(g.length===1&&32767>=h){if(h===1)return E===d.sign?d:b.unaryMinus(d);x=b.__absoluteDivSmall(d,h,null)}else x=b.__absoluteDivLarge(d,g,!0,!1);return x.sign=E,x.__trim()}},{key:"remainder",value:function(g,x){if(x.length===0)throw new RangeError("Division by zero");if(0>b.__absoluteCompare(g,x))return g;var E=x.__unsignedDigit(0);if(x.length===1&&32767>=E){if(E===1)return b.__zero();var h=b.__absoluteModSmall(g,E);return h===0?b.__zero():b.__oneDigit(h,g.sign)}var T=b.__absoluteDivLarge(g,x,!1,!0);return T.sign=g.sign,T.__trim()}},{key:"add",value:function(d,g){var x=d.sign;return x===g.sign?b.__absoluteAdd(d,g,x):0<=b.__absoluteCompare(d,g)?b.__absoluteSub(d,g,x):b.__absoluteSub(g,d,!x)}},{key:"subtract",value:function(d,g){var x=d.sign;return x===g.sign?0<=b.__absoluteCompare(d,g)?b.__absoluteSub(d,g,x):b.__absoluteSub(g,d,!x):b.__absoluteAdd(d,g,x)}},{key:"leftShift",value:function(d,g){return g.length===0||d.length===0?d:g.sign?b.__rightShiftByAbsolute(d,g):b.__leftShiftByAbsolute(d,g)}},{key:"signedRightShift",value:function(d,g){return g.length===0||d.length===0?d:g.sign?b.__leftShiftByAbsolute(d,g):b.__rightShiftByAbsolute(d,g)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(d,g){return 0>b.__compareToBigInt(d,g)}},{key:"lessThanOrEqual",value:function(d,g){return 0>=b.__compareToBigInt(d,g)}},{key:"greaterThan",value:function(d,g){return 0d)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(d===0)return b.__zero();if(d>=b.__kMaxLengthBits)return g;var x=0|(d+29)/30;if(g.lengthd)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(d===0)return b.__zero();if(g.sign){if(d>b.__kMaxLengthBits)throw new RangeError("BigInt too big");return b.__truncateAndSubFromPowerOfTwo(d,g,!1)}if(d>=b.__kMaxLengthBits)return g;var x=0|(d+29)/30;if(g.length>>E))return g}return b.__truncateToNBits(d,g)}},{key:"ADD",value:function(d,g){if(d=b.__toPrimitive(d),g=b.__toPrimitive(g),typeof d=="string")return typeof g!="string"&&(g=g.toString()),d+g;if(typeof g=="string")return d.toString()+g;if(d=b.__toNumeric(d),g=b.__toNumeric(g),b.__isBigInt(d)&&b.__isBigInt(g))return b.add(d,g);if(typeof d=="number"&&typeof g=="number")return d+g;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(d,g){return b.__compare(d,g,0)}},{key:"LE",value:function(d,g){return b.__compare(d,g,1)}},{key:"GT",value:function(d,g){return b.__compare(d,g,2)}},{key:"GE",value:function(d,g){return b.__compare(d,g,3)}},{key:"EQ",value:function(d,g){for(;;){if(b.__isBigInt(d))return b.__isBigInt(g)?b.equal(d,g):b.EQ(g,d);if(typeof d=="number"){if(b.__isBigInt(g))return b.__equalToNumber(g,d);if(i(g)!=="object")return d==g;g=b.__toPrimitive(g)}else if(typeof d=="string"){if(b.__isBigInt(g))return d=b.__fromString(d),d!==null&&b.equal(d,g);if(i(g)!=="object")return d==g;g=b.__toPrimitive(g)}else if(typeof d=="boolean"){if(b.__isBigInt(g))return b.__equalToNumber(g,+d);if(i(g)!=="object")return d==g;g=b.__toPrimitive(g)}else if(i(d)==="symbol"){if(b.__isBigInt(g))return!1;if(i(g)!=="object")return d==g;g=b.__toPrimitive(g)}else if(i(d)==="object"){if(i(g)==="object"&&g.constructor!==b)return d==g;d=b.__toPrimitive(d)}else return d==g}}},{key:"NE",value:function(d,g){return!b.EQ(d,g)}},{key:"DataViewGetBigInt64",value:function(d,g){var x=2>>30),F.__setDigit(2,L>>>28),F.__trim()}},{key:"DataViewSetBigInt64",value:function(d,g,x){var E=3>>2,2g)h=-g-1;else{if(x===0)return-1;x--,E=d.__digit(x),h=29}var T=1<>>20,E=x-1023,h=(0|E/30)+1,T=new b(h,0>d),$=1048575&b.__kBitConversionInts[1]|1048576,L=b.__kBitConversionInts[0],j=20,F=E%30,H=0;if(F>>q,$=$<<32-q|L>>>q,L<<=32-q}else if(F===j)H=32,g=$,$=L,L=0;else{var X=F-j;H=32-X,g=$<>>32-X,$=L<>>2,$=$<<30|L>>>2,L<<=30):g=0,T.__setDigit(te,g);return T.__trim()}},{key:"__isWhitespace",value:function(d){return 13>=d&&9<=d||(159>=d?d==32:131071>=d?d==160||d==5760:196607>=d?(d&=131071,10>=d||d==40||d==41||d==47||d==95||d==4096):d==65279)}},{key:"__fromString",value:function(d){var g=11073741824/L)return null;var F=L*$+j>>>b.__kBitsPerCharTableShift,H=new b(0|(F+29)/30,!1),q=10>g?g:10,X=10>>0>>0>>b.__kBitsPerCharTableShift)/30;H.__inplaceMultiplyAdd(ce,ie,ge)}while(!de)}else{L>>=b.__kBitsPerCharTableShift;var te=[],ne=[],N=!1;do{for(var P,re=0,ue=0;;){if(P=void 0,T-48>>>0>>0>>j-T)}if(h!==0){if(E>=d.length)throw new Error("implementation bug");d.__setDigit(E++,h)}for(;E>>1)+(85&E),E=(51&E>>>2)+(51&E),E=(15&E>>>4)+(15&E);var h=E,T=g-1,$=d.__digit(x-1),L=b.__clz30($),j=0|(30*x-L+h-1)/h;if(d.sign&&j++,268435456>>P,X=30-P;X>=h;)F[H--]=b.__kConversionChars[q&T],q>>>=h,X-=h}var re=(q|$<>>h-X;q!==0;)F[H--]=b.__kConversionChars[q&T],q>>>=h;if(d.sign&&(F[H--]="-"),H!==-1)throw new Error("implementation bug");return F.join("")}},{key:"__toStringGeneric",value:function(d,g,x){var E=d.length;if(E===0)return"";if(E===1){var h=d.__unsignedDigit(0).toString(g);return x===!1&&d.sign&&(h="-"+h),h}var T=30*E-b.__clz30(d.__digit(E-1)),$=b.__kMaxBitsPerChar[g],L=$-1,j=T*b.__kBitsPerCharTableMultiplier;j+=L-1,j=0|j/L;var F,H,q=j+1>>1,X=b.exponentiate(b.__oneDigit(g,!1),b.__oneDigit(q,!1)),te=X.__unsignedDigit(0);if(X.length===1&&32767>=te){F=new b(d.length,!1),F.__initializeDigits();for(var ne,N=0,P=2*d.length-1;0<=P;P--)ne=N<<15|d.__halfDigit(P),F.__setHalfDigit(P,0|ne/te),N=0|ne%te;H=N.toString(g)}else{var re=b.__absoluteDivLarge(d,X,!0,!0);F=re.quotient;var ue=re.remainder.__trim();H=b.__toStringGeneric(ue,g,!0)}F.__trim();for(var de=b.__toStringGeneric(F,g,!0);H.lengthE?b.__absoluteLess(x):0}},{key:"__compareToNumber",value:function(d,g){if(b.__isOneDigitInt(g)){var x=d.sign,E=0>g;if(x!==E)return b.__unequalSign(x);if(d.length===0){if(E)throw new Error("implementation bug");return g===0?0:-1}if(1h?b.__absoluteGreater(x):Tg)return b.__unequalSign(x);if(g===0)throw new Error("implementation bug: should be handled elsewhere");if(d.length===0)return-1;b.__kBitConversionDouble[0]=g;var E=2047&b.__kBitConversionInts[1]>>>20;if(E==2047)throw new Error("implementation bug: handled elsewhere");var h=E-1023;if(0>h)return b.__absoluteGreater(x);var T=d.length,$=d.__digit(T-1),L=b.__clz30($),j=30*T-L,F=h+1;if(jF)return b.__absoluteGreater(x);var H=1048576|1048575&b.__kBitConversionInts[1],q=b.__kBitConversionInts[0],X=20,te=29-L;if(te!==(0|(j-1)%30))throw new Error("implementation bug");var ne,N=0;if(te>>P,H=H<<32-P|q>>>P,q<<=32-P}else if(te===X)N=32,ne=H,H=q,q=0;else{var re=te-X;N=32-re,ne=H<>>32-re,H=q<>>=0,ne>>>=0,$>ne)return b.__absoluteGreater(x);if($>>2,H=H<<30|q>>>2,q<<=30):ne=0;var de=d.__unsignedDigit(ue);if(de>ne)return b.__absoluteGreater(x);if(deg&&d.__unsignedDigit(0)===R(g):b.__compareToDouble(d,g)===0}},{key:"__comparisonResultToBool",value:function(d,g){return g===0?0>d:g===1?0>=d:g===2?0g;case 3:return d>=g}if(b.__isBigInt(d)&&typeof g=="string")return g=b.__fromString(g),g!==null&&b.__comparisonResultToBool(b.__compareToBigInt(d,g),x);if(typeof d=="string"&&b.__isBigInt(g))return d=b.__fromString(d),d!==null&&b.__comparisonResultToBool(b.__compareToBigInt(d,g),x);if(d=b.__toNumeric(d),g=b.__toNumeric(g),b.__isBigInt(d)){if(b.__isBigInt(g))return b.__comparisonResultToBool(b.__compareToBigInt(d,g),x);if(typeof g!="number")throw new Error("implementation bug");return b.__comparisonResultToBool(b.__compareToNumber(d,g),x)}if(typeof d!="number")throw new Error("implementation bug");if(b.__isBigInt(g))return b.__comparisonResultToBool(b.__compareToNumber(g,d),2^x);if(typeof g!="number")throw new Error("implementation bug");return x===0?dg:x===3?d>=g:void 0}},{key:"__absoluteAdd",value:function(d,g,x){if(d.length>>30,T.__setDigit(L,1073741823&h);for(;L>>30,T.__setDigit(L,1073741823&j)}return L>>30,h.__setDigit($,1073741823&E);for(;$>>30,h.__setDigit($,1073741823&L)}return h.__trim()}},{key:"__absoluteAddOne",value:function(d,g){var x=2>>30,x.__setDigit($,1073741823&h);return T!==0&&x.__setDigitGrow(E,1),x}},{key:"__absoluteSubOne",value:function(d,g){var x=d.length;g=g||x;for(var E,h=new b(g,!1),T=1,$=0;$>>30,h.__setDigit($,1073741823&E);if(T!==0)throw new Error("implementation bug");for(var L=x;LE?0:d.__unsignedDigit(E)>g.__unsignedDigit(E)?1:-1}},{key:"__multiplyAccumulate",value:function(d,g,x,E){if(g!==0){for(var h=32767&g,T=g>>>15,$=0,L=0,j=0;j>>15,te=b.__imul(q,h),ne=b.__imul(q,T),N=b.__imul(X,h),P=b.__imul(X,T);F+=L+te+$,$=F>>>30,F&=1073741823,F+=((32767&ne)<<15)+((32767&N)<<15),$+=F>>>30,L=P+(ne>>>15)+(N>>>15),x.__setDigit(E,1073741823&F)}for(;$!==0||L!==0;E++){var re=x.__digit(E);re+=$+L,L=0,$=re>>>30,x.__setDigit(E,1073741823&re)}}}},{key:"__internalMultiplyAdd",value:function(d,g,x,E,h){for(var T=x,$=0,L=0;L>>15,g),q=F+((32767&H)<<15)+$+T;T=q>>>30,$=H>>>15,h.__setDigit(L,1073741823&q)}if(h.length>E)for(h.__setDigit(E++,T+$);E>>0,$=0|T/g;E=0|T%g,T=(E<<15|d.__halfDigit(h-1))>>>0;var L=0|T/g;E=0|T%g,x.__setDigit(h>>>1,$<<15|L)}return x}},{key:"__absoluteModSmall",value:function(d,g){for(var x,E=0,h=2*d.length-1;0<=h;h--)x=(E<<15|d.__halfDigit(h))>>>0,E=0|x%g;return E}},{key:"__absoluteDivLarge",value:function(d,g,x,E){var h=g.__halfDigitLength(),T=g.length,$=d.__halfDigitLength()-h,L=null;x&&(L=new b($+2>>>1,!1),L.__initializeDigits());var j=new b(h+2>>>1,!1);j.__initializeDigits();var F=b.__clz15(g.__halfDigit(h-1));0>>0;ne=0|P/q;for(var re=0|P%q,ue=g.__halfDigit(h-2),de=H.__halfDigit(te+h-2);b.__imul(ne,ue)>>>0>(re<<16|de)>>>0&&(ne--,re+=q,!(32767>>1,X|ne))}if(E)return H.__inplaceRightShift(F),x?{quotient:L,remainder:H}:H;if(x)return L;throw new Error("unreachable")}},{key:"__clz15",value:function(d){return b.__clz30(d)-15}},{key:"__specialLeftShift",value:function(d,g,x){var E=d.length,h=new b(E+x,!1);if(g===0){for(var T=0;T>>30-g;return 0x)throw new RangeError("BigInt too big");var E=0|x/30,h=x%30,T=d.length,$=h!==0&&d.__digit(T-1)>>>30-h!=0,L=T+E+($?1:0),j=new b(L,d.sign);if(h===0){for(var F=0;F>>30-h;if($)j.__setDigit(T+E,H);else if(H!==0)throw new Error("implementation bug")}return j.__trim()}},{key:"__rightShiftByAbsolute",value:function(d,g){var x=d.length,E=d.sign,h=b.__toShiftAmount(g);if(0>h)return b.__rightShiftByMaximum(E);var T=0|h/30,$=h%30,L=x-T;if(0>=L)return b.__rightShiftByMaximum(E);var j=!1;if(E){if(d.__digit(T)&(1<<$)-1)j=!0;else for(var F=0;F>>$,N=x-T-1,P=0;P>>$;q.__setDigit(N,ne)}return j&&(q=b.__absoluteAddOne(q,!0,q)),q.__trim()}},{key:"__rightShiftByMaximum",value:function(d){return d?b.__oneDigit(1,!0):b.__zero()}},{key:"__toShiftAmount",value:function(d){if(1b.__kMaxLengthBits?-1:g}},{key:"__toPrimitive",value:function(d){var g=1>>L}return E.__setDigit(h,$),E.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(d,g,x){for(var E=Math.min,h,T=0|(d+29)/30,$=new b(T,x),L=0,j=T-1,F=0,H=E(j,g.length);L>>30,$.__setDigit(L,1073741823&h);for(;L>>ne;var N=1<<32-ne;q=N-X-F,q&=N-1}return $.__setDigit(j,q),$.__trim()}},{key:"__digitPow",value:function(d,g){for(var x=1;0>>=1,d*=d;return x}},{key:"__isOneDigitInt",value:function(d){return(1073741823&d)===d}}]),b}(m(Array));return G.__kMaxLength=33554432,G.__kMaxLengthBits=G.__kMaxLength<<5,G.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],G.__kBitsPerCharTableShift=5,G.__kBitsPerCharTableMultiplier=1<>>0)/R)},G.__imul=r||function(W,R){return 0|W*R},G})})(hT);var Jk=hT.exports;Object.defineProperty(wt,"__esModule",{value:!0});wt.ckbDecimals=wt.BI=void 0;wt.formatUnit=nz;wt.isBIish=pT;wt.parseUnit=iz;wt.toJSBI=dt;var Xe=ez(Jk);function ez(t){return t&&t.__esModule?t:{default:t}}function pT(t){return t!==null&&(typeof t=="number"&&t%1===0||typeof t=="string"&&(!!t.match(/^0x(0|[0-9a-fA-F]+)$/)||!!t.match(/^-?[0-9]+$/))||typeof t=="bigint"||$o.isBI(t))}class $o{constructor(e){this.jsbi=e,this._isBI=!0}add(e){return Or(Xe.default.add(this.jsbi,dt(e)))}sub(e){return Or(Xe.default.subtract(this.jsbi,dt(e)))}div(e){return Or(Xe.default.divide(this.jsbi,dt(e)))}mul(e){return Or(Xe.default.multiply(this.jsbi,dt(e)))}mod(e){return Or(Xe.default.remainder(this.jsbi,dt(e)))}abs(){return Xe.default.greaterThanOrEqual(this.jsbi,dt(0))?Or(this.jsbi):Or(Xe.default.unaryMinus(this.jsbi))}pow(e){return Or(Xe.default.exponentiate(this.jsbi,dt(e)))}and(e){return Or(Xe.default.bitwiseAnd(this.jsbi,dt(e)))}or(e){return Or(Xe.default.bitwiseOr(this.jsbi,dt(e)))}xor(e){return Or(Xe.default.bitwiseXor(this.jsbi,dt(e)))}not(){return Or(Xe.default.bitwiseNot(this.jsbi))}mask(e){const r=dt(e);if(Xe.default.lessThan(r,dt(0))||Xe.default.lessThan(this.jsbi,dt(0)))throw new Error("mask works only with positive numbers");const n=dt(this.jsbi.toString(2).length);if(Xe.default.lessThanOrEqual(n,r))return Or(this.jsbi);{const i=Xe.default.leftShift(Xe.default.signedRightShift(this.jsbi,r),r);return Or(Xe.default.bitwiseXor(this.jsbi,i))}}shl(e){return Or(Xe.default.leftShift(this.jsbi,dt(e)))}shr(e){return Or(Xe.default.signedRightShift(this.jsbi,dt(e)))}eq(e){return Xe.default.equal(this.jsbi,dt(e))}lt(e){return Xe.default.lessThan(this.jsbi,dt(e))}lte(e){return Xe.default.lessThanOrEqual(this.jsbi,dt(e))}gt(e){return Xe.default.greaterThan(this.jsbi,dt(e))}gte(e){return Xe.default.greaterThanOrEqual(this.jsbi,dt(e))}isNegative(){return Xe.default.lessThan(this.jsbi,dt(0))}isZero(){return Xe.default.equal(this.jsbi,dt(0))}toNumber(){return Xe.default.toNumber(this.jsbi)}toBigInt(){try{return BigInt(this.jsbi.toString(10))}catch{throw new Error("this platform does not support BigInt")}}toString(e){return e=e||10,this.jsbi.toString(e)}toHexString(){return Xe.default.lessThan(this.jsbi,dt(0))?"-0x"+Xe.default.unaryMinus(this.jsbi).toString(16):"0x"+this.jsbi.toString(16)}static from(e){if(e instanceof $o)return e;if(pT(e))return Or(dt(e));if(e instanceof Xe.default)return Or(dt(e.toString()));throw new Error(`invalid type: ${e} can't be converted into BI`)}static isBI(e){return tz(e)&&!!e._isBI}}wt.BI=$o;function tz(t){return t==null?!1:typeof t=="object"}function Or(t){return new $o(t)}function dt(t){return typeof t=="number"||typeof t=="string"?Xe.default.BigInt(t):Xe.default.BigInt(t.toString())}const g9=["shannon","ckb"],rz=wt.ckbDecimals=8,bT=$o.from(-1);function nz(t,e){const r=gT(e);return az(t,r)}function iz(t,e){const r=gT(e);return sz(t,r)}function az(t,e){if(!j4(e))throw new Error("decimal size must be a non-negative integer");const r="1"+Array(e).fill("0").join("");t=$o.from(t);const n=t.isNegative();n&&(t=t.mul(bT));let a=t.div(r).toString();if(r.length>1){let s=t.mod(r).toString();for(;s.length0&&i[0]==="0";)i=i.substring(1);for(i===""&&(i="0");a.length>0&&a[a.length-1]==="0";)a=a.substring(0,a.length-1);if(a.length>r.length-1)throw new Error("decimal part exceeds max decimals");for(a===""&&(a="0");a.length=0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BI",{enumerable:!0,get:function(){return e.BI}}),Object.defineProperty(t,"BIish",{enumerable:!0,get:function(){return e.BIish}}),t.Uint8=t.Uint64LE=t.Uint64BE=t.Uint64=t.Uint512LE=t.Uint512BE=t.Uint512=t.Uint32LE=t.Uint32BE=t.Uint32=t.Uint256LE=t.Uint256BE=t.Uint256=t.Uint16LE=t.Uint16BE=t.Uint16=t.Uint128LE=t.Uint128BE=t.Uint128=void 0;var e=wt,r=Go,n=ya;function i(y,m,A,S){if(y=e.BI.from(y),y.lt(m)||y.gt(A))throw new n.CodecBaseParseError(`Value must be between ${m.toString()} and ${A.toString()}, but got ${y.toString()}`,S)}function a(y,m=!1){const A=s(y,m);return{__isFixedCodec__:!0,byteLength:y,pack:S=>A.pack(S),unpack:S=>A.unpack(S).toNumber()}}const s=(y,m=!1)=>{const A=e.BI.from(1).shl(y*8).sub(1);return(0,r.createFixedBytesCodec)({byteLength:y,pack(S){let w=m?"LE":"BE";y<=1&&(w="");const C=`Uint${y*8}${w}`;if(typeof S=="number"&&!Number.isSafeInteger(S))throw new n.CodecBaseParseError(`${S} is not a safe integer`,C);let O=e.BI.from(S);i(O,0,A,C);const M=new DataView(new ArrayBuffer(y));for(let U=0;U{const w=new DataView(Uint8Array.from(S).buffer);let C=e.BI.from(0);for(let O=0;Ot.pack(r),unpack:r=>t.unpack(r)})}function fz(t){return vT({...t,byteLength:1})}function cz(t){return(0,yT.createBytesCodec)({pack(e){const r=t.pack(e),n=v9.Uint32LE.pack(r.byteLength);return(0,oz.concat)(n,r)},unpack(e){(0,y9.assertMinBufferLength)(e,4);const r=v9.Uint32LE.unpack(e.slice(0,4));return(0,y9.assertBufferLength)(e.slice(4),r),t.unpack(e.slice(4))}})}var Ys={};Object.defineProperty(Ys,"__esModule",{value:!0});Ys.array=_T;Ys.dynvec=wT;Ys.fixvec=mT;Ys.option=pz;Ys.struct=uz;Ys.table=dz;Ys.union=hz;Ys.vector=lz;var yc=Go,Si=r0,ts=Ca,_9=ya,n0=z4;function _T(t,e){const r=(0,n0.createArrayCodec)(t);return(0,yc.createFixedBytesCodec)({byteLength:t.byteLength*e,pack(n){const i=r.pack(n);return(0,ts.concat)(...i)},unpack(n){const i=[],a=t.byteLength;for(let s=0;s!e.includes(r))}function F4(t,e){const r=Object.keys(t),n=m9(r,e),i=m9(e,r);if(n.length>0||i.length>0)throw new Error(`Invalid shape: missing fields ${n.join(", ")} or shape ${i.join(", ")}`)}function uz(t,e){F4(t,e);const r=(0,n0.createObjectCodec)(t);return(0,yc.createFixedBytesCodec)({byteLength:e.reduce((n,i)=>n+t[i].byteLength,0),pack(n){const i=r.pack(n);return e.reduce((a,s)=>(0,ts.concat)(a,i[s]),Uint8Array.from([]))},unpack(n){const i={};let a=0;return e.forEach(s=>{const o=t[s],f=n.slice(a,a+o.byteLength);Object.assign(i,{[s]:o.unpack(f)}),a=a+o.byteLength}),i}})}function mT(t){return(0,yc.createBytesCodec)({pack(e){const r=(0,n0.createArrayCodec)(t);return(0,ts.concat)(Si.Uint32LE.pack(e.length),r.pack(e).reduce((n,i)=>(0,ts.concat)(n,i),new ArrayBuffer(0)))},unpack(e){if(e.byteLength<4)throw new Error(`fixvec: buffer is too short, expected at least 4 bytes, got ${e.byteLength}`);const r=Si.Uint32LE.unpack(e.slice(0,4));return _T(t,r).unpack(e.slice(4))}})}function wT(t){return(0,yc.createBytesCodec)({pack(e){const n=(0,n0.createArrayCodec)(t).pack(e).reduce((a,s)=>{const o=Si.Uint32LE.pack(a.offset);return{header:(0,ts.concat)(a.header,o),body:(0,ts.concat)(a.body,s),offset:a.offset+s.byteLength}},{header:new ArrayBuffer(0),body:new ArrayBuffer(0),offset:4+e.length*4}),i=Si.Uint32LE.pack(n.header.byteLength+n.body.byteLength+4);return(0,ts.concat)(i,n.header,n.body)},unpack(e){const r=Si.Uint32LE.unpack(e.slice(0,4));if(r!==e.byteLength)throw new Error(`Invalid buffer size, read from header: ${r}, actual: ${e.byteLength}`);const n=[];if(r<=4)return n;{const a=(Si.Uint32LE.unpack(e.slice(4,8))-4)/4,s=new Array(a).fill(1).map((f,c)=>Si.Uint32LE.unpack(e.slice(4+c*4,8+c*4)));s.push(r);const o=[];for(let f=0;f{const u=a[c],l=Si.Uint32LE.pack(f.offset);return{header:(0,ts.concat)(f.header,l),body:(0,ts.concat)(f.body,u),offset:f.offset+u.byteLength}},{header:new ArrayBuffer(0),body:new ArrayBuffer(0),offset:n}),o=Si.Uint32LE.pack(s.header.byteLength+s.body.byteLength+4);return(0,ts.concat)(o,s.header,s.body)},unpack(r){const n=Si.Uint32LE.unpack(r.slice(0,4));if(n!==r.byteLength)throw new Error(`Invalid buffer size, read from header: ${n}, actual: ${r.byteLength}`);if(n<=4||e.length===0)return{};{const i=e.map((s,o)=>Si.Uint32LE.unpack(r.slice(4+o*4,8+o*4)));i.push(n);const a={};for(let s=0;s{if(Array.isArray(e))return e[n];const a=Object.entries(e).find(([,s])=>s===n);return a==null?void 0:a[0]})();if(!i)throw new Error(`Unknown union field id: ${n}, only ${e} are allowed`);return{type:i,value:t[i].unpack(r.slice(4))}}})}function pz(t){return(0,yc.createBytesCodec)({pack(e){const r=(0,n0.createNullableCodec)(t);return e!=null?r.pack(e):Uint8Array.from([])},unpack(e){if(e.byteLength!==0)return t.unpack(e)}})}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"array",{enumerable:!0,get:function(){return r.array}}),Object.defineProperty(t,"byteArrayOf",{enumerable:!0,get:function(){return e.byteArrayOf}}),Object.defineProperty(t,"byteOf",{enumerable:!0,get:function(){return e.byteOf}}),Object.defineProperty(t,"byteVecOf",{enumerable:!0,get:function(){return e.byteVecOf}}),Object.defineProperty(t,"option",{enumerable:!0,get:function(){return r.option}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return r.struct}}),Object.defineProperty(t,"table",{enumerable:!0,get:function(){return r.table}}),Object.defineProperty(t,"union",{enumerable:!0,get:function(){return r.union}}),Object.defineProperty(t,"vector",{enumerable:!0,get:function(){return r.vector}});var e=u1,r=Ys})(c1);(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e={createBytesCodec:!0,createFixedBytesCodec:!0,isFixedCodec:!0,bytes:!0,number:!0,molecule:!0};t.bytes=void 0,Object.defineProperty(t,"createBytesCodec",{enumerable:!0,get:function(){return r.createBytesCodec}}),Object.defineProperty(t,"createFixedBytesCodec",{enumerable:!0,get:function(){return r.createFixedBytesCodec}}),Object.defineProperty(t,"isFixedCodec",{enumerable:!0,get:function(){return r.isFixedCodec}}),t.number=t.molecule=void 0;var r=Go,n=z4;Object.keys(n).forEach(function(c){c==="default"||c==="__esModule"||Object.prototype.hasOwnProperty.call(e,c)||c in t&&t[c]===n[c]||Object.defineProperty(t,c,{enumerable:!0,get:function(){return n[c]}})});var i=f(Ca);t.bytes=i;var a=f(r0);t.number=a;var s=f(c1);t.molecule=s;function o(c){if(typeof WeakMap!="function")return null;var u=new WeakMap,l=new WeakMap;return(o=function(p){return p?l:u})(c)}function f(c,u){if(c&&c.__esModule)return c;if(c===null||typeof c!="object"&&typeof c!="function")return{default:c};var l=o(u);if(l&&l.has(c))return l.get(c);var p={__proto__:null},y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var m in c)if(m!=="default"&&{}.hasOwnProperty.call(c,m)){var A=y?Object.getOwnPropertyDescriptor(c,m):null;A&&(A.get||A.set)?Object.defineProperty(p,m,A):p[m]=c[m]}return p.default=c,l&&l.set(c,p),p}})(st);var Ir={},Wa={},q4={},K4={},AT={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(i){const a=[],s=new Array(4),o=[0,192,224,240],f=[127,63,63,63],c=[0,128,128,128];for(const u of i){const l=s,p=u.codePointAt(0),y=0-(-(p&4294967168)>>31)-(-(p&4294965248)>>31)-(-(p&4294901760)>>31),m=f[y],A=c[y];l[3]=A|p&m,l[2]=A|p>>>6&m,l[1]=A|p>>>12&m,l[0]=A|p>>>18&m;const S=3-y;l[S]|=o[y],Array.prototype.push.apply(a,l.slice(S))}return new Uint8Array(a)}t.toUtf8_1=e;function r(i){const a=[];for(const s of i){const o=s.codePointAt(0);o<128?a.push(o):o<2048?a.push(192|o>>6&31,128|o&63):o<65536?a.push(224|o>>12&15,128|o>>6&63,128|o&63):a.push(240|o>>18&7,128|o>>12&63,128|o>>6&63,128|o&63)}return new Uint8Array(a)}t.toUtf8_2=r;function n(i){const a=[];for(let s=0,o=i.length;s>6,128|f&63);else if(f<55296||f>=57344)a.push(224|f>>12,128|f>>6&63,128|f&63);else{let c=65536+((f&1023)<<10|i.charCodeAt(++s)&1023);a.push(240|c>>18&7,128|c>>12&63,128|c>>6&63,128|c&63)}}return new Uint8Array(a)}t.toUtf8_3=n,t.toUtf8=n,t.default=t.toUtf8})(AT);Object.defineProperty(K4,"__esModule",{value:!0});const bz=AT,el=2654435761,tl=2246822519,Mb=3266489917,w9=668265263,A9=374761393;function gz(t,e=0){t=typeof t=="string"?bz.default(t):t;const r=t;let n=e+A9&4294967295,i=0;if(r.length>=16){const s=[e+el+tl&4294967295,e+tl&4294967295,e+0&4294967295,e-el&4294967295],o=t,f=o.length-16;let c=0;for(i=0;(i&4294967280)<=f;i+=4){const u=i,l=o[u+0]+(o[u+1]<<8),p=o[u+2]+(o[u+3]<<8),y=l*tl+(p*tl<<16);let m=s[c]+y&4294967295;m=m<<13|m>>>19;const A=m&65535,S=m>>>16;s[c]=A*el+(S*el<<16)&4294967295,c=c+1&3}n=(s[0]<<1|s[0]>>>31)+(s[1]<<7|s[1]>>>25)+(s[2]<<12|s[2]>>>20)+(s[3]<<18|s[3]>>>14)&4294967295}n=n+t.length&4294967295;let a=t.length-4;for(;i<=a;i+=4){const s=i,o=r[s+0]+(r[s+1]<<8),f=r[s+2]+(r[s+3]<<8),c=o*Mb+(f*Mb<<16);n=n+c&4294967295,n=n<<17|n>>>15,n=(n&65535)*w9+((n>>>16)*w9<<16)&4294967295}for(;i>>21,n=(n&65535)*el+((n>>>16)*el<<16)&4294967295}return n=n^n>>>15,n=((n&65535)*tl&4294967295)+((n>>>16)*tl<<16),n=n^n>>>13,n=((n&65535)*Mb&4294967295)+((n>>>16)*Mb<<16),n=n^n>>>16,n<0?n+4294967296:n}K4.xxHash32=gz;(function(t){function e(r){for(var n in r)t.hasOwnProperty(n)||(t[n]=r[n])}Object.defineProperty(t,"__esModule",{value:!0}),e(K4)})(q4);var St={},Vn={exports:{}},ET=ST;class xT extends Error{}xT.prototype.name="AssertionError";function ST(t,e){if(!t){var r=new xT(e);throw Error.captureStackTrace&&Error.captureStackTrace(r,ST),r}}var Vs={exports:{}},$3={exports:{}};function IT(t){return t.length}function yz(t){const e=t.byteLength;let r="";for(let n=0;n1&&t.charCodeAt(e-1)===61&&e--,e*3>>>2}function mz(t){const e=t.byteLength;let r="";for(let n=0;n>2]+xl[(t[n]&3)<<4|t[n+1]>>4]+xl[(t[n+1]&15)<<2|t[n+2]>>6]+xl[t[n+2]&63];return e%3===2?r=r.substring(0,r.length-1)+"=":e%3===1&&(r=r.substring(0,r.length-2)+"=="),r}function wz(t,e,r=0,n=CT(e)){const i=Math.min(n,t.byteLength-r);for(let a=0,s=0;s>4,t[s++]=(f&15)<<4|c>>2,t[s++]=(c&3)<<6|u&63}return i}var Az={byteLength:CT,toString:mz,write:wz};function TT(t){return t.length>>>1}function Ez(t){const e=t.byteLength;t=new DataView(t.buffer,t.byteOffset,e);let r="",n=0;for(let i=e-e%4;n=48&&t<=57)return t-48;if(t>=65&&t<=70)return t-65+10;if(t>=97&&t<=102)return t-97+10}function j3(t){let e=0;for(let r=0,n=t.length;r=55296&&i<=56319&&r+1=56320&&a<=57343){e+=4,r++;continue}}i<=127?e+=1:i<=2047?e+=2:e+=3}return e}let F3;if(typeof TextDecoder<"u"){const t=new TextDecoder;F3=function(r){return t.decode(r)}}else F3=function(e){const r=e.byteLength;let n="",i=0;for(;i0){let f=0;for(;f>c,c-=6;c>=0;)e[o++]=128|f>>c&63,c-=6;s+=f>=65536?2:1}return a};var Iz={byteLength:j3,toString:F3,write:q3};function OT(t){return t.length*2}function Cz(t){const e=t.byteLength;let r="";for(let n=0;n>8,c=o%256;t[r+s*2]=c,t[r+s*2+1]=f}return i}var Oz={byteLength:OT,toString:Cz,write:Tz};(function(t,e){const r=_z,n=Az,i=Sz,a=Iz,s=Oz,o=new Uint8Array(Uint16Array.of(255).buffer)[0]===255;function f(V){switch(V){case"ascii":return r;case"base64":return n;case"hex":return i;case"utf8":case"utf-8":case void 0:case null:return a;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s;default:throw new Error(`Unknown encoding: ${V}`)}}function c(V){return V instanceof Uint8Array}function u(V){try{return f(V),!0}catch{return!1}}function l(V,J,ie){const ce=new Uint8Array(V);return J!==void 0&&e.fill(ce,J,0,ce.byteLength,ie),ce}function p(V){return new Uint8Array(V)}function y(V){return new Uint8Array(V)}function m(V,J){return f(J).byteLength(V)}function A(V,J){if(V===J)return 0;const ie=Math.min(V.byteLength,J.byteLength);V=new DataView(V.buffer,V.byteOffset,V.byteLength),J=new DataView(J.buffer,J.byteOffset,J.byteLength);let ce=0;for(let ye=ie-ie%4;cege)return 1}return V.byteLength>J.byteLength?1:V.byteLengthye+ge.byteLength,0));const ie=new Uint8Array(J);let ce=0;for(const ye of V){if(ce+ye.byteLength>ie.byteLength){const ge=ye.subarray(0,ie.byteLength-ce);return ie.set(ge,ce),ie}ie.set(ye,ce),ce+=ye.byteLength}return ie}function w(V,J,ie=0,ce=0,ye=V.byteLength){if(ye>0&&ye=V.byteLength)throw new RangeError("sourceStart is out of range");if(ye<0)throw new RangeError("sourceEnd is out of range");ie>=J.byteLength&&(ie=J.byteLength),ye>V.byteLength&&(ye=V.byteLength),J.byteLength-ie=V.byteLength){if(ye)return-1;ie=V.byteLength-1}else if(ie<0)if(ye)ie=0;else return-1;if(typeof J=="string")J=M(J,ce);else if(typeof J=="number")return J=J&255,ye?V.indexOf(J,ie):V.lastIndexOf(J,ie);if(J.byteLength===0)return-1;if(ye){let ge=-1;for(let Se=ie;SeV.byteLength&&(ie=V.byteLength-J.byteLength);for(let ge=ie;ge>=0;ge--){let Se=!0;for(let kt=0;kt=ye||ce<=ie?"":(ie<0&&(ie=0),ce>ye&&(ce=ye),(ie!==0||cefunction(){return s||(0,a[Object.keys(a)[0]])((s={exports:{}}).exports,s),s.exports},e=(()=>{for(var a=new Uint8Array(128),s=0;s<64;s++)a[s<26?s+65:s<52?s+71:s<62?s-4:s*4-205]=s;return o=>{for(var f=o.length,c=new Uint8Array((f-(o[f-1]=="=")-(o[f-2]=="="))*3/4|0),u=0,l=0;u>4,c[l++]=y<<4|m>>2,c[l++]=m<<6|A}return c}})(),r=t({"wasm-binary:./blake2b.wat"(a,s){s.exports=e("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMKvz8EwAIAIABCADcDACAAQgA3AwggAEIANwMQIABCADcDGCAAQgA3AyAgAEIANwMoIABCADcDMCAAQgA3AzggAEIANwNAIABCADcDSCAAQgA3A1AgAEIANwNYIABCADcDYCAAQgA3A2ggAEIANwNwIABCADcDeCAAQoiS853/zPmE6gBBACkDAIU3A4ABIABCu86qptjQ67O7f0EIKQMAhTcDiAEgAEKr8NP0r+68tzxBECkDAIU3A5ABIABC8e30+KWn/aelf0EYKQMAhTcDmAEgAELRhZrv+s+Uh9EAQSApAwCFNwOgASAAQp/Y+dnCkdqCm39BKCkDAIU3A6gBIABC6/qG2r+19sEfQTApAwCFNwOwASAAQvnC+JuRo7Pw2wBBOCkDAIU3A7gBIABCADcDwAEgAEIANwPIASAAQgA3A9ABC20BA38gAEHAAWohAyAAQcgBaiEEIAQpAwCnIQUCQANAIAEgAkYNASAFQYABRgRAIAMgAykDACAFrXw3AwBBACEFIAAQAwsgACAFaiABLQAAOgAAIAVBAWohBSABQQFqIQEMAAsLIAQgBa03AwALYQEDfyAAQcABaiEBIABByAFqIQIgASABKQMAIAIpAwB8NwMAIABCfzcD0AEgAikDAKchAwJAA0AgA0GAAUYNASAAIANqQQA6AAAgA0EBaiEDDAALCyACIAOtNwMAIAAQAwuqOwIgfgl/IABBgAFqISEgAEGIAWohIiAAQZABaiEjIABBmAFqISQgAEGgAWohJSAAQagBaiEmIABBsAFqIScgAEG4AWohKCAhKQMAIQEgIikDACECICMpAwAhAyAkKQMAIQQgJSkDACEFICYpAwAhBiAnKQMAIQcgKCkDACEIQoiS853/zPmE6gAhCUK7zqqm2NDrs7t/IQpCq/DT9K/uvLc8IQtC8e30+KWn/aelfyEMQtGFmu/6z5SH0QAhDUKf2PnZwpHagpt/IQ5C6/qG2r+19sEfIQ9C+cL4m5Gjs/DbACEQIAApAwAhESAAKQMIIRIgACkDECETIAApAxghFCAAKQMgIRUgACkDKCEWIAApAzAhFyAAKQM4IRggACkDQCEZIAApA0ghGiAAKQNQIRsgACkDWCEcIAApA2AhHSAAKQNoIR4gACkDcCEfIAApA3ghICANIAApA8ABhSENIA8gACkD0AGFIQ8gASAFIBF8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSASfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgE3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBR8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAVfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFnx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBd8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAYfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgGXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBp8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAbfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgHHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIB18fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAefHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgH3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFICB8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAffHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgG3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBV8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAZfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHICB8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAefHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggF3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBJ8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAdfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgEXx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBN8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAcfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggGHx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBZ8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAUfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHHx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBl8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAdfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgEXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBZ8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByATfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggIHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIB58fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAbfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgH3x8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBR8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAXfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBJ8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAafHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFXx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBh8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAafHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFHx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBJ8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAefHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHXx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBx8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAffHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgE3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBd8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAWfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgG3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBV8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCARfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgIHx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBl8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAafHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEXx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBZ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAYfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgE3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBV8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAbfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggIHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIB98fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiASfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgHHx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB18fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAXfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggGXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBR8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAefHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgE3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIB18fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAXfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgG3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBF8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAcfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggGXx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBR8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAVfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBh8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAWfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggIHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB98fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSASfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgGnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB18fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAWfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgEnx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGICB8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAffHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHnx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBV8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAbfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBh8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAXfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBp8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCATfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGXx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBx8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAefHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgHHx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBh8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAffHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBJ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAUfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBZ8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiARfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgIHx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBV8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAZfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggF3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBN8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAbfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgF3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFICB8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAffHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGnx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBx8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAUfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggEXx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBl8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAdfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgE3x8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIB58fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAYfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggEnx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBV8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAbfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBt8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSATfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgGXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBV8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAYfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgF3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBJ8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAWfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgIHx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBx8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAafHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgH3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBR8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAdfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgHnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBF8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgISAhKQMAIAEgCYWFNwMAICIgIikDACACIAqFhTcDACAjICMpAwAgAyALhYU3AwAgJCAkKQMAIAQgDIWFNwMAICUgJSkDACAFIA2FhTcDACAmICYpAwAgBiAOhYU3AwAgJyAnKQMAIAcgD4WFNwMAICggKCkDACAIIBCFhTcDAAs=")}}),n=r(),i=WebAssembly.compile(n);return E_=async a=>(await WebAssembly.instantiate(await i,a)).exports,E_}var Ai=ET,Mz=Bz,Do=null,S9=typeof WebAssembly<"u"&&Dz()().then(t=>{Do=t}),bo=64,hg=[];Vs.exports=Gn;var I9=Vs.exports.BYTES_MIN=16,C9=Vs.exports.BYTES_MAX=64;Vs.exports.BYTES=32;var T9=Vs.exports.KEYBYTES_MIN=16,O9=Vs.exports.KEYBYTES_MAX=64;Vs.exports.KEYBYTES=32;var B9=Vs.exports.SALTBYTES=16,D9=Vs.exports.PERSONALBYTES=16;function Gn(t,e,r,n,i){if(!(this instanceof Gn))return new Gn(t,e,r,n,i);if(!Do)throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(Ai(t>=I9,"digestLength must be at least "+I9+", was given "+t),Ai(t<=C9,"digestLength must be at most "+C9+", was given "+t),e!=null&&(Ai(e instanceof Uint8Array,"key must be Uint8Array or Buffer"),Ai(e.length>=T9,"key must be at least "+T9+", was given "+e.length),Ai(e.length<=O9,"key must be at least "+O9+", was given "+e.length)),r!=null&&(Ai(r instanceof Uint8Array,"salt must be Uint8Array or Buffer"),Ai(r.length===B9,"salt must be exactly "+B9+", was given "+r.length)),n!=null&&(Ai(n instanceof Uint8Array,"personal must be Uint8Array or Buffer"),Ai(n.length===D9,"personal must be exactly "+D9+", was given "+n.length))),hg.length||(hg.push(bo),bo+=216),this.digestLength=t,this.finalized=!1,this.pointer=hg.pop(),this._memory=new Uint8Array(Do.memory.buffer),this._memory.fill(0,0,64),this._memory[0]=this.digestLength,this._memory[1]=e?e.length:0,this._memory[2]=1,this._memory[3]=1,r&&this._memory.set(r,32),n&&this._memory.set(n,48),this.pointer+216>this._memory.length&&this._realloc(this.pointer+216),Do.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),this._memory.fill(0,bo,bo+e.length),this._memory[this.pointer+200]=128)}Gn.prototype._realloc=function(t){Do.memory.grow(Math.max(0,Math.ceil(Math.abs(t-this._memory.length)/65536))),this._memory=new Uint8Array(Do.memory.buffer)};Gn.prototype.update=function(t){return Ai(this.finalized===!1,"Hash instance finalized"),Ai(t instanceof Uint8Array,"input must be Uint8Array or Buffer"),bo+t.length>this._memory.length&&this._realloc(bo+t.length),this._memory.set(t,bo),Do.blake2b_update(this.pointer,bo,bo+t.length),this};Gn.prototype.digest=function(t){if(Ai(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,hg.push(this.pointer),Do.blake2b_final(this.pointer),!t||t==="binary")return this._memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(typeof t=="string")return Mz.toString(this._memory,t,this.pointer+128,this.pointer+128+this.digestLength);Ai(t instanceof Uint8Array&&t.length>=this.digestLength,"input must be Uint8Array or Buffer");for(var e=0;et(),t):t(new Error("WebAssembly not supported"))};Gn.prototype.ready=Gn.ready;Gn.prototype.getPartialHash=function(){return this._memory.slice(this.pointer,this.pointer+216)};Gn.prototype.setPartialHash=function(t){this._memory.set(t,this.pointer)};function Rz(){}var Lz=Vs.exports,Xi=ET,Ip=Lz;function Rb(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function M9(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var a=t[e+1]+n;i>=4294967296&&a++,t[e]=i,t[e+1]=a}function BT(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function ff(t,e,r,n,i,a){var s=xh[i],o=xh[i+1],f=xh[a],c=xh[a+1];Rb(Ue,t,e),M9(Ue,t,s,o);var u=Ue[n]^Ue[t],l=Ue[n+1]^Ue[t+1];Ue[n]=l,Ue[n+1]=u,Rb(Ue,r,n),u=Ue[e]^Ue[r],l=Ue[e+1]^Ue[r+1],Ue[e]=u>>>24^l<<8,Ue[e+1]=l>>>24^u<<8,Rb(Ue,t,e),M9(Ue,t,f,c),u=Ue[n]^Ue[t],l=Ue[n+1]^Ue[t+1],Ue[n]=u>>>16^l<<16,Ue[n+1]=l>>>16^u<<16,Rb(Ue,r,n),u=Ue[e]^Ue[r],l=Ue[e+1]^Ue[r+1],Ue[e]=l>>>31^u<<1,Ue[e+1]=u>>>31^l<<1}var DT=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Hz=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],un=new Uint8Array(Hz.map(function(t){return t*2})),Ue=new Uint32Array(32),xh=new Uint32Array(32);function MT(t,e){var r=0;for(r=0;r<16;r++)Ue[r]=t.h[r],Ue[r+16]=DT[r];for(Ue[24]=Ue[24]^t.t,Ue[25]=Ue[25]^t.t/4294967296,e&&(Ue[28]=~Ue[28],Ue[29]=~Ue[29]),r=0;r<32;r++)xh[r]=BT(t.b,4*r);for(r=0;r<12;r++)ff(0,8,16,24,un[r*16+0],un[r*16+1]),ff(2,10,18,26,un[r*16+2],un[r*16+3]),ff(4,12,20,28,un[r*16+4],un[r*16+5]),ff(6,14,22,30,un[r*16+6],un[r*16+7]),ff(0,10,20,30,un[r*16+8],un[r*16+9]),ff(2,12,22,24,un[r*16+10],un[r*16+11]),ff(4,14,16,26,un[r*16+12],un[r*16+13]),ff(6,8,18,28,un[r*16+14],un[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Ue[r]^Ue[r+16]}var cf=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function vd(t,e,r,n){cf.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,cf[0]=t,e&&(cf[1]=e.length),cf[2]=1,cf[3]=1,r&&cf.set(r,32),n&&cf.set(n,48);for(var i=0;i<16;i++)this.h[i]=DT[i]^BT(cf,i*4);e&&(RT(this,e),this.c=128)}vd.prototype.update=function(t){return Xi(t instanceof Uint8Array,"input must be Uint8Array or Buffer"),RT(this,t),this};vd.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Xi(e instanceof Uint8Array,'out must be "binary", "hex", Uint8Array, or Buffer'),Xi(e.length>=this.outlen,"out must have at least outlen bytes of space"),Pz(this,e),t==="hex"?Nz(e):e};vd.prototype.final=vd.prototype.digest;vd.ready=function(t){Ip.ready(function(){t()})};function RT(t,e){for(var r=0;r>2]>>8*(r&3);return e}function Nz(t){for(var e="",r=0;r=R9,"outlen must be at least "+R9+", was given "+e),Xi(e<=L9,"outlen must be at most "+L9+", was given "+e),r!=null&&(Xi(r instanceof Uint8Array,"key must be Uint8Array or Buffer"),Xi(r.length>=H9,"key must be at least "+H9+", was given "+r.length),Xi(r.length<=P9,"key must be at most "+P9+", was given "+r.length)),n!=null&&(Xi(n instanceof Uint8Array,"salt must be Uint8Array or Buffer"),Xi(n.length===N9,"salt must be exactly "+N9+", was given "+n.length)),i!=null&&(Xi(i instanceof Uint8Array,"personal must be Uint8Array or Buffer"),Xi(i.length===U9,"personal must be exactly "+U9+", was given "+i.length))),new kz(e,r,n,i)};Vn.exports.ready=function(t){Ip.ready(function(){t()})};Vn.exports.WASM_SUPPORTED=Ip.SUPPORTED;Vn.exports.WASM_LOADED=!1;var R9=Vn.exports.BYTES_MIN=16,L9=Vn.exports.BYTES_MAX=64;Vn.exports.BYTES=32;var H9=Vn.exports.KEYBYTES_MIN=16,P9=Vn.exports.KEYBYTES_MAX=64;Vn.exports.KEYBYTES=32;var N9=Vn.exports.SALTBYTES=16,U9=Vn.exports.PERSONALBYTES=16;Ip.ready(function(t){t||(Vn.exports.WASM_LOADED=!0,Vn.exports=Ip)});var zz=Vn.exports,Jg={exports:{}};Jg.exports;(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,a=2,s=9007199254740991,o="[object Arguments]",f="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",l="[object Date]",p="[object Error]",y="[object Function]",m="[object GeneratorFunction]",A="[object Map]",S="[object Number]",w="[object Null]",C="[object Object]",O="[object Promise]",M="[object Proxy]",U="[object RegExp]",K="[object Set]",Q="[object String]",k="[object Symbol]",G="[object Undefined]",W="[object WeakMap]",R="[object ArrayBuffer]",_="[object DataView]",I="[object Float32Array]",b="[object Float64Array]",v="[object Int8Array]",d="[object Int16Array]",g="[object Int32Array]",x="[object Uint8Array]",E="[object Uint8ClampedArray]",h="[object Uint16Array]",T="[object Uint32Array]",$=/[\\^$.*+?()[\]{}|]/g,L=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,F={};F[I]=F[b]=F[v]=F[d]=F[g]=F[x]=F[E]=F[h]=F[T]=!0,F[o]=F[f]=F[R]=F[u]=F[_]=F[l]=F[p]=F[y]=F[A]=F[S]=F[C]=F[U]=F[K]=F[Q]=F[W]=!1;var H=typeof Fn=="object"&&Fn&&Fn.Object===Object&&Fn,q=typeof self=="object"&&self&&self.Object===Object&&self,X=H||q||Function("return this")(),te=e&&!e.nodeType&&e,ne=te&&!0&&t&&!t.nodeType&&t,N=ne&&ne.exports===te,P=N&&H.process,re=function(){try{return P&&P.binding&&P.binding("util")}catch{}}(),ue=re&&re.isTypedArray;function de(Z,oe){for(var be=-1,Ce=Z==null?0:Z.length,It=0,ze=[];++be-1}function H0(Z,oe){var be=this.__data__,Ce=cb(be,Z);return Ce<0?(++this.size,be.push([Z,oe])):be[Ce][1]=oe,this}bi.prototype.clear=D0,bi.prototype.delete=M0,bi.prototype.get=R0,bi.prototype.has=L0,bi.prototype.set=H0;function Pa(Z){var oe=-1,be=Z==null?0:Z.length;for(this.clear();++oeTr))return!1;var jt=ze.get(Z);if(jt&&ze.get(oe))return jt==oe;var gi=-1,Na=!0,cn=be&a?new rf:void 0;for(ze.set(Z,oe),ze.set(oe,Z);++gi-1&&Z%1==0&&Z-1&&Z%1==0&&Z<=s}function Tw(Z){var oe=typeof Z;return Z!=null&&(oe=="object"||oe=="function")}function Y0(Z){return Z!=null&&typeof Z=="object"}var Ow=ue?ce(ue):IH;function zH(Z){return UH(Z)?AH(Z):CH(Z)}function $H(){return[]}function jH(){return!1}t.exports=kH})(Jg,Jg.exports);var $z=Jg.exports,Ee={},Q4,Y4;Object.defineProperty(Ee,"__esModule",{value:!0});var ey=Ee.WitnessArgs=Ee.UncleBlockVec=Ee.UncleBlock=Ee.TransactionVec=Y4=Ee.Transaction=Ee.ScriptOpt=Ee.Script=Ee.RawTransaction=Ee.RawHeader=Ee.ProposalShortIdVec=Ee.ProposalShortId=Q4=Ee.OutPoint=Ee.Header=Ee.HashType=Ee.DepType=Ee.CellbaseWitness=Ee.CellOutputVec=Ee.CellOutput=Ee.CellInputVec=Ee.CellInput=Ee.CellDepVec=Ee.CellDep=Ee.BytesVec=Ee.BytesOptVec=Ee.BytesOpt=Ee.Bytes=Ee.Byte32Vec=Ee.Byte32=Ee.BlockV1=Ee.Block=Ee.BaseHeader=void 0;Ee.WitnessArgsOf=HT;Ee.createFixedHexBytesCodec=W4;Ee.deTransformHeaderCodecType=jT;Ee.deTransformTransactionCodecType=zT;Ee.transformHeaderCodecType=$T;Ee.transformTransactionCodecType=kT;var Hr=st,jz=wt;function i2(t){return{...t,unpack:e=>jz.BI.from(t.unpack(e)).toHexString()}}const k9=i2(Hr.number.Uint8),ty=i2(Hr.number.Uint32LE),Wh=i2(Hr.number.Uint64LE),Fz=i2(Hr.number.Uint128LE),{byteVecOf:pg,option:Xh,table:Wo,vector:Xo,struct:l1}=Hr.molecule,{bytify:V4,hexify:G4}=Hr.bytes;function W4(t){return(0,Hr.createFixedBytesCodec)({byteLength:t,pack:e=>V4(e),unpack:e=>G4(e)})}const d1=Ee.Bytes=pg({pack:V4,unpack:G4}),qz=Ee.BytesOpt=Xh(d1),LT=Ee.BytesVec=Xo(d1);Ee.BytesOptVec=Xo(qz);const Bf=Ee.Byte32=W4(32),Kz=Ee.Byte32Vec=Xo(Bf);function HT(t){return Wo({lock:Xh(pg(t.lock)),inputType:Xh(pg(t.inputType)),outputType:Xh(pg(t.outputType))},["lock","inputType","outputType"])}const x_=(0,Hr.createBytesCodec)({pack:V4,unpack:G4});ey=Ee.WitnessArgs=HT({lock:x_,inputType:x_,outputType:x_});const Qz=Ee.HashType=(0,Hr.createFixedBytesCodec)({byteLength:1,pack:t=>{if(t==="type")return Hr.number.Uint8.pack(1);if(t==="data")return Hr.number.Uint8.pack(0);if(t==="data1")return Hr.number.Uint8.pack(2);if(t==="data2")return Hr.number.Uint8.pack(4);throw new Error(`Invalid hash type: ${t}`)},unpack:t=>{const e=Hr.number.Uint8.unpack(t);if(e===1)return"type";if(e===0)return"data";if(e===2)return"data1";if(e===4)return"data2";throw new Error(`Invalid hash type: ${e}`)}}),Yz=Ee.DepType=(0,Hr.createFixedBytesCodec)({byteLength:1,pack:t=>{if(t==="code")return k9.pack(0);if(t==="depGroup")return k9.pack(1);throw new Error(`Invalid dep type: ${t}`)},unpack:t=>{const e=Hr.number.Uint8.unpack(t);if(e===0)return"code";if(e===1)return"depGroup";throw new Error(`Invalid dep type: ${e}`)}}),X4=Ee.Script=Wo({codeHash:Bf,hashType:Qz,args:d1},["codeHash","hashType","args"]),Vz=Ee.ScriptOpt=Xh(X4),PT=Q4=Ee.OutPoint=l1({txHash:Bf,index:ty},["txHash","index"]),Gz=Ee.CellInput=l1({since:Wh,previousOutput:PT},["since","previousOutput"]),Wz=Ee.CellInputVec=Xo(Gz),Xz=Ee.CellOutput=Wo({capacity:Wh,lock:X4,type:Vz},["capacity","lock","type"]),Zz=Ee.CellOutputVec=Xo(Xz),Jz=Ee.CellDep=l1({outPoint:PT,depType:Yz},["outPoint","depType"]),e$=Ee.CellDepVec=Xo(Jz),t$=Ee.RawTransaction=Wo({version:ty,cellDeps:e$,headerDeps:Kz,inputs:Wz,outputs:Zz,outputsData:LT},["version","cellDeps","headerDeps","inputs","outputs","outputsData"]),z9=Wo({raw:t$,witnesses:LT},["raw","witnesses"]),r$=Y4=Ee.Transaction=(0,Hr.createBytesCodec)({pack:t=>z9.pack(kT(t)),unpack:t=>zT(z9.unpack(t))}),NT=Ee.TransactionVec=Xo(r$),n$=Ee.RawHeader=l1({version:ty,compactTarget:ty,timestamp:Wh,number:Wh,epoch:Wh,parentHash:Bf,transactionsRoot:Bf,proposalsHash:Bf,extraHash:Bf,dao:Bf},["version","compactTarget","timestamp","number","epoch","parentHash","transactionsRoot","proposalsHash","extraHash","dao"]),$9=Ee.BaseHeader=l1({raw:n$,nonce:Fz},["raw","nonce"]),Z4=Ee.Header=(0,Hr.createBytesCodec)({pack:t=>$9.pack($T(t)),unpack:t=>jT($9.unpack(t))}),i$=Ee.ProposalShortId=W4(10),J4=Ee.ProposalShortIdVec=Xo(i$),a$=Ee.UncleBlock=Wo({header:Z4,proposals:J4},["header","proposals"]),UT=Ee.UncleBlockVec=Xo(a$);Ee.Block=Wo({header:Z4,uncles:UT,transactions:NT,proposals:J4},["header","uncles","transactions","proposals"]);Ee.BlockV1=Wo({header:Z4,uncles:UT,transactions:NT,proposals:J4,extension:d1},["header","uncles","transactions","proposals","extension"]);Ee.CellbaseWitness=Wo({lock:X4,message:d1},["lock","message"]);function kT(t){return{raw:{version:t.version,cellDeps:t.cellDeps,headerDeps:t.headerDeps,inputs:t.inputs,outputs:t.outputs,outputsData:t.outputsData},witnesses:t.witnesses}}function zT(t){return{cellDeps:t.raw.cellDeps.map(e=>({outPoint:{txHash:e.outPoint.txHash,index:e.outPoint.index},depType:e.depType})),headerDeps:t.raw.headerDeps,inputs:t.raw.inputs.map(e=>({previousOutput:{txHash:e.previousOutput.txHash,index:e.previousOutput.index},since:e.since})),outputs:t.raw.outputs.map(e=>({capacity:e.capacity,lock:e.lock,type:e.type})),outputsData:t.raw.outputsData,version:t.raw.version,witnesses:t.witnesses}}function $T(t){return{raw:{timestamp:t.timestamp,number:t.number,epoch:t.epoch,compactTarget:Number(t.compactTarget),dao:t.dao,parentHash:t.parentHash,proposalsHash:t.proposalsHash,transactionsRoot:t.transactionsRoot,extraHash:t.extraHash,version:t.version},nonce:t.nonce}}function jT(t){return{timestamp:t.raw.timestamp,number:t.raw.number,epoch:t.raw.epoch,compactTarget:t.raw.compactTarget,dao:t.raw.dao,parentHash:t.raw.parentHash,proposalsHash:t.raw.proposalsHash,transactionsRoot:t.raw.transactionsRoot,extraHash:t.raw.extraHash,version:t.raw.version,nonce:t.nonce,hash:""}}Object.defineProperty(St,"__esModule",{value:!0});St.CKBHasher=void 0;St.assertHexString=w$;St.assertHexadecimal=GT;St.ckbHash=r8;St.ckbHash160=p$;var s$=St.computeScriptHash=b$;St.deepCamel=ry;St.deepCamelizeTransaction=I$;St.generateTypeIdScript=S$;St.hashCode=g$;St.isDeepEqual=A$;St.readBigUInt128LE=m$;St.readBigUInt128LECompatible=VT;St.readBigUInt64LE=v$;St.readBigUInt64LECompatible=QT;St.toBigUInt128LE=_$;St.toBigUInt128LECompatible=YT;St.toBigUInt64LE=y$;St.toBigUInt64LECompatible=KT;var o$=qT(zz),f$=qT($z),c$=q4,_d=st,e8=u$(Ee),a2=r0;function FT(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(FT=function(n){return n?r:e})(t)}function u$(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=FT(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}function qT(t){return t&&t.__esModule?t:{default:t}}const{bytify:l$,hexify:d$,bytifyRawString:h$}=_d.bytes;let t8=class{constructor(e={}){const{outLength:r=32}=e;this.outLength=r,this.hasher=(0,o$.default)(r,void 0,void 0,h$("ckb-default-hash"))}update(e){return this.hasher.update(l$(e)),this}digestHex(){const e=new Uint8Array(this.outLength);return this.hasher.digest(e),d$(e.buffer)}};St.CKBHasher=t8;function r8(t){const e=new t8;return e.update(_d.bytes.bytify(t)),e.digestHex()}function p$(t){return r8(t).slice(0,42)}function b$(t){return r8(e8.Script.pack(t))}function g$(t){return(0,c$.xxHash32)(t,0)}function y$(t){return KT(t)}function KT(t){return _d.bytes.hexify(a2.Uint64LE.pack(t))}function v$(t){return QT(t).toBigInt()}function QT(t){return a2.Uint64LE.unpack(t)}function _$(t){return YT(t)}function YT(t){return _d.bytes.hexify(a2.Uint128LE.pack(t))}function m$(t){return VT(t).toBigInt()}function VT(t){return a2.Uint128LE.unpack(t)}function w$(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(`${t} must be a hex string!`)}function GT(t,e){if(!/^0x(0|[0-9a-fA-F]+)$/.test(e))throw new Error(`${t} must be a hexadecimal!`)}function A$(t,e){return(0,f$.default)(t,e)}const E$="0x00000000000000000000000000000000000000000000000000545950455f4944";function x$(t,e){const r=e8.CellInput.pack(t),n=_d.bytes.hexify(_d.number.Uint64LE.pack(e)),i=new t8;return i.update(r),i.update(n),i.digestHex()}function S$(t,e="0x0"){e8.CellInput.pack(t),GT("outputIndex",e);const r=x$(t,e);return{codeHash:E$,hashType:"type",args:r}}function j9(t){return t.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace("-","").replace("_",""))}function ry(t){if(Object.prototype.toString.call(t)==="[object Array]")return t.length===0?t:t.map(r=>ry(r));const e={};if(Object.prototype.toString.call(t)==="[object Object]"){for(const r in t){const n=t[r];Object.prototype.toString.call(n)==="[object Object]"||Object.prototype.toString.call(n)==="[object Array]"?e[j9(r)]=ry(n):e[j9(r)]=n}return e}return t}function K3(t){if(Object.prototype.toString.call(t)==="[object Array]")return t.length===0?t:t.map(r=>K3(r));const e={};if(Object.prototype.toString.call(t)==="[object Object]"){for(const r in t){const n=t[r];Object.prototype.toString.call(n)==="[object Object]"||Object.prototype.toString.call(n)==="[object Array]"?e[r]=K3(n):e[r]=n==="dep_group"?"depGroup":n}return e}return t}function I$(t){return K3(ry(t))}Object.defineProperty(Wa,"__esModule",{value:!0});Wa.TransactionValue=Wa.ScriptValue=Wa.RawTransactionValue=Wa.OutPointValue=void 0;var C$=q4,T$=St,O$=st,s2=B$(Ee);function WT(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(WT=function(n){return n?r:e})(t)}function B$(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=WT(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}const{hexify:F9}=O$.bytes;class o2{constructor(e){this.buffer=e}equals(e){return F9(this.buffer)===F9(e.buffer)}hashCode(){return(0,C$.xxHash32)(Buffer.from(this.buffer),0)}hash(){return(0,T$.ckbHash)(this.buffer)}}let D$=class extends o2{constructor(e,r={}){super(s2.Script.pack(e))}};Wa.ScriptValue=D$;class M$ extends o2{constructor(e,r={}){super(s2.OutPoint.pack(e))}}Wa.OutPointValue=M$;class R$ extends o2{constructor(e,r={}){super(s2.RawTransaction.pack(e))}}Wa.RawTransactionValue=R$;class L$ extends o2{constructor(e,r={}){super(s2.Transaction.pack(e))}}Wa.TransactionValue=L$;var Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});Pi.generateAbsoluteEpochSince=ZT;var H$=Pi.generateHeaderEpoch=JT;Pi.generateSince=XT;Pi.maximumAbsoluteEpochSince=N$;var Cp=Pi.parseAbsoluteEpochSince=eO,h1=Pi.parseEpoch=ny;Pi.parseSince=P$;Pi.parseSinceCompatible=p1;Pi.validateAbsoluteEpochSince=tO;Pi.validateSince=U$;var Je=wt;function P$(t){const e=p1(t);return e.type==="epochNumber"?e:{...e,value:e.value.toBigInt()}}function p1(t){const e=Je.BI.from(t),r=e.shr(56),n=r.shr(5).and("0b11");let i,a;if(n.eq(0))i="blockNumber",a=e.and("0xFFFFFFFFFFFFFF");else if(n.eq(1))i="epochNumber",a={length:e.shr(40).and(65535).toNumber(),index:e.shr(24).and(65535).toNumber(),number:e.and(16777215).toNumber()};else if(n.eq(2))i="blockTimestamp",a=e.and("0xFFFFFFFFFFFFFF");else throw new Error("Invalid metric flag!");return{relative:!r.and("0x80").eq(0),type:i,value:a}}function XT({relative:t,type:e,value:r}){let n=Je.BI.from(0);t&&(n=n.add(128)),e==="epochNumber"?n=n.add(32):e==="blockTimestamp"&&(n=n.add(64));let i;return(0,Je.isBIish)(r)?i=Je.BI.from(r):typeof r=="object"?i=JT(r):i=Je.BI.from(r),rO(n.shl(56).add(i))}function ny(t){const e=Je.BI.from(t);return{length:e.shr(40).and(65535).toNumber(),index:e.shr(24).and(65535).toNumber(),number:e.and(16777215).toNumber()}}function N$(...t){const e=t.map(a=>eO(a)),r=Math.max(...e.map(a=>a.number)),n=e.filter(a=>a.number===r);let i=n[0];for(let a=1;a=0){const c=o.argsLen*2+2,u=o.script.args.length,l=Math.min(c,u),p=t.cellOutput.lock;if(p.args.length!==c||!(p.codeHash===o.script.codeHash&&p.hashType===o.script.hashType&&p.args.slice(0,l)===o.script.args.slice(0,l)))return!1}return!(f&&f==="empty"&&t.cellOutput.type||f&&typeof f=="object"&&(!t.cellOutput.type||!new Lb.ScriptValue(t.cellOutput.type,{validate:!1}).equals(new Lb.ScriptValue(f.script,{validate:!1})))||i&&i!=="any"&&t.data!==i||a&&t.blockNumber&&Hb.BI.from(t.blockNumber).lt(Hb.BI.from(a))||s&&t.blockNumber&&Hb.BI.from(t.blockNumber).gt(Hb.BI.from(s)))}var Xf={},n8={},g1={};Object.defineProperty(g1,"__esModule",{value:!0});g1.Reader=void 0;class y1{constructor(){this.__isByteLikeReader__=!0}static isReader(e){return e==null?!1:e instanceof y1?!0:e.__isByteLikeReader__===!0}}class Pb extends y1{constructor(e){super(),this.view=new DataView(e)}length(){return this.view.byteLength}indexAt(e){return this.view.getUint8(e)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),e=>("00"+e.toString(16)).slice(-2)).join("")}}class q9 extends y1{constructor(e){super(),this.string=e}length(){return this.string.length/2-1}indexAt(e){return parseInt(this.string.substr(2+e*2,2),16)}toArrayBuffer(){const e=new ArrayBuffer(this.length()),r=new DataView(e);for(let n=0;n255)throw new Error("fromRawString can only accept UTF-8 raw string!");n.setUint8(i,a)}return new Pb(r)}}g1.Reader=i8;var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.NormalizeBlock=j$;Jn.NormalizeCellDep=aO;Jn.NormalizeCellInput=nO;Jn.NormalizeCellOutput=iO;Jn.NormalizeCellbaseWitness=F$;Jn.NormalizeHeader=s8;Jn.NormalizeOutPoint=a8;Jn.NormalizeRawHeader=fO;Jn.NormalizeRawTransaction=sO;Jn.NormalizeScript=iy;Jn.NormalizeTransaction=oO;Jn.NormalizeUncleBlock=cO;Jn.NormalizeWitnessArgs=q$;var z$=wt,$$=g1;function xs(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=z$.BI.from(r).toString(16);if(n.length%2!==0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let a=0;a0&&r.byteLength!==t)throw new Error(`${e} has invalid length ${r.byteLength}, required: ${t}`);return r}}function Ta(t,e,r){const n={};for(const[i,a]of Object.entries(r)){const s=e[i];if(s==null)throw new Error(`${t} is missing ${i}!`);n[i]=a(`${t}.${i}`,s)}return n}function iy(t,{debugPath:e="script"}={}){return Ta(e,t,{codeHash:Jr(32),hashType:function(r,n){switch(n){case"data":return 0;case"type":return 1;case"data1":return 2;case"data2":return 4;case 0:return n;case 1:return n;case 2:return n;case 4:return n;default:throw new Error(`${r}.hashType has invalid value: ${n}`)}},args:Jr(-1)})}function a8(t,{debugPath:e="outPoint"}={}){return Ta(e,t,{txHash:Jr(32),index:xs(4)})}function rs(t){return function(e,r){return t(r,{debugPath:e})}}function nO(t,{debugPath:e="cell_input"}={}){return Ta(e,t,{since:xs(8),previousOutput:rs(a8)})}function iO(t,{debugPath:e="cellOutput"}={}){const r=Ta(e,t,{capacity:xs(8),lock:rs(iy)});return t.type&&(r.type_=iy(t.type,{debugPath:`${e}.type`})),r}function aO(t,{debugPath:e="cell_dep"}={}){return Ta(e,t,{outPoint:rs(a8),depType:function(r,n){switch(n){case"code":return 0;case"depGroup":return 1;case 0:return n;case 1:return n;default:throw new Error(`${r}.depType has invalid value: ${n}`)}}})}function Ss(t){return function(e,r){return r.map((n,i)=>t(`${e}[${i}]`,n))}}function sO(t,{debugPath:e="raw_transaction"}={}){return Ta(e,t,{version:xs(4),cellDeps:Ss(rs(aO)),headerDeps:Ss(Jr(32)),inputs:Ss(rs(nO)),outputs:Ss(rs(iO)),outputsData:Ss(Jr(-1))})}function oO(t,{debugPath:e="transaction"}={}){const r=sO(t,{debugPath:`(raw)${e}`}),n=Ta(e,t,{witnesses:Ss(Jr(-1))});return n.raw=r,n}function fO(t,{debugPath:e="raw_header"}={}){return Ta(e,t,{version:xs(4),compactTarget:xs(4),timestamp:xs(8),number:xs(8),epoch:xs(8),parentHash:Jr(32),transactionsRoot:Jr(32),proposalsHash:Jr(32),extraHash:Jr(32),dao:Jr(32)})}function s8(t,{debugPath:e="header"}={}){const r=fO(t,{debugPath:`(raw)${e}`}),n=Ta(e,t,{nonce:xs(16)});return n.raw=r,n}function cO(t,{debugPath:e="uncle_block"}={}){return Ta(e,t,{header:rs(s8),proposals:Ss(Jr(10))})}function j$(t,{debugPath:e="block"}={}){return Ta(e,t,{header:rs(s8),uncles:Ss(rs(cO)),transactions:Ss(rs(oO)),proposals:Ss(Jr(10))})}function F$(t,{debugPath:e="cellbase_witness"}={}){return Ta(e,t,{lock:rs(iy),message:Jr(-1)})}function q$(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=Jr(-1)(`${e}.lock`,t.lock)),t.inputType&&(r.inputType=Jr(-1)(`${e}.inputType`,t.inputType)),t.outputType&&(r.outputType=Jr(-1)(`${e}.outputType`,t.outputType)),r}var hi={},Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.ValidateBlock=G$;Mn.ValidateCellDep=dO;Mn.ValidateCellInput=uO;Mn.ValidateCellOutput=lO;Mn.ValidateCellbaseWitness=W$;Mn.ValidateHeader=f8;Mn.ValidateOutPoint=o8;Mn.ValidateRawHeader=V$;Mn.ValidateRawTransaction=Q$;Mn.ValidateScript=ay;Mn.ValidateTransaction=pO;Mn.ValidateUncleBlock=gO;Mn.ValidateWitnessArgs=X$;function K$(t,e){if(!(e instanceof Object))throw new Error(`${t} is not an object!`)}function Ni(t,e,r,n=[]){K$(t,e);const i=Object.keys(e).sort(),a=r.length,s=r.length+n.length,o=`${t} does not have correct keys! Required keys: [${r.sort().join(", ")}], optional keys: [${n.sort().join(", ")}], actual keys: [${i.join(", ")}]`;if(i.lengths)throw new Error(o);let f=i.filter(c=>!r.includes(c));if(i.length-f.length!==a)throw new Error(o);if(f.find(c=>!n.includes(c)))throw new Error(o)}function Ls(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(`${t} must be a hex string!`)}function Df(t,e){if(Ls(t,e),e.length!==66)throw new Error(`${t} must be a hex string of 66 bytes long!`)}function go(t,e){if(e!=="0x0"&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(`${t} must be a hex integer!`)}function ay(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(Ni(r,t,["codeHash","hashType","args"],[]),Df(`${r}.codeHash`,t.codeHash),Ls(`${r}.args`,t.args),t.hashType!=="data"&&t.hashType!=="type"&&t.hashType!=="data1"&&t.hashType!=="data2")throw new Error(`${r}.hashType must be either data or type!`)}function o8(t,{nestedValidation:e=!0,debugPath:r="outPoint"}={}){Ni(r,t,["txHash","index"],[]),Df(`${r}.txHash`,t.txHash),go(`${r}.index`,t.index)}function uO(t,{nestedValidation:e=!0,debugPath:r="cellInput"}={}){Ni(r,t,["since","previousOutput"],[]),go(`${r}.since`,t.since),e&&o8(t.previousOutput,{debugPath:`${r}.previousOutput`})}function lO(t,{nestedValidation:e=!0,debugPath:r="cellOutput"}={}){Ni(r,t,["capacity","lock"],["type"]),go(`${r}.capacity`,t.capacity),e&&(ay(t.lock,{debugPath:`${r}.lock`}),t.type&&ay(t.type,{debugPath:`${r}.type`}))}function dO(t,{nestedValidation:e=!0,debugPath:r="cellDep"}={}){if(Ni(r,t,["outPoint","depType"],[]),t.depType!=="code"&&t.depType!=="depGroup")throw new Error(`${r}.depType must be either code or depGroup!`);e&&o8(t.outPoint,{debugPath:`${r}.outPoint`})}function Is(t,e,r,n){if(!Array.isArray(e))throw new Error(`${t} is not an array!`);if(n)for(let i=0;if.toUpperCase().replace("_",""));s=e[o]}s&&(n[i]=a(`${t}.${i}`,s))}return n}function sy(t,{validation:e=!0,debugPath:r="script"}={}){return t=ki(r,t,{codeHash:Ne,hashType:Ne,args:Ne}),e&&Ui.ValidateScript(t,{debugPath:`(transformed) ${r}`}),t}function c8(t,{validation:e=!0,debugPath:r="outPoint"}={}){return t=ki(r,t,{txHash:Ne,index:Ne}),e&&Ui.ValidateOutPoint(t,{debugPath:`(transformed) ${r}`}),t}function Yn(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function u8(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=ki(r,t,{since:Ne,previousOutput:Yn(c8)}),e&&Ui.ValidateCellInput(t,{debugPath:`(transformed) ${r}`}),t}function l8(t,{validation:e=!0,debugPath:r="cellOutput"}={}){return t=ki(r,t,{capacity:Ne,lock:Yn(sy),type:Yn(sy)}),e&&Ui.ValidateCellOutput(t,{debugPath:`(transformed) ${r}`}),t}function vO(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=ki(r,t,{outPoint:Yn(c8),depType:Ne}),e&&Ui.ValidateCellDep(t,{debugPath:`(transformed) ${r}`}),t}function zn(t){return function(e,r){return r.map((n,i)=>t(`${e}[${i}]`,n))}}function J$(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=ki(r,t,{version:Ne,cellDeps:zn(Yn(vO)),headerDeps:zn(Ne),inputs:zn(Yn(u8)),outputs:zn(Yn(l8)),outputsData:zn(Ne)}),e&&Ui.ValidateRawTransaction(t,{debugPath:`(transformed) ${r}`}),t}function _O(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=ki(r,t,{version:Ne,cellDeps:zn(Yn(vO)),headerDeps:zn(Ne),inputs:zn(Yn(u8)),outputs:zn(Yn(l8)),outputsData:zn(Ne),witnesses:zn(Ne)}),e&&Ui.ValidateTransaction(t,{debugPath:`(transformed) ${r}`}),t}function ej(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=ki(r,t,{version:Ne,compactTarget:Ne,timestamp:Ne,number:Ne,epoch:Ne,parentHash:Ne,transactionsRoot:Ne,proposalsHash:Ne,extraHash:Ne,dao:Ne}),e&&Ui.ValidateRawHeader(t,{debugPath:`(transformed) ${r}`}),t}function d8(t,{validation:e=!0,debugPath:r="header"}={}){return t=ki(r,t,{version:Ne,compactTarget:Ne,timestamp:Ne,number:Ne,epoch:Ne,parentHash:Ne,transactionsRoot:Ne,proposalsHash:Ne,extraHash:Ne,dao:Ne,nonce:Ne}),e&&Ui.ValidateHeader(t,{debugPath:`(transformed) ${r}`}),t}function mO(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=ki(r,t,{header:Yn(d8),proposals:zn(Ne)}),e&&Ui.ValidateUncleBlock(t,{debugPath:`(transformed) ${r}`}),t}function tj(t,{validation:e=!0,debugPath:r="block"}={}){return t=ki(r,t,{header:Yn(d8),uncles:zn(Yn(mO)),transactions:zn(Yn(_O)),proposals:zn(Ne)}),e&&Ui.ValidateBlock(t,{debugPath:`(transformed) ${r}`}),t}function rj(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=ki(r,t,{lock:Yn(sy),message:Ne}),e&&Ui.ValidateCellbaseWitness(t,{debugPath:`(transformed) ${r}`}),t}function nj(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=ki(r,t,{lock:Ne,inputType:Ne,outputType:Ne}),e&&Ui.ValidateWitnessArgs(t,{debugPath:`(transformed) ${r}`}),t}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Reader",{enumerable:!0,get:function(){return e.Reader}}),t.validators=t.transformers=t.normalizers=t.VERSION=void 0;var e=g1,r=s(Jn);t.normalizers=r;var n=s(hi);t.transformers=n;var i=s(Mn);t.validators=i;function a(o){if(typeof WeakMap!="function")return null;var f=new WeakMap,c=new WeakMap;return(a=function(u){return u?c:f})(o)}function s(o,f){if(o&&o.__esModule)return o;if(o===null||typeof o!="object"&&typeof o!="function")return{default:o};var c=a(f);if(c&&c.has(o))return c.get(o);var u={__proto__:null},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in o)if(p!=="default"&&{}.hasOwnProperty.call(o,p)){var y=l?Object.getOwnPropertyDescriptor(o,p):null;y&&(y.get||y.set)?Object.defineProperty(u,p,y):u[p]=o[p]}return u.default=o,c&&c.set(o,u),u}t.VERSION="__development_build__"})(n8);Object.defineProperty(Xf,"__esModule",{value:!0});Xf.default=Xf.TransactionCollector=Xf.Indexer=void 0;var Nb=n8,K9=St,Q9=b1;class ij{}Xf.Indexer=ij;class wO{constructor(e,{lock:r,type:n,argsLen:i=-1,fromBlock:a,toBlock:s,order:o="asc",skip:f}={},{skipMissing:c=!1,includeStatus:u=!0}={}){if(!r&&(!n||n==="empty"))throw new Error("Either lock or type script must be provided!");if(r&&!(0,Q9.isScriptWrapper)(r)?(Nb.validators.ValidateScript(r),this.lock={script:r,ioType:"both",argsLen:i}):r&&r.script&&(Nb.validators.ValidateScript(r.script),this.lock=r,r.argsLen||(this.lock.argsLen=i),r.ioType||(this.lock.ioType="both")),n==="empty"?this.type=n:n&&!(0,Q9.isScriptWrapper)(n)?(Nb.validators.ValidateScript(n),this.type={script:n,ioType:"both",argsLen:i}):n&&n.script&&(Nb.validators.ValidateScript(n.script),this.type=n,n.argsLen||(this.type.argsLen=i),n.ioType||(this.type.ioType="both")),a&&(0,K9.assertHexadecimal)("fromBlock",a),s&&(0,K9.assertHexadecimal)("toBlock",s),o!=="asc"&&o!=="desc")throw new Error("Order must be either asc or desc!");this.indexer=e,this.skipMissing=c,this.includeStatus=u,this.fromBlock=a,this.toBlock=s,this.order=o,this.skip=f,this.rpc=e.rpc}async getTransactionHashes(){throw new Error("Not implement!")}async count(){return(await this.getTransactionHashes()).length}async*collect(){const e=await this.getTransactionHashes();for(const r of e){const n=await this.rpc.get_transaction(r);if(!this.skipMissing&&!n)throw new Error(`Transaction ${r} is missing!`);this.includeStatus?yield n:yield n.transaction}}}Xf.TransactionCollector=wO;const aj={TransactionCollector:wO};Xf.default=aj;var f2={};Object.defineProperty(f2,"__esModule",{value:!0});f2.defaultLogger=AO;f2.deprecated=sj;function AO(t,e){const r=`[${t}] ${e}`;if(t==="error"||t==="warn")return console.warn(r);console.log(`[${t}] ${e}`)}function sj(t){AO("deprecated",t)}var EO={};Object.defineProperty(EO,"__esModule",{value:!0});var xO={};Object.defineProperty(xO,"__esModule",{value:!0});(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e={values:!0,utils:!0,since:!0,helpers:!0,indexer:!0,logger:!0,blockchain:!0};t.values=t.utils=t.since=t.logger=t.indexer=t.helpers=t.blockchain=void 0;var r=p(Wa);t.values=r;var n=p(St);t.utils=n;var i=p(Pi);t.since=i;var a=p(b1);t.helpers=a;var s=p(Xf);t.indexer=s,Object.keys(s).forEach(function(y){y==="default"||y==="__esModule"||Object.prototype.hasOwnProperty.call(e,y)||y in t&&t[y]===s[y]||Object.defineProperty(t,y,{enumerable:!0,get:function(){return s[y]}})});var o=p(f2);t.logger=o;var f=p(Ee);t.blockchain=f;var c=EO;Object.keys(c).forEach(function(y){y==="default"||y==="__esModule"||Object.prototype.hasOwnProperty.call(e,y)||y in t&&t[y]===c[y]||Object.defineProperty(t,y,{enumerable:!0,get:function(){return c[y]}})});var u=xO;Object.keys(u).forEach(function(y){y==="default"||y==="__esModule"||Object.prototype.hasOwnProperty.call(e,y)||y in t&&t[y]===u[y]||Object.defineProperty(t,y,{enumerable:!0,get:function(){return u[y]}})});function l(y){if(typeof WeakMap!="function")return null;var m=new WeakMap,A=new WeakMap;return(l=function(S){return S?A:m})(y)}function p(y,m){if(y&&y.__esModule)return y;if(y===null||typeof y!="object"&&typeof y!="function")return{default:y};var A=l(m);if(A&&A.has(y))return A.get(y);var S={__proto__:null},w=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var C in y)if(C!=="default"&&{}.hasOwnProperty.call(y,C)){var O=w?Object.getOwnPropertyDescriptor(y,C):null;O&&(O.get||O.set)?Object.defineProperty(S,C,O):S[C]=y[C]}return S.default=y,A&&A.set(y,S),S}})(Ir);var sc={};Object.defineProperty(sc,"__esModule",{value:!0});var Tp=sc.bech32m=wu=sc.bech32=void 0;const oy="qpzry9x8gf2tvdw0s3jn54khce6mua7l",SO={};for(let t=0;t>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function Y9(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=zl(e)^n>>5}e=zl(e);for(let r=0;r=r;)a-=r,o.push(i>>a&s);if(n)a>0&&o.push(i<=e)return"Excess padding";if(i<f)throw new TypeError("Exceeds length limit");s=s.toLowerCase();let c=Y9(s);if(typeof c=="string")throw new Error(c);let u=s+"1";for(let l=0;l>5)throw new Error("Non 5-bit word");c=zl(c)^p,u+=oy.charAt(p)}for(let l=0;l<6;++l)c=zl(c);c^=e;for(let l=0;l<6;++l){const p=c>>(5-l)*5&31;u+=oy.charAt(p)}return u}function n(s,o){if(o=o||90,s.length<8)return s+" too short";if(s.length>o)return"Exceeds length limit";const f=s.toLowerCase(),c=s.toUpperCase();if(s!==f&&s!==c)return"Mixed-case string "+s;s=f;const u=s.lastIndexOf("1");if(u===-1)return"No separator character for "+s;if(u===0)return"Missing prefix for "+s;const l=s.slice(0,u),p=s.slice(u+1);if(p.length<6)return"Data too short";let y=Y9(l);if(typeof y=="string")return y;const m=[];for(let A=0;A=p.length)&&m.push(w)}return y!==e?"Invalid checksum for "+s:{prefix:l,words:m}}function i(s,o){const f=n(s,o);if(typeof f=="object")return f}function a(s,o){const f=n(s,o);if(typeof f=="object")return f;throw new Error(f)}return{decodeUnsafe:i,decode:a,encode:r,toWords:oj,fromWordsUnsafe:fj,fromWords:cj}}var wu=sc.bech32=IO("bech32");Tp=sc.bech32m=IO("bech32m");var v1="delete",Ct=5,ha=1<>>0;if(""+r!==e||r===4294967295)return NaN;e=r}return e<0?md(t)+e:e}function CO(){return!0}function _1(t,e,r){return(t===0&&!OO(t)||r!==void 0&&t<=-r)&&(e===void 0||r!==void 0&&e>=r)}function i0(t,e){return TO(t,e,0)}function m1(t,e){return TO(t,e,e)}function TO(t,e,r){return t===void 0?r:OO(t)?e===1/0?e:Math.max(0,e+t)|0:e===void 0||e===t?t:Math.min(e,t)|0}function OO(t){return t<0||t===0&&1/t===-1/0}var BO="@@__IMMUTABLE_ITERABLE__@@";function Tn(t){return!!(t&&t[BO])}var DO="@@__IMMUTABLE_KEYED__@@";function gt(t){return!!(t&&t[DO])}var MO="@@__IMMUTABLE_INDEXED__@@";function tn(t){return!!(t&&t[MO])}function a0(t){return gt(t)||tn(t)}var Ot=function(e){return Tn(e)?e:On(e)},Oa=function(t){function e(r){return gt(r)?r:_c(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ot),Nu=function(t){function e(r){return tn(r)?r:Ba(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ot),s0=function(t){function e(r){return Tn(r)&&!a0(r)?r:c0(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ot);Ot.Keyed=Oa;Ot.Indexed=Nu;Ot.Set=s0;var RO="@@__IMMUTABLE_SEQ__@@";function w1(t){return!!(t&&t[RO])}var LO="@@__IMMUTABLE_RECORD__@@";function vc(t){return!!(t&&t[LO])}function zi(t){return Tn(t)||vc(t)}var o0="@@__IMMUTABLE_ORDERED__@@";function Ri(t){return!!(t&&t[o0])}var A1=0,ss=1,wa=2,Y3=typeof Symbol=="function"&&Symbol.iterator,HO="@@iterator",c2=Y3||HO,tt=function(e){this.next=e};tt.prototype.toString=function(){return"[Iterator]"};tt.KEYS=A1;tt.VALUES=ss;tt.ENTRIES=wa;tt.prototype.inspect=tt.prototype.toSource=function(){return this.toString()};tt.prototype[c2]=function(){return this};function Bt(t,e,r,n){var i=t===0?e:t===1?r:[e,r];return n?n.value=i:n={value:i,done:!1},n}function Wn(){return{value:void 0,done:!0}}function b8(t){return Array.isArray(t)?!0:!!u2(t)}function V9(t){return t&&typeof t.next=="function"}function V3(t){var e=u2(t);return e&&e.call(t)}function u2(t){var e=t&&(Y3&&t[Y3]||t[HO]);if(typeof e=="function")return e}function uj(t){var e=u2(t);return e&&e===t.entries}function lj(t){var e=u2(t);return e&&e===t.keys}var f0=Object.prototype.hasOwnProperty;function g8(t){return Array.isArray(t)||typeof t=="string"?!0:t&&typeof t=="object"&&Number.isInteger(t.length)&&t.length>=0&&(t.length===0?Object.keys(t).length===1:t.hasOwnProperty(t.length-1))}var On=function(t){function e(r){return r==null?v8():zi(r)?r.toSeq():hj(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq {","}")},e.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},e.prototype.__iterate=function(n,i){var a=this._cache;if(a){for(var s=a.length,o=0;o!==s;){var f=a[i?s-++o:o++];if(n(f[1],f[0],this)===!1)break}return o}return this.__iterateUncached(n,i)},e.prototype.__iterator=function(n,i){var a=this._cache;if(a){var s=a.length,o=0;return new tt(function(){if(o===s)return Wn();var f=a[i?s-++o:o++];return Bt(n,f[0],f[1])})}return this.__iteratorUncached(n,i)},e}(Ot),_c=function(t){function e(r){return r==null?v8().toKeyedSeq():Tn(r)?gt(r)?r.toSeq():r.fromEntrySeq():vc(r)?r.toSeq():_8(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toKeyedSeq=function(){return this},e}(On),Ba=function(t){function e(r){return r==null?v8():Tn(r)?gt(r)?r.entrySeq():r.toIndexedSeq():vc(r)?r.toSeq().entrySeq():PO(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toIndexedSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq [","]")},e}(On),c0=function(t){function e(r){return(Tn(r)&&!a0(r)?r:Ba(r)).toSetSeq()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toSetSeq=function(){return this},e}(On);On.isSeq=w1;On.Keyed=_c;On.Set=c0;On.Indexed=Ba;On.prototype[RO]=!0;var Au=function(t){function e(r){this._array=r,this.size=r.length}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n,i){return this.has(n)?this._array[oc(this,n)]:i},e.prototype.__iterate=function(n,i){for(var a=this._array,s=a.length,o=0;o!==s;){var f=i?s-++o:o++;if(n(a[f],f,this)===!1)break}return o},e.prototype.__iterator=function(n,i){var a=this._array,s=a.length,o=0;return new tt(function(){if(o===s)return Wn();var f=i?s-++o:o++;return Bt(n,f,a[f])})},e}(Ba),y8=function(t){function e(r){var n=Object.keys(r).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(r):[]);this._object=r,this._keys=n,this.size=n.length}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n,i){return i!==void 0&&!this.has(n)?i:this._object[n]},e.prototype.has=function(n){return f0.call(this._object,n)},e.prototype.__iterate=function(n,i){for(var a=this._object,s=this._keys,o=s.length,f=0;f!==o;){var c=s[i?o-++f:f++];if(n(a[c],c,this)===!1)break}return f},e.prototype.__iterator=function(n,i){var a=this._object,s=this._keys,o=s.length,f=0;return new tt(function(){if(f===o)return Wn();var c=s[i?o-++f:f++];return Bt(n,c,a[c])})},e}(_c);y8.prototype[o0]=!0;var dj=function(t){function e(r){this._collection=r,this.size=r.length||r.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__iterateUncached=function(n,i){if(i)return this.cacheResult().__iterate(n,i);var a=this._collection,s=V3(a),o=0;if(V9(s))for(var f;!(f=s.next()).done&&n(f.value,o++,this)!==!1;);return o},e.prototype.__iteratorUncached=function(n,i){if(i)return this.cacheResult().__iterator(n,i);var a=this._collection,s=V3(a);if(!V9(s))return new tt(Wn);var o=0;return new tt(function(){var f=s.next();return f.done?f:Bt(n,o++,f.value)})},e}(Ba),G9;function v8(){return G9||(G9=new Au([]))}function _8(t){var e=m8(t);if(e)return e.fromEntrySeq();if(typeof t=="object")return new y8(t);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+t)}function PO(t){var e=m8(t);if(e)return e;throw new TypeError("Expected Array or collection object of values: "+t)}function hj(t){var e=m8(t);if(e)return uj(t)?e.fromEntrySeq():lj(t)?e.toSetSeq():e;if(typeof t=="object")return new y8(t);throw new TypeError("Expected Array or collection object of values, or keyed object: "+t)}function m8(t){return g8(t)?new Au(t):b8(t)?new dj(t):void 0}var NO="@@__IMMUTABLE_MAP__@@";function E1(t){return!!(t&&t[NO])}function l2(t){return E1(t)&&Ri(t)}function fy(t){return!!(t&&typeof t.equals=="function"&&typeof t.hashCode=="function")}function xr(t,e){if(t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1;if(typeof t.valueOf=="function"&&typeof e.valueOf=="function"){if(t=t.valueOf(),e=e.valueOf(),t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1}return!!(fy(t)&&fy(e)&&t.equals(e))}var rh=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(e,r){e|=0,r|=0;var n=e&65535,i=r&65535;return n*i+((e>>>16)*i+n*(r>>>16)<<16>>>0)|0};function d2(t){return t>>>1&1073741824|t&3221225471}var pj=Object.prototype.valueOf;function $n(t){if(t==null)return W9(t);if(typeof t.hashCode=="function")return d2(t.hashCode(t));var e=mj(t);if(e==null)return W9(e);switch(typeof e){case"boolean":return e?1108378657:1108378656;case"number":return bj(e);case"string":return e.length>wj?gj(e):G3(e);case"object":case"function":return vj(e);case"symbol":return yj(e);default:if(typeof e.toString=="function")return G3(e.toString());throw new Error("Value type "+typeof e+" cannot be hashed.")}}function W9(t){return t===null?1108378658:1108378659}function bj(t){if(t!==t||t===1/0)return 0;var e=t|0;for(e!==t&&(e^=t*4294967295);t>4294967295;)t/=4294967295,e^=t;return d2(e)}function gj(t){var e=C_[t];return e===void 0&&(e=G3(t),I_===Aj&&(I_=0,C_={}),I_++,C_[t]=e),e}function G3(t){for(var e=0,r=0;r0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function mj(t){return t.valueOf!==pj&&typeof t.valueOf=="function"?t.valueOf(t):t}function UO(){var t=++S_;return S_&1073741824&&(S_=0),t}var W3=typeof WeakMap=="function",X3;W3&&(X3=new WeakMap);var J9=Object.create(null),S_=0,Nc="__immutablehash__";typeof Symbol=="function"&&(Nc=Symbol(Nc));var wj=16,Aj=255,I_=0,C_={},h2=function(t){function e(r,n){this._iter=r,this._useKeys=n,this.size=r.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n,i){return this._iter.get(n,i)},e.prototype.has=function(n){return this._iter.has(n)},e.prototype.valueSeq=function(){return this._iter.valueSeq()},e.prototype.reverse=function(){var n=this,i=w8(this,!0);return this._useKeys||(i.valueSeq=function(){return n._iter.toSeq().reverse()}),i},e.prototype.map=function(n,i){var a=this,s=FO(this,n,i);return this._useKeys||(s.valueSeq=function(){return a._iter.toSeq().map(n,i)}),s},e.prototype.__iterate=function(n,i){var a=this;return this._iter.__iterate(function(s,o){return n(s,o,a)},i)},e.prototype.__iterator=function(n,i){return this._iter.__iterator(n,i)},e}(_c);h2.prototype[o0]=!0;var kO=function(t){function e(r){this._iter=r,this.size=r.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.includes=function(n){return this._iter.includes(n)},e.prototype.__iterate=function(n,i){var a=this,s=0;return i&&md(this),this._iter.__iterate(function(o){return n(o,i?a.size-++s:s++,a)},i)},e.prototype.__iterator=function(n,i){var a=this,s=this._iter.__iterator(ss,i),o=0;return i&&md(this),new tt(function(){var f=s.next();return f.done?f:Bt(n,i?a.size-++o:o++,f.value,f)})},e}(Ba),zO=function(t){function e(r){this._iter=r,this.size=r.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.has=function(n){return this._iter.includes(n)},e.prototype.__iterate=function(n,i){var a=this;return this._iter.__iterate(function(s){return n(s,s,a)},i)},e.prototype.__iterator=function(n,i){var a=this._iter.__iterator(ss,i);return new tt(function(){var s=a.next();return s.done?s:Bt(n,s.value,s.value,s)})},e}(c0),$O=function(t){function e(r){this._iter=r,this.size=r.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.entrySeq=function(){return this._iter.toSeq()},e.prototype.__iterate=function(n,i){var a=this;return this._iter.__iterate(function(s){if(s){tA(s);var o=Tn(s);return n(o?s.get(1):s[1],o?s.get(0):s[0],a)}},i)},e.prototype.__iterator=function(n,i){var a=this._iter.__iterator(ss,i);return new tt(function(){for(;;){var s=a.next();if(s.done)return s;var o=s.value;if(o){tA(o);var f=Tn(o);return Bt(n,f?o.get(0):o[0],f?o.get(1):o[1],s)}}})},e}(_c);kO.prototype.cacheResult=h2.prototype.cacheResult=zO.prototype.cacheResult=$O.prototype.cacheResult=x8;function jO(t){var e=Gs(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){var r=t.reverse.apply(this);return r.flip=function(){return t.reverse()},r},e.has=function(r){return t.includes(r)},e.includes=function(r){return t.has(r)},e.cacheResult=x8,e.__iterateUncached=function(r,n){var i=this;return t.__iterate(function(a,s){return r(s,a,i)!==!1},n)},e.__iteratorUncached=function(r,n){if(r===wa){var i=t.__iterator(r,n);return new tt(function(){var a=i.next();if(!a.done){var s=a.value[0];a.value[0]=a.value[1],a.value[1]=s}return a})}return t.__iterator(r===ss?A1:ss,n)},e}function FO(t,e,r){var n=Gs(t);return n.size=t.size,n.has=function(i){return t.has(i)},n.get=function(i,a){var s=t.get(i,Ge);return s===Ge?a:e.call(r,s,i,t)},n.__iterateUncached=function(i,a){var s=this;return t.__iterate(function(o,f,c){return i(e.call(r,o,f,c),f,s)!==!1},a)},n.__iteratorUncached=function(i,a){var s=t.__iterator(wa,a);return new tt(function(){var o=s.next();if(o.done)return o;var f=o.value,c=f[0];return Bt(i,c,e.call(r,f[1],c,t),o)})},n}function w8(t,e){var r=this,n=Gs(t);return n._iter=t,n.size=t.size,n.reverse=function(){return t},t.flip&&(n.flip=function(){var i=jO(t);return i.reverse=function(){return t.flip()},i}),n.get=function(i,a){return t.get(e?i:-1-i,a)},n.has=function(i){return t.has(e?i:-1-i)},n.includes=function(i){return t.includes(i)},n.cacheResult=x8,n.__iterate=function(i,a){var s=this,o=0;return a&&md(t),t.__iterate(function(f,c){return i(f,e?c:a?s.size-++o:o++,s)},!a)},n.__iterator=function(i,a){var s=0;a&&md(t);var o=t.__iterator(wa,!a);return new tt(function(){var f=o.next();if(f.done)return f;var c=f.value;return Bt(i,e?c[0]:a?r.size-++s:s++,c[1],f)})},n}function qO(t,e,r,n){var i=Gs(t);return n&&(i.has=function(a){var s=t.get(a,Ge);return s!==Ge&&!!e.call(r,s,a,t)},i.get=function(a,s){var o=t.get(a,Ge);return o!==Ge&&e.call(r,o,a,t)?o:s}),i.__iterateUncached=function(a,s){var o=this,f=0;return t.__iterate(function(c,u,l){if(e.call(r,c,u,l))return f++,a(c,n?u:f-1,o)},s),f},i.__iteratorUncached=function(a,s){var o=t.__iterator(wa,s),f=0;return new tt(function(){for(;;){var c=o.next();if(c.done)return c;var u=c.value,l=u[0],p=u[1];if(e.call(r,p,l,t))return Bt(a,n?l:f++,p,c)}})},i}function Ej(t,e,r){var n=Zo().asMutable();return t.__iterate(function(i,a){n.update(e.call(r,i,a,t),0,function(s){return s+1})}),n.asImmutable()}function xj(t,e,r){var n=gt(t),i=(Ri(t)?os():Zo()).asMutable();t.__iterate(function(s,o){i.update(e.call(r,s,o,t),function(f){return f=f||[],f.push(n?[o,s]:s),f})});var a=E8(t);return i.map(function(s){return ht(t,a(s))}).asImmutable()}function Sj(t,e,r){var n=gt(t),i=[[],[]];t.__iterate(function(s,o){i[e.call(r,s,o,t)?1:0].push(n?[o,s]:s)});var a=E8(t);return i.map(function(s){return ht(t,a(s))})}function A8(t,e,r,n){var i=t.size;if(_1(e,r,i))return t;if(typeof i>"u"&&(e<0||r<0))return A8(t.toSeq().cacheResult(),e,r,n);var a=i0(e,i),s=m1(r,i),o=s-a,f;o===o&&(f=o<0?0:o);var c=Gs(t);return c.size=f===0?f:t.size&&f||void 0,!n&&w1(t)&&f>=0&&(c.get=function(u,l){return u=oc(this,u),u>=0&&uf)return Wn();var A=p.next();return n||u===ss||A.done?A:u===A1?Bt(u,m-1,void 0,A):Bt(u,m-1,A.value[1],A)})},c}function Ij(t,e,r){var n=Gs(t);return n.__iterateUncached=function(i,a){var s=this;if(a)return this.cacheResult().__iterate(i,a);var o=0;return t.__iterate(function(f,c,u){return e.call(r,f,c,u)&&++o&&i(f,c,s)}),o},n.__iteratorUncached=function(i,a){var s=this;if(a)return this.cacheResult().__iterator(i,a);var o=t.__iterator(wa,a),f=!0;return new tt(function(){if(!f)return Wn();var c=o.next();if(c.done)return c;var u=c.value,l=u[0],p=u[1];return e.call(r,p,l,s)?i===wa?c:Bt(i,l,p,c):(f=!1,Wn())})},n}function KO(t,e,r,n){var i=Gs(t);return i.__iterateUncached=function(a,s){var o=this;if(s)return this.cacheResult().__iterate(a,s);var f=!0,c=0;return t.__iterate(function(u,l,p){if(!(f&&(f=e.call(r,u,l,p))))return c++,a(u,n?l:c-1,o)}),c},i.__iteratorUncached=function(a,s){var o=this;if(s)return this.cacheResult().__iterator(a,s);var f=t.__iterator(wa,s),c=!0,u=0;return new tt(function(){var l,p,y;do{if(l=f.next(),l.done)return n||a===ss?l:a===A1?Bt(a,u++,void 0,l):Bt(a,u++,l.value[1],l);var m=l.value;p=m[0],y=m[1],c&&(c=e.call(r,y,p,o))}while(c);return a===wa?l:Bt(a,p,y,l)})},i}function Cj(t,e){var r=gt(t),n=[t].concat(e).map(function(s){return Tn(s)?r&&(s=Oa(s)):s=r?_8(s):PO(Array.isArray(s)?s:[s]),s}).filter(function(s){return s.size!==0});if(n.length===0)return t;if(n.length===1){var i=n[0];if(i===t||r&>(i)||tn(t)&&tn(i))return i}var a=new Au(n);return r?a=a.toKeyedSeq():tn(t)||(a=a.toSetSeq()),a=a.flatten(!0),a.size=n.reduce(function(s,o){if(s!==void 0){var f=o.size;if(f!==void 0)return s+f}},0),a}function QO(t,e,r){var n=Gs(t);return n.__iterateUncached=function(i,a){if(a)return this.cacheResult().__iterate(i,a);var s=0,o=!1;function f(c,u){c.__iterate(function(l,p){return(!e||u0}function kb(t,e,r,n){var i=Gs(t),a=new Au(r).map(function(s){return s.size});return i.size=n?a.max():a.min(),i.__iterate=function(s,o){for(var f=this.__iterator(ss,o),c,u=0;!(c=f.next()).done&&s(c.value,u++,this)!==!1;);return u},i.__iteratorUncached=function(s,o){var f=r.map(function(l){return l=Ot(l),V3(o?l.reverse():l)}),c=0,u=!1;return new tt(function(){var l;return u||(l=f.map(function(p){return p.next()}),u=n?l.every(function(p){return p.done}):l.some(function(p){return p.done})),u?Wn():Bt(s,c++,e.apply(null,l.map(function(p){return p.value})))})},i}function ht(t,e){return t===e?t:w1(t)?e:t.constructor(e)}function tA(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function E8(t){return gt(t)?Oa:tn(t)?Nu:s0}function Gs(t){return Object.create((gt(t)?_c:tn(t)?Ba:c0).prototype)}function x8(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):On.prototype.cacheResult.call(this)}function YO(t,e){return t===void 0&&e===void 0?0:t===void 0?1:e===void 0?-1:t>e?1:t0;)e[r]=arguments[r+1];if(typeof t!="function")throw new TypeError("Invalid merger function: "+t);return ZO(this,e,t)}function ZO(t,e,r){for(var n=[],i=0;i0;)e[r]=arguments[r+1];return S1(t,e)}function eB(t,e){for(var r=[],n=arguments.length-2;n-- >0;)r[n]=arguments[n+2];return S1(e,r,t)}function tB(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];return x1(t,e)}function rB(t,e){for(var r=[],n=arguments.length-2;n-- >0;)r[n]=arguments[n+2];return x1(e,r,t)}function x1(t,e,r){return S1(t,e,Dj(r))}function S1(t,e,r){if(!fc(t))throw new TypeError("Cannot merge into non-data-structure value: "+t);if(zi(t))return typeof r=="function"&&t.mergeWith?t.mergeWith.apply(t,[r].concat(e)):t.merge?t.merge.apply(t,e):t.concat.apply(t,e);for(var n=Array.isArray(t),i=t,a=n?Nu:Oa,s=n?function(f){i===t&&(i=cy(i)),i.push(f)}:function(f,c){var u=f0.call(i,c),l=u&&r?r(i[c],f,c):f;(!u||l!==i[c])&&(i===t&&(i=cy(i)),i[c]=l)},o=0;o0;)e[r]=arguments[r+1];return x1(this,e,t)}function H8(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];return mc(this,t,Ya(),function(n){return S1(n,e)})}function P8(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];return mc(this,t,Ya(),function(n){return x1(n,e)})}function I1(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this}function C1(){return this.__ownerID?this:this.__ensureOwner(new p8)}function T1(){return this.__ensureOwner()}function N8(){return this.__altered}var Zo=function(t){function e(r){return r==null?Ya():E1(r)&&!Ri(r)?r:Ya().withMutations(function(n){var i=t(r);Ii(i.size),i.forEach(function(a,s){return n.set(s,a)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return Ya().withMutations(function(a){for(var s=0;s=n.length)throw new Error("Missing value for key: "+n[s]);a.set(n[s],n[s+1])}})},e.prototype.toString=function(){return this.__toString("Map {","}")},e.prototype.get=function(n,i){return this._root?this._root.get(0,void 0,n,i):i},e.prototype.set=function(n,i){return iA(this,n,i)},e.prototype.remove=function(n){return iA(this,n,Ge)},e.prototype.deleteAll=function(n){var i=Ot(n);return i.size===0?this:this.withMutations(function(a){i.forEach(function(s){return a.remove(s)})})},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Ya()},e.prototype.sort=function(n){return os(wd(this,n))},e.prototype.sortBy=function(n,i){return os(wd(this,i,n))},e.prototype.map=function(n,i){var a=this;return this.withMutations(function(s){s.forEach(function(o,f){s.set(f,n.call(i,o,f,a))})})},e.prototype.__iterator=function(n,i){return new Rj(this,n,i)},e.prototype.__iterate=function(n,i){var a=this,s=0;return this._root&&this._root.iterate(function(o){return s++,n(o[1],o[0],a)},i),s},e.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?U8(this.size,this._root,n,this.__hash):this.size===0?Ya():(this.__ownerID=n,this.__altered=!1,this)},e}(Oa);Zo.isMap=E1;var Mt=Zo.prototype;Mt[NO]=!0;Mt[v1]=Mt.remove;Mt.removeAll=Mt.deleteAll;Mt.setIn=B8;Mt.removeIn=Mt.deleteIn=M8;Mt.update=R8;Mt.updateIn=L8;Mt.merge=Mt.concat=WO;Mt.mergeWith=XO;Mt.mergeDeep=nB;Mt.mergeDeepWith=iB;Mt.mergeIn=H8;Mt.mergeDeepIn=P8;Mt.withMutations=I1;Mt.wasAltered=N8;Mt.asImmutable=T1;Mt["@@transducer/init"]=Mt.asMutable=C1;Mt["@@transducer/step"]=function(t,e){return t.set(e[0],e[1])};Mt["@@transducer/result"]=function(t){return t.asImmutable()};var Bp=function(e,r){this.ownerID=e,this.entries=r};Bp.prototype.get=function(e,r,n,i){for(var a=this.entries,s=0,o=a.length;s=kj)return Lj(e,c,i,a);var y=e&&e===this.ownerID,m=y?c:Cs(c);return p?f?u===l-1?m.pop():m[u]=m.pop():m[u]=[i,a]:m.push([i,a]),y?(this.entries=m,this):new Bp(e,m)}};var Ad=function(e,r,n){this.ownerID=e,this.bitmap=r,this.nodes=n};Ad.prototype.get=function(e,r,n,i){r===void 0&&(r=$n(n));var a=1<<((e===0?r:r>>>e)&Kn),s=this.bitmap;return s&a?this.nodes[aB(s&a-1)].get(e+Ct,r,n,i):i};Ad.prototype.update=function(e,r,n,i,a,s,o){n===void 0&&(n=$n(i));var f=(r===0?n:n>>>r)&Kn,c=1<=zj)return Pj(e,y,u,f,A);if(l&&!A&&y.length===2&&aA(y[p^1]))return y[p^1];if(l&&A&&y.length===1&&aA(A))return A;var S=e&&e===this.ownerID,w=l?A?u:u^c:u|c,C=l?A?sB(y,p,A,S):Uj(y,p,S):Nj(y,p,A,S);return S?(this.bitmap=w,this.nodes=C,this):new Ad(e,w,C)};var Dp=function(e,r,n){this.ownerID=e,this.count=r,this.nodes=n};Dp.prototype.get=function(e,r,n,i){r===void 0&&(r=$n(n));var a=(e===0?r:r>>>e)&Kn,s=this.nodes[a];return s?s.get(e+Ct,r,n,i):i};Dp.prototype.update=function(e,r,n,i,a,s,o){n===void 0&&(n=$n(i));var f=(r===0?n:n>>>r)&Kn,c=a===Ge,u=this.nodes,l=u[f];if(c&&!l)return this;var p=k8(l,e,r+Ct,n,i,a,s,o);if(p===l)return this;var y=this.count;if(!l)y++;else if(!p&&(y--,y<$j))return Hj(e,u,y,f);var m=e&&e===this.ownerID,A=sB(u,f,p,m);return m?(this.count=y,this.nodes=A,this):new Dp(e,y,A)};var Ed=function(e,r,n){this.ownerID=e,this.keyHash=r,this.entries=n};Ed.prototype.get=function(e,r,n,i){for(var a=this.entries,s=0,o=a.length;s>>r)&Kn,s=(r===0?n:n>>>r)&Kn,o,f=a===s?[z8(t,e,r+Ct,n,i)]:(o=new jo(e,n,i),a>>=1)s[o]=r&1?e[a++]:void 0;return s[n]=i,new Dp(t,a+1,s)}function aB(t){return t-=t>>1&1431655765,t=(t&858993459)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,t&127}function sB(t,e,r,n){var i=n?t:Cs(t);return i[e]=r,i}function Nj(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var a=new Array(i),s=0,o=0;o0&&a=0&&n>>r&Kn;if(i>=this.array.length)return new Zf([],e);var a=i===0,s;if(r>0){var o=this.array[i];if(s=o&&o.removeBefore(e,r-Ct,n),s===o&&a)return this}if(a&&!s)return this;var f=xd(this,e);if(!a)for(var c=0;c>>r&Kn;if(i>=this.array.length)return this;var a;if(r>0){var s=this.array[i];if(a=s&&s.removeAfter(e,r-Ct,n),a===s&&i===this.array.length-1)return this}var o=xd(this,e);return o.array.splice(i+1),a&&(o.array[i]=a),o};var Jh={};function sA(t,e){var r=t._origin,n=t._capacity,i=Rp(n),a=t._tail;return s(t._root,t._level,0);function s(c,u,l){return u===0?o(c,l):f(c,u,l)}function o(c,u){var l=u===i?a&&a.array:c&&c.array,p=u>r?0:r-u,y=n-u;return y>ha&&(y=ha),function(){if(p===y)return Jh;var m=e?--y:p++;return l&&l[m]}}function f(c,u,l){var p,y=c&&c.array,m=l>r?0:r-l>>u,A=(n-l>>u)+1;return A>ha&&(A=ha),function(){for(;;){if(p){var S=p();if(S!==Jh)return S;p=null}if(m===A)return Jh;var w=e?--A:m++;p=s(y&&y[w],u-Ct,l+(w<=t.size||e<0)return t.withMutations(function(s){e<0?Ef(s,e).set(0,r):Ef(s,0,e+1).set(e,r)});e+=t._origin;var n=t._tail,i=t._root,a=Q3();return e>=Rp(t._capacity)?n=Z3(n,t.__ownerID,0,e,r,a):i=Z3(i,t.__ownerID,t._level,e,r,a),a.value?t.__ownerID?(t._root=i,t._tail=n,t.__hash=void 0,t.__altered=!0,t):Mp(t._origin,t._capacity,t._level,i,n):t}function Z3(t,e,r,n,i,a){var s=n>>>r&Kn,o=t&&s0){var c=t&&t.array[s],u=Z3(c,e,r-Ct,n,i,a);return u===c?t:(f=xd(t,e),f.array[s]=u,f)}return o&&t.array[s]===i?t:(a&&pa(a),f=xd(t,e),i===void 0&&s===f.array.length-1?f.array.pop():f.array[s]=i,f)}function xd(t,e){return e&&t&&e===t.ownerID?t:new Zf(t?t.array.slice():[],e)}function fB(t,e){if(e>=Rp(t._capacity))return t._tail;if(e<1<0;)r=r.array[e>>>n&Kn],n-=Ct;return r}}function Ef(t,e,r){e!==void 0&&(e|=0),r!==void 0&&(r|=0);var n=t.__ownerID||new p8,i=t._origin,a=t._capacity,s=i+e,o=r===void 0?a:r<0?a+r:i+r;if(s===i&&o===a)return t;if(s>=o)return t.clear();for(var f=t._level,c=t._root,u=0;s+u<0;)c=new Zf(c&&c.array.length?[void 0,c]:[],n),f+=Ct,u+=1<=1<l?new Zf([],n):y;if(y&&p>l&&sCt;S-=Ct){var w=l>>>S&Kn;A=A.array[w]=xd(A.array[w],n)}A.array[l>>>Ct&Kn]=y}if(o=p)s-=p,o-=p,f=Ct,c=null,m=m&&m.removeBefore(n,0,s);else if(s>i||p>>f&Kn;if(C!==p>>>f&Kn)break;C&&(u+=(1<i&&(c=c.removeBefore(n,f,s-u)),c&&p>>Ct<=ha&&i.size>=n.size*2?(f=i.filter(function(c,u){return c!==void 0&&a!==u}),o=f.toKeyedSeq().map(function(c){return c[0]}).flip().toMap(),t.__ownerID&&(o.__ownerID=f.__ownerID=t.__ownerID)):(o=n.remove(e),f=a===i.size-1?i.pop():i.set(a,void 0))}else if(s){if(r===i.get(a)[1])return t;o=n,f=i.set(a,[e,r])}else o=n.set(e,i.size),f=i.set(i.size,[e,r]);return t.__ownerID?(t.size=o.size,t._map=o,t._list=f,t.__hash=void 0,t.__altered=!0,t):$8(o,f)}var cB="@@__IMMUTABLE_STACK__@@";function Lp(t){return!!(t&&t[cB])}var O1=function(t){function e(r){return r==null?zb():Lp(r)?r:zb().pushAll(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("Stack [","]")},e.prototype.get=function(n,i){var a=this._head;for(n=oc(this,n);a&&n--;)a=a.next;return a?a.value:i},e.prototype.peek=function(){return this._head&&this._head.value},e.prototype.push=function(){var n=arguments;if(arguments.length===0)return this;for(var i=this.size+arguments.length,a=this._head,s=arguments.length-1;s>=0;s--)a={value:n[s],next:a};return this.__ownerID?(this.size=i,this._head=a,this.__hash=void 0,this.__altered=!0,this):Ih(i,a)},e.prototype.pushAll=function(n){if(n=t(n),n.size===0)return this;if(this.size===0&&Lp(n))return n;Ii(n.size);var i=this.size,a=this._head;return n.__iterate(function(s){i++,a={value:s,next:a}},!0),this.__ownerID?(this.size=i,this._head=a,this.__hash=void 0,this.__altered=!0,this):Ih(i,a)},e.prototype.pop=function(){return this.slice(1)},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):zb()},e.prototype.slice=function(n,i){if(_1(n,i,this.size))return this;var a=i0(n,this.size),s=m1(i,this.size);if(s!==this.size)return t.prototype.slice.call(this,n,i);for(var o=this.size-a,f=this._head;a--;)f=f.next;return this.__ownerID?(this.size=o,this._head=f,this.__hash=void 0,this.__altered=!0,this):Ih(o,f)},e.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?Ih(this.size,this._head,n,this.__hash):this.size===0?zb():(this.__ownerID=n,this.__altered=!1,this)},e.prototype.__iterate=function(n,i){var a=this;if(i)return new Au(this.toArray()).__iterate(function(f,c){return n(f,c,a)},i);for(var s=0,o=this._head;o&&n(o.value,s++,this)!==!1;)o=o.next;return s},e.prototype.__iterator=function(n,i){if(i)return new Au(this.toArray()).__iterator(n,i);var a=0,s=this._head;return new tt(function(){if(s){var o=s.value;return s=s.next,Bt(n,a++,o)}return Wn()})},e}(Nu);O1.isStack=Lp;var Xn=O1.prototype;Xn[cB]=!0;Xn.shift=Xn.pop;Xn.unshift=Xn.push;Xn.unshiftAll=Xn.pushAll;Xn.withMutations=I1;Xn.wasAltered=N8;Xn.asImmutable=T1;Xn["@@transducer/init"]=Xn.asMutable=C1;Xn["@@transducer/step"]=function(t,e){return t.unshift(e)};Xn["@@transducer/result"]=function(t){return t.asImmutable()};function Ih(t,e,r,n){var i=Object.create(Xn);return i.size=t,i._head=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}var uA;function zb(){return uA||(uA=Ih(0))}var uB="@@__IMMUTABLE_SET__@@";function B1(t){return!!(t&&t[uB])}function v2(t){return B1(t)&&Ri(t)}function j8(t,e){if(t===e)return!0;if(!Tn(e)||t.size!==void 0&&e.size!==void 0&&t.size!==e.size||t.__hash!==void 0&&e.__hash!==void 0&&t.__hash!==e.__hash||gt(t)!==gt(e)||tn(t)!==tn(e)||Ri(t)!==Ri(e))return!1;if(t.size===0&&e.size===0)return!0;var r=!a0(t);if(Ri(t)){var n=t.entries();return e.every(function(f,c){var u=n.next().value;return u&&xr(u[1],f)&&(r||xr(u[0],c))})&&n.next().done}var i=!1;if(t.size===void 0)if(e.size===void 0)typeof t.cacheResult=="function"&&t.cacheResult();else{i=!0;var a=t;t=e,e=a}var s=!0,o=e.__iterate(function(f,c){if(r?!t.has(f):i?!xr(f,t.get(c,Ge)):!xr(t.get(c,Ge),f))return s=!1,!1});return s&&t.size===o}function Uu(t,e){var r=function(n){t.prototype[n]=e[n]};return Object.keys(e).forEach(r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(r),t}function uy(t){if(!t||typeof t!="object")return t;if(!Tn(t)){if(!fc(t))return t;t=On(t)}if(gt(t)){var e={};return t.__iterate(function(n,i){e[i]=uy(n)}),e}var r=[];return t.__iterate(function(n){r.push(uy(n))}),r}var u0=function(t){function e(r){return r==null?Ch():B1(r)&&!Ri(r)?r:Ch().withMutations(function(n){var i=t(r);Ii(i.size),i.forEach(function(a){return n.add(a)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(n){return this(Oa(n).keySeq())},e.intersect=function(n){return n=Ot(n).toArray(),n.length?rn.intersect.apply(e(n.pop()),n):Ch()},e.union=function(n){return n=Ot(n).toArray(),n.length?rn.union.apply(e(n.pop()),n):Ch()},e.prototype.toString=function(){return this.__toString("Set {","}")},e.prototype.has=function(n){return this._map.has(n)},e.prototype.add=function(n){return $b(this,this._map.set(n,n))},e.prototype.remove=function(n){return $b(this,this._map.remove(n))},e.prototype.clear=function(){return $b(this,this._map.clear())},e.prototype.map=function(n,i){var a=this,s=!1,o=$b(this,this._map.mapEntries(function(f){var c=f[1],u=n.call(i,c,c,a);return u!==c&&(s=!0),[u,u]},i));return s?o:this},e.prototype.union=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return n=n.filter(function(a){return a.size!==0}),n.length===0?this:this.size===0&&!this.__ownerID&&n.length===1?this.constructor(n[0]):this.withMutations(function(a){for(var s=0;s=0&&i=0&&athis.size?r:this.find(function(n,i){return i===e},void 0,r)},has:function(e){return e=oc(this,e),e>=0&&(this.size!==void 0?this.size===1/0||ee?-1:0}function Qj(t){if(t.size===1/0)return 0;var e=Ri(t),r=gt(t),n=e?1:0,i=t.__iterate(r?e?function(a,s){n=31*n+gA($n(a),$n(s))|0}:function(a,s){n=n+gA($n(a),$n(s))|0}:e?function(a){n=31*n+$n(a)|0}:function(a){n=n+$n(a)|0});return Yj(i,n)}function Yj(t,e){return e=rh(e,3432918353),e=rh(e<<15|e>>>-15,461845907),e=rh(e<<13|e>>>-13,5),e=(e+3864292196|0)^t,e=rh(e^e>>>16,2246822507),e=rh(e^e>>>13,3266489909),e=d2(e^e>>>16),e}function gA(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}var Eu=function(t){function e(r){return r==null?J3():v2(r)?r:J3().withMutations(function(n){var i=s0(r);Ii(i.size),i.forEach(function(a){return n.add(a)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(n){return this(Oa(n).keySeq())},e.prototype.toString=function(){return this.__toString("OrderedSet {","}")},e}(u0);Eu.isOrderedSet=v2;var ku=Eu.prototype;ku[o0]=!0;ku.zip=l0.zip;ku.zipWith=l0.zipWith;ku.zipAll=l0.zipAll;ku.__empty=J3;ku.__make=pB;function pB(t,e){var r=Object.create(ku);return r.size=t?t.size:0,r._map=t,r.__ownerID=e,r}var yA;function J3(){return yA||(yA=pB(Sh()))}var bB={LeftThenRight:-1,RightThenLeft:1};function Vj(t){if(vc(t))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(zi(t))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(t===null||typeof t!="object")throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}var pr=function(e,r){var n;Vj(e);var i=function(o){var f=this;if(o instanceof i)return o;if(!(this instanceof i))return new i(o);if(!n){n=!0;var c=Object.keys(e),u=a._indices={};a._name=r,a._keys=c,a._defaultValues=e;for(var l=0;l2?[]:void 0,{"":t})}function vB(t,e,r,n,i,a){if(typeof r!="string"&&!zi(r)&&(g8(r)||b8(r)||p2(r))){if(~t.indexOf(r))throw new TypeError("Cannot convert circular structure to Immutable");t.push(r),i&&n!==""&&i.push(n);var s=e.call(a,n,On(r).map(function(o,f){return vB(t,e,o,f,i,r)}),i&&i.slice());return t.pop(),i&&i.pop(),s}return r}function Wj(t,e){return tn(e)?e.toList():gt(e)?e.toMap():e.toSet()}var _B="4.3.7",Xj={version:_B,Collection:Ot,Iterable:Ot,Seq:On,Map:Zo,OrderedMap:os,List:Aa,Stack:O1,Set:u0,OrderedSet:Eu,PairSorting:bB,Record:pr,Range:F8,Repeat:gB,is:xr,fromJS:yB,hash:$n,isImmutable:zi,isCollection:Tn,isKeyed:gt,isIndexed:tn,isAssociative:a0,isOrdered:Ri,isValueObject:fy,isPlainObject:p2,isSeq:w1,isList:y2,isMap:E1,isOrderedMap:l2,isStack:Lp,isSet:B1,isOrderedSet:v2,isRecord:vc,get:b2,getIn:_2,has:I8,hasIn:q8,merge:JO,mergeDeep:tB,mergeWith:eB,mergeDeepWith:rB,remove:C8,removeIn:D8,set:T8,setIn:O8,update:g2,updateIn:mc},Zj=Ot;const Jj=Object.freeze(Object.defineProperty({__proto__:null,Collection:Ot,Iterable:Zj,List:Aa,Map:Zo,OrderedMap:os,OrderedSet:Eu,PairSorting:bB,Range:F8,Record:pr,Repeat:gB,Seq:On,Set:u0,Stack:O1,default:Xj,fromJS:yB,get:b2,getIn:_2,has:I8,hasIn:q8,hash:$n,is:xr,isAssociative:a0,isCollection:Tn,isImmutable:zi,isIndexed:tn,isKeyed:gt,isList:y2,isMap:E1,isOrdered:Ri,isOrderedMap:l2,isOrderedSet:v2,isPlainObject:p2,isRecord:vc,isSeq:w1,isSet:B1,isStack:Lp,isValueObject:fy,merge:JO,mergeDeep:tB,mergeDeepWith:rB,mergeWith:eB,remove:C8,removeIn:D8,set:T8,setIn:O8,update:g2,updateIn:mc,version:_B},Symbol.toStringTag,{value:"Module"})),Jo=eS(Jj);var Nr={},mB={};Object.defineProperty(mB,"__esModule",{value:!0});var zu={},wB=function t(e){Object.freeze(e);var r=typeof e=="function",n=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach(function(i){n.call(e,i)&&(!r||i!=="caller"&&i!=="callee"&&i!=="arguments")&&e[i]!==null&&(typeof e[i]=="object"||typeof e[i]=="function")&&!Object.isFrozen(e[i])&&t(e[i])}),e},d0={};Object.defineProperty(d0,"__esModule",{value:!0});d0.createConfig=Y8;d0.predefined=void 0;var eF=tF(wB);function tF(t){return t&&t.__esModule?t:{default:t}}function Y8(t){return(0,eF.default)(t)}const rF=Y8({PREFIX:"ckb",SCRIPTS:{SECP256K1_BLAKE160:{CODE_HASH:"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",HASH_TYPE:"type",TX_HASH:"0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c",INDEX:"0x0",DEP_TYPE:"depGroup",SHORT_ID:0},SECP256K1_BLAKE160_MULTISIG:{CODE_HASH:"0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8",HASH_TYPE:"type",TX_HASH:"0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c",INDEX:"0x1",DEP_TYPE:"depGroup",SHORT_ID:1},DAO:{CODE_HASH:"0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e",HASH_TYPE:"type",TX_HASH:"0xe2fb199810d49a4d8beec56718ba2593b665db9d52299a0f9e6e75416d73ff5c",INDEX:"0x2",DEP_TYPE:"code"},SUDT:{CODE_HASH:"0x5e7a36a77e68eecc013dfa2fe6a23f3b6c344b04005808694ae6dd45eea4cfd5",HASH_TYPE:"type",TX_HASH:"0xc7813f6a415144643970c2e88e0bb6ca6a8edc5dd7c1022746f628284a9936d5",INDEX:"0x0",DEP_TYPE:"code"},ANYONE_CAN_PAY:{CODE_HASH:"0xd369597ff47f29fbc0d47d2e3775370d1250b85140c670e4718af712983a2354",HASH_TYPE:"type",TX_HASH:"0x4153a2014952d7cac45f285ce9a7c5c0c0e1b21f2d378b82ac1433cb11c25c4d",INDEX:"0x0",DEP_TYPE:"depGroup",SHORT_ID:2},OMNILOCK:{CODE_HASH:"0x9b819793a64463aed77c615d6cb226eea5487ccfc0783043a587254cda2b6f26",HASH_TYPE:"type",TX_HASH:"0xc76edf469816aa22f416503c38d0b533d2a018e253e379f134c3985b3472c842",INDEX:"0x0",DEP_TYPE:"code"},XUDT:{CODE_HASH:"0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95",HASH_TYPE:"data1",TX_HASH:"0xc07844ce21b38e4b071dd0e1ee3b0e27afd8d7532491327f39b786343f558ab7",INDEX:"0x0",DEP_TYPE:"code"}}}),nF=Y8({PREFIX:"ckt",SCRIPTS:{SECP256K1_BLAKE160:{CODE_HASH:"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",HASH_TYPE:"type",TX_HASH:"0xf8de3bb47d055cdf460d93a2a6e1b05f7432f9777c8c474abf4eec1d4aee5d37",INDEX:"0x0",DEP_TYPE:"depGroup",SHORT_ID:0},SECP256K1_BLAKE160_MULTISIG:{CODE_HASH:"0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8",HASH_TYPE:"type",TX_HASH:"0xf8de3bb47d055cdf460d93a2a6e1b05f7432f9777c8c474abf4eec1d4aee5d37",INDEX:"0x1",DEP_TYPE:"depGroup",SHORT_ID:1},DAO:{CODE_HASH:"0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e",HASH_TYPE:"type",TX_HASH:"0x8f8c79eb6671709633fe6a46de93c0fedc9c1b8a6527a18d3983879542635c9f",INDEX:"0x2",DEP_TYPE:"code"},SUDT:{CODE_HASH:"0xc5e5dcf215925f7ef4dfaf5f4b4f105bc321c02776d6e7d52a1db3fcd9d011a4",HASH_TYPE:"type",TX_HASH:"0xe12877ebd2c3c364dc46c5c992bcfaf4fee33fa13eebdf82c591fc9825aab769",INDEX:"0x0",DEP_TYPE:"code"},ANYONE_CAN_PAY:{CODE_HASH:"0x3419a1c09eb2567f6552ee7a8ecffd64155cffe0f1796e6e61ec088d740c1356",HASH_TYPE:"type",TX_HASH:"0xec26b0f85ed839ece5f11c4c4e837ec359f5adc4420410f6453b1f6b60fb96a6",INDEX:"0x0",DEP_TYPE:"depGroup",SHORT_ID:2},OMNILOCK:{CODE_HASH:"0xf329effd1c475a2978453c8600e1eaf0bc2087ee093c3ee64cc96ec6847752cb",HASH_TYPE:"type",TX_HASH:"0xec18bf0d857c981c3d1f4e17999b9b90c484b303378e94de1a57b0872f5d4602",INDEX:"0x0",DEP_TYPE:"code"},XUDT:{CODE_HASH:"0x25c29dc317811a6f6f3985a7a9ebc4838bd388d19d0feeecf0bcd60f6c0975bb",HASH_TYPE:"type",TX_HASH:"0xbf6fb538763efec2a70a6a3dcb7242787087e1030c4e7d86585bc63a9d337f5f",INDEX:"0x0",DEP_TYPE:"code"}}});d0.predefined={LINA:rF,AGGRON4:nF};Object.defineProperty(zu,"__esModule",{value:!0});zu.assertHashType=AB;zu.getConfig=cF;zu.initializeConfig=uF;zu.validateConfig=EB;var iF=sF(wB),aF=d0;function sF(t){return t&&t.__esModule?t:{default:t}}function oF(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(`${t} must be a hex string!`)}function vA(t,e){if(oF(t,e),e.length!==66)throw new Error(`${t} must be a hex string of 66 characters long!`)}function fF(t,e){if(e!=="0x0"&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(`${t} must be a hex integer!`)}function AB(t,e){if(e!=="type"&&e!=="data"&&e!=="data1"&&e!=="data2")throw new Error(`${t} must one of type, data, data1, data2!`)}function _A(t,e="variable"){if(!t)throw new Error(`${e} is not valid`)}function EB(t){_A(typeof t.SCRIPTS=="object"&&t.SCRIPTS!=null,"config.SCRIPT");for(const e of Object.keys(t.SCRIPTS)){const r=t.SCRIPTS[e];_A(r==null?void 0:r.CODE_HASH),vA(`SCRIPTS.${e}.CODE_HASH`,r.CODE_HASH),AB(`SCRIPTS.${e}.HASH_TYPE`,r.HASH_TYPE),vA(`SCRIPTS.${e}.TX_HASH`,r.TX_HASH),fF(`SCRIPTS.${e}.INDEX`,r.INDEX);const n=r.DEP_TYPE;if(n!=="depGroup"&&n!=="code")throw new Error(`SCRIPTS.${e}.DEP_TYPE must either be depGroup or code!`);const i=r.SHORT_ID;if(i!=null&&typeof i!="number")throw new Error("SHORT_ID must be a number!")}}let xB=aF.predefined.LINA;function cF(){return xB}function uF(t){EB(t),xB=(0,iF.default)(t)}var m2={};Object.defineProperty(m2,"__esModule",{value:!0});m2.findConfigByScript=lF;m2.nameOfScript=dF;var SB=zu;function lF(t,e){const r=e||(0,SB.getConfig)().SCRIPTS;return Object.values(r).find(n=>(n==null?void 0:n.CODE_HASH)===t.codeHash&&(n==null?void 0:n.HASH_TYPE)===t.hashType)}function dF(t,e){const r=e||(0,SB.getConfig)().SCRIPTS,n=Object.entries(r).find(([,i])=>(i==null?void 0:i.CODE_HASH)===t.codeHash&&(i==null?void 0:i.HASH_TYPE)===t.hashType);if(n)return n[0]}var Ci={};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.SIGHASH_OUTPUT_LOC=Ci.SIGHASH_GROUP_OUTPUT_LOC=Ci.MULTISIG_OUTPUT_LOC=Ci.MULTISIG_GROUP_OUTPUT_LOC=Ci.DAO_OUTPUT_LOC=void 0;Ci.generateGenesisScriptConfigs=pF;var hF=Ir;const mA=Ci.SIGHASH_OUTPUT_LOC=[0,1],wA=Ci.MULTISIG_OUTPUT_LOC=[0,4],AA=Ci.DAO_OUTPUT_LOC=[0,2],EA=Ci.SIGHASH_GROUP_OUTPUT_LOC=[1,0],xA=Ci.MULTISIG_GROUP_OUTPUT_LOC=[1,1];function pF(t){if(!t||Number(t.header.number)!==0)throw new Error("The block must be a genesis block");const e=t.transactions;return{SECP256K1_BLAKE160:{...M_({transaction:e[mA[0]],outputIndex:mA[1],depGroupTransaction:e[EA[0]],depGroupOutputIndex:EA[1]}),SHORT_ID:0},SECP256K1_BLAKE160_MULTISIG:{...M_({transaction:e[wA[0]],outputIndex:wA[1],depGroupTransaction:e[xA[0]],depGroupOutputIndex:xA[1]}),SHORT_ID:1},DAO:M_({transaction:e[AA[0]],outputIndex:AA[1]})}}function M_(t){var e;const{transaction:r,outputIndex:n}=t,i=hF.utils.computeScriptHash(R_((e=r.outputs[n])===null||e===void 0?void 0:e.type));if("depGroupTransaction"in t){const{depGroupOutputIndex:a,depGroupTransaction:s}=t;return{HASH_TYPE:"type",CODE_HASH:i,DEP_TYPE:"depGroup",TX_HASH:R_(s.hash),INDEX:SA(a)}}return{HASH_TYPE:"type",CODE_HASH:i,DEP_TYPE:"code",INDEX:SA(n),TX_HASH:R_(r.hash)}}function R_(t){if(t==null)throw new Error("The block must be a genesis block");return t}function SA(t){return`0x${t.toString(16)}`}var M1={};Object.defineProperty(M1,"__esModule",{value:!0});M1.createLatestTypeIdResolver=IB;M1.createRpcResolver=bF;M1.refreshScriptConfigs=gF;function bF(t){return IB(async n=>{const i=await t.createBatchRequest(n.map(a=>["getTransaction",a])).exec();return ly(n,i,(a,s)=>{if(!(s!=null&&s.transaction))throw new Error(`Cannot find transaction ${a}`);return s.transaction})},async n=>(await t.createBatchRequest(n.map(a=>["getCells",{script:a,scriptType:"type",scriptSearchMode:"exact",withData:!1},"asc","0x1"])).exec()).map(a=>a.objects[0]))}function IB(t,e){return async r=>{const n=await t(r.map(s=>s.txHash)),i=ly(r,n,(s,o)=>(ep(s),ep(o,`Cannot find the OutPoint ${s.txHash}#${s.index}`),o.outputs[Number(s.index)].type)),a=await e(i.filter(Boolean));return ly(r,i,(s,o)=>{if(ep(s),!o)return s;const[f]=a.splice(0,1);return f.outPoint})}}async function gF(t,{resolve:e,skip:r=["SECP256K1_BLAKE160","SECP256K1_BLAKE160_MULTISIG","DAO"]}){const n=Object.entries(t).filter(([o,f])=>!r.includes(o)&&(f==null?void 0:f.HASH_TYPE)==="type"),i=n.map(([o,f])=>({txHash:f.TX_HASH,index:f.INDEX})),a=await e(i),s=Object.fromEntries(ly(n,a,(o,f)=>{ep(o);const[c,u]=o;return ep(f,`Refreshing failed, cannot load config of ${c}, please check whether the scriptConfig is correct`),[c,{...u,TX_HASH:f.txHash,INDEX:f.index}]}));return Object.assign({},t,s)}function ly(t,e,r){return t.map((n,i)=>r(t[i],e[i]))}function ep(t,e="Not nullable"){if(t==null)throw new Error(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e={initializeConfig:!0,getConfig:!0,validateConfig:!0,nameOfScript:!0,findConfigByScript:!0,helpers:!0,predefined:!0,createConfig:!0,generateGenesisScriptConfigs:!0,refreshScriptConfigs:!0,createRpcResolver:!0,createLatestTypeIdResolver:!0};Object.defineProperty(t,"createConfig",{enumerable:!0,get:function(){return a.createConfig}}),Object.defineProperty(t,"createLatestTypeIdResolver",{enumerable:!0,get:function(){return o.createLatestTypeIdResolver}}),Object.defineProperty(t,"createRpcResolver",{enumerable:!0,get:function(){return o.createRpcResolver}}),Object.defineProperty(t,"findConfigByScript",{enumerable:!0,get:function(){return i.findConfigByScript}}),Object.defineProperty(t,"generateGenesisScriptConfigs",{enumerable:!0,get:function(){return s.generateGenesisScriptConfigs}}),Object.defineProperty(t,"getConfig",{enumerable:!0,get:function(){return n.getConfig}}),t.helpers=void 0,Object.defineProperty(t,"initializeConfig",{enumerable:!0,get:function(){return n.initializeConfig}}),Object.defineProperty(t,"nameOfScript",{enumerable:!0,get:function(){return i.nameOfScript}}),Object.defineProperty(t,"predefined",{enumerable:!0,get:function(){return a.predefined}}),Object.defineProperty(t,"refreshScriptConfigs",{enumerable:!0,get:function(){return o.refreshScriptConfigs}}),Object.defineProperty(t,"validateConfig",{enumerable:!0,get:function(){return n.validateConfig}});var r=mB;Object.keys(r).forEach(function(u){u==="default"||u==="__esModule"||Object.prototype.hasOwnProperty.call(e,u)||u in t&&t[u]===r[u]||Object.defineProperty(t,u,{enumerable:!0,get:function(){return r[u]}})});var n=zu,i=c(m2);t.helpers=i;var a=d0,s=Ci,o=M1;function f(u){if(typeof WeakMap!="function")return null;var l=new WeakMap,p=new WeakMap;return(f=function(y){return y?p:l})(u)}function c(u,l){if(u&&u.__esModule)return u;if(u===null||typeof u!="object"&&typeof u!="function")return{default:u};var p=f(l);if(p&&p.has(u))return p.get(u);var y={__proto__:null},m=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var A in u)if(A!=="default"&&{}.hasOwnProperty.call(u,A)){var S=m?Object.getOwnPropertyDescriptor(u,A):null;S&&(S.get||S.set)?Object.defineProperty(y,A,S):y[A]=u[A]}return y.default=u,p&&p.set(u,y),y}})(Nr);var ba={};Object.defineProperty(ba,"__esModule",{value:!0});ba.ADDRESS_FORMAT_SHORT=ba.ADDRESS_FORMAT_FULLTYPE=ba.ADDRESS_FORMAT_FULLDATA=ba.ADDRESS_FORMAT_FULL=void 0;ba.parseDeprecatedCkb2019Address=EF;ba.parseFullFormatAddress=AF;var yF=Ir,Uc=st,CB=Nr,dy=sc;const TB=1023,vF=ba.ADDRESS_FORMAT_FULL=0,_F=ba.ADDRESS_FORMAT_SHORT=1,mF=ba.ADDRESS_FORMAT_FULLDATA=2,wF=ba.ADDRESS_FORMAT_FULLTYPE=4;function AF(t,{config:e}){e=e||(0,CB.getConfig)();const{words:r,prefix:n}=dy.bech32m.decode(t,TB);if(n!==e.PREFIX)throw Error(`Invalid prefix! Expected: ${e.PREFIX}, actual: ${n}`);const[i,...a]=dy.bech32m.fromWords(r);if(i!==vF)throw new Error("Invalid address format type");if(a.length<33)throw new Error("Invalid payload length, too short!");const s=Uc.bytes.hexify(a.slice(0,32)),o=yF.blockchain.HashType.unpack(a.slice(32,33)),f=Uc.bytes.hexify(a.slice(33));return{codeHash:s,hashType:o,args:f}}function EF(t,{config:e}){e=e||(0,CB.getConfig)();const{prefix:r,words:n}=dy.bech32.decode(t,TB);if(r!==e.PREFIX)throw Error(`Invalid prefix! Expected: ${e.PREFIX}, actual: ${r}`);const[i,...a]=dy.bech32.fromWords(n);switch(i){case _F:{const[s,...o]=a;if(o.length!==20)throw Error("Invalid payload length!");const f=Object.values(e.SCRIPTS).find(c=>c&&c.SHORT_ID===s);if(!f)throw Error(`Invalid code hash index: ${s}!`);return{codeHash:f.CODE_HASH,hashType:f.HASH_TYPE,args:Uc.bytes.hexify(o)}}case mF:{if(a.length<32)throw Error("Invalid payload length!");return{codeHash:Uc.bytes.hexify(a.slice(0,32)),hashType:"data",args:Uc.bytes.hexify(a.slice(32))}}case wF:{if(a.length<32)throw Error("Invalid payload length!");return{codeHash:Uc.bytes.hexify(a.slice(0,32)),hashType:"type",args:Uc.bytes.hexify(a.slice(32))}}}throw Error(`Invalid payload format type: ${i}`)}var V8={};Object.defineProperty(V8,"__esModule",{value:!0});V8.hexToByteArray=xF;function xF(t){if(!/^(0x)?([0-9a-fA-F][0-9a-fA-F])*$/.test(t))throw new Error("Invalid hex string!");t.startsWith("0x")&&(t=t.slice(2));const e=[];for(;t.length>=2;)e.push(parseInt(t.slice(0,2),16)),t=t.slice(2);return e}var G8={};Object.defineProperty(G8,"__esModule",{value:!0});G8.refreshTypeIdCellDeps=SF;async function SF(t,{resolve:e}){const r=t.cellDeps.map(({outPoint:i})=>i).toArray(),n=await e(r);return t.update("cellDeps",i=>i.map((a,s)=>({...a,outPoint:n[s]})))}var L_={},$u={};Object.defineProperty($u,"__esModule",{value:!0});$u.createModelHelper=CF;$u.defaultDeepClone=hy;var IA=st,IF=St;function CF(t){return{create:e=>t.unpack(t.pack(e)),hash:e=>IA.bytes.bytify((0,IF.ckbHash)(t.pack(e))),equals:(e,r)=>IA.bytes.equal(t.pack(e),t.pack(r)),clone:hy}}function hy(t){const e=typeof t;if(e==="number"||e==="string"||e==="boolean"||e==="bigint"||t==null)return t;if(Array.isArray(t))return t.map(hy);if(e==="object")return Object.entries(t).reduce((r,[n,i])=>Object.assign(r,{[n]:hy(i)}),{});throw new Error("Cannot clone the value: "+String(t))}var nh={},ih={},CA;function OB(){if(CA)return ih;CA=1,Object.defineProperty(ih,"__esModule",{value:!0}),ih.scriptHelper=void 0;var t=Ir,e=Nr,r=pi(),n=$u;function i(a){if(a.startsWith("ckb"))return(0,r.parseAddress)(a,{config:e.predefined.LINA});if(a.startsWith("ckt"))return(0,r.parseAddress)(a,{config:e.predefined.AGGRON4});throw new Error(`The address prefix ${a} is unknown`)}return ih.scriptHelper=(0,n.createModelHelper)({pack:a=>t.blockchain.Script.pack(typeof a=="string"?i(a):a),unpack:a=>t.blockchain.Script.unpack(a)}),ih}var R1={};Object.defineProperty(R1,"__esModule",{value:!0});R1.outPointHelper=void 0;var TF=Ir,OF=$u;R1.outPointHelper=(0,OF.createModelHelper)(TF.blockchain.OutPoint);var TA;function BF(){if(TA)return nh;TA=1,Object.defineProperty(nh,"__esModule",{value:!0}),nh.cellHelper=void 0;var t=$u,e=Ir,r=OB(),n=wt,i=st,a=c1,s=R1,o=pi();function f(u){return!u||typeof u!="object"?!1:"lock"in u}const c=(0,a.table)({cellOutput:e.blockchain.CellOutput,data:e.blockchain.Bytes,outPoint:(0,a.option)(e.blockchain.OutPoint)},["cellOutput","data","outPoint"]);return nh.cellHelper=(0,t.createModelHelper)({pack:u=>{const l=f(u)?{cellOutput:{capacity:n.BI.from(u.capacity||"0x0").toHexString(),lock:r.scriptHelper.create(u.lock),type:u.type&&r.scriptHelper.create(u.type)},outPoint:u.outPoint&&s.outPointHelper.create(u.outPoint),data:i.bytes.hexify(u.data||"0x")}:u;return n.BI.from(l.cellOutput.capacity).eq(0)&&(l.cellOutput.capacity=(0,o.minimalCellCapacityCompatible)(l).toHexString()),c.pack(l)},unpack:u=>c.unpack(u)}),nh}var OA;function DF(){return OA||(OA=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"cellHelper",{enumerable:!0,get:function(){return r.cellHelper}}),Object.defineProperty(t,"createModelHelper",{enumerable:!0,get:function(){return e.createModelHelper}}),Object.defineProperty(t,"outPointHelper",{enumerable:!0,get:function(){return i.outPointHelper}}),Object.defineProperty(t,"scriptHelper",{enumerable:!0,get:function(){return n.scriptHelper}});var e=$u,r=BF(),n=OB(),i=R1}(L_)),L_}var BA;function pi(){return BA||(BA=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e={minimalScriptCapacity:!0,minimalScriptCapacityCompatible:!0,minimalCellCapacity:!0,minimalCellCapacityCompatible:!0,locateCellDep:!0,generateAddress:!0,scriptToAddress:!0,generateSecp256k1Blake160Address:!0,generateSecp256k1Blake160MultisigAddress:!0,parseAddress:!0,addressToScript:!0,encodeToAddress:!0,encodeToConfigAddress:!0,TransactionSkeleton:!0,createTransactionFromSkeleton:!0,createTransactionSkeleton:!0,sealTransaction:!0,transactionSkeletonToObject:!0,objectToTransactionSkeleton:!0,refreshTypeIdCellDeps:!0};t.addressToScript=t.TransactionSkeleton=void 0,t.createTransactionFromSkeleton=x,t.createTransactionSkeleton=E,t.encodeToAddress=v,t.encodeToConfigAddress=d,t.generateAddress=W,t.generateSecp256k1Blake160Address=_,t.generateSecp256k1Blake160MultisigAddress=I,t.locateCellDep=K,t.minimalCellCapacity=M,t.minimalCellCapacityCompatible=U,t.minimalScriptCapacity=w,t.minimalScriptCapacityCompatible=O,t.objectToTransactionSkeleton=$,t.parseAddress=b,Object.defineProperty(t,"refreshTypeIdCellDeps",{enumerable:!0,get:function(){return p.refreshTypeIdCellDeps}}),t.scriptToAddress=void 0,t.sealTransaction=h,t.transactionSkeletonToObject=T;var r=st,n=Ir,i=sc,a=Jo,s=Nr,o=wt,f=ba,c=V8,u=n8,l=Ee,p=G8,y=DF();Object.keys(y).forEach(function(L){L==="default"||L==="__esModule"||Object.prototype.hasOwnProperty.call(e,L)||L in t&&t[L]===y[L]||Object.defineProperty(t,L,{enumerable:!0,get:function(){return y[L]}})});const{bytify:m,hexify:A}=r.bytes,S=1023;function w(L,{validate:j=!0}={}){const F=O(L,{validate:j});return BigInt(F.toString())}const C=1e8;function O(L,{validate:j=!0}={}){j&&u.validators.ValidateScript(L);let F=0;return F+=m(L.codeHash).length,F+=m(L.args).length,F+=1,o.BI.from(F).mul(C)}function M(L,{validate:j=!0}={}){const F=U(L,{validate:j});return BigInt(F.toString())}function U(L,{validate:j=!0}={}){j&&n.blockchain.CellOutput.pack(L.cellOutput);let F=8;return F+=m(L.cellOutput.lock.codeHash).length,F+=m(L.cellOutput.lock.args).length,F+=1,L.cellOutput.type&&(F+=m(L.cellOutput.type.codeHash).length,F+=m(L.cellOutput.type.args).length,F+=1),L.data&&(F+=m(L.data).length),o.BI.from(F).mul(C)}function K(L,{config:j=void 0}={}){j=j||(0,s.getConfig)();const F=Object.values(j.SCRIPTS).find(H=>H&&H.CODE_HASH===L.codeHash&&H.HASH_TYPE===L.hashType);return F?{depType:F.DEP_TYPE,outPoint:{txHash:F.TX_HASH,index:F.INDEX}}:null}let Q=!1;const k=2,G=4;function W(L,{config:j=void 0}={}){j=j||(0,s.getConfig)(),Q||(console.warn("The address format generated by generateAddress or scriptToAddress will be deprecated, please migrate to encodeToAddress to generate the new ckb2021 full format address as soon as possible"),Q=!0),u.validators.ValidateScript(L);const F=Object.values(j.SCRIPTS).find(X=>X&&X.CODE_HASH===L.codeHash&&X.HASH_TYPE===L.hashType),H=[];if(F&&F.SHORT_ID!==void 0)H.push(1,F.SHORT_ID),H.push(...(0,c.hexToByteArray)(L.args));else{if(L.hashType==="type")H.push(G);else if(L.hashType==="data")H.push(k);else throw new Error(`Invalid hashType ${L.hashType}`);H.push(...(0,c.hexToByteArray)(L.codeHash)),H.push(...(0,c.hexToByteArray)(L.args))}const q=i.bech32.toWords(H);return i.bech32.encode(j.PREFIX,q,S)}t.scriptToAddress=W;function R(L,j,{config:F=void 0}={}){F=F||(0,s.getConfig)();const H=F.SCRIPTS[j];if(!H){const X=Object.keys(F.SCRIPTS);throw new Error(`Invalid script type: ${j}, only support: ${X}`)}const q={codeHash:H.CODE_HASH,hashType:H.HASH_TYPE,args:L};return W(q,{config:F})}function _(L,{config:j=void 0}={}){return R(L,"SECP256K1_BLAKE160",{config:j})}function I(L,{config:j=void 0}={}){return R(L,"SECP256K1_BLAKE160_MULTISIG",{config:j})}function b(L,{config:j=void 0}={}){j=j||(0,s.getConfig)();try{return(0,f.parseFullFormatAddress)(L,{config:j})}catch{return(0,f.parseDeprecatedCkb2019Address)(L,{config:j})}}t.addressToScript=b;function v(L,{config:j=void 0}={}){u.validators.ValidateScript(L),j=j||(0,s.getConfig)();const F=r.bytes.concat([0],L.codeHash,l.HashType.pack(L.hashType),L.args);return i.bech32m.encode(j.PREFIX,i.bech32m.toWords(F),S)}function d(L,j,F){const H=(F==null?void 0:F.config)||(0,s.getConfig)(),q=H.SCRIPTS[j];if(!q){const te=Object.keys(H.SCRIPTS);throw new Error(`Invalid script type: ${String(j)}, only support: ${te}`)}const X={codeHash:q.CODE_HASH,hashType:q.HASH_TYPE,args:L};return v(X,{config:H})}const g=t.TransactionSkeleton=(0,a.Record)({cellProvider:null,cellDeps:(0,a.List)(),headerDeps:(0,a.List)(),inputs:(0,a.List)(),outputs:(0,a.List)(),witnesses:(0,a.List)(),fixedEntries:(0,a.List)(),signingEntries:(0,a.List)(),inputSinces:(0,a.Map)()});function x(L,{validate:j=!0}={}){const F={version:"0x0",cellDeps:L.get("cellDeps").toArray(),headerDeps:L.get("headerDeps").toArray(),inputs:L.get("inputs").map((H,q)=>{if(!H.outPoint)throw new Error(`cannot find OutPoint in Inputs[${q}] when createTransactionFromSkeleton`);return{since:L.get("inputSinces").get(q,"0x0"),previousOutput:H.outPoint}}).toArray(),outputs:L.get("outputs").map(H=>H.cellOutput).toArray(),outputsData:L.get("outputs").map(H=>H.data||"0x0").toArray(),witnesses:L.get("witnesses").toArray()};return j&&u.validators.ValidateTransaction(F),F}async function E(L,j){let F=g();F=F.update("cellDeps",X=>X.push(...L.cellDeps)),F=F.update("headerDeps",X=>X.push(...L.headerDeps));const H=await Promise.all(L.inputs.map(X=>j(X.previousOutput)));F=F.update("inputs",X=>X.push(...H)),F=F.update("inputSinces",X=>L.inputs.reduce((te,ne,N)=>te.set(N,ne.since),X));const q=L.outputs.map((X,te)=>{var ne;return{cellOutput:X,data:(ne=L.outputsData[te])!==null&&ne!==void 0?ne:"0x"}});return F=F.update("outputs",X=>X.push(...q)),F=F.update("witnesses",X=>X.push(...L.witnesses)),F}function h(L,j){const F=x(L);if(j.length!==L.get("signingEntries").size)throw new Error(`Requiring ${L.get("signingEntries").size} sealing contents but provided ${j.length}!`);return L.get("signingEntries").forEach((H,q)=>{switch(H.type){case"witness_args_lock":{const X=F.witnesses[H.index],te=n.blockchain.WitnessArgs.unpack(m(X)),ne={lock:j[q]},N=te.inputType;N&&(ne.inputType=N);const P=te.outputType;P&&(ne.outputType=P),F.witnesses[H.index]=A(n.blockchain.WitnessArgs.pack(ne));break}default:throw new Error(`Invalid signing entry type: ${H.type}`)}}),F}function T(L){return L.toJS()}function $(L){let j=(0,a.Map)();for(const[H,q]of Object.entries(L.inputSinces))j=j.set(+H,q);return g({cellProvider:L.cellProvider,cellDeps:(0,a.List)(L.cellDeps),headerDeps:(0,a.List)(L.headerDeps),inputs:(0,a.List)(L.inputs),outputs:(0,a.List)(L.outputs),witnesses:(0,a.List)(L.witnesses),fixedEntries:(0,a.List)(L.fixedEntries),signingEntries:(0,a.List)(L.signingEntries),inputSinces:j})}}(A_)),A_}var w2=pi(),BB,DB,MB,RB,LB,HB;const h0=Symbol("immutable"),Oi=Symbol("cellDeps"),fi=Symbol("headerDeps"),uu=Symbol("witness"),Hs=Symbol("since");class xn{constructor(e){this[BB]=!0,this.codeHash=e.codeHash,this.hashType=e.hashType,this.args=e.args,this[Oi]=Object.freeze(e[Oi]),this[fi]=Object.freeze(e[fi]),this[uu]=e[uu],this[Hs]=e[Hs]}static from(e){return Object.freeze(e instanceof xn?e:new xn(e))}}BB=h0;const va=xn.from({codeHash:"0x0000000000000000000000000000000000000000000000000000000000000000",hashType:"data",args:"0x",[Oi]:[],[fi]:[],[uu]:void 0,[Hs]:"0x0"});class Fo{constructor(e){this[DB]=!0,this.txHash=e.txHash,this.index=e.index}static from(e){return Object.freeze(e instanceof Fo?e:new Fo(e))}}DB=h0;class Hp{constructor(e){this[MB]=!0,this.capacity=e.capacity,this.lock=xn.from(e.lock),this.type=e.type?xn.from(e.type):void 0}static from(e){return Object.freeze(e instanceof Hp?e:new Hp(e))}}MB=h0;class Yt{constructor(e){this[RB]=!0;const{capacity:r,lock:n,type:i}={lock:va,capacity:"0x0",...e.cellOutput,...e};this.cellOutput=Hp.from({capacity:r,lock:n,type:i}),this.data=e.data??"0x",this.outPoint=e.outPoint?Fo.from(e.outPoint):void 0,this.blockHash=e.blockHash,this.blockNumber=e.blockNumber,this.txIndex=e.txIndex,BigInt(r)<=0n&&(this.cellOutput=Hp.from({capacity:w2.minimalCellCapacityCompatible(this,{validate:!1}).toHexString(),lock:n,type:i}))}static from(e){return Object.freeze(e instanceof Yt?e:new Yt(e))}}RB=h0;class lu{constructor(e){this[LB]=!0,this.outPoint=Fo.from(e.outPoint),this.depType=e.depType}static from(e){return Object.freeze(e instanceof lu?e:new lu(e))}}LB=h0;class Cd{constructor(e){this[HB]=!0,this.timestamp=e.timestamp,this.number=e.number,this.epoch=e.epoch,this.compactTarget=e.compactTarget,this.dao=e.dao,this.hash=e.hash,this.nonce=e.nonce,this.parentHash=e.parentHash,this.proposalsHash=e.proposalsHash,this.transactionsRoot=e.transactionsRoot,this.extraHash=e.extraHash,this.version=e.version}static from(e){return Object.freeze(e instanceof Cd?e:new Cd(e))}}HB=h0;const MF=Object.freeze(zo.Uint8);Object.freeze(zo.Uint16);const RF=Object.freeze(zo.Uint32),Td=Object.freeze({...zo.Uint64,unpack:t=>zo.Uint64.unpack(t).toBigInt()}),e6=Object.freeze({...zo.Uint128,unpack:t=>zo.Uint128.unpack(t).toBigInt()}),PB=Object.freeze(st.createFixedBytesCodec({byteLength:4,pack:t=>{const e=new Uint8Array([0,0,0,0]);return new DataView(e.buffer).setInt32(0,t,!0),e},unpack:t=>new DataView(t.buffer).getInt32(0,!0)})),LF=Object.freeze(Q4);var yi={},Od={},A2={},ef={},E2={},yn={},cc={};Object.defineProperty(cc,"__esModule",{value:!0});cc.default=cc.ErrorCode=void 0;let HF=cc.ErrorCode=function(t){return t[t.ParameterInvalid=101]="ParameterInvalid",t[t.IdNotMatch=201]="IdNotMatch",t[t.MethodNotFound=202]="MethodNotFound",t[t.PayloadMessage=203]="PayloadMessage",t[t.ResponseMessage=204]="ResponseMessage",t}({});cc.default=HF;Object.defineProperty(yn,"__esModule",{value:!0});yn.default=yn.StringHashTypeException=yn.PageSizeTooSmallException=yn.PageSizeTooLargeException=yn.OutputsValidatorTypeException=yn.HexStringWithout0xException=yn.BigintOrHexStringTypeException=void 0;var p0=PF(cc);function PF(t){return t&&t.__esModule?t:{default:t}}class NB extends RangeError{constructor(r,n){super(`Expect page size to be at most ${n}, but ${r} received`);Vr(this,"code",p0.default.ParameterInvalid)}}yn.PageSizeTooLargeException=NB;class UB extends RangeError{constructor(r,n){super(`Expect page size to be at least ${n}, but ${r} received`);Vr(this,"code",p0.default.ParameterInvalid)}}yn.PageSizeTooSmallException=UB;class kB extends TypeError{constructor(){super("Expect outputs validator to be 'default' or 'passthrough'");Vr(this,"code",p0.default.ParameterInvalid)}}yn.OutputsValidatorTypeException=kB;class zB extends TypeError{constructor(r){super(`Expect number to be bigint or hex string, but ${r} received`);Vr(this,"code",p0.default.ParameterInvalid)}}yn.BigintOrHexStringTypeException=zB;class $B extends TypeError{constructor(r){super(`Expect hash to be string, but ${r} received`);Vr(this,"code",p0.default.ParameterInvalid)}}yn.StringHashTypeException=$B;class jB extends Error{constructor(r){super(`Hex string ${r} should start with 0x`);Vr(this,"code",p0.default.ParameterInvalid)}}yn.HexStringWithout0xException=jB;yn.default={PageSizeTooLargeException:NB,PageSizeTooSmallException:UB,OutputsValidatorTypeException:kB,BigintOrHexStringTypeException:zB,StringHashTypeException:$B,HexStringWithout0xException:jB};var Mo={};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.default=Mo.ResponseException=Mo.IdNotMatchException=void 0;var FB=NF(cc);function NF(t){return t&&t.__esModule?t:{default:t}}class qB extends Error{constructor(r,n){super(`Expect json rpc id to be ${r}, but ${n} received`);Vr(this,"code",FB.default.IdNotMatch)}}Mo.IdNotMatchException=qB;class KB extends Error{constructor(){super(...arguments);Vr(this,"code",FB.default.ResponseMessage)}}Mo.ResponseException=KB;Mo.default={IdNotMatchException:qB,ResponseException:KB};var Os={};Object.defineProperty(Os,"__esModule",{value:!0});Os.default=Os.PayloadInBatchException=Os.MethodInBatchNotFoundException=Os.IdNotMatchedInBatchException=void 0;var QB=kF(cc),UF=Mo;function kF(t){return t&&t.__esModule?t:{default:t}}const W8="Batch Request";class YB extends Error{constructor(r){super(`[${W8}]: Method ${r} is not found`);Vr(this,"code",QB.default.MethodNotFound)}}Os.MethodInBatchNotFoundException=YB;class VB extends Error{constructor(r,n){super(`[${W8} ${r}]: ${n}`);Vr(this,"code",QB.default.PayloadMessage);this.index=r}}Os.PayloadInBatchException=VB;class GB extends UF.IdNotMatchException{constructor(e,r,n){super(r,n),this.message=`[${W8} ${e}]: ${this.message}`,this.index=e}}Os.IdNotMatchedInBatchException=GB;Os.default={MethodInBatchNotFoundException:YB,PayloadInBatchException:VB,IdNotMatchedInBatchException:GB};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=yn;Object.keys(e).forEach(function(i){i==="default"||i==="__esModule"||i in t&&t[i]===e[i]||Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[i]}})});var r=Mo;Object.keys(r).forEach(function(i){i==="default"||i==="__esModule"||i in t&&t[i]===r[i]||Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[i]}})});var n=Os;Object.keys(n).forEach(function(i){i==="default"||i==="__esModule"||i in t&&t[i]===n[i]||Object.defineProperty(t,i,{enumerable:!0,get:function(){return n[i]}})})})(E2);Object.defineProperty(ef,"__esModule",{value:!0});ef.formatter=void 0;var rl=E2,H_=wt;const ur=ef.formatter={toOptional:t=>e=>!t||e===void 0||e===null?e:t(e),toArray:t=>e=>typeof t!="function"||!Array.isArray(e)?e:e.map(t),toHash:t=>{if(typeof t!="string")throw new rl.StringHashTypeException(t);return t.startsWith("0x")?t:`0x${t}`},toNumber:t=>{if(typeof t=="bigint")return`0x${t.toString(16)}`;if(typeof t!="string")throw new rl.BigintOrHexStringTypeException(t);if(!t.startsWith("0x"))throw new rl.HexStringWithout0xException(t);return t},toScript:t=>{const{codeHash:e,hashType:r,...n}=t;return{code_hash:ur.toHash(e),hash_type:r,...n}},toOutPoint:t=>{const{txHash:e,index:r,...n}=t;return{tx_hash:ur.toHash(e),index:ur.toNumber(r),...n}},toInput:t=>{if(!t)return t;const{previousOutput:e,since:r,...n}=t;return{previous_output:ur.toOutPoint(e),since:ur.toNumber(r),...n}},toOutput:t=>{if(!t)return t;const{capacity:e,lock:r,type:n=void 0,...i}=t;return{capacity:ur.toNumber(e),lock:ur.toScript(r),type:n&&ur.toScript(n),...i}},toDepType:t=>t==="depGroup"?"dep_group":t,toOrder:t=>t,toCellDep:t=>{if(!t)return t;const{outPoint:e,depType:r="code",...n}=t;return{out_point:ur.toOutPoint(e),dep_type:ur.toDepType(r),...n}},toRawTransaction:t=>{if(!t)return t;const{version:e,cellDeps:r=[],inputs:n=[],outputs:i=[],outputsData:a=[],headerDeps:s=[],...o}=t,f=n.map(p=>ur.toInput(p)),c=i.map(p=>ur.toOutput(p)),u=r.map(p=>ur.toCellDep(p));return{version:ur.toNumber(e),cell_deps:u,inputs:f,outputs:c,outputs_data:a,header_deps:s,...o}},toPageNumber:(t="0x1")=>ur.toNumber(t),toPageSize:(t="0x32")=>{const e=H_.BI.from(t),r=50,n=0;if(H_.BI.from(e).gt(r))throw new rl.PageSizeTooLargeException(t,r);if(H_.BI.from(e).lt(n))throw new rl.PageSizeTooSmallException(t,n);return ur.toNumber(`0x${e.toString(16)}`)},toReverseOrder:(t=!1)=>!!t,toOutputsValidator:t=>{if(!t)return;if(["default","passthrough"].indexOf(t)>-1)return t;throw new rl.OutputsValidatorTypeException},toBoolean:t=>!!t,toTransactionProof:t=>{if(!t)return t;const{blockHash:e,witnessesRoot:r,...n}=t;return{block_hash:e,witnesses_root:r,...n}},toTransactionAndWitnessProof:t=>({block_hash:t.blockHash,witnesses_proof:t.witnessesProof,transactions_proof:t.transactionsProof}),toSearchFilter:t=>t&&{script:t.script?ur.toScript(t.script):t.script,output_data_len_range:t.outputDataLenRange,output_capacity_range:t.outputCapacityRange,block_range:t.blockRange,script_len_range:t.scriptLenRange},toSearchKey:t=>t&&{script:ur.toScript(t.script),script_type:t.scriptType,filter:t.filter?ur.toSearchFilter(t.filter):t.filter,script_search_mode:t.scriptSearchMode?t.scriptSearchMode:"prefix"},toGetCellsSearchKey:t=>t&&{...ur.toSearchKey(t),with_data:t.withData},toGetTransactionsSearchKey:t=>t&&{...ur.toSearchKey(t),group_by_transaction:t.groupByTransaction}};var he={};Object.defineProperty(he,"__esModule",{value:!0});he.toBannedAddresses=he.toBannedAddress=he.toArray=he.toAlertMessage=void 0;he.toBlock=JB;he.toHash=he.toGetTransactionsResult=he.toGetCellsResult=he.toForkBlockResult=he.toFeeRateStatistics=he.toFeeRate=he.toEstimateCycles=he.toEpoch=he.toDeploymentsInfo=he.toDeploymentInfo=he.toDeployment=he.toDeployState=he.toDepType=he.toConsensus=he.toCellsIncludingOutPoint=he.toCellsCapacity=he.toCells=he.toCellbaseOutputCapacityDetails=he.toCellIncludingOutPoint=he.toCellDep=he.toCell=he.toCapacityByLockHash=he.toBlockchainInfo=he.toBlockFilter=he.toBlockEconomicState=void 0;he.toHeader=x2;he.toTip=he.toSyncState=he.toScript=he.toRemoteNodeInfo=he.toRawTxPool=he.toPeers=he.toOutput=he.toOutPoint=he.toNumber=he.toNullable=he.toLockHashIndexStates=he.toLockHashIndexState=he.toLocalNodeInfo=he.toLiveCellsByLockHash=he.toLiveCellWithStatus=he.toLiveCell=he.toInput=void 0;he.toTransaction=I2;he.toUncleBlock=he.toTxPoolInfo=he.toTransactionsByLockHash=he.toTransactionWithStatus=he.toTransactionProof=he.toTransactionPoint=he.toTransactionAndWitnessProof=void 0;const zF=t=>Array.isArray(t.pending),$F=t=>e=>typeof t!="function"||!Array.isArray(e)?e:e.map(t);he.toArray=$F;const jF=t=>e=>!t||e===null?e:t(e);he.toNullable=jF;const FF=t=>t.toString();he.toNumber=FF;const qF=t=>t;he.toHash=qF;function x2(t){if(typeof t=="string"||!t)return t;const{compact_target:e,transactions_root:r,proposals_hash:n,extra_hash:i,parent_hash:a,...s}=t;return{compactTarget:e,parentHash:a,transactionsRoot:r,proposalsHash:n,extraHash:i,...s}}const Bd=t=>{if(!t)return t;const{code_hash:e,hash_type:r,...n}=t;return{codeHash:e,hashType:r,...n}};he.toScript=Bd;const WB=t=>{if(!t)return t;const{previous_output:e,...r}=t;return{previousOutput:e&&L1(e),...r}};he.toInput=WB;const S2=t=>{if(!t)return t;const{lock:e,type:r,...n}=t;return{lock:Bd(e),type:r&&Bd(r),...n}};he.toOutput=S2;const L1=t=>{const{tx_hash:e,...r}=t;return{txHash:e,...r}};he.toOutPoint=L1;const XB=t=>t==="dep_group"?"depGroup":t;he.toDepType=XB;const ZB=t=>{if(!t)return t;const{out_point:e,dep_type:r="code",...n}=t;return{outPoint:L1(e),depType:XB(r),...n}};he.toCellDep=ZB;function I2(t){if(!t||typeof t!="object")return t;const{cell_deps:e=[],inputs:r=[],outputs:n=[],outputs_data:i=[],header_deps:a=[],...s}=t;return{cellDeps:e.map(ZB),inputs:r.map(WB),outputs:n.map(S2),outputsData:i,headerDeps:a,...s}}const X8=t=>{if(!t)return t;const{header:e,...r}=t;return{header:x2(e),...r}};he.toUncleBlock=X8;const KF=t=>({blockHash:t.block_hash,blockNumber:t.block_number});he.toTip=KF;function JB(t){if(!t||typeof t=="string")return t;if("block"in t&&"cycles"in t)return{cycles:t.cycles,block:JB(t.block)};const{header:e,uncles:r=[],transactions:n=[],...i}=t;return{header:x2(e),uncles:r.map(X8),transactions:n.map(I2),...i}}const eD=t=>{if(!t)return t;const{notice_until:e,...r}=t;return{noticeUntil:e,...r}};he.toAlertMessage=eD;const QF=t=>{if(!t)return t;const{is_initial_block_download:e,median_time:r,alerts:n,...i}=t;return{isInitialBlockDownload:e,medianTime:r,alerts:n.map(eD),...i}};he.toBlockchainInfo=QF;const YF=t=>{if(!t)return t;const{node_id:e,protocols:r,...n}=t;return{nodeId:e,protocols:r.map(({id:i,name:a,support_versions:s})=>({id:i,name:a,supportVersions:s})),...n}};he.toLocalNodeInfo=YF;const tD=t=>{if(!t)return t;const{node_id:e,connected_duration:r,is_outbound:n,last_ping_duration:i,sync_state:a,...s}=t;return{nodeId:e,connectedDuration:r,isOutbound:n,lastPingDuration:i,syncState:{bestKnownHeaderHash:a.best_known_header_hash,bestKnownHeaderNumber:a.best_known_header_number,canFetchCount:a.can_fetch_count,inflightCount:a.inflight_count,lastCommonHeaderHash:a.last_common_header_hash,lastCommonHeaderNumber:a.last_common_header_number,unknownHeaderListSize:a.unknown_header_list_size},...s}};he.toRemoteNodeInfo=tD;const VF=t=>{if(!t)return t;const{last_txs_updated_at:e,tip_hash:r,tip_number:n,total_tx_cycles:i,total_tx_size:a,min_fee_rate:s,min_rbf_rate:o,tx_size_limit:f,max_tx_pool_size:c,...u}=t;return{lastTxsUpdatedAt:e,tipHash:r,tipNumber:n,totalTxCycles:i,totalTxSize:a,minFeeRate:s,minRbfRate:o,txSizeLimit:f,maxTxPoolSize:c,...u}};he.toTxPoolInfo=VF;const GF=t=>Array.isArray(t)?t.map(tD):[];he.toPeers=GF;const Z8=t=>{if(!t)return t;const{lock:e,type:r,...n}=t;return{lock:Bd(e),type:r?Bd(r):void 0,...n}};he.toCell=Z8;const rD=t=>{if(!t)return t;const{data:e,output:r,...n}=t;return{data:e,output:S2(r),...n}};he.toLiveCell=rD;const WF=t=>{if(!t)return t;const{cell:e,...r}=t;return{cell:rD(e),...r}};he.toLiveCellWithStatus=WF;const XF=t=>Array.isArray(t)?t.map(Z8):[];he.toCells=XF;const nD=t=>{if(!t)return t;const{lock:e,block_hash:r,out_point:n,output_data_len:i,...a}=t;return{blockHash:r,lock:Bd(e),outPoint:L1(n),outputDataLen:i,...a}};he.toCellIncludingOutPoint=nD;const ZF=t=>Array.isArray(t)?t.map(nD):[];he.toCellsIncludingOutPoint=ZF;const JF=t=>{if(!t)return t;const{transaction:e,tx_status:{block_hash:r,status:n},time_added_to_pool:i,min_replace_fee:a,fee:s,...o}=t;return{transaction:I2(e),txStatus:{blockHash:r,status:n,..."reason"in t.tx_status?{reason:t.tx_status.reason}:{}},timeAddedToPool:i,minReplaceFee:a,fee:s,...o}};he.toTransactionWithStatus=JF;const eq=t=>{if(!t)return t;const{start_number:e,compact_target:r,...n}=t;return{compactTarget:r,startNumber:e,...n}};he.toEpoch=eq;const py=t=>{if(!t)return t;const{block_number:e,tx_hash:r,...n}=t;return{blockNumber:e,txHash:r,...n}};he.toTransactionPoint=py;const tq=t=>t&&t.map(e=>({consumedBy:e.consumed_by?py(e.consumed_by):e.consumed_by,createdBy:py(e.created_by)}));he.toTransactionsByLockHash=tq;const rq=t=>t&&t.map(e=>({cellOutput:Z8(e.cell_output),createdBy:py(e.created_by),cellbase:e.cellbase,outputDataLen:e.output_data_len}));he.toLiveCellsByLockHash=rq;const iD=t=>{if(!t)return t;const{block_hash:e,block_number:r,lock_hash:n,...i}=t;return{blockHash:e,blockNumber:r,lockHash:n,...i}};he.toLockHashIndexState=iD;const nq=t=>t&&t.map(iD);he.toLockHashIndexStates=nq;const aD=t=>{if(!t)return t;const{ban_reason:e,ban_until:r,created_at:n,...i}=t;return{banReason:e,banUntil:r,createdAt:n,...i}};he.toBannedAddress=aD;const iq=t=>t&&t.map(e=>aD(e));he.toBannedAddresses=iq;const aq=t=>{if(!t)return t;const{proposal_reward:e,tx_fee:r,...n}=t;return{proposalReward:e,txFee:r,...n}};he.toCellbaseOutputCapacityDetails=aq;const sq=t=>{if(!t)return t;const{fee_rate:e,...r}=t;return{feeRate:e,...r}};he.toFeeRate=sq;const oq=t=>{if(!t)return t;const{cells_count:e,block_number:r,capacity:n,...i}=t;return{blockNumber:r,capacity:n,cellsCount:e,...i}};he.toCapacityByLockHash=oq;const fq=t=>{if(!t)return t;const{finalized_at:e,miner_reward:r,txs_fee:n,...i}=t;return{finalizedAt:e,minerReward:r,txsFee:n,...i}};he.toBlockEconomicState=fq;const cq=t=>t&&{bestKnownBlockNumber:t.best_known_block_number,bestKnownBlockTimestamp:t.best_known_block_timestamp,fastTime:t.fast_time,ibd:t.ibd,inflightBlocksCount:t.inflight_blocks_count,lowTime:t.low_time,normalTime:t.normal_time,orphanBlocksCount:t.orphan_blocks_count};he.toSyncState=cq;const uq=t=>{if(!t)return t;const{block_hash:e,witnesses_root:r,...n}=t;return{blockHash:e,witnessesRoot:r,...n}};he.toTransactionProof=uq;const lq=t=>({rfc:t.rfc,epochNumber:t.epoch_number}),sD=t=>({bit:t.bit,start:t.start,timeout:t.timeout,minActivationEpoch:t.min_activation_epoch,period:t.period,threshold:t.threshold});he.toDeployment=sD;const DA=t=>"rfc0043"in t?{status:t.status,rfc0043:sD(t.rfc0043)}:t,dq=t=>{if(!t)return t;const e=t.hardfork_features,r=t.softforks,n=r.light_client&&DA(r.light_client),i=r.testdummy&&DA(r.testdummy);return{blockVersion:t.block_version,cellbaseMaturity:t.cellbase_maturity,daoTypeHash:t.dao_type_hash,epochDurationTarget:t.epoch_duration_target,genesisHash:t.genesis_hash,id:t.id,initialPrimaryEpochReward:t.initial_primary_epoch_reward,maxBlockBytes:t.max_block_bytes,maxBlockCycles:t.max_block_cycles,maxBlockProposalsLimit:t.max_block_proposals_limit,maxUnclesNum:t.max_uncles_num,medianTimeBlockCount:t.median_time_block_count,orphanRateTarget:t.orphan_rate_target,permanentDifficultyInDummy:t.permanent_difficulty_in_dummy,primaryEpochRewardHalvingInterval:t.primary_epoch_reward_halving_interval,proposerRewardRatio:t.proposer_reward_ratio,secondaryEpochReward:t.secondary_epoch_reward,secp256k1Blake160MultisigAllTypeHash:t.secp256k1_blake160_multisig_all_type_hash,secp256k1Blake160SighashAllTypeHash:t.secp256k1_blake160_sighash_all_type_hash,txProposalWindow:t.tx_proposal_window,txVersion:t.tx_version,typeIdCodeHash:t.type_id_code_hash,hardforkFeatures:e.map(lq),softforks:{...n&&{lightClient:n},...i&&{testdummy:i}}}};he.toConsensus=dq;const hq=t=>{if(!t||zF(t))return t;const e=({ancestors_count:i,ancestors_cycles:a,ancestors_size:s,...o})=>({ancestorsCount:i,ancestorsCycles:a,ancestorsSize:s,...o}),r={},n={};return Object.keys(t.proposed).forEach(i=>{r[i]=e(t.proposed[i])}),Object.keys(t.pending).forEach(i=>{n[i]=e(t.pending[i])}),{proposed:r,pending:n}};he.toRawTxPool=hq;const pq=t=>t&&{blockNumber:t.block_number,outPoint:L1(t.out_point),output:S2(t.output),outputData:t.output_data,txIndex:t.tx_index},bq=t=>({lastCursor:t.last_cursor,objects:t.objects.map(e=>pq(e))});he.toGetCellsResult=bq;const gq=t=>!t.cells,yq=t=>t&&(gq(t)?{txHash:t.tx_hash,blockNumber:t.block_number,ioIndex:t.io_index,ioType:t.io_type,txIndex:t.tx_index}:{txHash:t.tx_hash,txIndex:t.tx_index,blockNumber:t.block_number,cells:t.cells}),vq=t=>t&&{lastCursor:t.last_cursor,objects:t.objects.map(e=>yq(e))};he.toGetTransactionsResult=vq;const _q=t=>t&&{capacity:t.capacity,blockHash:t.block_hash,blockNumber:t.block_number};he.toCellsCapacity=_q;const mq=t=>({hash:t.hash,data:t.data});he.toBlockFilter=mq;const wq=t=>({blockHash:t.block_hash,transactionsProof:t.transactions_proof,witnessesProof:t.witnesses_proof});he.toTransactionAndWitnessProof=wq;const Aq=t=>({mean:t.mean,median:t.median});he.toFeeRateStatistics=Aq;const Eq=t=>typeof t=="string"?t:{header:x2(t.header),uncles:t.uncles.map(X8),transactions:t.transactions.map(I2),proposals:t.proposals,extension:t.extension};he.toForkBlockResult=Eq;const xq=t=>({cycles:t.cycles});he.toEstimateCycles=xq;const oD=t=>t==="locked_in"?"lockedIn":t;he.toDeployState=oD;const t6=t=>({bit:t.bit,start:t.start,timeout:t.timeout,minActivationEpoch:t.min_activation_epoch,period:t.period,threshold:t.threshold,since:t.since,state:oD(t.state)});he.toDeploymentInfo=t6;const Sq=t=>{const{light_client:e,testdummy:r}=t.deployments;return{hash:t.hash,epoch:t.epoch,deployments:{...e?{lightClient:t6(e)}:{},...r?{testdummy:t6(r)}:{}}}};he.toDeploymentsInfo=Sq;Object.defineProperty(A2,"__esModule",{value:!0});A2.default=void 0;var Ln=ef,ti=Iq(he);function fD(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(fD=function(n){return n?r:e})(t)}function Iq(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=fD(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}A2.default={getTipBlockNumber:{method:"get_tip_block_number",paramsFormatters:[],resultFormatters:ti.toNumber},getTipHeader:{method:"get_tip_header",paramsFormatters:[],resultFormatters:ti.toHeader},getCurrentEpoch:{method:"get_current_epoch",paramsFormatters:[],resultFormatters:ti.toEpoch},getEpochByNumber:{method:"get_epoch_by_number",paramsFormatters:[Ln.formatter.toNumber],resultFormatters:ti.toEpoch},getBlockHash:{method:"get_block_hash",paramsFormatters:[Ln.formatter.toNumber]},getBlock:{method:"get_block",paramsFormatters:[Ln.formatter.toHash],resultFormatters:ti.toBlock},getBlockByNumber:{method:"get_block_by_number",paramsFormatters:[Ln.formatter.toNumber],resultFormatters:ti.toBlock},getHeader:{method:"get_header",paramsFormatters:[Ln.formatter.toHash],resultFormatters:ti.toHeader},getHeaderByNumber:{method:"get_header_by_number",paramsFormatters:[Ln.formatter.toNumber],resultFormatters:ti.toHeader},getLiveCell:{method:"get_live_cell",paramsFormatters:[Ln.formatter.toOutPoint],resultFormatters:ti.toLiveCellWithStatus},getTransaction:{method:"get_transaction",paramsFormatters:[Ln.formatter.toHash],resultFormatters:ti.toTransactionWithStatus},getCellbaseOutputCapacityDetails:{method:"get_cellbase_output_capacity_details",paramsFormatters:[Ln.formatter.toHash],resultFormatters:ti.toCellbaseOutputCapacityDetails},getBlockEconomicState:{method:"get_block_economic_state",paramsFormatters:[Ln.formatter.toHash],resultFormatters:ti.toBlockEconomicState},getTransactionProof:{method:"get_transaction_proof",paramsFormatters:[Ln.formatter.toArray(Ln.formatter.toHash),Ln.formatter.toOptional(Ln.formatter.toHash)],resultFormatters:ti.toTransactionProof},verifyTransactionProof:{method:"verify_transaction_proof",paramsFormatters:[Ln.formatter.toTransactionProof]},getConsensus:{method:"get_consensus",paramsFormatters:[],resultFormatters:ti.toConsensus}};var C2={};Object.defineProperty(C2,"__esModule",{value:!0});C2.default=void 0;var P_=ef;C2.default={dryRunTransaction:{method:"dry_run_transaction",paramsFormatters:[P_.formatter.toRawTransaction]},calculateDaoMaximumWithdraw:{method:"calculate_dao_maximum_withdraw",paramsFormatters:[P_.formatter.toOutPoint,P_.formatter.toHash]}};var T2={};Object.defineProperty(T2,"__esModule",{value:!0});T2.default=void 0;var Cq=ef,jb=Tq(he);function cD(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(cD=function(n){return n?r:e})(t)}function Tq(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=cD(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}T2.default={localNodeInfo:{method:"local_node_info",paramsFormatters:[],resultFormatters:jb.toLocalNodeInfo},getPeers:{method:"get_peers",paramsFormatters:[],resultFormatters:jb.toPeers},getBannedAddresses:{method:"get_banned_addresses",paramsFormatters:[],resultFormatters:jb.toBannedAddresses},clearBannedAddresses:{method:"clear_banned_addresses",paramsFormatters:[]},setBan:{method:"set_ban",paramsFormatters:[]},syncState:{method:"sync_state",paramsFormatters:[],resultFormatters:jb.toSyncState},setNetworkActive:{method:"set_network_active",paramsFormatters:[Cq.formatter.toBoolean]},addNode:{method:"add_node",paramsFormatters:[]},removeNode:{method:"remove_node",paramsFormatters:[]},pingPeers:{method:"ping_peers",paramsFormatters:[]}};var O2={};Object.defineProperty(O2,"__esModule",{value:!0});O2.default=void 0;var MA=ef,N_=Oq(he);function uD(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(uD=function(n){return n?r:e})(t)}function Oq(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=uD(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}O2.default={sendTransaction:{method:"send_transaction",paramsFormatters:[MA.formatter.toRawTransaction,MA.formatter.toOutputsValidator],resultFormatters:N_.toHash},txPoolInfo:{method:"tx_pool_info",paramsFormatters:[],resultFormatters:N_.toTxPoolInfo},clearTxPool:{method:"clear_tx_pool",paramsFormatters:[]},getRawTxPool:{method:"get_raw_tx_pool",paramsFormatters:[],resultFormatters:N_.toRawTxPool}};var B2={};Object.defineProperty(B2,"__esModule",{value:!0});B2.default=void 0;var RA=Bq(he);function lD(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(lD=function(n){return n?r:e})(t)}function Bq(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=lD(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}B2.default={getBlockchainInfo:{method:"get_blockchain_info",paramsFormatters:[],resultFormatters:RA.toBlockchainInfo},getDeploymentsInfo:{method:"get_deployments_info",paramsFormatters:[],resultFormatters:RA.toDeploymentsInfo}};var D2={};Object.defineProperty(D2,"__esModule",{value:!0});D2.default=void 0;var vt=ef,Br=Dq(he);function dD(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(dD=function(n){return n?r:e})(t)}function Dq(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=dD(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}const Mq={getIndexerTip:{method:"get_indexer_tip",paramsFormatters:[],resultFormatters:Br.toTip},getCells:{method:"get_cells",paramsFormatters:[vt.formatter.toGetCellsSearchKey,vt.formatter.toOrder,vt.formatter.toNumber,vt.formatter.toOptional(vt.formatter.toHash)],resultFormatters:Br.toGetCellsResult},getTransactions:{method:"get_transactions",paramsFormatters:[vt.formatter.toGetTransactionsSearchKey,vt.formatter.toOrder,vt.formatter.toNumber,vt.formatter.toOptional(vt.formatter.toHash)],resultFormatters:Br.toGetTransactionsResult},getCellsCapacity:{method:"get_cells_capacity",paramsFormatters:[vt.formatter.toSearchKey],resultFormatters:Br.toCellsCapacity},getBlockFilter:{method:"get_block_filter",paramsFormatters:[vt.formatter.toHash],resultFormatters:Br.toNullable(Br.toBlockFilter)},getTransactionAndWitnessProof:{method:"get_transaction_and_witness_proof",paramsFormatters:[vt.formatter.toArray(vt.formatter.toHash),vt.formatter.toOptional(vt.formatter.toHash)],resultFormatters:Br.toTransactionAndWitnessProof},verifyTransactionAndWitnessProof:{method:"verify_transaction_and_witness_proof",paramsFormatters:[vt.formatter.toTransactionAndWitnessProof],resultFormatters:Br.toArray(Br.toHash)},getForkBlock:{method:"get_fork_block",paramsFormatters:[vt.formatter.toHash,vt.formatter.toOptional(vt.formatter.toNumber)],resultFormatters:Br.toNullable(Br.toForkBlockResult)},getBlockMedianTime:{method:"get_block_median_time",paramsFormatters:[vt.formatter.toHash],resultFormatters:Br.toNullable(Br.toNumber)},estimateCycles:{method:"estimate_cycles",paramsFormatters:[vt.formatter.toRawTransaction],resultFormatters:Br.toEstimateCycles},getFeeRateStatistics:{method:"get_fee_rate_statistics",paramsFormatters:[vt.formatter.toOptional(vt.formatter.toNumber)],resultFormatters:Br.toNullable(Br.toFeeRateStatistics)},getFeeRateStatics:{method:"get_fee_rate_statics",paramsFormatters:[vt.formatter.toOptional(vt.formatter.toNumber)],resultFormatters:Br.toNullable(Br.toFeeRateStatistics)}};D2.default=Mq;Object.defineProperty(Od,"__esModule",{value:!0});Od.rpcProperties=Od.Base=void 0;var Rq=b0(A2),Lq=b0(C2),Hq=b0(T2),Pq=b0(O2),Nq=b0(B2),Uq=b0(D2);function b0(t){return t&&t.__esModule?t:{default:t}}const kq=Od.rpcProperties={...Rq.default,...Lq.default,...Uq.default,...Hq.default,...Pq.default,...Nq.default};var ky,Zx;let zq=(Zx=class{constructor(){Be(this,ky,kq)}get rpcProperties(){return se(this,ky)}},ky=new WeakMap,Zx);Od.Base=zq;var ah={},M2={exports:{}};const{AbortController:hD,AbortSignal:$q}=typeof self<"u"?self:typeof window<"u"?window:void 0;M2.exports=hD;M2.exports.AbortSignal=$q;M2.exports.default=hD;var pD=M2.exports,r6={exports:{}};(function(t,e){var r=typeof self<"u"?self:Fn,n=function(){function a(){this.fetch=!1,this.DOMException=r.DOMException}return a.prototype=r,new a}();(function(a){(function(s){var o={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function f(b){return b&&DataView.prototype.isPrototypeOf(b)}if(o.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(b){return b&&c.indexOf(Object.prototype.toString.call(b))>-1};function l(b){if(typeof b!="string"&&(b=String(b)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(b))throw new TypeError("Invalid character in header field name");return b.toLowerCase()}function p(b){return typeof b!="string"&&(b=String(b)),b}function y(b){var v={next:function(){var d=b.shift();return{done:d===void 0,value:d}}};return o.iterable&&(v[Symbol.iterator]=function(){return v}),v}function m(b){this.map={},b instanceof m?b.forEach(function(v,d){this.append(d,v)},this):Array.isArray(b)?b.forEach(function(v){this.append(v[0],v[1])},this):b&&Object.getOwnPropertyNames(b).forEach(function(v){this.append(v,b[v])},this)}m.prototype.append=function(b,v){b=l(b),v=p(v);var d=this.map[b];this.map[b]=d?d+", "+v:v},m.prototype.delete=function(b){delete this.map[l(b)]},m.prototype.get=function(b){return b=l(b),this.has(b)?this.map[b]:null},m.prototype.has=function(b){return this.map.hasOwnProperty(l(b))},m.prototype.set=function(b,v){this.map[l(b)]=p(v)},m.prototype.forEach=function(b,v){for(var d in this.map)this.map.hasOwnProperty(d)&&b.call(v,this.map[d],d,this)},m.prototype.keys=function(){var b=[];return this.forEach(function(v,d){b.push(d)}),y(b)},m.prototype.values=function(){var b=[];return this.forEach(function(v){b.push(v)}),y(b)},m.prototype.entries=function(){var b=[];return this.forEach(function(v,d){b.push([d,v])}),y(b)},o.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function A(b){if(b.bodyUsed)return Promise.reject(new TypeError("Already read"));b.bodyUsed=!0}function S(b){return new Promise(function(v,d){b.onload=function(){v(b.result)},b.onerror=function(){d(b.error)}})}function w(b){var v=new FileReader,d=S(v);return v.readAsArrayBuffer(b),d}function C(b){var v=new FileReader,d=S(v);return v.readAsText(b),d}function O(b){for(var v=new Uint8Array(b),d=new Array(v.length),g=0;g-1?v:b}function k(b,v){v=v||{};var d=v.body;if(b instanceof k){if(b.bodyUsed)throw new TypeError("Already read");this.url=b.url,this.credentials=b.credentials,v.headers||(this.headers=new m(b.headers)),this.method=b.method,this.mode=b.mode,this.signal=b.signal,!d&&b._bodyInit!=null&&(d=b._bodyInit,b.bodyUsed=!0)}else this.url=String(b);if(this.credentials=v.credentials||this.credentials||"same-origin",(v.headers||!this.headers)&&(this.headers=new m(v.headers)),this.method=Q(v.method||this.method||"GET"),this.mode=v.mode||this.mode||null,this.signal=v.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&d)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(d)}k.prototype.clone=function(){return new k(this,{body:this._bodyInit})};function G(b){var v=new FormData;return b.trim().split("&").forEach(function(d){if(d){var g=d.split("="),x=g.shift().replace(/\+/g," "),E=g.join("=").replace(/\+/g," ");v.append(decodeURIComponent(x),decodeURIComponent(E))}}),v}function W(b){var v=new m,d=b.replace(/\r?\n[\t ]+/g," ");return d.split(/\r?\n/).forEach(function(g){var x=g.split(":"),E=x.shift().trim();if(E){var h=x.join(":").trim();v.append(E,h)}}),v}U.call(k.prototype);function R(b,v){v||(v={}),this.type="default",this.status=v.status===void 0?200:v.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in v?v.statusText:"OK",this.headers=new m(v.headers),this.url=v.url||"",this._initBody(b)}U.call(R.prototype),R.prototype.clone=function(){return new R(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},R.error=function(){var b=new R(null,{status:0,statusText:""});return b.type="error",b};var _=[301,302,303,307,308];R.redirect=function(b,v){if(_.indexOf(v)===-1)throw new RangeError("Invalid status code");return new R(null,{status:v,headers:{location:b}})},s.DOMException=a.DOMException;try{new s.DOMException}catch{s.DOMException=function(v,d){this.message=v,this.name=d;var g=Error(v);this.stack=g.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function I(b,v){return new Promise(function(d,g){var x=new k(b,v);if(x.signal&&x.signal.aborted)return g(new s.DOMException("Aborted","AbortError"));var E=new XMLHttpRequest;function h(){E.abort()}E.onload=function(){var T={status:E.status,statusText:E.statusText,headers:W(E.getAllResponseHeaders()||"")};T.url="responseURL"in E?E.responseURL:T.headers.get("X-Request-URL");var $="response"in E?E.response:E.responseText;d(new R($,T))},E.onerror=function(){g(new TypeError("Network request failed"))},E.ontimeout=function(){g(new TypeError("Network request failed"))},E.onabort=function(){g(new s.DOMException("Aborted","AbortError"))},E.open(x.method,x.url,!0),x.credentials==="include"?E.withCredentials=!0:x.credentials==="omit"&&(E.withCredentials=!1),"responseType"in E&&o.blob&&(E.responseType="blob"),x.headers.forEach(function(T,$){E.setRequestHeader($,T)}),x.signal&&(x.signal.addEventListener("abort",h),E.onreadystatechange=function(){E.readyState===4&&x.signal.removeEventListener("abort",h)}),E.send(typeof x._bodyInit>"u"?null:x._bodyInit)})}return I.polyfill=!0,a.fetch||(a.fetch=I,a.Headers=m,a.Request=k,a.Response=R),s.Headers=m,s.Request=k,s.Response=R,s.fetch=I,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(r6,r6.exports);var bD=r6.exports,LA;function jq(){var s,o,f,c;if(LA)return ah;LA=1,Object.defineProperty(ah,"__esModule",{value:!0}),ah.Method=void 0;var t=E2,e=R2(),r=i(pD),n=i(bD);function i(u){return u&&u.__esModule?u:{default:u}}class a{constructor(l,p,y={}){Be(this,s);Be(this,o);Be(this,f,{name:"",method:"",paramsFormatters:[],resultFormatters:void 0});Be(this,c);Vr(this,"call",async(...l)=>{const p=this.getPayload(...l),y=new r.default,m=y.signal,A=setTimeout(()=>y.abort(),se(this,o).timeout),S=await se(this,o).fetch(se(this,c).url,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(p),signal:m}).then(w=>w.json()).then(w=>{var C,O,M;if(w.id!==p.id)throw new t.IdNotMatchException(p.id,w.id);if(w.error)throw new t.ResponseException(JSON.stringify(w.error));return(C=(O=(M=se(this,f)).resultFormatters)===null||O===void 0?void 0:O.call(M,w.result))!==null&&C!==void 0?C:w.result});return clearTimeout(A),S});Vr(this,"getPayload",(...l)=>{const p=l.map((A,S)=>se(this,f).paramsFormatters[S]&&se(this,f).paramsFormatters[S](A)||A);return{id:Math.round(Math.random()*1e4),method:se(this,f).method,params:p,jsonrpc:"2.0"}});ve(this,c,l),ve(this,f,p),ve(this,s,p.name);const{timeout:m=e.DEFAULT_RPC_TIMEOUT,fetch:A=n.default}=y;ve(this,o,{timeout:m,fetch:A}),Object.defineProperty(this.call,"name",{value:p.name,configurable:!1,writable:!1})}get name(){return se(this,s)}}return s=new WeakMap,o=new WeakMap,f=new WeakMap,c=new WeakMap,ah.Method=a,ah}var HA;function R2(){var p,y,m,A;if(HA)return yi;HA=1,Object.defineProperty(yi,"__esModule",{value:!0}),yi.ResultFormatter=yi.RPC=yi.ParamsFormatter=yi.DEFAULT_RPC_TIMEOUT=yi.CKBRPC=void 0;var t=Od,e=jq(),r=ef,n=c(he),i=E2,a=o(bD),s=o(pD);function o(S){return S&&S.__esModule?S:{default:S}}function f(S){if(typeof WeakMap!="function")return null;var w=new WeakMap,C=new WeakMap;return(f=function(O){return O?C:w})(S)}function c(S,w){if(S&&S.__esModule)return S;if(S===null||typeof S!="object"&&typeof S!="function")return{default:S};var C=f(w);if(C&&C.has(S))return C.get(S);var O={__proto__:null},M=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var U in S)if(U!=="default"&&{}.hasOwnProperty.call(S,U)){var K=M?Object.getOwnPropertyDescriptor(S,U):null;K&&(K.get||K.set)?Object.defineProperty(O,U,K):O[U]=S[U]}return O.default=S,C&&C.set(S,O),O}yi.ParamsFormatter=r.formatter,yi.ResultFormatter=n;const u=yi.DEFAULT_RPC_TIMEOUT=3e4;class l extends t.Base{constructor(C,O={}){super();Be(this,p);Be(this,y,{url:""});Be(this,m,r.formatter);Be(this,A,n);Vr(this,"addMethod",(C,O)=>{const M=new e.Method(this.node,C,O);Object.defineProperty(this,C.name,{value:M.call,enumerable:!0})});Vr(this,"createBatchRequest",(C=[])=>{const O=this,M=new Proxy([],{set(...U){const K=Object.keys(O);if(U[1]!=="length"){var Q;const k=U==null||(Q=U[2])===null||Q===void 0?void 0:Q[0];if(K.indexOf(k)===-1)throw new i.MethodInBatchNotFoundException(k)}return Reflect.set(...U)}});return Object.defineProperties(M,{add:{value(...U){return this.push(U),this}},remove:{value(U){return this.splice(U,1),this}},exec:{async value(){const U=M.map(([W,...R],_)=>{try{return new e.Method(O.node,{...O.rpcProperties[W],name:W}).getPayload(...R)}catch(I){throw new i.PayloadInBatchException(_,I.message)}}),K=new s.default,Q=K.signal,k=setTimeout(()=>K.abort(),se(O,p).timeout),G=await se(O,p).fetch(se(O,y).url,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(U),signal:Q}).then(W=>W.json());return clearTimeout(k),G.map((W,R)=>{var _,I,b;return W.id!==U[R].id?new i.IdNotMatchedInBatchException(R,U[R].id,W.id):(_=(I=(b=O.rpcProperties[M[R][0]]).resultFormatters)===null||I===void 0?void 0:I.call(b,W.result))!==null&&_!==void 0?_:W.result})}}}),C.forEach(U=>M.push(U)),M});this.setNode({url:C});const{timeout:M=u,fetch:U=a.default}=O;ve(this,p,{timeout:M,fetch:U}),Object.defineProperties(this,{addMethod:{value:this.addMethod,enumerable:!1,writable:!1,configurable:!1},setNode:{value:this.setNode,enumerable:!1,writable:!1,configurable:!1}}),Object.keys(this.rpcProperties).forEach(K=>{this.addMethod({name:K,...this.rpcProperties[K]},se(this,p))})}get node(){return se(this,y)}get paramsFormatter(){return se(this,m)}get resultFormatter(){return se(this,A)}setNode(C){return Object.assign(this.node,C),this.node}}return p=new WeakMap,y=new WeakMap,m=new WeakMap,A=new WeakMap,yi.RPC=yi.CKBRPC=l,yi}var U_=R2();async function gD(t,e=qq(t),r=!1,...n){const i=Kq(e);let a=Vq(t==="mainnet"?Nr.predefined.LINA:t==="testnet"?Nr.predefined.AGGRON4:{PREFIX:"ckt",SCRIPTS:Nr.generateGenesisScriptConfigs(await i.getBlockByNumber("0x0"))}),s=a.SCRIPTS;for(const o of n)s=Object.freeze({...s,...o(t,s)});return a=new yD(a.prefix,s),Nr.initializeConfig(r?{PREFIX:"",SCRIPTS:{}}:a),{chain:t,rpcUrl:e,rpc:i,config:a}}const Fq=Object.freeze({mainnet:"https://rpc.ankr.com/nervos_ckb",testnet:"https://testnet.ckb.dev",devnet:"http://127.0.0.1:8114/"});function qq(t){return Fq[t]}function Kq(t){const e=new U_.RPC(t);return e.addMethod({name:"getCellsByLock",method:"get_cells",paramsFormatters:[r=>({script:{code_hash:r.codeHash,hash_type:r.hashType,args:r.args},script_type:"lock",script_search_mode:"exact"}),r=>r,r=>r==="max"?"0xffffffff":U_.ParamsFormatter.toNumber(r)],resultFormatters:r=>r.objects.map(({output:{capacity:n,lock:i,type:a},block_number:s,out_point:o,output_data:f,tx_index:c})=>({cellOutput:{capacity:n,lock:{codeHash:i.code_hash,hashType:i.hash_type,args:i.args},type:a?{codeHash:a.code_hash,hashType:a.hash_type,args:a.args}:void 0},data:f??"0x",outPoint:{index:o.index,txHash:o.tx_hash},blockNumber:s,txIndex:c}))}),e.addMethod({name:"getFeeRate",method:"get_fee_rate_statistics",paramsFormatters:[r=>U_.ParamsFormatter.toNumber(r)],resultFormatters:r=>!r||!r.median?1000n:BigInt(r.median)}),e}class J8 extends Error{constructor(e){super(Qq),this.missingScriptName=e,Object.setPrototypeOf(this,J8.prototype)}}const Qq="Script name not found";class yD{constructor(e,r){return this.prefix=e,this.scripts=Object.freeze(r),Object.freeze(this)}defaultScript(e){const r=this.scripts[e];if(!r)throw new J8(e);return r.defaultScript}get PREFIX(){return this.prefix}get SCRIPTS(){return this.scripts}}class tp{constructor(e,r=0){return e[Oi][r].depType,this.defaultScript=e,this.index=r,Object.freeze(this)}get CODE_HASH(){return this.defaultScript.codeHash}get HASH_TYPE(){return this.defaultScript.hashType}get TX_HASH(){return this.defaultScript[Oi][this.index].outPoint.txHash}get INDEX(){return this.defaultScript[Oi][this.index].outPoint.index}get DEP_TYPE(){return this.defaultScript[Oi][this.index].depType}}function Yq(t){if(t instanceof tp)return t;const e=lu.from({outPoint:Fo.from({txHash:t.TX_HASH,index:t.INDEX}),depType:t.DEP_TYPE});return new tp(xn.from({...va,codeHash:t.CODE_HASH,hashType:t.HASH_TYPE,[Oi]:[e]}))}function Vq(t){const e={};for(const r in t.SCRIPTS)e[r]=Yq(t.SCRIPTS[r]);return new yD(t.PREFIX,e)}var Hn={},Dn={},lt={};Object.defineProperty(lt,"__esModule",{value:!0});lt.SECP_SIGNATURE_PLACEHOLDER=void 0;lt.addCellDep=vD;lt.default=void 0;lt.ensureScript=CD;lt.generateDaoScript=_D;lt.hashWitness=yg;lt.isAcpAddress=SD;lt.isAcpScript=r5;lt.isDaoScript=ED;lt.isOmnilockAddress=Jq;lt.isOmnilockScript=wD;lt.isSecp256k1Blake160Address=mD;lt.isSecp256k1Blake160MultisigAddress=AD;lt.isSecp256k1Blake160MultisigScript=t5;lt.isSecp256k1Blake160Script=e5;lt.isSudtScript=xD;lt.prepareSigningEntries=ID;var Gq=Jo,H1=pi(),PA=st,$l=Ir,Wq=r0;const{CKBHasher:Xq,ckbHash:Zq}=$l.utils;function vD(t,e){return t.get("cellDeps").find(n=>n.depType===e.depType&&new $l.values.OutPointValue(n.outPoint,{validate:!1}).equals(new $l.values.OutPointValue(e.outPoint,{validate:!1})))||(t=t.update("cellDeps",n=>n.push({outPoint:e.outPoint,depType:e.depType}))),t}function _D(t){const e=t.SCRIPTS.DAO;return{codeHash:e.CODE_HASH,hashType:e.HASH_TYPE,args:"0x"}}function e5(t,e){const r=e.SCRIPTS.SECP256K1_BLAKE160;return t.codeHash===r.CODE_HASH&&t.hashType===r.HASH_TYPE}function mD(t,e){const r=(0,H1.parseAddress)(t,{config:e});return e5(r,e)}function wD(t,e){const r=e.SCRIPTS.OMNILOCK;return t.codeHash===r.CODE_HASH&&t.hashType===r.HASH_TYPE}function Jq(t,e){const r=(0,H1.parseAddress)(t,{config:e});return wD(r,e)}function t5(t,e){const r=e.SCRIPTS.SECP256K1_BLAKE160_MULTISIG;return t.codeHash===r.CODE_HASH&&t.hashType===r.HASH_TYPE}function AD(t,e){const r=(0,H1.parseAddress)(t,{config:e});return t5(r,e)}function ED(t,e){const r=e.SCRIPTS.DAO;return!!t&&t.codeHash===r.CODE_HASH&&t.hashType===r.HASH_TYPE}function xD(t,e){const r=e.SCRIPTS.SUDT;if(!r)throw new Error("SUDT script not defined in config!");return!!t&&t.codeHash===r.CODE_HASH&&t.hashType===r.HASH_TYPE}function r5(t,e){const r=e.SCRIPTS.ANYONE_CAN_PAY;if(!r)throw new Error("ANYONE_CAN_PAY script not defined in config!");return!!t&&t.codeHash===r.CODE_HASH&&t.hashType===r.HASH_TYPE}function SD(t,e){const r=(0,H1.parseAddress)(t,{config:e});return r5(r,e)}function yg(t,e){const r=PA.bytes.hexify(Wq.Uint64.pack(PA.bytes.bytify(e).length));t.update(r),t.update(e)}function ID(t,e,r){const n=e.SCRIPTS[r];if(!n)throw new Error(`Provided config does not have ${r} script setup!`);let i=(0,Gq.Set)();const a=(0,H1.createTransactionFromSkeleton)(t),s=Zq($l.blockchain.RawTransaction.pack(a)),o=t.get("inputs"),f=t.get("witnesses");let c=t.get("signingEntries");for(let u=0;u=f.size)throw new Error(`The first witness in the script group starting at input index ${u} does not exist, maybe some other part has invalidly tampered the transaction?`);yg(y,f.get(u));for(let A=u+1;A255)throw new Error("`R` should be less than 256!");if(e<0||e>255)throw new Error("`M` should be less than 256!");return"0x00"+("00"+t.toString(16)).slice(-2)+("00"+e.toString(16)).slice(-2)+("00"+r.length.toString(16)).slice(-2)+r.map(n=>n.slice(2)).join("")}function OD(t,e){let r="0x";return e!=null&&(r=UA.bytes.hexify(UA.number.Uint64LE.pack(e))),new rK().update(t).digestHex().slice(0,42)+r.slice(2)}function iK(t,{config:e=void 0}={}){e=e||(0,tK.getConfig)();let r,n,i,a;if(typeof t=="string")r=(0,NA.parseAddress)(t,{config:e});else if("R"in t){const s=e.SCRIPTS.SECP256K1_BLAKE160_MULTISIG;if(!s)throw new Error("Provided config does not have SECP256K1_BLAKE16_MULTISIG script setup!");n=TD(t);const o=OD(n,t.since);r={codeHash:s.CODE_HASH,hashType:s.HASH_TYPE,args:o}}else if("address"in t){const s=e.SCRIPTS.ANYONE_CAN_PAY;if(!s)throw new Error("Provided config does not have ANYONE_CAN_PAY script setup!");const o=t.address;if(r=(0,NA.parseAddress)(o,{config:e}),i=t.destroyable,r.codeHash!==s.CODE_HASH||r.hashType!==s.HASH_TYPE)throw new Error("fromInfo.address is not ANYONE_CAN_PAY address!")}else if("script"in t)r=t.script,a=t.customData;else throw new Error("Invalid fromInfo format!");return{fromScript:r,multisigScript:n,destroyable:i,customData:a}}Object.defineProperty(Dn,"__esModule",{value:!0});Dn.default=Dn.CellCollector=void 0;Dn.injectCapacity=RD;Dn.payFee=MD;Dn.prepareSigningEntries=LD;Dn.setupInputCell=BD;Dn.transfer=DD;Dn.transferCompatible=P1;var aK=Jo,Fb=pi(),jl=st,Pp=Ir,g0=Nr,Jf=lt,sK=ei,xf=wt;const{ScriptValue:Sl}=Pp.values,oK=Dn.CellCollector=class{constructor(e,r,{config:n=void 0,queryOptions:i={}}={}){if(!r)throw new Error("Cell provider is missing!");n=n||(0,g0.getConfig)(),this.fromScript=(0,sK.parseFromInfo)(e,{config:n}).fromScript,this.config=n,i={...i,lock:this.fromScript,type:i.type||"empty"},this.cellCollector=r.collector(i)}async*collect(){if((0,Jf.isSecp256k1Blake160Script)(this.fromScript,this.config))for await(const e of this.cellCollector.collect())yield e}};async function BD(t,e,r,{config:n=void 0,defaultWitness:i="0x",since:a=void 0}={}){n=n||(0,g0.getConfig)();const s=e.cellOutput.lock;if(!(0,Jf.isSecp256k1Blake160Script)(s,n))throw new Error("Not SECP256K1_BLAKE160 input!");t=t.update("inputs",l=>l.push(e));const o={cellOutput:{capacity:e.cellOutput.capacity,lock:e.cellOutput.lock,type:e.cellOutput.type},data:e.data};t=t.update("outputs",l=>l.push(o)),a&&(t=t.update("inputSinces",l=>l.set(t.get("inputs").size-1,a))),t=t.update("witnesses",l=>l.push(i));const f=n.SCRIPTS.SECP256K1_BLAKE160;if(!f)throw new Error("SECP256K1_BLAKE160 script not defined in config!");const c={txHash:f.TX_HASH,index:f.INDEX};t=(0,Jf.addCellDep)(t,{outPoint:c,depType:f.DEP_TYPE});const u=t.get("inputs").findIndex(l=>new Sl(l.cellOutput.lock,{validate:!1}).equals(new Sl(s,{validate:!1})));if(u!==-1){for(;u>=t.get("witnesses").size;)t=t.update("witnesses",y=>y.push("0x"));let l=t.get("witnesses").get(u);const p={lock:Jf.SECP_SIGNATURE_PLACEHOLDER};if(l!=="0x"){const y=Pp.blockchain.WitnessArgs.unpack(jl.bytes.bytify(l)),m=y.lock;if(m&&p.lock&&!jl.bytes.equal(m,p.lock))throw new Error("Lock field in first witness is set aside for signature!");const A=y.inputType;A&&(p.inputType=A);const S=y.outputType;S&&(p.outputType=S)}l=jl.bytes.hexify(Pp.blockchain.WitnessArgs.pack(p)),t=t.update("witnesses",y=>y.set(u,l))}return t}async function DD(t,e,r,n,{config:i=void 0,requireToAddress:a=!0,assertAmountEnough:s=!0}={}){const o=await P1(t,e,r,n,{config:i,requireToAddress:a,assertAmountEnough:s});let f,c;return o instanceof Array?(f=o[0],c=BigInt(o[1].toString()),[f,c]):(f=o,f)}async function P1(t,e,r,n,{config:i=void 0,requireToAddress:a=!0,assertAmountEnough:s=!0}={}){i=i||(0,g0.getConfig)();const o=i.SCRIPTS.SECP256K1_BLAKE160;if(!o)throw new Error("Provided config does not have SECP256K1_BLAKE160 script setup!");const f={txHash:o.TX_HASH,index:o.INDEX};t=(0,Jf.addCellDep)(t,{outPoint:f,depType:o.DEP_TYPE});const c=(0,Fb.parseAddress)(e,{config:i});if((0,Jf.ensureScript)(c,i,"SECP256K1_BLAKE160"),a&&!r)throw new Error("You must provide a to address!");let u=xf.BI.from(n);if(r){const m=(0,Fb.parseAddress)(r,{config:i});t=t.update("outputs",A=>A.push({cellOutput:{capacity:"0x"+u.toString(16),lock:m,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0}))}const l=t.get("fixedEntries").filter(({field:m})=>m==="outputs").maxBy(({index:m})=>m);let p=l?l.index+1:0;for(;pm.filter(A=>!xf.BI.from(A.cellOutput.capacity).eq(0))),u.gt(0)){const m=t.get("cellProvider");if(!m)throw new Error("Cell provider is missing!");const A=m.collector({lock:c}),S={cellOutput:{capacity:"0x0",lock:c,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0};let w=xf.BI.from(0),C=(0,aK.Set)();for(const O of t.get("inputs"))C=C.add(`${O.outPoint.txHash}_${O.outPoint.index}`);for await(const O of A.collect()){if(C.has(`${O.outPoint.txHash}_${O.outPoint.index}`))continue;t=t.update("inputs",K=>K.push(O)),t=t.update("witnesses",K=>K.push("0x"));const M=xf.BI.from(O.cellOutput.capacity);let U=M;if(U.gt(u)&&(U=u),u=u.sub(U),w=w.add(M).sub(U),u.eq(0)&&(w.eq(0)||w.gt((0,Fb.minimalCellCapacityCompatible)(S))))break}w.gt(0)&&(S.cellOutput.capacity="0x"+w.toString(16),t=t.update("outputs",O=>O.push(S)))}if(u.gt(0)&&s)throw new Error("Not enough capacity in from address!");const y=t.get("inputs").findIndex(m=>new Sl(m.cellOutput.lock,{validate:!1}).equals(new Sl(c,{validate:!1})));if(y!==-1){for(;y>=t.get("witnesses").size;)t=t.update("witnesses",S=>S.push("0x"));let m=t.get("witnesses").get(y);const A={lock:Jf.SECP_SIGNATURE_PLACEHOLDER};if(m!=="0x"){const S=Pp.blockchain.WitnessArgs.unpack(jl.bytes.bytify(m)),w=S.lock;if(w&&A.lock&&!jl.bytes.equal(w,A.lock))throw new Error("Lock field in first witness is set aside for signature!");const C=S.inputType;C&&(A.inputType=C);const O=S.outputType;O&&(A.outputType=O)}m=jl.bytes.hexify(Pp.blockchain.WitnessArgs.pack(A)),t=t.update("witnesses",S=>S.set(y,m))}return s?t:[t,xf.BI.from(u)]}async function MD(t,e,r,{config:n=void 0}={}){return n=n||(0,g0.getConfig)(),await P1(t,e,null,r,{config:n,requireToAddress:!1})}async function RD(t,e,r,{config:n=void 0}={}){if(n=n||(0,g0.getConfig)(),e>=t.get("outputs").size)throw new Error("Invalid output index!");const i=xf.BI.from(t.get("outputs").get(e).cellOutput.capacity);return await P1(t,r,null,xf.BI.from(i),{config:n,requireToAddress:!1})}function LD(t,{config:e=void 0}={}){return e=e||(0,g0.getConfig)(),(0,Jf.prepareSigningEntries)(t,e,"SECP256K1_BLAKE160")}Dn.default={transfer:DD,transferCompatible:P1,payFee:MD,prepareSigningEntries:LD,injectCapacity:RD,setupInputCell:BD,CellCollector:oK};var N1={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.CellCollector=void 0,t.injectCapacity=A,Object.defineProperty(t,"multisigArgs",{enumerable:!0,get:function(){return o.multisigArgs}}),t.payFee=m,t.prepareSigningEntries=S,Object.defineProperty(t,"serializeMultisigScript",{enumerable:!0,get:function(){return o.serializeMultisigScript}}),t.setupInputCell=l,t.transfer=p,t.transferCompatible=y;var e=pi(),r=st,n=Ir,i=Nr,a=Jo,s=lt,o=ei,f=wt;const{ScriptValue:c}=n.values,u=t.CellCollector=class{constructor(C,O,{config:M=void 0,queryOptions:U={}}={}){if(!O)throw new Error("Cell provider is missing!");M=M||(0,i.getConfig)();const K=(0,o.parseFromInfo)(C,{config:M});this.fromScript=K.fromScript,this.multisigScript=K.multisigScript,this.config=M,U={...U,lock:this.fromScript,type:U.type||"empty"},this.cellCollector=O.collector(U)}async*collect(){if((0,s.isSecp256k1Blake160MultisigScript)(this.fromScript,this.config))for await(const C of this.cellCollector.collect())yield C}};async function l(w,C,O,{config:M=void 0,defaultWitness:U="0x",since:K=void 0,requireMultisigScript:Q=!0}={}){if(M=M||(0,i.getConfig)(),Q&&typeof O!="object")throw new Error("`fromInfo` must be MultisigScript format!");const k=C.cellOutput.lock;if(O){const I=(0,o.parseFromInfo)(O,{config:M}).fromScript;if(!new c(I,{validate:!1}).equals(new c(k,{validate:!1})))throw new Error("`fromInfo` not match to input lock!")}if(!(0,s.isSecp256k1Blake160MultisigScript)(k,M))throw new Error("Not SECP256K1_BLAKE160_MULTISIG input!");w=w.update("inputs",I=>I.push(C)),K&&(w=w.update("inputSinces",I=>I.set(w.get("inputs").size-1,K))),w=w.update("witnesses",I=>I.push(U));const G={cellOutput:{capacity:C.cellOutput.capacity,lock:C.cellOutput.lock,type:C.cellOutput.type},data:C.data};w=w.update("outputs",I=>I.push(G));const W=M.SCRIPTS.SECP256K1_BLAKE160_MULTISIG;if(!W)throw new Error("SECP256K1_BLAKE160_MULTISIG script not defined in config!");const R={txHash:W.TX_HASH,index:W.INDEX};w=(0,s.addCellDep)(w,{outPoint:R,depType:W.DEP_TYPE});const _=w.get("inputs").findIndex(I=>new c(I.cellOutput.lock,{validate:!1}).equals(new c(k,{validate:!1})));if(_!==-1){for(;_>=w.get("witnesses").size;)w=w.update("witnesses",b=>b.push("0x"));if(w.get("witnesses").get(_)==="0x"&&typeof O!="object")throw new Error("`fromInfo` must be MultisigScript format!");if(typeof O=="object"){const b=(0,o.parseFromInfo)(O,{config:M}).multisigScript;let v=w.get("witnesses").get(_);const d={lock:"0x"+b.slice(2)+s.SECP_SIGNATURE_PLACEHOLDER.slice(2).repeat(O.M)};if(v!=="0x"){const g=n.blockchain.WitnessArgs.unpack(r.bytes.bytify(v)),x=g.lock;if(x&&d.lock&&!r.bytes.equal(x,d.lock))throw new Error("Lock field in first witness is set aside for signature!");const E=g.inputType;E&&(d.inputType=E);const h=g.outputType;h&&(d.outputType=h)}v=r.bytes.hexify(n.blockchain.WitnessArgs.pack(d)),w=w.update("witnesses",g=>g.set(_,v))}}return w}async function p(w,C,O,M,{config:U=void 0,requireToAddress:K=!0,assertAmountEnough:Q=!0}={}){const k=await y(w,C,O,M,{config:U,requireToAddress:K,assertAmountEnough:Q});let G,W;return k instanceof Array?(G=k[0],W=BigInt(k[1].toString()),[G,W]):(G=k,G)}async function y(w,C,O,M,{config:U=void 0,requireToAddress:K=!0,assertAmountEnough:Q=!0}={}){U=U||(0,i.getConfig)();const k=U.SCRIPTS.SECP256K1_BLAKE160_MULTISIG;if(!k)throw new Error("Provided config does not have SECP256K1_BLAKE16_MULTISIG script setup!");const G={txHash:k.TX_HASH,index:k.INDEX};w=(0,s.addCellDep)(w,{outPoint:G,depType:k.DEP_TYPE});const{fromScript:W,multisigScript:R}=(0,o.parseFromInfo)(C,{config:U});(0,s.ensureScript)(W,U,"SECP256K1_BLAKE160_MULTISIG");const _=!w.get("inputs").find(g=>new c(g.cellOutput.lock,{validate:!1}).equals(new c(W,{validate:!1})));if(_&&C==="string")throw new Error("MultisigScript is required for witness!");if(K&&!O)throw new Error("You must provide a to address!");let I=M?f.BI.from(M):f.BI.from(0);if(O){const g=(0,e.parseAddress)(O,{config:U});w=w.update("outputs",x=>x.push({cellOutput:{capacity:"0x"+I.toString(16),lock:g,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0}))}const b=w.get("fixedEntries").filter(({field:g})=>g==="outputs").maxBy(({index:g})=>g);let v=b?b.index+1:0;for(;vg.filter(x=>!f.BI.from(x.cellOutput.capacity).eq(0))),I.gt(0)){const g=w.get("cellProvider");if(!g)throw new Error("cell provider is missing!");const x=g.collector({lock:W}),E={cellOutput:{capacity:"0x0",lock:W,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0};let h=f.BI.from(0),T=(0,a.Set)();for(const $ of w.get("inputs"))T=T.add(`${$.outPoint.txHash}_${$.outPoint.index}`);for await(const $ of x.collect()){if(T.has(`${$.outPoint.txHash}_${$.outPoint.index}`))continue;w=w.update("inputs",F=>F.push($)),w=w.update("witnesses",F=>F.push("0x"));const L=f.BI.from($.cellOutput.capacity);let j=L;if(j.gt(I)&&(j=I),I=I.sub(j),h=h.add(L.sub(j)),I.eq(0)&&(h.eq(0)||h.gt((0,e.minimalCellCapacityCompatible)(E))))break}h.gt(0)&&(E.cellOutput.capacity="0x"+h.toString(16),w=w.update("outputs",$=>$.push(E)))}if(I.gt(0)&&Q)throw new Error("Not enough capacity in from address!");const d=w.get("inputs").findIndex(g=>new c(g.cellOutput.lock,{validate:!1}).equals(new c(W,{validate:!1})));if(d!==-1){for(;f.BI.from(d).gte(w.get("witnesses").size);)w=w.update("witnesses",g=>g.push("0x"));if(_||typeof C!="string"){let g=w.get("witnesses").get(d);const x={lock:"0x"+R.slice(2)+s.SECP_SIGNATURE_PLACEHOLDER.slice(2).repeat(C.M)};if(g!=="0x"){const E=n.blockchain.WitnessArgs.unpack(r.bytes.bytify(g)),h=E.lock;if(h&&x.lock&&!r.bytes.equal(h,x.lock))throw new Error("Lock field in first witness is set aside for signature!");const T=E.inputType;T&&(x.inputType=T);const $=E.outputType;$&&(x.outputType=$)}g=r.bytes.hexify(n.blockchain.WitnessArgs.pack(x)),w=w.update("witnesses",E=>E.set(d,g))}}return Q?w:[w,f.BI.from(I)]}async function m(w,C,O,{config:M=void 0}={}){return M=M||(0,i.getConfig)(),y(w,C,void 0,O,{config:M,requireToAddress:!1})}async function A(w,C,O,{config:M=void 0}={}){if(M=M||(0,i.getConfig)(),C>=w.get("outputs").size)throw new Error("Invalid output index!");const U=f.BI.from(w.get("outputs").get(C).cellOutput.capacity);return y(w,O,void 0,U,{config:M,requireToAddress:!1})}function S(w,{config:C=void 0}={}){return C=C||(0,i.getConfig)(),(0,s.prepareSigningEntries)(w,C,"SECP256K1_BLAKE160_MULTISIG")}t.default={transfer:p,transferCompatible:y,payFee:m,prepareSigningEntries:S,serializeMultisigScript:o.serializeMultisigScript,multisigArgs:o.multisigArgs,injectCapacity:A,setupInputCell:l,CellCollector:u}})(N1);var Vi={},vi={},k_={},bs={},_i={},kA;function n5(){if(kA)return _i;kA=1,Object.defineProperty(_i,"__esModule",{value:!0}),_i.CellCollector=void 0,_i.checkLimit=m,_i.default=void 0,_i.injectCapacity=S,_i.prepareSigningEntries=w,_i.setupInputCell=y,_i.setupOutputCell=A,_i.withdraw=C;var t=Ir,e=st,r=Nr,n=pi(),i=Jo,a=wt,s=ei,o=lt,f=HD();const{ScriptValue:c}=t.values,{CKBHasher:u,ckbHash:l}=t.utils,p=_i.CellCollector=class{constructor(M,U,{config:K=void 0,queryOptions:Q={}}={}){if(!U)throw new Error("Cell provider is missing!");K=K||(0,r.getConfig)(),this.fromScript=(0,s.parseFromInfo)(M,{config:K}).fromScript,this.config=K,Q={...Q,lock:this.fromScript,type:Q.type||"empty"},this.cellCollector=U.collector(Q)}async*collect(){if((0,o.isAcpScript)(this.fromScript,this.config))for await(const M of this.cellCollector.collect())yield M}};async function y(O,M,U,{config:K=void 0,defaultWitness:Q="0x",since:k=void 0}={}){K=K||(0,r.getConfig)();const G=M.cellOutput.lock;if(!(0,o.isAcpScript)(G,K))throw new Error("Not anyone-can-pay input!");O=O.update("inputs",b=>b.push(M)),k&&(O=O.update("inputSinces",b=>b.set(O.get("inputs").size-1,k))),O=O.update("witnesses",b=>b.push(Q));const W={cellOutput:{capacity:M.cellOutput.capacity,lock:M.cellOutput.lock,type:M.cellOutput.type},data:M.data};O=O.update("outputs",b=>b.push(W)),O=O.update("fixedEntries",b=>b.push({field:"outputs",index:O.get("outputs").size-1}));const R=K.SCRIPTS.ANYONE_CAN_PAY;if(!R)throw new Error("ANYONE_CAN_PAY script not defined in config!");const _={txHash:R.TX_HASH,index:R.INDEX};O=(0,o.addCellDep)(O,{outPoint:_,depType:R.DEP_TYPE});const I=O.get("inputs").findIndex(b=>new c(b.cellOutput.lock,{validate:!1}).equals(new c(G,{validate:!1})));if(I!==-1){for(;I>=O.get("witnesses").size;)O=O.update("witnesses",d=>d.push("0x"));let b=O.get("witnesses").get(I);const v={lock:o.SECP_SIGNATURE_PLACEHOLDER};if(b!=="0x"){const d=t.blockchain.WitnessArgs.unpack(e.bytes.bytify(b)),g=d.lock;if(g&&v.lock&&!e.bytes.equal(g,v.lock))throw new Error("Lock field in first witness is set aside for signature!");const x=d.inputType;x&&(v.inputType=x);const E=d.outputType;E&&(v.outputType=E)}b=e.bytes.hexify(t.blockchain.WitnessArgs.pack(v)),O=O.update("witnesses",d=>d.set(I,b))}return O}function m(O,M){const U=a.BI.from(M);let K,Q;if(O.length>=46&&(K=a.BI.from(10).pow("0x"+O.slice(44,46))),O.length>=44){const k=a.BI.from(10).pow("0x"+O.slice(42,44)),G=a.BI.from(10).pow(8);Q=k.mul(G)}if(Q&&K){if(U.lt(Q))throw new Error(`capacity(${M}) less than toAddress minimal capacity limit(${Q}), and amount less then toAddress minimal amount limit(${K})! If you want to transfer sudt, maybe sudt.transfer can help you.`)}else if(Q&&U.lt(Q))throw new Error(`capacity(${M}) less than toAddress minimal capacity limit(${Q})!`)}async function A(O,M,{config:U=void 0}={}){U=U||(0,r.getConfig)();const K=M.cellOutput.lock,Q=a.BI.from(M.cellOutput.capacity);m(K.args,Q.toString());const k=O.get("cellProvider");if(!k)throw new Error("Cell Provider is missing!");const G=(0,n.generateAddress)(K,{config:U}),R=(await new p(G,k,{config:U}).collect().next()).value;let _=Q;if(R&&(_=Q.add(R.cellOutput.capacity),O=O.update("inputs",I=>I.push(R)),O=O.update("witnesses",I=>I.push("0x"))),M.cellOutput.capacity="0x"+_.toString(16),O=O.update("outputs",I=>I.push(M)),R){const I=U.SCRIPTS.ANYONE_CAN_PAY;if(!I)throw new Error("ANYONE_CAN_PAY script not defined in config!");const b={txHash:I.TX_HASH,index:I.INDEX};O=(0,o.addCellDep)(O,{outPoint:b,depType:I.DEP_TYPE})}return O}async function S(O,M,U,K,{config:Q=void 0}={}){if(Q=Q||(0,r.getConfig)(),U>=M.get("outputs").size)throw new Error("Invalid output index!");let k=a.BI.from(K);if(!Q.SCRIPTS.ANYONE_CAN_PAY)throw new Error("Provided config does not have ANYONE_CAN_PAY script setup!");const W=O.fromScript,R=M.get("fixedEntries").filter(({field:b})=>b==="outputs").maxBy(({index:b})=>b);let _=R?R.index+1:0;for(;_b.filter(v=>!a.BI.from(v.cellOutput.capacity).eq(0)));const I=b=>`${b.outPoint.txHash}_${b.outPoint.index}`;if(k.gt(0)){const b={cellOutput:{capacity:"0x0",lock:W,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0};let v=a.BI.from(0);const d=a.BI.from((0,n.minimalCellCapacityCompatible)(b));let g=(0,i.Set)();for(const x of M.get("inputs"))g=g.add(I(x));for await(const x of O.collect()){if(g.has(I(x)))continue;M=await y(M,x,void 0,{config:Q});const E=M.get("outputs").size-1;M=M.update("outputs",L=>L.remove(E));const h=M.get("fixedEntries").findIndex(L=>L.field==="outputs"&&L.index===E);h>=0&&(M=M.update("fixedEntries",L=>L.remove(h)));const T=a.BI.from(x.cellOutput.capacity);let $=T;if($.gt(k)&&($=k),k=k.sub($),v=v.add(T.sub($)),k.eq(0)&&v.gte(d))break;b.cellOutput.capacity="0x"+v.toString(16),M=M.update("outputs",L=>L.push(b))}if(k.gt(0)||vx.push(b))}return M}function w(O,{config:M=void 0}={}){M=M||(0,r.getConfig)();const U="ANYONE_CAN_PAY",K=M.SCRIPTS[U];if(!K)throw new Error(`Provided config does not have ${U} script setup!`);let Q=(0,i.Set)();const k=(0,n.createTransactionFromSkeleton)(O),G=l(t.blockchain.RawTransaction.pack(k)),W=O.get("inputs"),R=O.get("witnesses");let _=O.get("signingEntries");for(let I=0;Inew c(j.cellOutput.lock,{validate:!1}).equals(new c(b.cellOutput.lock,{validate:!1}))),d=v.map(j=>a.BI.from(j.cellOutput.capacity)).reduce((j,F)=>j.add(F),a.BI.from(0)),g=v.filter(j=>j.data!=="0x").map(j=>(0,f.unpackAmount)(j.data)).reduce((j,F)=>j.add(F),a.BI.from(0)),x=W.filter(j=>new c(j.cellOutput.lock,{validate:!1}).equals(new c(b.cellOutput.lock,{validate:!1}))),E=x.map(j=>a.BI.from(j.cellOutput.capacity)).reduce((j,F)=>j.add(F),a.BI.from(0)),h=x.filter(j=>j.data!=="0x").map(j=>a.BI.from((0,f.unpackAmount)(j.data))).reduce((j,F)=>j.add(F),a.BI.from(0));if(E.lte(d)&&h.lte(g))continue;const T=new t.values.ScriptValue(b.cellOutput.lock,{validate:!1}),$=new u;if($.update(G),I>=R.size)throw new Error(`The first witness in the script group starting at input index ${I} does not exist, maybe some other part has invalidly tampered the transaction?`);(0,o.hashWitness)($,R.get(I));for(let j=I+1;jE.push(g)),O=O.update("witnesses",E=>E.push("0x"))}O=O.update("outputs",v=>v.push(_)),O=await y(O,M,(0,n.generateAddress)(M.cellOutput.lock,{config:Q}),{config:Q});const I=O.get("outputs").size-1;O=O.update("outputs",v=>v.remove(I));const b=O.get("fixedEntries").findIndex(v=>v.field==="outputs"&&v.index===I);return b>=0&&(O=O.update("fixedEntries",v=>v.remove(b))),k.eq(G)||(O=O.update("outputs",v=>v.push({cellOutput:{capacity:"0x"+G.sub(K).toString(16),lock:M.cellOutput.lock,type:M.cellOutput.type},data:M.data}))),O}return _i.default={CellCollector:p,setupInputCell:y,setupOutputCell:A,injectCapacity:S,prepareSigningEntries:w,withdraw:C},_i}var zA;function HD(){if(zA)return bs;zA=1,Object.defineProperty(bs,"__esModule",{value:!0}),bs.default=void 0,bs.issueToken=C,bs.ownerForSudt=U,bs.packAmount=Q,bs.transfer=O,bs.unpackAmount=K;var t=lt,e=Ir,r=A(N1),n=ei,i=A(h5()),a=pi(),s=Jo,o=Nr,f=d5(),c=m(n5()),u=A(Dn),l=wt,p=st;function y(k){if(typeof WeakMap!="function")return null;var G=new WeakMap,W=new WeakMap;return(y=function(R){return R?W:G})(k)}function m(k,G){if(k&&k.__esModule)return k;if(k===null||typeof k!="object"&&typeof k!="function")return{default:k};var W=y(G);if(W&&W.has(k))return W.get(k);var R={__proto__:null},_=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var I in k)if(I!=="default"&&{}.hasOwnProperty.call(k,I)){var b=_?Object.getOwnPropertyDescriptor(k,I):null;b&&(b.get||b.set)?Object.defineProperty(R,I,b):R[I]=k[I]}return R.default=k,W&&W.set(k,R),R}function A(k){return k&&k.__esModule?k:{default:k}}const{computeScriptHash:S}=e.utils,{ScriptValue:w}=e.values;async function C(k,G,W,R,_,{config:I=void 0}={}){I=I||(0,o.getConfig)();const b=I.SCRIPTS.SUDT;if(!b)throw new Error("Provided config does not have SUDT script setup!");k=(0,t.addCellDep)(k,{outPoint:{txHash:b.TX_HASH,index:b.INDEX},depType:b.DEP_TYPE});const v=(0,n.parseFromInfo)(G,{config:I}).fromScript,d=v,g={codeHash:b.CODE_HASH,hashType:b.HASH_TYPE,args:S(v)},x={cellOutput:{capacity:"0x0",lock:d,type:g},data:p.bytes.hexify(p.number.Uint128LE.pack(W)),outPoint:void 0,blockHash:void 0};R||(R=(0,a.minimalCellCapacityCompatible)(x));const E=l.BI.from(R);x.cellOutput.capacity="0x"+E.toString(16),k=k.update("outputs",T=>T.push(x));const h=k.get("outputs").size-1;return k=k.update("fixedEntries",T=>T.push({field:"outputs",index:h})),k=await i.default.injectCapacity(k,[G],l.BI.from(l.BI.from(x.cellOutput.capacity)),void 0,_,{config:I}),k}async function O(k,G,W,R,_,I,b,v,{config:d=void 0,LocktimePoolCellCollector:g=f.CellCollector,splitChangeCell:x=!1}={}){d=d||(0,o.getConfig)();let E=l.BI.from(_),h=b?l.BI.from(b):void 0;const T=d.SCRIPTS.SUDT;if(!T)throw new Error("Provided config does not have SUDT script setup!");if(G.length===0)throw new Error("`fromInfos` can't be empty!");if(!R)throw new Error("You must provide a to address!");const $=(0,a.parseAddress)(R,{config:d}),L=G.map(J=>(0,n.parseFromInfo)(J,{config:d}).fromScript),j=I?(0,a.parseAddress)(I,{config:d}):L[0];if(E.lte(0))throw new Error("amount must be greater than 0");const F=M(W,d),H=k.get("cellProvider");if(!H)throw new Error("Cell provider is missing!");let q=l.BI.from(0),X=l.BI.from(0);if((0,t.isAcpScript)($,d)){const ie=(await new c.CellCollector(R,H,{config:d,queryOptions:{type:F,data:"any"}}).collect().next()).value;if(!ie)throw new Error("toAddress ANYONE_CAN_PAY input not found!");k=k.update("inputs",ce=>ce.push(ie)),k=k.update("witnesses",ce=>ce.push("0x")),q=l.BI.from(ie.cellOutput.capacity),X=K(ie.data)}const te={cellOutput:{capacity:"0x0",lock:$,type:F},data:p.bytes.hexify(p.number.Uint128LE.pack(E)),outPoint:void 0,blockHash:void 0};(0,t.isAcpScript)($,d)?(h||(h=l.BI.from(0)),te.cellOutput.capacity="0x"+q.add(h).toString(16),te.data=p.bytes.hexify(p.number.Uint128LE.pack(X.add(E)))):(h||(h=l.BI.from((0,a.minimalCellCapacityCompatible)(te))),te.cellOutput.capacity="0x"+h.toString(16)),k=k.update("outputs",J=>J.push(te)),k=k.update("fixedEntries",J=>J.push({field:"outputs",index:k.get("outputs").size-1})),k=(0,t.addCellDep)(k,{outPoint:{txHash:T.TX_HASH,index:T.INDEX},depType:T.DEP_TYPE});const ne={cellOutput:{capacity:"0x0",lock:j,type:F},data:p.bytes.hexify(p.number.Uint128LE.pack(0)),outPoint:void 0,blockHash:void 0},N={cellOutput:{capacity:"0x0",lock:j,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0};let P=l.BI.from(0),re=l.BI.from(0),ue=(0,s.Set)();for(const J of k.get("inputs"))ue=ue.add(`${J.outPoint.txHash}_${J.outPoint.index}`);let de=(0,s.List)();v&&G.forEach((J,ie)=>{const ce=new g(J,H,{config:d,tipHeader:v,queryOptions:{type:F,data:"any"}});de=de.push({cellCollector:ce,index:ie})}),G.forEach((J,ie)=>{const ce=new u.default.CellCollector(J,H,{config:d,queryOptions:{type:F,data:"any"}}),ye=new r.default.CellCollector(J,H,{config:d,queryOptions:{type:F,data:"any"}}),ge=new c.default.CellCollector(J,H,{config:d,queryOptions:{type:F,data:"any"}});de=de.push({cellCollector:ce,index:ie},{cellCollector:ye,index:ie},{cellCollector:ge,index:ie,isAnyoneCanPay:!0,destroyable:(0,n.parseFromInfo)(J,{config:d}).destroyable})}),v&&G.forEach((J,ie)=>{const ce=new g(J,H,{config:d,tipHeader:v});de=de.push({cellCollector:ce,index:ie})}),G.forEach((J,ie)=>{const ce=new u.default.CellCollector(J,H,{config:d}),ye=new r.default.CellCollector(J,H,{config:d}),ge=new c.default.CellCollector(J,H,{config:d});de=de.push({cellCollector:ce,index:ie},{cellCollector:ye,index:ie},{cellCollector:ge,index:ie,isAnyoneCanPay:!0,destroyable:(0,n.parseFromInfo)(J,{config:d}).destroyable})});for(const{index:J,cellCollector:ie,isAnyoneCanPay:ce,destroyable:ye}of de)for await(const ge of ie.collect()){const Se=`${ge.outPoint.txHash}_${ge.outPoint.index}`;if(ue.has(Se))continue;ue=ue.add(Se);const kt=G[J];k=await i.default.setupInputCell(k,ge,kt,{config:d});const He=k.get("outputs").size-1;k=k.update("outputs",fe=>fe.remove(He));const Fe=k.get("fixedEntries").findIndex(fe=>fe.field==="outputs"&&fe.index===He);Fe>=0&&(k=k.update("fixedEntries",fe=>fe.remove(Fe)));const fn=l.BI.from(ge.cellOutput.capacity),z=ge.cellOutput.type?K(ge.data):l.BI.from(0);let B=ce&&!ye?fn.sub((0,a.minimalCellCapacityCompatible)(ge)):fn,D=z;B.gt(h)&&(B=l.BI.from(h)),h=h.sub(B);const Y=fn.sub(B);(!ce||ce&&ye)&&(P=P.add(Y)),D.gt(E)&&(D=E),E=E.sub(D);const ae=z.sub(D);if((!ce||ce&&ye)&&(re=re.add(ae)),ce&&!ye){const fe={cellOutput:{capacity:"0x"+Y.toString(16),lock:ge.cellOutput.lock,type:ge.cellOutput.type},data:ge.cellOutput.type?p.bytes.hexify(p.number.Uint128LE.pack(ae)):"0x"};k=k.update("outputs",le=>le.push(fe)),ge.cellOutput.type&&(k=k.update("fixedEntries",le=>le.push({field:"outputs",index:k.get("outputs").size-1})))}if(h.eq(0)&&E.eq(0)&&(P.eq(0)&&re.eq(0)||P.gt((0,a.minimalCellCapacityCompatible)(N))&&re.eq(0))){ne.cellOutput.type=void 0,ne.data="0x";break}if(h.eq(0)&&E.eq(0)&&P.gt((0,a.minimalCellCapacityCompatible)(N))&&re.gt(0))break}let V=-1;if((0,t.isAcpScript)(ne.cellOutput.lock,d)&&(V=k.get("outputs").findIndex(J=>new w(ne.cellOutput.lock,{validate:!1}).equals(new w(J.cellOutput.lock,{validate:!1}))&&(re.eq(0)&&!ne.cellOutput.type&&!J.cellOutput.type||re.gte(0)&&!!ne.cellOutput.type&&!!J.cellOutput.type&&new w(ne.cellOutput.type,{validate:!1}).equals(new w(J.cellOutput.type,{validate:!1})))))!==-1&&k.get("fixedEntries").findIndex(J=>J.field==="output"&&J.index===V)===-1){const J=k.get("outputs").get(V),ie=JSON.parse(JSON.stringify(J));ie.cellOutput.capacity="0x"+l.BI.from(J.cellOutput.capacity).add(P).toString(16),re.gt(0)&&(ie.data=p.bytes.hexify(p.number.Uint128LE.pack(K(J.data).add(re))));const ce=l.BI.from((0,a.minimalCellCapacityCompatible)(ne)),ye=l.BI.from((0,a.minimalCellCapacityCompatible)(N));let ge=!1;re.gt(0)&&x&&P.gte(ce.add(ye))&&(ie.cellOutput.capacity=J.cellOutput.capacity,N.cellOutput.capacity="0x"+P.toString(16),ge=!0),k=k.update("outputs",Se=>Se.set(V,ie)),ge&&(k=k.update("outputs",Se=>Se.push(N)))}else if(P.gte((0,a.minimalCellCapacityCompatible)(ne))){ne.cellOutput.capacity="0x"+P.toString(16),re.gt(0)&&(ne.data=p.bytes.hexify(p.number.Uint128LE.pack(re)));const J=l.BI.from((0,a.minimalCellCapacityCompatible)(ne)),ie=l.BI.from((0,a.minimalCellCapacityCompatible)(N));let ce=!1;re.gt(0)&&x&&P.gte(J.add(ie))&&(ne.cellOutput.capacity="0x"+J.toString(16),N.cellOutput.capacity="0x"+P.sub(J).toString(16),ce=!0),k=k.update("outputs",ye=>ye.push(ne)),re.gt(0)&&(k=k.update("fixedEntries",ye=>ye.push({field:"outputs",index:k.get("outputs").size-1}))),ce&&(k=k.update("outputs",ye=>ye.push(N)))}else if(re.gt(0)&&P.lt((0,a.minimalCellCapacityCompatible)(ne)))throw new Error("Not enough capacity for change in from infos!");if(h.gt(0))throw new Error("Not enough capacity in from infos!");if(E.gt(0))throw new Error("Not enough amount in from infos!");return k}function M(k,G){const W=G.SCRIPTS.SUDT;return{codeHash:W.CODE_HASH,hashType:W.HASH_TYPE,args:k}}function U(k,{config:G=void 0}={}){G=G||(0,o.getConfig)();const{fromScript:W}=(0,n.parseFromInfo)(k,{config:G});return S(W)}function K(k){return p.number.Uint128LE.unpack(p.bytes.bytify(k).slice(0,16))}function Q(k){return p.bytes.hexify(p.number.Uint128LE.pack(k))}return bs.default={issueToken:C,transfer:O,ownerForSudt:U,packAmount:Q,unpackAmount:K},bs}var i5={};Object.defineProperty(i5,"__esModule",{value:!0});i5.createP2PKHMessageGroup=pK;var Yc=Ir,fK=pi(),ll=st,cK=wt;function uK(t,e){const r=new Set;for(const i of e){const a=Yc.utils.ckbHash(Yc.blockchain.Script.pack(i));r.add(a)}const n=new Map;for(let i=0;i{const t=new Yc.utils.CKBHasher;return{update:e=>t.update(e.buffer),digest:()=>ll.bytes.bytify(t.digestHex())}};function hK(t){return t instanceof Function?t():t}function pK(t,e,{hasher:r=dK}={}){const n=uK(t.inputs.toArray(),e),i=lK(t);if(e.length>1&&!(r instanceof Function))throw new Error("Must provide hasher producer when you have multiple locks to group.");const a=[];for(const s of n.keys()){const o=hK(r),f=n.get(s),c=f[0],u=t.witnesses.get(c);if(u===void 0)throw new Error("Please fill witnesses with 0 first!");o.update(ll.bytes.bytify(i));const l=new ArrayBuffer(8),p=new DataView(l),y=cK.BI.from(ll.bytes.bytify(u).length).toString(16);y.length<=8&&(p.setUint32(0,+("0x"+y),!0),p.setUint32(4,+"0x00000000",!0)),y.length>8&&y.length<=16&&(p.setUint32(0,+("0x"+y.slice(-8)),!0),p.setUint32(4,+("0x"+y.slice(0,-8)),!0)),o.update(new Uint8Array(l)),o.update(ll.bytes.bytify(u));for(let S=1;S("00"+S.toString(16)).slice(-2)).join("")};a.push(A)}return a}var wc={};Object.defineProperty(wc,"__esModule",{value:!0});wc.compareScriptBinaryWithOnChainData=$D;wc.default=void 0;wc.generateDeployWithDataTx=UD;wc.generateDeployWithTypeIdTx=kD;wc.generateUpgradeTypeIdDataTx=zD;var fs=Ir,rp=st,by=Nr,Ac=pi(),bK=Jo,L2=ei,vn=wt;const{ScriptValue:$A}=fs.values;function a5(t){let e="0x";for(let r=0;rn.push(e)),t}function o5(t,e){t=t.update("cellDeps",i=>i.clear()),e=e||(0,by.getConfig)();const r=e.SCRIPTS.SECP256K1_BLAKE160,n=e.SCRIPTS.SECP256K1_BLAKE160_MULTISIG;if(!r||!n)throw new Error("Provided config does not have SECP256K1_BLAKE160 or SECP256K1_BLAKE160_MULTISIG script setup!");return t=t.update("cellDeps",i=>i.push({outPoint:{txHash:r.TX_HASH,index:r.INDEX},depType:r.DEP_TYPE},{outPoint:{txHash:n.TX_HASH,index:n.INDEX},depType:n.DEP_TYPE})),t}async function f5(t,e,r,n){const i=t.get("inputs").map(o=>vn.BI.from(o.cellOutput.capacity)).reduce((o,f)=>o.add(f),vn.BI.from(0)),s=t.get("outputs").map(o=>vn.BI.from(o.cellOutput.capacity)).reduce((o,f)=>o.add(f),vn.BI.from(0)).sub(i);return t=await yK(t,e,vn.BI.from(s),{config:r,feeRate:n}),t}async function yK(t,e,r,{config:n=void 0,feeRate:i=void 0}){n=n||(0,by.getConfig)();const a=i||1e3;let s=vn.BI.from(r);const{fromScript:o,multisigScript:f}=(0,L2.parseFromInfo)(e,{config:n});s=s.add(vn.BI.from(10).pow(8));let c=vn.BI.from(10).pow(8);const u={cellOutput:{capacity:"0x0",lock:o,type:void 0},data:"0x"},l=vn.BI.from((0,Ac.minimalCellCapacityCompatible)(u)).add(vn.BI.from(10).pow(8));if(s.lt(0)&&(c=c.sub(s),s=vn.BI.from(0)),s.gt(0)||c.lt(l)){const m=t.get("cellProvider");if(!m)throw new Error("Cell provider is missing!");const A=m.collector({lock:o,type:"empty",data:"0x"});let S=(0,bK.Set)();for(const w of t.get("inputs"))S=S.add(`${w.outPoint.txHash}_${w.outPoint.index}`);for await(const w of A.collect()){if(S.has(`${w.outPoint.txHash}_${w.outPoint.index}`))continue;t=t.update("inputs",M=>M.push(w)),t=t.update("witnesses",M=>M.push("0x"));const C=vn.BI.from(w.cellOutput.capacity);let O=C;if(O.gt(s)&&(O=s),s=s.sub(O),c=c.add(C).sub(O),s.eq(0)&&(c.eq(0)||c.gte(l)))break}}if(c.gt(0)&&(u.cellOutput.capacity="0x"+c.toString(16),t=t.update("outputs",m=>m.push(u))),s.gt(0)||c.lt(l))throw new Error("Not enough capacity in from address!");const p=t.get("inputs").findIndex(m=>new $A(m.cellOutput.lock,{validate:!1}).equals(new $A(o,{validate:!1})));if(p!==-1){for(;p>=t.get("witnesses").size;)t=t.update("witnesses",w=>w.push("0x"));let m=t.get("witnesses").get(p),A;const S="0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";if(typeof e!="string"?A={lock:"0x"+f.slice(2)+S.slice(2).repeat(e.M)}:A={lock:S},m!=="0x"){const w=fs.blockchain.WitnessArgs.unpack(rp.bytes.bytify(m)),C=w.lock;if(C&&A.lock&&!rp.bytes.equal(C,A.lock))throw new Error("Lock field in first witness is set aside for signature!");const O=w.inputType;O&&(A.inputType=O);const M=w.outputType;M&&(A.outputType=M)}m=rp.bytes.hexify(fs.blockchain.WitnessArgs.pack(A)),t=t.update("witnesses",w=>w.set(p,m))}const y=PD(t,a);return c=c.sub(y),t=t.update("outputs",m=>m.pop()),c.gt(0)&&(u.cellOutput.capacity="0x"+c.toString(16),t=t.update("outputs",m=>m.push(u))),t}function vK(t){const e=(0,Ac.createTransactionFromSkeleton)(t);return _K(e)}function _K(t){return fs.blockchain.Transaction.pack(t).byteLength+4}function mK(t,e){const r=vn.BI.from(1e3),n=vn.BI.from(t).mul(e),i=n.div(r);return i.mul(r).lt(n)?i.add(1):vn.BI.from(i)}function PD(t,e){const r=vK(t);return vn.BI.from(mK(r,e))}function wK(t){const e=t.valueOf();return new fs.utils.CKBHasher().update(e.buffer.slice(e.byteOffset,e.byteLength+e.byteOffset)).digestHex()}async function AK(t,e){const r=t.txHash,n=parseInt(t.index,10),i=await e.getTransaction(r);if(!i)throw new Error(`TxHash(${r}) is not found`);const a=i.transaction.outputsData[n];if(!a)throw new Error("cannot find output data");return new fs.utils.CKBHasher().update(rp.bytes.bytify(a)).digestHex()}function ND(t){const e=(0,Ac.createTransactionFromSkeleton)(t);return fs.utils.ckbHash(fs.blockchain.RawTransaction.pack(e))}function EK(t,e){const r=t.outputs.get(e).data,n=fs.utils.ckbHash(rp.bytes.bytify(r)),i=ND(t);return{CODE_HASH:n,HASH_TYPE:"data2",TX_HASH:i,INDEX:"0x0",DEP_TYPE:"code"}}function xK(t,e){const r=t.outputs.get(e).cellOutput.type,n=fs.utils.computeScriptHash(r),i=ND(t);return{CODE_HASH:n,HASH_TYPE:"type",TX_HASH:i,INDEX:"0x0",DEP_TYPE:"code"}}function c5(t,e){const r=t.outputs.get(e);if(r==null)throw new Error("Invalid txSkeleton or outputIndex");return r.cellOutput.type!==void 0?xK(t,e):EK(t,e)}function SK(t){return typeof t!="object"?!1:"M"in t&&"R"in t&&Array.isArray(t.publicKeyHashes)}function u5(t,{config:e=void 0}={}){if(e=e||(0,by.getConfig)(),typeof t=="string"){if(by.helpers.nameOfScript((0,Ac.parseAddress)(t,{config:e}),e.SCRIPTS)!=="SECP256K1_BLAKE160")throw new Error("only SECP256K1_BLAKE160 or SECP256K1_MULTISIG is supported")}else if(!SK(t))throw new Error("only SECP256K1_BLAKE160 or SECP256K1_MULTISIG is supported")}async function UD(t){u5(t.fromInfo,{config:t.config});let e=(0,Ac.TransactionSkeleton)({cellProvider:t.cellProvider});const{fromScript:r}=(0,L2.parseFromInfo)(t.fromInfo,{config:t.config}),n={cellOutput:{capacity:"0x0",lock:r},data:a5(t.scriptBinary)};e=s5(e,n),e=o5(e,t.config),e=await f5(e,t.fromInfo,t.config,t.feeRate);const i=c5(e,0);return{txSkeleton:e,scriptConfig:i}}async function kD(t){u5(t.fromInfo,{config:t.config});let e=(0,Ac.TransactionSkeleton)({cellProvider:t.cellProvider});const{fromScript:r}=(0,L2.parseFromInfo)(t.fromInfo,{config:t.config}),[n]=await gK(r,t.cellProvider);if(!n)throw new Error("fromAddress has no live ckb");const i=fs.utils.generateTypeIdScript({previousOutput:n.outPoint,since:"0x0"},"0x0"),a={cellOutput:{capacity:"0x0",lock:r,type:i},data:a5(t.scriptBinary)};e=s5(e,a),e=o5(e,t.config),e=await f5(e,t.fromInfo,t.config,t.feeRate);const s=c5(e,0);return{txSkeleton:e,scriptConfig:s,typeId:i}}async function zD(t){u5(t.fromInfo,{config:t.config});let e=(0,Ac.TransactionSkeleton)({cellProvider:t.cellProvider});const{fromScript:r}=(0,L2.parseFromInfo)(t.fromInfo,{config:t.config}),n=t.cellProvider.collector({type:t.typeId}),i=[];for await(const f of n.collect())i.push(f);if(i.length!==1)throw new Error("the typeid maybe wrong");const a=i[0];e=e.update("inputs",f=>f.push(a));const s={cellOutput:{capacity:"0x0",lock:r,type:t.typeId},data:a5(t.scriptBinary)};e=s5(e,s),e=o5(e,t.config),e=await f5(e,t.fromInfo,t.config,t.feeRate);const o=c5(e,0);return{txSkeleton:e,scriptConfig:o}}async function $D(t,e,r){const n=wK(t),i=await AK(e,r);return n===i}wc.default={generateDeployWithDataTx:UD,generateDeployWithTypeIdTx:kD,generateUpgradeTypeIdDataTx:zD,compareScriptBinaryWithOnChainData:$D,__tests__:{calculateTxFee:PD}};var Sn={},_n={};Object.defineProperty(_n,"__esModule",{value:!0});_n.WitnessArgs=_n.BytesVec=_n.BytesOpt=_n.Bytes=_n.Byte32Vec=_n.Byte32=void 0;_n.WitnessArgsOf=KD;_n.createFixedHexBytesCodec=FD;var jD=Go,Dd=Ca,Fa=c1;function FD(t){return(0,jD.createFixedBytesCodec)({byteLength:t,pack:e=>(0,Dd.bytify)(e),unpack:e=>(0,Dd.hexify)(e)})}const qD=_n.Bytes=(0,Fa.byteVecOf)({pack:Dd.bytify,unpack:Dd.hexify});_n.BytesOpt=(0,Fa.option)(qD);_n.BytesVec=(0,Fa.vector)(qD);const IK=_n.Byte32=FD(32);_n.Byte32Vec=(0,Fa.vector)(IK);function KD(t){return(0,Fa.table)({lock:(0,Fa.option)((0,Fa.byteVecOf)(t.lock)),input_type:(0,Fa.option)((0,Fa.byteVecOf)(t.input_type)),output_type:(0,Fa.option)((0,Fa.byteVecOf)(t.output_type))},["lock","input_type","output_type"])}const z_=(0,jD.createBytesCodec)({pack:Dd.bytify,unpack:Dd.hexify});_n.WitnessArgs=KD({lock:z_,input_type:z_,output_type:z_});var H2={};function CK(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,O=new Uint8Array(C);S!==w;){for(var M=y[S],U=0,K=C-1;(M!==0||U>>0,O[K]=M%s>>>0,M=M/s>>>0;if(M!==0)throw new Error("Non-zero carry");A=U,S++}for(var Q=C-A;Q!==C&&O[Q]===0;)Q++;for(var k=o.repeat(m);Q>>0,C=new Uint8Array(w);y[m];){var O=e[y.charCodeAt(m)];if(O===255)return;for(var M=0,U=w-1;(O!==0||M>>0,C[U]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");S=M,m++}for(var K=w-S;K!==w&&C[K]===0;)K++;for(var Q=new Uint8Array(A+(w-K)),k=A;K!==w;)Q[k++]=C[K++];return Q}function p(y){var m=l(y);if(m)return m;throw new Error("Non-base"+s+" character")}return{encode:u,decodeUnsafe:l,decode:p}}var TK=CK;const OK=TK,BK="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var QD=OK(BK);Object.defineProperty(H2,"__esModule",{value:!0});H2.decodeAddress=RK;H2.signMessage=LK;var $_=st,jA=sc,FA=DK(QD);function DK(t){return t&&t.__esModule?t:{default:t}}const MK="CKB (Bitcoin Layer) transaction: 0x";function RK(t){try{if(t.startsWith("bc1q"))return jA.bech32.fromWords(jA.bech32.decode(t).words.slice(1));if(t.startsWith("1")||t.startsWith("3"))return FA.default.decode(t).slice(1,21)}catch{if(t.startsWith("bc1p"))throw new Error("Taproot address is not supported yet.")}throw new Error(`Unsupported bitcoin address ${t}, only 1...(P2PKH) 3...(P2SH), and bc1...(Bech32) are supported.`)}async function LK(t,e,r){const n=(()=>{if(r)return r;if(typeof window<"u"){if("unisat"in window)return window.unisat;if("okxwallet"in window&&"bitcoin"in window.okxwallet)return window.okxwallet.bitcoin}throw new Error("No provider found, make sure you have installed UniSat Wallet")})(),i=await n.requestAccounts(),a=$_.bytes.hexify(t).slice(2),s=await n.signMessage(`${MK}${a}`,e),o=$_.bytes.bytify(HK(s)),f=i[0];if(f.startsWith("bc1q"))o[0]=39+(o[0]-27)%4;else if(f.startsWith("3"))o[0]=35+(o[0]-27)%4;else if(f.startsWith("1"))o[0]=31+(o[0]-27)%4;else throw new Error(`Unsupported bitcoin address ${f}, only 1...(P2PKH) 3...(P2SH), and bc1...(Bech32) are supported.`);return $_.bytes.hexify(o)}function HK(t){const e=atob(t);let r="";for(let n=0;n{if(e)return e;if(typeof window<"u"&&"phantom"in window&&window.phantom&&"solana"in window.phantom)return window.phantom.solana;throw new Error("No provider found, make sure you have installed Phantom or other Solana wallet")})(),i=j_.bytes.hexify(t).slice(2),a=await r.signMessage(new TextEncoder().encode(`${PK}${i}`));return j_.bytes.hexify(j_.bytes.concat(a.signature,a.publicKey.toBytes()))}Object.defineProperty(Sn,"__esModule",{value:!0});Sn.bitcoin=Sn.OmnilockWitnessLock=Sn.CellCollector=void 0;Sn.createOmnilockScript=XD;Sn.default=void 0;Sn.prepareSigningEntries=tM;Sn.setupInputCell=eM;Sn.solana=void 0;var Zi=st,YD=Ir,P2=Nr,np=lt,UK=ei,xu=c1,n6=_n,qA=Ca,VD=WD(H2);Sn.bitcoin=VD;var kK=WD(l5);Sn.solana=kK;var zK=QD,$K=St;function GD(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(GD=function(n){return n?r:e})(t)}function WD(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=GD(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(a!=="default"&&{}.hasOwnProperty.call(t,a)){var s=i?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}const{ScriptValue:KA}=YD.values;var So=function(t){return t[t.IdentityFlagsCkb=0]="IdentityFlagsCkb",t[t.IdentityFlagsEthereum=1]="IdentityFlagsEthereum",t[t.IdentityFlagsEos=2]="IdentityFlagsEos",t[t.IdentityFlagsTron=3]="IdentityFlagsTron",t[t.IdentityFlagsBitcoin=4]="IdentityFlagsBitcoin",t[t.IdentityFlagsDogecoin=5]="IdentityFlagsDogecoin",t[t.IdentityCkbMultisig=6]="IdentityCkbMultisig",t[t.IdentityFlagsEthereumDisplaying=18]="IdentityFlagsEthereumDisplaying",t[t.IdentityFlagsSolana=19]="IdentityFlagsSolana",t[t.IdentityFlagsOwnerLock=252]="IdentityFlagsOwnerLock",t[t.IdentityFlagsExec=253]="IdentityFlagsExec",t[t.IdentityFlagsDl=254]="IdentityFlagsDl",t}(So||{});const jK=20,FK=65,qK=96;function XD(t,e){const n=((e==null?void 0:e.config)||(0,P2.getConfig)()).SCRIPTS.OMNILOCK;if(!n)throw new Error("OMNILOCK script config not found.");const a=[0],s=(()=>{const o=t.auth.flag;switch(o){case"ETHEREUM":return Zi.bytes.hexify(Zi.bytes.concat([So.IdentityFlagsEthereum],t.auth.content,a));case"SECP256K1_BLAKE160":return Zi.bytes.hexify(Zi.bytes.concat([So.IdentityFlagsCkb],t.auth.content,a));case"BITCOIN":return Zi.bytes.hexify(Zi.bytes.concat([So.IdentityFlagsBitcoin],VD.decodeAddress(t.auth.content),a));case"SOLANA":{const f=Zi.bytes.bytify((0,$K.ckbHash)((0,zK.decode)(t.auth.content))).slice(0,jK);return Zi.bytes.hexify(Zi.bytes.concat([So.IdentityFlagsSolana],f,a))}default:throw new Error(`Not supported flag: ${o}.`)}})();return{codeHash:n.CODE_HASH,hashType:n.HASH_TYPE,args:s}}const ZD={pack:qA.bytify,unpack:qA.hexify},KK=21,QK=(0,n6.createFixedHexBytesCodec)(KK),YK=(0,xu.byteVecOf)(ZD),VK=(0,xu.table)({mask:(0,xu.byteOf)(ZD),proof:YK},["mask","proof"]),GK=(0,xu.vector)(VK),WK=(0,xu.table)({identity:QK,proofs:GK},["identity","proofs"]),XK=(0,xu.option)(WK),JD=Sn.OmnilockWitnessLock=(0,xu.table)({signature:n6.BytesOpt,omni_identity:XK,preimage:n6.BytesOpt},["signature","omni_identity","preimage"]),ZK=Sn.CellCollector=class{constructor(e,r,{config:n=void 0,queryOptions:i={}}={}){if(!r)throw new Error("Cell provider is missing!");n=n||(0,P2.getConfig)(),this.fromScript=(0,UK.parseFromInfo)(e,{config:n}).fromScript,this.config=n,i={...i,lock:this.fromScript,type:i.type||"empty"},this.cellCollector=r.collector(i)}async*collect(){if((0,np.isOmnilockScript)(this.fromScript,this.config))for await(const e of this.cellCollector.collect())yield e}};async function eM(t,e,r,{config:n=void 0,defaultWitness:i="0x",since:a=void 0}={}){n=n||(0,P2.getConfig)();const s=e.cellOutput.lock;if(!(0,np.isOmnilockScript)(s,n))throw new Error("Not OMNILOCK input!");t=t.update("inputs",y=>y.push(e));const o={cellOutput:{capacity:e.cellOutput.capacity,lock:e.cellOutput.lock,type:e.cellOutput.type},data:e.data};t=t.update("outputs",y=>y.push(o)),a&&(t=t.update("inputSinces",y=>y.set(t.get("inputs").size-1,a))),t=t.update("witnesses",y=>y.push(i));const f=n.SCRIPTS.OMNILOCK,c=n.SCRIPTS.SECP256K1_BLAKE160;if(!f)throw new Error("OMNILOCK script not defined in config!");if(!c)throw new Error("SECP256K1_BLAKE160 script not defined in config!");const u={txHash:f.TX_HASH,index:f.INDEX},l={txHash:c.TX_HASH,index:c.INDEX};t=(0,np.addCellDep)(t,{outPoint:u,depType:f.DEP_TYPE}),t=(0,np.addCellDep)(t,{outPoint:l,depType:c.DEP_TYPE});const p=t.get("inputs").findIndex(y=>new KA(y.cellOutput.lock,{validate:!1}).equals(new KA(s,{validate:!1})));if(p!==-1){for(;p>=t.get("witnesses").size;)t=t.update("witnesses",S=>S.push("0x"));let y=t.get("witnesses").get(p);const m=(()=>{const S=Zi.bytes.bytify(e.cellOutput.lock.args)[0];switch(S){case So.IdentityFlagsSolana:return qK;case So.IdentityFlagsCkb:case So.IdentityFlagsEthereum:case So.IdentityFlagsBitcoin:return FK;default:throw new Error(`Unsupported flag: ${S}, please check if the script.args is expected`)}})(),A={lock:JK(m)};y=Zi.bytes.hexify(YD.blockchain.WitnessArgs.pack(A)),t=t.update("witnesses",S=>S.set(p,y))}return t}function JK(t){const e=JD.pack({signature:new Uint8Array(t)}).byteLength;return Zi.bytes.hexify(new Uint8Array(e))}function tM(t,{config:e=void 0}={}){return e=e||(0,P2.getConfig)(),(0,np.prepareSigningEntries)(t,e,"OMNILOCK")}Sn.default={prepareSigningEntries:tM,setupInputCell:eM,CellCollector:ZK,OmnilockWitnessLock:JD,createOmnilockScript:XD};var QA;function eQ(){return QA||(QA=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"anyoneCanPay",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(t,"common",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"createP2PKHMessageGroup",{enumerable:!0,get:function(){return c.createP2PKHMessageGroup}}),Object.defineProperty(t,"dao",{enumerable:!0,get:function(){return i.default}}),t.default=void 0,Object.defineProperty(t,"deploy",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"locktimePool",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"omnilock",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"parseFromInfo",{enumerable:!0,get:function(){return n.parseFromInfo}}),Object.defineProperty(t,"secp256k1Blake160",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(t,"secp256k1Blake160Multisig",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"sudt",{enumerable:!0,get:function(){return o.default}});var e=p(Dn),r=p(N1),n=ei,i=p(p5()),a=p(d5()),s=p(h5()),o=p(HD()),f=p(n5()),c=i5,u=p(wc),l=p(Sn);function p(y){return y&&y.__esModule?y:{default:y}}t.default={secp256k1Blake160:e.default,secp256k1Blake160Multisig:r.default,dao:i.default,locktimePool:a.default,common:s.default,sudt:o.default,anyoneCanPay:f.default}}(k_)),k_}var YA;function d5(){if(YA)return vi;YA=1,Object.defineProperty(vi,"__esModule",{value:!0}),vi.default=vi.CellCollector=void 0,vi.injectCapacity=R,vi.payFee=G,vi.prepareSigningEntries=W,vi.setupInputCell=I,vi.transfer=M,vi.transferCompatible=U;var t=pi(),e=st,r=ei,n=y(Dn),i=p5(),a=Ir,s=lt,o=Jo,f=Nr,c=eQ(),u=Pi,l=wt,p=R2();function y(v){return v&&v.__esModule?v:{default:v}}const{ScriptValue:m}=a.values,{parseEpoch:A,maximumAbsoluteEpochSince:S,generateAbsoluteEpochSince:w,validateSince:C}=a.since,O=vi.CellCollector=class{constructor(d,g,{config:x=void 0,queryOptions:E={},tipHeader:h=void 0,NodeRPC:T=p.RPC}={}){if(!g)throw new Error("Cell provider is missing!");x=x||(0,f.getConfig)();const $=(0,r.parseFromInfo)(d,{config:x}),L=$.fromScript;this.multisigScript=$.multisigScript,this.fromScript=L,this.config=x,this.tipHeader=h,h&&(this.tipSinceValidationInfo={blockNumber:h.number,epoch:h.epoch,median_timestamp:""}),this.rpc=new T(g.uri),E={...E,lock:this.fromScript};let j=(0,o.List)([]);if((0,s.isSecp256k1Blake160MultisigScript)(L,x)){const F={codeHash:L.codeHash,hashType:L.hashType,args:L.args.slice(0,42)};j=j.push(g.collector({lock:F,argsLen:E.argsLen||28,type:E.type||"empty",data:E.data||"0x"})),!E.type&&(!E.data||E.data==="any")&&(j=j.push(g.collector({lock:F,type:(0,s.generateDaoScript)(x),data:"any"})),j=j.push(g.collector({lock:F,argsLen:28,type:(0,s.generateDaoScript)(x),data:"any"})))}else(0,s.isSecp256k1Blake160Script)(L,x)&&!E.type&&(!E.data||E.data==="any")&&(j=j.push(g.collector({lock:L,type:(0,s.generateDaoScript)(x),data:"any"})));this.cellCollectors=j}async*collect(){for(const d of this.cellCollectors)for await(const g of d.collect()){const x=g.cellOutput.lock;let E,h,T,$,L;if(x.args.length===58){const F=await this.rpc.getHeader(g.blockHash);E="0x"+b(x.args).toString(16),L={epoch:F.epoch,blockNumber:F.number,median_timestamp:""}}if((0,s.isDaoScript)(g.cellOutput.type,this.config)){if(g.data==="0x0000000000000000")continue;const F=await this.rpc.getTransaction(g.outPoint.txHash);$=F.txStatus.blockHash;const q=F.transaction.inputs[+g.outPoint.index].previousOutput;T=(await this.rpc.getTransaction(q.txHash)).txStatus.blockHash;const X=await this.rpc.getHeader(T),te=await this.rpc.getHeader($);let ne="0x"+(0,i.calculateDaoEarliestSinceCompatible)(X.epoch,te.epoch).toString(16);h=(0,i.calculateMaximumWithdrawCompatible)(g,X.dao,te.dao);const N=A(te.epoch),P={number:N.number+4,length:N.length,index:N.index};if(ne=S(ne,w(P)),E){const re=(0,u.parseSinceCompatible)(E);if(!(re.relative===!1&&re.type==="epochNumber"))continue;try{E=S(ne,E)}catch{E=ne}}else E=ne}if((0,u.parseSinceCompatible)(E).type==="blockTimestamp"||this.tipHeader&&!C(E,this.tipSinceValidationInfo,L))continue;const j={...g,since:E,depositBlockHash:T,withdrawBlockHash:$,sinceValidationInfo:L};j.cellOutput.capacity="0x"+(h||l.BI.from(g.cellOutput.capacity)).toString(16),yield j}}};async function M(v,d,g,x,E,{config:h=void 0,requireToAddress:T=!0,assertAmountEnough:$=!0,LocktimeCellCollector:L=O}={}){const j=await U(v,d,g,x,E,{config:h,requireToAddress:T,assertAmountEnough:$,LocktimeCellCollector:L});let F,H;return j instanceof Array?(F=j[0],H=BigInt(j[1].toString()),[F,H]):(F=j,F)}async function U(v,d,g,x,E,{config:h=void 0,requireToAddress:T=!0,assertAmountEnough:$=!0,LocktimeCellCollector:L=O}={}){let j=l.BI.from(x);for(const[F,H]of d.entries()){const q=await K(v,H,F===0?g:void 0,j,E,{config:h,requireToAddress:F===0?T:!1,assertAmountEnough:!1,LocktimeCellCollector:L});if(v=q[0],j=q[1],j.eq(0))return $?v:[v,l.BI.from(j)]}if($)throw new Error("Not enough capacity in from addresses!");return[v,l.BI.from(j)]}async function K(v,d,g,x,E,{config:h=void 0,requireToAddress:T=!0,assertAmountEnough:$=!0,LocktimeCellCollector:L=O,changeAddress:j=void 0}){h=h||(0,f.getConfig)();const{fromScript:F}=(0,r.parseFromInfo)(d,{config:h});if(!(0,s.isSecp256k1Blake160MultisigScript)(F,h)&&!(0,s.isSecp256k1Blake160Script)(F,h))throw new Error("fromInfo not supported!");if(T&&!g)throw new Error("You must provide a to address!");let H=l.BI.from(x||0);if(g){const te=(0,t.parseAddress)(g,{config:h});v=v.update("outputs",ne=>ne.push({cellOutput:{capacity:"0x"+H.toString(16),lock:te,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0}))}const q=v.get("fixedEntries").filter(({field:te})=>te==="outputs").maxBy(({index:te})=>te);let X=q?q.index+1:0;for(;Xre.update(X,()=>P))}}if(v=v.update("outputs",te=>te.filter(ne=>!l.BI.from(ne.cellOutput.capacity).eq(0))),H.gt(0)){const te=v.get("cellProvider");if(!te)throw new Error("cell provider is missing!");const N={cellOutput:{capacity:"0x0",lock:j?(0,t.parseAddress)(j,{config:h}):F,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0};let P=l.BI.from(0),re=(0,o.Set)();for(const de of v.get("inputs"))re=re.add(`${de.outPoint.txHash}_${de.outPoint.index}`);const ue=new L(d,te,{config:h,tipHeader:E});for await(const de of ue.collect()){const V=de;if(re.has(`${V.outPoint.txHash}_${V.outPoint.index}`))continue;let J;if((0,s.isSecp256k1Blake160MultisigScript)(F,h)){const ge=V.cellOutput.lock.args;J=ge.length===58?l.BI.from(b(ge)):void 0}let ie="0x";if((0,s.isDaoScript)(V.cellOutput.type,h)){const ge=h.SCRIPTS.DAO;v=(0,s.addCellDep)(v,{depType:ge.DEP_TYPE,outPoint:{txHash:ge.TX_HASH,index:ge.INDEX}}),v=v.update("headerDeps",He=>He.push(V.depositBlockHash,V.withdrawBlockHash));const Se=v.get("headerDeps").size-2,kt={inputType:e.bytes.hexify(e.number.Uint64.pack(Se))};ie=e.bytes.hexify(a.blockchain.WitnessArgs.pack(kt))}v=await _(v,V,(0,s.isSecp256k1Blake160MultisigScript)(F,h)?Object.assign({},d,{since:J}):d,{config:h,defaultWitness:ie,since:V.since});const ce=l.BI.from(V.cellOutput.capacity);let ye=ce;if(ye.gt(H)&&(ye=H),H=H.sub(ye),P=P.add(ce).sub(ye),(0,s.isDaoScript)(V.cellOutput.type,h)&&(v=v.update("fixedEntries",ge=>ge.push({field:"inputs",index:v.get("inputs").size-1},{field:"witnesses",index:v.get("witnesses").size-1},{field:"headerDeps",index:v.get("headerDeps").size-2}))),H.eq(0)&&(P.eq(0)||P.gt((0,t.minimalCellCapacityCompatible)(N))))break}P.gt(0)&&(N.cellOutput.capacity="0x"+P.toString(16),v=v.update("outputs",de=>de.push(N)))}if(!$)return[v,H];if(H.gt(0))throw new Error("Not enough capacity in from address!");return v}async function Q(v,d,g,x,E,{config:h=void 0,LocktimeCellCollector:T=O,enableDeductCapacity:$=!0}){h=h||(0,f.getConfig)();let L=l.BI.from(g);const j=l.BI.from(E);if($)for(const H of d){const q=(0,r.parseFromInfo)(H,{config:h}).fromScript;if(!(0,s.isSecp256k1Blake160MultisigScript)(q,h)&&!(0,s.isSecp256k1Blake160Script)(q,h))continue;const X=v.get("fixedEntries").filter(({field:ne})=>ne==="outputs").maxBy(({index:ne})=>ne);let te=X?X.index+1:0;for(;teue.update(te,()=>N))}}v=v.update("outputs",ne=>ne.filter(N=>!l.BI.from(N.cellOutput.capacity).eq(0)))}let F=l.BI.from(0);if(L.gt(0)){const H=v.get("cellProvider");if(!H)throw new Error("cell provider is missing!");const q=te=>`${te.outPoint.txHash}_${te.outPoint.index}`;let X=(0,o.Set)();for(const te of v.get("inputs"))X=X.add(q(te));for(const te of d){const ne=(0,r.parseFromInfo)(te,{config:h}).fromScript,N=new T(te,H,{config:h,tipHeader:x});for await(const P of N.collect()){const re=P;if(X.has(q(re)))continue;let ue="0x";if((0,s.isDaoScript)(re.cellOutput.type,h)){const ie=h.SCRIPTS.DAO;v=(0,s.addCellDep)(v,{depType:ie.DEP_TYPE,outPoint:{txHash:ie.TX_HASH,index:ie.INDEX}}),v=v.update("headerDeps",ge=>ge.push(re.depositBlockHash,re.withdrawBlockHash));const ce=v.get("headerDeps").size-2,ye={inputType:e.bytes.hexify(e.number.Uint64.pack(ce))};ue=e.bytes.hexify(a.blockchain.WitnessArgs.pack(ye))}let de;if((0,s.isSecp256k1Blake160MultisigScript)(ne,h)){const ie=re.cellOutput.lock.args;de=ie.length===58?l.BI.from(b(ie)):void 0}v=await _(v,re,Object.assign({},te,{since:de}),{config:h,defaultWitness:ue,since:re.since});const V=l.BI.from(re.cellOutput.capacity);let J=V;if(J.gt(L)&&(J=L),L=L.sub(J),F=F.add(V).sub(J),(0,s.isDaoScript)(re.cellOutput.type,h)&&(v=v.update("fixedEntries",ie=>ie.push({field:"inputs",index:v.get("inputs").size-1},{field:"witnesses",index:v.get("witnesses").size-1},{field:"headerDeps",index:v.get("headerDeps").size-2}))),L.eq(0)&&(F.eq(0)||F.gt(j)))break}}}return{txSkeleton:v,capacity:l.BI.from(L.toString()),changeCapacity:l.BI.from(F.toString())}}async function k(v,d,g,x,E,{config:h=void 0,LocktimeCellCollector:T=O,enableDeductCapacity:$=!0}){const L=await Q(v,d,g,x,E,{config:h,LocktimeCellCollector:T,enableDeductCapacity:$});return{txSkeleton:L.txSkeleton,capacity:L.capacity.toBigInt(),changeCapacity:L.changeCapacity.toBigInt()}}async function G(v,d,g,x,{config:E=void 0,LocktimeCellCollector:h=O}={}){return U(v,d,void 0,g,x,{config:E,requireToAddress:!1,LocktimeCellCollector:h})}function W(v,{config:d=void 0}={}){return d=d||(0,f.getConfig)(),v=(0,s.prepareSigningEntries)(v,d,"SECP256K1_BLAKE160"),v=(0,s.prepareSigningEntries)(v,d,"SECP256K1_BLAKE160_MULTISIG"),v}async function R(v,d,g,x,{config:E=void 0,LocktimeCellCollector:h=O}={}){if(E=E||(0,f.getConfig)(),d>=v.get("outputs").size)throw new Error("Invalid output index!");const T=l.BI.from(v.get("outputs").get(d).cellOutput.capacity);return U(v,g,void 0,l.BI.from(T),x,{config:E,requireToAddress:!1,LocktimeCellCollector:h})}async function _(v,d,g,{config:x=void 0,since:E=void 0,defaultWitness:h="0x"}={}){return x=x||(0,f.getConfig)(),v=await I(v,d,g,{config:x,since:E,defaultWitness:h}),v=v.update("outputs",T=>T.remove(T.size-1)),v}async function I(v,d,g,{config:x=void 0,since:E=void 0,defaultWitness:h="0x"}={}){x=x||(0,f.getConfig)();const T=d.cellOutput.lock;if((0,s.isSecp256k1Blake160Script)(T,x))return n.default.setupInputCell(v,d,g,{config:x,defaultWitness:h,since:E});if((0,s.isSecp256k1Blake160MultisigScript)(T,x))return c.secp256k1Blake160Multisig.setupInputCell(v,d,g,{config:x,defaultWitness:h,since:E});throw new Error("Not supported input lock!")}function b(v){if(v.length!==58)throw new Error("Invalid multisig with since args!");return e.number.Uint64LE.unpack("0x"+v.slice(42))}return vi.default={CellCollector:O,transfer:M,transferCompatible:U,payFee:G,prepareSigningEntries:W,injectCapacity:R,setupInputCell:I,injectCapacityWithoutChange:k,injectCapacityWithoutChangeCompatible:Q},vi}var VA;function h5(){if(VA)return Vi;VA=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.default=void 0,Vi.injectCapacity=Q,Vi.payFee=k,Vi.payFeeByFeeRate=v,Vi.prepareSigningEntries=G,Vi.registerCustomLockScriptInfos=M,Vi.setupInputCell=b,Vi.transfer=K;var t=pi(),e=m(N1),r=ei,n=m(Dn),i=Nr,a=y(d5()),s=Ir,o=m(n5()),f=Jo,c=lt,u=wt,l=m(Sn);function p(h){if(typeof WeakMap!="function")return null;var T=new WeakMap,$=new WeakMap;return(p=function(L){return L?$:T})(h)}function y(h,T){if(h&&h.__esModule)return h;if(h===null||typeof h!="object"&&typeof h!="function")return{default:h};var $=p(T);if($&&$.has(h))return $.get(h);var L={__proto__:null},j=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var F in h)if(F!=="default"&&{}.hasOwnProperty.call(h,F)){var H=j?Object.getOwnPropertyDescriptor(h,F):null;H&&(H.get||H.set)?Object.defineProperty(L,F,H):L[F]=h[F]}return L.default=h,$&&$.set(h,L),L}function m(h){return h&&h.__esModule?h:{default:h}}const{ScriptValue:A}=s.values;function S(h,T){console.log(`[${h}] ${T}`)}const w={configHashCode:0,_predefinedInfos:[],_customInfos:[],get infos(){return[...this._predefinedInfos,...this._customInfos]}};function C(){w.configHashCode=0,w._predefinedInfos=[],w._customInfos=[]}function O(){return w}function M(h){w._customInfos=h}function U({config:h=void 0}={}){h=h||(0,i.getConfig)();const T=()=>{var L,j,F,H;const q=(L=h)===null||L===void 0?void 0:L.SCRIPTS.SECP256K1_BLAKE160,X=(j=h)===null||j===void 0?void 0:j.SCRIPTS.SECP256K1_BLAKE160_MULTISIG,te=(F=h)===null||F===void 0?void 0:F.SCRIPTS.ANYONE_CAN_PAY,ne=(H=h)===null||H===void 0?void 0:H.SCRIPTS.OMNILOCK,N=[];return q?N.push({codeHash:q.CODE_HASH,hashType:q.HASH_TYPE,lockScriptInfo:n.default}):S("warn","SECP256K1_BLAKE160 script info not found in config!"),X?N.push({codeHash:X.CODE_HASH,hashType:X.HASH_TYPE,lockScriptInfo:e.default}):S("warn","SECP256K1_BLAKE160_MULTISIG script info not found in config!"),te?N.push({codeHash:te.CODE_HASH,hashType:te.HASH_TYPE,lockScriptInfo:o.default}):S("warn","ANYONE_CAN_PAY script info not found in config!"),ne?N.push({codeHash:ne.CODE_HASH,hashType:ne.HASH_TYPE,lockScriptInfo:l.default}):S("warn","OMNILOCK script info not found in config!"),N},$=s.utils.hashCode(Buffer.from(JSON.stringify(h)));w.infos.length===0?(w._predefinedInfos=T(),w.configHashCode=$):$!==w.configHashCode&&(S("warn","`config` changed, regenerate lockScriptInfos!"),w._predefinedInfos=T(),w.configHashCode=$)}async function K(h,T,$,L,j,F,{config:H=void 0,useLocktimeCellsFirst:q=!0,LocktimePoolCellCollector:X=a.CellCollector}={}){var te;H=H||(0,i.getConfig)();const ne=u.BI.from(L);if(!$)throw new Error("You must provide a to address!");const N=(0,t.parseAddress)($,{config:H}),P={cellOutput:{capacity:"0x"+ne.toString(16),lock:N,type:void 0},data:"0x"};U({config:H});const re=w.infos.find(ue=>ue.codeHash===N.codeHash&&ue.hashType===N.hashType);return re&&(te=re.lockScriptInfo)!==null&&te!==void 0&&te.setupOutputCell?h=await re.lockScriptInfo.setupOutputCell(h,P,{config:H}):h=h.update("outputs",ue=>ue.push(P)),h=await Q(h,T,ne.toString(),j,F,{config:H,useLocktimeCellsFirst:q,LocktimePoolCellCollector:X}),h}async function Q(h,T,$,L,j,{config:F=void 0,useLocktimeCellsFirst:H=!0,LocktimePoolCellCollector:q=a.CellCollector,enableDeductCapacity:X=!0}={}){F=F||(0,i.getConfig)();let ne=u.BI.from($);if(T.length===0)throw new Error("No from info provided!");const P={cellOutput:{capacity:"0x0",lock:(0,r.parseFromInfo)(L||T[0],{config:F}).fromScript,type:void 0},data:"0x"},re=u.BI.from((0,t.minimalCellCapacityCompatible)(P));let ue=u.BI.from(0);if(H){if(j){const de=await a.default.injectCapacityWithoutChangeCompatible(h,T,ne.toString(),j,re.toString(),{config:F,LocktimeCellCollector:q,enableDeductCapacity:X});h=de.txSkeleton,ne=u.BI.from(de.capacity),ue=u.BI.from(de.changeCapacity)}if(ne.gt(0)){const de=await R(h,T,ne,re,{config:F,enableDeductCapacity:X});h=de.txSkeleton,ne=de.capacity,ue=de.changeCapacity}else if(ne.eq(0)&&ue.gt(0)&&ue.lt(re)){const de=await R(h,T,re.sub(ue),u.BI.from(0),{config:F,enableDeductCapacity:X});h=de.txSkeleton,ne=de.capacity,ue=de.changeCapacity}}else{const de=await R(h,T,ne,re,{config:F,enableDeductCapacity:X});if(h=de.txSkeleton,ne=de.capacity,ue=de.changeCapacity,j){if(ne.gt(0)){const V=await a.default.injectCapacityWithoutChangeCompatible(h,T,ne.toString(),j,re.toString(),{config:F,LocktimeCellCollector:q,enableDeductCapacity:X});h=V.txSkeleton,ne=u.BI.from(V.capacity),ue=u.BI.from(V.changeCapacity)}else if(ne.eq(0)&&ue.gt(0)&&ue.lt(re)){const V=await a.default.injectCapacityWithoutChangeCompatible(h,T,re.sub(ue).toString(),j,0,{config:F,LocktimeCellCollector:q,enableDeductCapacity:X});h=V.txSkeleton,ne=u.BI.from(V.capacity),ue=u.BI.from(V.changeCapacity)}}}if(ne.gt(0))throw new Error("Not enough capacity in from infos!");if(ue.gt(0)&&ue.lt(re))throw new Error("Not enough capacity in from infos for change!");return ue.gt(0)&&(P.cellOutput.capacity="0x"+ue.toString(16),h=h.update("outputs",de=>de.push(P))),h}async function k(h,T,$,L,{config:j=void 0,useLocktimeCellsFirst:F=!0,enableDeductCapacity:H=!0}={}){return Q(h,T,$,void 0,L,{config:j,useLocktimeCellsFirst:F,enableDeductCapacity:H})}function G(h,{config:T=void 0}={}){T=T||(0,i.getConfig)(),U({config:T});for(const $ of w.infos)h=$.lockScriptInfo.prepareSigningEntries(h,{config:T});return h}async function W(h,T,$,L,{config:j=void 0,enableDeductCapacity:F=!0}={}){const H=await R(h,T,$,L,{config:j,enableDeductCapacity:F});return{txSkeleton:H.txSkeleton,capacity:BigInt(H.capacity.toString()),changeCapacity:BigInt(H.changeCapacity.toString())}}async function R(h,T,$,L,{config:j=void 0,enableDeductCapacity:F=!0}={}){j=j||(0,i.getConfig)();let H=u.BI.from($);const q=h.get("cellProvider");if(!q)throw new Error("Cell Provider is missing!");const X=P=>{var re,ue;return`${(re=P.outPoint)===null||re===void 0?void 0:re.txHash}_${(ue=P.outPoint)===null||ue===void 0?void 0:ue.index}`};let te=(0,f.Set)();for(const P of h.get("inputs"))te=te.add(X(P));const ne=T.map(P=>(0,r.parseFromInfo)(P,{config:j}).fromScript);for(const P of ne)F&&H.gt(0)&&([h,H]=_(h,P,H));U({config:j});let N=u.BI.from(0);if(H.gt(0))e:for(const P of T){const re=w.infos.map(ue=>new ue.lockScriptInfo.CellCollector(P,q,{config:j}));for(const ue of re)for await(const de of ue.collect()){const V=X(de);if(te.has(V))continue;te=te.add(V);const J=await I(h,de,P,{config:j,needCapacity:H});h=J.txSkeleton;const ie=u.BI.from(J.availableCapacity);let ce=ie;if(ce.gt(H)&&(ce=H),H=H.sub(ce),N=N.add(ie.sub(ce)),H.eq(0)&&(N.eq(0)||N.gt(L)))break e}}return{txSkeleton:h,capacity:H,changeCapacity:N}}function _(h,T,$){let L=u.BI.from($);const j=h.get("fixedEntries").filter(({field:H})=>H==="outputs").maxBy(({index:H})=>H);let F=j?j.index+1:0;for(;FN.update(F,()=>q))}}return h=h.update("outputs",H=>H.filter(q=>u.BI.from(q.cellOutput.capacity).toString()!==u.BI.from(0).toString())),[h,L]}async function I(h,T,$,{config:L=void 0,since:j=void 0,defaultWitness:F="0x",needCapacity:H=void 0}={}){L=L||(0,i.getConfig)(),h=await b(h,T,$,{config:L,since:j,defaultWitness:F});const q=h.get("outputs").size-1,X=h.get("outputs").get(q);if(!X)throw new Error("Impossible: can not find last output");const te=u.BI.from(X.cellOutput.capacity),ne=h.get("fixedEntries").findIndex(ue=>ue.field==="outputs"&&ue.index===q),N=T.cellOutput.lock;let P=u.BI.from(0);if(L.SCRIPTS.ANYONE_CAN_PAY&&(0,c.isAcpScript)(N,L)){const ue=!!($&&typeof $=="object"&&"destroyable"in $&&$.destroyable),de=H?u.BI.from(H):te;if(ue)P=te,h=h.update("outputs",V=>V.remove(q)),ne>=0&&(h=h.update("fixedEntries",V=>V.remove(ne)));else{const V=u.BI.from((0,t.minimalCellCapacityCompatible)(X)),J=te.sub(V),ie=JSON.parse(JSON.stringify(X));let ce=V;P=J,de.lt(J)&&(ce=te.sub(de),P=de),ie.cellOutput.capacity="0x"+ce.toString(16),h=h.update("outputs",ye=>ye.update(q,()=>ie))}}else if(ne<0){var re;P=u.BI.from((re=h.get("outputs").get(q))===null||re===void 0?void 0:re.cellOutput.capacity),h=h.update("outputs",ue=>ue.remove(q))}return{txSkeleton:h,availableCapacity:P}}async function b(h,T,$,{config:L=void 0,since:j=void 0,defaultWitness:F=void 0}={}){L=L||(0,i.getConfig)(),U({config:L});const H=T.cellOutput.lock,q=w.infos.find(X=>X.codeHash===H.codeHash&&X.hashType===H.hashType);if(!q)throw new Error("No LockScriptInfo found for setupInputCell!");return q.lockScriptInfo.setupInputCell(h,T,$,{config:L,since:j,defaultWitness:F})}async function v(h,T,$,L,{config:j=void 0,useLocktimeCellsFirst:F=!0,enableDeductCapacity:H=!0}={}){let q=0,X=h,te=x(X);for(;te>q;){q=te;const ne=g(q,$);X=await k(h,T,ne,L,{config:j,useLocktimeCellsFirst:F,enableDeductCapacity:H}),te=x(X)}return X}function d(h,T){const $=g(h,T);return BigInt($.toString())}function g(h,T){const $=u.BI.from(1e3),L=u.BI.from(h).mul(T),j=L.div($);return j.mul($).lt(L)?j.add(1):u.BI.from(j)}function x(h){const T=(0,t.createTransactionFromSkeleton)(h);return E(T)}function E(h){return s.blockchain.Transaction.pack(h).byteLength+4}return Vi.default={transfer:K,payFee:k,prepareSigningEntries:G,injectCapacity:Q,setupInputCell:b,registerCustomLockScriptInfos:M,payFeeByFeeRate:v,__tests__:{_commonTransfer:W,resetLockScriptInfos:C,getLockScriptInfos:O,generateLockScriptInfos:U,getTransactionSizeByTx:E,getTransactionSize:x,calculateFee:d,calculateFeeCompatible:g}},Vi}var GA;function p5(){if(GA)return Hn;GA=1,Object.defineProperty(Hn,"__esModule",{value:!0}),Hn.CellCollector=void 0,Hn.calculateDaoEarliestSince=Q,Hn.calculateDaoEarliestSinceCompatible=k,Hn.calculateMaximumWithdraw=_,Hn.calculateMaximumWithdrawCompatible=I,Hn.default=void 0,Hn.deposit=w,Hn.extractDaoDataCompatible=R,Hn.listDaoCells=S,Hn.unlock=K;var t=pi(),e=Ir,r=st,n=Nr,i=l(Dn),a=l(N1),s=ei,o=lt,f=wt,c=R2(),u=l(h5());function l(b){return b&&b.__esModule?b:{default:b}}const{parseSince:p}=e.since,y="0x0000000000000000",m=f.BI.from(180);class A{constructor(v,d,g,{config:x=void 0}={}){if(!d)throw new Error("Cell Provider is missing!");x=x||(0,n.getConfig)();const E=(0,s.parseFromInfo)(v,{config:x}).fromScript,h=(0,o.generateDaoScript)(x),T=g==="deposit"?y:"any";this.cellType=g,this.cellCollector=d.collector({lock:E,type:h,data:T})}async*collect(){for await(const v of this.cellCollector.collect())this.cellType==="withdraw"&&v.data===y||(yield v)}}Hn.CellCollector=A;async function*S(b,v,d,{config:g=void 0}={}){const x=new A(v,b,d,{config:g});for await(const E of x.collect())yield E}async function w(b,v,d,g,{config:x=void 0,enableNonSystemScript:E=!1}={}){x=x||(0,n.getConfig)();const h=x.SCRIPTS.DAO;if(!h)throw new Error("Provided config does not have DAO script setup!");if(C(v,x),b=W(b,x),!d)throw new Error("You must provide a to address!");const T=(0,t.parseAddress)(d,{config:x}),$={codeHash:h.CODE_HASH,hashType:h.HASH_TYPE,args:"0x"};b=b.update("outputs",j=>j.push({cellOutput:{capacity:"0x"+f.BI.from(g).toString(16),lock:T,type:$},data:y,outPoint:void 0,blockHash:void 0}));const L=b.get("outputs").size-1;if(b=b.update("fixedEntries",j=>j.push({field:"outputs",index:L})),typeof v=="string"){const j=(0,t.parseAddress)(v,{config:x});(0,o.isSecp256k1Blake160Script)(j,x)?b=await i.default.injectCapacity(b,L,v,{config:x}):(0,o.isSecp256k1Blake160MultisigScript)(j,x)?b=await a.default.injectCapacity(b,L,v,{config:x}):E&&(b=await u.default.injectCapacity(b,[v],g,(0,t.encodeToAddress)((0,s.parseFromInfo)(v).fromScript,{config:x}),void 0,{config:x}))}else v&&((0,s.isMultisigFromInfo)(v)?b=await a.default.injectCapacity(b,L,v,{config:x}):E&&(b=await u.default.injectCapacity(b,[v],g,(0,t.encodeToAddress)((0,s.parseFromInfo)(v).fromScript,{config:x}),void 0,{config:x})));return b}function C(b,v){let d;if(typeof b=="string"){const x=(0,t.parseAddress)(b,{config:v}).args;x.length===58&&(d=r.number.Uint64LE.unpack("0x"+x.slice(42)).toHexString())}else"R"in b&&(d=b.since);if(d!=null){const{relative:g,type:x}=p(d);if(!(!g&&x==="epochNumber"))throw new Error("Can't deposit a dao cell with multisig locktime which not using absolute-epoch-number format!")}}async function O(b,v,d,{config:g=void 0,enableNonSystemScript:x=!1}={}){if(g=g||(0,n.getConfig)(),G(g),b=W(b,g),b.get("inputs").size!==b.get("outputs").size)throw new Error("Input size must equals to output size in txSkeleton!");if(!g.SCRIPTS.DAO)throw new Error("Provided config does not have DAO script setup!");if(!b.get("cellProvider"))throw new Error("Cell provider is missing!");const h=v.cellOutput.type,T=g.SCRIPTS.DAO;if(!h||h.codeHash!==T.CODE_HASH||h.hashType!==T.HASH_TYPE||v.data!==y)throw new Error("fromInput is not a DAO deposit cell.");const $=v.cellOutput.lock;(0,o.isSecp256k1Blake160Script)($,g)?b=await i.default.setupInputCell(b,v,void 0,{config:g}):(0,o.isSecp256k1Blake160MultisigScript)($,g)?b=await a.default.setupInputCell(b,v,d||(0,t.generateAddress)($,{config:g}),{config:g}):x&&(b=await u.default.setupInputCell(b,v,d||(0,t.encodeToAddress)($,{config:g}),{config:g}));const L=b.get("outputs").size-1,j=b.get("outputs").get(L),F=JSON.parse(JSON.stringify(j));if(v.blockNumber)F.data=r.bytes.hexify(r.number.Uint64.pack(v.blockNumber));else throw new Error("fromInput has no blockNumber!");return b=b.update("outputs",H=>H.update(L,()=>F)),b=b.update("headerDeps",H=>H.push(v.blockHash)),b=b.update("fixedEntries",H=>H.push({field:"inputs",index:b.get("inputs").size-1},{field:"outputs",index:b.get("outputs").size-1})),b}function M(b){const v=f.BI.from(b);return{length:v.shr(40).and(4095),index:v.shr(24).and(4095),number:v.and(16777215)}}function U({length:b,index:v,number:d}){const g=f.BI.from(b),x=f.BI.from(v),E=f.BI.from(d);return f.BI.from(32).shl(56).add(g.shl(40)).add(x.shl(24)).add(E)}async function K(b,v,d,g,x,{config:E=void 0,RpcClient:h=c.RPC}={}){if(E=E||(0,n.getConfig)(),G(E),b=W(b,E),!E.SCRIPTS.DAO)throw new Error("Provided config does not have DAO script setup!");const T=b.get("cellProvider");if(!T)throw new Error("Cell provider is missing!");const $=new h(T.uri),L=v.cellOutput.type,j=E.SCRIPTS.DAO;if(!L||L.codeHash!==j.CODE_HASH||L.hashType!==j.HASH_TYPE||v.data!==y)throw new Error("depositInput is not a DAO deposit cell.");const F=d.cellOutput.type;if(!F||F.codeHash!==j.CODE_HASH||F.hashType!==j.HASH_TYPE||d.data===y)throw new Error("withdrawInput is not a DAO withdraw cell.");const H=await $.getHeader(v.blockHash),q=M(H.epoch),X=await $.getHeader(d.blockHash),te=M(X.epoch),ne=te.index.mul(q.length),N=q.index.mul(te.length);let P=te.number.sub(q.number);ne.gt(N)&&(P=P.add(1));const re=P.add(m).sub(1).div(m).mul(m),ue={number:f.BI.from(q.number.add(re)),index:f.BI.from(q.index),length:f.BI.from(q.length)},de=U(ue),V="0x"+I(d,H.dao,X.dao).toString(16),J=(0,t.parseAddress)(g,{config:E});b=b.update("outputs",He=>He.push({cellOutput:{capacity:V,lock:J,type:void 0},data:"0x",outPoint:void 0,blockHash:void 0}));const ie="0x"+de.toString(16);for(;b.get("witnesses").sizeHe.push("0x"));b=b.update("headerDeps",He=>He.push(v.blockHash,d.blockHash));const ce=b.get("headerDeps").size-2,ye={inputType:r.bytes.hexify(r.number.Uint64LE.pack(ce))},ge=r.bytes.hexify(e.blockchain.WitnessArgs.pack(ye)),Se=d.cellOutput.lock;(0,o.isSecp256k1Blake160Script)(Se,E)?b=await i.default.setupInputCell(b,d,void 0,{config:E,since:ie,defaultWitness:ge}):(0,o.isSecp256k1Blake160MultisigScript)(Se,E)&&(b=await a.default.setupInputCell(b,d,x||(0,t.generateAddress)(Se,{config:E}),{config:E,since:ie,defaultWitness:ge}));const kt=b.get("outputs").size-1;return b=b.update("outputs",He=>He.remove(kt)),b=b.update("fixedEntries",He=>He.push({field:"inputs",index:b.get("inputs").size-1},{field:"outputs",index:b.get("outputs").size-1},{field:"witnesses",index:b.get("witnesses").size-1},{field:"headerDeps",index:b.get("headerDeps").size-2})),b}function Q(b,v){const d=k(b,v);return BigInt(d.toString())}function k(b,v){const d=M(b),g=M(v),x=g.index.mul(d.length),E=d.index.mul(g.length);let h=g.number.sub(d.number);x.gt(E)&&(h=h.add(1));const T=h.add(m).sub(1).div(m).mul(m),$={number:f.BI.from(d.number.add(T)),index:f.BI.from(d.index),length:f.BI.from(d.length)};return U($)}function G(b){if(!b.SCRIPTS.DAO)throw new Error("Provided config does not have DAO script setup!")}function W(b,v){const d=v.SCRIPTS.DAO;return(0,o.addCellDep)(b,{outPoint:{txHash:d.TX_HASH,index:d.INDEX},depType:d.DEP_TYPE})}function R(b){if(!/^(0x)?([0-9a-fA-F]){64}$/.test(b))throw new Error("Invalid dao format!");const v=8*2,d=b.startsWith("0x")?b.slice(2):b;return["c","ar","s","u"].map((g,x)=>({[g]:r.number.Uint64LE.unpack("0x"+d.slice(v*x,v*(x+1)))})).reduce((g,x)=>({...g,...x}),{})}function _(b,v,d){return I(b,v,d).toBigInt()}function I(b,v,d){const g=f.BI.from(R(v).ar),x=f.BI.from(R(d).ar),E=f.BI.from((0,t.minimalCellCapacityCompatible)(b));return f.BI.from(b.cellOutput.capacity).sub(E).mul(x).div(g).add(E)}return Hn.default={deposit:w,withdraw:O,unlock:K,calculateMaximumWithdraw:_,calculateMaximumWithdrawCompatible:I,calculateDaoEarliestSince:Q,calculateDaoEarliestSinceCompatible:k,CellCollector:A,listDaoCells:S},Hn}var N2=p5();const qt=100000000n;function Ec(t){return"0x"+t.toString(16)}function Np(...t){return t.reduce((e,r)=>e>r?e:r)}function tQ(...t){return t.reduce((e,r)=>eEn(e.cellOutput.lock,t)?t:void 0}function rQ(t,e){const r=[],n=[];for(const i of t){if(i.cellOutput.type!==void 0||i.data!=="0x"){n.push(i);continue}const a=e(i);if(!a){n.push(i);continue}r.push(Yt.from({...i,cellOutput:{lock:a,capacity:i.cellOutput.capacity}}))}return{capacities:r,notCapacities:n}}function nQ(t,e,r){const n=[],i=[];for(const a of t){if(!En(a.cellOutput.type,e)){i.push(a);continue}const s=r(a);if(!s){i.push(a);continue}n.push(Yt.from({...a,cellOutput:{lock:s,type:e,capacity:a.cellOutput.capacity}}))}return{types:n,notTypes:i}}function iQ(t,e,r){const n=h1(r.epoch),i=[],a=[];for(const s of t)U2(n,Cp(e(s)))>=0?i.push(s):a.push(s);return{mature:i,notMature:a}}const aQ="Comparing two Scripts that both are undefined";function En(t,e){if(!t&&!e)throw Error(aQ);return!t||!e?!1:t.codeHash===e.codeHash&&t.hashType===e.hashType&&t.args===e.args}function U2(t,e){if(t.numbere.number)return 1;const r=t.index*e.length,n=e.index*t.length;return rn?1:0}const sQ="Zero EpochSinceValue length";function rM(t,e){if(t.length===0||e.length===0)throw Error(sQ);t.length!==e.length&&(e={length:t.length,index:Math.ceil(e.index*t.length/e.length),number:e.number});const r=t.index+e.index,n=t.length,i=r%n,a=t.number+(r-i)/n;return{length:n,index:i,number:a}}function oQ(t){const e=[...t];for(let r=e.length-1;r>0;r--){const n=Math.floor(Math.random()*(r+1));[e[r],e[n]]=[e[n],e[r]]}return e}function fQ(t,e){let[r,n]=[0,t];for(;r0)throw Error(lQ)}const o=e=="matched",f=o?i.inputs+1:t.inputs.size,c=o?i.outputs+1:t.outputs.size;return t=bQ(t,a,s),t=pQ(t,a,s),t=hQ(t,f,a),t=dQ(t,f,a,c,s),t=t.update("inputs",u=>u.splice(f,0,...a)),t=t.update("outputs",u=>u.splice(c,0,...s)),o&&(t=g5(t,i.set("inputs",i.inputs+a.size).set("outputs",i.outputs+s.size))),t}const WA=gc(ey.pack({lock:void 0,inputType:void 0,outputType:void 0}));function dQ(t,e,r,n,i){const a=Np(t.inputs.size,t.outputs.size,t.witnesses.size,e,n),s=[],o=[],f=[];for(let l=0;ll.cellOutput.lock[uu])),o.splice(e,0,...r.map(l=>{var p;return(p=l.cellOutput.type)==null?void 0:p[uu]})),f.splice(n,0,...i.map(l=>{var p;return(p=l.cellOutput.type)==null?void 0:p[uu]}));const c=Np(o.length,f.length),u=[];for(let l=0;lt.inputSinces.get(o,n)),a=[];for(const s of r){const o=s.cellOutput.lock[Hs],f=s.cellOutput.type?s.cellOutput.type[Hs]:o;o===n||o===f?a.push(f):f===n?a.push(o):U2(Cp(o),Cp(f))==-1?a.push(f):a.push(o)}return i.splice(e,0,...a),t.set("inputSinces",Zo(i.map((s,o)=>[o,s]).filter(({1:s})=>s!==n)))}function pQ(t,e,r){const n=[];for(const i of e){const a=i.cellOutput.lock;n.push(...a[fi])}for(const i of[...e,...r]){const a=i.cellOutput.type;a!==void 0&&n.push(...a[fi])}return nM(t,...n.map(i=>i.hash))}function nM(t,...e){const r=b5(t);let n=t.headerDeps.push(...e);return n=Aa(new Set(n)),t=g5(t,r.set("headerDeps",n.size-1)),t.set("headerDeps",n)}function bQ(t,e,r){const n=[];for(const i of e){const a=i.cellOutput.lock;n.push(...a[Oi])}for(const i of[...e,...r]){const a=i.cellOutput.type;a!==void 0&&n.push(...a[Oi])}return yQ(t,...n)}const gQ=t=>`${t.outPoint.txHash}-${t.outPoint.index}-${t.depType}`;function yQ(t,...e){const r=b5(t);let n=t.cellDeps.push(...e);return n=Aa(new Map(n.map(i=>[gQ(i),i])).values()),t=g5(t,r.set("cellDeps",n.size-1)),t.set("cellDeps",n)}function b5(t){return AQ(t.fixedEntries.sort((e,r)=>e.index-r.index).map(e=>[e.field,e.index]))}const vQ=Aa(["cellDeps","headerDeps","inputs","outputs"]);function g5(t,e){return t.set("fixedEntries",vQ.map(r=>Object.freeze({field:r,index:e[r]})).filter(({index:r})=>r>=0))}function _Q(t){return t.inputs.size>0&&t.outputs.size>0}function mQ(t){return Y4.pack(w2.createTransactionFromSkeleton(t)).byteLength+4}function wQ(t,e){const r=1000n,n=BigInt(t)*e,i=n/r;return i*rYt.from({...c,cellOutput:{lock:u,type:xn.from({...o,[fi]:p?[l,p]:[l],[Hs]:y??o[Hs]}),capacity:c.cellOutput.capacity},blockHash:l.hash});for(const c of t){const u=e(c);if(!u||!y5(c,n)){s.push(c);continue}if(!c.blockNumber)throw Error(iM);const l=r(c.blockNumber,c);if(c.data===k2)i.push(f(c,u,l));else{const p=r(Ec(Td.unpack(c.data)),c),y=N2.calculateDaoEarliestSinceCompatible(p.epoch,l.epoch).toHexString();a.push(f(c,u,l,p,y))}}return{deposits:i,withdrawalRequests:a,notDaos:s}}const k2="0x0000000000000000";function y5(t,e){return En(t.cellOutput.type,e.defaultScript("DAO"))}function aM(t,e){return y5(t,e)&&t.data===k2}function sM(t,e){return y5(t,e)&&t.data!==k2}function EQ(t,e,r,n){const i=Yt.from({lock:r,type:n.defaultScript("DAO"),data:k2}),a=e.map(s=>Yt.from({...i,capacity:Ec(s)}));return Ea(t,"append",[],a)}const xQ="Withdrawal request lock has different size";function SQ(t,e,r){const n=[];for(const i of e){if(i.cellOutput.lock.args.length!=r.args.length)throw Error(xQ);n.push(Yt.from({...i.cellOutput,lock:r,data:gc(Td.pack(BigInt(i.blockNumber)))}))}return Ea(t,"matched",e,n)}function IQ(t,e){const r=[];for(const a of e)r.push(...a.cellOutput.type[fi].map(s=>s.hash));t=nM(t,...r);const n=[],i=new Map(t.headerDeps.map((a,s)=>[a,s]));for(const a of e){const s=a.cellOutput.type[fi][1];n.push(Yt.from({...a,type:xn.from({...a.cellOutput.type,[uu]:gc(Td.pack(i.get(s.hash)))})}))}return Ea(t,"append",n,[])}function CQ(t,e){const r=H$(e),n=t.cellOutput.type[fi][0].epoch;return Cp(N2.calculateDaoEarliestSinceCompatible(n,r).toHexString())}function vg(t,e){let r=0n;for(const n of t.inputs)if(sM(n,e)){const i=n,[a,s]=i.cellOutput.type[fi],o=N2.calculateMaximumWithdraw(n,s.dao,a.dao);r+=o}else r+=BigInt(n.cellOutput.capacity);return t.outputs.forEach(n=>r-=BigInt(n.cellOutput.capacity)),r}function TQ(t,e,r,n){let i=Yt.from({lock:e});const a=BigInt(i.cellOutput.capacity),s=Ea(t,"append",[],[i]),o=r(s),f=vg(s,n)-o;return f>0n?(i=Yt.from({...i,capacity:Ec(a+f)}),t=Ea(t,"append",[],[i])):t=s,{tx:t,txFee:o,freeCkb:f}}function OQ(){const t=n2.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=_e.jsx(_e.Fragment,{children:_e.jsxs("h1",{className:"flex flex-row items-center justify-center py-4 text-5xl font-medium",children:[_e.jsx("span",{className:"mr-2 text-5xl text-amber-400",children:"{"}),_e.jsx("span",{children:"iCKB DApp"}),_e.jsx("span",{className:"ml-2 text-5xl text-amber-400",children:"}"})]})}),t[0]=e):e=t[0],e}function ZA(t){const e=n2.c(8),{walletConfig:r}=t,{chain:n,address:i}=r,a=`https://${n!=="mainnet"?"testnet.":""}explorer.nervos.org/address/${i}`;let s,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=_e.jsx("span",{className:"mr-2 text-5xl text-amber-400",children:"{"}),o={direction:"rtl"},e[0]=s,e[1]=o):(s=e[0],o=e[1]);let f;e[2]!==i?(f=_e.jsx("h1",{style:o,className:"-ml-3 truncate text-3xl",children:i}),e[2]=i,e[3]=f):f=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=_e.jsx("span",{className:"ml-2 text-5xl text-amber-400",children:"}"}),e[4]=c):c=e[4];let u;return e[5]!==a||e[6]!==f?(u=_e.jsxs("a",{href:a,target:"_blank",className:"flex flex-row items-center justify-center rounded-2xl py-4 font-medium",children:[s,f,c]}),e[5]=a,e[6]=f,e[7]=u):u=e[7],u}function oM(t){return t==="C"}function a6(t){return t?"C":"I"}function BQ(t){let e=0;for(;eU2(e,r)===-1?r:e)}const uM=Object.freeze({number:0,index:0,length:1}),Fl=Object.freeze({tx:w2.TransactionSkeleton(),error:"",fee:0n,estimatedMaturity:uM}),lM=1000n*qt,{union:MQ,struct:ju}=st.molecule;function RQ(t){return st.createFixedBytesCodec({pack:st.bytes.bytify,unpack:st.bytes.hexify,byteLength:t})}const LQ=RQ(32),dM=ju({depositQuantity:RF,depositAmount:Td},["depositQuantity","depositAmount"]),hM=ju({ownedDistance:PB},["ownedDistance"]),JA=ju({ckbMultiplier:Td,udtMultiplier:Td},["ckbMultiplier","udtMultiplier"]),pM=ju({ckbToUdt:JA,udtToCkb:JA,ckbMinMatchLog:MF},["ckbToUdt","udtToCkb","ckbMinMatchLog"]),HQ=ju({padding:LQ,masterDistance:PB,orderInfo:pM},["padding","masterDistance","orderInfo"]),PQ=ju({masterOutpoint:LF,orderInfo:pM},["masterOutpoint","orderInfo"]),eE=MQ({MintOrderData:HQ,MatchOrderData:PQ},["MintOrderData","MatchOrderData"]),Th=ju({udtAmount:e6},["udtAmount"]),v5=st.createBytesCodec({pack:t=>st.bytes.concat(Th.pack(t),eE.pack(t)),unpack:t=>{const e=t.slice(0,Th.byteLength),r=t.slice(Th.byteLength),n=Th.unpack(e),i=eE.unpack(r);return{...n,...i}}}),NQ=[{name:"ICKB_LOGIC",tx_hash:"0x80930f4b12169ce124840aeb42a9d3105d592584382e95d1ada111da8347e337",index:0,occupied_capacity:54717e8,data_hash:"0x2a8100ab5990fa055ab1b50891702e1e895c7bd1df6322cd725c1a6115873bd3",type_id:null},{name:"LIMIT_ORDER",tx_hash:"0x80930f4b12169ce124840aeb42a9d3105d592584382e95d1ada111da8347e337",index:1,occupied_capacity:34261e8,data_hash:"0x49dfb6afee5cc8ac4225aeea8cb8928b150caf3cd92fea33750683c74b13254a",type_id:null},{name:"OWNED_OWNER",tx_hash:"0x80930f4b12169ce124840aeb42a9d3105d592584382e95d1ada111da8347e337",index:2,occupied_capacity:27981e8,data_hash:"0xacc79e07d107831feef4c70c9e683dac5644d5993b9cb106dca6e74baa381bd0",type_id:null},{name:"XUDT",tx_hash:"0x80930f4b12169ce124840aeb42a9d3105d592584382e95d1ada111da8347e337",index:3,occupied_capacity:33757e8,data_hash:"0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95",type_id:null}],UQ=[{name:"ickb_dep_group",tx_hash:"0x0152f73978779b99eb5aeed9ae9879a7004bd7c69fd858da443b535cb2c9df1d",index:0,data_hash:"0xb208b98b17ff0f740464299171f2285cbd4dcf6792a4058a9ff365eed15e19e3",occupied_capacity:353e8}],kQ={cell_recipes:NQ,dep_group_recipes:UQ},zQ=[{name:"ICKB_LOGIC",tx_hash:"0x9ac989b3355764f76cdce02c69dedb819fdfbcbda49a7db1a2c9facdfdb9a7fe",index:0,occupied_capacity:54717e8,data_hash:"0x2a8100ab5990fa055ab1b50891702e1e895c7bd1df6322cd725c1a6115873bd3",type_id:null},{name:"LIMIT_ORDER",tx_hash:"0x9ac989b3355764f76cdce02c69dedb819fdfbcbda49a7db1a2c9facdfdb9a7fe",index:1,occupied_capacity:34261e8,data_hash:"0x49dfb6afee5cc8ac4225aeea8cb8928b150caf3cd92fea33750683c74b13254a",type_id:null},{name:"OWNED_OWNER",tx_hash:"0x9ac989b3355764f76cdce02c69dedb819fdfbcbda49a7db1a2c9facdfdb9a7fe",index:2,occupied_capacity:27981e8,data_hash:"0xacc79e07d107831feef4c70c9e683dac5644d5993b9cb106dca6e74baa381bd0",type_id:null}],$Q=[{name:"ickb_dep_group",tx_hash:"0xf7ece4fb33d8378344cab11fcd6a4c6f382fd4207ac921cf5821f30712dcd311",index:0,data_hash:"0x8d3a9737808fc4a3c7f9e554be9045333c5082bf3b82f8a33873c367a2b2307f",occupied_capacity:353e8}],jQ={cell_recipes:zQ,dep_group_recipes:$Q},FQ=[{name:"ICKB_LOGIC",tx_hash:"0xd7309191381f5a8a2904b8a79958a9be2752dbba6871fa193dab6aeb29dc8f44",index:0,occupied_capacity:54717e8,data_hash:"0x2a8100ab5990fa055ab1b50891702e1e895c7bd1df6322cd725c1a6115873bd3",type_id:null},{name:"LIMIT_ORDER",tx_hash:"0xd7309191381f5a8a2904b8a79958a9be2752dbba6871fa193dab6aeb29dc8f44",index:1,occupied_capacity:34261e8,data_hash:"0x49dfb6afee5cc8ac4225aeea8cb8928b150caf3cd92fea33750683c74b13254a",type_id:null},{name:"OWNED_OWNER",tx_hash:"0xd7309191381f5a8a2904b8a79958a9be2752dbba6871fa193dab6aeb29dc8f44",index:2,occupied_capacity:27981e8,data_hash:"0xacc79e07d107831feef4c70c9e683dac5644d5993b9cb106dca6e74baa381bd0",type_id:null}],qQ=[{name:"ickb_dep_group",tx_hash:"0x621a6f38de3b9f453016780edac3b26bfcbfa3e2ecb47c2da275471a5d3ed165",index:0,data_hash:"0x94d59795c742dfb381c8e8d8beee0362d0bf8f8921212ed15f87acd89a3ce78b",occupied_capacity:353e8}],KQ={cell_recipes:FQ,dep_group_recipes:qQ},QQ="The requested script is missing in the old config";function bM(t,e){const{cell_recipes:r,dep_group_recipes:n}=t==="mainnet"?KQ:t==="testnet"?jQ:kQ,{tx_hash:i,index:a}=n[0],s=Fo.from({txHash:i,index:Ec(a)}),o={};for(const c of r)o[c.name]=new tp(xn.from({...va,codeHash:c.type_id??c.data_hash,hashType:c.type_id?"type":"data1",[Oi]:[lu.from({outPoint:s,depType:"depGroup"})]}));const f=["SECP256K1_BLAKE160","DAO","SECP256K1_BLAKE160_MULTISIG"];if(t!=="devnet")if(t==="testnet")f.push("XUDT"),e={...e,XUDT:new tp(xn.from({...va,codeHash:"0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95",hashType:"data1",[Oi]:[lu.from({outPoint:Fo.from({txHash:"0xbf6fb538763efec2a70a6a3dcb7242787087e1030c4e7d86585bc63a9d337f5f",index:"0x0"}),depType:"code"})]}))};else{if(e.XUDT.HASH_TYPE!=="data1")throw Error("Expected data1 hashType for XUDT");f.push("XUDT")}for(const c of f){const u=e[c];if(!u)throw Error(QQ);o[c]=new tp(xn.from({...u.defaultScript,[Oi]:[lu.from({outPoint:s,depType:"depGroup"})]}))}return o}function tE(t,e,r,n){const i=U1(n),a=y0(n),s=[],o=[];let f=[],c=[],u=[];for(const w of t){const C=e(w);if(!C){u.push(w);continue}if(En(w.cellOutput.type,i)){s.push(Yt.from({...w,cellOutput:{lock:C,type:i,capacity:w.cellOutput.capacity}}));continue}if(!En(w.cellOutput.type,a)){u.push(w);continue}if(!w.blockNumber)throw Error(iM);o.push(Yt.from({...w,cellOutput:{lock:C,type:xn.from({...a,[fi]:[r(w.blockNumber,w)]}),capacity:w.cellOutput.capacity}}))}let l;({deposits:c,withdrawalRequests:l,notDaos:u}=XA(u,i6(a),r,n)),u=u.concat(l);const p=j2(n);({deposits:l,withdrawalRequests:f,notDaos:u}=XA(u,i6(p),r,n)),u=u.concat(l);let y;({types:y,notTypes:u}=nQ(u,p,e));const m=w=>w.txHash+w.index,A=new Map(f.map(w=>[m(w.outPoint),w])),S=[];for(const w of y){const{ownedDistance:C}=hM.unpack(w.data),O=Ec(Number(w.outPoint.index)+C),M=m({...w.outPoint,index:O}),U=A.get(M);U?(S.push(Object.freeze({owner:w,ownedWithdrawalRequest:U})),A.delete(M)):u.push(w)}return u=u.concat(Array.from(A.values())),{udts:s,receipts:o,withdrawalRequestGroups:S,ickbPool:c,notIckbs:u}}function YQ(t,e,r,n){let i=t.map(a=>Object.freeze({deposit:a,ickbValue:s6(BigInt(a.cellOutput.capacity)-$2,a.cellOutput.type[fi][0]),estimatedMaturity:{length:1,index:0,number:0}}));if(r){const a=rM(h1(e.epoch),r);i=i.map(s=>Object.freeze({...s,estimatedMaturity:CQ(s.deposit,a)})).sort((s,o)=>U2(s.estimatedMaturity,o.estimatedMaturity))}return i}function VQ(t,e,r,n){return EQ(t,Array(e).fill(r),y0(n),n)}function GQ(t,e,r){return SQ(t,e,j2(r))}function WQ(t,e){const r=[],n=[];for(const{ownedWithdrawalRequest:i,owner:a}of e)r.push(i),n.push(a);return r.length>0&&(t=IQ(t,r),t=Ea(t,"append",n,[])),t}function _g(t,e){const r=U1(e),n=y0(e);let i=0n;for(const a of t.inputs){if(En(a.cellOutput.type,r)){i+=e6.unpack(a.data.slice(0,2+16*2));continue}if(En(a.cellOutput.lock,n)&&aM(a,e)){const s=a.cellOutput.type[fi][0],o=BigInt(a.cellOutput.capacity)-$2;i-=s6(o,s);continue}if(En(a.cellOutput.type,n)){const s=a.cellOutput.type[fi][0],{depositQuantity:o,depositAmount:f}=dM.unpack(a.data);i+=s6(f,s)*BigInt(o)}}for(const a of t.outputs)En(a.cellOutput.type,r)&&(i-=e6.unpack(a.data.slice(0,2+16*2)));return i}function s6(t,e){let r=gM(t,e,!1);return gy0n){const i=Yt.from({lock:e,type:U1(r),data:gc(Th.pack({udtAmount:n}))});t=Ea(t,"append",[],[i])}return{tx:t,freeIckbUdt:n}}function ZQ(t,e,r){const n=[],i=j2(r);for(const[a,s]of t.outputs.entries()){if(!sM(s,r)||!En(s.cellOutput.lock,i))continue;const o=t.outputs.size+n.length,f=a-o;n.push(Yt.from({lock:e,type:i,data:gc(hM.pack({ownedDistance:f}))}))}return n.length>0?Ea(t,"append",[],n):t}function JQ(t,e,r){const n=y0(r),i=new Map;for(const s of t.outputs){if(!aM(s,r)||!En(s.cellOutput.lock,n))continue;const o=BigInt(s.cellOutput.capacity)-$2;let f=i.get(o);f?f.depositQuantity+=1:i.set(o,{depositQuantity:1,depositAmount:o})}const a=[];for(const s of i.values())a.push(Yt.from({lock:e,type:n,data:gc(dM.pack(s))}));return a.length>0?Ea(t,"append",[],a):t}const gy=100000n*qt;function eY(t){return yy(gy,t)}function gM(t,e,r=!0){const{ckbMultiplier:n,udtMultiplier:i}=_5(e,r);return t*n/i}function yy(t,e,r=!0){const{ckbMultiplier:n,udtMultiplier:i}=_5(e,r);return t*i/n}const yM=10000000000000000n,$2=82n*qt,tY=$2*yM/gy;function _5(t,e=!0){const n=N2.extractDaoDataCompatible(t.dao).ar.toBigInt();return{ckbMultiplier:yM,udtMultiplier:e?n+tY:n}}function U1(t){return xn.from({...t.defaultScript("XUDT"),args:s$(y0(t))+"00000080"})}function y0(t){return t.defaultScript("ICKB_LOGIC")}function j2(t){return t.defaultScript("OWNED_OWNER")}function rE(t,e){return t.ckbMultiplier===e.ckbMultiplier&&t.udtMultiplier===e.udtMultiplier}function vM(t,e){return rE(t.ckbToUdt,e.ckbToUdt)&&rE(t.udtToCkb,e.udtToCkb)&&t.ckbMinMatchLog===e.ckbMinMatchLog}function nE(t,e,r,n,i=U1(n)){const a=m5(n),{groups:s,unknowns:o}=_M(t,e,a,i),f=rY([...s.values()].map(l=>{var p;return((p=l.master)==null?void 0:p.outPoint)??l.orders[0].info.masterOutpoint}),r,a,i),c=[],u=[];for(const[l,p]of s){const y=f.get(l);if(y===void 0){const S=p.master===void 0?[]:[p.master];o.push(...S,...p.orders.map(w=>w.cell));continue}let m=-1,A=y;for(let S=0;S=0&&o.push(A.cell),m=S,A=w}if(m===-1){p.master!==void 0&&o.push(p.master);continue}p.master!==void 0?u.push(Object.freeze({...A,master:p.master})):c.push(Object.freeze(A))}return{myOrders:u,orders:c,notOrders:o}}function rY(t,e,r,n){const i=new Map,a=s=>xn.from({...va,...s.cellOutput.lock});for(const s of new Set(t.map(o=>o.txHash)))for(const[o,f]of _M(e(s),a,r,n).groups)f.master===void 0||f.orders.length!==1||!f.orders[0].info.isMint||i.set(o,{...f.orders[0],master:f.master});return i}function _M(t,e,r,n){const i=new Map,a=o=>{const f=o.txHash+o.index;let c=i.get(f);return c===void 0&&(c={master:void 0,orders:[]},i.set(f,c)),c},s=[];for(const o of t){const{lock:f,type:c}=o.cellOutput;if(En(c,r)){const u=e(o);if(u){a(o.outPoint).master=Yt.from({...o,cellOutput:{lock:u,type:r,capacity:o.cellOutput.capacity}});continue}}else if(En(f,r)&&En(c,n)){const u=nY(o);if(u!==void 0){a(u.masterOutpoint).orders.push({cell:Yt.from({...o,cellOutput:{lock:r,type:n,capacity:o.cellOutput.capacity}}),info:u});continue}}s.push(o)}return{groups:i,unknowns:s}}function nY(t){let e;try{e=v5.unpack(t.data)}catch{return}const r=e.value.orderInfo,n=vy(r.ckbToUdt),i=vy(r.udtToCkb),a=mM(r.ckbMinMatchLog);if(!vM({ckbToUdt:n,udtToCkb:i,ckbMinMatchLog:a},r)||e.type==="MintOrderData"&&e.value.padding!==w5||t.cellOutput.type===void 0||t.cellOutput.type.args.length<2)return;const s=e.type==="MintOrderData",o=Fo.from(e.type==="MintOrderData"?{txHash:t.outPoint.txHash,index:Ec(Number(t.outPoint.index)+e.value.masterDistance)}:e.value.masterOutpoint),f=1n<>1n,O=A?C:y?c*n.udtMultiplier:p*i.ckbMultiplier,M=y&&p>0n,U=m&&c>0n;return Object.freeze({isMint:s,masterOutpoint:o,ckbToUdt:n,udtToCkb:i,ckbMinMatchLog:a,ckbMinMatch:f,udtAmount:c,ckbAmount:u,ckbOccupied:l,ckbUnoccupied:p,absTotal:C,absProgress:O,isCkb2Udt:y,isUdt2Ckb:m,isDualRatio:A,isCkb2UdtMatchable:M,isUdt2CkbMatchable:U,isMatchable:M||U})}const iY=33;function aY(t,...e){const{master:r,order:n}=sY(...e);return Ea(t,"append",[],[r,n])}const iE="Order ratio are invalid";function sY(t,e,r=0n,n=0n,i=Io,a=Io,s=iY,o=U1(e)){if(i=vy(i),a=vy(a),s=mM(s),i===Io&&a===Io||i.ckbMultiplier*a.udtMultiplier0n&&(u=Yt.from({...u,capacity:Ec(BigInt(u.cellOutput.capacity)+r)})),{master:c,order:u}}function oY(t,e){return Ea(t,"append",e.flatMap(r=>[r.cell,r.master]),[])}function m5(t){return t.defaultScript("LIMIT_ORDER")}function mM(t){return t>64?64:t}function vy(t){return t.ckbMultiplier===0n||t.udtMultiplier===0n?Io:Object.freeze({...t})}const Io=Object.freeze({ckbMultiplier:0n,udtMultiplier:0n}),w5="0x0000000000000000000000000000000000000000000000000000000000000000",fY=BigInt(Yt.from({lock:va,type:va,data:gc(v5.pack({udtAmount:0n,type:"MintOrderData",value:{masterDistance:0,padding:w5,orderInfo:{ckbToUdt:Io,udtToCkb:Io,ckbMinMatchLog:0}}}))}).cellOutput.capacity);function cY({rawText:t,setRawText:e,amount:r,tipHeader:n,isFrozen:i,ckbNative:a,ickbNative:s,ckbAvailable:o,ickbAvailable:f,ckbBalance:c,ickbBalance:u}){const l=t[0],p=t.slice(1),y=oM(l),m=()=>e(a6(!y)+p),A=tQ(Np(o-lM,0n),a);let S={name:"CKB",native:A,locked:c-A,status:c===a?"✅":c===o?"⌛️":"⏳"},w={name:"ICKB",native:s,locked:u-s,status:u===s?"✅":u===f?"⌛️":"⏳"};return y||([S,w]=[w,S]),_e.jsx(_e.Fragment,{children:_e.jsxs("span",{className:"grid grid-cols-3 items-center justify-items-center gap-y-4 leading-relaxed font-bold tracking-wider uppercase",children:[_e.jsx("span",{className:"text-amber-400",children:qb(S.native,"✅")}),_e.jsx("span",{className:"text-2xl text-amber-400",children:S.name}),_e.jsx("span",{className:"cursor-wait text-amber-400",children:qb(S.locked,S.status)}),_e.jsx("input",{placeholder:"0",disabled:i,autoFocus:!0,value:p,onChange:C=>e(l+C.target.value),autoComplete:"off",inputMode:"decimal",type:"text",className:"col-span-3 w-full rounded border-0 bg-transparent text-center text-3xl text-amber-400 outline-none disabled:cursor-default","aria-label":"Amount to be converted"}),_e.jsx("span",{className:"",children:"1 "+S.name}),_e.jsx("button",{className:"rotate-90 cursor-pointer border-0 bg-transparent text-5xl text-slate-300 disabled:cursor-default",disabled:i,onClick:m,children:"⇌"}),_e.jsx("span",{className:"text-center",children:aE(y,qt,n)+" "+w.name}),_e.jsxs("span",{className:"col-span-3 text-center text-3xl text-amber-400",children:["⏳",aE(y,r,n)]}),_e.jsx("span",{className:"text-amber-400",children:qb(w.native,"✅")}),_e.jsx("span",{className:"text-2xl text-amber-400",children:w.name}),_e.jsx("span",{className:"cursor-wait text-amber-400",children:qb(w.locked,w.status)})]})})}function qb(t,e){const r=e==="⏳";return _e.jsxs("span",{className:"flex flex-row "+(r?"cursor-wait":""),children:[_e.jsx("span",{className:r?"animate-pulse":"",children:e}),_e.jsx("span",{className:"sm:hidden",children:String(t/qt)}),_e.jsx("span",{className:"hidden sm:block",children:z2(t)})]})}function aE(t,e,r){let n=t?gM(e,r):yy(e,r);return n-=n/1000n,z2(n)}function F_({txInfo:t=Fl,capacities:e=new Array,udts:r=new Array,receipts:n=new Array,wrGroups:i=new Array,myOrders:a=new Array,tipHeader:s=F2}){let{tx:o}=t;const f=[t.estimatedMaturity,h1(s.epoch)];if(a.length>0){o=oY(o,a);for(const{info:l}of a){if(!l.isMatchable||l.isDualRatio)continue;const p=l.isCkb2UdtMatchable;f.push(fM(p,p?l.ckbUnoccupied:l.udtAmount,s))}}const c=[e,r,n].flat();c.length>0&&(o=Ea(o,"append",c,[])),i.length>0&&(o=WQ(o,i),f.push(...i.map(l=>Cp(l.ownedWithdrawalRequest.cellOutput.type[Hs]))));const u=Object.freeze(cM(f));return Object.freeze({...t,tx:o,estimatedMaturity:u})}function uY(t,e,r,n,i,a,s){if(t.error!=="")return t;const o=[];if(!e){let A=0n;for(const S of n){const w=A+S.ickbValue;if(!(w>r)&&(A=w,o.push(Object.freeze({...S,ickbCumulative:A})),o.length>=30))break}}Object.freeze(o);const{ckbMultiplier:f,udtMultiplier:c}=_5(i),u={ckbMultiplier:f,udtMultiplier:c+(e?1n:-1n)*(c/1000n)},l=eY(i),p=e?Number(r/l):o.length,y=Array(p),m=A=>(A=p-A,y[A]=y[A]??lY(A,e,r,t,u,l,o,i,a,s));return Object.freeze(m(fQ(p,A=>m(A).error==="")))}function lY(t,e,r,n,i,a,s,o,f,c){let{tx:u}=n;const{accountLocks:l,config:p}=c,y=[n.estimatedMaturity];if(t>0)if(e){if(r-=a*BigInt(t),r<0n)return{...n,error:"Too many Deposits respectfully to the amount"};u=VQ(u,t,a,p),u=JQ(u,l[0],p)}else{if(s.lengthw.deposit);u=GQ(u,S,p),u=ZQ(u,l[0],p),y.push(...s.map(w=>w.estimatedMaturity))}let m=n.fee;r>0n&&(u=aY(u,l[0],p,e?r:void 0,e?void 0:r,e?i:void 0,e?void 0:i),m+=e?r-yy(r*i.ckbMultiplier/i.udtMultiplier,o):yy(r,o)-r*i.udtMultiplier/i.ckbMultiplier,y.push(fM(e,r,o)));const A=cM(y);return wM({...n,tx:u,estimatedMaturity:A,fee:m},f,c)}function wM(t,e,r){let{tx:n}=t;const{accountLocks:i,config:a}=r;let s,o,f;({tx:n,freeIckbUdt:f}=XQ(n,i[0],a)),{tx:n,txFee:s,freeCkb:o}=TQ(n,i[0],e,a);const c=t.fee+s;return t={...t,tx:n,fee:c},o<0n?{...t,error:"Not enough CKB"}:f<0n?{...t,error:"Not enough iCKB"}:n.outputs.size>64?{...t,error:"More than 64 output cells"}:t}function A5(t,e){return{retry:!0,refetchInterval:({state:r})=>{var n;return 6e4*((n=r.data)!=null&&n.hasMatchable?1:10)},staleTime:1e4,queryKey:[t.chain,t.address,"l1State"],queryFn:async()=>{try{return await dY(t)}catch(r){throw console.log(r),r}},placeholderData:{ckbNative:6n*qt*qt,ickbNative:3n*qt*qt,ckbAvailable:6n*qt*qt,ickbAvailable:3n*qt*qt,ckbBalance:6n*qt*qt,ickbBalance:3n*qt*qt,tipHeader:F2,txBuilder:()=>Fl,hasMatchable:!1},enabled:!e}}async function dY(t){const{rpc:e,config:r,expander:n,getTxSizeOverhead:i}=t,a=await hY(t),s=e.getFeeRate(61n),o=e.getTipHeader(),f=new Set;tE(a,n,ne=>(f.add(ne),F2),r);const u=bY(f,t),l=new Set;nE(a,n,ne=>(l.add(ne),[]),r);const y=pY(l,t),{capacities:m,notCapacities:A}=rQ(a,n),S=await u,{udts:w,receipts:C,withdrawalRequestGroups:O,ickbPool:M,notIckbs:U}=tE(A,n,ne=>S.get(ne),r),K=Cd.from(await o),{mature:Q,notMature:k}=iQ(O,ne=>ne.ownedWithdrawalRequest.cellOutput.type[Hs],K);let W=YQ(M,K,{length:4,index:1,number:0});if(W.length>40){const ne=Np(Math.round(W.length/180),40);W=oQ(W.slice(0,ne).map((N,P)=>({d:N,i:P}))).slice(0,40).sort((N,P)=>N.i-P.i).map(N=>N.d)}const R=await y,{myOrders:_}=nE(U,n,ne=>R.get(ne)??[],r),I=[],b=[];for(const ne of _){const{isMatchable:N,isDualRatio:P}=ne.info;N&&!P?I.push(ne):b.push(ne)}const v=I.length>0,d=Q.length>0||C.length>0||b.length>0;let g=F_({capacities:m,udts:w,tipHeader:K});const x=vg(g.tx,r),E=_g(g.tx,r);g=F_({txInfo:g,myOrders:b,receipts:C,wrGroups:Q,tipHeader:K});const h=i(g.tx),T=vg(g.tx,r),$=_g(g.tx,r),L=F_({txInfo:g,myOrders:I,wrGroups:k,tipHeader:K}),j=vg(L.tx,r),F=_g(L.tx,r);g=Object.freeze({...g,estimatedMaturity:L.estimatedMaturity});const[H,q]=await Promise.all([h,s]),X=ne=>{const N=wQ(mQ(ne)+H,q),P=1249n;return(N+(P-1n))/P*P};return{ckbNative:x,ickbNative:E,ckbBalance:j,ickbBalance:F,ckbAvailable:T,ickbAvailable:$,tipHeader:K,txBuilder:(ne,N)=>N>0n?uY(g,ne,N,W,K,X,t):d?wM(g,X,t):Object.freeze({...g,error:"Nothing to do"}),hasMatchable:v}}async function AM(t){const{queryClient:e}=t,r={...t,accountLocks:[va],address:w2.encodeToAddress(va,t),expander:i6(va),getTxSizeOverhead:()=>Promise.resolve(0),sendSigned:()=>Promise.resolve("0x0")};return e.prefetchQuery(A5(r,!1))}async function hY(t){const{accountLocks:e,config:r,rpc:n}=t;return Object.freeze((await Promise.all([...e,y0(r),j2(r),m5(r)].map(i=>n.getCellsByLock(i,"desc","max")))).flat())}async function pY(t,e){const{chain:r,rpc:n,queryClient:i}=e,a=i.getQueryData([r,"txsOutputs"])??Object.freeze(new Map),s=new Map,o=n.createBatchRequest();for(const c of t){const u=a.get(c);if(u!==void 0){s.set(c,u);continue}o.add("getTransaction",c)}if(o.length===0)return a;for(const c of(await o.exec()).map(({transaction:u})=>u))s.set(c.hash,Object.freeze(c.outputs.map(({lock:u,type:l,capacity:p},y)=>Object.freeze({cellOutput:Object.freeze({lock:Object.freeze(u),type:Object.freeze(l),capacity:Object.freeze(p)}),data:Object.freeze(c.outputsData[y]??"0x"),outPoint:Object.freeze({txHash:c.hash,index:Ec(y)})}))));const f=Object.freeze(s);return i.setQueryData([r,"txsOutputs"],f),f}async function bY(t,e){const{chain:r,rpc:n,queryClient:i}=e,a=i.getQueryData([r,"headers"])??Object.freeze(new Map),s=new Map,o=n.createBatchRequest();for(const c of t){const u=a.get(c);if(u!==void 0){s.set(c,u);continue}o.add("getHeaderByNumber",c)}if(o.length===0)return a;for(const c of await o.exec())s.set(c.number,Cd.from(c));const f=Object.freeze(s);return i.setQueryData([r,"headers"],f),f}const F2=Cd.from({compactTarget:"0x1a08a97e",parentHash:"0x0000000000000000000000000000000000000000000000000000000000000000",transactionsRoot:"0x31bf3fdf4bc16d6ea195dbae808e2b9a8eca6941d589f6959b1d070d51ac28f7",proposalsHash:"0x0000000000000000000000000000000000000000000000000000000000000000",extraHash:"0x0000000000000000000000000000000000000000000000000000000000000000",dao:"0x8874337e541ea12e0000c16ff286230029bfa3320800000000710b00c0fefe06",epoch:"0x0",hash:"0x92b197aa1fba0f63633922c61c92375c9c074a93e85963554f5499fe1450d0e5",nonce:"0x0",number:"0x0",timestamp:"0x16e70e6985c",version:"0x0"});function E5(t){const e=n2.c(7),{children:r,isDone:n}=t;if(n){let o;return e[0]!==r?(o=_e.jsx("span",{className:"col-span-full w-full pb-4",children:r}),e[0]=r,e[1]=o):o=e[1],o}let i;e[2]!==r?(i=_e.jsx("span",{className:"pb-2",children:r}),e[2]=r,e[3]=i):i=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=_e.jsxs("span",{className:"flex h-2 w-full flex-row overflow-hidden rounded",children:[_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-3.00s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-2.85s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-2.70s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-2.55s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-2.40s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-2.25s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-2.10s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.95s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.80s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.65s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.50s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.35s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.20s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-1.05s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-0.90s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-0.75s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-0.60s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-0.45s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-0.30s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-delay:-0.15s] [animation-duration:6s]"}),_e.jsx("span",{className:"size-full animate-pulse bg-amber-400 [animation-duration:6s]"})]}),e[4]=a):a=e[4];let s;return e[5]!==i?(s=_e.jsxs("span",{className:"col-span-full flex w-full flex-col",children:[i,a]}),e[5]=i,e[6]=s):s=e[6],s}function gY({isCkb2Udt:t,amount:e,freeze:r,formReset:n,walletConfig:i}){const[a,s]=yr.useState(Fl),o=C=>{s(C),r(C!=Fl)},f=a!==Fl,{data:c,isStale:u,isFetching:l}=k4(A5(i,f)),{txBuilder:p,tipHeader:y}=c,m=f?a:p(t,e),A=_Q(m.tx)&&m.fee>0n&&m.estimatedMaturity!==uM&&m.error==="",{maturity:S,isReady:w}=vY(m.estimatedMaturity,y);return _e.jsxs("span",{className:"grid grid-cols-2 items-center justify-items-center gap-y-4",children:[_e.jsx(E5,{isDone:!l&&!f,children:_e.jsx("button",{className:"text-s col-span-2 min-h-12 w-full cursor-pointer rounded border-2 border-amber-400 px-8 leading-relaxed font-bold tracking-wider text-amber-400 uppercase disabled:cursor-default disabled:opacity-50",onClick:u?()=>i.queryClient.invalidateQueries({queryKey:[i.chain,i.address,"l1State"]}):()=>yY(m,o,n,i),disabled:l||f||!A,children:l?"refreshing...":m.error!==""?m.error:A?u?`refresh before ${e>0?`converting to ${t?"iCKB":"CKB"}`:"withdrawing converted"}`:f?"waiting transaction confirmation...":e>0?`convert to ${t?"iCKB":"CKB"}`:`${w?"fully":"partially"} withdraw converted`:"finding a goose egg"})}),_e.jsx("span",{className:"leading-relaxed font-bold tracking-wider",children:"Fee:"}),_e.jsxs("span",{children:[z2(m.fee)," CKB"]}),_e.jsx("span",{className:"leading-relaxed font-bold tracking-wider",children:"Maturity:"}),_e.jsx("span",{children:S})]})}async function yY(t,e,r,n){const{rpc:i,sendSigned:a}=n;try{e(t);const s=await a(t.tx);let o="pending";for(;o==="pending"||o==="proposed";)await new Promise(f=>setTimeout(f,1e4)),o=(await i.getTransaction(s)).txStatus.status;r(),console.log(s,o)}finally{e(Fl)}}function vY(t,e){const r=h1(e.epoch),n=t.index/t.length-r.index/r.length+t.number-r.number;return n<=0?{maturity:"⌛️ Ready",isReady:!0}:n<=.375?{maturity:`⏳ ${String(Math.ceil(n*4*60))} minutes`,isReady:!1}:n<=6?{maturity:`⏳ ${String(1+Math.ceil(n*4))} hours`,isReady:!1}:{maturity:`⏳ ${String(1+Math.ceil(n/6))} days`,isReady:!1}}function _Y({walletConfig:t}){const[e,r]=yr.useState(!1),[n,i]=yr.useState(a6(!0)),a=n[0],s=oM(a);let o=BQ(n),f=DQ(o);const{ckbNative:c,ickbNative:u,ckbAvailable:l,ickbAvailable:p,ckbBalance:y,ickbBalance:m,tipHeader:A}=k4(A5(t,e)).data,S=s?Np(l-lM,0n):p;f>S&&(f=S,o=z2(S));const w=()=>i(a6(s)),C=yr.useDeferredValue({isCkb2Udt:s,amount:f,freeze:r,formReset:w,walletConfig:t});return A===F2?_e.jsxs(_e.Fragment,{children:[_e.jsx(ZA,{walletConfig:t}),_e.jsx(E5,{children:"Downloading the latest L1 Cell data, just for you. Hang tight!"})]}):_e.jsxs(_e.Fragment,{children:[_e.jsx(ZA,{walletConfig:t}),_e.jsx(cY,{rawText:a+o,setRawText:i,amount:f,tipHeader:A,isFrozen:e,ckbNative:c,ickbNative:u,ckbAvailable:l,ickbAvailable:p,ckbBalance:y,ickbBalance:m}),_e.jsx(gY,{...C})]})}var qo={},q2={};q2.byteLength=AY;q2.toByteArray=xY;q2.fromByteArray=CY;var Ts=[],Ji=[],mY=typeof Uint8Array<"u"?Uint8Array:Array,q_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var nl=0,wY=q_.length;nl0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function AY(t){var e=EM(t),r=e[0],n=e[1];return(r+n)*3/4-n}function EY(t,e,r){return(e+r)*3/4-r}function xY(t){var e,r=EM(t),n=r[0],i=r[1],a=new mY(EY(t,n,i)),s=0,o=i>0?n-4:n,f;for(f=0;f>16&255,a[s++]=e>>8&255,a[s++]=e&255;return i===2&&(e=Ji[t.charCodeAt(f)]<<2|Ji[t.charCodeAt(f+1)]>>4,a[s++]=e&255),i===1&&(e=Ji[t.charCodeAt(f)]<<10|Ji[t.charCodeAt(f+1)]<<4|Ji[t.charCodeAt(f+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function SY(t){return Ts[t>>18&63]+Ts[t>>12&63]+Ts[t>>6&63]+Ts[t&63]}function IY(t,e,r){for(var n,i=[],a=e;ao?o:s+a));return n===1?(e=t[r-1],i.push(Ts[e>>2]+Ts[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Ts[e>>10]+Ts[e>>4&63]+Ts[e<<2&63]+"=")),i.join("")}var x5={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */x5.read=function(t,e,r,n,i){var a,s,o=i*8-n-1,f=(1<>1,u=-7,l=r?i-1:0,p=r?-1:1,y=t[e+l];for(l+=p,a=y&(1<<-u)-1,y>>=-u,u+=o;u>0;a=a*256+t[e+l],l+=p,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=n;u>0;s=s*256+t[e+l],l+=p,u-=8);if(a===0)a=1-c;else{if(a===f)return s?NaN:(y?-1:1)*(1/0);s=s+Math.pow(2,n),a=a-c}return(y?-1:1)*s*Math.pow(2,a-n)};x5.write=function(t,e,r,n,i,a){var s,o,f,c=a*8-i-1,u=(1<>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:a-1,m=n?1:-1,A=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-s))<1&&(s--,f*=2),s+l>=1?e+=p/f:e+=p*Math.pow(2,1-l),e*f>=2&&(s++,f/=2),s+l>=u?(o=0,s=u):s+l>=1?(o=(e*f-1)*Math.pow(2,i),s=s+l):(o=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+y]=o&255,y+=m,o/=256,i-=8);for(s=s<0;t[r+y]=s&255,y+=m,s/=256,c-=8);t[r+y-m]|=A*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh diff --git a/index.html b/index.html index b867fb6..0a5ef7e 100644 --- a/index.html +++ b/index.html @@ -12,12 +12,12 @@ property="og:description" content="An interface for interacting with iCKB scripts." /> - - + +