diff --git a/app/__init__.py b/app/__init__.py index 0eb725c..a779be1 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -25,6 +25,7 @@ def create_app(environment="development"): section_blueprint, vote_blueprint, approve_blueprint, + star_blueprint, ) from app.models import ( User, @@ -55,6 +56,7 @@ def create_app(environment="development"): app.register_blueprint(section_blueprint) app.register_blueprint(vote_blueprint) app.register_blueprint(approve_blueprint) + app.register_blueprint(star_blueprint) # Set up flask login. @login_manager.user_loader diff --git a/app/models/book.py b/app/models/book.py index 6d0d496..35a28d5 100644 --- a/app/models/book.py +++ b/app/models/book.py @@ -1,4 +1,6 @@ -from app import db +from flask_login import current_user + +from app import db, models as m from app.models.utils import BaseModel @@ -23,3 +25,12 @@ class Book(BaseModel): @property def last_version(self): return self.versions[-1] + + @property + def current_user_has_star(self): + if current_user.is_authenticated: + book_star: m.BookStar = m.BookStar.query.filter_by( + user_id=current_user.id, book_id=self.id + ).first() + if book_star: + return True diff --git a/app/static/css/styles.css b/app/static/css/styles.css index ecfd477..9ff2b13 100644 --- a/app/static/css/styles.css +++ b/app/static/css/styles.css @@ -1 +1 @@ -/*! tailwindcss v3.3.1 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal}body{margin:0;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;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}[multiple],[type=date],[type=datetime-local],[type=email],[type=month],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=time],[type=url],[type=week],select,textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-width:1px;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem;--tw-shadow:0 0 #0000}[multiple]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=email]:focus,[type=month]:focus,[type=number]:focus,[type=password]:focus,[type=search]:focus,[type=tel]:focus,[type=text]:focus,[type=time]:focus,[type=url]:focus,[type=week]:focus,select:focus,textarea:focus{outline:2px solid #0000;outline-offset:2px;--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#1c64f2;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#1c64f2}input::-moz-placeholder,textarea::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder,textarea::placeholder{color:#6b7280;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}select:not([size]){background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}[multiple]{background-image:none;background-position:0 0;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;display:inline-block;vertical-align:middle;background-origin:border-box;-webkit-user-select:none;-moz-user-select:none;user-select:none;flex-shrink:0;height:1rem;width:1rem;color:#1c64f2;background-color:#fff;border-color:#6b7280;border-width:1px;--tw-shadow:0 0 #0000}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{outline:2px solid #0000;outline-offset:2px;--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:#1c64f2;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.dark [type=checkbox]:checked,.dark [type=radio]:checked,[type=checkbox]:checked,[type=radio]:checked{border-color:#0000;background-color:currentColor;background-size:100% 100%;background-position:50%;background-repeat:no-repeat}[type=checkbox]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E")}[type=radio]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E")}[type=checkbox]:indeterminate{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E");background-size:100% 100%;background-position:50%;background-repeat:no-repeat}[type=checkbox]:indeterminate,[type=checkbox]:indeterminate:focus,[type=checkbox]:indeterminate:hover{border-color:#0000;background-color:currentColor}[type=file]{background:unset;border-color:inherit;border-width:0;border-radius:0;padding:0;font-size:unset;line-height:inherit}[type=file]:focus{outline:1px auto inherit}input[type=file]::file-selector-button{color:#fff;background:#1f2937;border:0;font-weight:500;font-size:.875rem;cursor:pointer;padding:.625rem 1rem .625rem 2rem;-webkit-margin-start:-1rem;margin-inline-start:-1rem;-webkit-margin-end:1rem;margin-inline-end:1rem}input[type=file]::file-selector-button:hover{background:#374151}.dark input[type=file]::file-selector-button{color:#fff;background:#4b5563}.dark input[type=file]::file-selector-button:hover{background:#6b7280}input[type=range]::-webkit-slider-thumb{height:1.25rem;width:1.25rem;background:#1c64f2;border-radius:9999px;border:0;appearance:none;-moz-appearance:none;-webkit-appearance:none;cursor:pointer}input[type=range]:disabled::-webkit-slider-thumb{background:#9ca3af}.dark input[type=range]:disabled::-webkit-slider-thumb{background:#6b7280}input[type=range]:focus::-webkit-slider-thumb{outline:2px solid #0000;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-opacity:1px;--tw-ring-color:rgb(164 202 254/var(--tw-ring-opacity))}input[type=range]::-moz-range-thumb{height:1.25rem;width:1.25rem;background:#1c64f2;border-radius:9999px;border:0;appearance:none;-moz-appearance:none;-webkit-appearance:none;cursor:pointer}input[type=range]:disabled::-moz-range-thumb{background:#9ca3af}.dark input[type=range]:disabled::-moz-range-thumb{background:#6b7280}input[type=range]::-moz-range-progress{background:#3f83f8}input[type=range]::-ms-fill-lower{background:#3f83f8}.toggle-bg:after{content:"";position:absolute;top:.125rem;left:.125rem;background:#fff;border-color:#d1d5db;border-width:1px;border-radius:9999px;height:1.25rem;width:1.25rem;transition-property:background-color,border-color,color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-duration:.15s;box-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}input:checked+.toggle-bg:after{transform:translateX(100%);;border-color:#fff}input:checked+.toggle-bg{background:#1c64f2;border-color:#1c64f2}.tooltip-arrow,.tooltip-arrow:before{position:absolute;width:8px;height:8px;background:inherit}.tooltip-arrow{visibility:hidden}.tooltip-arrow:before{content:"";visibility:visible;transform:rotate(45deg)}[data-tooltip-style^=light]+.tooltip>.tooltip-arrow:before{border-style:solid;border-color:#e5e7eb}[data-tooltip-style^=light]+.tooltip[data-popper-placement^=top]>.tooltip-arrow:before{border-bottom-width:1px;border-right-width:1px}[data-tooltip-style^=light]+.tooltip[data-popper-placement^=right]>.tooltip-arrow:before{border-bottom-width:1px;border-left-width:1px}[data-tooltip-style^=light]+.tooltip[data-popper-placement^=bottom]>.tooltip-arrow:before{border-top-width:1px;border-left-width:1px}[data-tooltip-style^=light]+.tooltip[data-popper-placement^=left]>.tooltip-arrow:before{border-top-width:1px;border-right-width:1px}.tooltip[data-popper-placement^=top]>.tooltip-arrow{bottom:-4px}.tooltip[data-popper-placement^=bottom]>.tooltip-arrow{top:-4px}.tooltip[data-popper-placement^=left]>.tooltip-arrow{right:-4px}.tooltip[data-popper-placement^=right]>.tooltip-arrow{left:-4px}.tooltip.invisible>.tooltip-arrow:before{visibility:hidden}[data-popper-arrow],[data-popper-arrow]:before{position:absolute;width:8px;height:8px;background:inherit}[data-popper-arrow]{visibility:hidden}[data-popper-arrow]:after,[data-popper-arrow]:before{content:"";visibility:visible;transform:rotate(45deg)}[data-popper-arrow]:after{position:absolute;width:9px;height:9px;background:inherit}[role=tooltip]>[data-popper-arrow]:before{border-style:solid;border-color:#e5e7eb}.dark [role=tooltip]>[data-popper-arrow]:before{border-style:solid;border-color:#4b5563}[role=tooltip]>[data-popper-arrow]:after{border-style:solid;border-color:#e5e7eb}.dark [role=tooltip]>[data-popper-arrow]:after{border-style:solid;border-color:#4b5563}[data-popover][role=tooltip][data-popper-placement^=top]>[data-popper-arrow]:after,[data-popover][role=tooltip][data-popper-placement^=top]>[data-popper-arrow]:before{border-bottom-width:1px;border-right-width:1px}[data-popover][role=tooltip][data-popper-placement^=right]>[data-popper-arrow]:after,[data-popover][role=tooltip][data-popper-placement^=right]>[data-popper-arrow]:before{border-bottom-width:1px;border-left-width:1px}[data-popover][role=tooltip][data-popper-placement^=bottom]>[data-popper-arrow]:after,[data-popover][role=tooltip][data-popper-placement^=bottom]>[data-popper-arrow]:before{border-top-width:1px;border-left-width:1px}[data-popover][role=tooltip][data-popper-placement^=left]>[data-popper-arrow]:after,[data-popover][role=tooltip][data-popper-placement^=left]>[data-popper-arrow]:before{border-top-width:1px;border-right-width:1px}[data-popover][role=tooltip][data-popper-placement^=top]>[data-popper-arrow]{bottom:-5px}[data-popover][role=tooltip][data-popper-placement^=bottom]>[data-popper-arrow]{top:-5px}[data-popover][role=tooltip][data-popper-placement^=left]>[data-popper-arrow]{right:-5px}[data-popover][role=tooltip][data-popper-placement^=right]>[data-popper-arrow]{left:-5px}[role=tooltip].invisible>[data-popper-arrow]:after,[role=tooltip].invisible>[data-popper-arrow]:before{visibility:hidden}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3f83f880;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-y-0{top:0;bottom:0}.-top-2{top:-.5rem}.bottom-0{bottom:0}.bottom-14{bottom:3.5rem}.bottom-2{bottom:.5rem}.bottom-2\.5{bottom:.625rem}.bottom-3{bottom:.75rem}.bottom-\[60px\]{bottom:60px}.left-0{left:0}.left-10{left:2.5rem}.left-3{left:.75rem}.left-auto{left:auto}.right-0{right:0}.right-2{right:.5rem}.right-2\.5{right:.625rem}.right-3{right:.75rem}.top-0{top:0}.top-10{top:2.5rem}.top-3{top:.75rem}.top-32{top:8rem}.top-44{top:11rem}.-z-10{z-index:-10}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[55\]{z-index:55}.col-span-6{grid-column:span 6/span 6}.col-span-full{grid-column:1/-1}.m-3{margin:.75rem}.m-5{margin:1.25rem}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-1\.5{margin-left:-.375rem;margin-right:-.375rem}.-my-1{margin-top:-.25rem;margin-bottom:-.25rem}.-my-1\.5{margin-top:-.375rem;margin-bottom:-.375rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.my-auto{margin-top:auto;margin-bottom:auto}.-mb-px{margin-bottom:-1px}.-mr-1{margin-right:-.25rem}.-mt-5{margin-top:-1.25rem}.mb-0{margin-bottom:0}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.ml-0{margin-left:0}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-5{margin-left:1.25rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-64{margin-right:16rem}.mr-8{margin-right:2rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-20{margin-top:5rem}.mt-24{margin-top:6rem}.mt-3{margin-top:.75rem}.mt-36{margin-top:9rem}.mt-40{margin-top:10rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-11{height:2.75rem}.h-14{height:3.5rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-\[calc\(100\%-1rem\)\]{height:calc(100% - 1rem)}.h-auto{height:auto}.h-full{height:100%}.h-max{height:-moz-max-content;height:max-content}.h-screen{height:100vh}.max-h-full{max-height:100%}.w-1\/2{width:50%}.w-11{width:2.75rem}.w-11\/12{width:91.666667%}.w-14{width:3.5rem}.w-2\/3{width:66.666667%}.w-24{width:6rem}.w-3{width:.75rem}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-full{width:100%}.w-screen{width:100vw}.max-w-2xl{max-width:42rem}.max-w-6xl{max-width:72rem}.max-w-full{max-width:100%}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink{flex-shrink:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.origin-\[0\]{transform-origin:0}.-translate-x-full{--tw-translate-x:-100%}.-translate-x-full,.-translate-y-6{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-6{--tw-translate-y:-1.5rem}.-translate-y-full{--tw-translate-y:-100%}.-translate-y-full,.translate-x-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x:0px}.translate-x-96{--tw-translate-x:24rem}.translate-x-96,.translate-x-full{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-full{--tw-translate-x:100%}.translate-y-full{--tw-translate-y:100%}.rotate-180,.translate-y-full{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg}.scale-75{--tw-scale-x:.75;--tw-scale-y:.75}.scale-75,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform-none{transform:none}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.list-none{list-style-type:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-center{align-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-6{gap:1.5rem}.-space-x-px>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(-1px*var(--tw-space-x-reverse));margin-left:calc(-1px*(1 - var(--tw-space-x-reverse)))}.space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0px*var(--tw-space-x-reverse));margin-left:calc(0px*(1 - var(--tw-space-x-reverse)))}.space-x-0\.5>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.125rem*var(--tw-space-x-reverse));margin-left:calc(.125rem*(1 - var(--tw-space-x-reverse)))}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.25rem*var(--tw-space-x-reverse));margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem*var(--tw-space-x-reverse));margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.75rem*var(--tw-space-x-reverse));margin-left:calc(.75rem*(1 - var(--tw-space-x-reverse)))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem*var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem*var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem*var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem*var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px*var(--tw-divide-y-reverse))}.divide-gray-100>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(243 244 246/var(--tw-divide-opacity))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(229 231 235/var(--tw-divide-opacity))}.self-center{align-self:center}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-x-scroll{overflow-x:scroll}.truncate{overflow:hidden;text-overflow:ellipsis}.truncate,.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-b-lg{border-bottom-right-radius:.5rem}.rounded-b-lg,.rounded-l-lg{border-bottom-left-radius:.5rem}.rounded-l-lg{border-top-left-radius:.5rem}.rounded-r-lg{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-lg{border-top-left-radius:.5rem;border-top-right-radius:.5rem}.border{border-width:1px}.border-0{border-width:0}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-t-2{border-top-width:2px}.border-solid{border-style:solid}.border-blue-300{--tw-border-opacity:1;border-color:rgb(164 202 254/var(--tw-border-opacity))}.border-blue-600{--tw-border-opacity:1;border-color:rgb(28 100 242/var(--tw-border-opacity))}.border-blue-700{--tw-border-opacity:1;border-color:rgb(26 86 219/var(--tw-border-opacity))}.border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity))}.border-red-700{--tw-border-opacity:1;border-color:rgb(200 30 30/var(--tw-border-opacity))}.border-transparent{border-color:#0000}.border-white{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.bg-blue-50{--tw-bg-opacity:1;background-color:rgb(235 245 255/var(--tw-bg-opacity))}.bg-blue-600{--tw-bg-opacity:1;background-color:rgb(28 100 242/var(--tw-bg-opacity))}.bg-blue-700{--tw-bg-opacity:1;background-color:rgb(26 86 219/var(--tw-bg-opacity))}.bg-emerald-700{--tw-bg-opacity:1;background-color:rgb(4 120 87/var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}.bg-green-100{--tw-bg-opacity:1;background-color:rgb(222 247 236/var(--tw-bg-opacity))}.bg-red-100{--tw-bg-opacity:1;background-color:rgb(253 232 232/var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(240 82 82/var(--tw-bg-opacity))}.bg-red-700{--tw-bg-opacity:1;background-color:rgb(200 30 30/var(--tw-bg-opacity))}.bg-slate-300{--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}.bg-slate-600{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity))}.bg-teal-700{--tw-bg-opacity:1;background-color:rgb(3 102 114/var(--tw-bg-opacity))}.bg-transparent{background-color:initial}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-white\/50{background-color:#ffffff80}.bg-opacity-50{--tw-bg-opacity:0.5}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-cyan-500{--tw-gradient-from:#06b6d4 var(--tw-gradient-from-position);--tw-gradient-from-position: ;--tw-gradient-to:#06b6d400 var(--tw-gradient-from-position);--tw-gradient-to-position: ;--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.to-blue-500{--tw-gradient-to:#3f83f8 var(--tw-gradient-to-position);--tw-gradient-to-position: }.stroke-green-500{stroke:#0e9f6e}.stroke-red-500{stroke:#f05252}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.px-0{padding-left:0;padding-right:0}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-1{padding-left:.25rem}.pl-10{padding-left:2.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pt-0{padding-top:0}.pt-2{padding-top:.5rem}.pt-20{padding-top:5rem}.pt-28{padding-top:7rem}.pt-3{padding-top:.75rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.align-middle{vertical-align:middle}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-6{line-height:1.5rem}.leading-9{line-height:2.25rem}.leading-tight{line-height:1.25}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity:1;color:rgb(63 131 248/var(--tw-text-opacity))}.text-blue-600{--tw-text-opacity:1;color:rgb(28 100 242/var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-green-200{--tw-text-opacity:1;color:rgb(188 240 218/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(14 159 110/var(--tw-text-opacity))}.text-red-500{--tw-text-opacity:1;color:rgb(240 82 82/var(--tw-text-opacity))}.text-red-700{--tw-text-opacity:1;color:rgb(200 30 30/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 #0000001a,0 1px 2px -1px #0000001a;--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-md,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.shadow-xl{--tw-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.blur{--tw-blur:blur(8px)}.blur,.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,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-100{transition-delay:.1s}.duration-300{transition-duration:.3s}.duration-700{transition-duration:.7s}.duration-75{transition-duration:75ms}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.text-danger{color:red}.h-box{height:calc(100vh - 150px)}.w-box{width:calc(100vw - 255px)}.hover\:border-gray-300:hover{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.hover\:bg-blue-100:hover{--tw-bg-opacity:1;background-color:rgb(225 239 254/var(--tw-bg-opacity))}.hover\:bg-blue-800:hover{--tw-bg-opacity:1;background-color:rgb(30 66 159/var(--tw-bg-opacity))}.hover\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.hover\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.hover\:bg-red-800:hover{--tw-bg-opacity:1;background-color:rgb(155 28 28/var(--tw-bg-opacity))}.hover\:bg-white:hover{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.hover\:bg-gradient-to-bl:hover{background-image:linear-gradient(to bottom left,var(--tw-gradient-stops))}.hover\:text-blue-600:hover{--tw-text-opacity:1;color:rgb(28 100 242/var(--tw-text-opacity))}.hover\:text-blue-700:hover{--tw-text-opacity:1;color:rgb(26 86 219/var(--tw-text-opacity))}.hover\:text-gray-600:hover{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.hover\:text-gray-700:hover{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.hover\:text-gray-900:hover{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.focus\:border-blue-500:focus{--tw-border-opacity:1;border-color:rgb(63 131 248/var(--tw-border-opacity))}.focus\:border-blue-600:focus{--tw-border-opacity:1;border-color:rgb(28 100 242/var(--tw-border-opacity))}.focus\:outline-none:focus{outline:2px solid #0000;outline-offset:2px}.focus\:ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\:ring-0:focus,.focus\:ring-2:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\:ring-4:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\:ring-blue-100:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(225 239 254/var(--tw-ring-opacity))}.focus\:ring-blue-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(164 202 254/var(--tw-ring-opacity))}.focus\:ring-blue-500:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(63 131 248/var(--tw-ring-opacity))}.focus\:ring-blue-600:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(28 100 242/var(--tw-ring-opacity))}.focus\:ring-cyan-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(103 232 249/var(--tw-ring-opacity))}.focus\:ring-emerald-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(110 231 183/var(--tw-ring-opacity))}.focus\:ring-gray-200:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(229 231 235/var(--tw-ring-opacity))}.focus\:ring-gray-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(209 213 219/var(--tw-ring-opacity))}.focus\:ring-red-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(248 180 180/var(--tw-ring-opacity))}.focus\:ring-teal-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(126 220 226/var(--tw-ring-opacity))}.group:hover .group-hover\:text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.peer:-moz-placeholder-shown~.peer-placeholder-shown\:translate-y-0{--tw-translate-y:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:placeholder-shown~.peer-placeholder-shown\:translate-y-0{--tw-translate-y:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:-moz-placeholder-shown~.peer-placeholder-shown\:scale-100{--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:placeholder-shown~.peer-placeholder-shown\:scale-100{--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:focus~.peer-focus\:left-0{left:0}.peer:focus~.peer-focus\:-translate-y-6{--tw-translate-y:-1.5rem}.peer:focus~.peer-focus\:-translate-y-6,.peer:focus~.peer-focus\:scale-75{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:focus~.peer-focus\:scale-75{--tw-scale-x:.75;--tw-scale-y:.75}.peer:focus~.peer-focus\:font-medium{font-weight:500}.peer:focus~.peer-focus\:text-blue-600{--tw-text-opacity:1;color:rgb(28 100 242/var(--tw-text-opacity))}:is(.dark .dark\:block){display:block}:is(.dark .dark\:hidden){display:none}:is(.dark .dark\:divide-gray-600)>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(75 85 99/var(--tw-divide-opacity))}:is(.dark .dark\:divide-gray-700)>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(55 65 81/var(--tw-divide-opacity))}:is(.dark .dark\:border-blue-500){--tw-border-opacity:1;border-color:rgb(63 131 248/var(--tw-border-opacity))}:is(.dark .dark\:border-gray-500){--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity))}:is(.dark .dark\:border-gray-600){--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity))}:is(.dark .dark\:border-gray-700){--tw-border-opacity:1;border-color:rgb(55 65 81/var(--tw-border-opacity))}:is(.dark .dark\:border-gray-800){--tw-border-opacity:1;border-color:rgb(31 41 55/var(--tw-border-opacity))}:is(.dark .dark\:border-gray-900){--tw-border-opacity:1;border-color:rgb(17 24 39/var(--tw-border-opacity))}:is(.dark .dark\:border-red-500){--tw-border-opacity:1;border-color:rgb(240 82 82/var(--tw-border-opacity))}:is(.dark .dark\:border-transparent){border-color:#0000}:is(.dark .dark\:bg-blue-600){--tw-bg-opacity:1;background-color:rgb(28 100 242/var(--tw-bg-opacity))}:is(.dark .dark\:bg-emerald-600){--tw-bg-opacity:1;background-color:rgb(5 150 105/var(--tw-bg-opacity))}:is(.dark .dark\:bg-gray-600){--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity))}:is(.dark .dark\:bg-gray-700){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}:is(.dark .dark\:bg-gray-800){--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}:is(.dark .dark\:bg-gray-800\/50){background-color:#1f293780}:is(.dark .dark\:bg-gray-900){--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}:is(.dark .dark\:bg-green-800){--tw-bg-opacity:1;background-color:rgb(3 84 63/var(--tw-bg-opacity))}:is(.dark .dark\:bg-red-600){--tw-bg-opacity:1;background-color:rgb(224 36 36/var(--tw-bg-opacity))}:is(.dark .dark\:bg-red-800){--tw-bg-opacity:1;background-color:rgb(155 28 28/var(--tw-bg-opacity))}:is(.dark .dark\:bg-slate-700){--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity))}:is(.dark .dark\:bg-teal-600){--tw-bg-opacity:1;background-color:rgb(4 116 129/var(--tw-bg-opacity))}:is(.dark .dark\:bg-opacity-80){--tw-bg-opacity:0.8}:is(.dark .dark\:text-blue-500){--tw-text-opacity:1;color:rgb(63 131 248/var(--tw-text-opacity))}:is(.dark .dark\:text-gray-200){--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity))}:is(.dark .dark\:text-gray-400){--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}:is(.dark .dark\:text-gray-500){--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}:is(.dark .dark\:text-green-200){--tw-text-opacity:1;color:rgb(188 240 218/var(--tw-text-opacity))}:is(.dark .dark\:text-red-200){--tw-text-opacity:1;color:rgb(251 213 213/var(--tw-text-opacity))}:is(.dark .dark\:text-red-500){--tw-text-opacity:1;color:rgb(240 82 82/var(--tw-text-opacity))}:is(.dark .dark\:text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}:is(.dark .dark\:placeholder-gray-400)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity))}:is(.dark .dark\:placeholder-gray-400)::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity))}:is(.dark .dark\:shadow-gray-600){--tw-shadow-color:#4b5563;--tw-shadow:var(--tw-shadow-colored)}:is(.dark .dark\:hover\:border-gray-600:hover){--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity))}:is(.dark .dark\:hover\:bg-blue-700:hover){--tw-bg-opacity:1;background-color:rgb(26 86 219/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-emerald-700:hover){--tw-bg-opacity:1;background-color:rgb(4 120 87/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-gray-600:hover){--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-gray-700:hover){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-gray-800:hover){--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-red-600:hover){--tw-bg-opacity:1;background-color:rgb(224 36 36/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-red-700:hover){--tw-bg-opacity:1;background-color:rgb(200 30 30/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-teal-700:hover){--tw-bg-opacity:1;background-color:rgb(3 102 114/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:text-blue-500:hover){--tw-text-opacity:1;color:rgb(63 131 248/var(--tw-text-opacity))}:is(.dark .dark\:hover\:text-gray-300:hover){--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}:is(.dark .dark\:hover\:text-white:hover){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}:is(.dark .dark\:focus\:border-blue-500:focus){--tw-border-opacity:1;border-color:rgb(63 131 248/var(--tw-border-opacity))}:is(.dark .dark\:focus\:ring-blue-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(63 131 248/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-blue-800:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(30 66 159/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-cyan-800:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(21 94 117/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-emerald-800:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(6 95 70/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-gray-600:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(75 85 99/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-gray-700:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(55 65 81/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-red-800:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(155 28 28/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-red-900:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(119 29 29/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-teal-800:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(5 80 92/var(--tw-ring-opacity))}:is(.dark .group:hover .dark\:group-hover\:text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.peer:focus~:is(.dark .peer-focus\:dark\:text-blue-500){--tw-text-opacity:1;color:rgb(63 131 248/var(--tw-text-opacity))}@media (min-width:640px){.sm\:col-span-3{grid-column:span 3/span 3}.sm\:w-auto{width:auto}.sm\:rounded-lg{border-radius:.5rem}.sm\:p-8{padding:2rem}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}}@media (min-width:768px){.md\:inset-0{inset:0}.md\:ml-3{margin-left:.75rem}.md\:ml-auto{margin-left:auto}.md\:mr-2{margin-right:.5rem}.md\:mr-24{margin-right:6rem}.md\:mr-3{margin-right:.75rem}.md\:mr-64{margin-right:16rem}.md\:block{display:block}.md\:inline-block{display:inline-block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-1\/2{width:50%}.md\:w-10\/12{width:83.333333%}.md\:w-auto{width:auto}.md\:w-full{width:100%}.md\:max-w-xl{max-width:36rem}.md\:translate-x-0{--tw-translate-x:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\:flex-row{flex-direction:row}.md\:flex-wrap{flex-wrap:wrap}.md\:space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.75rem*var(--tw-space-x-reverse));margin-left:calc(.75rem*(1 - var(--tw-space-x-reverse)))}.md\:overflow-auto{overflow:auto}.md\:text-left{text-align:left}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width:1024px){.lg\:w-4\/12{width:33.333333%}.lg\:max-w-xl{max-width:36rem}.lg\:px-5{padding-left:1.25rem;padding-right:1.25rem}.lg\:pl-3{padding-left:.75rem}}.\[\&\>\*\]\:\!border-none>*{border-style:none!important}.\[\&\>\*\]\:\!stroke-black>*{stroke:#000!important}:is(.dark .\[\&\>\*\]\:dark\:bg-gray-600)>*{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity))}:is(.dark .dark\:\[\&\>\*\]\:\!stroke-white>*){stroke:#fff!important} \ No newline at end of file +/*! tailwindcss v3.3.1 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal}body{margin:0;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;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}[multiple],[type=date],[type=datetime-local],[type=email],[type=month],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=time],[type=url],[type=week],select,textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-width:1px;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem;--tw-shadow:0 0 #0000}[multiple]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=email]:focus,[type=month]:focus,[type=number]:focus,[type=password]:focus,[type=search]:focus,[type=tel]:focus,[type=text]:focus,[type=time]:focus,[type=url]:focus,[type=week]:focus,select:focus,textarea:focus{outline:2px solid #0000;outline-offset:2px;--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#1c64f2;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#1c64f2}input::-moz-placeholder,textarea::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder,textarea::placeholder{color:#6b7280;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}select:not([size]){background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}[multiple]{background-image:none;background-position:0 0;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;display:inline-block;vertical-align:middle;background-origin:border-box;-webkit-user-select:none;-moz-user-select:none;user-select:none;flex-shrink:0;height:1rem;width:1rem;color:#1c64f2;background-color:#fff;border-color:#6b7280;border-width:1px;--tw-shadow:0 0 #0000}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{outline:2px solid #0000;outline-offset:2px;--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:#1c64f2;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.dark [type=checkbox]:checked,.dark [type=radio]:checked,[type=checkbox]:checked,[type=radio]:checked{border-color:#0000;background-color:currentColor;background-size:100% 100%;background-position:50%;background-repeat:no-repeat}[type=checkbox]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E")}[type=radio]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E")}[type=checkbox]:indeterminate{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E");background-size:100% 100%;background-position:50%;background-repeat:no-repeat}[type=checkbox]:indeterminate,[type=checkbox]:indeterminate:focus,[type=checkbox]:indeterminate:hover{border-color:#0000;background-color:currentColor}[type=file]{background:unset;border-color:inherit;border-width:0;border-radius:0;padding:0;font-size:unset;line-height:inherit}[type=file]:focus{outline:1px auto inherit}input[type=file]::file-selector-button{color:#fff;background:#1f2937;border:0;font-weight:500;font-size:.875rem;cursor:pointer;padding:.625rem 1rem .625rem 2rem;-webkit-margin-start:-1rem;margin-inline-start:-1rem;-webkit-margin-end:1rem;margin-inline-end:1rem}input[type=file]::file-selector-button:hover{background:#374151}.dark input[type=file]::file-selector-button{color:#fff;background:#4b5563}.dark input[type=file]::file-selector-button:hover{background:#6b7280}input[type=range]::-webkit-slider-thumb{height:1.25rem;width:1.25rem;background:#1c64f2;border-radius:9999px;border:0;appearance:none;-moz-appearance:none;-webkit-appearance:none;cursor:pointer}input[type=range]:disabled::-webkit-slider-thumb{background:#9ca3af}.dark input[type=range]:disabled::-webkit-slider-thumb{background:#6b7280}input[type=range]:focus::-webkit-slider-thumb{outline:2px solid #0000;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-opacity:1px;--tw-ring-color:rgb(164 202 254/var(--tw-ring-opacity))}input[type=range]::-moz-range-thumb{height:1.25rem;width:1.25rem;background:#1c64f2;border-radius:9999px;border:0;appearance:none;-moz-appearance:none;-webkit-appearance:none;cursor:pointer}input[type=range]:disabled::-moz-range-thumb{background:#9ca3af}.dark input[type=range]:disabled::-moz-range-thumb{background:#6b7280}input[type=range]::-moz-range-progress{background:#3f83f8}input[type=range]::-ms-fill-lower{background:#3f83f8}.toggle-bg:after{content:"";position:absolute;top:.125rem;left:.125rem;background:#fff;border-color:#d1d5db;border-width:1px;border-radius:9999px;height:1.25rem;width:1.25rem;transition-property:background-color,border-color,color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-duration:.15s;box-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}input:checked+.toggle-bg:after{transform:translateX(100%);;border-color:#fff}input:checked+.toggle-bg{background:#1c64f2;border-color:#1c64f2}.tooltip-arrow,.tooltip-arrow:before{position:absolute;width:8px;height:8px;background:inherit}.tooltip-arrow{visibility:hidden}.tooltip-arrow:before{content:"";visibility:visible;transform:rotate(45deg)}[data-tooltip-style^=light]+.tooltip>.tooltip-arrow:before{border-style:solid;border-color:#e5e7eb}[data-tooltip-style^=light]+.tooltip[data-popper-placement^=top]>.tooltip-arrow:before{border-bottom-width:1px;border-right-width:1px}[data-tooltip-style^=light]+.tooltip[data-popper-placement^=right]>.tooltip-arrow:before{border-bottom-width:1px;border-left-width:1px}[data-tooltip-style^=light]+.tooltip[data-popper-placement^=bottom]>.tooltip-arrow:before{border-top-width:1px;border-left-width:1px}[data-tooltip-style^=light]+.tooltip[data-popper-placement^=left]>.tooltip-arrow:before{border-top-width:1px;border-right-width:1px}.tooltip[data-popper-placement^=top]>.tooltip-arrow{bottom:-4px}.tooltip[data-popper-placement^=bottom]>.tooltip-arrow{top:-4px}.tooltip[data-popper-placement^=left]>.tooltip-arrow{right:-4px}.tooltip[data-popper-placement^=right]>.tooltip-arrow{left:-4px}.tooltip.invisible>.tooltip-arrow:before{visibility:hidden}[data-popper-arrow],[data-popper-arrow]:before{position:absolute;width:8px;height:8px;background:inherit}[data-popper-arrow]{visibility:hidden}[data-popper-arrow]:after,[data-popper-arrow]:before{content:"";visibility:visible;transform:rotate(45deg)}[data-popper-arrow]:after{position:absolute;width:9px;height:9px;background:inherit}[role=tooltip]>[data-popper-arrow]:before{border-style:solid;border-color:#e5e7eb}.dark [role=tooltip]>[data-popper-arrow]:before{border-style:solid;border-color:#4b5563}[role=tooltip]>[data-popper-arrow]:after{border-style:solid;border-color:#e5e7eb}.dark [role=tooltip]>[data-popper-arrow]:after{border-style:solid;border-color:#4b5563}[data-popover][role=tooltip][data-popper-placement^=top]>[data-popper-arrow]:after,[data-popover][role=tooltip][data-popper-placement^=top]>[data-popper-arrow]:before{border-bottom-width:1px;border-right-width:1px}[data-popover][role=tooltip][data-popper-placement^=right]>[data-popper-arrow]:after,[data-popover][role=tooltip][data-popper-placement^=right]>[data-popper-arrow]:before{border-bottom-width:1px;border-left-width:1px}[data-popover][role=tooltip][data-popper-placement^=bottom]>[data-popper-arrow]:after,[data-popover][role=tooltip][data-popper-placement^=bottom]>[data-popper-arrow]:before{border-top-width:1px;border-left-width:1px}[data-popover][role=tooltip][data-popper-placement^=left]>[data-popper-arrow]:after,[data-popover][role=tooltip][data-popper-placement^=left]>[data-popper-arrow]:before{border-top-width:1px;border-right-width:1px}[data-popover][role=tooltip][data-popper-placement^=top]>[data-popper-arrow]{bottom:-5px}[data-popover][role=tooltip][data-popper-placement^=bottom]>[data-popper-arrow]{top:-5px}[data-popover][role=tooltip][data-popper-placement^=left]>[data-popper-arrow]{right:-5px}[data-popover][role=tooltip][data-popper-placement^=right]>[data-popper-arrow]{left:-5px}[role=tooltip].invisible>[data-popper-arrow]:after,[role=tooltip].invisible>[data-popper-arrow]:before{visibility:hidden}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3f83f880;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-y-0{top:0;bottom:0}.-top-2{top:-.5rem}.bottom-0{bottom:0}.bottom-14{bottom:3.5rem}.bottom-2{bottom:.5rem}.bottom-2\.5{bottom:.625rem}.bottom-3{bottom:.75rem}.bottom-\[60px\]{bottom:60px}.left-0{left:0}.left-10{left:2.5rem}.left-3{left:.75rem}.left-auto{left:auto}.right-0{right:0}.right-2{right:.5rem}.right-2\.5{right:.625rem}.right-3{right:.75rem}.top-0{top:0}.top-10{top:2.5rem}.top-3{top:.75rem}.top-32{top:8rem}.top-44{top:11rem}.-z-10{z-index:-10}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[55\]{z-index:55}.col-span-6{grid-column:span 6/span 6}.col-span-full{grid-column:1/-1}.m-3{margin:.75rem}.m-5{margin:1.25rem}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-1\.5{margin-left:-.375rem;margin-right:-.375rem}.-my-1{margin-top:-.25rem;margin-bottom:-.25rem}.-my-1\.5{margin-top:-.375rem;margin-bottom:-.375rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.my-auto{margin-top:auto;margin-bottom:auto}.-mb-px{margin-bottom:-1px}.-mr-1{margin-right:-.25rem}.-mt-5{margin-top:-1.25rem}.mb-0{margin-bottom:0}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.ml-0{margin-left:0}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-5{margin-left:1.25rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-64{margin-right:16rem}.mr-8{margin-right:2rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-20{margin-top:5rem}.mt-24{margin-top:6rem}.mt-3{margin-top:.75rem}.mt-36{margin-top:9rem}.mt-40{margin-top:10rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-11{height:2.75rem}.h-14{height:3.5rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-\[calc\(100\%-1rem\)\]{height:calc(100% - 1rem)}.h-auto{height:auto}.h-full{height:100%}.h-max{height:-moz-max-content;height:max-content}.h-screen{height:100vh}.max-h-full{max-height:100%}.w-1\/2{width:50%}.w-11{width:2.75rem}.w-11\/12{width:91.666667%}.w-14{width:3.5rem}.w-2\/3{width:66.666667%}.w-24{width:6rem}.w-3{width:.75rem}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-full{width:100%}.w-screen{width:100vw}.max-w-2xl{max-width:42rem}.max-w-6xl{max-width:72rem}.max-w-full{max-width:100%}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink{flex-shrink:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.origin-\[0\]{transform-origin:0}.-translate-x-full{--tw-translate-x:-100%}.-translate-x-full,.-translate-y-6{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-6{--tw-translate-y:-1.5rem}.-translate-y-full{--tw-translate-y:-100%}.-translate-y-full,.translate-x-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x:0px}.translate-x-96{--tw-translate-x:24rem}.translate-x-96,.translate-x-full{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-full{--tw-translate-x:100%}.translate-y-full{--tw-translate-y:100%}.rotate-180,.translate-y-full{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg}.scale-75{--tw-scale-x:.75;--tw-scale-y:.75}.scale-75,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform-none{transform:none}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.list-none{list-style-type:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-center{align-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-6{gap:1.5rem}.-space-x-px>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(-1px*var(--tw-space-x-reverse));margin-left:calc(-1px*(1 - var(--tw-space-x-reverse)))}.space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0px*var(--tw-space-x-reverse));margin-left:calc(0px*(1 - var(--tw-space-x-reverse)))}.space-x-0\.5>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.125rem*var(--tw-space-x-reverse));margin-left:calc(.125rem*(1 - var(--tw-space-x-reverse)))}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.25rem*var(--tw-space-x-reverse));margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem*var(--tw-space-x-reverse));margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.75rem*var(--tw-space-x-reverse));margin-left:calc(.75rem*(1 - var(--tw-space-x-reverse)))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem*var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem*var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem*var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem*var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px*var(--tw-divide-y-reverse))}.divide-gray-100>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(243 244 246/var(--tw-divide-opacity))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(229 231 235/var(--tw-divide-opacity))}.self-center{align-self:center}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-x-scroll{overflow-x:scroll}.truncate{overflow:hidden;text-overflow:ellipsis}.truncate,.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-b-lg{border-bottom-right-radius:.5rem}.rounded-b-lg,.rounded-l-lg{border-bottom-left-radius:.5rem}.rounded-l-lg{border-top-left-radius:.5rem}.rounded-r-lg{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-lg{border-top-left-radius:.5rem;border-top-right-radius:.5rem}.border{border-width:1px}.border-0{border-width:0}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-t-2{border-top-width:2px}.border-solid{border-style:solid}.border-blue-300{--tw-border-opacity:1;border-color:rgb(164 202 254/var(--tw-border-opacity))}.border-blue-600{--tw-border-opacity:1;border-color:rgb(28 100 242/var(--tw-border-opacity))}.border-blue-700{--tw-border-opacity:1;border-color:rgb(26 86 219/var(--tw-border-opacity))}.border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity))}.border-red-700{--tw-border-opacity:1;border-color:rgb(200 30 30/var(--tw-border-opacity))}.border-transparent{border-color:#0000}.border-white{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.bg-blue-50{--tw-bg-opacity:1;background-color:rgb(235 245 255/var(--tw-bg-opacity))}.bg-blue-600{--tw-bg-opacity:1;background-color:rgb(28 100 242/var(--tw-bg-opacity))}.bg-blue-700{--tw-bg-opacity:1;background-color:rgb(26 86 219/var(--tw-bg-opacity))}.bg-emerald-700{--tw-bg-opacity:1;background-color:rgb(4 120 87/var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}.bg-green-100{--tw-bg-opacity:1;background-color:rgb(222 247 236/var(--tw-bg-opacity))}.bg-red-100{--tw-bg-opacity:1;background-color:rgb(253 232 232/var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(240 82 82/var(--tw-bg-opacity))}.bg-red-700{--tw-bg-opacity:1;background-color:rgb(200 30 30/var(--tw-bg-opacity))}.bg-slate-300{--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}.bg-slate-600{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity))}.bg-teal-700{--tw-bg-opacity:1;background-color:rgb(3 102 114/var(--tw-bg-opacity))}.bg-transparent{background-color:initial}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-white\/50{background-color:#ffffff80}.bg-opacity-50{--tw-bg-opacity:0.5}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-cyan-500{--tw-gradient-from:#06b6d4 var(--tw-gradient-from-position);--tw-gradient-from-position: ;--tw-gradient-to:#06b6d400 var(--tw-gradient-from-position);--tw-gradient-to-position: ;--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.to-blue-500{--tw-gradient-to:#3f83f8 var(--tw-gradient-to-position);--tw-gradient-to-position: }.fill-yellow-300{fill:#faca15}.stroke-green-500{stroke:#0e9f6e}.stroke-red-500{stroke:#f05252}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.px-0{padding-left:0;padding-right:0}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-1{padding-left:.25rem}.pl-10{padding-left:2.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pt-0{padding-top:0}.pt-2{padding-top:.5rem}.pt-20{padding-top:5rem}.pt-28{padding-top:7rem}.pt-3{padding-top:.75rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.align-middle{vertical-align:middle}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-6{line-height:1.5rem}.leading-9{line-height:2.25rem}.leading-tight{line-height:1.25}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity:1;color:rgb(63 131 248/var(--tw-text-opacity))}.text-blue-600{--tw-text-opacity:1;color:rgb(28 100 242/var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-green-200{--tw-text-opacity:1;color:rgb(188 240 218/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(14 159 110/var(--tw-text-opacity))}.text-red-500{--tw-text-opacity:1;color:rgb(240 82 82/var(--tw-text-opacity))}.text-red-700{--tw-text-opacity:1;color:rgb(200 30 30/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 #0000001a,0 1px 2px -1px #0000001a;--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-md,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.shadow-xl{--tw-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.blur{--tw-blur:blur(8px)}.blur,.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,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-100{transition-delay:.1s}.duration-300{transition-duration:.3s}.duration-700{transition-duration:.7s}.duration-75{transition-duration:75ms}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.text-danger{color:red}.h-box{height:calc(100vh - 150px)}.w-box{width:calc(100vw - 255px)}.hover\:border-gray-300:hover{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.hover\:bg-blue-100:hover{--tw-bg-opacity:1;background-color:rgb(225 239 254/var(--tw-bg-opacity))}.hover\:bg-blue-800:hover{--tw-bg-opacity:1;background-color:rgb(30 66 159/var(--tw-bg-opacity))}.hover\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.hover\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.hover\:bg-red-800:hover{--tw-bg-opacity:1;background-color:rgb(155 28 28/var(--tw-bg-opacity))}.hover\:bg-white:hover{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.hover\:bg-gradient-to-bl:hover{background-image:linear-gradient(to bottom left,var(--tw-gradient-stops))}.hover\:text-blue-600:hover{--tw-text-opacity:1;color:rgb(28 100 242/var(--tw-text-opacity))}.hover\:text-blue-700:hover{--tw-text-opacity:1;color:rgb(26 86 219/var(--tw-text-opacity))}.hover\:text-gray-600:hover{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.hover\:text-gray-700:hover{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.hover\:text-gray-900:hover{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.focus\:border-blue-500:focus{--tw-border-opacity:1;border-color:rgb(63 131 248/var(--tw-border-opacity))}.focus\:border-blue-600:focus{--tw-border-opacity:1;border-color:rgb(28 100 242/var(--tw-border-opacity))}.focus\:outline-none:focus{outline:2px solid #0000;outline-offset:2px}.focus\:ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\:ring-0:focus,.focus\:ring-2:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\:ring-4:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\:ring-blue-100:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(225 239 254/var(--tw-ring-opacity))}.focus\:ring-blue-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(164 202 254/var(--tw-ring-opacity))}.focus\:ring-blue-500:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(63 131 248/var(--tw-ring-opacity))}.focus\:ring-blue-600:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(28 100 242/var(--tw-ring-opacity))}.focus\:ring-cyan-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(103 232 249/var(--tw-ring-opacity))}.focus\:ring-emerald-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(110 231 183/var(--tw-ring-opacity))}.focus\:ring-gray-200:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(229 231 235/var(--tw-ring-opacity))}.focus\:ring-gray-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(209 213 219/var(--tw-ring-opacity))}.focus\:ring-red-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(248 180 180/var(--tw-ring-opacity))}.focus\:ring-teal-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(126 220 226/var(--tw-ring-opacity))}.group:hover .group-hover\:text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.peer:-moz-placeholder-shown~.peer-placeholder-shown\:translate-y-0{--tw-translate-y:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:placeholder-shown~.peer-placeholder-shown\:translate-y-0{--tw-translate-y:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:-moz-placeholder-shown~.peer-placeholder-shown\:scale-100{--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:placeholder-shown~.peer-placeholder-shown\:scale-100{--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:focus~.peer-focus\:left-0{left:0}.peer:focus~.peer-focus\:-translate-y-6{--tw-translate-y:-1.5rem}.peer:focus~.peer-focus\:-translate-y-6,.peer:focus~.peer-focus\:scale-75{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:focus~.peer-focus\:scale-75{--tw-scale-x:.75;--tw-scale-y:.75}.peer:focus~.peer-focus\:font-medium{font-weight:500}.peer:focus~.peer-focus\:text-blue-600{--tw-text-opacity:1;color:rgb(28 100 242/var(--tw-text-opacity))}:is(.dark .dark\:block){display:block}:is(.dark .dark\:hidden){display:none}:is(.dark .dark\:divide-gray-600)>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(75 85 99/var(--tw-divide-opacity))}:is(.dark .dark\:divide-gray-700)>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(55 65 81/var(--tw-divide-opacity))}:is(.dark .dark\:border-blue-500){--tw-border-opacity:1;border-color:rgb(63 131 248/var(--tw-border-opacity))}:is(.dark .dark\:border-gray-500){--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity))}:is(.dark .dark\:border-gray-600){--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity))}:is(.dark .dark\:border-gray-700){--tw-border-opacity:1;border-color:rgb(55 65 81/var(--tw-border-opacity))}:is(.dark .dark\:border-gray-800){--tw-border-opacity:1;border-color:rgb(31 41 55/var(--tw-border-opacity))}:is(.dark .dark\:border-gray-900){--tw-border-opacity:1;border-color:rgb(17 24 39/var(--tw-border-opacity))}:is(.dark .dark\:border-red-500){--tw-border-opacity:1;border-color:rgb(240 82 82/var(--tw-border-opacity))}:is(.dark .dark\:border-transparent){border-color:#0000}:is(.dark .dark\:bg-blue-600){--tw-bg-opacity:1;background-color:rgb(28 100 242/var(--tw-bg-opacity))}:is(.dark .dark\:bg-emerald-600){--tw-bg-opacity:1;background-color:rgb(5 150 105/var(--tw-bg-opacity))}:is(.dark .dark\:bg-gray-600){--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity))}:is(.dark .dark\:bg-gray-700){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}:is(.dark .dark\:bg-gray-800){--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}:is(.dark .dark\:bg-gray-800\/50){background-color:#1f293780}:is(.dark .dark\:bg-gray-900){--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}:is(.dark .dark\:bg-green-800){--tw-bg-opacity:1;background-color:rgb(3 84 63/var(--tw-bg-opacity))}:is(.dark .dark\:bg-red-600){--tw-bg-opacity:1;background-color:rgb(224 36 36/var(--tw-bg-opacity))}:is(.dark .dark\:bg-red-800){--tw-bg-opacity:1;background-color:rgb(155 28 28/var(--tw-bg-opacity))}:is(.dark .dark\:bg-slate-700){--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity))}:is(.dark .dark\:bg-teal-600){--tw-bg-opacity:1;background-color:rgb(4 116 129/var(--tw-bg-opacity))}:is(.dark .dark\:bg-opacity-80){--tw-bg-opacity:0.8}:is(.dark .dark\:text-blue-500){--tw-text-opacity:1;color:rgb(63 131 248/var(--tw-text-opacity))}:is(.dark .dark\:text-gray-200){--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity))}:is(.dark .dark\:text-gray-400){--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}:is(.dark .dark\:text-gray-500){--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}:is(.dark .dark\:text-green-200){--tw-text-opacity:1;color:rgb(188 240 218/var(--tw-text-opacity))}:is(.dark .dark\:text-red-200){--tw-text-opacity:1;color:rgb(251 213 213/var(--tw-text-opacity))}:is(.dark .dark\:text-red-500){--tw-text-opacity:1;color:rgb(240 82 82/var(--tw-text-opacity))}:is(.dark .dark\:text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}:is(.dark .dark\:placeholder-gray-400)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity))}:is(.dark .dark\:placeholder-gray-400)::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity))}:is(.dark .dark\:shadow-gray-600){--tw-shadow-color:#4b5563;--tw-shadow:var(--tw-shadow-colored)}:is(.dark .dark\:hover\:border-gray-600:hover){--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity))}:is(.dark .dark\:hover\:bg-blue-700:hover){--tw-bg-opacity:1;background-color:rgb(26 86 219/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-emerald-700:hover){--tw-bg-opacity:1;background-color:rgb(4 120 87/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-gray-600:hover){--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-gray-700:hover){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-gray-800:hover){--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-red-600:hover){--tw-bg-opacity:1;background-color:rgb(224 36 36/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-red-700:hover){--tw-bg-opacity:1;background-color:rgb(200 30 30/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:bg-teal-700:hover){--tw-bg-opacity:1;background-color:rgb(3 102 114/var(--tw-bg-opacity))}:is(.dark .dark\:hover\:text-blue-500:hover){--tw-text-opacity:1;color:rgb(63 131 248/var(--tw-text-opacity))}:is(.dark .dark\:hover\:text-gray-300:hover){--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}:is(.dark .dark\:hover\:text-white:hover){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}:is(.dark .dark\:focus\:border-blue-500:focus){--tw-border-opacity:1;border-color:rgb(63 131 248/var(--tw-border-opacity))}:is(.dark .dark\:focus\:ring-blue-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(63 131 248/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-blue-800:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(30 66 159/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-cyan-800:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(21 94 117/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-emerald-800:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(6 95 70/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-gray-600:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(75 85 99/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-gray-700:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(55 65 81/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-red-800:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(155 28 28/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-red-900:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(119 29 29/var(--tw-ring-opacity))}:is(.dark .dark\:focus\:ring-teal-800:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(5 80 92/var(--tw-ring-opacity))}:is(.dark .group:hover .dark\:group-hover\:text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.peer:focus~:is(.dark .peer-focus\:dark\:text-blue-500){--tw-text-opacity:1;color:rgb(63 131 248/var(--tw-text-opacity))}@media (min-width:640px){.sm\:col-span-3{grid-column:span 3/span 3}.sm\:w-auto{width:auto}.sm\:rounded-lg{border-radius:.5rem}.sm\:p-8{padding:2rem}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}}@media (min-width:768px){.md\:inset-0{inset:0}.md\:ml-3{margin-left:.75rem}.md\:ml-auto{margin-left:auto}.md\:mr-2{margin-right:.5rem}.md\:mr-24{margin-right:6rem}.md\:mr-3{margin-right:.75rem}.md\:mr-64{margin-right:16rem}.md\:block{display:block}.md\:inline-block{display:inline-block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-1\/2{width:50%}.md\:w-10\/12{width:83.333333%}.md\:w-auto{width:auto}.md\:w-full{width:100%}.md\:max-w-xl{max-width:36rem}.md\:translate-x-0{--tw-translate-x:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\:flex-row{flex-direction:row}.md\:flex-wrap{flex-wrap:wrap}.md\:space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.75rem*var(--tw-space-x-reverse));margin-left:calc(.75rem*(1 - var(--tw-space-x-reverse)))}.md\:overflow-auto{overflow:auto}.md\:text-left{text-align:left}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width:1024px){.lg\:w-4\/12{width:33.333333%}.lg\:max-w-xl{max-width:36rem}.lg\:px-5{padding-left:1.25rem;padding-right:1.25rem}.lg\:pl-3{padding-left:.75rem}}.\[\&\>\*\]\:\!border-none>*{border-style:none!important}.\[\&\>\*\]\:\!stroke-black>*{stroke:#000!important}:is(.dark .\[\&\>\*\]\:dark\:bg-gray-600)>*{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity))}:is(.dark .dark\:\[\&\>\*\]\:\!stroke-white>*){stroke:#fff!important} \ No newline at end of file diff --git a/app/static/js/main.js b/app/static/js/main.js index a73acff..b7aa261 100644 --- a/app/static/js/main.js +++ b/app/static/js/main.js @@ -1,2 +1,2 @@ /*! For license information please see main.js.LICENSE.txt */ -(()=>{var t={5851:(t,e,r)=>{"use strict";r.d(e,{i:()=>n});const n="abi/5.7.0"},2734:(t,e,r)=>{"use strict";r.d(e,{R:()=>x,$:()=>O});var n=r(3286),i=r(3587),o=r(711),s=r(5851),a=r(1184),u=r(4594);class l extends a.XI{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=(0,u.Kn)(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return(0,u.Kn)((0,n.$m)(t.readValue().toHexString(),20))}}class h extends a.XI{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const c=new o.Yd(s.i);function f(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let t={};n=e.map((e=>{const n=e.localName;return n||c.throwError("cannot encode object for signature with missing names",o.Yd.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]&&c.throwError("cannot encode object for signature with duplicate names",o.Yd.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]=!0,r[n]}))}else c.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&c.throwArgumentError("types/value length mismatch","tuple",r);let i=new a.QV(t.wordSize),s=new a.QV(t.wordSize),u=[];e.forEach(((t,e)=>{let r=n[e];if(t.dynamic){let e=s.length;t.encode(s,r);let n=i.writeUpdatableValue();u.push((t=>{n(t+e)}))}else t.encode(i,r)})),u.forEach((t=>{t(i.length)}));let l=t.appendWriter(i);return l+=t.appendWriter(s),l}function d(t,e){let r=[],n=t.subReader(0);e.forEach((e=>{let i=null;if(e.dynamic){let r=t.readValue(),s=n.subReader(r.toNumber());try{i=e.decode(s)}catch(t){if(t.code===o.Yd.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(t.code===o.Yd.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}null!=i&&r.push(i)}));const i=e.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});e.forEach(((t,e)=>{let n=t.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const o=r[e];o instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}}):r[n]=o}));for(let t=0;t{throw e}})}return Object.freeze(r)}class p extends a.XI{constructor(t,e,r){super("array",t.type+"["+(e>=0?e:"")+"]",r,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let r=0;rt._data.length&&c.throwError("insufficient data length",o.Yd.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let r=[];for(let t=0;t{t.dynamic&&(r=!0),n.push(t.type)})),super("tuple","tuple("+n.join(",")+")",e,r),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});return this.coders.forEach(((r,n)=>{let i=r.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[n]))})),Object.freeze(t)}encode(t,e){return f(t,this.coders,e)}decode(t){return t.coerce(this.name,d(t,this.coders))}}var S=r(1388);const T=new o.Yd(s.i),k=new RegExp(/^bytes([0-9]*)$/),R=new RegExp(/^(u?int)([0-9]*)$/);class x{constructor(t){(0,i.zG)(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new l(t.name);case"bool":return new m(t.name);case"string":return new _(t.name);case"bytes":return new v(t.name);case"array":return new p(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new N((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new b(t.name)}let e=t.type.match(R);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&T.throwArgumentError("invalid "+e[1]+" bit length","param",t),new M(r/8,"int"===e[1],t.name)}if(e=t.type.match(k),e){let r=parseInt(e[1]);return(0===r||r>32)&&T.throwArgumentError("invalid bytes length","param",t),new y(r,t.name)}return T.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new a.Ej(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new a.QV(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(S._R.from(t))));return new N(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&T.throwError("types/values length mismatch",o.Yd.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map((t=>this._getCoder(S._R.from(t)))),n=new N(r,"_"),i=this._getWriter();return n.encode(i,e),i.data}decode(t,e,r){const i=t.map((t=>this._getCoder(S._R.from(t))));return new N(i,"_").decode(this._getReader((0,n.lE)(e),r))}}const O=new x},1184:(t,e,r)=>{"use strict";r.d(e,{BR:()=>l,Ej:()=>f,QV:()=>c,XI:()=>h});var n=r(3286),i=r(2593),o=r(3587),s=r(711),a=r(5851);const u=new s.Yd(a.i);function l(t){const e=[],r=function(t,n){if(Array.isArray(n))for(let i in n){const o=t.slice();o.push(i);try{r(o,n[i])}catch(t){e.push({path:o,error:t})}}};return r([],t),e}class h{constructor(t,e,r,n){this.name=t,this.type=e,this.localName=r,this.dynamic=n}_throwError(t,e){u.throwArgumentError(t,this.localName,e)}}class c{constructor(t){(0,o.zG)(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return(0,n.xs)(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData((0,n.zo)(t._data))}writeBytes(t){let e=(0,n.lE)(t);const r=e.length%this.wordSize;return r&&(e=(0,n.zo)([e,this._padding.slice(r)])),this._writeData(e)}_getValue(t){let e=(0,n.lE)(i.O$.from(t));return e.length>this.wordSize&&u.throwError("value out-of-bounds",s.Yd.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=(0,n.zo)([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class f{constructor(t,e,r,i){(0,o.zG)(this,"_data",(0,n.lE)(t)),(0,o.zG)(this,"wordSize",e||32),(0,o.zG)(this,"_coerceFunc",r),(0,o.zG)(this,"allowLoose",i),this._offset=0}get data(){return(0,n.Dv)(this._data)}get consumed(){return this._offset}static coerce(t,e){let r=t.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):f.coerce(t,e)}_peekBytes(t,e,r){let n=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?n=e:u.throwError("data out-of-bounds",s.Yd.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(t){return new f(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let r=this._peekBytes(0,t,!!e);return this._offset+=r.length,r.slice(0,t)}readValue(){return i.O$.from(this.readBytes(this.wordSize))}}},1388:(t,e,r)=>{"use strict";r.d(e,{HY:()=>v,IC:()=>N,QV:()=>y,Xg:()=>M,YW:()=>A,_R:()=>m,pc:()=>d});var n=r(2593),i=r(3587),o=r(711),s=r(5851);const a=new o.Yd(s.i),u={};let l={calldata:!0,memory:!0,storage:!0},h={calldata:!0,memory:!0};function c(t,e){if("bytes"===t||"string"===t){if(l[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&h[e])return!0;return(l[e]||"payable"===e)&&a.throwArgumentError("invalid modifier","name",e),!1}function f(t,e){for(let r in e)(0,i.zG)(t,r,e[r])}const d=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),p=new RegExp(/^(.*)\[([0-9]*)\]$/);class m{constructor(t,e){t!==u&&a.throwError("use fromString",o.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),f(this,e);let r=this.type.match(p);f(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:m.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=d.sighash),d[t]||a.throwArgumentError("invalid format type","format",t),t===d.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==d.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===d.full?", ":",")+")"):e+=this.type,t!==d.sighash&&(!0===this.indexed&&(e+=" indexed"),t===d.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?m.fromString(t,e):m.fromObject(t)}static fromObject(t){return m.isParamType(t)?t:new m(u,{name:t.name||null,type:S(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(m.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function n(e){a.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function i(t){let r={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(r.indexed=!1),r}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},s=o;for(let r=0;rm.fromString(t,e)))}class v{constructor(t,e){t!==u&&a.throwError("use a static from method",o.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),f(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return v.isFragment(t)?t:"string"==typeof t?v.fromString(t):v.fromObject(t)}static fromObject(t){if(v.isFragment(t))return t;switch(t.type){case"function":return A.fromObject(t);case"event":return y.fromObject(t);case"constructor":return M.fromObject(t);case"error":return N.fromObject(t);case"fallback":case"receive":return null}return a.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?y.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?A.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?M.fromString(t.trim()):"error"===t.split(" ")[0]?N.fromString(t.substring(5).trim()):a.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class y extends v{format(t){if(t||(t=d.sighash),d[t]||a.throwArgumentError("invalid format type","format",t),t===d.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==d.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ",t!==d.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?y.fromString(t):y.fromObject(t)}static fromObject(t){if(y.isEventFragment(t))return t;"event"!==t.type&&a.throwArgumentError("invalid event object","value",t);const e={name:k(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(m.fromObject):[],type:"event"};return new y(u,e)}static fromString(t){let e=t.match(R);e||a.throwArgumentError("invalid event string","value",t);let r=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":r=!0;break;case"":break;default:a.warn("unknown modifier: "+t)}})),y.fromObject({name:e[1].trim(),anonymous:r,inputs:g(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function b(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&a.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||a.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=n.O$.from(r[1]),r[0]):t}function w(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function E(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&a.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&a.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||a.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&a.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&a.throwArgumentError("unable to determine stateMutability","value",t),e}class M extends v{format(t){if(t||(t=d.sighash),d[t]||a.throwArgumentError("invalid format type","format",t),t===d.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===d.sighash&&a.throwError("cannot format a constructor for sighash",o.Yd.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?M.fromString(t):M.fromObject(t)}static fromObject(t){if(M.isConstructorFragment(t))return t;"constructor"!==t.type&&a.throwArgumentError("invalid constructor object","value",t);let e=E(t);e.constant&&a.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(m.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?n.O$.from(t.gas):null};return new M(u,r)}static fromString(t){let e={type:"constructor"},r=(t=b(t,e)).match(R);return r&&"constructor"===r[1].trim()||a.throwArgumentError("invalid constructor string","value",t),e.inputs=g(r[2].trim(),!1),w(r[3].trim(),e),M.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class A extends M{format(t){if(t||(t=d.sighash),d[t]||a.throwArgumentError("invalid format type","format",t),t===d.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==d.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ",t!==d.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?A.fromString(t):A.fromObject(t)}static fromObject(t){if(A.isFunctionFragment(t))return t;"function"!==t.type&&a.throwArgumentError("invalid function object","value",t);let e=E(t);const r={type:t.type,name:k(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(m.fromObject):[],outputs:t.outputs?t.outputs.map(m.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?n.O$.from(t.gas):null};return new A(u,r)}static fromString(t){let e={type:"function"},r=(t=b(t,e)).split(" returns ");r.length>2&&a.throwArgumentError("invalid function string","value",t);let n=r[0].match(R);if(n||a.throwArgumentError("invalid function signature","value",t),e.name=n[1].trim(),e.name&&k(e.name),e.inputs=g(n[2],!1),w(n[3].trim(),e),r.length>1){let n=r[1].match(R);""==n[1].trim()&&""==n[3].trim()||a.throwArgumentError("unexpected tokens","value",t),e.outputs=g(n[2],!1)}else e.outputs=[];return A.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function _(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||a.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class N extends v{format(t){if(t||(t=d.sighash),d[t]||a.throwArgumentError("invalid format type","format",t),t===d.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==d.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?N.fromString(t):N.fromObject(t)}static fromObject(t){if(N.isErrorFragment(t))return t;"error"!==t.type&&a.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:k(t.name),inputs:t.inputs?t.inputs.map(m.fromObject):[]};return _(new N(u,e))}static fromString(t){let e={type:"error"},r=t.match(R);return r||a.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&k(e.name),e.inputs=g(r[2],!1),_(N.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function S(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const T=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function k(t){return t&&t.match(T)||a.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const R=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$")},8198:(t,e,r)=>{"use strict";r.d(e,{CC:()=>p,Hk:()=>v,vU:()=>w,vk:()=>m});var n=r(4594),i=r(2593),o=r(3286),s=r(2046),a=r(8197),u=r(3587),l=r(2734),h=r(1388),c=r(711),f=r(5851);const d=new c.Yd(f.i);class p extends u.dk{}class m extends u.dk{}class g extends u.dk{}class v extends u.dk{static isIndexed(t){return!(!t||!t._isIndexed)}}const y={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function b(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class w{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,(0,u.zG)(this,"fragments",e.map((t=>h.HY.from(t))).filter((t=>null!=t))),(0,u.zG)(this,"_abiCoder",(0,u.tu)(new.target,"getAbiCoder")()),(0,u.zG)(this,"functions",{}),(0,u.zG)(this,"errors",{}),(0,u.zG)(this,"events",{}),(0,u.zG)(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void d.warn("duplicate definition - constructor"):void(0,u.zG)(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let r=t.format();e[r]?d.warn("duplicate definition - "+r):e[r]=t})),this.deploy||(0,u.zG)(this,"deploy",h.Xg.from({payable:!1,type:"constructor"})),(0,u.zG)(this,"_isInterface",!0)}format(t){t||(t=h.pc.full),t===h.pc.sighash&&d.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===h.pc.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return l.$}static getAddress(t){return(0,n.Kn)(t)}static getSighash(t){return(0,o.p3)((0,s.id)(t.format()),0,4)}static getEventTopic(t){return(0,s.id)(t.format())}getFunction(t){if((0,o.A7)(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];d.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===r.length?d.throwArgumentError("no matching function","name",e):r.length>1&&d.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const e=this.functions[h.YW.fromString(t).format()];return e||d.throwArgumentError("no matching function","signature",t),e}getEvent(t){if((0,o.A7)(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];d.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===r.length?d.throwArgumentError("no matching event","name",e):r.length>1&&d.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const e=this.events[h.QV.fromString(t).format()];return e||d.throwArgumentError("no matching event","signature",t),e}getError(t){if((0,o.A7)(t)){const e=(0,u.tu)(this.constructor,"getSighash");for(const r in this.errors)if(t===e(this.errors[r]))return this.errors[r];d.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===r.length?d.throwArgumentError("no matching error","name",e):r.length>1&&d.throwArgumentError("multiple matching errors","name",e),this.errors[r[0]]}const e=this.errors[h.YW.fromString(t).format()];return e||d.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return(0,u.tu)(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),(0,u.tu)(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const r=(0,o.lE)(e);return(0,o.Dv)(r.slice(0,4))!==this.getSighash(t)&&d.throwArgumentError(`data signature does not match error ${t.name}.`,"data",(0,o.Dv)(r)),this._decodeParams(t.inputs,r.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),(0,o.Dv)((0,o.zo)([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const r=(0,o.lE)(e);return(0,o.Dv)(r.slice(0,4))!==this.getSighash(t)&&d.throwArgumentError(`data signature does not match function ${t.name}.`,"data",(0,o.Dv)(r)),this._decodeParams(t.inputs,r.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),(0,o.Dv)((0,o.zo)([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let r=(0,o.lE)(e),n=null,i="",s=null,a=null,u=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,r)}catch(t){}break;case 4:{const t=(0,o.Dv)(r.slice(0,4)),e=y[t];if(e)s=this._abiCoder.decode(e.inputs,r.slice(4)),a=e.name,u=e.signature,e.reason&&(n=s[0]),"Error"===a?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:"Panic"===a&&(i=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const e=this.getError(t);s=this._abiCoder.decode(e.inputs,r.slice(4)),a=e.name,u=e.format()}catch(t){}break}}return d.throwError("call revert exception"+i,c.Yd.errors.CALL_EXCEPTION,{method:t.format(),data:(0,o.Dv)(e),errorArgs:s,errorName:a,errorSignature:u,reason:n})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),(0,o.Dv)(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&d.throwError("too many arguments for "+t.format(),c.Yd.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let r=[];t.anonymous||r.push(this.getEventTopic(t));const n=(t,e)=>"string"===t.type?(0,s.id)(e):"bytes"===t.type?(0,a.w)((0,o.Dv)(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=i.O$.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),(0,o.$m)((0,o.Dv)(e),32));for(e.forEach(((e,i)=>{let o=t.inputs[i];o.indexed?null==e?r.push(null):"array"===o.baseType||"tuple"===o.baseType?d.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?r.push(e.map((t=>n(o,t)))):r.push(n(o,e)):null!=e&&d.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const r=[],n=[],i=[];return t.anonymous||r.push(this.getEventTopic(t)),e.length!==t.inputs.length&&d.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const u=e[o];if(t.indexed)if("string"===t.type)r.push((0,s.id)(u));else if("bytes"===t.type)r.push((0,a.w)(u));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([t.type],[u]))}else n.push(t),i.push(u)})),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(t,e,r){if("string"==typeof t&&(t=this.getEvent(t)),null!=r&&!t.anonymous){let e=this.getEventTopic(t);(0,o.A7)(r[0],32)&&r[0].toLowerCase()===e||d.throwError("fragment/topic mismatch",c.Yd.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:r[0]}),r=r.slice(1)}let n=[],i=[],s=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(n.push(h._R.fromObject({type:"bytes32",name:t.name})),s.push(!0)):(n.push(t),s.push(!1)):(i.push(t),s.push(!1))}));let a=null!=r?this._abiCoder.decode(n,(0,o.zo)(r)):null,u=this._abiCoder.decode(i,e,!0),l=[],f=0,p=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==a)l[e]=new v({_isIndexed:!0,hash:null});else if(s[e])l[e]=new v({_isIndexed:!0,hash:a[p++]});else try{l[e]=a[p++]}catch(t){l[e]=t}else try{l[e]=u[f++]}catch(t){l[e]=t}if(t.name&&null==l[t.name]){const r=l[e];r instanceof Error?Object.defineProperty(l,t.name,{enumerable:!0,get:()=>{throw b(`property ${JSON.stringify(t.name)}`,r)}}):l[t.name]=r}}));for(let t=0;t{throw b(`index ${t}`,e)}})}return Object.freeze(l)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new m({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:i.O$.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new p({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=(0,o.Dv)(t);let r=this.getError(e.substring(0,10).toLowerCase());return r?new g({args:this._abiCoder.decode(r.inputs,"0x"+e.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(t){return!(!t||!t._isInterface)}}},4353:(t,e,r)=>{"use strict";r.d(e,{Sg:()=>a,zt:()=>u});var n=r(2593),i=r(3587),o=r(711);const s=new o.Yd("abstract-provider/5.7.0");class a extends i.dk{static isForkEvent(t){return!(!t||!t._isForkEvent)}}class u{constructor(){s.checkAbstract(new.target,u),(0,i.zG)(this,"_isProvider",!0)}getFeeData(){return t=this,e=void 0,o=function*(){const{block:t,gasPrice:e}=yield(0,i.mE)({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((t=>null))});let r=null,o=null,s=null;return t&&t.baseFeePerGas&&(r=t.baseFeePerGas,s=n.O$.from("1500000000"),o=t.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:r,maxFeePerGas:o,maxPriorityFeePerGas:s,gasPrice:e}},new((r=void 0)||(r=Promise))((function(n,i){function s(t){try{u(o.next(t))}catch(t){i(t)}}function a(t){try{u(o.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((o=o.apply(t,e||[])).next())}));var t,e,r,o}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}},8171:(t,e,r)=>{"use strict";r.d(e,{E:()=>l,b:()=>h});var n=r(3587),i=r(711),o=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const s=new i.Yd("abstract-signer/5.7.0"),a=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],u=[i.Yd.errors.INSUFFICIENT_FUNDS,i.Yd.errors.NONCE_EXPIRED,i.Yd.errors.REPLACEMENT_UNDERPRICED];class l{constructor(){s.checkAbstract(new.target,l),(0,n.zG)(this,"_isSigner",!0)}getBalance(t){return o(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return o(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return o(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const e=yield(0,n.mE)(this.checkTransaction(t));return yield this.provider.estimateGas(e)}))}call(t,e){return o(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield(0,n.mE)(this.checkTransaction(t));return yield this.provider.call(r,e)}))}sendTransaction(t){return o(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),r=yield this.signTransaction(e);return yield this.provider.sendTransaction(r)}))}getChainId(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return o(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===a.indexOf(e)&&s.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=(0,n.DC)(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then((e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&s.throwArgumentError("from address mismatch","transaction",t),e[0]))),e}populateTransaction(t){return o(this,void 0,void 0,(function*(){const e=yield(0,n.mE)(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then((t=>o(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&s.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})))),e.to.catch((t=>{})));const r=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!r?0!==e.type&&1!==e.type||!r||s.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):s.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(r&&s.throwError("network does not support EIP-1559",i.Yd.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):s.throwError("failed to get consistent fee data",i.Yd.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch((t=>{if(u.indexOf(t.code)>=0)throw t;return s.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",i.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})}))),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then((e=>(0!==e[1]&&e[0]!==e[1]&&s.throwArgumentError("chainId address mismatch","transaction",t),e[0]))),yield(0,n.mE)(e)}))}_checkProvider(t){this.provider||s.throwError("missing provider",i.Yd.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class h extends l{constructor(t,e){super(),(0,n.zG)(this,"address",t),(0,n.zG)(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then((()=>{s.throwError(t,i.Yd.errors.UNSUPPORTED_OPERATION,{operation:e})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new h(this.address,t)}}},4594:(t,e,r)=>{"use strict";r.d(e,{Kn:()=>d,CR:()=>g,hB:()=>v,vU:()=>m,UJ:()=>p});var n=r(3286),i=r(2593),o=r(8197),s=r(1843);const a=new(r(711).Yd)("address/5.7.0");function u(t){(0,n.A7)(t,20)||a.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const i=(0,n.lE)((0,o.w)(r));for(let t=0;t<40;t+=2)i[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&i[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const l={};for(let t=0;t<10;t++)l[String(t)]=String(t);for(let t=0;t<26;t++)l[String.fromCharCode(65+t)]=String(10+t);const h=Math.floor((c=9007199254740991,Math.log10?Math.log10(c):Math.log(c)/Math.LN10));var c;function f(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>l[t])).join("");for(;e.length>=h;){let t=e.substring(0,h);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function d(t){let e=null;if("string"!=typeof t&&a.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=u(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&a.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==f(t)&&a.throwArgumentError("bad icap checksum","address",t),e=(0,i.g$)(t.substring(4));e.length<40;)e="0"+e;e=u("0x"+e)}else a.throwArgumentError("invalid address","address",t);return e}function p(t){try{return d(t),!0}catch(t){}return!1}function m(t){let e=(0,i.t2)(d(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+f("XE00"+e)+e}function g(t){let e=null;try{e=d(t.from)}catch(e){a.throwArgumentError("missing from address","transaction",t)}const r=(0,n.G1)((0,n.lE)(i.O$.from(t.nonce).toHexString()));return d((0,n.p3)((0,o.w)((0,s.encode)([e,r])),12))}function v(t,e,r){return 32!==(0,n.E1)(e)&&a.throwArgumentError("salt must be 32 bytes","salt",e),32!==(0,n.E1)(r)&&a.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),d((0,n.p3)((0,o.w)((0,n.zo)(["0xff",d(t),e,r])),12))}},9567:(t,e,r)=>{"use strict";r.d(e,{J:()=>i,c:()=>o});var n=r(3286);function i(t){t=atob(t);const e=[];for(let r=0;r{"use strict";r.d(e,{eU:()=>s});var n=r(3286),i=r(3587);class o{constructor(t){(0,i.zG)(this,"alphabet",t),(0,i.zG)(this,"base",t.length),(0,i.zG)(this,"_alphabetMap",{}),(0,i.zG)(this,"_leader",t.charAt(0));for(let e=0;e0;)r.push(n%this.base),n=n/this.base|0}let i="";for(let t=0;0===e[t]&&t=0;--t)i+=this.alphabet[r[t]];return i}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let r=0;r>=8;for(;i>0;)e.push(255&i),i>>=8}for(let r=0;t[r]===this._leader&&r{"use strict";r.d(e,{i:()=>n});const n="bignumber/5.7.0"},2593:(t,e,r)=>{"use strict";r.d(e,{O$:()=>p,Zm:()=>f,g$:()=>b,t2:()=>w});var n=r(3877),i=r.n(n),o=r(3286),s=r(711),a=r(8794),u=i().BN;const l=new s.Yd(a.i),h={},c=9007199254740991;function f(t){return null!=t&&(p.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||(0,o.A7)(t)||"bigint"==typeof t||(0,o._t)(t))}let d=!1;class p{constructor(t,e){t!==h&&l.throwError("cannot call constructor directly; use BigNumber.from",s.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return g(v(this).fromTwos(t))}toTwos(t){return g(v(this).toTwos(t))}abs(){return"-"===this._hex[0]?p.from(this._hex.substring(1)):this}add(t){return g(v(this).add(v(t)))}sub(t){return g(v(this).sub(v(t)))}div(t){return p.from(t).isZero()&&y("division-by-zero","div"),g(v(this).div(v(t)))}mul(t){return g(v(this).mul(v(t)))}mod(t){const e=v(t);return e.isNeg()&&y("division-by-zero","mod"),g(v(this).umod(e))}pow(t){const e=v(t);return e.isNeg()&&y("negative-power","pow"),g(v(this).pow(e))}and(t){const e=v(t);return(this.isNegative()||e.isNeg())&&y("unbound-bitwise-result","and"),g(v(this).and(e))}or(t){const e=v(t);return(this.isNegative()||e.isNeg())&&y("unbound-bitwise-result","or"),g(v(this).or(e))}xor(t){const e=v(t);return(this.isNegative()||e.isNeg())&&y("unbound-bitwise-result","xor"),g(v(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&y("negative-width","mask"),g(v(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&y("negative-width","shl"),g(v(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&y("negative-width","shr"),g(v(this).shrn(t))}eq(t){return v(this).eq(v(t))}lt(t){return v(this).lt(v(t))}lte(t){return v(this).lte(v(t))}gt(t){return v(this).gt(v(t))}gte(t){return v(this).gte(v(t))}isNegative(){return"-"===this._hex[0]}isZero(){return v(this).isZero()}toNumber(){try{return v(this).toNumber()}catch(t){y("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return l.throwError("this platform does not support BigInt",s.Yd.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?d||(d=!0,l.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?l.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",s.Yd.errors.UNEXPECTED_ARGUMENT,{}):l.throwError("BigNumber.toString does not accept parameters",s.Yd.errors.UNEXPECTED_ARGUMENT,{})),v(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof p)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new p(h,m(t)):t.match(/^-?[0-9]+$/)?new p(h,m(new u(t))):l.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&y("underflow","BigNumber.from",t),(t>=c||t<=-c)&&y("overflow","BigNumber.from",t),p.from(String(t));const e=t;if("bigint"==typeof e)return p.from(e.toString());if((0,o._t)(e))return p.from((0,o.Dv)(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return p.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&((0,o.A7)(t)||"-"===t[0]&&(0,o.A7)(t.substring(1))))return p.from(t)}return l.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function m(t){if("string"!=typeof t)return m(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&l.throwArgumentError("invalid hex","value",t),"0x00"===(t=m(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function g(t){return p.from(m(t))}function v(t){const e=p.from(t).toHexString();return"-"===e[0]?new u("-"+e.substring(3),16):new u(e.substring(2),16)}function y(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),l.throwError(t,s.Yd.errors.NUMERIC_FAULT,n)}function b(t){return new u(t,36).toString(16)}function w(t){return new u(t,16).toString(36)}},335:(t,e,r)=>{"use strict";r.d(e,{Ox:()=>m,S5:()=>p,xs:()=>v});var n=r(3286),i=r(711),o=r(8794),s=r(2593);const a=new i.Yd(o.i),u={},l=s.O$.from(0),h=s.O$.from(-1);function c(t,e,r,n){const o={fault:e,operation:r};return void 0!==n&&(o.value=n),a.throwError(t,i.Yd.errors.NUMERIC_FAULT,o)}let f="0";for(;f.length<256;)f+=f;function d(t){if("number"!=typeof t)try{t=s.O$.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+f.substring(0,t):a.throwArgumentError("invalid decimal size","decimals",t)}function p(t,e){null==e&&(e=0);const r=d(e),n=(t=s.O$.from(t)).lt(l);n&&(t=t.mul(h));let i=t.mod(r).toString();for(;i.length2&&a.throwArgumentError("too many decimal points","value",t);let o=i[0],u=i[1];for(o||(o="0"),u||(u="0");"0"===u[u.length-1];)u=u.substring(0,u.length-1);for(u.length>r.length-1&&c("fractional component exceeds decimals","underflow","parseFixed"),""===u&&(u="0");u.lengthnull==t[e]?n:(typeof t[e]!==r&&a.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&a.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&a.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new g(u,e,r,n)}}class v{constructor(t,e,r,n){t!==u&&a.throwError("cannot use FixedNumber constructor; use FixedNumber.from",i.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=e,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&a.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=m(this._value,this.format.decimals),r=m(t._value,t.format.decimals);return v.fromValue(e.add(r),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=m(this._value,this.format.decimals),r=m(t._value,t.format.decimals);return v.fromValue(e.sub(r),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=m(this._value,this.format.decimals),r=m(t._value,t.format.decimals);return v.fromValue(e.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=m(this._value,this.format.decimals),r=m(t._value,t.format.decimals);return v.fromValue(e.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=v.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(e=e.subUnsafe(y.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=v.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(e=e.addUnsafe(y.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&a.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const r=v.from("1"+f.substring(0,t),this.format),n=b.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){if(null==t)return this._hex;t%8&&a.throwArgumentError("invalid byte width","width",t);const e=s.O$.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString();return(0,n.$m)(e,t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return v.fromString(this._value,t)}static fromValue(t,e,r){return null!=r||null==e||(0,s.Zm)(e)||(r=e,e=null),null==e&&(e=0),null==r&&(r="fixed"),v.fromString(p(t,e),g.from(r))}static fromString(t,e){null==e&&(e="fixed");const r=g.from(e),i=m(t,r.decimals);!r.signed&&i.lt(l)&&c("unsigned value cannot be negative","overflow","value",t);let o=null;r.signed?o=i.toTwos(r.width).toHexString():(o=i.toHexString(),o=(0,n.$m)(o,r.width/8));const s=p(i,r.decimals);return new v(u,o,s,r)}static fromBytes(t,e){null==e&&(e="fixed");const r=g.from(e);if((0,n.lE)(t).length>r.width/8)throw new Error("overflow");let i=s.O$.from(t);r.signed&&(i=i.fromTwos(r.width));const o=i.toTwos((r.signed?0:1)+r.width).toHexString(),a=p(i,r.decimals);return new v(u,o,a,r)}static from(t,e){if("string"==typeof t)return v.fromString(t,e);if((0,n._t)(t))return v.fromBytes(t,e);try{return v.fromValue(t,0,e)}catch(t){if(t.code!==i.Yd.errors.INVALID_ARGUMENT)throw t}return a.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const y=v.from(1),b=v.from("0.5")},3877:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(8677).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},3286:(t,e,r)=>{"use strict";r.d(e,{lE:()=>l,zo:()=>h,xs:()=>y,E1:()=>g,p3:()=>v,Ou:()=>w,$P:()=>b,$m:()=>E,Dv:()=>m,_t:()=>u,Zq:()=>s,A7:()=>d,gV:()=>A,N:()=>M,G1:()=>c,Bu:()=>f});const n=new(r(711).Yd)("bytes/5.7.0");function i(t){return!!t.toHexString}function o(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function s(t){return d(t)&&!(t.length%2)||u(t)}function a(t){return"number"==typeof t&&t==t&&t%1==0}function u(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!a(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function l(t,e){if(e||(e={}),"number"==typeof t){n.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),o(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),i(t)&&(t=t.toHexString()),d(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":n.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;tl(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),o(n)}function c(t){let e=l(t);if(0===e.length)return e;let r=0;for(;re&&n.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),o(r)}function d(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const p="0123456789abcdef";function m(t,e){if(e||(e={}),"number"==typeof t){n.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=p[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),i(t))return t.toHexString();if(d(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":n.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(u(t)){let e="0x";for(let r=0;r>4]+p[15&n]}return e}return n.throwArgumentError("invalid hexlify value","value",t)}function g(t){if("string"!=typeof t)t=m(t);else if(!d(t)||t.length%2)return null;return(t.length-2)/2}function v(t,e,r){return"string"!=typeof t?t=m(t):(!d(t)||t.length%2)&&n.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function y(t){let e="0x";return t.forEach((t=>{e+=m(t).substring(2)})),e}function b(t){const e=w(m(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function w(t){"string"!=typeof t&&(t=m(t)),d(t)||n.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&n.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function M(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(s(t)){let r=l(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=m(r.slice(0,32)),e.s=m(r.slice(32,64))):65===r.length?(e.r=m(r.slice(0,32)),e.s=m(r.slice(32,64)),e.v=r[64]):n.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:n.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=m(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=f(l(e._vs),32);e._vs=m(r);const i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&n.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const o=m(r);null==e.s?e.s=o:e.s!==o&&n.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?n.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&n.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&d(e.r)?e.r=E(e.r,32):n.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&d(e.s)?e.s=E(e.s,32):n.throwArgumentError("signature missing or invalid s","signature",t);const r=l(e.s);r[0]>=128&&n.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=m(r);e._vs&&(d(e._vs)||n.throwArgumentError("signature invalid _vs","signature",t),e._vs=E(e._vs,32)),null==e._vs?e._vs=i:e._vs!==i&&n.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function A(t){return m(h([(t=M(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}},9279:(t,e,r)=>{"use strict";r.d(e,{d:()=>n});const n="0x0000000000000000000000000000000000000000"},1046:(t,e,r)=>{"use strict";r.d(e,{$B:()=>h,Bz:()=>l,Ce:()=>u,PS:()=>c,Py:()=>a,_Y:()=>o,fh:()=>s,tL:()=>i});var n=r(2593);const i=n.O$.from(-1),o=n.O$.from(0),s=n.O$.from(1),a=n.O$.from(2),u=n.O$.from("1000000000000000000"),l=n.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),h=n.O$.from("-0x8000000000000000000000000000000000000000000000000000000000000000"),c=n.O$.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")},7218:(t,e,r)=>{"use strict";r.d(e,{R:()=>n});const n="0x0000000000000000000000000000000000000000000000000000000000000000"},5644:(t,e,r)=>{"use strict";r.d(e,{i:()=>n});const n="hash/5.7.0"},2046:(t,e,r)=>{"use strict";r.d(e,{id:()=>o});var n=r(8197),i=r(4242);function o(t){return(0,n.w)((0,i.Y0)(t))}},3684:(t,e,r)=>{"use strict";r.d(e,{r:()=>a});var n=r(3286),i=r(8197),o=r(4242);const s="Ethereum Signed Message:\n";function a(t){return"string"==typeof t&&(t=(0,o.Y0)(t)),(0,i.w)((0,n.zo)([(0,o.Y0)(s),(0,o.Y0)(String(t.length)),t]))}},8339:(t,e,r)=>{"use strict";r.d(e,{Kn:()=>C,r1:()=>O,VM:()=>I});var n=r(3286),i=r(4242),o=r(8197),s=r(711),a=r(5644);function u(t,e){null==e&&(e=1);const r=[],n=r.forEach,i=function(t,e){n.call(t,(function(t){e>0&&Array.isArray(t)?i(t,e-1):r.push(t)}))};return i(t,e),r}function l(t){return 1&t?~t>>1:t>>1}function h(t,e){let r=Array(t);for(let n=0,i=-1;ne[t])):r}function d(t,e,r){let n=Array(t).fill(void 0).map((()=>[]));for(let i=0;in[e].push(t)));return n}function p(t,e){let r=1+e(),n=e(),i=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(r)}return e}(e);return u(d(i.length,1+t,e).map(((t,e)=>{const o=t[0],s=t.slice(1);return Array(i[e]).fill(void 0).map(((t,e)=>{let i=e*n;return[o+e*r,s.map((t=>t+i))]}))})))}function m(t,e){return d(1+e(),1+t,e).map((t=>[t[0],t.slice(1)]))}const g=function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,o=[0,1];for(let t=1;t>--u&1}const c=Math.pow(2,31),f=c>>>1,d=f>>1,p=c-1;let m=0;for(let t=0;t<31;t++)m=m<<1|h();let g=[],v=0,y=c;for(;;){let t=Math.floor(((m-v+1)*i-1)/y),e=0,r=n;for(;r-e>1;){let n=e+r>>>1;t>>1|h(),s=s<<1^f,a=(a^f)<<1|f|1;v=s,y=1+a-s}let b=n-4;return g.map((e=>{switch(e-b){case 3:return b+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return b+256+(t[a++]<<8|t[a++]);case 1:return b+t[a++];default:return e-1}}))}((0,r(9567).J)("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))),v=new Set(f(g)),y=new Set(f(g)),b=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(p(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(m(r,t))}return function(t){const e={};for(let r=0;rt-e));return function r(){let n=[];for(;;){let i=f(t,e);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.sort(((t,e)=>e.set.size-t.set.size));let i=t(),o=i%3;i=i/3|0;let s=!!(1&i);return i>>=1,{branches:n,valid:o,fe0f:s,save:1==i,check:2==i}}()}(g),E=45,M=95;function A(t){return(0,i.XL)(t)}function _(t){return t.filter((t=>65039!=t))}function N(t){for(let e of t.split(".")){let t=A(e);try{for(let e=t.lastIndexOf(M)-1;e>=0;e--)if(t[e]!==M)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every((t=>t<128))&&t[2]===E&&t[3]===E)throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${e}": ${t.message}`)}}return t}function S(t,e){var r;let n,i,o=w,s=[],a=t.length;for(e&&(e.length=0);a;){let u=t[--a];if(o=null===(r=o.branches.find((t=>t.set.has(u))))||void 0===r?void 0:r.node,!o)break;if(o.save)i=u;else if(o.check&&u===i)break;s.push(u),o.fe0f&&(s.push(65039),a>0&&65039==t[a-1]&&a--),o.valid&&(n=s.slice(),2==o.valid&&n.splice(1,1),e&&e.push(...t.slice(a).reverse()),t.length=a)}return n}const T=new s.Yd(a.i),k=new Uint8Array(32);function R(t){if(0===t.length)throw new Error("invalid ENS name; empty component");return t}function x(t){const e=(0,i.Y0)(function(t){return N(function(t,e){let r=A(t).reverse(),n=[];for(;r.length;){let t=S(r);if(t){n.push(...e(t));continue}let i=r.pop();if(v.has(i)){n.push(i);continue}if(y.has(i))continue;let o=b[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);n.push(...o)}return N(String.fromCodePoint(...n).normalize("NFC"))}(t,_))}(t)),r=[];if(0===t.length)return r;let n=0;for(let t=0;t=e.length)throw new Error("invalid ENS name; empty component");return r.push(R(e.slice(n))),r}function O(t){try{return 0!==x(t).length}catch(t){}return!1}function I(t){"string"!=typeof t&&T.throwArgumentError("invalid ENS name; not a string","name",t);let e=k;const r=x(t);for(;r.length;)e=(0,o.w)((0,n.zo)([e,(0,o.w)(r.pop())]));return(0,n.Dv)(e)}function C(t){return(0,n.Dv)((0,n.zo)(x(t).map((t=>{if(t.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const e=new Uint8Array(t.length+1);return e.set(t,1),e[0]=e.length-1,e}))))+"00"}k.fill(0)},7827:(t,e,r)=>{"use strict";r.d(e,{E:()=>N});var n=r(4594),i=r(2593),o=r(3286),s=r(8197),a=r(3587),u=r(711),l=r(5644),h=r(2046);const c=new u.Yd(l.i),f=new Uint8Array(32);f.fill(0);const d=i.O$.from(-1),p=i.O$.from(0),m=i.O$.from(1),g=i.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),v=(0,o.$m)(m.toHexString(),32),y=(0,o.$m)(p.toHexString(),32),b={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},w=["name","version","chainId","verifyingContract","salt"];function E(t){return function(e){return"string"!=typeof e&&c.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const M={name:E("name"),version:E("version"),chainId:function(t){try{return i.O$.from(t).toString()}catch(t){}return c.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return(0,n.Kn)(t).toLowerCase()}catch(t){}return c.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=(0,o.lE)(t);if(32!==e.length)throw new Error("bad length");return(0,o.Dv)(e)}catch(t){}return c.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function A(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],n=parseInt(e[2]||"256");(n%8!=0||n>256||e[2]&&e[2]!==String(n))&&c.throwArgumentError("invalid numeric width","type",t);const s=g.mask(r?n-1:n),a=r?s.add(m).mul(d):p;return function(e){const r=i.O$.from(e);return(r.lt(a)||r.gt(s))&&c.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),(0,o.$m)(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&c.throwArgumentError("invalid bytes width","type",t),function(e){return(0,o.lE)(e).length!==r&&c.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=(0,o.lE)(t),r=e.length%32;return r?(0,o.xs)([e,f.slice(r)]):(0,o.Dv)(e)}(e)}}}switch(t){case"address":return function(t){return(0,o.$m)((0,n.Kn)(t),32)};case"bool":return function(t){return t?v:y};case"bytes":return function(t){return(0,s.w)(t)};case"string":return function(t){return(0,h.id)(t)}}return null}function _(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class N{constructor(t){(0,a.zG)(this,"types",Object.freeze((0,a.p$)(t))),(0,a.zG)(this,"_encoderCache",{}),(0,a.zG)(this,"_types",{});const e={},r={},n={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],n[t]={}}));for(const n in t){const i={};t[n].forEach((o=>{i[o.name]&&c.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",t),i[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&c.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t),A(s)||(r[s]||c.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const i=Object.keys(r).filter((t=>0===r[t].length));0===i.length?c.throwArgumentError("missing primary type","types",t):i.length>1&&c.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),(0,a.zG)(this,"primaryType",i[0]),function i(o,s){s[o]&&c.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(i(t,s),Object.keys(s).forEach((e=>{n[e][t]=!0})))})),delete s[o]}(this.primaryType,{});for(const e in n){const r=Object.keys(n[e]);r.sort(),this._types[e]=_(e,t[e])+r.map((e=>_(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=A(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),n=parseInt(e[3]);return e=>{n>=0&&e.length!==n&&c.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(s.w)),(0,s.w)((0,o.xs)(i))}}const r=this.types[t];if(r){const e=(0,h.id)(this._types[t]);return t=>{const n=r.map((({name:e,type:r})=>{const n=this.getEncoder(r)(t[e]);return this._types[r]?(0,s.w)(n):n}));return n.unshift(e),(0,o.xs)(n)}}return c.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||c.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return(0,s.w)(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(A(t))return r(t,e);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=parseInt(n[3]);return i>=0&&e.length!==i&&c.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const i=this.types[t];return i?i.reduce(((t,{name:n,type:i})=>(t[n]=this._visit(i,e[n],r),t)),{}):c.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new N(t)}static getPrimaryType(t){return N.from(t).primaryType}static hashStruct(t,e,r){return N.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=b[r];n||c.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>w.indexOf(t.name)-w.indexOf(e.name))),N.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return(0,o.xs)(["0x1901",N.hashDomain(t),N.from(e).hash(r)])}static hash(t,e,r){return(0,s.w)(N.encode(t,e,r))}static resolveNames(t,e,r,n){return i=this,s=void 0,l=function*(){t=(0,a.DC)(t);const i={};t.verifyingContract&&!(0,o.A7)(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const s=N.from(e);s.visit(r,((t,e)=>("address"!==t||(0,o.A7)(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),r=s.visit(r,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:r}},new((u=void 0)||(u=Promise))((function(t,e){function r(t){try{o(l.next(t))}catch(t){e(t)}}function n(t){try{o(l.throw(t))}catch(t){e(t)}}function o(e){var i;e.done?t(e.value):(i=e.value,i instanceof u?i:new u((function(t){t(i)}))).then(r,n)}o((l=l.apply(i,s||[])).next())}));var i,s,u,l}static getPayload(t,e,r){N.hashDomain(t);const n={},s=[];w.forEach((e=>{const r=t[e];null!=r&&(n[e]=M[e](r),s.push({name:e,type:b[e]}))}));const u=N.from(e),l=(0,a.DC)(e);return l.EIP712Domain?c.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):l.EIP712Domain=s,u.encode(r),{types:l,domain:n,primaryType:u.primaryType,message:u.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return(0,o.Dv)((0,o.lE)(e));if(t.match(/^u?int/))return i.O$.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&c.throwArgumentError("invalid string","value",e),e}return c.throwArgumentError("unsupported type","type",t)}))}}}},6274:(t,e,r)=>{"use strict";r.d(e,{m$:()=>_,cD:()=>A,JJ:()=>T,ny:()=>R,xh:()=>k,oy:()=>S,OI:()=>N});var n=r(7727),i=r(3286),o=r(2593),s=r(4242),a=r(5306),u=r(3587),l=r(2768),h=r(3951),c=r(1261),f=r(4377),d=r(9855);const p=new(r(711).Yd)("hdnode/5.7.0"),m=o.O$.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),g=(0,s.Y0)("Bitcoin seed"),v=2147483648;function y(t){return(1<=256)throw new Error("Depth too large!");return w((0,i.zo)([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",(0,i.Dv)(this.depth),this.parentFingerprint,(0,i.$m)((0,i.Dv)(this.index),4),this.chainCode,null!=this.privateKey?(0,i.zo)(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new _(M,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(t){if(t>4294967295)throw new Error("invalid index - "+String(t));let e=this.path;e&&(e+="/"+(t&~v));const r=new Uint8Array(37);if(t&v){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set((0,i.lE)(this.privateKey),1),e&&(e+="'")}else r.set((0,i.lE)(this.publicKey));for(let e=24;e>=0;e-=8)r[33+(e>>3)]=t>>24-e&255;const n=(0,i.lE)((0,h.Gy)(c.p.sha512,this.chainCode,r)),s=n.slice(0,32),a=n.slice(32);let u=null,f=null;this.privateKey?u=b(o.O$.from(s).add(this.privateKey).mod(m)):f=new l.Et((0,i.Dv)(s))._addPoint(this.publicKey);let d=e;const p=this.mnemonic;return p&&(d=Object.freeze({phrase:p.phrase,path:e,locale:p.locale||"en"})),new _(M,u,f,this.fingerprint,b(a),t,this.depth+1,d)}derivePath(t){const e=t.split("/");if(0===e.length||"m"===e[0]&&0!==this.depth)throw new Error("invalid path - "+t);"m"===e[0]&&e.shift();let r=this;for(let t=0;t=v)throw new Error("invalid path index - "+n);r=r._derive(v+t)}else{if(!n.match(/^[0-9]+$/))throw new Error("invalid path component - "+n);{const t=parseInt(n);if(t>=v)throw new Error("invalid path index - "+n);r=r._derive(t)}}}return r}static _fromSeed(t,e){const r=(0,i.lE)(t);if(r.length<16||r.length>64)throw new Error("invalid seed");const n=(0,i.lE)((0,h.Gy)(c.p.sha512,g,r));return new _(M,b(n.slice(0,32)),null,"0x00000000",b(n.slice(32)),0,0,e)}static fromMnemonic(t,e,r){return t=T(S(t,r=E(r)),r),_._fromSeed(N(t,e),{phrase:t,path:"m",locale:r.locale})}static fromSeed(t){return _._fromSeed(t,null)}static fromExtendedKey(t){const e=n.eU.decode(t);82===e.length&&w(e.slice(0,78))===t||p.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const r=e[4],o=(0,i.Dv)(e.slice(5,9)),s=parseInt((0,i.Dv)(e.slice(9,13)).substring(2),16),a=(0,i.Dv)(e.slice(13,45)),u=e.slice(45,78);switch((0,i.Dv)(e.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new _(M,null,(0,i.Dv)(u),o,a,s,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==u[0])break;return new _(M,(0,i.Dv)(u.slice(1)),null,o,a,s,r,null)}return p.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function N(t,e){e||(e="");const r=(0,s.Y0)("mnemonic"+e,s.Uj.NFKD);return(0,a.n)((0,s.Y0)(t,s.Uj.NFKD),r,2048,64,"sha512")}function S(t,e){e=E(e),p.checkNormalize();const r=e.split(t);if(r.length%3!=0)throw new Error("invalid mnemonic");const n=(0,i.lE)(new Uint8Array(Math.ceil(11*r.length/8)));let o=0;for(let t=0;t>3]|=1<<7-o%8),o++}const s=32*r.length/3,a=y(r.length/3);if(((0,i.lE)((0,h.JQ)(n.slice(0,s/8)))[0]&a)!=(n[n.length-1]&a))throw new Error("invalid checksum");return(0,i.Dv)(n.slice(0,s/8))}function T(t,e){if(e=E(e),(t=(0,i.lE)(t)).length%4!=0||t.length<16||t.length>32)throw new Error("invalid entropy");const r=[0];let n=11;for(let e=0;e8?(r[r.length-1]<<=8,r[r.length-1]|=t[e],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=t[e]>>8-n,r.push(t[e]&(1<<8-n)-1),n+=3);const o=t.length/4,s=(0,i.lE)((0,h.JQ)(t))[0]&y(o);return r[r.length-1]<<=o,r[r.length-1]|=s>>8-o,e.join(r.map((t=>e.getWord(t))))}function k(t,e){try{return S(t,e),!0}catch(t){}return!1}function R(t){return("number"!=typeof t||t<0||t>=v||t%1)&&p.throwArgumentError("invalid account index","index",t),`m/44'/60'/${t}'/0/0`}},9816:(t,e,r)=>{"use strict";r.d(e,{i:()=>n});const n="json-wallets/5.7.0"},9380:(t,e,r)=>{"use strict";r.d(e,{w:()=>b,qz:()=>w});var n=r(8826),i=r.n(n),o=r(4594),s=r(3286),a=r(8197),u=r(5306),l=r(4242),h=r(3587),c=r(711),f=r(9816),d=r(7013);const p=new c.Yd(f.i);class m extends h.dk{isCrowdsaleAccount(t){return!(!t||!t._isCrowdsaleAccount)}}function g(t,e){const r=JSON.parse(t);e=(0,d.Ij)(e);const n=(0,o.Kn)((0,d.gx)(r,"ethaddr")),h=(0,d.p3)((0,d.gx)(r,"encseed"));h&&h.length%16==0||p.throwArgumentError("invalid encseed","json",t);const c=(0,s.lE)((0,u.n)(e,e,2e3,32,"sha256")).slice(0,16),f=h.slice(0,16),g=h.slice(16),v=new(i().ModeOfOperation.cbc)(c,f),y=i().padding.pkcs7.strip((0,s.lE)(v.decrypt(g)));let b="";for(let t=0;t{"use strict";r.d(e,{LW:()=>i,Rb:()=>s,aO:()=>o});var n=r(4594);function i(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return e.encseed&&e.ethaddr}function o(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return!(!e.version||parseInt(e.version)!==e.version||3!==parseInt(e.version))}function s(t){if(i(t))try{return(0,n.Kn)(JSON.parse(t).ethaddr)}catch(t){return null}if(o(t))try{return(0,n.Kn)(JSON.parse(t).address)}catch(t){return null}return null}},1964:(t,e,r)=>{"use strict";r.d(e,{HI:()=>k,hb:()=>S,pe:()=>T});var n=r(8826),i=r.n(n),o=r(7635),s=r.n(o),a=r(4594),u=r(3286),l=r(6274),h=r(8197),c=r(5306),f=r(4478),d=r(3587),p=r(4377),m=r(7013),g=r(711),v=r(9816),y=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const b=new g.Yd(v.i);function w(t){return null!=t&&t.mnemonic&&t.mnemonic.phrase}class E extends d.dk{isKeystoreAccount(t){return!(!t||!t._isKeystoreAccount)}}function M(t,e){const r=(0,m.p3)((0,m.gx)(t,"crypto/ciphertext"));if((0,u.Dv)((0,h.w)((0,u.zo)([e.slice(16,32),r]))).substring(2)!==(0,m.gx)(t,"crypto/mac").toLowerCase())throw new Error("invalid password");const n=function(t,e,r){if("aes-128-ctr"===(0,m.gx)(t,"crypto/cipher")){const n=(0,m.p3)((0,m.gx)(t,"crypto/cipherparams/iv")),o=new(i().Counter)(n),s=new(i().ModeOfOperation.ctr)(e,o);return(0,u.lE)(s.decrypt(r))}return null}(t,e.slice(0,16),r);n||b.throwError("unsupported cipher",g.Yd.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const o=e.slice(32,64),s=(0,p.db)(n);if(t.address){let e=t.address.toLowerCase();if("0x"!==e.substring(0,2)&&(e="0x"+e),(0,a.Kn)(e)!==s)throw new Error("address mismatch")}const c={_isKeystoreAccount:!0,address:s,privateKey:(0,u.Dv)(n)};if("0.1"===(0,m.gx)(t,"x-ethers/version")){const e=(0,m.p3)((0,m.gx)(t,"x-ethers/mnemonicCiphertext")),r=(0,m.p3)((0,m.gx)(t,"x-ethers/mnemonicCounter")),n=new(i().Counter)(r),s=new(i().ModeOfOperation.ctr)(o,n),a=(0,m.gx)(t,"x-ethers/path")||l.cD,h=(0,m.gx)(t,"x-ethers/locale")||"en",f=(0,u.lE)(s.decrypt(e));try{const t=(0,l.JJ)(f,h),e=l.m$.fromMnemonic(t,null,h).derivePath(a);if(e.privateKey!=c.privateKey)throw new Error("mnemonic mismatch");c.mnemonic=e.mnemonic}catch(t){if(t.code!==g.Yd.errors.INVALID_ARGUMENT||"wordlist"!==t.argument)throw t}}return new E(c)}function A(t,e,r,n,i){return(0,u.lE)((0,c.n)(t,e,r,n,i))}function _(t,e,r,n,i){return Promise.resolve(A(t,e,r,n,i))}function N(t,e,r,n,i){const o=(0,m.Ij)(e),s=(0,m.gx)(t,"crypto/kdf");if(s&&"string"==typeof s){const e=function(t,e){return b.throwArgumentError("invalid key-derivation function parameters",t,e)};if("scrypt"===s.toLowerCase()){const r=(0,m.p3)((0,m.gx)(t,"crypto/kdfparams/salt")),a=parseInt((0,m.gx)(t,"crypto/kdfparams/n")),u=parseInt((0,m.gx)(t,"crypto/kdfparams/r")),l=parseInt((0,m.gx)(t,"crypto/kdfparams/p"));a&&u&&l||e("kdf",s),0!=(a&a-1)&&e("N",a);const h=parseInt((0,m.gx)(t,"crypto/kdfparams/dklen"));return 32!==h&&e("dklen",h),n(o,r,a,u,l,64,i)}if("pbkdf2"===s.toLowerCase()){const n=(0,m.p3)((0,m.gx)(t,"crypto/kdfparams/salt"));let i=null;const s=(0,m.gx)(t,"crypto/kdfparams/prf");"hmac-sha256"===s?i="sha256":"hmac-sha512"===s?i="sha512":e("prf",s);const a=parseInt((0,m.gx)(t,"crypto/kdfparams/c")),u=parseInt((0,m.gx)(t,"crypto/kdfparams/dklen"));return 32!==u&&e("dklen",u),r(o,n,a,u,i)}}return b.throwArgumentError("unsupported key-derivation function","kdf",s)}function S(t,e){const r=JSON.parse(t);return M(r,N(r,e,A,s().syncScrypt))}function T(t,e,r){return y(this,void 0,void 0,(function*(){const n=JSON.parse(t);return M(n,yield N(n,e,_,s().scrypt,r))}))}function k(t,e,r,n){try{if((0,a.Kn)(t.address)!==(0,p.db)(t.privateKey))throw new Error("address/privateKey mismatch");if(w(t)){const e=t.mnemonic;if(l.m$.fromMnemonic(e.phrase,null,e.locale).derivePath(e.path||l.cD).privateKey!=t.privateKey)throw new Error("mnemonic mismatch")}}catch(t){return Promise.reject(t)}"function"!=typeof r||n||(n=r,r={}),r||(r={});const o=(0,u.lE)(t.privateKey),c=(0,m.Ij)(e);let d=null,g=null,v=null;if(w(t)){const e=t.mnemonic;d=(0,u.lE)((0,l.oy)(e.phrase,e.locale||"en")),g=e.path||l.cD,v=e.locale||"en"}let y=r.client;y||(y="ethers.js");let b=null;b=r.salt?(0,u.lE)(r.salt):(0,f.O)(32);let E=null;if(r.iv){if(E=(0,u.lE)(r.iv),16!==E.length)throw new Error("invalid iv")}else E=(0,f.O)(16);let M=null;if(r.uuid){if(M=(0,u.lE)(r.uuid),16!==M.length)throw new Error("invalid uuid")}else M=(0,f.O)(16);let A=1<<17,_=8,N=1;return r.scrypt&&(r.scrypt.N&&(A=r.scrypt.N),r.scrypt.r&&(_=r.scrypt.r),r.scrypt.p&&(N=r.scrypt.p)),s().scrypt(c,b,A,_,N,64,n).then((e=>{const r=(e=(0,u.lE)(e)).slice(0,16),n=e.slice(16,32),s=e.slice(32,64),a=new(i().Counter)(E),l=new(i().ModeOfOperation.ctr)(r,a),c=(0,u.lE)(l.encrypt(o)),p=(0,h.w)((0,u.zo)([n,c])),w={address:t.address.substring(2).toLowerCase(),id:(0,m.EH)(M),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:(0,u.Dv)(E).substring(2)},ciphertext:(0,u.Dv)(c).substring(2),kdf:"scrypt",kdfparams:{salt:(0,u.Dv)(b).substring(2),n:A,dklen:32,p:N,r:_},mac:p.substring(2)}};if(d){const t=(0,f.O)(16),e=new(i().Counter)(t),r=new(i().ModeOfOperation.ctr)(s,e),n=(0,u.lE)(r.encrypt(d)),o=new Date,a=o.getUTCFullYear()+"-"+(0,m.VP)(o.getUTCMonth()+1,2)+"-"+(0,m.VP)(o.getUTCDate(),2)+"T"+(0,m.VP)(o.getUTCHours(),2)+"-"+(0,m.VP)(o.getUTCMinutes(),2)+"-"+(0,m.VP)(o.getUTCSeconds(),2)+".0Z";w["x-ethers"]={client:y,gethFilename:"UTC--"+a+"--"+w.address,mnemonicCounter:(0,u.Dv)(t).substring(2),mnemonicCiphertext:(0,u.Dv)(n).substring(2),path:g,locale:v,version:"0.1"}}return JSON.stringify(w)}))}},7013:(t,e,r)=>{"use strict";r.d(e,{EH:()=>l,Ij:()=>a,VP:()=>s,gx:()=>u,p3:()=>o});var n=r(3286),i=r(4242);function o(t){return"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),(0,n.lE)(t)}function s(t,e){for(t=String(t);t.length{"use strict";r.d(e,{w:()=>s});var n=r(1094),i=r.n(n),o=r(3286);function s(t){return"0x"+i().keccak_256((0,o.lE)(t))}},711:(t,e,r)=>{"use strict";r.d(e,{jK:()=>h,Yd:()=>f});let n=!1,i=!1;const o={debug:1,default:2,info:2,warning:3,error:4,off:5};let s=o.default,a=null;const u=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var l,h;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(l||(l={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(h||(h={}));const c="0123456789abcdef";class f{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==o[r]&&this.throwArgumentError("invalid log level name","logLevel",t),s>o[r]||console.log.apply(console,e)}debug(...t){this._log(f.levels.DEBUG,t)}info(...t){this._log(f.levels.INFO,t)}warn(...t){this._log(f.levels.WARNING,t)}makeError(t,e,r){if(i)return this.makeError("censored error",e,{});e||(e=f.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=c[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const o=t;let s="";switch(e){case h.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case h.CALL_EXCEPTION:case h.INSUFFICIENT_FUNDS:case h.MISSING_NEW:case h.NONCE_EXPIRED:case h.REPLACEMENT_UNDERPRICED:case h.TRANSACTION_REPLACED:case h.UNPREDICTABLE_GAS_LIMIT:s=e}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const a=new Error(t);return a.reason=o,a.code=e,Object.keys(r).forEach((function(t){a[t]=r[t]})),a}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,f.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),u&&this.throwError("platform missing String.prototype.normalize",f.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:u})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,f.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,f.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,f.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",f.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",f.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",f.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return a||(a=new f("logger/5.7.0")),a}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",f.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),n){if(!t)return;this.globalLogger().throwError("error censorship permanent",f.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!t,n=!!e}static setLogLevel(t){const e=o[t.toLowerCase()];null!=e?s=e:f.globalLogger().warn("invalid log level - "+t)}static from(t){return new f(t)}}f.errors=h,f.levels=l},9861:(t,e,r)=>{"use strict";r.d(e,{H:()=>h});const n=new(r(711).Yd)("networks/5.7.1");function i(t){const e=function(e,r){null==r&&(r={});const n=[];if(e.InfuraProvider&&"-"!==r.infura)try{n.push(new e.InfuraProvider(t,r.infura))}catch(t){}if(e.EtherscanProvider&&"-"!==r.etherscan)try{n.push(new e.EtherscanProvider(t,r.etherscan))}catch(t){}if(e.AlchemyProvider&&"-"!==r.alchemy)try{n.push(new e.AlchemyProvider(t,r.alchemy))}catch(t){}if(e.PocketProvider&&"-"!==r.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const o=new e.PocketProvider(t,r.pocket);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(t){}}if(e.CloudflareProvider&&"-"!==r.cloudflare)try{n.push(new e.CloudflareProvider(t))}catch(t){}if(e.AnkrProvider&&"-"!==r.ankr)try{const i=["ropsten"],o=new e.AnkrProvider(t,r.ankr);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(t){}if(0===n.length)return null;if(e.FallbackProvider){let i=1;return null!=r.quorum?i=r.quorum:"homestead"===t&&(i=2),new e.FallbackProvider(n,i)}return n[0]};return e.renetwork=function(t){return i(t)},e}function o(t,e){const r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(t,e):null};return r.renetwork=function(e){return o(t,e)},r}const s={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:i("homestead")},a={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:i("ropsten")},u={chainId:63,name:"classicMordor",_defaultProvider:o("https://www.ethercluster.com/mordor","classicMordor")},l={unspecified:{chainId:0,name:"unspecified"},homestead:s,mainnet:s,morden:{chainId:2,name:"morden"},ropsten:a,testnet:a,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:i("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:i("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:i("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:i("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:o("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:u,classicTestnet:u,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:o("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:i("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:i("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function h(t){if(null==t)return null;if("number"==typeof t){for(const e in l){const r=l[e];if(r.chainId===t)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"==typeof t){const e=l[t];return null==e?null:{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress,_defaultProvider:e._defaultProvider||null}}const e=l[t.name];if(!e)return"number"!=typeof t.chainId&&n.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==e.chainId&&n.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;var i;return null==r&&e._defaultProvider&&(r=(i=e._defaultProvider)&&"function"==typeof i.renetwork?e._defaultProvider.renetwork(t):e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}},5306:(t,e,r)=>{"use strict";r.d(e,{n:()=>o});var n=r(3286),i=r(3951);function o(t,e,r,o,s){let a;t=(0,n.lE)(t),e=(0,n.lE)(e);let u=1;const l=new Uint8Array(o),h=new Uint8Array(e.length+4);let c,f;h.set(e);for(let d=1;d<=u;d++){h[e.length]=d>>24&255,h[e.length+1]=d>>16&255,h[e.length+2]=d>>8&255,h[e.length+3]=255&d;let p=(0,n.lE)((0,i.Gy)(s,t,h));a||(a=p.length,f=new Uint8Array(a),u=Math.ceil(o/a),c=o-(u-1)*a),f.set(p);for(let e=1;e{"use strict";r.d(e,{dk:()=>m,uj:()=>l,p$:()=>p,zG:()=>s,tu:()=>a,mE:()=>u,DC:()=>h});var n=r(711),i=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const o=new n.Yd("properties/5.7.0");function s(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function a(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function u(t){return i(this,void 0,void 0,(function*(){const e=Object.keys(t).map((e=>{const r=t[e];return Promise.resolve(r).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}))}function l(t,e){t&&"object"==typeof t||o.throwArgumentError("invalid object","object",t),Object.keys(t).forEach((r=>{e[r]||o.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)}))}function h(t){const e={};for(const r in t)e[r]=t[r];return e}const c={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function f(t){if(null==t||c[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rp(t))));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&s(e,r,p(n))}return e}return o.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function p(t){return d(t)}class m{constructor(t){for(const e in t)this[e]=p(t[e])}}},4478:(t,e,r)=>{"use strict";r.d(e,{O:()=>u});var n=r(3286),i=r(711);const o=new i.Yd("random/5.7.0"),s=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("unable to locate global object")}();let a=s.crypto||s.msCrypto;function u(t){(t<=0||t>1024||t%1||t!=t)&&o.throwArgumentError("invalid length","length",t);const e=new Uint8Array(t);return a.getRandomValues(e),(0,n.lE)(e)}a&&a.getRandomValues||(o.warn("WARNING: Missing strong random number source"),a={getRandomValues:function(t){return o.throwError("no secure random source avaialble",i.Yd.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}})},2472:(t,e,r)=>{"use strict";function n(t){for(let e=(t=t.slice()).length-1;e>0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}r.d(e,{y:()=>n})},1843:(t,e,r)=>{"use strict";r.r(e),r.d(e,{decode:()=>f,encode:()=>l});var n=r(3286),i=r(711);const o=new i.Yd("rlp/5.7.0");function s(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function a(t,e,r){let n=0;for(let i=0;ie+1+n&&o.throwError("child data too short",i.Yd.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:s}}function c(t,e){if(0===t.length&&o.throwError("data too short",i.Yd.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&o.throwError("data short segment too short",i.Yd.errors.BUFFER_OVERRUN,{});const n=a(t,e+1,r);return e+1+r+n>t.length&&o.throwError("data long segment too short",i.Yd.errors.BUFFER_OVERRUN,{}),h(t,e,e+1+r,r+n)}if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&o.throwError("data array too short",i.Yd.errors.BUFFER_OVERRUN,{}),h(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&o.throwError("data array too short",i.Yd.errors.BUFFER_OVERRUN,{});const s=a(t,e+1,r);return e+1+r+s>t.length&&o.throwError("data array too short",i.Yd.errors.BUFFER_OVERRUN,{}),{consumed:1+r+s,result:(0,n.Dv)(t.slice(e+1+r,e+1+r+s))}}if(t[e]>=128){const r=t[e]-128;return e+1+r>t.length&&o.throwError("data too short",i.Yd.errors.BUFFER_OVERRUN,{}),{consumed:1+r,result:(0,n.Dv)(t.slice(e+1,e+1+r))}}return{consumed:1,result:(0,n.Dv)(t[e])}}function f(t){const e=(0,n.lE)(t),r=c(e,0);return r.consumed!==e.length&&o.throwArgumentError("invalid rlp data","data",t),r.result}},3951:(t,e,r)=>{"use strict";r.d(e,{Gy:()=>f,bP:()=>l,JQ:()=>h,o:()=>c});var n=r(3715),i=r.n(n),o=r(3286),s=r(1261),a=r(711);const u=new a.Yd("sha2/5.7.0");function l(t){return"0x"+i().ripemd160().update((0,o.lE)(t)).digest("hex")}function h(t){return"0x"+i().sha256().update((0,o.lE)(t)).digest("hex")}function c(t){return"0x"+i().sha512().update((0,o.lE)(t)).digest("hex")}function f(t,e,r){return s.p[t]||u.throwError("unsupported algorithm "+t,a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),"0x"+i().hmac(i()[t],(0,o.lE)(e)).update((0,o.lE)(r)).digest("hex")}},1261:(t,e,r)=>{"use strict";var n;r.d(e,{p:()=>n}),function(t){t.sha256="sha256",t.sha512="sha512"}(n||(n={}))},2768:(t,e,r)=>{"use strict";r.d(e,{Et:()=>W,VW:()=>J,LO:()=>Y});var n=r(2500),i=r.n(n),o=r(3715),s=r.n(o);function a(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},t(r,r.exports),r.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self&&self;var u=l;function l(t,e){if(!t)throw new Error(e||"Assertion failed")}l.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var h=a((function(t,e){var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}})),c=a((function(t,e){var r=e;r.assert=u,r.toArray=h.toArray,r.zero2=h.zero2,r.toHex=h.toHex,r.encode=h.encode,r.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,l=e.andln(3)+o&3;3===u&&(u=-1),3===l&&(l=-1),s=0==(1&u)?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==l?u:-u,r[0].push(s),a=0==(1&l)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==u?l:-l,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new(i())(t,"hex","le")}})),f=c.getNAF,d=c.getJSF,p=c.assert;function m(t,e){this.type=t,this.p=new(i())(e.p,16),this.red=e.prime?i().red(e.prime):i().mont(this.p),this.zero=new(i())(0).toRed(this.red),this.one=new(i())(1).toRed(this.red),this.two=new(i())(2).toRed(this.red),this.n=e.n&&new(i())(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var g=m;function v(t,e){this.curve=t,this.type=e,this.precomputed=null}m.prototype.point=function(){throw new Error("Not implemented")},m.prototype.validate=function(){throw new Error("Not implemented")},m.prototype._fixedNafMul=function(t,e){p(t.precomputed);var r=t._getDoubles(),n=f(e,1,this._bitLength),i=(1<=o;u--)s=(s<<1)+n[u];a.push(s)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),c=i;c>0;c--){for(o=0;o=0;a--){for(var u=0;a>=0&&0===o[a];a--)u++;if(a>=0&&u++,s=s.dblp(u),a<0)break;var l=o[a];p(0!==l),s="affine"===t.type?l>0?s.mixedAdd(i[l-1>>1]):s.mixedAdd(i[-l-1>>1].neg()):l>0?s.add(i[l-1>>1]):s.add(i[-l-1>>1].neg())}return"affine"===t.type?s.toP():s},m.prototype._wnafMulAdd=function(t,e,r,n,i){var o,s,a,u=this._wnafT1,l=this._wnafT2,h=this._wnafT3,c=0;for(o=0;o=1;o-=2){var m=o-1,g=o;if(1===u[m]&&1===u[g]){var v=[e[m],null,null,e[g]];0===e[m].y.cmp(e[g].y)?(v[1]=e[m].add(e[g]),v[2]=e[m].toJ().mixedAdd(e[g].neg())):0===e[m].y.cmp(e[g].y.redNeg())?(v[1]=e[m].toJ().mixedAdd(e[g]),v[2]=e[m].add(e[g].neg())):(v[1]=e[m].toJ().mixedAdd(e[g]),v[2]=e[m].toJ().mixedAdd(e[g].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],b=d(r[m],r[g]);for(c=Math.max(b[0].length,c),h[m]=new Array(c),h[g]=new Array(c),s=0;s=0;o--){for(var _=0;o>=0;){var N=!0;for(s=0;s=0&&_++,M=M.dblp(_),o<0)break;for(s=0;s0?a=l[s][S-1>>1]:S<0&&(a=l[s][-S-1>>1].neg()),M="affine"===a.type?M.mixedAdd(a):M.add(a))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},v.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(s=e,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},w.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),l=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(l).neg()}},w.prototype.pointFromX=function(t,e){(t=new(i())(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(n=n.redNeg()),this.point(t,n)},w.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},w.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},M.prototype.isInfinity=function(){return this.inf},M.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},M.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},M.prototype.getX=function(){return this.x.fromRed()},M.prototype.getY=function(){return this.y.fromRed()},M.prototype.mul=function(t){return t=new(i())(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},M.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},M.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},M.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},M.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},M.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},y(A,g.BasePoint),w.prototype.jpoint=function(t,e,r){return new A(this,t,e,r)},A.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},A.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},A.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),h=l.redMul(a),c=n.redMul(l),f=u.redSqr().redIAdd(h).redISub(c).redISub(c),d=u.redMul(c.redISub(f)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(f,d,p)},A.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),h=r.redMul(u),c=a.redSqr().redIAdd(l).redISub(h).redISub(h),f=a.redMul(h.redISub(c)).redISub(i.redMul(l)),d=this.z.redMul(s);return this.curve.jpoint(c,f,d)},A.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},A.prototype.inspect=function(){return this.isInfinity()?"":""},A.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var _=a((function(t,e){var r=e;r.base=g,r.short=E,r.mont=null,r.edwards=null})),N=a((function(t,e){var r,n=e,i=c.assert;function o(t){"short"===t.type?this.curve=new _.short(t):"edwards"===t.type?this.curve=new _.edwards(t):this.curve=new _.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:s().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:s().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:s().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:s().sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:s().sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s().sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){r=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:s().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function S(t){if(!(this instanceof S))return new S(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=h.toArray(t.entropy,t.entropyEnc||"hex"),r=h.toArray(t.nonce,t.nonceEnc||"hex"),n=h.toArray(t.pers,t.persEnc||"hex");u(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var T=S;S.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},S.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=h.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var O=c.assert;function I(t,e){if(t instanceof I)return t;this._importDER(t,e)||(O(t.r&&t.s,"Signature without r or s"),this.r=new(i())(t.r,16),this.s=new(i())(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var C=I;function P(){this.place=0}function L(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return!(i<=127)&&(e.place=s,i)}function U(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}I.prototype._importDER=function(t,e){t=c.toArray(t,e);var r=new P;if(48!==t[r.place++])return!1;var n=L(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var o=L(t,r);if(!1===o)return!1;var s=t.slice(r.place,o+r.place);if(r.place+=o,2!==t[r.place++])return!1;var a=L(t,r);if(!1===a)return!1;if(t.length!==a+r.place)return!1;var u=t.slice(r.place,a+r.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}return this.r=new(i())(s),this.s=new(i())(u),this.recoveryParam=null,!0},I.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=U(e),r=U(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];B(n,e.length),(n=n.concat(e)).push(2),B(n,r.length);var i=n.concat(r),o=[48];return B(o,i.length),o=o.concat(i),c.encode(o,t)};var D=function(){throw new Error("unsupported")},F=c.assert;function G(t){if(!(this instanceof G))return new G(t);"string"==typeof t&&(F(Object.prototype.hasOwnProperty.call(N,t),"Unknown curve "+t),t=N[t]),t instanceof N.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var j=G;G.prototype.keyPair=function(t){return new x(this,t)},G.prototype.keyFromPrivate=function(t,e){return x.fromPrivate(this,t,e)},G.prototype.keyFromPublic=function(t,e){return x.fromPublic(this,t,e)},G.prototype.genKeyPair=function(t){t||(t={});for(var e=new T({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||D(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new(i())(2));;){var o=new(i())(e.generate(r));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}},G.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},G.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new(i())(t,16));for(var o=this.n.byteLength(),s=e.getPrivate().toArray("be",o),a=t.toArray("be",o),u=new T({hash:this.hash,entropy:s,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),l=this.n.sub(new(i())(1)),h=0;;h++){var c=n.k?n.k(h):new(i())(u.generate(this.n.byteLength()));if(!((c=this._truncateToN(c,!0)).cmpn(1)<=0||c.cmp(l)>=0)){var f=this.g.mul(c);if(!f.isInfinity()){var d=f.getX(),p=d.umod(this.n);if(0!==p.cmpn(0)){var m=c.invm(this.n).mul(p.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var g=(f.getY().isOdd()?1:0)|(0!==d.cmp(p)?2:0);return n.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new C({r:p,s:m,recoveryParam:g})}}}}}},G.prototype.verify=function(t,e,r,n){t=this._truncateToN(new(i())(t,16)),r=this.keyFromPublic(r,n);var o=(e=new C(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,u=s.invm(this.n),l=u.mul(t).umod(this.n),h=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(l,r.getPublic(),h)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(l,r.getPublic(),h)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},G.prototype.recoverPubKey=function(t,e,r,n){F((3&r)===r,"The recovery param is more than two bits"),e=new C(e,n);var o=this.n,s=new(i())(t),a=e.r,u=e.s,l=1&r,h=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");a=h?this.curve.pointFromX(a.add(this.curve.n),l):this.curve.pointFromX(a,l);var c=e.r.invm(o),f=o.sub(s).mul(c).umod(o),d=u.mul(c).umod(o);return this.g.mulAdd(f,a,d)},G.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new C(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var q=a((function(t,e){var r=e;r.version="6.5.4",r.utils=c,r.rand=function(){throw new Error("unsupported")},r.curve=_,r.curves=N,r.ec=j,r.eddsa=null})).ec,z=r(3286),K=r(3587);const H=new(r(711).Yd)("signing-key/5.7.0");let $=null;function V(){return $||($=new q("secp256k1")),$}class W{constructor(t){(0,K.zG)(this,"curve","secp256k1"),(0,K.zG)(this,"privateKey",(0,z.Dv)(t)),32!==(0,z.E1)(this.privateKey)&&H.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=V().keyFromPrivate((0,z.lE)(this.privateKey));(0,K.zG)(this,"publicKey","0x"+e.getPublic(!1,"hex")),(0,K.zG)(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),(0,K.zG)(this,"_isSigningKey",!0)}_addPoint(t){const e=V().keyFromPublic((0,z.lE)(this.publicKey)),r=V().keyFromPublic((0,z.lE)(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=V().keyFromPrivate((0,z.lE)(this.privateKey)),r=(0,z.lE)(t);32!==r.length&&H.throwArgumentError("bad digest length","digest",t);const n=e.sign(r,{canonical:!0});return(0,z.N)({recoveryParam:n.recoveryParam,r:(0,z.$m)("0x"+n.r.toString(16),32),s:(0,z.$m)("0x"+n.s.toString(16),32)})}computeSharedSecret(t){const e=V().keyFromPrivate((0,z.lE)(this.privateKey)),r=V().keyFromPublic((0,z.lE)(J(t)));return(0,z.$m)("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function Y(t,e){const r=(0,z.N)(e),n={r:(0,z.lE)(r.r),s:(0,z.lE)(r.s)};return"0x"+V().recoverPubKey((0,z.lE)(t),n,r.recoveryParam).encode("hex",!1)}function J(t,e){const r=(0,z.lE)(t);if(32===r.length){const t=new W(r);return e?"0x"+V().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?(0,z.Dv)(r):"0x"+V().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+V().keyFromPublic(r).getPublic(!0,"hex"):(0,z.Dv)(r):H.throwArgumentError("invalid public or private key","key","[REDACTED]")}},2500:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(2808).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},4242:(t,e,r)=>{"use strict";r.d(e,{Uj:()=>o,te:()=>u,Uw:()=>s,U$:()=>f,uu:()=>d,Y0:()=>h,XL:()=>m,ZN:()=>p});var n=r(3286);const i=new(r(711).Yd)("strings/5.7.0");var o,s;function a(t,e,r,n,i){if(t===s.BAD_PREFIX||t===s.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n>6==2;n++)t++;return t}return t===s.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(o||(o={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(s||(s={}));const u=Object.freeze({error:function(t,e,r,n,o){return i.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:a,replace:function(t,e,r,n,i){return t===s.OVERLONG?(n.push(i),0):(n.push(65533),a(t,e,r))}});function l(t,e){null==e&&(e=u.error),t=(0,n.lE)(t);const r=[];let i=0;for(;i>7==0){r.push(n);continue}let o=null,a=null;if(192==(224&n))o=1,a=127;else if(224==(240&n))o=2,a=2047;else{if(240!=(248&n)){i+=e(128==(192&n)?s.UNEXPECTED_CONTINUE:s.BAD_PREFIX,i-1,t,r);continue}o=3,a=65535}if(i-1+o>=t.length){i+=e(s.OVERRUN,i-1,t,r);continue}let u=n&(1<<8-o-1)-1;for(let n=0;n1114111?i+=e(s.OUT_OF_RANGE,i-1-o,t,r,u):u>=55296&&u<=57343?i+=e(s.UTF16_SURROGATE,i-1-o,t,r,u):u<=a?i+=e(s.OVERLONG,i-1-o,t,r,u):r.push(u))}return r}function h(t,e=o.current){e!=o.current&&(i.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return(0,n.lE)(r)}function c(t){const e="0000"+t.toString(16);return"\\u"+e.substring(e.length-4)}function f(t,e){return'"'+l(t,e).map((t=>{if(t<256){switch(t){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(t>=32&&t<127)return String.fromCharCode(t)}return t<=65535?c(t):c(55296+((t-=65536)>>10&1023))+c(56320+(1023&t))})).join("")+'"'}function d(t){return t.map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function p(t,e){return d(l(t,e))}function m(t,e=o.current){return l(h(t,e))}},4377:(t,e,r)=>{"use strict";r.d(e,{em:()=>d,z7:()=>M,db:()=>y,Qc:()=>k,RJ:()=>b,qC:()=>S});var n=r(4594),i=r(2593),o=r(3286),s=r(1046),a=r(8197),u=r(3587),l=r(1843),h=r(2768),c=r(711);const f=new c.Yd("transactions/5.7.0");var d;function p(t){return"0x"===t?null:(0,n.Kn)(t)}function m(t){return"0x"===t?s._Y:i.O$.from(t)}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(d||(d={}));const g=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],v={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function y(t){const e=(0,h.VW)(t);return(0,n.Kn)((0,o.p3)((0,a.w)((0,o.p3)(e,1)),12))}function b(t,e){return y((0,h.LO)((0,o.lE)(t),e))}function w(t,e){const r=(0,o.G1)(i.O$.from(t).toHexString());return r.length>32&&f.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function E(t,e){return{address:(0,n.Kn)(t),storageKeys:(e||[]).map(((e,r)=>(32!==(0,o.E1)(e)&&f.throwArgumentError("invalid access list storageKey",`accessList[${t}:${r}]`,e),e.toLowerCase())))}}function M(t){if(Array.isArray(t))return t.map(((t,e)=>Array.isArray(t)?(t.length>2&&f.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),E(t[0],t[1])):E(t.address,t.storageKeys)));const e=Object.keys(t).map((e=>{const r=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return E(e,Object.keys(r).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function A(t){return M(t).map((t=>[t.address,t.storageKeys]))}function _(t,e){if(null!=t.gasPrice){const e=i.O$.from(t.gasPrice),r=i.O$.from(t.maxFeePerGas||0);e.eq(r)||f.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:r})}const r=[w(t.chainId||0,"chainId"),w(t.nonce||0,"nonce"),w(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),w(t.maxFeePerGas||0,"maxFeePerGas"),w(t.gasLimit||0,"gasLimit"),null!=t.to?(0,n.Kn)(t.to):"0x",w(t.value||0,"value"),t.data||"0x",A(t.accessList||[])];if(e){const t=(0,o.N)(e);r.push(w(t.recoveryParam,"recoveryParam")),r.push((0,o.G1)(t.r)),r.push((0,o.G1)(t.s))}return(0,o.xs)(["0x02",l.encode(r)])}function N(t,e){const r=[w(t.chainId||0,"chainId"),w(t.nonce||0,"nonce"),w(t.gasPrice||0,"gasPrice"),w(t.gasLimit||0,"gasLimit"),null!=t.to?(0,n.Kn)(t.to):"0x",w(t.value||0,"value"),t.data||"0x",A(t.accessList||[])];if(e){const t=(0,o.N)(e);r.push(w(t.recoveryParam,"recoveryParam")),r.push((0,o.G1)(t.r)),r.push((0,o.G1)(t.s))}return(0,o.xs)(["0x01",l.encode(r)])}function S(t,e){if(null==t.type||0===t.type)return null!=t.accessList&&f.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",t),function(t,e){(0,u.uj)(t,v);const r=[];g.forEach((function(e){let n=t[e.name]||[];const i={};e.numeric&&(i.hexPad="left"),n=(0,o.lE)((0,o.Dv)(n,i)),e.length&&n.length!==e.length&&n.length>0&&f.throwArgumentError("invalid length for "+e.name,"transaction:"+e.name,n),e.maxLength&&(n=(0,o.G1)(n),n.length>e.maxLength&&f.throwArgumentError("invalid length for "+e.name,"transaction:"+e.name,n)),r.push((0,o.Dv)(n))}));let n=0;if(null!=t.chainId?(n=t.chainId,"number"!=typeof n&&f.throwArgumentError("invalid transaction.chainId","transaction",t)):e&&!(0,o.Zq)(e)&&e.v>28&&(n=Math.floor((e.v-35)/2)),0!==n&&(r.push((0,o.Dv)(n)),r.push("0x"),r.push("0x")),!e)return l.encode(r);const i=(0,o.N)(e);let s=27+i.recoveryParam;return 0!==n?(r.pop(),r.pop(),r.pop(),s+=2*n+8,i.v>28&&i.v!==s&&f.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e)):i.v!==s&&f.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e),r.push((0,o.Dv)(s)),r.push((0,o.G1)((0,o.lE)(i.r))),r.push((0,o.G1)((0,o.lE)(i.s))),l.encode(r)}(t,e);switch(t.type){case 1:return N(t,e);case 2:return _(t,e)}return f.throwError(`unsupported transaction type: ${t.type}`,c.Yd.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:t.type})}function T(t,e,r){try{const r=m(e[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");t.v=r}catch(t){f.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=(0,o.$m)(e[1],32),t.s=(0,o.$m)(e[2],32);try{const e=(0,a.w)(r(t));t.from=b(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){}}function k(t){const e=(0,o.lE)(t);if(e[0]>127)return function(t){const e=l.decode(t);9!==e.length&&6!==e.length&&f.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:m(e[0]).toNumber(),gasPrice:m(e[1]),gasLimit:m(e[2]),to:p(e[3]),value:m(e[4]),data:e[5],chainId:0};if(6===e.length)return r;try{r.v=i.O$.from(e[6]).toNumber()}catch(t){return r}if(r.r=(0,o.$m)(e[7],32),r.s=(0,o.$m)(e[8],32),i.O$.from(r.r).isZero()&&i.O$.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);0!==r.chainId&&(i.push((0,o.Dv)(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const s=(0,a.w)(l.encode(i));try{r.from=b(s,{r:(0,o.Dv)(r.r),s:(0,o.Dv)(r.s),recoveryParam:n})}catch(t){}r.hash=(0,a.w)(t)}return r.type=null,r}(e);switch(e[0]){case 1:return function(t){const e=l.decode(t.slice(1));8!==e.length&&11!==e.length&&f.throwArgumentError("invalid component count for transaction type: 1","payload",(0,o.Dv)(t));const r={type:1,chainId:m(e[0]).toNumber(),nonce:m(e[1]).toNumber(),gasPrice:m(e[2]),gasLimit:m(e[3]),to:p(e[4]),value:m(e[5]),data:e[6],accessList:M(e[7])};return 8===e.length||(r.hash=(0,a.w)(t),T(r,e.slice(8),N)),r}(e);case 2:return function(t){const e=l.decode(t.slice(1));9!==e.length&&12!==e.length&&f.throwArgumentError("invalid component count for transaction type: 2","payload",(0,o.Dv)(t));const r=m(e[2]),n=m(e[3]),i={type:2,chainId:m(e[0]).toNumber(),nonce:m(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:m(e[4]),to:p(e[5]),value:m(e[6]),data:e[7],accessList:M(e[8])};return 9===e.length||(i.hash=(0,a.w)(t),T(i,e.slice(9),_)),i}(e)}return f.throwError(`unsupported transaction type: ${e[0]}`,c.Yd.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}},8341:(t,e,r)=>{"use strict";r.d(e,{MY:()=>p,rd:()=>m,$l:()=>g});var n=r(9567),i=r(3286),o=r(3587),s=r(4242),a=r(711),u=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};function l(t,e){return u(this,void 0,void 0,(function*(){null==e&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(!0!==e.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),null!=e.fetchOptions){const t=e.fetchOptions;t.mode&&(r.mode=t.mode),t.cache&&(r.cache=t.cache),t.credentials&&(r.credentials=t.credentials),t.redirect&&(r.redirect=t.redirect),t.referrer&&(r.referrer=t.referrer)}const n=yield fetch(t,r),o=yield n.arrayBuffer(),s={};return n.headers.forEach?n.headers.forEach(((t,e)=>{s[e.toLowerCase()]=t})):n.headers.keys().forEach((t=>{s[t.toLowerCase()]=n.headers.get(t)})),{headers:s,statusCode:n.status,statusMessage:n.statusText,body:(0,i.lE)(new Uint8Array(o))}}))}var h=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const c=new a.Yd("web/5.7.1");function f(t){return new Promise((e=>{setTimeout(e,t)}))}function d(t,e){if(null==t)return null;if("string"==typeof t)return t;if((0,i.Zq)(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return(0,s.ZN)(t)}catch(t){}return(0,i.Dv)(t)}return t}function p(t,e,r){const i="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;c.assertArgument(i>0&&i%1==0,"invalid connection throttle limit","connection.throttleLimit",i);const u="object"==typeof t?t.throttleCallback:null,p="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;c.assertArgument(p>0&&p%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",p);const m="object"==typeof t&&!!t.errorPassThrough,g={};let v=null;const y={method:"GET"};let b=!1,w=12e4;if("string"==typeof t)v=t;else if("object"==typeof t){if(null!=t&&null!=t.url||c.throwArgumentError("missing URL","connection.url",t),v=t.url,"number"==typeof t.timeout&&t.timeout>0&&(w=t.timeout),t.headers)for(const e in t.headers)g[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(b=!0);if(y.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==v.substring(0,6)&&!0!==t.allowInsecureAuthentication&&c.throwError("basic authentication requires a secure https url",a.Yd.errors.INVALID_ARGUMENT,{argument:"url",url:v,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;g.authorization={key:"Authorization",value:"Basic "+(0,n.c)((0,s.Y0)(e))}}null!=t.skipFetchSetup&&(y.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(y.fetchOptions=(0,o.DC)(t.fetchOptions))}const E=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),M=v?v.match(E):null;if(M)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":M[1]||"text/plain"},body:M[2]?(0,n.J)(M[3]):(A=M[3],(0,s.Y0)(A.replace(/%([0-9a-f][0-9a-f])/gi,((t,e)=>String.fromCharCode(parseInt(e,16))))))};let e=t.body;return r&&(e=r(t.body,t)),Promise.resolve(e)}catch(t){c.throwError("processing response error",a.Yd.errors.SERVER_ERROR,{body:d(M[1],M[2]),error:t,requestBody:null,requestMethod:"GET",url:v})}var A;e&&(y.method="POST",y.body=e,null==g["content-type"]&&(g["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==g["content-length"]&&(g["content-length"]={key:"Content-Length",value:String(e.length)}));const _={};Object.keys(g).forEach((t=>{const e=g[t];_[e.key]=e.value})),y.headers=_;const N=function(){let t=null;return{promise:new Promise((function(e,r){w&&(t=setTimeout((()=>{null!=t&&(t=null,r(c.makeError("timeout",a.Yd.errors.TIMEOUT,{requestBody:d(y.body,_["content-type"]),requestMethod:y.method,timeout:w,url:v})))}),w))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),S=function(){return h(this,void 0,void 0,(function*(){for(let t=0;t=300)&&(N.cancel(),c.throwError("bad response",a.Yd.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:d(n,e.headers?e.headers["content-type"]:null),requestBody:d(y.body,_["content-type"]),requestMethod:y.method,url:v})),r)try{const t=yield r(n,e);return N.cancel(),t}catch(r){if(r.throttleRetry&&t"content-type"===t.toLowerCase())).length||(r.headers=(0,o.DC)(r.headers),r.headers["content-type"]="application/json"):r.headers={"content-type":"application/json"},t=r}return p(t,n,((t,e)=>{let n=null;if(null!=t)try{n=JSON.parse((0,s.ZN)(t))}catch(e){c.throwError("invalid JSON",a.Yd.errors.SERVER_ERROR,{body:t,error:e})}return r&&(n=r(n,e)),n}))}function g(t,e){return e||(e={}),null==(e=(0,o.DC)(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,n){let i=null,o=!1;const s=()=>!o&&(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout((()=>{s()&&n(new Error("timeout"))}),e.timeout));const a=e.retryLimit;let u=0;!function i(){return t().then((function(t){if(void 0!==t)s()&&r(t);else if(e.oncePoll)e.oncePoll.once("poll",i);else if(e.onceBlock)e.onceBlock.once("block",i);else if(!o){if(u++,u>a)return void(s()&&n(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,u)));te.ceiling&&(t=e.ceiling),setTimeout(i,t)}return null}),(function(t){s()&&n(t)}))}()}))}},8659:(t,e,r)=>{"use strict";r.d(e,{D:()=>s});var n=r(2046),i=r(3587);const o=new(r(711).Yd)("wordlists/5.7.0");class s{constructor(t){o.checkAbstract(new.target,s),(0,i.zG)(this,"locale",t)}split(t){return t.toLowerCase().split(/ +/g)}join(t){return t.join(" ")}static check(t){const e=[];for(let r=0;r<2048;r++){const n=t.getWord(r);if(r!==t.getWordIndex(n))return"0x";e.push(n)}return(0,n.id)(e.join("\n")+"\n")}static register(t,e){e||(e=t.locale)}}},9855:(t,e,r)=>{"use strict";r.d(e,{E:()=>u});var n=r(8659);let i=null;function o(t){if(null==i&&(i="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==n.D.check(t)))throw i=null,new Error("BIP39 Wordlist for en (English) FAILED")}class s extends n.D{constructor(){super("en")}getWord(t){return o(this),i[t]}getWordIndex(t){return o(this),i.indexOf(t)}}const a=new s;n.D.register(a);const u={en:a}},8099:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(7117);function i(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}function o(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}function s(t,e){return void 0===e&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function a(t,e){return void 0===e&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}function u(t,e){return void 0===e&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}function l(t,e){return void 0===e&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}function h(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}function c(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}function f(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),h(t/4294967296>>>0,e,r),h(t>>>0,e,r+4),e}function d(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),c(t>>>0,e,r),c(t/4294967296>>>0,e,r+4),e}e.readInt16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16},e.readUint16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])>>>0},e.readInt16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])<<16>>16},e.readUint16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])>>>0},e.writeUint16BE=i,e.writeInt16BE=i,e.writeUint16LE=o,e.writeInt16LE=o,e.readInt32BE=s,e.readUint32BE=a,e.readInt32LE=u,e.readUint32LE=l,e.writeUint32BE=h,e.writeInt32BE=h,e.writeUint32LE=c,e.writeInt32LE=c,e.readInt64BE=function(t,e){void 0===e&&(e=0);var r=s(t,e),n=s(t,e+4);return 4294967296*r+n-4294967296*(n>>31)},e.readUint64BE=function(t,e){return void 0===e&&(e=0),4294967296*a(t,e)+a(t,e+4)},e.readInt64LE=function(t,e){void 0===e&&(e=0);var r=u(t,e);return 4294967296*u(t,e+4)+r-4294967296*(r>>31)},e.readUint64LE=function(t,e){void 0===e&&(e=0);var r=l(t,e);return 4294967296*l(t,e+4)+r},e.writeUint64BE=f,e.writeInt64BE=f,e.writeUint64LE=d,e.writeInt64LE=d,e.readUintBE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=t/8+r-1;o>=r;o--)n+=e[o]*i,i*=256;return n},e.readUintLE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o=i;s--)r[s]=e/o&255,o*=256;return r},e.writeUintLE=function(t,e,r,i){if(void 0===r&&(r=new Uint8Array(t/8)),void 0===i&&(i=0),t%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var o=1,s=i;s{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.mul=Math.imul||function(t,e){var r=65535&t,n=65535&e;return r*n+((t>>>16&65535)*n+r*(e>>>16&65535)<<16>>>0)|0},e.add=function(t,e){return t+e|0},e.sub=function(t,e){return t-e|0},e.rotl=function(t,e){return t<>>32-e},e.rotr=function(t,e){return t<<32-e|t>>>e},e.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(t){return e.isInteger(t)&&t>=-e.MAX_SAFE_INTEGER&&t<=e.MAX_SAFE_INTEGER}},1416:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const n=r(6008),i=r(8099),o=r(7309);function s(t,r=e.defaultRandomSource){return r.randomBytes(t)}e.defaultRandomSource=new n.SystemRandomSource,e.randomBytes=s,e.randomUint32=function(t=e.defaultRandomSource){const r=s(4,t),n=(0,i.readUint32LE)(r);return(0,o.wipe)(r),n};const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function u(t,r=a,n=e.defaultRandomSource){if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let i="";const u=r.length,l=256-256%u;for(;t>0;){const e=s(Math.ceil(256*t/l),n);for(let n=0;n0;n++){const o=e[n];o{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BrowserRandomSource=void 0,e.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const t="undefined"!=typeof self?self.crypto||self.msCrypto:null;t&&void 0!==t.getRandomValues&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const e=new Uint8Array(t);for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NodeRandomSource=void 0;const n=r(7309);e.NodeRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const t=r(5883);t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let e=this._crypto.randomBytes(t);if(e.length!==t)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(t);for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SystemRandomSource=void 0;const n=r(5455),i=r(8871);e.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)}}},7309:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.wipe=function(t){for(var e=0;e255)return!1;return!0}function i(t,e){if(t.buffer&&ArrayBuffer.isView(t)&&"Uint8Array"===t.name)return e&&(t=t.slice?t.slice():Array.prototype.slice.call(t)),t;if(Array.isArray(t)){if(!n(t))throw new Error("Array contains invalid value: "+t);return new Uint8Array(t)}if(r(t.length)&&n(t))return new Uint8Array(t);throw new Error("unsupported array-like object")}function o(t){return new Uint8Array(t)}function s(t,e,r,n,i){null==n&&null==i||(t=t.slice?t.slice(n,i):Array.prototype.slice.call(t,n,i)),e.set(t,r)}var a,u={toBytes:function(t){var e=[],r=0;for(t=encodeURI(t);r191&&n<224?(e.push(String.fromCharCode((31&n)<<6|63&t[r+1])),r+=2):(e.push(String.fromCharCode((15&n)<<12|(63&t[r+1])<<6|63&t[r+2])),r+=3)}return e.join("")}},l=(a="0123456789abcdef",{toBytes:function(t){for(var e=[],r=0;r>4]+a[15&n])}return e.join("")}}),h={16:10,24:12,32:14},c=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],f=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],d=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],p=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],m=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],g=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],v=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],b=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],w=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],E=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],M=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],A=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],_=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],N=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function S(t){for(var e=[],r=0;r>2,this._Ke[r][e%4]=o[e],this._Kd[t-r][e%4]=o[e];for(var s,a=0,u=i;u>16&255]<<24^f[s>>8&255]<<16^f[255&s]<<8^f[s>>24&255]^c[a]<<24,a+=1,8!=i)for(e=1;e>8&255]<<8^f[s>>16&255]<<16^f[s>>24&255]<<24,e=i/2+1;e>2,d=u%4,this._Ke[l][d]=o[e],this._Kd[t-l][d]=o[e++],u++}for(var l=1;l>24&255]^A[s>>16&255]^_[s>>8&255]^N[255&s]},T.prototype.encrypt=function(t){if(16!=t.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var e=this._Ke.length-1,r=[0,0,0,0],n=S(t),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var s=1;s>24&255]^m[n[(i+1)%4]>>16&255]^g[n[(i+2)%4]>>8&255]^v[255&n[(i+3)%4]]^this._Ke[s][i];n=r.slice()}var a,u=o(16);for(i=0;i<4;i++)a=this._Ke[e][i],u[4*i]=255&(f[n[i]>>24&255]^a>>24),u[4*i+1]=255&(f[n[(i+1)%4]>>16&255]^a>>16),u[4*i+2]=255&(f[n[(i+2)%4]>>8&255]^a>>8),u[4*i+3]=255&(f[255&n[(i+3)%4]]^a);return u},T.prototype.decrypt=function(t){if(16!=t.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var e=this._Kd.length-1,r=[0,0,0,0],n=S(t),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var s=1;s>24&255]^b[n[(i+3)%4]>>16&255]^w[n[(i+2)%4]>>8&255]^E[255&n[(i+1)%4]]^this._Kd[s][i];n=r.slice()}var a,u=o(16);for(i=0;i<4;i++)a=this._Kd[e][i],u[4*i]=255&(d[n[i]>>24&255]^a>>24),u[4*i+1]=255&(d[n[(i+3)%4]>>16&255]^a>>16),u[4*i+2]=255&(d[n[(i+2)%4]>>8&255]^a>>8),u[4*i+3]=255&(d[255&n[(i+1)%4]]^a);return u};var k=function(t){if(!(this instanceof k))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new T(t)};k.prototype.encrypt=function(t){if((t=i(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=o(t.length),r=o(16),n=0;n=0;--e)this._counter[e]=t%256,t>>=8},I.prototype.setBytes=function(t){if(16!=(t=i(t,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=t},I.prototype.increment=function(){for(var t=15;t>=0;t--){if(255!==this._counter[t]){this._counter[t]++;break}this._counter[t]=0}};var C=function(t,e){if(!(this instanceof C))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",e instanceof I||(e=new I(e)),this._counter=e,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new T(t)};C.prototype.encrypt=function(t){for(var e=i(t,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=t.length-e,n=0;n{t.exports=function(t){const e="api.js: ",n=this,i=r(8737),o=r(979),s=r(1789),a=new(r(3737)),{attributes:u,showAttributes:l,showAttributeErrors:h,showRuleDependencies:c}=r(8862),f=r(2595),d=function(t,e,r){const n=``,o="",s=``,a="";let u,l="";for(;Array.isArray(t)&&0!==t.length;){if("number"!=typeof e)throw new Error("abnfToHtml: beg must be type number");if(e>=t.length)break;u="number"!=typeof r||e+r>=t.length?t.length:e+r;let h=0;for(let r=e;r=32&&e<=126)switch(1===h?(l+=o,h=0):2===h&&(l+=a,h=0),e){case 32:l+=" ";break;case 60:l+="<";break;case 62:l+=">";break;case 38:l+="&";break;case 34:l+=""";break;case 39:l+="'";break;case 92:l+="\";break;default:l+=String.fromCharCode(e)}else 9===e||10===e||13===e?(0===h?(l+=n,h=1):2===h&&(l+=a+n,h=1),9===e&&(l+="TAB"),10===e&&(l+="LF"),13===e&&(l+="CR")):(0===h?(l+=s,h=2):1===h&&(l+=o+s,h=2),l+=`\\x${i.utils.charToHex(e)}`)}2===h&&(l+=a),1===h&&(l+=o);break}return l},p=function(t,e,r){let n="";for(let i=e;i=32&&e<=126)n+=String.fromCharCode(e);else switch(e){case 9:n+="\\t";break;case 10:n+="\\n";break;case 13:n+="\\r";break;default:n+="\\unknown"}}return n};let m,g=!1,v=!1,y=!1,b=!1,w=0;if(this.errors=[],Buffer.isBuffer(t))this.chars=o.decode("BINARY",t);else if(Array.isArray(t))this.chars=t.slice();else{if("string"!=typeof t)throw new Error(`${e}input source is not a string, byte Buffer or character array`);this.chars=o.decode("STRING",t)}this.sabnf=o.encode("STRING",this.chars),this.scan=function(t,e){this.lines=s(this.chars,this.errors,t,e),g=!0},this.parse=function(t,r){if(!g)throw new Error(`${e}grammar not scanned`);a.syntax(this.chars,this.lines,this.errors,t,r),v=!0},this.translate=function(){if(!v)throw new Error(`${e}grammar not scanned and parsed`);const t=a.semantic(this.chars,this.lines,this.errors);0===this.errors.length&&(this.rules=t.rules,this.udts=t.udts,m=t.lineMap,y=!0)},this.attributes=function(){if(!y)throw new Error(`${e}grammar not scanned, parsed and translated`);return w=u(this.rules,this.udts,m,this.errors),b=!0,w},this.generate=function(t){if(this.lines=s(this.chars,this.errors,t),this.errors.length)return;if(a.syntax(this.chars,this.lines,this.errors,t),this.errors.length)return;const e=a.semantic(this.chars,this.lines,this.errors);this.errors.length||(this.rules=e.rules,this.udts=e.udts,m=e.lineMap,w=u(this.rules,this.udts,m,this.errors),b=!0)},this.displayRules=function(t="index"){if(!y)throw new Error(`${e}grammar not scanned, parsed and translated`);return f(this.rules,this.udts,t)},this.displayRuleDependencies=function(t="index"){if(!b)throw new Error(`${e}no attributes - must be preceeded by call to attributes()`);return c(t)},this.displayAttributes=function(t="index"){if(!b)throw new Error(`${e}no attributes - must be preceeded by call to attributes()`);return w&&h(t),l(t)},this.displayAttributeErrors=function(){if(!b)throw new Error(`${e}no attributes - must be preceeded by call to attributes()`);return h()},this.toSource=function(t){if(!b)throw new Error(`${e}can't generate parser source - must be preceeded by call to attributes()`);if(w)throw new Error(`${e}can't generate parser source - attributes have ${w} errors`);return a.generateSource(this.chars,this.lines,this.rules,this.udts,t)},this.toObject=function(){if(!b)throw new Error(`${e}can't generate parser source - must be preceeded by call to attributes()`);if(w)throw new Error(`${e}can't generate parser source - attributes have ${w} errors`);return a.generateObject(this.sabnf,this.rules,this.udts)},this.errorsToAscii=function(){return function(t,e,r){let n,i,o,s;return n="",t.forEach((t=>{i=e[t.line],n+=`${i.lineNo}: `,n+=`${i.beginChar}: `,n+=t.char-i.beginChar+": ",o=i.beginChar,s=t.char-i.beginChar,n+=p(r,o,s),n+=" >> ",o=t.char,s=i.beginChar+i.length-t.char,n+=p(r,o,s),n+="\n",n+=`${i.lineNo}: `,n+=`${i.beginChar}: `,n+=t.char-i.beginChar+": ",n+="error: ",n+=t.msg,n+="\n"})),n}(this.errors,this.lines,this.chars)},this.errorsToHtml=function(t){return function(t,e,r,n){const[o]=i;let s="";const a=`»`;return s+=`

\n`,n&&"string"==typeof n&&(s+=`\n`),s+="\n",t.forEach((t=>{let n,o,u,l,h,c="",f="";0===e.length?(h=a,o=0):(n=e[t.line],u=n.beginChar,t.char>u&&(c=d(r,u,t.char-u)),u=t.char,l=n.beginChar+n.length,u",s+=``,s+="\n",s+="",s+=``,s+="\n")})),s+="
${n}
line
no.
line
offset
error
offset

text
${t.line}${n.beginChar}${o}${h}
↑: ${i.utils.stringToAsciiHtml(t.msg)}

\n",s}(this.errors,this.lines,this.chars,t)},this.linesToAscii=function(){return function(t){let e="Annotated Input Grammar";return t.forEach((t=>{e+="\n",e+=`line no: ${t.lineNo}`,e+=` : char index: ${t.beginChar}`,e+=` : length: ${t.length}`,e+=` : abnf: ${p(n.chars,t.beginChar,t.length)}`})),e+="\n",e}(this.lines)},this.linesToHtml=function(){return function(t){let e="";return e+=`\n`,e+="\n",e+="",e+="",e+="\n",t.forEach((t=>{e+="",e+=`",e+="\n"})),e+="
Annotated Input Grammar
line
no.
first
char

length

text
${t.lineNo}`,e+=`${t.beginChar}`,e+=`${t.length}`,e+=`${d(n.chars,t.beginChar,t.length)}`,e+="
\n",e}(this.lines)}}},8862:(t,e,r)=>{t.exports=function(){const t=r(8276),{ruleAttributes:e,showAttributes:n,showAttributeErrors:i}=r(4246),{ruleDependencies:o,showRuleDependencies:s}=r(7008);class a{constructor(t,e){this.rules=t,this.udts=e,this.ruleCount=t.length,this.udtCount=e.length,this.startRule=0,this.dependenciesComplete=!1,this.attributesComplete=!1,this.isMutuallyRecursive=!1,this.ruleIndexes=this.indexArray(this.ruleCount),this.ruleAlphaIndexes=this.indexArray(this.ruleCount),this.ruleTypeIndexes=this.indexArray(this.ruleCount),this.udtIndexes=this.indexArray(this.udtCount),this.udtAlphaIndexes=this.indexArray(this.udtCount),this.attrsErrorCount=0,this.attrs=[],this.attrsErrors=[],this.attrsWorking=[],this.ruleDeps=[];for(let e=0;e0)for(let r=0;r0)for(let r=0;rthis.rules[e].lower?1:0}compUdtsAlpha(t,e){return this.udts[t].lowerthis.udts[e].lower?1:0}compRulesType(t,e){return this.ruleDeps[t].recursiveTypethis.ruleDeps[e].recursiveType?1:0}compRulesGroup(e,r){if(this.ruleDeps[e].recursiveType===t.ATTR_MR&&this.ruleDeps[r].recursiveType===t.ATTR_MR){if(this.ruleDeps[e].groupNumberthis.ruleDeps[r].groupNumber)return 1}return 0}}return{attributes:function(t=[],r=[],n=[],i=[]){const s=new a(t,r);return o(s),e(s),s.attrsErrorCount&&i.push({line:0,char:0,msg:`${s.attrsErrorCount} attribute errors`}),s.attrsErrorCount},showAttributes:n,showAttributeErrors:i,showRuleDependencies:s}}()},3737:(t,e,r)=>{t.exports=function(){const t=r(8737),e=t.ids,n=new(r(4216)),i=new(r(1832)),o=new(r(3610)),s=new t.parser;s.ast=new t.ast,s.callbacks=n.callbacks,s.ast.callbacks=i.callbacks;const a=function(t,e,r){if(e<0||e>=r)return-1;for(let r=0;r=t[r].beginChar&&e{const r=[],n=[];let i=0;t.opcodes.forEach((t=>{t.type===e.ALT&&1===t.children.length||t.type===e.CAT&&1===t.children.length||t.type===e.REP&&1===t.min&&1===t.max?n.push(null):(n.push(i),r.push(t),i+=1)})),n.push(i),r.forEach((t=>{if(t.type===e.ALT||t.type===e.CAT)for(let e=0;e{d.push(t.lower),h+=t.opcodes.length,t.opcodes.forEach((t=>{switch(t.type){case e.ALT:m+=1;break;case e.CAT:g+=1;break;case e.RNM:v+=1;break;case e.UDT:y+=1;break;case e.REP:b+=1;break;case e.AND:w+=1;break;case e.NOT:E+=1;break;case e.BKA:S+=1;break;case e.BKN:T+=1;break;case e.BKR:N+=1;break;case e.ABG:k+=1;break;case e.AEN:R+=1;break;case e.TLS:for(M+=1,s=0;sf&&(f=t.string[s]);break;case e.TBS:for(A+=1,s=0;sf&&(f=t.string[s]);break;case e.TRG:_+=1,t.minf&&(f=t.max);break;default:throw new Error("generateSource: unrecognized opcode")}}))})),d.sort(),i.length>0&&(i.forEach((t=>{p.push(t.lower)})),p.sort());let x,O="module.exports";return o&&"string"==typeof o&&(O=`let ${o}`),l+="// copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved
\n",l+="// license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)
\n",l+="//\n",l+="// Generated by apg-js, Version 4.0.0 [apg-js](https://github.com/ldthomas/apg-js)\n",l+=`${O} = function grammar(){\n`,l+=" // ```\n",l+=" // SUMMARY\n",l+=` // rules = ${n.length}\n`,l+=` // udts = ${i.length}\n`,l+=` // opcodes = ${h}\n`,l+=" // --- ABNF original opcodes\n",l+=` // ALT = ${m}\n`,l+=` // CAT = ${g}\n`,l+=` // REP = ${b}\n`,l+=` // RNM = ${v}\n`,l+=` // TLS = ${M}\n`,l+=` // TBS = ${A}\n`,l+=` // TRG = ${_}\n`,l+=" // --- SABNF superset opcodes\n",l+=` // UDT = ${y}\n`,l+=` // AND = ${w}\n`,l+=` // NOT = ${E}\n`,l+=` // BKA = ${S}\n`,l+=` // BKN = ${T}\n`,l+=` // BKR = ${N}\n`,l+=` // ABG = ${k}\n`,l+=` // AEN = ${R}\n`,l+=" // characters = [",l+=M+A+_===0?" none defined ]":`${c} - ${f}]`,y>0&&(l+=" + user defined"),l+="\n",l+=" // ```\n",l+=" /* OBJECT IDENTIFIER (for internal parser use) */\n",l+=" this.grammarObject = 'grammarObject';\n",l+="\n",l+=" /* RULES */\n",l+=" this.rules = [];\n",n.forEach(((t,e)=>{let r=" this.rules[";r+=e,r+="] = {name: '",r+=t.name,r+="', lower: '",r+=t.lower,r+="', index: ",r+=t.index,r+=", isBkr: ",r+=t.isBkr,r+="};\n",l+=r})),l+="\n",l+=" /* UDTS */\n",l+=" this.udts = [];\n",i.length>0&&i.forEach(((t,e)=>{let r=" this.udts[";r+=e,r+="] = {name: '",r+=t.name,r+="', lower: '",r+=t.lower,r+="', index: ",r+=t.index,r+=", empty: ",r+=t.empty,r+=", isBkr: ",r+=t.isBkr,r+="};\n",l+=r})),l+="\n",l+=" /* OPCODES */\n",n.forEach(((t,r)=>{r>0&&(l+="\n"),l+=` /* ${t.name} */\n`,l+=` this.rules[${r}].opcodes = [];\n`,t.opcodes.forEach(((t,o)=>{let s;switch(t.type){case e.ALT:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, children: [${t.children.toString()}]};// ALT\n`;break;case e.CAT:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, children: [${t.children.toString()}]};// CAT\n`;break;case e.RNM:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, index: ${t.index}};// RNM(${n[t.index].name})\n`;break;case e.BKR:t.index>=n.length?(a=i[t.index-n.length].name,u=i[t.index-n.length].lower):(a=n[t.index].name,u=n[t.index].lower),s="%i",t.bkrCase===e.BKR_MODE_CS&&(s="%s"),t.bkrMode===e.BKR_MODE_UM?s+="%u":s+="%p",a=s+a,l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, index: ${t.index}, lower: '${u}', bkrCase: ${t.bkrCase}, bkrMode: ${t.bkrMode}};// BKR(\\${a})\n`;break;case e.UDT:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, empty: ${t.empty}, index: ${t.index}};// UDT(${i[t.index].name})\n`;break;case e.REP:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, min: ${t.min}, max: ${t.max}};// REP\n`;break;case e.AND:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}};// AND\n`;break;case e.NOT:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}};// NOT\n`;break;case e.ABG:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}};// ABG(%^)\n`;break;case e.AEN:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}};// AEN(%$)\n`;break;case e.BKA:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}};// BKA\n`;break;case e.BKN:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}};// BKN\n`;break;case e.TLS:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, string: [${t.string.toString()}]};// TLS\n`;break;case e.TBS:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, string: [${t.string.toString()}]};// TBS\n`;break;case e.TRG:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, min: ${t.min}, max: ${t.max}};// TRG\n`;break;default:throw new Error("parser.js: ~143: unrecognized opcode")}}))})),l+="\n",l+=" // The `toString()` function will display the original grammar file(s) that produced these opcodes.\n",l+=" this.toString = function toString(){\n",l+=' let str = "";\n',r.forEach((e=>{const r=e.beginChar+e.length;x="",l+=' str += "';for(let n=e.beginChar;n{i.push(t.lower)})),i.sort(),r.length>0&&(r.forEach((t=>{o.push(t.lower)})),o.sort()),n.callbacks=[],i.forEach((t=>{n.callbacks[t]=!1})),r.length>0&&o.forEach((t=>{n.callbacks[t]=!1})),n.rules=e,n.udts=r,n.toString=function(){return s},n}}},4246:(t,e,r)=>{t.exports=function(){const t=r(8276);let e=null;function n(t){return!(t.left||t.nested||t.right||t.cyclic)&&t.empty}function i(t){return!!(t.left||t.nested||t.right||t.cyclic)}function o(e,r,a,u){e.attrInit(u);const l=r[a];switch(l.type){case t.ALT:!function(t,e,r,n){let i=0;const s=e[r],a=s.children.length,u=[];for(i=0;i=0;r-=1){if(t[r].right)return!0;if(!t[r].empty)return!1}return!1}(h,l),s.nested=function(t,e){let r=0,o=0,s=0;for(r=0;r=0;r-=1)if(t[r].left&&!t[r].leaf)for(o=r-1;o>=0;o-=1)if(!n(t[o]))return!0;for(r=0;r=t.ruleCount?(n.empty=t.udts[i.index-t.ruleCount].empty,n.finite=!0):(s(t,i.index,n),n.left=!1,n.nested=!1,n.right=!1,n.cyclic=!1)}(e,r,a,u);break;case t.AND:case t.NOT:case t.BKA:case t.BKN:o(e,r,a+1,u),u.empty=!0;break;case t.TLS:u.empty=!r[a].string.length,u.finite=!0,u.cyclic=!1;break;case t.TBS:case t.TRG:u.empty=!1,u.finite=!0,u.cyclic=!1;break;case t.UDT:u.empty=l.empty,u.finite=!0,u.cyclic=!1;break;case t.ABG:case t.AEN:u.empty=!0,u.finite=!0,u.cyclic=!1;break;default:throw new Error(`unknown opcode type: ${l}`)}}function s(t,e,r){const n=t.attrsWorking[e];n.isComplete?t.attrCopy(r,n):n.isOpen?e===t.startRule?e===t.startRule&&(r.left=!0,r.right=!0,r.cyclic=!0,r.leaf=!0):r.finite=!0:(n.isOpen=!0,o(t,n.rule.opcodes,0,r),n.left=r.left,n.right=r.right,n.nested=r.nested,n.empty=r.empty,n.finite=r.finite,n.cyclic=r.cyclic,n.leaf=!1,n.isOpen=!1,n.isComplete=!0)}const a=t=>t?"t":"f",u=t=>t?"e":"f",l=(r,n,i,o)=>{let s=`${r}:${n}:`;return s+=`${u(i.left)} `,s+=`${a(i.nested)} `,s+=`${a(i.right)} `,s+=`${u(i.cyclic)} `,s+=(i.finite?"t":"e")+" ",s+=`${a(i.empty)}:`,s+=`${e.typeToString(o.recursiveType)}:`,s+=o.recursiveType===t.ATTR_MR?o.groupNumber:"-",s+=`:${i.rule.name}\n`,s},h=()=>{let t="LEGEND - t=true, f=false, e=error\n";return t+="sequence:rule index:left nested right cyclic finite empty:type:group number:rule name\n","LEGEND - t=true, f=false, e=error\nsequence:rule index:left nested right cyclic finite empty:type:group number:rule name\n"},c=t=>{let r=0,n=0,i=null,o=null,s="",{ruleIndexes:a}=e;for(97===t?a=e.ruleAlphaIndexes:116===t&&(a=e.ruleTypeIndexes),r=0;r{e=t;let r=0,n=0;const i=e.attrGen();for(r=0;r{if(!e.attributesComplete)throw new Error("rule-attributes.js:showAttributes: attributes not available");let r="";const n="RULE ATTRIBUTES\n";return 97===t.charCodeAt(0)?(r+="alphabetical by rule name\n",r+=n,r+=h(),r+=c(97)):116===t.charCodeAt(0)?(r+="ordered by rule type\n",r+=n,r+=h(),r+=c(116)):(r+="ordered by rule index\n",r+=n,r+=h(),r+=c()),r},showAttributeErrors:()=>{let t=null,r=null,n="";if(n+="RULE ATTRIBUTES WITH ERRORS\n",n+=h(),e.attrsErrorCount)for(let i=0;i{t.exports=(()=>{const t=r(8276);let e=null;const n=(e,r,i,o)=>{let s=0,a=0;const u=r[i];o[i]=!0;const l=u.rule.opcodes;for(s=0;s{let r=0,n=0,i=0,o=0;const s=e.ruleCount-1,a=e.udtCount-1;let u="",l="";const h="=> ";let c=!1,f=null,{ruleIndexes:d}=e,{udtIndexes:p}=e;for(97===t?(d=e.ruleAlphaIndexes,p=e.udtAlphaIndexes):116===t&&(d=e.ruleTypeIndexes,p=e.udtAlphaIndexes),r=0;r-1?f.groupNumber:"-",l+=":"),l+=" ",u+=`${l+e.rules[d[r]].name}\n`,c=!0,i=0,o=u.length,u+=l,n=0;n100&&n!==s&&(u+=`\n${l}${h}`,o=u.length);if(e.udtCount)for(n=0;n100&&n!==a&&(u+=`\n${l}${h}`,o=u.length);for(0===i&&(u+="=> \n"),!1===c&&(u+="\n"),c=!0,i=0,o=u.length,u+=l,n=0;n100&&n!==s&&(u+=`\n${l}${h}`,o=u.length);0===i&&(u+="<= \n"),!1===c&&(u+="\n"),u+="\n"}return u};return{ruleDependencies:r=>{e=r;let i=0,o=0,s=0,a=null,u=null,l=!1;e.dependenciesComplete=!1;const h=e.falseArray(e.ruleCount);for(i=0;i-1,e.ruleAlphaIndexes.sort(e.compRulesAlpha),e.ruleTypeIndexes.sort(e.compRulesAlpha),e.ruleTypeIndexes.sort(e.compRulesType),e.isMutuallyRecursive&&e.ruleTypeIndexes.sort(e.compRulesGroup),e.udtCount&&e.udtAlphaIndexes.sort(e.compUdtsAlpha),e.dependenciesComplete=!0},showRuleDependencies:(t="index")=>{let r="RULE DEPENDENCIES(index:type:[group number:])\n";return r+="=> refers to rule names\n",r+="<= referenced by rule names\n",e.dependenciesComplete?(97===t.charCodeAt(0)?(r+="alphabetical by rule name\n",r+=i(97)):116===t.charCodeAt(0)?(r+="ordered by rule type\n",r+=i(116)):(r+="ordered by rule index\n",r+=i(null)),r):r}}})()},3610:t=>{t.exports=function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"File",lower:"file",index:0,isBkr:!1},this.rules[1]={name:"BlankLine",lower:"blankline",index:1,isBkr:!1},this.rules[2]={name:"Rule",lower:"rule",index:2,isBkr:!1},this.rules[3]={name:"RuleLookup",lower:"rulelookup",index:3,isBkr:!1},this.rules[4]={name:"RuleNameTest",lower:"rulenametest",index:4,isBkr:!1},this.rules[5]={name:"RuleName",lower:"rulename",index:5,isBkr:!1},this.rules[6]={name:"RuleNameError",lower:"rulenameerror",index:6,isBkr:!1},this.rules[7]={name:"DefinedAsTest",lower:"definedastest",index:7,isBkr:!1},this.rules[8]={name:"DefinedAsError",lower:"definedaserror",index:8,isBkr:!1},this.rules[9]={name:"DefinedAs",lower:"definedas",index:9,isBkr:!1},this.rules[10]={name:"Defined",lower:"defined",index:10,isBkr:!1},this.rules[11]={name:"IncAlt",lower:"incalt",index:11,isBkr:!1},this.rules[12]={name:"RuleError",lower:"ruleerror",index:12,isBkr:!1},this.rules[13]={name:"LineEndError",lower:"lineenderror",index:13,isBkr:!1},this.rules[14]={name:"Alternation",lower:"alternation",index:14,isBkr:!1},this.rules[15]={name:"Concatenation",lower:"concatenation",index:15,isBkr:!1},this.rules[16]={name:"Repetition",lower:"repetition",index:16,isBkr:!1},this.rules[17]={name:"Modifier",lower:"modifier",index:17,isBkr:!1},this.rules[18]={name:"Predicate",lower:"predicate",index:18,isBkr:!1},this.rules[19]={name:"BasicElement",lower:"basicelement",index:19,isBkr:!1},this.rules[20]={name:"BasicElementErr",lower:"basicelementerr",index:20,isBkr:!1},this.rules[21]={name:"Group",lower:"group",index:21,isBkr:!1},this.rules[22]={name:"GroupError",lower:"grouperror",index:22,isBkr:!1},this.rules[23]={name:"GroupOpen",lower:"groupopen",index:23,isBkr:!1},this.rules[24]={name:"GroupClose",lower:"groupclose",index:24,isBkr:!1},this.rules[25]={name:"Option",lower:"option",index:25,isBkr:!1},this.rules[26]={name:"OptionError",lower:"optionerror",index:26,isBkr:!1},this.rules[27]={name:"OptionOpen",lower:"optionopen",index:27,isBkr:!1},this.rules[28]={name:"OptionClose",lower:"optionclose",index:28,isBkr:!1},this.rules[29]={name:"RnmOp",lower:"rnmop",index:29,isBkr:!1},this.rules[30]={name:"BkrOp",lower:"bkrop",index:30,isBkr:!1},this.rules[31]={name:"bkrModifier",lower:"bkrmodifier",index:31,isBkr:!1},this.rules[32]={name:"cs",lower:"cs",index:32,isBkr:!1},this.rules[33]={name:"ci",lower:"ci",index:33,isBkr:!1},this.rules[34]={name:"um",lower:"um",index:34,isBkr:!1},this.rules[35]={name:"pm",lower:"pm",index:35,isBkr:!1},this.rules[36]={name:"bkr-name",lower:"bkr-name",index:36,isBkr:!1},this.rules[37]={name:"rname",lower:"rname",index:37,isBkr:!1},this.rules[38]={name:"uname",lower:"uname",index:38,isBkr:!1},this.rules[39]={name:"ename",lower:"ename",index:39,isBkr:!1},this.rules[40]={name:"UdtOp",lower:"udtop",index:40,isBkr:!1},this.rules[41]={name:"udt-non-empty",lower:"udt-non-empty",index:41,isBkr:!1},this.rules[42]={name:"udt-empty",lower:"udt-empty",index:42,isBkr:!1},this.rules[43]={name:"RepOp",lower:"repop",index:43,isBkr:!1},this.rules[44]={name:"AltOp",lower:"altop",index:44,isBkr:!1},this.rules[45]={name:"CatOp",lower:"catop",index:45,isBkr:!1},this.rules[46]={name:"StarOp",lower:"starop",index:46,isBkr:!1},this.rules[47]={name:"AndOp",lower:"andop",index:47,isBkr:!1},this.rules[48]={name:"NotOp",lower:"notop",index:48,isBkr:!1},this.rules[49]={name:"BkaOp",lower:"bkaop",index:49,isBkr:!1},this.rules[50]={name:"BknOp",lower:"bknop",index:50,isBkr:!1},this.rules[51]={name:"AbgOp",lower:"abgop",index:51,isBkr:!1},this.rules[52]={name:"AenOp",lower:"aenop",index:52,isBkr:!1},this.rules[53]={name:"TrgOp",lower:"trgop",index:53,isBkr:!1},this.rules[54]={name:"TbsOp",lower:"tbsop",index:54,isBkr:!1},this.rules[55]={name:"TlsOp",lower:"tlsop",index:55,isBkr:!1},this.rules[56]={name:"TlsCase",lower:"tlscase",index:56,isBkr:!1},this.rules[57]={name:"TlsOpen",lower:"tlsopen",index:57,isBkr:!1},this.rules[58]={name:"TlsClose",lower:"tlsclose",index:58,isBkr:!1},this.rules[59]={name:"TlsString",lower:"tlsstring",index:59,isBkr:!1},this.rules[60]={name:"StringTab",lower:"stringtab",index:60,isBkr:!1},this.rules[61]={name:"ClsOp",lower:"clsop",index:61,isBkr:!1},this.rules[62]={name:"ClsOpen",lower:"clsopen",index:62,isBkr:!1},this.rules[63]={name:"ClsClose",lower:"clsclose",index:63,isBkr:!1},this.rules[64]={name:"ClsString",lower:"clsstring",index:64,isBkr:!1},this.rules[65]={name:"ProsVal",lower:"prosval",index:65,isBkr:!1},this.rules[66]={name:"ProsValOpen",lower:"prosvalopen",index:66,isBkr:!1},this.rules[67]={name:"ProsValString",lower:"prosvalstring",index:67,isBkr:!1},this.rules[68]={name:"ProsValClose",lower:"prosvalclose",index:68,isBkr:!1},this.rules[69]={name:"rep-min",lower:"rep-min",index:69,isBkr:!1},this.rules[70]={name:"rep-min-max",lower:"rep-min-max",index:70,isBkr:!1},this.rules[71]={name:"rep-max",lower:"rep-max",index:71,isBkr:!1},this.rules[72]={name:"rep-num",lower:"rep-num",index:72,isBkr:!1},this.rules[73]={name:"dString",lower:"dstring",index:73,isBkr:!1},this.rules[74]={name:"xString",lower:"xstring",index:74,isBkr:!1},this.rules[75]={name:"bString",lower:"bstring",index:75,isBkr:!1},this.rules[76]={name:"Dec",lower:"dec",index:76,isBkr:!1},this.rules[77]={name:"Hex",lower:"hex",index:77,isBkr:!1},this.rules[78]={name:"Bin",lower:"bin",index:78,isBkr:!1},this.rules[79]={name:"dmin",lower:"dmin",index:79,isBkr:!1},this.rules[80]={name:"dmax",lower:"dmax",index:80,isBkr:!1},this.rules[81]={name:"bmin",lower:"bmin",index:81,isBkr:!1},this.rules[82]={name:"bmax",lower:"bmax",index:82,isBkr:!1},this.rules[83]={name:"xmin",lower:"xmin",index:83,isBkr:!1},this.rules[84]={name:"xmax",lower:"xmax",index:84,isBkr:!1},this.rules[85]={name:"dnum",lower:"dnum",index:85,isBkr:!1},this.rules[86]={name:"bnum",lower:"bnum",index:86,isBkr:!1},this.rules[87]={name:"xnum",lower:"xnum",index:87,isBkr:!1},this.rules[88]={name:"alphanum",lower:"alphanum",index:88,isBkr:!1},this.rules[89]={name:"owsp",lower:"owsp",index:89,isBkr:!1},this.rules[90]={name:"wsp",lower:"wsp",index:90,isBkr:!1},this.rules[91]={name:"space",lower:"space",index:91,isBkr:!1},this.rules[92]={name:"comment",lower:"comment",index:92,isBkr:!1},this.rules[93]={name:"LineEnd",lower:"lineend",index:93,isBkr:!1},this.rules[94]={name:"LineContinue",lower:"linecontinue",index:94,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:3,min:0,max:1/0},this.rules[0].opcodes[1]={type:1,children:[2,3,4]},this.rules[0].opcodes[2]={type:4,index:1},this.rules[0].opcodes[3]={type:4,index:2},this.rules[0].opcodes[4]={type:4,index:12},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,5,7]},this.rules[1].opcodes[1]={type:3,min:0,max:1/0},this.rules[1].opcodes[2]={type:1,children:[3,4]},this.rules[1].opcodes[3]={type:6,string:[32]},this.rules[1].opcodes[4]={type:6,string:[9]},this.rules[1].opcodes[5]={type:3,min:0,max:1},this.rules[1].opcodes[6]={type:4,index:92},this.rules[1].opcodes[7]={type:4,index:93},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[2].opcodes[1]={type:4,index:3},this.rules[2].opcodes[2]={type:4,index:89},this.rules[2].opcodes[3]={type:4,index:14},this.rules[2].opcodes[4]={type:1,children:[5,8]},this.rules[2].opcodes[5]={type:2,children:[6,7]},this.rules[2].opcodes[6]={type:4,index:89},this.rules[2].opcodes[7]={type:4,index:93},this.rules[2].opcodes[8]={type:2,children:[9,10]},this.rules[2].opcodes[9]={type:4,index:13},this.rules[2].opcodes[10]={type:4,index:93},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:2,children:[1,2,3]},this.rules[3].opcodes[1]={type:4,index:4},this.rules[3].opcodes[2]={type:4,index:89},this.rules[3].opcodes[3]={type:4,index:7},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:4,index:5},this.rules[4].opcodes[2]={type:4,index:6},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:4,index:88},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:3,min:1,max:1/0},this.rules[6].opcodes[1]={type:1,children:[2,3]},this.rules[6].opcodes[2]={type:5,min:33,max:60},this.rules[6].opcodes[3]={type:5,min:62,max:126},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:1,children:[1,2]},this.rules[7].opcodes[1]={type:4,index:9},this.rules[7].opcodes[2]={type:4,index:8},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:3,min:1,max:2},this.rules[8].opcodes[1]={type:5,min:33,max:126},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:1,children:[1,2]},this.rules[9].opcodes[1]={type:4,index:11},this.rules[9].opcodes[2]={type:4,index:10},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:6,string:[61]},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:6,string:[61,47]},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:2,children:[1,6]},this.rules[12].opcodes[1]={type:3,min:1,max:1/0},this.rules[12].opcodes[2]={type:1,children:[3,4,5]},this.rules[12].opcodes[3]={type:5,min:32,max:126},this.rules[12].opcodes[4]={type:6,string:[9]},this.rules[12].opcodes[5]={type:4,index:94},this.rules[12].opcodes[6]={type:4,index:93},this.rules[13].opcodes=[],this.rules[13].opcodes[0]={type:3,min:1,max:1/0},this.rules[13].opcodes[1]={type:1,children:[2,3,4]},this.rules[13].opcodes[2]={type:5,min:32,max:126},this.rules[13].opcodes[3]={type:6,string:[9]},this.rules[13].opcodes[4]={type:4,index:94},this.rules[14].opcodes=[],this.rules[14].opcodes[0]={type:2,children:[1,2]},this.rules[14].opcodes[1]={type:4,index:15},this.rules[14].opcodes[2]={type:3,min:0,max:1/0},this.rules[14].opcodes[3]={type:2,children:[4,5,6]},this.rules[14].opcodes[4]={type:4,index:89},this.rules[14].opcodes[5]={type:4,index:44},this.rules[14].opcodes[6]={type:4,index:15},this.rules[15].opcodes=[],this.rules[15].opcodes[0]={type:2,children:[1,2]},this.rules[15].opcodes[1]={type:4,index:16},this.rules[15].opcodes[2]={type:3,min:0,max:1/0},this.rules[15].opcodes[3]={type:2,children:[4,5]},this.rules[15].opcodes[4]={type:4,index:45},this.rules[15].opcodes[5]={type:4,index:16},this.rules[16].opcodes=[],this.rules[16].opcodes[0]={type:2,children:[1,3]},this.rules[16].opcodes[1]={type:3,min:0,max:1},this.rules[16].opcodes[2]={type:4,index:17},this.rules[16].opcodes[3]={type:1,children:[4,5,6,7]},this.rules[16].opcodes[4]={type:4,index:21},this.rules[16].opcodes[5]={type:4,index:25},this.rules[16].opcodes[6]={type:4,index:19},this.rules[16].opcodes[7]={type:4,index:20},this.rules[17].opcodes=[],this.rules[17].opcodes[0]={type:1,children:[1,5]},this.rules[17].opcodes[1]={type:2,children:[2,3]},this.rules[17].opcodes[2]={type:4,index:18},this.rules[17].opcodes[3]={type:3,min:0,max:1},this.rules[17].opcodes[4]={type:4,index:43},this.rules[17].opcodes[5]={type:4,index:43},this.rules[18].opcodes=[],this.rules[18].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[18].opcodes[1]={type:4,index:49},this.rules[18].opcodes[2]={type:4,index:50},this.rules[18].opcodes[3]={type:4,index:47},this.rules[18].opcodes[4]={type:4,index:48},this.rules[19].opcodes=[],this.rules[19].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10]},this.rules[19].opcodes[1]={type:4,index:40},this.rules[19].opcodes[2]={type:4,index:29},this.rules[19].opcodes[3]={type:4,index:53},this.rules[19].opcodes[4]={type:4,index:54},this.rules[19].opcodes[5]={type:4,index:55},this.rules[19].opcodes[6]={type:4,index:61},this.rules[19].opcodes[7]={type:4,index:30},this.rules[19].opcodes[8]={type:4,index:51},this.rules[19].opcodes[9]={type:4,index:52},this.rules[19].opcodes[10]={type:4,index:65},this.rules[20].opcodes=[],this.rules[20].opcodes[0]={type:3,min:1,max:1/0},this.rules[20].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[20].opcodes[2]={type:5,min:33,max:40},this.rules[20].opcodes[3]={type:5,min:42,max:46},this.rules[20].opcodes[4]={type:5,min:48,max:92},this.rules[20].opcodes[5]={type:5,min:94,max:126},this.rules[21].opcodes=[],this.rules[21].opcodes[0]={type:2,children:[1,2,3]},this.rules[21].opcodes[1]={type:4,index:23},this.rules[21].opcodes[2]={type:4,index:14},this.rules[21].opcodes[3]={type:1,children:[4,5]},this.rules[21].opcodes[4]={type:4,index:24},this.rules[21].opcodes[5]={type:4,index:22},this.rules[22].opcodes=[],this.rules[22].opcodes[0]={type:3,min:1,max:1/0},this.rules[22].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[22].opcodes[2]={type:5,min:33,max:40},this.rules[22].opcodes[3]={type:5,min:42,max:46},this.rules[22].opcodes[4]={type:5,min:48,max:92},this.rules[22].opcodes[5]={type:5,min:94,max:126},this.rules[23].opcodes=[],this.rules[23].opcodes[0]={type:2,children:[1,2]},this.rules[23].opcodes[1]={type:6,string:[40]},this.rules[23].opcodes[2]={type:4,index:89},this.rules[24].opcodes=[],this.rules[24].opcodes[0]={type:2,children:[1,2]},this.rules[24].opcodes[1]={type:4,index:89},this.rules[24].opcodes[2]={type:6,string:[41]},this.rules[25].opcodes=[],this.rules[25].opcodes[0]={type:2,children:[1,2,3]},this.rules[25].opcodes[1]={type:4,index:27},this.rules[25].opcodes[2]={type:4,index:14},this.rules[25].opcodes[3]={type:1,children:[4,5]},this.rules[25].opcodes[4]={type:4,index:28},this.rules[25].opcodes[5]={type:4,index:26},this.rules[26].opcodes=[],this.rules[26].opcodes[0]={type:3,min:1,max:1/0},this.rules[26].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[26].opcodes[2]={type:5,min:33,max:40},this.rules[26].opcodes[3]={type:5,min:42,max:46},this.rules[26].opcodes[4]={type:5,min:48,max:92},this.rules[26].opcodes[5]={type:5,min:94,max:126},this.rules[27].opcodes=[],this.rules[27].opcodes[0]={type:2,children:[1,2]},this.rules[27].opcodes[1]={type:6,string:[91]},this.rules[27].opcodes[2]={type:4,index:89},this.rules[28].opcodes=[],this.rules[28].opcodes[0]={type:2,children:[1,2]},this.rules[28].opcodes[1]={type:4,index:89},this.rules[28].opcodes[2]={type:6,string:[93]},this.rules[29].opcodes=[],this.rules[29].opcodes[0]={type:4,index:88},this.rules[30].opcodes=[],this.rules[30].opcodes[0]={type:2,children:[1,2,4]},this.rules[30].opcodes[1]={type:6,string:[92]},this.rules[30].opcodes[2]={type:3,min:0,max:1},this.rules[30].opcodes[3]={type:4,index:31},this.rules[30].opcodes[4]={type:4,index:36},this.rules[31].opcodes=[],this.rules[31].opcodes[0]={type:1,children:[1,7,13,19]},this.rules[31].opcodes[1]={type:2,children:[2,3]},this.rules[31].opcodes[2]={type:4,index:32},this.rules[31].opcodes[3]={type:3,min:0,max:1},this.rules[31].opcodes[4]={type:1,children:[5,6]},this.rules[31].opcodes[5]={type:4,index:34},this.rules[31].opcodes[6]={type:4,index:35},this.rules[31].opcodes[7]={type:2,children:[8,9]},this.rules[31].opcodes[8]={type:4,index:33},this.rules[31].opcodes[9]={type:3,min:0,max:1},this.rules[31].opcodes[10]={type:1,children:[11,12]},this.rules[31].opcodes[11]={type:4,index:34},this.rules[31].opcodes[12]={type:4,index:35},this.rules[31].opcodes[13]={type:2,children:[14,15]},this.rules[31].opcodes[14]={type:4,index:34},this.rules[31].opcodes[15]={type:3,min:0,max:1},this.rules[31].opcodes[16]={type:1,children:[17,18]},this.rules[31].opcodes[17]={type:4,index:32},this.rules[31].opcodes[18]={type:4,index:33},this.rules[31].opcodes[19]={type:2,children:[20,21]},this.rules[31].opcodes[20]={type:4,index:35},this.rules[31].opcodes[21]={type:3,min:0,max:1},this.rules[31].opcodes[22]={type:1,children:[23,24]},this.rules[31].opcodes[23]={type:4,index:32},this.rules[31].opcodes[24]={type:4,index:33},this.rules[32].opcodes=[],this.rules[32].opcodes[0]={type:6,string:[37,115]},this.rules[33].opcodes=[],this.rules[33].opcodes[0]={type:6,string:[37,105]},this.rules[34].opcodes=[],this.rules[34].opcodes[0]={type:6,string:[37,117]},this.rules[35].opcodes=[],this.rules[35].opcodes[0]={type:6,string:[37,112]},this.rules[36].opcodes=[],this.rules[36].opcodes[0]={type:1,children:[1,2,3]},this.rules[36].opcodes[1]={type:4,index:38},this.rules[36].opcodes[2]={type:4,index:39},this.rules[36].opcodes[3]={type:4,index:37},this.rules[37].opcodes=[],this.rules[37].opcodes[0]={type:4,index:88},this.rules[38].opcodes=[],this.rules[38].opcodes[0]={type:2,children:[1,2]},this.rules[38].opcodes[1]={type:6,string:[117,95]},this.rules[38].opcodes[2]={type:4,index:88},this.rules[39].opcodes=[],this.rules[39].opcodes[0]={type:2,children:[1,2]},this.rules[39].opcodes[1]={type:6,string:[101,95]},this.rules[39].opcodes[2]={type:4,index:88},this.rules[40].opcodes=[],this.rules[40].opcodes[0]={type:1,children:[1,2]},this.rules[40].opcodes[1]={type:4,index:42},this.rules[40].opcodes[2]={type:4,index:41},this.rules[41].opcodes=[],this.rules[41].opcodes[0]={type:2,children:[1,2]},this.rules[41].opcodes[1]={type:6,string:[117,95]},this.rules[41].opcodes[2]={type:4,index:88},this.rules[42].opcodes=[],this.rules[42].opcodes[0]={type:2,children:[1,2]},this.rules[42].opcodes[1]={type:6,string:[101,95]},this.rules[42].opcodes[2]={type:4,index:88},this.rules[43].opcodes=[],this.rules[43].opcodes[0]={type:1,children:[1,5,8,11,12]},this.rules[43].opcodes[1]={type:2,children:[2,3,4]},this.rules[43].opcodes[2]={type:4,index:69},this.rules[43].opcodes[3]={type:4,index:46},this.rules[43].opcodes[4]={type:4,index:71},this.rules[43].opcodes[5]={type:2,children:[6,7]},this.rules[43].opcodes[6]={type:4,index:69},this.rules[43].opcodes[7]={type:4,index:46},this.rules[43].opcodes[8]={type:2,children:[9,10]},this.rules[43].opcodes[9]={type:4,index:46},this.rules[43].opcodes[10]={type:4,index:71},this.rules[43].opcodes[11]={type:4,index:46},this.rules[43].opcodes[12]={type:4,index:70},this.rules[44].opcodes=[],this.rules[44].opcodes[0]={type:2,children:[1,2]},this.rules[44].opcodes[1]={type:6,string:[47]},this.rules[44].opcodes[2]={type:4,index:89},this.rules[45].opcodes=[],this.rules[45].opcodes[0]={type:4,index:90},this.rules[46].opcodes=[],this.rules[46].opcodes[0]={type:6,string:[42]},this.rules[47].opcodes=[],this.rules[47].opcodes[0]={type:6,string:[38]},this.rules[48].opcodes=[],this.rules[48].opcodes[0]={type:6,string:[33]},this.rules[49].opcodes=[],this.rules[49].opcodes[0]={type:6,string:[38,38]},this.rules[50].opcodes=[],this.rules[50].opcodes[0]={type:6,string:[33,33]},this.rules[51].opcodes=[],this.rules[51].opcodes[0]={type:6,string:[37,94]},this.rules[52].opcodes=[],this.rules[52].opcodes[0]={type:6,string:[37,36]},this.rules[53].opcodes=[],this.rules[53].opcodes[0]={type:2,children:[1,2]},this.rules[53].opcodes[1]={type:6,string:[37]},this.rules[53].opcodes[2]={type:1,children:[3,8,13]},this.rules[53].opcodes[3]={type:2,children:[4,5,6,7]},this.rules[53].opcodes[4]={type:4,index:76},this.rules[53].opcodes[5]={type:4,index:79},this.rules[53].opcodes[6]={type:6,string:[45]},this.rules[53].opcodes[7]={type:4,index:80},this.rules[53].opcodes[8]={type:2,children:[9,10,11,12]},this.rules[53].opcodes[9]={type:4,index:77},this.rules[53].opcodes[10]={type:4,index:83},this.rules[53].opcodes[11]={type:6,string:[45]},this.rules[53].opcodes[12]={type:4,index:84},this.rules[53].opcodes[13]={type:2,children:[14,15,16,17]},this.rules[53].opcodes[14]={type:4,index:78},this.rules[53].opcodes[15]={type:4,index:81},this.rules[53].opcodes[16]={type:6,string:[45]},this.rules[53].opcodes[17]={type:4,index:82},this.rules[54].opcodes=[],this.rules[54].opcodes[0]={type:2,children:[1,2]},this.rules[54].opcodes[1]={type:6,string:[37]},this.rules[54].opcodes[2]={type:1,children:[3,10,17]},this.rules[54].opcodes[3]={type:2,children:[4,5,6]},this.rules[54].opcodes[4]={type:4,index:76},this.rules[54].opcodes[5]={type:4,index:73},this.rules[54].opcodes[6]={type:3,min:0,max:1/0},this.rules[54].opcodes[7]={type:2,children:[8,9]},this.rules[54].opcodes[8]={type:6,string:[46]},this.rules[54].opcodes[9]={type:4,index:73},this.rules[54].opcodes[10]={type:2,children:[11,12,13]},this.rules[54].opcodes[11]={type:4,index:77},this.rules[54].opcodes[12]={type:4,index:74},this.rules[54].opcodes[13]={type:3,min:0,max:1/0},this.rules[54].opcodes[14]={type:2,children:[15,16]},this.rules[54].opcodes[15]={type:6,string:[46]},this.rules[54].opcodes[16]={type:4,index:74},this.rules[54].opcodes[17]={type:2,children:[18,19,20]},this.rules[54].opcodes[18]={type:4,index:78},this.rules[54].opcodes[19]={type:4,index:75},this.rules[54].opcodes[20]={type:3,min:0,max:1/0},this.rules[54].opcodes[21]={type:2,children:[22,23]},this.rules[54].opcodes[22]={type:6,string:[46]},this.rules[54].opcodes[23]={type:4,index:75},this.rules[55].opcodes=[],this.rules[55].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[55].opcodes[1]={type:4,index:56},this.rules[55].opcodes[2]={type:4,index:57},this.rules[55].opcodes[3]={type:4,index:59},this.rules[55].opcodes[4]={type:4,index:58},this.rules[56].opcodes=[],this.rules[56].opcodes[0]={type:3,min:0,max:1},this.rules[56].opcodes[1]={type:1,children:[2,3]},this.rules[56].opcodes[2]={type:7,string:[37,105]},this.rules[56].opcodes[3]={type:7,string:[37,115]},this.rules[57].opcodes=[],this.rules[57].opcodes[0]={type:6,string:[34]},this.rules[58].opcodes=[],this.rules[58].opcodes[0]={type:6,string:[34]},this.rules[59].opcodes=[],this.rules[59].opcodes[0]={type:3,min:0,max:1/0},this.rules[59].opcodes[1]={type:1,children:[2,3,4]},this.rules[59].opcodes[2]={type:5,min:32,max:33},this.rules[59].opcodes[3]={type:5,min:35,max:126},this.rules[59].opcodes[4]={type:4,index:60},this.rules[60].opcodes=[],this.rules[60].opcodes[0]={type:6,string:[9]},this.rules[61].opcodes=[],this.rules[61].opcodes[0]={type:2,children:[1,2,3]},this.rules[61].opcodes[1]={type:4,index:62},this.rules[61].opcodes[2]={type:4,index:64},this.rules[61].opcodes[3]={type:4,index:63},this.rules[62].opcodes=[],this.rules[62].opcodes[0]={type:6,string:[39]},this.rules[63].opcodes=[],this.rules[63].opcodes[0]={type:6,string:[39]},this.rules[64].opcodes=[],this.rules[64].opcodes[0]={type:3,min:0,max:1/0},this.rules[64].opcodes[1]={type:1,children:[2,3,4]},this.rules[64].opcodes[2]={type:5,min:32,max:38},this.rules[64].opcodes[3]={type:5,min:40,max:126},this.rules[64].opcodes[4]={type:4,index:60},this.rules[65].opcodes=[],this.rules[65].opcodes[0]={type:2,children:[1,2,3]},this.rules[65].opcodes[1]={type:4,index:66},this.rules[65].opcodes[2]={type:4,index:67},this.rules[65].opcodes[3]={type:4,index:68},this.rules[66].opcodes=[],this.rules[66].opcodes[0]={type:6,string:[60]},this.rules[67].opcodes=[],this.rules[67].opcodes[0]={type:3,min:0,max:1/0},this.rules[67].opcodes[1]={type:1,children:[2,3,4]},this.rules[67].opcodes[2]={type:5,min:32,max:61},this.rules[67].opcodes[3]={type:5,min:63,max:126},this.rules[67].opcodes[4]={type:4,index:60},this.rules[68].opcodes=[],this.rules[68].opcodes[0]={type:6,string:[62]},this.rules[69].opcodes=[],this.rules[69].opcodes[0]={type:4,index:72},this.rules[70].opcodes=[],this.rules[70].opcodes[0]={type:4,index:72},this.rules[71].opcodes=[],this.rules[71].opcodes[0]={type:4,index:72},this.rules[72].opcodes=[],this.rules[72].opcodes[0]={type:3,min:1,max:1/0},this.rules[72].opcodes[1]={type:5,min:48,max:57},this.rules[73].opcodes=[],this.rules[73].opcodes[0]={type:4,index:85},this.rules[74].opcodes=[],this.rules[74].opcodes[0]={type:4,index:87},this.rules[75].opcodes=[],this.rules[75].opcodes[0]={type:4,index:86},this.rules[76].opcodes=[],this.rules[76].opcodes[0]={type:1,children:[1,2]},this.rules[76].opcodes[1]={type:6,string:[68]},this.rules[76].opcodes[2]={type:6,string:[100]},this.rules[77].opcodes=[],this.rules[77].opcodes[0]={type:1,children:[1,2]},this.rules[77].opcodes[1]={type:6,string:[88]},this.rules[77].opcodes[2]={type:6,string:[120]},this.rules[78].opcodes=[],this.rules[78].opcodes[0]={type:1,children:[1,2]},this.rules[78].opcodes[1]={type:6,string:[66]},this.rules[78].opcodes[2]={type:6,string:[98]},this.rules[79].opcodes=[],this.rules[79].opcodes[0]={type:4,index:85},this.rules[80].opcodes=[],this.rules[80].opcodes[0]={type:4,index:85},this.rules[81].opcodes=[],this.rules[81].opcodes[0]={type:4,index:86},this.rules[82].opcodes=[],this.rules[82].opcodes[0]={type:4,index:86},this.rules[83].opcodes=[],this.rules[83].opcodes[0]={type:4,index:87},this.rules[84].opcodes=[],this.rules[84].opcodes[0]={type:4,index:87},this.rules[85].opcodes=[],this.rules[85].opcodes[0]={type:3,min:1,max:1/0},this.rules[85].opcodes[1]={type:5,min:48,max:57},this.rules[86].opcodes=[],this.rules[86].opcodes[0]={type:3,min:1,max:1/0},this.rules[86].opcodes[1]={type:5,min:48,max:49},this.rules[87].opcodes=[],this.rules[87].opcodes[0]={type:3,min:1,max:1/0},this.rules[87].opcodes[1]={type:1,children:[2,3,4]},this.rules[87].opcodes[2]={type:5,min:48,max:57},this.rules[87].opcodes[3]={type:5,min:65,max:70},this.rules[87].opcodes[4]={type:5,min:97,max:102},this.rules[88].opcodes=[],this.rules[88].opcodes[0]={type:2,children:[1,4]},this.rules[88].opcodes[1]={type:1,children:[2,3]},this.rules[88].opcodes[2]={type:5,min:97,max:122},this.rules[88].opcodes[3]={type:5,min:65,max:90},this.rules[88].opcodes[4]={type:3,min:0,max:1/0},this.rules[88].opcodes[5]={type:1,children:[6,7,8,9]},this.rules[88].opcodes[6]={type:5,min:97,max:122},this.rules[88].opcodes[7]={type:5,min:65,max:90},this.rules[88].opcodes[8]={type:5,min:48,max:57},this.rules[88].opcodes[9]={type:6,string:[45]},this.rules[89].opcodes=[],this.rules[89].opcodes[0]={type:3,min:0,max:1/0},this.rules[89].opcodes[1]={type:4,index:91},this.rules[90].opcodes=[],this.rules[90].opcodes[0]={type:3,min:1,max:1/0},this.rules[90].opcodes[1]={type:4,index:91},this.rules[91].opcodes=[],this.rules[91].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[91].opcodes[1]={type:6,string:[32]},this.rules[91].opcodes[2]={type:6,string:[9]},this.rules[91].opcodes[3]={type:4,index:92},this.rules[91].opcodes[4]={type:4,index:94},this.rules[92].opcodes=[],this.rules[92].opcodes[0]={type:2,children:[1,2]},this.rules[92].opcodes[1]={type:6,string:[59]},this.rules[92].opcodes[2]={type:3,min:0,max:1/0},this.rules[92].opcodes[3]={type:1,children:[4,5]},this.rules[92].opcodes[4]={type:5,min:32,max:126},this.rules[92].opcodes[5]={type:6,string:[9]},this.rules[93].opcodes=[],this.rules[93].opcodes[0]={type:1,children:[1,2,3]},this.rules[93].opcodes[1]={type:6,string:[13,10]},this.rules[93].opcodes[2]={type:6,string:[10]},this.rules[93].opcodes[3]={type:6,string:[13]},this.rules[94].opcodes=[],this.rules[94].opcodes[0]={type:2,children:[1,5]},this.rules[94].opcodes[1]={type:1,children:[2,3,4]},this.rules[94].opcodes[2]={type:6,string:[13,10]},this.rules[94].opcodes[3]={type:6,string:[10]},this.rules[94].opcodes[4]={type:6,string:[13]},this.rules[94].opcodes[5]={type:1,children:[6,7]},this.rules[94].opcodes[6]={type:6,string:[32]},this.rules[94].opcodes[7]={type:6,string:[9]},this.toString=function(){let t="";return t+=";\n",t+="; ABNF for JavaScript APG 2.0 SABNF\n",t+="; RFC 5234 with some restrictions and additions.\n",t+="; Updated 11/24/2015 for RFC 7405 case-sensitive literal string notation\n",t+='; - accepts %s"string" as a case-sensitive string\n',t+='; - accepts %i"string" as a case-insensitive string\n',t+='; - accepts "string" as a case-insensitive string\n',t+=";\n",t+="; Some restrictions:\n",t+="; 1. Rules must begin at first character of each line.\n",t+="; Indentations on first rule and rules thereafter are not allowed.\n",t+="; 2. Relaxed line endings. CRLF, LF or CR are accepted as valid line ending.\n",t+="; 3. Prose values, i.e. , are accepted as valid grammar syntax.\n",t+="; However, a working parser cannot be generated from them.\n",t+=";\n",t+="; Super set (SABNF) additions:\n",t+="; 1. Look-ahead (syntactic predicate) operators are accepted as element prefixes.\n",t+="; & is the positive look-ahead operator, succeeds and backtracks if the look-ahead phrase is found\n",t+="; ! is the negative look-ahead operator, succeeds and backtracks if the look-ahead phrase is NOT found\n",t+="; e.g. &%d13 or &rule or !(A / B)\n",t+="; 2. User-Defined Terminals (UDT) of the form, u_name and e_name are accepted.\n",t+="; 'name' is alpha followed by alpha/num/hyphen just like a rule name.\n",t+="; u_name may be used as an element but no rule definition is given.\n",t+="; e.g. rule = A / u_myUdt\n",t+='; A = "a"\n',t+="; would be a valid grammar.\n",t+="; 3. Case-sensitive, single-quoted strings are accepted.\n",t+="; e.g. 'abc' would be equivalent to %d97.98.99\n",t+='; (kept for backward compatibility, but superseded by %s"abc") \n',t+="; New 12/26/2015\n",t+="; 4. Look-behind operators are accepted as element prefixes.\n",t+="; && is the positive look-behind operator, succeeds and backtracks if the look-behind phrase is found\n",t+="; !! is the negative look-behind operator, succeeds and backtracks if the look-behind phrase is NOT found\n",t+="; e.g. &&%d13 or &&rule or !!(A / B)\n",t+="; 5. Back reference operators, i.e. \\rulename, are accepted.\n",t+="; A back reference operator acts like a TLS or TBS terminal except that the phrase it attempts\n",t+="; to match is a phrase previously matched by the rule 'rulename'.\n",t+="; There are two modes of previous phrase matching - the parent-frame mode and the universal mode.\n",t+="; In universal mode, \\rulename matches the last match to 'rulename' regardless of where it was found.\n",t+="; In parent-frame mode, \\rulename matches only the last match found on the parent's frame or parse tree level.\n",t+="; Back reference modifiers can be used to specify case and mode.\n",t+="; \\A defaults to case-insensitive and universal mode, e.g. \\A === \\%i%uA\n",t+="; Modifiers %i and %s determine case-insensitive and case-sensitive mode, respectively.\n",t+="; Modifiers %u and %p determine universal mode and parent frame mode, respectively.\n",t+="; Case and mode modifiers can appear in any order, e.g. \\%s%pA === \\%p%sA. \n",t+="; 7. String begin anchor, ABG(%^) matches the beginning of the input string location.\n",t+="; Returns EMPTY or NOMATCH. Never consumes any characters.\n",t+="; 8. String end anchor, AEN(%$) matches the end of the input string location.\n",t+="; Returns EMPTY or NOMATCH. Never consumes any characters.\n",t+=";\n",t+="File = *(BlankLine / Rule / RuleError)\n",t+="BlankLine = *(%d32/%d9) [comment] LineEnd\n",t+="Rule = RuleLookup owsp Alternation ((owsp LineEnd)\n",t+=" / (LineEndError LineEnd))\n",t+="RuleLookup = RuleNameTest owsp DefinedAsTest\n",t+="RuleNameTest = RuleName/RuleNameError\n",t+="RuleName = alphanum\n",t+="RuleNameError = 1*(%d33-60/%d62-126)\n",t+="DefinedAsTest = DefinedAs / DefinedAsError\n",t+="DefinedAsError = 1*2%d33-126\n",t+="DefinedAs = IncAlt / Defined\n",t+="Defined = %d61\n",t+="IncAlt = %d61.47\n",t+="RuleError = 1*(%d32-126 / %d9 / LineContinue) LineEnd\n",t+="LineEndError = 1*(%d32-126 / %d9 / LineContinue)\n",t+="Alternation = Concatenation *(owsp AltOp Concatenation)\n",t+="Concatenation = Repetition *(CatOp Repetition)\n",t+="Repetition = [Modifier] (Group / Option / BasicElement / BasicElementErr)\n",t+="Modifier = (Predicate [RepOp])\n",t+=" / RepOp\n",t+="Predicate = BkaOp\n",t+=" / BknOp\n",t+=" / AndOp\n",t+=" / NotOp\n",t+="BasicElement = UdtOp\n",t+=" / RnmOp\n",t+=" / TrgOp\n",t+=" / TbsOp\n",t+=" / TlsOp\n",t+=" / ClsOp\n",t+=" / BkrOp\n",t+=" / AbgOp\n",t+=" / AenOp\n",t+=" / ProsVal\n",t+="BasicElementErr = 1*(%d33-40/%d42-46/%d48-92/%d94-126)\n",t+="Group = GroupOpen Alternation (GroupClose / GroupError)\n",t+="GroupError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr\n",t+="GroupOpen = %d40 owsp\n",t+="GroupClose = owsp %d41\n",t+="Option = OptionOpen Alternation (OptionClose / OptionError)\n",t+="OptionError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr\n",t+="OptionOpen = %d91 owsp\n",t+="OptionClose = owsp %d93\n",t+="RnmOp = alphanum\n",t+="BkrOp = %d92 [bkrModifier] bkr-name\n",t+="bkrModifier = (cs [um / pm]) / (ci [um / pm]) / (um [cs /ci]) / (pm [cs / ci])\n",t+="cs = '%s'\n",t+="ci = '%i'\n",t+="um = '%u'\n",t+="pm = '%p'\n",t+="bkr-name = uname / ename / rname\n",t+="rname = alphanum\n",t+="uname = %d117.95 alphanum\n",t+="ename = %d101.95 alphanum\n",t+="UdtOp = udt-empty\n",t+=" / udt-non-empty\n",t+="udt-non-empty = %d117.95 alphanum\n",t+="udt-empty = %d101.95 alphanum\n",t+="RepOp = (rep-min StarOp rep-max)\n",t+=" / (rep-min StarOp)\n",t+=" / (StarOp rep-max)\n",t+=" / StarOp\n",t+=" / rep-min-max\n",t+="AltOp = %d47 owsp\n",t+="CatOp = wsp\n",t+="StarOp = %d42\n",t+="AndOp = %d38\n",t+="NotOp = %d33\n",t+="BkaOp = %d38.38\n",t+="BknOp = %d33.33\n",t+="AbgOp = %d37.94\n",t+="AenOp = %d37.36\n",t+="TrgOp = %d37 ((Dec dmin %d45 dmax) / (Hex xmin %d45 xmax) / (Bin bmin %d45 bmax))\n",t+="TbsOp = %d37 ((Dec dString *(%d46 dString)) / (Hex xString *(%d46 xString)) / (Bin bString *(%d46 bString)))\n",t+="TlsOp = TlsCase TlsOpen TlsString TlsClose\n",t+='TlsCase = ["%i" / "%s"]\n',t+="TlsOpen = %d34\n",t+="TlsClose = %d34\n",t+="TlsString = *(%d32-33/%d35-126/StringTab)\n",t+="StringTab = %d9\n",t+="ClsOp = ClsOpen ClsString ClsClose\n",t+="ClsOpen = %d39\n",t+="ClsClose = %d39\n",t+="ClsString = *(%d32-38/%d40-126/StringTab)\n",t+="ProsVal = ProsValOpen ProsValString ProsValClose\n",t+="ProsValOpen = %d60\n",t+="ProsValString = *(%d32-61/%d63-126/StringTab)\n",t+="ProsValClose = %d62\n",t+="rep-min = rep-num\n",t+="rep-min-max = rep-num\n",t+="rep-max = rep-num\n",t+="rep-num = 1*(%d48-57)\n",t+="dString = dnum\n",t+="xString = xnum\n",t+="bString = bnum\n",t+="Dec = (%d68/%d100)\n",t+="Hex = (%d88/%d120)\n",t+="Bin = (%d66/%d98)\n",t+="dmin = dnum\n",t+="dmax = dnum\n",t+="bmin = bnum\n",t+="bmax = bnum\n",t+="xmin = xnum\n",t+="xmax = xnum\n",t+="dnum = 1*(%d48-57)\n",t+="bnum = 1*%d48-49\n",t+="xnum = 1*(%d48-57 / %d65-70 / %d97-102)\n",t+=";\n",t+="; Basics\n",t+="alphanum = (%d97-122/%d65-90) *(%d97-122/%d65-90/%d48-57/%d45)\n",t+="owsp = *space\n",t+="wsp = 1*space\n",t+="space = %d32\n",t+=" / %d9\n",t+=" / comment\n",t+=" / LineContinue\n",t+="comment = %d59 *(%d32-126 / %d9)\n",t+="LineEnd = %d13.10\n",t+=" / %d10\n",t+=" / %d13\n",t+="LineContinue = (%d13.10 / %d10 / %d13) (%d32 / %d9)\n",";\n; ABNF for JavaScript APG 2.0 SABNF\n; RFC 5234 with some restrictions and additions.\n; Updated 11/24/2015 for RFC 7405 case-sensitive literal string notation\n; - accepts %s\"string\" as a case-sensitive string\n; - accepts %i\"string\" as a case-insensitive string\n; - accepts \"string\" as a case-insensitive string\n;\n; Some restrictions:\n; 1. Rules must begin at first character of each line.\n; Indentations on first rule and rules thereafter are not allowed.\n; 2. Relaxed line endings. CRLF, LF or CR are accepted as valid line ending.\n; 3. Prose values, i.e. , are accepted as valid grammar syntax.\n; However, a working parser cannot be generated from them.\n;\n; Super set (SABNF) additions:\n; 1. Look-ahead (syntactic predicate) operators are accepted as element prefixes.\n; & is the positive look-ahead operator, succeeds and backtracks if the look-ahead phrase is found\n; ! is the negative look-ahead operator, succeeds and backtracks if the look-ahead phrase is NOT found\n; e.g. &%d13 or &rule or !(A / B)\n; 2. User-Defined Terminals (UDT) of the form, u_name and e_name are accepted.\n; 'name' is alpha followed by alpha/num/hyphen just like a rule name.\n; u_name may be used as an element but no rule definition is given.\n; e.g. rule = A / u_myUdt\n; A = \"a\"\n; would be a valid grammar.\n; 3. Case-sensitive, single-quoted strings are accepted.\n; e.g. 'abc' would be equivalent to %d97.98.99\n; (kept for backward compatibility, but superseded by %s\"abc\") \n; New 12/26/2015\n; 4. Look-behind operators are accepted as element prefixes.\n; && is the positive look-behind operator, succeeds and backtracks if the look-behind phrase is found\n; !! is the negative look-behind operator, succeeds and backtracks if the look-behind phrase is NOT found\n; e.g. &&%d13 or &&rule or !!(A / B)\n; 5. Back reference operators, i.e. \\rulename, are accepted.\n; A back reference operator acts like a TLS or TBS terminal except that the phrase it attempts\n; to match is a phrase previously matched by the rule 'rulename'.\n; There are two modes of previous phrase matching - the parent-frame mode and the universal mode.\n; In universal mode, \\rulename matches the last match to 'rulename' regardless of where it was found.\n; In parent-frame mode, \\rulename matches only the last match found on the parent's frame or parse tree level.\n; Back reference modifiers can be used to specify case and mode.\n; \\A defaults to case-insensitive and universal mode, e.g. \\A === \\%i%uA\n; Modifiers %i and %s determine case-insensitive and case-sensitive mode, respectively.\n; Modifiers %u and %p determine universal mode and parent frame mode, respectively.\n; Case and mode modifiers can appear in any order, e.g. \\%s%pA === \\%p%sA. \n; 7. String begin anchor, ABG(%^) matches the beginning of the input string location.\n; Returns EMPTY or NOMATCH. Never consumes any characters.\n; 8. String end anchor, AEN(%$) matches the end of the input string location.\n; Returns EMPTY or NOMATCH. Never consumes any characters.\n;\nFile = *(BlankLine / Rule / RuleError)\nBlankLine = *(%d32/%d9) [comment] LineEnd\nRule = RuleLookup owsp Alternation ((owsp LineEnd)\n / (LineEndError LineEnd))\nRuleLookup = RuleNameTest owsp DefinedAsTest\nRuleNameTest = RuleName/RuleNameError\nRuleName = alphanum\nRuleNameError = 1*(%d33-60/%d62-126)\nDefinedAsTest = DefinedAs / DefinedAsError\nDefinedAsError = 1*2%d33-126\nDefinedAs = IncAlt / Defined\nDefined = %d61\nIncAlt = %d61.47\nRuleError = 1*(%d32-126 / %d9 / LineContinue) LineEnd\nLineEndError = 1*(%d32-126 / %d9 / LineContinue)\nAlternation = Concatenation *(owsp AltOp Concatenation)\nConcatenation = Repetition *(CatOp Repetition)\nRepetition = [Modifier] (Group / Option / BasicElement / BasicElementErr)\nModifier = (Predicate [RepOp])\n / RepOp\nPredicate = BkaOp\n / BknOp\n / AndOp\n / NotOp\nBasicElement = UdtOp\n / RnmOp\n / TrgOp\n / TbsOp\n / TlsOp\n / ClsOp\n / BkrOp\n / AbgOp\n / AenOp\n / ProsVal\nBasicElementErr = 1*(%d33-40/%d42-46/%d48-92/%d94-126)\nGroup = GroupOpen Alternation (GroupClose / GroupError)\nGroupError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr\nGroupOpen = %d40 owsp\nGroupClose = owsp %d41\nOption = OptionOpen Alternation (OptionClose / OptionError)\nOptionError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr\nOptionOpen = %d91 owsp\nOptionClose = owsp %d93\nRnmOp = alphanum\nBkrOp = %d92 [bkrModifier] bkr-name\nbkrModifier = (cs [um / pm]) / (ci [um / pm]) / (um [cs /ci]) / (pm [cs / ci])\ncs = '%s'\nci = '%i'\num = '%u'\npm = '%p'\nbkr-name = uname / ename / rname\nrname = alphanum\nuname = %d117.95 alphanum\nename = %d101.95 alphanum\nUdtOp = udt-empty\n / udt-non-empty\nudt-non-empty = %d117.95 alphanum\nudt-empty = %d101.95 alphanum\nRepOp = (rep-min StarOp rep-max)\n / (rep-min StarOp)\n / (StarOp rep-max)\n / StarOp\n / rep-min-max\nAltOp = %d47 owsp\nCatOp = wsp\nStarOp = %d42\nAndOp = %d38\nNotOp = %d33\nBkaOp = %d38.38\nBknOp = %d33.33\nAbgOp = %d37.94\nAenOp = %d37.36\nTrgOp = %d37 ((Dec dmin %d45 dmax) / (Hex xmin %d45 xmax) / (Bin bmin %d45 bmax))\nTbsOp = %d37 ((Dec dString *(%d46 dString)) / (Hex xString *(%d46 xString)) / (Bin bString *(%d46 bString)))\nTlsOp = TlsCase TlsOpen TlsString TlsClose\nTlsCase = [\"%i\" / \"%s\"]\nTlsOpen = %d34\nTlsClose = %d34\nTlsString = *(%d32-33/%d35-126/StringTab)\nStringTab = %d9\nClsOp = ClsOpen ClsString ClsClose\nClsOpen = %d39\nClsClose = %d39\nClsString = *(%d32-38/%d40-126/StringTab)\nProsVal = ProsValOpen ProsValString ProsValClose\nProsValOpen = %d60\nProsValString = *(%d32-61/%d63-126/StringTab)\nProsValClose = %d62\nrep-min = rep-num\nrep-min-max = rep-num\nrep-max = rep-num\nrep-num = 1*(%d48-57)\ndString = dnum\nxString = xnum\nbString = bnum\nDec = (%d68/%d100)\nHex = (%d88/%d120)\nBin = (%d66/%d98)\ndmin = dnum\ndmax = dnum\nbmin = bnum\nbmax = bnum\nxmin = xnum\nxmax = xnum\ndnum = 1*(%d48-57)\nbnum = 1*%d48-49\nxnum = 1*(%d48-57 / %d65-70 / %d97-102)\n;\n; Basics\nalphanum = (%d97-122/%d65-90) *(%d97-122/%d65-90/%d48-57/%d45)\nowsp = *space\nwsp = 1*space\nspace = %d32\n / %d9\n / comment\n / LineContinue\ncomment = %d59 *(%d32-126 / %d9)\nLineEnd = %d13.10\n / %d10\n / %d13\nLineContinue = (%d13.10 / %d10 / %d13) (%d32 / %d9)\n"}}},3479:(t,e,r)=>{const n=r(8276),i=r(8544),o=[];o.line=function(t,e,r,i,o){return t===n.SEM_PRE?(o.endLength=0,o.textLength=0,o.invalidCount=0):o.lines.push({lineNo:o.lines.length,beginChar:r,length:i,textLength:o.textLength,endType:o.endType,invalidChars:o.invalidCount}),n.SEM_OK},o["line-text"]=function(t,e,r,i,o){return t===n.SEM_PRE&&(o.textLength=i),n.SEM_OK},o["last-line"]=function(t,e,r,i,o){return t===n.SEM_PRE?(o.endLength=0,o.textLength=0,o.invalidCount=0):o.strict?(o.lines.push({lineNo:o.lines.length,beginChar:r,length:i,textLength:i,endType:"none",invalidChars:o.invalidCount}),o.errors.push({line:o.lineNo,char:r+i,msg:"no line end on last line - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})):(e.push(10),o.lines.push({lineNo:o.lines.length,beginChar:r,length:i+1,textLength:i,endType:"LF",invalidChars:o.invalidCount})),n.SEM_OK},o.invalid=function(t,e,r,o,s){return t===n.SEM_PRE&&s.errors.push({line:s.lineNo,char:r,msg:`invalid character found '\\x${i.charToHex(e[r])}'`}),n.SEM_OK},o.end=function(t,e,r,i,o){return t===n.SEM_POST&&(o.lineNo+=1),n.SEM_OK},o.lf=function(t,e,r,i,o){return t===n.SEM_PRE&&(o.endType="LF",o.strict&&o.errors.push({line:o.lineNo,char:r,msg:"line end character LF(\\n, \\x0A) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),n.SEM_OK},o.cr=function(t,e,r,i,o){return t===n.SEM_PRE&&(o.endType="CR",o.strict&&o.errors.push({line:o.lineNo,char:r,msg:"line end character CR(\\r, \\x0D) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),n.SEM_OK},o.crlf=function(t,e,r,i,o){return t===n.SEM_PRE&&(o.endType="CRLF"),n.SEM_OK},e.callbacks=o},6410:t=>{t.exports=function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"file",lower:"file",index:0,isBkr:!1},this.rules[1]={name:"line",lower:"line",index:1,isBkr:!1},this.rules[2]={name:"line-text",lower:"line-text",index:2,isBkr:!1},this.rules[3]={name:"last-line",lower:"last-line",index:3,isBkr:!1},this.rules[4]={name:"valid",lower:"valid",index:4,isBkr:!1},this.rules[5]={name:"invalid",lower:"invalid",index:5,isBkr:!1},this.rules[6]={name:"end",lower:"end",index:6,isBkr:!1},this.rules[7]={name:"CRLF",lower:"crlf",index:7,isBkr:!1},this.rules[8]={name:"LF",lower:"lf",index:8,isBkr:!1},this.rules[9]={name:"CR",lower:"cr",index:9,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:2,children:[1,3]},this.rules[0].opcodes[1]={type:3,min:0,max:1/0},this.rules[0].opcodes[2]={type:4,index:1},this.rules[0].opcodes[3]={type:3,min:0,max:1},this.rules[0].opcodes[4]={type:4,index:3},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,2]},this.rules[1].opcodes[1]={type:4,index:2},this.rules[1].opcodes[2]={type:4,index:6},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:3,min:0,max:1/0},this.rules[2].opcodes[1]={type:1,children:[2,3]},this.rules[2].opcodes[2]={type:4,index:4},this.rules[2].opcodes[3]={type:4,index:5},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:3,min:1,max:1/0},this.rules[3].opcodes[1]={type:1,children:[2,3]},this.rules[3].opcodes[2]={type:4,index:4},this.rules[3].opcodes[3]={type:4,index:5},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:5,min:32,max:126},this.rules[4].opcodes[2]={type:6,string:[9]},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[5].opcodes[1]={type:5,min:0,max:8},this.rules[5].opcodes[2]={type:5,min:11,max:12},this.rules[5].opcodes[3]={type:5,min:14,max:31},this.rules[5].opcodes[4]={type:5,min:127,max:4294967295},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:1,children:[1,2,3]},this.rules[6].opcodes[1]={type:4,index:7},this.rules[6].opcodes[2]={type:4,index:8},this.rules[6].opcodes[3]={type:4,index:9},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:6,string:[13,10]},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:6,string:[10]},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:6,string:[13]},this.toString=function(){let t="";return t+="file = *line [last-line]\n",t+="line = line-text end\n",t+="line-text = *(valid/invalid)\n",t+="last-line = 1*(valid/invalid)\n",t+="valid = %d32-126 / %d9\n",t+="invalid = %d0-8 / %d11-12 /%d14-31 / %x7f-ffffffff\n",t+="end = CRLF / LF / CR\n",t+="CRLF = %d13.10\n",t+="LF = %d10\n",t+="CR = %d13\n","file = *line [last-line]\nline = line-text end\nline-text = *(valid/invalid)\nlast-line = 1*(valid/invalid)\nvalid = %d32-126 / %d9\ninvalid = %d0-8 / %d11-12 /%d14-31 / %x7f-ffffffff\nend = CRLF / LF / CR\nCRLF = %d13.10\nLF = %d10\nCR = %d13\n"}}},1789:(t,e,r)=>{t.exports=function(t,e,n,i){const o=r(8737),s=new(r(6410)),{callbacks:a}=r(3479),u=[],l=new o.parser;if(l.ast=new o.ast,l.ast.callbacks=a,i){if("traceObject"!==i.traceObject)throw new TypeError("scanner.js: trace argument is not a trace object");l.trace=i}if(!0!==l.parse(s,"file",t).success)return void e.push({line:0,char:0,msg:"syntax analysis error analyzing input SABNF grammar"});const h={lines:u,lineNo:0,errors:e,strict:!!n};return l.ast.translate(h),u}},1832:(t,e,r)=>{t.exports=function(){const t=r(8737),e=t.ids,n=function(){this.names=[],this.add=function(t){let e=-1;return-1===this.get(t)&&(e={name:t,lower:t.toLowerCase(),index:this.names.length},this.names.push(e)),e},this.get=function(t){let e=-1;const r=t.toLowerCase();for(let t=0;t=48&&e<=57)e-=48;else if(e>=65&&e<=70)e-=55;else{if(!(e>=97&&e<=102))throw new Error("hexnum out of range");e-=87}n=16*n+e}return n};this.callbacks=[],this.callbacks.abgop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.ABG}),s},this.callbacks.aenop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.AEN}),s},this.callbacks.alternation=function(t,r,n,i,o){let s=e.SEM_OK;if(t===e.SEM_PRE){const t=!0;for(;t;){if(null===o.definedas){s=e.SEM_SKIP;break}if(null===o.topStack){if("="===o.definedas){o.topStack={alt:{type:e.ALT,children:[]},cat:null},o.altStack.push(o.topStack),o.opcodes.push(o.topStack.alt);break}o.topStack={alt:o.opcodes[0],cat:null},o.altStack.push(o.topStack);break}o.topStack={alt:{type:e.ALT,children:[]},cat:null},o.altStack.push(o.topStack),o.opcodes.push(o.topStack.alt);break}}else t===e.SEM_POST&&(o.altStack.pop(),o.altStack.length>0?o.topStack=o.altStack[o.altStack.length-1]:o.topStack=null);return s},this.callbacks.andop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.AND}),s},this.callbacks.bmax=function(t,r,n,i,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.max=o(r,n,i)),a},this.callbacks.bmin=function(t,r,n,i,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.min=o(r,n,i)),a},this.callbacks.bkaop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.BKA}),s},this.callbacks.bknop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.BKN}),s},this.callbacks.bkrop=function(r,n,i,o,s){const a=e.SEM_OK;return r===e.SEM_PRE?(s.ci=!0,s.cs=!1,s.um=!0,s.pm=!1):r===e.SEM_POST&&s.opcodes.push({type:e.BKR,bkrCase:!0===s.cs?e.BKR_MODE_CS:e.BKR_MODE_CI,bkrMode:!0===s.pm?e.BKR_MODE_PM:e.BKR_MODE_UM,index:{phraseIndex:s.bkrname.phraseIndex,name:t.utils.charsToString(n,s.bkrname.phraseIndex,s.bkrname.phraseLength)}}),a},this.callbacks["bkr-name"]=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.bkrname={phraseIndex:n,phraseLength:i}),s},this.callbacks.bstring=function(t,r,n,i,s){const a=e.SEM_OK;return t===e.SEM_POST&&s.tbsstr.push(o(r,n,i)),a},this.callbacks.clsop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(i<=2?o.opcodes.push({type:e.TLS,string:[]}):o.opcodes.push({type:e.TBS,string:r.slice(n+1,n+i-1)})),s},this.callbacks.ci=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.ci=!0),s},this.callbacks.cs=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.cs=!0),s},this.callbacks.um=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.um=!0),s},this.callbacks.pm=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.pm=!0),s},this.callbacks.concatenation=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE?(o.topStack.alt.children.push(o.opcodes.length),o.topStack.cat={type:e.CAT,children:[]},o.opcodes.push(o.topStack.cat)):t===e.SEM_POST&&(o.topStack.cat=null),s},this.callbacks.defined=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.definedas="="),s},this.callbacks.dmax=function(t,r,n,o,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.max=i(r,n,o)),a},this.callbacks.dmin=function(t,r,n,o,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.min=i(r,n,o)),a},this.callbacks.dstring=function(t,r,n,o,s){const a=e.SEM_OK;return t===e.SEM_POST&&s.tbsstr.push(i(r,n,o)),a},this.callbacks.file=function(t,r,i,o,s){const a=e.SEM_OK;if(t===e.SEM_PRE)s.ruleNames=new n,s.udtNames=new n,s.rules=[],s.udts=[],s.rulesLineMap=[],s.opcodes=[],s.altStack=[],s.topStack=null,s.topRule=null;else if(t===e.SEM_POST){let t;s.rules.forEach((r=>{r.isBkr=!1,r.opcodes.forEach((r=>{r.type===e.RNM&&(t=s.ruleNames.get(r.index.name),-1===t?(s.errors.push({line:s.findLine(s.lines,r.index.phraseIndex,s.charsLength),char:r.index.phraseIndex,msg:`Rule name '${r.index.name}' used but not defined.`}),r.index=-1):r.index=t.index)}))})),s.udts.forEach((t=>{t.isBkr=!1})),s.rules.forEach((r=>{r.opcodes.forEach((n=>{n.type===e.BKR&&(r.hasBkr=!0,t=s.ruleNames.get(n.index.name),-1!==t?(s.rules[t.index].isBkr=!0,n.index=t.index):(t=s.udtNames.get(n.index.name),-1!==t?(s.udts[t.index].isBkr=!0,n.index=s.rules.length+t.index):(s.errors.push({line:s.findLine(s.lines,n.index.phraseIndex,s.charsLength),char:n.index.phraseIndex,msg:`Back reference name '${n.index.name}' refers to undefined rule or unamed UDT.`}),n.index=-1)))}))}))}return a},this.callbacks.incalt=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.definedas="=/"),s},this.callbacks.notop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.NOT}),s},this.callbacks.optionopen=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.REP,min:0,max:1,char:n}),s},this.callbacks["rep-max"]=function(t,r,n,o,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.max=i(r,n,o)),a},this.callbacks["rep-min"]=function(t,r,n,o,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.min=i(r,n,o)),a},this.callbacks["rep-min-max"]=function(t,r,n,o,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.max=i(r,n,o),s.min=s.max),a},this.callbacks.repetition=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE&&o.topStack.cat.children.push(o.opcodes.length),s},this.callbacks.repop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE?(o.min=0,o.max=1/0,o.topRep={type:e.REP,min:0,max:1/0},o.opcodes.push(o.topRep)):t===e.SEM_POST&&(o.min>o.max&&o.errors.push({line:o.findLine(o.lines,n,o.charsLength),char:n,msg:`repetition min cannot be greater than max: min: ${o.min}: max: ${o.max}`}),o.topRep.min=o.min,o.topRep.max=o.max),s},this.callbacks.rnmop=function(r,n,i,o,s){const a=e.SEM_OK;return r===e.SEM_POST&&s.opcodes.push({type:e.RNM,index:{phraseIndex:i,name:t.utils.charsToString(n,i,o)}}),a},this.callbacks.rule=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE&&(o.altStack.length=0,o.topStack=null,o.rulesLineMap.push({line:o.findLine(o.lines,n,o.charsLength),char:n})),s},this.callbacks.rulelookup=function(t,r,n,i,o){const s=e.SEM_OK;if(t===e.SEM_PRE)o.ruleName="",o.definedas="";else if(t===e.SEM_POST){let t;"="===o.definedas?(t=o.ruleNames.add(o.ruleName),-1===t?(o.definedas=null,o.errors.push({line:o.findLine(o.lines,n,o.charsLength),char:n,msg:`Rule name '${o.ruleName}' previously defined.`})):(o.topRule={name:t.name,lower:t.lower,opcodes:[],index:t.index},o.rules.push(o.topRule),o.opcodes=o.topRule.opcodes)):(t=o.ruleNames.get(o.ruleName),-1===t?(o.definedas=null,o.errors.push({line:o.findLine(o.lines,n,o.charsLength),char:n,msg:`Rule name '${o.ruleName}' for incremental alternate not previously defined.`})):(o.topRule=o.rules[t.index],o.opcodes=o.topRule.opcodes))}return s},this.callbacks.rulename=function(r,n,i,o,s){const a=e.SEM_OK;return r===e.SEM_PRE&&(s.ruleName=t.utils.charsToString(n,i,o)),a},this.callbacks.tbsop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE?o.tbsstr=[]:t===e.SEM_POST&&o.opcodes.push({type:e.TBS,string:o.tbsstr}),s},this.callbacks.tlscase=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&i>0&&(83===r[n+1]||115===r[n+1])&&(o.tlscase=!1),s},this.callbacks.tlsstring=function(t,r,n,i,o){const s=e.SEM_OK;if(t===e.SEM_POST)if(o.tlscase){const t=r.slice(n,n+i);for(let e=0;e=65&&t[e]<=90&&(t[e]+=32);o.opcodes.push({type:e.TLS,string:t})}else o.opcodes.push({type:e.TBS,string:r.slice(n,n+i)});return s},this.callbacks.tlsop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE&&(o.tlscase=!0),s},this.callbacks.trgop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE?(o.min=0,o.max=0):t===e.SEM_POST&&(o.min>o.max&&o.errors.push({line:o.findLine(o.lines,n,o.charsLength),char:n,msg:`TRG, (%dmin-max), min cannot be greater than max: min: ${o.min}: max: ${o.max}`}),o.opcodes.push({type:e.TRG,min:o.min,max:o.max})),s},this.callbacks["udt-empty"]=function(r,n,i,o,s){const a=e.SEM_OK;if(r===e.SEM_POST){const r=t.utils.charsToString(n,i,o);let a=s.udtNames.add(r);if(-1===a){if(a=s.udtNames.get(r),-1===a)throw new Error("semUdtEmpty: name look up error")}else s.udts.push({name:a.name,lower:a.lower,index:a.index,empty:!0});s.opcodes.push({type:e.UDT,empty:!0,index:a.index})}return a},this.callbacks["udt-non-empty"]=function(r,n,i,o,s){const a=e.SEM_OK;if(r===e.SEM_POST){const r=t.utils.charsToString(n,i,o);let a=s.udtNames.add(r);if(-1===a){if(a=s.udtNames.get(r),-1===a)throw new Error("semUdtNonEmpty: name look up error")}else s.udts.push({name:a.name,lower:a.lower,index:a.index,empty:!1});s.opcodes.push({type:e.UDT,empty:!1,index:a.index,syntax:null,semantic:null})}return a},this.callbacks.xmax=function(t,r,n,i,o){const a=e.SEM_OK;return t===e.SEM_POST&&(o.max=s(r,n,i)),a},this.callbacks.xmin=function(t,r,n,i,o){const a=e.SEM_OK;return t===e.SEM_POST&&(o.min=s(r,n,i)),a},this.callbacks.xstring=function(t,r,n,i,o){const a=e.SEM_OK;return t===e.SEM_POST&&o.tbsstr.push(s(r,n,i)),a}}},2595:t=>{t.exports=function(){const t="show-rules.js";return function(e=[],r=[],n="index"){const i="showRules";let o=[],s=[];const a=[],u=[],l=e,h=r,c=e.length,f=r.length;let d,p="RULE/UDT NAMES";if(!Array.isArray(e)||!e.length)throw new Error(`${t}:${i}: rules arg must be array with length > 0`);if(!Array.isArray(r))throw new Error(`${t}:${i}: udts arg must be array`);for(d=0;dl[e].lower?1:0})),f){for(d=0;dh[e].lower?1:0}))}if(97===n.charCodeAt(0)){for(p+=" - alphabetical by rule/UDT name\n",d=0;d{t.exports=function(){const t="syntax-callbacks.js: ",e=r(8737),n=e.ids;let i;this.callbacks=[],this.callbacks.andop=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.strict&&o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"AND operator(&) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.basicelementerr=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:!1===i.basicError&&s.errors.push({line:s.findLine(s.lines,o,s.charsLength),char:o,msg:"Unrecognized SABNF element."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.clsclose=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:break;case n.NOMATCH:s.errors.push({line:s.findLine(s.lines,i.clsOpen),char:i.clsOpen,msg:"Case-sensitive literal string('...') opened but not closed."}),i.clsOpen=null,i.basicError=!0;break;case n.MATCH:s.strict&&s.errors.push({line:s.findLine(s.lines,i.clsOpen),char:i.clsOpen,msg:"Case-sensitive string operator('...') found - strict ABNF specified."}),i.clsOpen=null;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.clsopen=function(e,r,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:i.clsOpen=o;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.clsstring=function(e,r,i,o){switch(e.state){case n.ACTIVE:o.stringTabChar=!1;break;case n.EMPTY:case n.NOMATCH:break;case n.MATCH:!1!==o.stringTabChar&&o.errors.push({line:o.findLine(o.lines,o.stringTabChar),char:o.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.definedaserror=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Expected '=' or '=/'. Not found."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.file=function(e,r,i,o){switch(e.state){case n.ACTIVE:o.altStack=[],o.repCount=0;break;case n.EMPTY:o.errors.push({line:0,char:0,msg:"grammar file is empty"});break;case n.MATCH:0===o.ruleCount&&o.errors.push({line:0,char:0,msg:"no rules defined"});break;case n.NOMATCH:throw new Error(`${t}synFile: grammar file NOMATCH: design error: should never happen.`);default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.groupclose=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:break;case n.NOMATCH:s.errors.push({line:s.findLine(s.lines,i.groupOpen),char:i.groupOpen,msg:'Group "(...)" opened but not closed.'}),i=s.altStack.pop(),i.groupError=!0;break;case n.MATCH:i=s.altStack.pop();break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.groupopen=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:i={groupOpen:o,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},s.altStack.push(i);break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.lineenderror=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Unrecognized grammar element or characters."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.lineend=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:if(1===e.phraseLength&&o.strict){const t=13===r[i]?"CR":"LF";o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:`Line end '${t}' found - strict ABNF specified, only CRLF allowed.`})}break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.notop=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.strict&&o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"NOT operator(!) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.optionclose=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:break;case n.NOMATCH:s.errors.push({line:s.findLine(s.lines,i.optionOpen),char:i.optionOpen,msg:'Option "[...]" opened but not closed.'}),i=s.altStack.pop(),i.optionError=!0;break;case n.MATCH:i=s.altStack.pop();break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.optionopen=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:i={groupOpen:null,groupError:!1,optionOpen:o,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},s.altStack.push(i);break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.prosvalclose=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:break;case n.NOMATCH:s.errors.push({line:s.findLine(s.lines,i.prosValOpen),char:i.prosValOpen,msg:"Prose value operator(<...>) opened but not closed."}),i.basicError=!0,i.prosValOpen=null;break;case n.MATCH:s.errors.push({line:s.findLine(s.lines,i.prosValOpen),char:i.prosValOpen,msg:"Prose value operator(<...>) found. The ABNF syntax is valid, but a parser cannot be generated from this grammar."}),i.prosValOpen=null;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.prosvalopen=function(e,r,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:i.prosValOpen=o;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.prosvalstring=function(e,r,i,o){switch(e.state){case n.ACTIVE:o.stringTabChar=!1;break;case n.EMPTY:case n.NOMATCH:break;case n.MATCH:!1!==o.stringTabChar&&o.errors.push({line:o.findLine(o.lines,o.stringTabChar),char:o.stringTabChar,msg:"Tab character (\\t, x09) not allowed in prose value string."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.repetition=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:break;case n.NOMATCH:case n.MATCH:o.repCount+=1;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.rule=function(e,r,o,s){switch(e.state){case n.ACTIVE:s.altStack.length=0,i={groupOpen:null,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},s.altStack.push(i);break;case n.EMPTY:throw new Error(`${t}synRule: EMPTY: rule cannot be empty`);case n.NOMATCH:break;case n.MATCH:s.ruleCount+=1;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.ruleerror=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Unrecognized SABNF line. Invalid rule, comment or blank line."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.rulenameerror=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Rule names must be alphanum and begin with alphabetic character."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.stringtab=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.stringTabChar=i;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.tlsclose=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:break;case n.NOMATCH:s.errors.push({line:s.findLine(s.lines,i.tlsOpen),char:i.tlsOpen,msg:'Case-insensitive literal string("...") opened but not closed.'}),i.basicError=!0,i.tlsOpen=null;break;case n.MATCH:i.tlsOpen=null;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.tlsopen=function(e,r,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:i.tlsOpen=o;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.tlsstring=function(e,r,i,o){switch(e.state){case n.ACTIVE:o.stringTabChar=!1;break;case n.EMPTY:case n.NOMATCH:break;case n.MATCH:!1!==o.stringTabChar&&o.errors.push({line:o.findLine(o.lines,o.stringTabChar),char:o.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string (see 'quoted-string' definition, RFC 7405.)"});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.udtop=function(r,i,o,s){switch(r.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:if(s.strict){const t=e.utils.charsToString(i,o,r.phraseLength);s.errors.push({line:s.findLine(s.lines,o,s.charsLength),char:o,msg:`UDT operator found(${t}) - strict ABNF specified.`})}break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.bkaop=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.strict&&o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Positive look-behind operator(&&) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.bknop=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.strict&&o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Negative look-behind operator(!!) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.bkrop=function(r,i,o,s){switch(r.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:if(s.strict){const t=e.utils.charsToString(i,o,r.phraseLength);s.errors.push({line:s.findLine(s.lines,o,s.charsLength),char:o,msg:`Back reference operator(${t}) found - strict ABNF specified.`})}break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.abgop=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.strict&&o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Beginning of string anchor(%^) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.aenop=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.strict&&o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"End of string anchor(%$) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}}}},979:function(t,e,r){const n=this,i=r(6322),o="UTF8",s="UTF16",a="UTF16BE",u="UTF16LE",l="UTF32",h="UTF32BE",c="UTF32LE",f="UINT7",d="ASCII",p="BINARY",m="UINT8",g="UINT16",v="UINT16LE",y="UINT16BE",b="UINT32",w="UINT32LE",E="UINT32BE",M="ESCAPED",A="STRING",_=function(t,e){switch(t){case o:return i.utf8.encode(e);case a:return i.utf16be.encode(e);case u:return i.utf16le.encode(e);case h:return i.utf32be.encode(e);case c:return i.utf32le.encode(e);case f:return i.uint7.encode(e);case m:return i.uint8.encode(e);case y:return i.uint16be.encode(e);case v:return i.uint16le.encode(e);case E:return i.uint32be.encode(e);case w:return i.uint32le.encode(e);case A:return i.string.encode(e);case M:return i.escaped.encode(e);default:throw new TypeError(`encode type "${t}" not recognized`)}};e.decode=function(t,e){return function(t){switch(t.type){case o:return i.utf8.decode(t.data,t.bom);case u:return i.utf16le.decode(t.data,t.bom);case a:return i.utf16be.decode(t.data,t.bom);case h:return i.utf32be.decode(t.data,t.bom);case c:return i.utf32le.decode(t.data,t.bom);case f:return i.uint7.decode(t.data);case m:return i.uint8.decode(t.data);case y:return i.uint16be.decode(t.data);case v:return i.uint16le.decode(t.data);case E:return i.uint32be.decode(t.data);case w:return i.uint32le.decode(t.data);case A:return i.string.decode(t.data);case M:return i.escaped.decode(t.data);default:throw new TypeError(`decode type "${t.type}" not recognized`)}}(function(t,e){if("string"!=typeof t||""===t)throw new TypeError(`type: "${t}" not recognized`);const r=function(t){const e={type:"",base64:!1},r=/^(base64:)?([a-zA-Z0-9]+)$/i.exec(t);return r&&(r[2]&&(e.type=r[2].toUpperCase()),r[1]&&(e.base64=!0)),e}(t.toUpperCase());if(r.base64){if(r.type===A)throw new TypeError(`type: "${t} "BASE64:" prefix not allowed with type ${A}`);if(Buffer.isBuffer(e))r.data=i.base64.decode(e);else{if("string"!=typeof e)throw new TypeError(`type: "${t} unrecognized data type: typeof(data): ${typeof e}`);{const t=Buffer.from(e,"ascii");r.data=i.base64.decode(t)}}}else r.data=e;switch(r.type){case o:!function(t){t.type=o;const e=t.data;t.bom=0,e.length>=3&&239===e[0]&&187===e[1]&&191===e[2]&&(t.bom=3)}(r);break;case s:case a:case u:!function(t){const e=t.data;switch(t.bom=0,t.type){case s:t.type=a,e.length>=2&&(254===e[0]&&255===e[1]?t.bom=2:255===e[0]&&254===e[1]&&(t.type=u,t.bom=2));break;case a:if(t.type=a,e.length>=2)if(254===e[0]&&255===e[1])t.bom=2;else if(255===e[0]&&254===e[1])throw new TypeError(`src type: "${a}" specified but BOM is for "${u}"`);break;case u:if(t.type=u,e.length>=0){if(254===e[0]&&255===e[1])throw new TypeError(`src type: "${u}" specified but BOM is for "${a}"`);255===e[0]&&254===e[1]&&(t.bom=2)}break;default:throw new TypeError(`UTF16 BOM: src type "${t.type}" unrecognized`)}}(r);break;case l:case h:case c:!function(t){const e=t.data;switch(t.bom=0,t.type){case l:t.type=h,e.length>=4&&(0===e[0]&&0===e[1]&&254===e[2]&&255===e[3]&&(t.bom=4),255===e[0]&&254===e[1]&&0===e[2]&&0===e[3]&&(t.type=c,t.bom=4));break;case h:if(t.type=h,e.length>=4&&(0===e[0]&&0===e[1]&&254===e[2]&&255===e[3]&&(t.bom=4),255===e[0]&&254===e[1]&&0===e[2]&&0===e[3]))throw new TypeError(`src type: ${h} specified but BOM is for ${c}"`);break;case c:if(t.type=c,e.length>=4){if(0===e[0]&&0===e[1]&&254===e[2]&&255===e[3])throw new TypeError(`src type: "${c}" specified but BOM is for "${h}"`);255===e[0]&&254===e[1]&&0===e[2]&&0===e[3]&&(t.bom=4)}break;default:throw new TypeError(`UTF32 BOM: src type "${t.type}" unrecognized`)}}(r);break;case g:r.type=y;break;case b:r.type=E;break;case d:r.type=f;break;case p:r.type=m;break;case f:case m:case v:case y:case w:case E:case A:case M:break;default:throw new TypeError(`type: "${t}" not recognized`)}if(r.type===A){if("string"!=typeof r.data)throw new TypeError(`type: "${t}" but data is not a string`)}else if(!Buffer.isBuffer(r.data))throw new TypeError(`type: "${t}" but data is not a Buffer`);return r}(t,e))},e.encode=function(t,e){let r,n;const N=function(t,e){if(!Array.isArray(e))throw new TypeError('dst chars: not array: "'+typeof e);if("string"!=typeof t)throw new TypeError('dst type: not string: "'+typeof t);const r=function(t){let e,r;const n={crlf:!1,lf:!1,base64:!1,type:""};for(;;){if(r=t,e=t.slice(0,5),"CRLF:"===e){n.crlf=!0,r=t.slice(5);break}if(e=t.slice(0,3),"LF:"===e){n.lf=!0,r=t.slice(3);break}break}return e=r.split(":"),1===e.length?n.type=e[0]:2===e.length&&"BASE64"===e[1]&&(n.base64=!0,n.type=e[0]),n}(t.toUpperCase());switch(r.type){case o:case a:case u:case h:case c:case f:case m:case v:case y:case w:case E:case M:break;case A:if(r.base64)throw new TypeError(`":BASE64" suffix not allowed with type ${A}`);break;case d:r.type=f;break;case p:r.type=m;break;case s:r.type=a;break;case l:r.type=h;break;case g:r.type=y;break;case b:r.type=E;break;default:throw new TypeError(`dst type unrecognized: "${t}" : must have form [crlf:|lf:]type[:base64]`)}return r}(t,e);return N.crlf?(r=i.lineEnds.crlf(e),n=_(N.type,r)):N.lf?(r=i.lineEnds.lf(e),n=_(N.type,r)):n=_(N.type,e),N.base64&&(n=i.base64.encode(n)),n},e.convert=function(t,e,r){return n.encode(r,n.decode(t,e))}},6322:function(t,e){const r=this,n=4294967292,i=4294967293,o=4294967294,s=4294967295,a=[0,1,3,7,15,31,63,127,255,511,1023],u=["00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F","10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F","20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F","30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F","40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F","50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F","60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F","70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F","80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F","90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF","B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF","C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF","D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF","F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"],l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),h=[];l.forEach((t=>{h.push(t.charCodeAt(0))})),e.utf8={encode(t){const e=[];return t.forEach((t=>{if(t>=0&&t<=127)e.push(t);else if(t<=2047)e.push(192+(t>>6&a[5])),e.push(128+(t&a[6]));else if(t<55296||t>57343&&t<=65535)e.push(224+(t>>12&a[4])),e.push(128+(t>>6&a[6])),e.push(128+(t&a[6]));else{if(!(t>=65536&&t<=1114111))throw new RangeError(`utf8.encode: character out of range: char: ${t}`);{const r=t>>16&a[5];e.push(240+(r>>2)),e.push(128+((r&a[2])<<4)+(t>>12&a[4])),e.push(128+(t>>6&a[6])),e.push(128+(t&a[6]))}}})),Buffer.from(e)},decode(t,e){function r(t,e){if(128!=(192&e))return i;const r=((t&a[5])<<6)+(e&a[6]);return r<128?n:r}function u(t,e,r){if(128!=(192&r)||128!=(192&e))return i;const s=((t&a[4])<<12)+((e&a[6])<<6)+(r&a[6]);return s<2048?n:s>=55296&&s<=57343?o:s}function l(t,e,r,s){if(128!=(192&s)||128!=(192&r)||128!=(192&e))return i;const u=(((t&a[3])<<2)+(e>>4&a[2])<<16)+((e&a[4])<<12)+((r&a[6])<<6)+(s&a[6]);return u<65536?n:u>1114111?o:u}let h,c,f,d,p,m;const g=t.length;let v=e?3:0;const y=[];for(;v=0&&c<=127){h=c,m=1;break}if(f=v+1,f=194&&c<=223){h=r(c,t[f]),m=2;break}if(d=v+2,d=224&&c<=239){h=u(c,t[f],t[d]),m=3;break}if(p=v+3,p=240&&c<=244){h=l(c,t[f],t[d],t[p]),m=4;break}break}if(h>1114111){const t=`byte[${v}]`;if(h===s)throw new RangeError(`utf8.decode: ill-formed UTF8 byte sequence found at: ${t}`);if(h===i)throw new RangeError(`utf8.decode: illegal trailing byte found at: ${t}`);if(h===o)throw new RangeError(`utf8.decode: code point out of range found at: ${t}`);if(h===n)throw new RangeError(`utf8.decode: non-shortest form found at: ${t}`);throw new RangeError(`utf8.decode: unrecognized error found at: ${t}`)}y.push(h),v+=m}return y}},e.utf16be={encode(t){const e=[];let r,n,i;for(let o=0;o=0&&r<=55295||r>=57344&&r<=65535)e.push(r>>8&a[8]),e.push(r&a[8]);else{if(!(r>=65536&&r<=1114111))throw new RangeError(`utf16be.encode: UTF16BE value out of range: char[${o}]: ${r}`);i=r-65536,n=55296+(i>>10),i=56320+(i&a[10]),e.push(n>>8&a[8]),e.push(n&a[8]),e.push(i>>8&a[8]),e.push(i&a[8])}return Buffer.from(e)},decode(t,e){if(t.length%2>0)throw new RangeError(`utf16be.decode: data length must be even multiple of 2: length: ${t.length}`);const r=[],n=t.length;let i,o,s,a,u,l,h=e?2:0,c=0;for(;h57343){i=u,o=2;break}if(a=h+3,a=56320&&l<=57343)){i=65536+(u-55296<<10)+(l-56320),o=4;break}}throw new RangeError(`utf16be.decode: ill-formed UTF16BE byte sequence found: byte[${h}]`)}r[c++]=i,h+=o}return r}},e.utf16le={encode(t){const e=[];let r,n,i;for(let o=0;o=0&&r<=55295||r>=57344&&r<=65535)e.push(r&a[8]),e.push(r>>8&a[8]);else{if(!(r>=65536&&r<=1114111))throw new RangeError(`utf16le.encode: UTF16LE value out of range: char[${o}]: ${r}`);i=r-65536,n=55296+(i>>10),i=56320+(i&a[10]),e.push(n&a[8]),e.push(n>>8&a[8]),e.push(i&a[8]),e.push(i>>8&a[8])}return Buffer.from(e)},decode(t,e){if(t.length%2>0)throw new RangeError(`utf16le.decode: data length must be even multiple of 2: length: ${t.length}`);const r=[],n=t.length;let i,o,s,a,u,l,h=e?2:0,c=0;for(;h57343){i=u,o=2;break}if(a=h+3,a=56320&&l<=57343)){i=65536+(u-55296<<10)+(l-56320),o=4;break}}throw new RangeError(`utf16le.decode: ill-formed UTF16LE byte sequence found: byte[${h}]`)}r[c++]=i,h+=o}return r}},e.utf32be={encode(t){const e=Buffer.alloc(4*t.length);let r=0;return t.forEach((t=>{if(t>=55296&&t<=57343||t>1114111)throw new RangeError(`utf32be.encode: UTF32BE character code out of range: char[${r/4}]: ${t}`);e[r++]=t>>24&a[8],e[r++]=t>>16&a[8],e[r++]=t>>8&a[8],e[r++]=t&a[8]})),e},decode(t,e){if(t.length%4>0)throw new RangeError(`utf32be.decode: UTF32BE byte length must be even multiple of 4: length: ${t.length}`);const r=[];let n=e?4:0;for(;n=55296&&e<=57343||e>1114111)throw new RangeError(`utf32be.decode: UTF32BE character code out of range: char[${n/4}]: ${e}`);r.push(e)}return r}},e.utf32le={encode(t){const e=Buffer.alloc(4*t.length);let r=0;return t.forEach((t=>{if(t>=55296&&t<=57343||t>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${r/4}]: ${t}`);e[r++]=t&a[8],e[r++]=t>>8&a[8],e[r++]=t>>16&a[8],e[r++]=t>>24&a[8]})),e},decode(t,e){if(t.length%4>0)throw new RangeError(`utf32be.decode: UTF32LE byte length must be even multiple of 4: length: ${t.length}`);const r=[];let n=e?4:0;for(;n=55296&&e<=57343||e>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${n/4}]: ${e}`);r.push(e)}return r}},e.uint7={encode(t){const e=Buffer.alloc(t.length);for(let r=0;r127)throw new RangeError(`uint7.encode: UINT7 character code out of range: char[${r}]: ${t[r]}`);e[r]=t[r]}return e},decode(t){const e=[];for(let r=0;r127)throw new RangeError(`uint7.decode: UINT7 character code out of range: byte[${r}]: ${t[r]}`);e[r]=t[r]}return e}},e.uint8={encode(t){const e=Buffer.alloc(t.length);for(let r=0;r255)throw new RangeError(`uint8.encode: UINT8 character code out of range: char[${r}]: ${t[r]}`);e[r]=t[r]}return e},decode(t){const e=[];for(let r=0;r{if(t>65535)throw new RangeError(`uint16be.encode: UINT16BE character code out of range: char[${r/2}]: ${t}`);e[r++]=t>>8&a[8],e[r++]=t&a[8]})),e},decode(t){if(t.length%2>0)throw new RangeError(`uint16be.decode: UINT16BE byte length must be even multiple of 2: length: ${t.length}`);const e=[];for(let r=0;r{if(t>65535)throw new RangeError(`uint16le.encode: UINT16LE character code out of range: char[${r/2}]: ${t}`);e[r++]=t&a[8],e[r++]=t>>8&a[8]})),e},decode(t){if(t.length%2>0)throw new RangeError(`uint16le.decode: UINT16LE byte length must be even multiple of 2: length: ${t.length}`);const e=[];for(let r=0;r{e[r++]=t>>24&a[8],e[r++]=t>>16&a[8],e[r++]=t>>8&a[8],e[r++]=t&a[8]})),e},decode(t){if(t.length%4>0)throw new RangeError(`uint32be.decode: UINT32BE byte length must be even multiple of 4: length: ${t.length}`);const e=[];for(let r=0;r{e[r++]=t&a[8],e[r++]=t>>8&a[8],e[r++]=t>>16&a[8],e[r++]=t>>24&a[8]})),e},decode(t){if(t.length%4>0)throw new RangeError(`uint32le.decode: UINT32LE byte length must be even multiple of 4: length: ${t.length}`);const e=[];for(let r=0;rr.utf16le.encode(t).toString("utf16le"),decode:t=>r.utf16le.decode(Buffer.from(t,"utf16le"),0)},e.escaped={encode(t){const e=[];for(let r=0;r=32&&n<=126)e.push(n);else{let t="";if(n>=0&&n<=31)t+=`\`x${u[n]}`;else if(n>=127&&n<=255)t+=`\`x${u[n]}`;else if(n>=256&&n<=65535)t+=`\`u${u[n>>8&a[8]]}${u[n&a[8]]}`;else{if(!(n>=65536&&n<=4294967295))throw new Error("escape.encode(char): char > 0xffffffff not allowed");{t+="`u{";const e=n>>24&a[8];e>0&&(t+=u[e]),t+=`${u[n>>16&a[8]]+u[n>>8&a[8]]+u[n&a[8]]}}`}}Buffer.from(t).forEach((t=>{e.push(t)}))}}return Buffer.from(e)},decode(t){function e(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function r(t,r,n){const i={char:null,nexti:t+2,error:!0};if(t+1=s)break;if(96===t[a]){o.push(96),h+=2,l=!1;break}if(120===t[a]){if(u=r(a+1,s,t),u.error)break;o.push(u.char),h=u.nexti,l=!1;break}if(117===t[a]){if(123===t[a+1]){if(u=i(a+2,s,t),u.error)break;o.push(u.char),h=u.nexti,l=!1;break}if(u=n(a+1,s,t),u.error)break;o.push(u.char),h=u.nexti,l=!1;break}break}if(l)throw new Error(`escaped.decode: ill-formed escape sequence at buf[${h}]`)}return o}};const c=10;e.lineEnds={crlf(t){const e=[];let r=0;for(;r0&&e[e.length-1]!==c&&(e.push(13),e.push(c)),e},lf(t){const e=[];let r=0;for(;r0&&e[e.length-1]!==c&&e.push(c),e}},e.base64={encode(t){if(0===t.length)return Buffer.alloc(0);let e,r,n,i=t.length%3;i=i>0?3-i:0;let o=(t.length+i)/3;const s=Buffer.alloc(4*o);i>0&&(o-=1),e=0,r=0;for(let i=0;i>18&a[6]],s[r++]=h[n>>12&a[6]],s[r++]=h[n>>6&a[6]],s[r++]=h[n&a[6]];return 0===i?s:1===i?(n=t[e++]<<16,n+=t[e]<<8,s[r++]=h[n>>18&a[6]],s[r++]=h[n>>12&a[6]],s[r++]=h[n>>6&a[6]],s[r]=h[64],s):2===i?(n=t[e]<<16,s[r++]=h[n>>18&a[6]],s[r++]=h[n>>12&a[6]],s[r++]=h[64],s[r]=h[64],s):void 0},decode(t){if(0===t.length)return Buffer.alloc(0);const e=function(t){const e=[];let r=0;for(let n=0;n=65&&i<=90){e.push(i-65);break}if(i>=97&&i<=122){e.push(i-71);break}if(i>=48&&i<=57){e.push(i+4);break}if(43===i){e.push(62);break}if(47===i){e.push(63);break}if(61===i){e.push(64),r+=1;break}throw new RangeError(`base64.decode: invalid character buf[${n}]: ${i}`)}}if(e.length%4>0)throw new RangeError(`base64.decode: string length not integral multiple of 4: ${e.length}`);switch(r){case 0:break;case 1:if(64!==e[e.length-1])throw new RangeError("base64.decode: one tail character found: not last character");break;case 2:if(64!==e[e.length-1]||64!==e[e.length-2])throw new RangeError("base64.decode: two tail characters found: not last characters");break;default:throw new RangeError(`base64.decode: more than two tail characters found: ${r}`)}return{tail:r,buf:Buffer.from(e)}}(t),{tail:r}=e,n=e.buf;let i,o,s,u=n.length/4;const l=Buffer.alloc(3*u-r);r>0&&(u-=1),o=0,i=0;for(let t=0;t>16&a[8],l[o++]=s>>8&a[8],l[o++]=s&a[8];return 1===r&&(s=n[i++]<<18,s+=n[i++]<<12,s+=n[i]<<6,l[o++]=s>>16&a[8],l[o]=s>>8&a[8]),2===r&&(s=n[i++]<<18,s+=n[i++]<<12,l[o]=s>>16&a[8]),l},toString(t){if(t.length%4>0)throw new RangeError(`base64.toString: input buffer length not multiple of 4: ${t.length}`);let e="",r=0;function n(t,n,i,o){switch(r){case 76:e+=`\r\n${t}${n}${i}${o}`,r=4;break;case 75:e+=`${t}\r\n${n}${i}${o}`,r=3;break;case 74:e+=`${t+n}\r\n${i}${o}`,r=2;break;case 73:e+=`${t+n+i}\r\n${o}`,r=1;break;default:e+=t+n+i+o,r+=4}}for(let e=0;e=65&&i<=90||i>=97&&i<=122||i>=48&&i<=57||43===i||47===i||61===i))throw new RangeError(`base64.toString: buf[${r}]: ${t[r]} : not valid base64 character code`);n(String.fromCharCode(t[e]),String.fromCharCode(t[e+1]),String.fromCharCode(t[e+2]),String.fromCharCode(t[e+3]))}var i;return e}}},580:(t,e,r)=>{t.exports=function(){const t=r(8276),e=r(8544),n=this;let i=null,o=null,s=null,a=0;const u=[],l=[],h=[],c=[];function f(t){let e="";for(let r=0;r0?c[t-1].stack:0},this.getLength=function(){return c.length},this.toXml=function(r){let n=e.charsToDec,i="decimal integer character codes";if("string"==typeof r&&r.length>=3){const t=r.slice(0,3).toLowerCase();"asc"===t?(n=e.charsToAscii,i="ASCII for printing characters, hex for non-printing"):"hex"===t?(n=e.charsToHex,i="hexadecimal integer character codes"):"uni"===t&&(n=e.charsToUnicode,i="Unicode UTF-32 integer character codes")}let o="",a=0;return o+='\n',o+=`\n`,o+=`\x3c!-- input string, ${i} --\x3e\n`,o+=f(a+2),o+=n(s),o+="\n",c.forEach((e=>{e.state===t.SEM_PRE?(a+=1,o+=f(a),o+=`\n`,o+=f(a+2),o+=n(s,e.phraseIndex,e.phraseLength),o+="\n"):(o+=f(a),o+=`\x3c!-- name="${e.name}" --\x3e\n`,a-=1)})),o+="\n",o},this.phrases=function(){const e={};let r,n;for(r=0;r{t.exports=function(){let t=-1,e=0;this.init=function(r){if("number"!=typeof r||r<=0)throw new Error("circular-buffer.js: init: circular buffer size must an integer > 0");e=Math.ceil(r),t=-1},this.increment=function(){return t+=1,(t+e)%e},this.maxSize=function(){return e},this.items=function(){return t+1},this.getListIndex=function(r){return-1===t||r<0||r>t||t-r>=e?-1:(r+e)%e},this.forEach=function(r){if(-1!==t)if(t{t.exports=function(){return"/* This file automatically generated by jsonToless() and LESS. */\n.apg-mono {\n font-family: monospace;\n}\n.apg-active {\n font-weight: bold;\n color: #000000;\n}\n.apg-match {\n font-weight: bold;\n color: #264BFF;\n}\n.apg-empty {\n font-weight: bold;\n color: #0fbd0f;\n}\n.apg-nomatch {\n font-weight: bold;\n color: #FF4000;\n}\n.apg-lh-match {\n font-weight: bold;\n color: #1A97BA;\n}\n.apg-lb-match {\n font-weight: bold;\n color: #5F1687;\n}\n.apg-remainder {\n font-weight: bold;\n color: #999999;\n}\n.apg-ctrl-char {\n font-weight: bolder;\n font-style: italic;\n font-size: 0.6em;\n}\n.apg-line-end {\n font-weight: bold;\n color: #000000;\n}\n.apg-error {\n font-weight: bold;\n color: #FF4000;\n}\n.apg-phrase {\n color: #000000;\n background-color: #8caae6;\n}\n.apg-empty-phrase {\n color: #0fbd0f;\n}\ntable.apg-state {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: left;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-state th,\ntable.apg-state td {\n text-align: left;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-state th:nth-last-child(2),\ntable.apg-state td:nth-last-child(2) {\n text-align: right;\n}\ntable.apg-state caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-stats {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-stats th,\ntable.apg-stats td {\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-stats caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-trace {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-trace caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-trace th,\ntable.apg-trace td {\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-trace th:last-child,\ntable.apg-trace th:nth-last-child(2),\ntable.apg-trace td:last-child,\ntable.apg-trace td:nth-last-child(2) {\n text-align: left;\n}\ntable.apg-grammar {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-grammar caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-grammar th,\ntable.apg-grammar td {\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-grammar th:last-child,\ntable.apg-grammar td:last-child {\n text-align: left;\n}\ntable.apg-rules {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-rules caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-rules th,\ntable.apg-rules td {\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-rules a {\n color: #003399 !important;\n}\ntable.apg-rules a:hover {\n color: #8caae6 !important;\n}\ntable.apg-attrs {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: center;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-attrs caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-attrs th,\ntable.apg-attrs td {\n text-align: center;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-attrs th:nth-child(1),\ntable.apg-attrs th:nth-child(2),\ntable.apg-attrs th:nth-child(3) {\n text-align: right;\n}\ntable.apg-attrs td:nth-child(1),\ntable.apg-attrs td:nth-child(2),\ntable.apg-attrs td:nth-child(3) {\n text-align: right;\n}\ntable.apg-attrs a {\n color: #003399 !important;\n}\ntable.apg-attrs a:hover {\n color: #8caae6 !important;\n}\n"}},8276:t=>{t.exports={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,BKR:14,BKA:15,BKN:16,ABG:17,AEN:18,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,SEM_SKIP:301,ATTR_N:400,ATTR_R:401,ATTR_MR:402,LOOKAROUND_NONE:500,LOOKAROUND_AHEAD:501,LOOKAROUND_BEHIND:502,BKR_MODE_UM:601,BKR_MODE_PM:602,BKR_MODE_CS:603,BKR_MODE_CI:604}},8737:(t,e,r)=>{t.exports={ast:r(580),circular:r(2761),ids:r(8276),parser:r(8629),stats:r(5403),trace:r(9290),utils:r(8544),emitcss:r(1593),style:r(3932)}},8629:(t,e,r)=>{t.exports=function(){const t=r(8276),e=r(8544),n="parser.js: ",i=this;let o;this.ast=null,this.stats=null,this.trace=null,this.callbacks=[];let s,a,u,l,h=null,c=null,f=0,d=0,p=0,m=null,g=null,v=null,y=null,b=null,w=0,E=1/0,M=1/0;const A=function(e,r,i){const s=`${n}evaluateRule(): `;if(e>=v.length)throw new Error(`${s}rule index: ${e} out of range`);if(r>=u)throw new Error(`${s}phrase index: ${r} out of range`);const{length:a}=h;h.push({type:t.RNM,index:e}),o(a,r,i),h.pop()},_=function(e,r,i){const s=`${n}evaluateUdt(): `;if(e>=y.length)throw new Error(`${s}udt index: ${e} out of range`);if(r>=u)throw new Error(`${s}phrase index: ${r} out of range`);const{length:a}=h;h.push({type:t.UDT,empty:y[e].empty,index:e}),o(a,r,i),h.pop()},N=function(){f=0,d=0,p=0,w=0,l=[{lookAround:t.LOOKAROUND_NONE,anchor:0,charsEnd:0,charsLength:0}],v=null,y=null,c=null,s=0,a=0,u=0,m=null,g=null,b=null,h=null},S=function(){const t=[];this.push=function(){t.push(function(){const e=t[t.length-1],r={};for(const t in e)r[t]=e[t];return r}())},this.pop=function(e){let r=e;if(r||(r=t.length-1),r<1||r>t.length)throw new Error(`${n}backRef.pop(): bad length: ${r}`);return t.length=r,t[t.length-1]},this.length=function(){return t.length},this.savePhrase=function(e,r,n){t[t.length-1][e]={phraseIndex:r,phraseLength:n}},this.getPhrase=function(e){return t[t.length-1][e]},function(){const e={};v.forEach((t=>{t.isBkr&&(e[t.lower]=null)})),y.length>0&&y.forEach((t=>{t.isBkr&&(e[t.lower]=null)})),t.push(e)}()},T=function(){const e=this;this.state=t.ACTIVE,this.phraseLength=0,this.ruleIndex=0,this.udtIndex=0,this.lookAround=l[l.length-1],this.uFrame=new S,this.pFrame=new S,this.evaluateRule=A,this.evaluateUdt=_,this.refresh=function(){e.state=t.ACTIVE,e.phraseLength=0,e.lookAround=l[l.length-1]}},k=function(){return l[l.length-1]},R=function(){return l.length>1},x=function(t,r,i){const o=`${n}initializeInputChars(): `;let l=t,h=r,f=i;if(void 0===l)throw new Error(`${o}input string is undefined`);if(null===l)throw new Error(`${o}input string is null`);if("string"==typeof l)l=e.stringToChars(l);else if(!Array.isArray(l))throw new Error(`${o}input string is not a string or array`);if(l.length>0&&"number"!=typeof l[0])throw new Error(`${o}input string not an array of integers`);if("number"!=typeof h)h=0;else if(h=Math.floor(h),h<0||h>l.length)throw new Error(`${o}input beginning index out of range: ${h}`);if("number"!=typeof f)f=l.length-h;else if(f=Math.floor(f),f<0||f>l.length-h)throw new Error(`${o}input length out of range: ${f}`);c=l,s=h,a=f,u=s+a};this.setMaxTreeDepth=function(t){if("number"!=typeof t)throw new Error(`parser: max tree depth must be integer > 0: ${t}`);if(E=Math.floor(t),E<=0)throw new Error(`parser: max tree depth must be integer > 0: ${t}`)},this.setMaxNodeHits=function(t){if("number"!=typeof t)throw new Error(`parser: max node hits must be integer > 0: ${t}`);if(M=Math.floor(t),M<=0)throw new Error(`parser: max node hits must be integer > 0: ${t}`)};const O=function(e,r,l){let f;const E=`${n}parse(): `;!function(t){const e=`${n}initializeGrammar(): `;if(!t)throw new Error(`${e}grammar object undefined`);if("grammarObject"!==t.grammarObject)throw new Error(`${e}bad grammar object`);v=t.rules,y=t.udts}(e);const M=function(t){const e=`${n}initializeStartRule(): `;let r=null;if("number"==typeof t){if(t>=v.length)throw new Error(`${e}start rule index too large: max: ${v.length}: index: ${t}`);r=t}else{if("string"!=typeof t)throw new Error(`${e}type of start rule '${typeof t}' not recognized`);{const n=t.toLowerCase();for(let t=0;ti){let t=`${n}opRNM(${e.name}): callback function error: `;throw t+=`sysData.phraseLength: ${r.phraseLength}`,t+=` must be <= remaining chars: ${i}`,new Error(t)}switch(r.state){case t.ACTIVE:if(!0!==o)throw new Error(`${n}opRNM(${e.name}): callback function return error. ACTIVE state not allowed.`);break;case t.EMPTY:r.phraseLength=0;break;case t.MATCH:0===r.phraseLength&&(r.state=t.EMPTY);break;case t.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opRNM(${e.name}): callback function return error. Unrecognized return state: ${r.state}`)}},P=function(e,r,n){let s,a,l,f,d,p;const g=h[e],y=v[g.index],w=m[y.index],E=!R();if(E&&(a=i.ast&&i.ast.ruleDefined(g.index),a&&(s=i.ast.getLength(),i.ast.down(g.index,v[g.index].name)),f=n.uFrame.length(),d=n.pFrame.length(),n.uFrame.push(),n.pFrame.push(),p=n.pFrame,n.pFrame=new S),null===w)l=h,h=y.opcodes,o(0,r,n),h=l;else{const e=u-r;n.ruleIndex=y.index,w(n,c,r,b),C(y,n,e,!0),n.state===t.ACTIVE&&(l=h,h=y.opcodes,o(0,r,n),h=l,n.ruleIndex=y.index,w(n,c,r,b),C(y,n,e,!1))}E&&(a&&(n.state===t.NOMATCH?i.ast.setLength(s):i.ast.up(g.index,y.name,r,n.phraseLength)),n.pFrame=p,n.state===t.NOMATCH?(n.uFrame.pop(f),n.pFrame.pop(d)):y.isBkr&&(n.pFrame.savePhrase(y.lower,r,n.phraseLength),n.uFrame.savePhrase(y.lower,r,n.phraseLength)))},L=function(e,r,o){let s,a,l,f,d,p;const m=h[e],w=y[m.index];o.UdtIndex=w.index;const E=!R();E&&(l=i.ast&&i.ast.udtDefined(m.index),l&&(a=v.length+m.index,s=i.ast.getLength(),i.ast.down(a,w.name)),f=o.uFrame.length(),d=o.pFrame.length(),o.uFrame.push(),o.pFrame.push(),p=o.pFrame,o.pFrame=new S);const M=u-r;g[m.index](o,c,r,b),function(e,r,i){if(r.phraseLength>i){let t=`${n}opUDT(${e.name}): callback function error: `;throw t+=`sysData.phraseLength: ${r.phraseLength}`,t+=` must be <= remaining chars: ${i}`,new Error(t)}switch(r.state){case t.ACTIVE:throw new Error(`${n}opUDT(${e.name}): callback function return error. ACTIVE state not allowed.`);case t.EMPTY:if(!1===e.empty)throw new Error(`${n}opUDT(${e.name}): callback function return error. May not return EMPTY.`);r.phraseLength=0;break;case t.MATCH:if(0===r.phraseLength){if(!1===e.empty)throw new Error(`${n}opUDT(${e.name}): callback function return error. May not return EMPTY.`);r.state=t.EMPTY}break;case t.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opUDT(${e.name}): callback function return error. Unrecognized return state: ${r.state}`)}}(w,o,M),E&&(l&&(o.state===t.NOMATCH?i.ast.setLength(s):i.ast.up(a,w.name,r,o.phraseLength)),o.pFrame=p,o.state===t.NOMATCH?(o.uFrame.pop(f),o.pFrame.pop(d)):w.isBkr&&(o.pFrame.savePhrase(w.lower,r,o.phraseLength),o.uFrame.savePhrase(w.lower,r,o.phraseLength)))},U=function(e,r,n){l.push({lookAround:t.LOOKAROUND_AHEAD,anchor:r,charsEnd:u,charsLength:a}),u=c.length,a=c.length-s,o(e+1,r,n);const i=l.pop();switch(u=i.charsEnd,a=i.charsLength,n.phraseLength=0,n.state){case t.EMPTY:case t.MATCH:n.state=t.EMPTY;break;case t.NOMATCH:n.state=t.NOMATCH;break;default:throw new Error(`opAND: invalid state ${n.state}`)}},B=function(e,r,n){l.push({lookAround:t.LOOKAROUND_AHEAD,anchor:r,charsEnd:u,charsLength:a}),u=c.length,a=c.length-s,o(e+1,r,n);const i=l.pop();switch(u=i.charsEnd,a=i.charsLength,n.phraseLength=0,n.state){case t.EMPTY:case t.MATCH:n.state=t.NOMATCH;break;case t.NOMATCH:n.state=t.EMPTY;break;default:throw new Error(`opNOT: invalid state ${n.state}`)}},D=function(e,r,n){n.state=t.NOMATCH,n.phraseLength=0,n.state=0===r?t.EMPTY:t.NOMATCH},F=function(e,r,n){n.state=t.NOMATCH,n.phraseLength=0,n.state=r===c.length?t.EMPTY:t.NOMATCH},G=function(e,r,n){switch(l.push({lookAround:t.LOOKAROUND_BEHIND,anchor:r}),o(e+1,r,n),l.pop(),n.phraseLength=0,n.state){case t.EMPTY:case t.MATCH:n.state=t.EMPTY;break;case t.NOMATCH:n.state=t.NOMATCH;break;default:throw new Error(`opBKA: invalid state ${n.state}`)}},j=function(e,r,n){switch(l.push({lookAround:t.LOOKAROUND_BEHIND,anchor:r}),o(e+1,r,n),l.pop(),n.phraseLength=0,n.state){case t.EMPTY:case t.MATCH:n.state=t.NOMATCH;break;case t.NOMATCH:n.state=t.EMPTY;break;default:throw new Error(`opBKN: invalid state ${n.state}`)}};o=function(e,r,n){let s=!0;const a=h[e];if(p+=1,p>M)throw new Error(`parser: maximum number of node hits exceeded: ${M}`);if(f+=1,f>d&&(d=f,d>E))throw new Error(`parser: maximum parse tree depth exceeded: ${E}`);if(n.refresh(),null!==i.trace){const t=k();i.trace.down(a,n.state,r,n.phraseLength,t.anchor,t.lookAround)}if(l[l.length-1].lookAround===t.LOOKAROUND_BEHIND)switch(a.type){case t.ALT:I(e,r,n);break;case t.CAT:!function(e,r,n){let s,a,u,l;const c=h[e],f=n.uFrame.length(),d=n.pFrame.length();i.ast&&(a=i.ast.getLength()),s=!0,u=r,l=0;for(let e=c.children.length-1;e>=0;e-=1)if(o(c.children[e],u,n),u-=n.phraseLength,l+=n.phraseLength,n.state===t.NOMATCH){s=!1;break}s?(n.state=0===l?t.EMPTY:t.MATCH,n.phraseLength=l):(n.state=t.NOMATCH,n.phraseLength=0,n.uFrame.pop(f),n.pFrame.pop(d),i.ast&&i.ast.setLength(a))}(e,r,n);break;case t.REP:!function(e,r,n){let s,a,u,l;const c=h[e];a=r,u=0,l=0;const f=n.uFrame.length(),d=n.pFrame.length();for(i.ast&&(s=i.ast.getLength());!(a<=0)&&(o(e+1,a,n),n.state!==t.NOMATCH)&&n.state!==t.EMPTY&&(l+=1,u+=n.phraseLength,a-=n.phraseLength,l!==c.max););n.state===t.EMPTY||l>=c.min?(n.state=0===u?t.EMPTY:t.MATCH,n.phraseLength=u):(n.state=t.NOMATCH,n.phraseLength=0,n.uFrame.pop(f),n.pFrame.pop(d),i.ast&&i.ast.setLength(s))}(e,r,n);break;case t.RNM:P(e,r,n);break;case t.UDT:L(e,r,n);break;case t.AND:U(e,r,n);break;case t.NOT:B(e,r,n);break;case t.TRG:!function(e,r,n){const i=h[e];if(n.state=t.NOMATCH,n.phraseLength=0,r>0){const e=c[r-1];i.min<=e&&e<=i.max&&(n.state=t.MATCH,n.phraseLength=1)}}(e,r,n);break;case t.TBS:!function(e,r,n){let i;const o=h[e];n.state=t.NOMATCH;const s=o.string.length,a=r-s;if(a>=0){for(i=0;i=0){for(let t=0;t=65&&i<=90&&(i+=32),i!==o.string[t])return;n.state=t.MATCH,n.phraseLength=s}}(e,r,n);break;case t.BKR:!function(e,r,n){let i,o,s,a;const u=h[e];n.state=t.NOMATCH,n.phraseLength=0,a=u.index=0){if(f){for(i=0;i=65&&o<=90&&(o+=32),s>=65&&s<=90&&(s+=32),o!==s)return;n.state=t.MATCH,n.phraseLength=p}else for(i=0;i=u)&&(o(e+1,a,n),n.state!==t.NOMATCH)&&n.state!==t.EMPTY&&(c+=1,l+=n.phraseLength,a+=n.phraseLength,c!==f.max););n.state===t.EMPTY||c>=f.min?(n.state=0===l?t.EMPTY:t.MATCH,n.phraseLength=l):(n.state=t.NOMATCH,n.phraseLength=0,n.uFrame.pop(d),n.pFrame.pop(p),i.ast&&i.ast.setLength(s))}(e,r,n);break;case t.RNM:P(e,r,n);break;case t.UDT:L(e,r,n);break;case t.AND:U(e,r,n);break;case t.NOT:B(e,r,n);break;case t.TRG:!function(e,r,n){const i=h[e];n.state=t.NOMATCH,r=65&&o<=90&&(o+=32),o!==s.string[i])return;n.state=t.MATCH,n.phraseLength=a}}else n.state=t.EMPTY}(e,r,n);break;case t.BKR:!function(e,r,n){let i,o,s,a;const l=h[e];n.state=t.NOMATCH,a=l.index=65&&o<=90&&(o+=32),s>=65&&s<=90&&(s+=32),o!==s)return;n.state=t.MATCH,n.phraseLength=m}else for(i=0;iw&&(w=r+n.phraseLength),null!==i.stats&&i.stats.collect(a,n),null!==i.trace){const t=k();i.trace.up(a,n.state,r,n.phraseLength,t.anchor,t.lookAround)}return f-=1,s}}},5403:(t,e,r)=>{t.exports=function(){const t=r(8276),e=r(8544),n=r(3932);let i=[],o=[];const s=[];let a;const u=[],l=[];this.statsObject="statsObject";const h=function(t,e){return t.lowere.lower?1:0},c=function(t,e){return t.totale.total?-1:h(t,e)},f=function(t,e){return t.indexe.index?1:0},d=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},p=function(e,r){switch(e.total+=1,r){case t.EMPTY:e.empty+=1;break;case t.MATCH:e.match+=1;break;case t.NOMATCH:e.nomatch+=1;break;default:throw new Error(`stats.js: collect(): incStat(): unrecognized state: ${r}`)}},m=function(t,e){let r="";return r+="",r+=`${t}`,r+=`${e.empty}`,r+=`${e.match}`,r+=`${e.nomatch}`,r+=`${e.total}`,r+="\n",r},g=function(){let e="";return e+=m("ALT",s[t.ALT]),e+=m("CAT",s[t.CAT]),e+=m("REP",s[t.REP]),e+=m("RNM",s[t.RNM]),e+=m("TRG",s[t.TRG]),e+=m("TBS",s[t.TBS]),e+=m("TLS",s[t.TLS]),e+=m("UDT",s[t.UDT]),e+=m("AND",s[t.AND]),e+=m("NOT",s[t.NOT]),e+=m("BKR",s[t.BKR]),e+=m("BKA",s[t.BKA]),e+=m("BKN",s[t.BKN]),e+=m("ABG",s[t.ABG]),e+=m("AEN",s[t.AEN]),e+=m("totals",a),e},v=function(){let t="";t+="\n",t+="rules\n";for(let e=0;e0&&(t+="",t+=`${u[e].name}`,t+=`${u[e].empty}`,t+=`${u[e].match}`,t+=`${u[e].nomatch}`,t+=`${u[e].total}`,t+="\n");if(o.length>0){t+="\n",t+="udts\n";for(let e=0;e0&&(t+="",t+=`${l[e].name}`,t+=`${l[e].empty}`,t+=`${l[e].match}`,t+=`${l[e].nomatch}`,t+=`${l[e].total}`,t+="\n")}return t};this.validate=function(t){let e=!1;return"string"==typeof t&&"stats"===t&&(e=!0),e},this.init=function(e,r){i=e,o=r,function(){s.length=0,a=new d,s[t.ALT]=new d,s[t.CAT]=new d,s[t.REP]=new d,s[t.RNM]=new d,s[t.TRG]=new d,s[t.TBS]=new d,s[t.TLS]=new d,s[t.UDT]=new d,s[t.AND]=new d,s[t.NOT]=new d,s[t.BKR]=new d,s[t.BKA]=new d,s[t.BKN]=new d,s[t.ABG]=new d,s[t.AEN]=new d,u.length=0;for(let t=0;t0){l.length=0;for(let t=0;t\n`,"string"==typeof e&&(r+=`${e}\n`),r+=`ops\n`,r+=`EMPTY\n`,r+=`MATCH\n`,r+=`NOMATCH\n`,r+=`totals\n`;;){if(void 0===t){r+=g();break}if(null===t){r+=g();break}if("ops"===t){r+=g();break}if("index"===t){u.sort(f),l.length>0&&l.sort(f),r+=g(),r+=v();break}if("hits"===t){u.sort(c),l.length>0&&l.sort(f),r+=g(),r+=v();break}if("alpha"===t){u.sort(h),l.length>0&&l.sort(h),r+=g(),r+=v();break}break}return r+="\n",r},this.toHtmlPage=function(t,r,n){return e.htmlToPage(this.toHtml(t,r),n)}}},3932:t=>{t.exports={CLASS_MONOSPACE:"apg-mono",CLASS_ACTIVE:"apg-active",CLASS_EMPTY:"apg-empty",CLASS_MATCH:"apg-match",CLASS_NOMATCH:"apg-nomatch",CLASS_LOOKAHEAD:"apg-lh-match",CLASS_LOOKBEHIND:"apg-lb-match",CLASS_REMAINDER:"apg-remainder",CLASS_CTRLCHAR:"apg-ctrl-char",CLASS_LINEEND:"apg-line-end",CLASS_ERROR:"apg-error",CLASS_PHRASE:"apg-phrase",CLASS_EMPTYPHRASE:"apg-empty-phrase",CLASS_STATE:"apg-state",CLASS_STATS:"apg-stats",CLASS_TRACE:"apg-trace",CLASS_GRAMMAR:"apg-grammar",CLASS_RULES:"apg-rules",CLASS_RULESLINK:"apg-rules-link",CLASS_ATTRIBUTES:"apg-attrs"}},9290:(t,e,r)=>{t.exports=function(){const t=r(8544),e=r(3932),n=new(r(2761)),i=r(8276),o="trace.js: ",s=this,a=16,u=80,l=[];let h=5e3,c=-1,f=0,d=0;const p=[];let m=null,g=null,v=null;const y=[],b=[],w=``,E=``,M=`𝜺`;this.traceObject="traceObject",this.filter={operators:[],rules:[]},this.setMaxRecords=function(t,e){c=-1,"number"==typeof t&&t>0?(h=Math.ceil(t),"number"==typeof e&&(c=Math.floor(e),c<0&&(c=-1))):h=0},this.getMaxRecords=function(){return h},this.getLastRecord=function(){return c},this.init=function(t,e,r){l.length=0,p.length=0,f=0,d=0,m=r,g=t,v=e,function(){const t=function(t){y[i.ALT]=t,y[i.CAT]=t,y[i.REP]=t,y[i.TLS]=t,y[i.TBS]=t,y[i.TRG]=t,y[i.AND]=t,y[i.NOT]=t,y[i.BKR]=t,y[i.BKA]=t,y[i.BKN]=t,y[i.ABG]=t,y[i.AEN]=t};let e=0;for(const t in s.filter.operators)e+=1;if(0!==e){for(const e in s.filter.operators){const r=e.toUpperCase();if(""===r)return void t(!0);if(""===r)return void t(!1)}t(!1);for(const t in s.filter.operators){const e=t.toUpperCase();if("ALT"===e)y[i.ALT]=!0===s.filter.operators[t];else if("CAT"===e)y[i.CAT]=!0===s.filter.operators[t];else if("REP"===e)y[i.REP]=!0===s.filter.operators[t];else if("AND"===e)y[i.AND]=!0===s.filter.operators[t];else if("NOT"===e)y[i.NOT]=!0===s.filter.operators[t];else if("TLS"===e)y[i.TLS]=!0===s.filter.operators[t];else if("TBS"===e)y[i.TBS]=!0===s.filter.operators[t];else if("TRG"===e)y[i.TRG]=!0===s.filter.operators[t];else if("BKR"===e)y[i.BKR]=!0===s.filter.operators[t];else if("BKA"===e)y[i.BKA]=!0===s.filter.operators[t];else if("BKN"===e)y[i.BKN]=!0===s.filter.operators[t];else if("ABG"===e)y[i.ABG]=!0===s.filter.operators[t];else{if("AEN"!==e)throw new Error(`${o}initOpratorFilter: '${t}' not a valid operator name. Must be , , alt, cat, rep, tls, tbs, trg, and, not, bkr, bka or bkn`);y[i.AEN]=!0===s.filter.operators[t]}}}else t(!1)}(),function(){const t=function(t){y[i.RNM]=t,y[i.UDT]=t;const e=g.length+v.length;b.length=0;for(let r=0;r"===r)return void t(!0);if(""===r)return void t(!1)}t(!1),y[i.RNM]=!0,y[i.UDT]=!0;for(const t in s.filter.rules){const e=t.toLowerCase();if(r=n.indexOf(e),r<0)throw new Error(`${o}initRuleFilter: '${t}' not a valid rule or udt name`);b[r]=!0===s.filter.rules[t]}}else t(!0)}(),n.init(h)};const A=function(t){let e=!1;return e=t.type===i.RNM?!(!y[t.type]||!b[t.index]):t.type===i.UDT?!(!y[t.type]||!b[g.length+t.index]):y[t.type],e},_=function(t){return-1===c||t<=c};this.down=function(t,e,r,i,o,s){_(f)&&A(t)&&(p.push(f),l[n.increment()]={dirUp:!1,depth:d,thisLine:f,thatLine:void 0,opcode:t,state:e,phraseIndex:r,phraseLength:i,lookAnchor:o,lookAround:s},f+=1,d+=1)},this.up=function(t,e,r,i,o,s){if(_(f)&&A(t)){const a=f,u=p.pop(),h=n.getListIndex(u);-1!==h&&(l[h].thatLine=a),d-=1,l[n.increment()]={dirUp:!0,depth:d,thisLine:a,thatLine:u,opcode:t,state:e,phraseIndex:r,phraseLength:i,lookAnchor:o,lookAround:s},f+=1}},this.toTree=function(e){const r=function(){function e(e,r){let n,o,s;if(r)switch(e.op={id:r.type,name:t.opcodeToString(r.type)},e.opData=void 0,r.type){case i.RNM:e.opData=g[r.index].name;break;case i.UDT:e.opData=v[r.index].name;break;case i.BKR:n=r.index{if(w=l[t],E&&(E=!1,w.depth>0)){const t=w.dirUp?w.depth+1:w.depth;for(let e=0;e1;)y=f.pop(),a(y,null);if(0===M.children.length)throw new Error("trace.toTree(): parse tree has no nodes");if(0===f.length)throw new Error("trace.toTree(): integrity check: dummy root node disappeared?");p=M.children[0];let A=p;for(;p&&!p.down&&!p.up;)A=p,p=p.children[0];p=A,p.leftMost=!0,p.rightMost=!0,function t(e){if(h+=1,e.branch=c,h>d&&(d=h),0===e.children.length)u+=1;else for(let r=0;r0&&(c+=1),e.children[r].leftMost=!1,e.children[r].rightMost=!1,e.leftMost&&(e.children[r].leftMost=0===r),e.rightMost&&(e.children[r].rightMost=r===e.children.length-1),t(e.children[r]);h-=1}(p),p.branch=0;const _={string:[]};for(let t=0;t`,g="";let v=!1;switch(n){case i.EMPTY:d+=M;case i.NOMATCH:case i.ACTIVE:l=o,h=0,c=o,f=r.length-c;break;case i.MATCH:l=o,h=s,c=o+h,f=r.length-c;break;default:throw new Error("unrecognized state")}return p=w,h>u?(h=u,p=E,f=0):h+f>u&&(p=E,f=u-h),h>0&&(d+=a,d+=N(t,r,l,h,v),d+=g,v=!0),f>0&&(d+=m,d+=N(t,r,c,f,v),d+=g),d+p};this.toHtml=function(r,h){let c=8;if("string"==typeof r&&r.length>=3){const t=r.toLowerCase().slice(0,3);"hex"===t?c=a:"dec"===t?c=10:"uni"===t&&(c=32)}let f="";return f+=function(t,r){let n;switch(t){case a:n="hexadecimal";break;case 10:n="decimal";break;case 8:n="ASCII";break;case 32:n="UNICODE";break;default:throw new Error(`${o}htmlHeader: unrecognized mode: ${t}`)}let i="";return i+=`

display mode: ${n}

\n`,i+=`\n`,"string"==typeof r&&(i+=``),i}(c,h),f+=function(r){if(null===g)return"";let o,h,c,f,d,p,y="";return y+="",y+="\n",n.forEach((n=>{const b=l[n];switch(o=b.thisLine,h=void 0!==b.thatLine?b.thatLine:"--",c=!1,f=!1,d=!1,b.lookAround===i.LOOKAROUND_AHEAD&&(c=!0,d=!0,p=b.lookAnchor),b.opcode.type!==i.AND&&b.opcode.type!==i.NOT||(c=!0,d=!0,p=b.phraseIndex),b.lookAround===i.LOOKAROUND_BEHIND&&(f=!0,d=!0,p=b.lookAnchor),b.opcode.type!==i.BKA&&b.opcode.type!==i.BKN||(f=!0,d=!0,p=b.phraseIndex),y+="",y+=``,y+=``,y+=``,y+=``,y+="",y+="\n"})),y+="",y+="\n",y+="
${r}
(a)(b)(c)(d)(e)(f)operatorphrase
${o}${h}${b.phraseIndex}${b.phraseLength}${b.depth}",b.state){case i.ACTIVE:y+=`↓ `;break;case i.MATCH:y+=`↑M`;break;case i.NOMATCH:y+=`↑N`;break;case i.EMPTY:y+=`↑E`;break;default:y+=`--`}if(y+="",y+=s.indent(b.depth),c?y+=``:f&&(y+=``),y+=t.opcodeToString(b.opcode.type),b.opcode.type===i.RNM&&(y+=`(${g[b.opcode.index].name}) `),b.opcode.type===i.BKR){const t=b.opcode.bkrCase===i.BKR_MODE_CI?"%i":"%s",e=b.opcode.bkrMode===i.BKR_MODE_UM?"%u":"%p";y+=`(\\${t}${e}${g[b.opcode.index].name}) `}b.opcode.type===i.UDT&&(y+=`(${v[b.opcode.index].name}) `),b.opcode.type===i.TRG&&(y+=`(${function(t,e){let r="";if(e.type===i.TRG)if(t===a||32===t){let n=e.min.toString(16).toUpperCase();n.length%2!=0&&(n=`0${n}`),r+=t===a?"%x":"U+",r+=n,n=e.max.toString(16).toUpperCase(),n.length%2!=0&&(n=`0${n}`),r+=`–${n}`}else r=`%d${e.min.toString(10)}–${e.max.toString(10)}`;return r}(r,b.opcode)}) `),b.opcode.type===i.TBS&&(y+=`(${function(t,e){let r="";if(e.type===i.TBS){const n=Math.min(e.string.length,10);if(t===a||32===t){r+=t===a?"%x":"U+";for(let t=0;t0&&(r+="."),n=e.string[t].toString(16).toUpperCase(),n.length%2!=0&&(n=`0${n}`),r+=n}}else{r="%d";for(let t=0;t0&&(r+="."),r+=e.string[t].toString(10)}n0&&(n+="."),o=r.string[e],o>=97&&o<=122?(t=o-32,n+=`${t.toString(s)}/${o.toString(s)}`.toUpperCase()):o>=65&&o<=90?(t=o,o+=32,n+=`${t.toString(s)}/${o.toString(s)}`.toUpperCase()):n+=o.toString(s).toUpperCase();i`,g=``,v="";let y=!1;switch(n){case i.EMPTY:d+=M;case i.NOMATCH:case i.MATCH:case i.ACTIVE:l=o-s,h=a-l,c=a,f=r.length-c;break;default:throw new Error("unrecognized state")}return p=w,h>u?(h=u,p=E,f=0):h+f>u&&(p=E,f=u-h),h>0&&(d+=m,d+=N(t,r,l,h,y),d+=v,y=!0),f>0&&(d+=g,d+=N(t,r,c,f,y),d+=v),d+p}(r,m,b.state,b.phraseIndex,b.phraseLength,p):c?function(t,r,n,i,o){const s=``;return S(t,r,n,i,o,s)}(r,m,b.state,b.phraseIndex,b.phraseLength):function(t,r,n,i,o){const s=``;return S(t,r,n,i,o,s)}(r,m,b.state,b.phraseIndex,b.phraseLength),y+="
(a)(b)(c)(d)(e)(f)operatorphrase
\n",y}(c),f+=function(){let t="";return t+="\n",t+=`

legend:
\n`,t+="(a) - line number
\n",t+="(b) - matching line number
\n",t+="(c) - phrase offset
\n",t+="(d) - phrase length
\n",t+="(e) - tree depth
\n",t+="(f) - operator state
\n",t+=`    -   phrase opened
\n`,t+=`    - ↑M phrase matched
\n`,t+=`    - ↑E empty phrase matched
\n`,t+=`    - ↑N phrase not matched
\n`,t+="operator - ALT, CAT, REP, RNM, TRG, TLS, TBS, UDT, AND, NOT, BKA, BKN, BKR, ABG, AEN
\n",t+="phrase   - up to 80 characters of the phrase being matched
\n",t+=`         - matched characters
\n`,t+=`         - matched characters in look ahead mode
\n`,t+=`         - matched characters in look behind mode
\n`,t+=`         - remainder characters(not yet examined by parser)
\n`,t+=`         - control characters, TAB, LF, CR, etc. (ASCII mode only)
\n`,t+=`         - ${M} empty string
\n`,t+=`         - ${w} end of input string
\n`,t+=`         - ${E} input string display truncated
\n`,t+="

\n",t+=`

\n`,t+="original ABNF operators:
\n",t+="ALT - alternation
\n",t+="CAT - concatenation
\n",t+="REP - repetition
\n",t+="RNM - rule name
\n",t+="TRG - terminal range
\n",t+="TLS - terminal literal string (case insensitive)
\n",t+="TBS - terminal binary string (case sensitive)
\n",t+="
\n",t+="super set SABNF operators:
\n",t+="UDT - user-defined terminal
\n",t+="AND - positive look ahead
\n",t+="NOT - negative look ahead
\n",t+="BKA - positive look behind
\n",t+="BKN - negative look behind
\n",t+="BKR - back reference
\n",t+="ABG - anchor - begin of input string
\n",t+="AEN - anchor - end of input string
\n",t+="

\n",t}(),f}}},8544:function(t,e,r){const n=r(3932),i=r(979),o=r(1593),s=r(8276),a="utilities.js: ",u=this,l=function(t,e,r){let n,i=e;for(;;){if(t<=0){i=0,n=0;break}if("number"!=typeof i){i=0,n=t;break}if(i>=t){i=t,n=t;break}if("number"!=typeof r){n=t;break}if(n=i+r,n>t){n=t;break}break}return{beg:i,end:n}};e.htmlToPage=function(t,e){let r;if("string"!=typeof t)throw new Error(`${a}htmlToPage: input HTML is not a string`);r="string"!=typeof e?"htmlToPage":e;let n="";return n+="\n",n+='\n',n+="\n",n+='\n',n+=`${r}\n`,n+="\n",n+="\n\n",n+=`

${new Date}

\n`,n+=t,n+="\n\n",n},e.parserResultToHtml=function(t,e){let r,i,o=null;"string"==typeof e&&""!==e&&(o=e),r=!0===t.success?`true`:`false`,i=t.state===s.EMPTY?`EMPTY`:t.state===s.MATCH?`MATCH`:t.state===s.NOMATCH?`NOMATCH`:`unrecognized`;let a="";return a+=`\n`,o&&(a+=`\n`),a+="\n",a+=`\n`,a+=`\n",a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+="
${o}
state itemvaluedescription
parser success${r}true if the parse succeeded,\n`,a+=` false otherwise`,a+="
NOTE: for success, entire string must be matched
parser state${i}EMPTY, `,a+=`MATCH or \n`,a+=`NOMATCH
string length${t.length}length of the input (sub)string
matched length${t.matched}number of input string characters matched
max matched${t.maxMatched}maximum number of input string characters matched
max tree depth${t.maxTreeDepth}maximum depth of the parse tree reached
node hits${t.nodeHits}number of parse tree node hits (opcode function calls)
input length${t.inputLength}length of full input string
sub-string begin${t.subBegin}sub-string first character index
sub-string end${t.subEnd}sub-string end-of-string index
sub-string length${t.subLength}sub-string length
\n",a},e.charsToString=function(t,e,r){let n,o;if("number"==typeof e){if(e>=t.length)return"";n=e<0?0:e}else n=0;if("number"==typeof r){if(r<=0)return"";o=r>t.length-n?t.length:n+r}else o=t.length;return ni.beg){n+=t[i.beg];for(let e=i.beg+1;ei.beg){n+=`\\x${u.charToHex(t[i.beg])}`;for(let e=i.beg+1;ei.beg)for(let e=i.beg;ei.beg)for(let e=i.beg;e=55296&&o<=57343||o>1114111?` U+${u.charToHex(t[e])}`:`&#${t[e]};`;var o;return n},e.charsToJsUnicode=function(t,e,r){let n="";if(!Array.isArray(t))throw new Error(`${a}charsToJsUnicode: input must be an array of integers`);const i=l(t.length,e,r);if(i.end>i.beg){n+=`\\u${u.charToHex(t[i.beg])}`;for(let e=i.beg+1;e=32&&r<=126?String.fromCharCode(r):`\\x${u.charToHex(r)}`}return n},e.charsToAsciiHtml=function(t,e,r){if(!Array.isArray(t))throw new Error(`${a}charsToAsciiHtml: input must be an array of integers`);let i,o="";const s=l(t.length,e,r);for(let e=s.beg;e${u.asciiChars[i]}`:i>127?`U+${u.charToHex(i)}`:u.asciiChars[i];return o},e.stringToAsciiHtml=function(t){const e=i.decode("STRING",t);return this.charsToAsciiHtml(e)}},2882:t=>{"use strict";for(var e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={},n=0;n<32;n++){var i=e.charAt(n);if(void 0!==r[i])throw new TypeError(i+" is ambiguous");r[i]=n}function o(t){var e=t>>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function s(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=o(e)^n>>5}for(e=o(e),r=0;re)return"Exceeds length limit";var n=t.toLowerCase(),i=t.toUpperCase();if(t!==n&&t!==i)return"Mixed-case string "+t;var a=(t=n).lastIndexOf("1");if(-1===a)return"No separator character for "+t;if(0===a)return"Missing prefix for "+t;var u=t.slice(0,a),l=t.slice(a+1);if(l.length<6)return"Data too short";var h=s(u);if("string"==typeof h)return h;for(var c=[],f=0;f=l.length||c.push(p)}return 1!==h?"Invalid checksum for "+t:{prefix:u,words:c}}function u(t,e,r,n){for(var i=0,o=0,s=(1<=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<=e)return"Excess padding";if(i<n)throw new TypeError("Exceeds length limit");var i=s(t=t.toLowerCase());if("string"==typeof i)throw new Error(i);for(var a=t+"1",u=0;u>5!=0)throw new Error("Non 5-bit word");i=o(i)^l,a+=e.charAt(l)}for(u=0;u<6;++u)i=o(i);for(i^=1,u=0;u<6;++u)a+=e.charAt(i>>5*(5-u)&31);return a},toWordsUnsafe:function(t){var e=u(t,8,5,!0);if(Array.isArray(e))return e},toWords:function(t){var e=u(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(t){var e=u(t,5,8,!1);if(Array.isArray(e))return e},fromWords:function(t){var e=u(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}}},3550:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(6601).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?h[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=c[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,l=new t(o),h=this.clone();if(u){for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),l[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},g.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(b,y),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new w;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return v[t]=e,e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new _(t)},i(_,A),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},_.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},9580:(t,e,r)=>{"use strict";r.r(e),r.d(e,{BaseContract:()=>C,BigNumber:()=>lt,Contract:()=>P,ContractFactory:()=>L,FixedNumber:()=>_t,Signer:()=>zt,VoidSigner:()=>Kt,Wallet:()=>ee,Wordlist:()=>ai,constants:()=>n,errors:()=>ed,ethers:()=>u,getDefaultProvider:()=>Dn,logger:()=>qb,providers:()=>i,utils:()=>a,version:()=>jb,wordlists:()=>ci});var n={};r.r(n),r.d(n,{AddressZero:()=>ie,EtherSymbol:()=>Ge,HashZero:()=>Fe,MaxInt256:()=>De,MaxUint256:()=>Ue,MinInt256:()=>Be,NegativeOne:()=>Oe,One:()=>Ce,Two:()=>Pe,WeiPerEther:()=>Le,Zero:()=>Ie});var i={};r.r(i),r.d(i,{AlchemyProvider:()=>Wr,AlchemyWebSocketProvider:()=>Vr,BaseProvider:()=>_r,CloudflareProvider:()=>Jr,EtherscanProvider:()=>sn,FallbackProvider:()=>En,Formatter:()=>Qe,InfuraProvider:()=>Sn,InfuraWebSocketProvider:()=>Nn,IpcProvider:()=>Mn,JsonRpcBatchProvider:()=>Tn,JsonRpcProvider:()=>Ur,JsonRpcSigner:()=>Cr,NodesmithProvider:()=>Rn,PocketProvider:()=>In,Provider:()=>c.zt,Resolver:()=>Er,StaticJsonRpcProvider:()=>zr,UrlJsonRpcProvider:()=>Kr,Web3Provider:()=>Un,WebSocketProvider:()=>jr,getDefaultProvider:()=>Dn,getNetwork:()=>je.H,isCommunityResourcable:()=>tr,isCommunityResource:()=>er,showThrottleMessage:()=>nr});var o={};r.r(o),r.d(o,{decode:()=>_a,encode:()=>Na});var s={};r.r(s),r.d(s,{decode:()=>Hp,encode:()=>qp});var a={};r.r(a),r.d(a,{AbiCoder:()=>us,ConstructorFragment:()=>Xo,ErrorFragment:()=>ts,EventFragment:()=>Vo,FormatTypes:()=>qo,Fragment:()=>$o,FunctionFragment:()=>Zo,HDNode:()=>nf,Indexed:()=>ms,Interface:()=>ys,LogDescription:()=>fs,Logger:()=>nd,ParamType:()=>Ko,RLP:()=>s,SigningKey:()=>Qm,SupportedAlgorithm:()=>yd,TransactionDescription:()=>ds,TransactionTypes:()=>Py,UnicodeNormalizationForm:()=>Eg,Utf8ErrorFuncs:()=>_g,Utf8ErrorReason:()=>Mg,_TypedDataEncoder:()=>Ql,_fetchData:()=>Db,_toEscapedUtf8String:()=>kg,accessListify:()=>zy,arrayify:()=>ou,base58:()=>qa,base64:()=>o,checkProperties:()=>dp,checkResultErrors:()=>Qi,commify:()=>Qy,computeAddress:()=>Fy,computeHmac:()=>Ad,computePublicKey:()=>eg,concat:()=>su,deepCopy:()=>yp,defaultAbiCoder:()=>ls,defaultPath:()=>rf,defineReadOnly:()=>hp,entropyToMnemonic:()=>af,fetchJson:()=>Fb,formatBytes32String:()=>Kg,formatEther:()=>rb,formatUnits:()=>tb,getAccountPath:()=>lf,getAddress:()=>oa,getContractAddress:()=>ua,getCreate2Address:()=>la,getIcapAddress:()=>aa,getJsonWalletAddress:()=>If,getStatic:()=>cp,hashMessage:()=>Zu,hexConcat:()=>pu,hexDataLength:()=>fu,hexDataSlice:()=>du,hexStripZeros:()=>gu,hexValue:()=>mu,hexZeroPad:()=>vu,hexlify:()=>cu,id:()=>gl,isAddress:()=>sa,isBytes:()=>iu,isBytesLike:()=>ru,isHexString:()=>lu,isValidMnemonic:()=>uf,isValidName:()=>pl,joinSignature:()=>bu,keccak256:()=>Vf,mnemonicToEntropy:()=>sf,mnemonicToSeed:()=>of,namehash:()=>ml,nameprep:()=>qg,parseBytes32String:()=>Hg,parseEther:()=>nb,parseTransaction:()=>Yy,parseUnits:()=>eb,poll:()=>Gb,randomBytes:()=>Jd,recoverAddress:()=>Gy,recoverPublicKey:()=>tg,resolveProperties:()=>fp,ripemd160:()=>wd,serializeTransaction:()=>Vy,sha256:()=>Ed,sha512:()=>Md,shallowCopy:()=>pp,shuffled:()=>Xd,solidityKeccak256:()=>Od,solidityPack:()=>xd,soliditySha256:()=>Id,splitSignature:()=>yu,stripZeros:()=>au,toUtf8Bytes:()=>Sg,toUtf8CodePoints:()=>Og,toUtf8String:()=>xg,verifyMessage:()=>re,verifyTypedData:()=>ne,zeroPad:()=>uu});var u={};r.r(u),r.d(u,{BaseContract:()=>C,BigNumber:()=>lt,Contract:()=>P,ContractFactory:()=>L,FixedNumber:()=>_t,Signer:()=>zt,VoidSigner:()=>Kt,Wallet:()=>ee,Wordlist:()=>ai,constants:()=>n,errors:()=>ed,getDefaultProvider:()=>Dn,logger:()=>qb,providers:()=>i,utils:()=>a,version:()=>jb,wordlists:()=>ci});var l=r(1184),h=r(8198),c=r(4353),f=r(8171),d=r(4594),p=r(2593),m=r(3286),g=r(3587),v=r(4377),y=r(711),b=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const w=new y.Yd("contracts/5.5.0"),E={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0};function M(t,e){return b(this,void 0,void 0,(function*(){const r=yield e;"string"!=typeof r&&w.throwArgumentError("invalid address or ENS name","name",r);try{return(0,d.Kn)(r)}catch(t){}t||w.throwError("a provider or signer is needed to resolve ENS names",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return null==n&&w.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n}))}function A(t,e,r){return b(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,n)=>A(t,Array.isArray(e)?e[n]:e[r.name],r)))):"address"===r.type?yield M(t,e):"tuple"===r.type?yield A(t,e,r.components):"array"===r.baseType?Array.isArray(e)?yield Promise.all(e.map((e=>A(t,e,r.arrayChildren)))):Promise.reject(w.makeError("invalid value for array",y.Yd.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e}))}function _(t,e,r){return b(this,void 0,void 0,(function*(){let n={};r.length===e.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=(0,g.DC)(r.pop())),w.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=(0,g.mE)({override:M(t.signer,n.from),signer:t.signer.getAddress()}).then((t=>b(this,void 0,void 0,(function*(){return(0,d.Kn)(t.signer)!==t.override&&w.throwError("Contract with a Signer cannot override from",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})))):n.from=t.signer.getAddress():n.from&&(n.from=M(t.provider,n.from));const i=yield(0,g.mE)({args:A(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:(0,g.mE)(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},a=i.overrides;if(null!=a.nonce&&(s.nonce=p.O$.from(a.nonce).toNumber()),null!=a.gasLimit&&(s.gasLimit=p.O$.from(a.gasLimit)),null!=a.gasPrice&&(s.gasPrice=p.O$.from(a.gasPrice)),null!=a.maxFeePerGas&&(s.maxFeePerGas=p.O$.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(s.maxPriorityFeePerGas=p.O$.from(a.maxPriorityFeePerGas)),null!=a.from&&(s.from=a.from),null!=a.type&&(s.type=a.type),null!=a.accessList&&(s.accessList=(0,v.z7)(a.accessList)),null==s.gasLimit&&null!=e.gas){let t=21e3;const r=(0,m.lE)(o);for(let e=0;enull!=n[t]));return u.length&&w.throwError(`cannot override ${u.map((t=>JSON.stringify(t))).join(",")}`,y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),s}))}function N(t,e){const r=e.wait.bind(e);e.wait=e=>r(e).then((e=>(e.events=e.logs.map((r=>{let n=(0,g.p$)(r),i=null;try{i=t.interface.parseLog(r)}catch(t){}return i&&(n.args=i.args,n.decode=(e,r)=>t.interface.decodeEventLog(i.eventFragment,e,r),n.event=i.name,n.eventSignature=i.signature),n.removeListener=()=>t.provider,n.getBlock=()=>t.provider.getBlock(e.blockHash),n.getTransaction=()=>t.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(e),n})),e)))}function S(t,e,r){const n=t.signer||t.provider;return function(...i){return b(this,void 0,void 0,(function*(){let o;if(i.length===e.inputs.length+1&&"object"==typeof i[i.length-1]){const t=(0,g.DC)(i.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,i.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const s=yield _(t,e,i),a=yield n.call(s,o);try{let n=t.interface.decodeFunctionResult(e,a);return r&&1===e.outputs.length&&(n=n[0]),n}catch(e){throw e.code===y.Yd.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=i,e.transaction=s),e}}))}}function T(t,e,r){return e.constant?S(t,e,r):function(t,e){return function(...r){return b(this,void 0,void 0,(function*(){t.signer||w.throwError("sending a transaction requires a signer",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const n=yield _(t,e,r),i=yield t.signer.sendTransaction(n);return N(t,i),i}))}}(t,e)}function k(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map((t=>Array.isArray(t)?t.join("|"):t)).join(":"):""):"*"}class R{constructor(t,e){(0,g.zG)(this,"tag",t),(0,g.zG)(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter((r=>!(!e&&r.listener===t&&(e=!0,1))))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((t=>t.listener))}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter((e=>{const r=t.slice();return setTimeout((()=>{e.listener.apply(this,r)}),0),!e.once})),e}prepareEvent(t){}getEmit(t){return[t]}}class x extends R{constructor(){super("error",null)}}class O extends R{constructor(t,e,r,n){const i={address:t};let o=e.getEventTopic(r);n?(o!==n[0]&&w.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[o],super(k(i),i),(0,g.zG)(this,"address",t),(0,g.zG)(this,"interface",e),(0,g.zG)(this,"fragment",r)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=(0,l.BR)(t.args);if(e.length)throw e[0].error;const r=(t.args||[]).slice();return r.push(t),r}}class I extends R{constructor(t,e){super("*",{address:t}),(0,g.zG)(this,"address",t),(0,g.zG)(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,r)=>this.interface.decodeEventLog(e.eventFragment,t,r),t.args=e.args}catch(t){}}}class C{constructor(t,e,r){w.checkNew(new.target,P),(0,g.zG)(this,"interface",(0,g.tu)(new.target,"getInterface")(e)),null==r?((0,g.zG)(this,"provider",null),(0,g.zG)(this,"signer",null)):f.E.isSigner(r)?((0,g.zG)(this,"provider",r.provider||null),(0,g.zG)(this,"signer",r)):c.zt.isProvider(r)?((0,g.zG)(this,"provider",r),(0,g.zG)(this,"signer",null)):w.throwArgumentError("invalid signer or provider","signerOrProvider",r),(0,g.zG)(this,"callStatic",{}),(0,g.zG)(this,"estimateGas",{}),(0,g.zG)(this,"functions",{}),(0,g.zG)(this,"populateTransaction",{}),(0,g.zG)(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach((e=>{const r=this.interface.events[e];(0,g.zG)(this.filters,e,((...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,t)}))),t[r.name]||(t[r.name]=[]),t[r.name].push(e)})),Object.keys(t).forEach((e=>{const r=t[e];1===r.length?(0,g.zG)(this.filters,e,this.filters[r[0]]):w.warn(`Duplicate definition of ${e} (${r.join(", ")})`)}))}if((0,g.zG)(this,"_runningEvents",{}),(0,g.zG)(this,"_wrappedEmits",{}),null==t&&w.throwArgumentError("invalid contract address or ENS name","addressOrName",t),(0,g.zG)(this,"address",t),this.provider)(0,g.zG)(this,"resolvedAddress",M(this.provider,t));else try{(0,g.zG)(this,"resolvedAddress",Promise.resolve((0,d.Kn)(t)))}catch(t){w.throwError("provider is required to use ENS name as contract address",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}const n={},i={};Object.keys(this.interface.functions).forEach((t=>{const e=this.interface.functions[t];if(i[t])w.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{i[t]=!0;{const r=e.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(t)}null==this[t]&&(0,g.zG)(this,t,T(this,e,!0)),null==this.functions[t]&&(0,g.zG)(this.functions,t,T(this,e,!1)),null==this.callStatic[t]&&(0,g.zG)(this.callStatic,t,S(this,e,!0)),null==this.populateTransaction[t]&&(0,g.zG)(this.populateTransaction,t,function(t,e){return function(...r){return _(t,e,r)}}(this,e)),null==this.estimateGas[t]&&(0,g.zG)(this.estimateGas,t,function(t,e){const r=t.signer||t.provider;return function(...n){return b(this,void 0,void 0,(function*(){r||w.throwError("estimate require a provider or signer",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield _(t,e,n);return yield r.estimateGas(i)}))}}(this,e))}})),Object.keys(n).forEach((t=>{const e=n[t];if(e.length>1)return;t=t.substring(1);const r=e[0];try{null==this[t]&&(0,g.zG)(this,t,this[r])}catch(t){}null==this.functions[t]&&(0,g.zG)(this.functions,t,this.functions[r]),null==this.callStatic[t]&&(0,g.zG)(this.callStatic,t,this.callStatic[r]),null==this.populateTransaction[t]&&(0,g.zG)(this.populateTransaction,t,this.populateTransaction[r]),null==this.estimateGas[t]&&(0,g.zG)(this.estimateGas,t,this.estimateGas[r])}))}static getContractAddress(t){return(0,d.CR)(t)}static getInterface(t){return h.vU.isInterface(t)?t:new h.vU(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,t).then((t=>("0x"===t&&w.throwError("contract not deployed",y.Yd.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(t){this.signer||w.throwError("sending a transactions require a signer",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=(0,g.DC)(t||{});return["from","to"].forEach((function(t){null!=e[t]&&w.throwError("cannot override "+t,y.Yd.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(e)))}connect(t){"string"==typeof t&&(t=new f.b(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&(0,g.zG)(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return h.Hk.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new x);if("event"===t)return this._normalizeRunningEvent(new R("event",null));if("*"===t)return this._normalizeRunningEvent(new I(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new O(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new O(this.address,this.interface,r,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new R(k(e),e))}return this._normalizeRunningEvent(new I(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,r){const n=(0,g.p$)(e);return n.removeListener=()=>{r&&(t.removeListener(r),this._checkRunningEvents(t))},n.getBlock=()=>this.provider.getBlock(e.blockHash),n.getTransaction=()=>this.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(n),n}_addEventListener(t,e,r){if(this.provider||w.throwError("events require a provider or a signer with a provider",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,r),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const r=r=>{let n=this._wrapEvent(t,r,e);if(null==n.decodeError)try{const e=t.getEmit(n);this.emit(t.filter,...e)}catch(t){n.decodeError=t.error}null!=t.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[t.tag]=r,null!=t.filter&&this.provider.on(t.filter,r)}}queryFilter(t,e,r){const n=this._getRunningEvent(t),i=(0,g.DC)(n.filter);return"string"==typeof e&&(0,m.A7)(e,32)?(null!=r&&w.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=e):(i.fromBlock=null!=e?e:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then((t=>t.map((t=>this._wrapEvent(n,t,null)))))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const r=this._getRunningEvent(t),n=r.run(e)>0;return this._checkRunningEvents(r),n}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce(((t,e)=>t+this._runningEvents[e].listenerCount()),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach((e=>{t.push(e)}));return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const r=this._getRunningEvent(t);return r.removeListener(e),this._checkRunningEvents(r),this}removeListener(t,e){return this.off(t,e)}}class P extends C{}class L{constructor(t,e,r){let n=null;n="string"==typeof e?e:(0,m._t)(e)?(0,m.Dv)(e):e&&"string"==typeof e.object?e.object:"!","0x"!==n.substring(0,2)&&(n="0x"+n),(!(0,m.A7)(n)||n.length%2)&&w.throwArgumentError("invalid bytecode","bytecode",e),r&&!f.E.isSigner(r)&&w.throwArgumentError("invalid signer","signer",r),(0,g.zG)(this,"bytecode",n),(0,g.zG)(this,"interface",(0,g.tu)(new.target,"getInterface")(t)),(0,g.zG)(this,"signer",r||null)}getDeployTransaction(...t){let e={};if(t.length===this.interface.deploy.inputs.length+1&&"object"==typeof t[t.length-1]){e=(0,g.DC)(t.pop());for(const t in e)if(!E[t])throw new Error("unknown transaction override "+t)}return["data","from","to"].forEach((t=>{null!=e[t]&&w.throwError("cannot override "+t,y.Yd.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.value&&(p.O$.from(e.value).isZero()||this.interface.deploy.payable||w.throwError("non-payable constructor cannot override value",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:e.value})),w.checkArgumentCount(t.length,this.interface.deploy.inputs.length," in Contract constructor"),e.data=(0,m.Dv)((0,m.zo)([this.bytecode,this.interface.encodeDeploy(t)])),e}deploy(...t){return b(this,void 0,void 0,(function*(){let e={};t.length===this.interface.deploy.inputs.length+1&&(e=t.pop()),w.checkArgumentCount(t.length,this.interface.deploy.inputs.length," in Contract constructor");const r=yield A(this.signer,t,this.interface.deploy.inputs);r.push(e);const n=this.getDeployTransaction(...r),i=yield this.signer.sendTransaction(n),o=(0,g.tu)(this.constructor,"getContractAddress")(i),s=(0,g.tu)(this.constructor,"getContract")(o,this.interface,this.signer);return N(s,i),(0,g.zG)(s,"deployTransaction",i),s}))}attach(t){return this.constructor.getContract(t,this.interface,this.signer)}connect(t){return new this.constructor(this.interface,this.bytecode,t)}static fromSolidity(t,e){null==t&&w.throwError("missing compiler output",y.Yd.errors.MISSING_ARGUMENT,{argument:"compilerOutput"}),"string"==typeof t&&(t=JSON.parse(t));const r=t.abi;let n=null;return t.bytecode?n=t.bytecode:t.evm&&t.evm.bytecode&&(n=t.evm.bytecode),new this(r,n,e)}static getInterface(t){return P.getInterface(t)}static getContractAddress(t){return(0,d.CR)(t)}static getContract(t,e,r){return new P(t,e,r)}}var U=r(3550),B=r.n(U);let D=!1,F=!1;const G={debug:1,default:2,info:2,warning:3,error:4,off:5};let j=G.default,q=null;const z=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var K,H;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(K||(K={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(H||(H={}));const $="0123456789abcdef";class V{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==G[r]&&this.throwArgumentError("invalid log level name","logLevel",t),j>G[r]||console.log.apply(console,e)}debug(...t){this._log(V.levels.DEBUG,t)}info(...t){this._log(V.levels.INFO,t)}warn(...t){this._log(V.levels.WARNING,t)}makeError(t,e,r){if(F)return this.makeError("censored error",e,{});e||(e=V.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=$[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case H.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case H.CALL_EXCEPTION:case H.INSUFFICIENT_FUNDS:case H.MISSING_NEW:case H.NONCE_EXPIRED:case H.REPLACEMENT_UNDERPRICED:case H.TRANSACTION_REPLACED:case H.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,V.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),z&&this.throwError("platform missing String.prototype.normalize",V.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:z})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,V.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,V.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,V.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",V.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",V.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",V.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return q||(q=new V("logger/5.7.0")),q}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",V.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),D){if(!t)return;this.globalLogger().throwError("error censorship permanent",V.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}F=!!t,D=!!e}static setLogLevel(t){const e=G[t.toLowerCase()];null!=e?j=e:V.globalLogger().warn("invalid log level - "+t)}static from(t){return new V(t)}}V.errors=H,V.levels=K;const W=new V("bytes/5.7.0");function Y(t){return!!t.toHexString}function J(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return J(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function X(t){return"number"==typeof t&&t==t&&t%1==0}function Z(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!X(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Q(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const tt="0123456789abcdef";function et(t,e){if(e||(e={}),"number"==typeof t){W.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=tt[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Y(t))return t.toHexString();if(Q(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":W.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Z(t)){let e="0x";for(let r=0;r>4]+tt[15&n]}return e}return W.throwArgumentError("invalid hexlify value","value",t)}function rt(t,e){for("string"!=typeof t?t=et(t):Q(t)||W.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&W.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}const nt="bignumber/5.5.0";var it=B().BN;const ot=new V(nt),st={},at=9007199254740991;let ut=!1;class lt{constructor(t,e){ot.checkNew(new.target,lt),t!==st&&ot.throwError("cannot call constructor directly; use BigNumber.from",V.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return ct(ft(this).fromTwos(t))}toTwos(t){return ct(ft(this).toTwos(t))}abs(){return"-"===this._hex[0]?lt.from(this._hex.substring(1)):this}add(t){return ct(ft(this).add(ft(t)))}sub(t){return ct(ft(this).sub(ft(t)))}div(t){return lt.from(t).isZero()&&dt("division by zero","div"),ct(ft(this).div(ft(t)))}mul(t){return ct(ft(this).mul(ft(t)))}mod(t){const e=ft(t);return e.isNeg()&&dt("cannot modulo negative values","mod"),ct(ft(this).umod(e))}pow(t){const e=ft(t);return e.isNeg()&&dt("cannot raise to negative values","pow"),ct(ft(this).pow(e))}and(t){const e=ft(t);return(this.isNegative()||e.isNeg())&&dt("cannot 'and' negative values","and"),ct(ft(this).and(e))}or(t){const e=ft(t);return(this.isNegative()||e.isNeg())&&dt("cannot 'or' negative values","or"),ct(ft(this).or(e))}xor(t){const e=ft(t);return(this.isNegative()||e.isNeg())&&dt("cannot 'xor' negative values","xor"),ct(ft(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&dt("cannot mask negative values","mask"),ct(ft(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&dt("cannot shift negative values","shl"),ct(ft(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&dt("cannot shift negative values","shr"),ct(ft(this).shrn(t))}eq(t){return ft(this).eq(ft(t))}lt(t){return ft(this).lt(ft(t))}lte(t){return ft(this).lte(ft(t))}gt(t){return ft(this).gt(ft(t))}gte(t){return ft(this).gte(ft(t))}isNegative(){return"-"===this._hex[0]}isZero(){return ft(this).isZero()}toNumber(){try{return ft(this).toNumber()}catch(t){dt("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return ot.throwError("this platform does not support BigInt",V.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?ut||(ut=!0,ot.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?ot.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",V.errors.UNEXPECTED_ARGUMENT,{}):ot.throwError("BigNumber.toString does not accept parameters",V.errors.UNEXPECTED_ARGUMENT,{})),ft(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof lt)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new lt(st,ht(t)):t.match(/^-?[0-9]+$/)?new lt(st,ht(new it(t))):ot.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&dt("underflow","BigNumber.from",t),(t>=at||t<=-at)&&dt("overflow","BigNumber.from",t),lt.from(String(t));const e=t;if("bigint"==typeof e)return lt.from(e.toString());if(Z(e))return lt.from(et(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return lt.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Q(t)||"-"===t[0]&&Q(t.substring(1))))return lt.from(t)}return ot.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function ht(t){if("string"!=typeof t)return ht(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&ot.throwArgumentError("invalid hex","value",t),"0x00"===(t=ht(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function ct(t){return lt.from(ht(t))}function ft(t){const e=lt.from(t).toHexString();return"-"===e[0]?new it("-"+e.substring(3),16):new it(e.substring(2),16)}function dt(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),ot.throwError(t,V.errors.NUMERIC_FAULT,n)}const pt=new V(nt),mt={},gt=lt.from(0),vt=lt.from(-1);function yt(t,e,r,n){const i={fault:e,operation:r};return void 0!==n&&(i.value=n),pt.throwError(t,V.errors.NUMERIC_FAULT,i)}let bt="0";for(;bt.length<256;)bt+=bt;function wt(t){if("number"!=typeof t)try{t=lt.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+bt.substring(0,t):pt.throwArgumentError("invalid decimal size","decimals",t)}function Et(t,e){null==e&&(e=0);const r=wt(e),n=(t=lt.from(t)).lt(gt);n&&(t=t.mul(vt));let i=t.mod(r).toString();for(;i.length2&&pt.throwArgumentError("too many decimal points","value",t);let o=i[0],s=i[1];for(o||(o="0"),s||(s="0");"0"===s[s.length-1];)s=s.substring(0,s.length-1);for(s.length>r.length-1&&yt("fractional component exceeds decimals","underflow","parseFixed"),""===s&&(s="0");s.lengthnull==t[e]?n:(typeof t[e]!==r&&pt.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&pt.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&pt.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new At(mt,e,r,n)}}class _t{constructor(t,e,r,n){pt.checkNew(new.target,_t),t!==mt&&pt.throwError("cannot use FixedNumber constructor; use FixedNumber.from",V.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=e,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&pt.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=Mt(this._value,this.format.decimals),r=Mt(t._value,t.format.decimals);return _t.fromValue(e.add(r),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=Mt(this._value,this.format.decimals),r=Mt(t._value,t.format.decimals);return _t.fromValue(e.sub(r),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=Mt(this._value,this.format.decimals),r=Mt(t._value,t.format.decimals);return _t.fromValue(e.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=Mt(this._value,this.format.decimals),r=Mt(t._value,t.format.decimals);return _t.fromValue(e.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=_t.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(e=e.subUnsafe(Nt.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=_t.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(e=e.addUnsafe(Nt.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&pt.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const r=_t.from("1"+bt.substring(0,t),this.format),n=St.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){return null==t?this._hex:(t%8&&pt.throwArgumentError("invalid byte width","width",t),rt(lt.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8))}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return _t.fromString(this._value,t)}static fromValue(t,e,r){return null!=r||null==e||function(t){return null!=t&&(lt.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||Q(t)||"bigint"==typeof t||Z(t))}(e)||(r=e,e=null),null==e&&(e=0),null==r&&(r="fixed"),_t.fromString(Et(t,e),At.from(r))}static fromString(t,e){null==e&&(e="fixed");const r=At.from(e),n=Mt(t,r.decimals);!r.signed&&n.lt(gt)&&yt("unsigned value cannot be negative","overflow","value",t);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=rt(i,r.width/8));const o=Et(n,r.decimals);return new _t(mt,i,o,r)}static fromBytes(t,e){null==e&&(e="fixed");const r=At.from(e);if(function(t,e){if(e||(e={}),"number"==typeof t){W.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),J(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Y(t)&&(t=t.toHexString()),Q(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":W.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;tr.width/8)throw new Error("overflow");let n=lt.from(t);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=Et(n,r.decimals);return new _t(mt,i,o,r)}static from(t,e){if("string"==typeof t)return _t.fromString(t,e);if(Z(t))return _t.fromBytes(t,e);try{return _t.fromValue(t,0,e)}catch(t){if(t.code!==V.errors.INVALID_ARGUMENT)throw t}return pt.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const Nt=_t.from(1),St=_t.from("0.5");let Tt=!1,kt=!1;const Rt={debug:1,default:2,info:2,warning:3,error:4,off:5};let xt=Rt.default,Ot=null;const It=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Ct,Pt;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Ct||(Ct={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Pt||(Pt={}));const Lt="0123456789abcdef";class Ut{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Rt[r]&&this.throwArgumentError("invalid log level name","logLevel",t),xt>Rt[r]||console.log.apply(console,e)}debug(...t){this._log(Ut.levels.DEBUG,t)}info(...t){this._log(Ut.levels.INFO,t)}warn(...t){this._log(Ut.levels.WARNING,t)}makeError(t,e,r){if(kt)return this.makeError("censored error",e,{});e||(e=Ut.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Lt[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Pt.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Pt.CALL_EXCEPTION:case Pt.INSUFFICIENT_FUNDS:case Pt.MISSING_NEW:case Pt.NONCE_EXPIRED:case Pt.REPLACEMENT_UNDERPRICED:case Pt.TRANSACTION_REPLACED:case Pt.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Ut.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),It&&this.throwError("platform missing String.prototype.normalize",Ut.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:It})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Ut.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Ut.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,Ut.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Ut.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Ut.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Ut.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Ot||(Ot=new Ut("logger/5.7.0")),Ot}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Ut.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Tt){if(!t)return;this.globalLogger().throwError("error censorship permanent",Ut.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}kt=!!t,Tt=!!e}static setLogLevel(t){const e=Rt[t.toLowerCase()];null!=e?xt=e:Ut.globalLogger().warn("invalid log level - "+t)}static from(t){return new Ut(t)}}Ut.errors=Pt,Ut.levels=Ct;function Bt(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function Dt(t){return e=this,r=void 0,i=function*(){const e=Object.keys(t).map((e=>{const r=t[e];return Promise.resolve(r).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})},new((n=void 0)||(n=Promise))((function(t,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(t){t(r)}))).then(s,a)}u((i=i.apply(e,r||[])).next())}));var e,r,n,i}new Ut("properties/5.7.0");var Ft=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Gt=new Ut("abstract-signer/5.5.0"),jt=["accessList","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],qt=[Ut.errors.INSUFFICIENT_FUNDS,Ut.errors.NONCE_EXPIRED,Ut.errors.REPLACEMENT_UNDERPRICED];class zt{constructor(){Gt.checkAbstract(new.target,zt),Bt(this,"_isSigner",!0)}getBalance(t){return Ft(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return Ft(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return Ft(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const e=yield Dt(this.checkTransaction(t));return yield this.provider.estimateGas(e)}))}call(t,e){return Ft(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield Dt(this.checkTransaction(t));return yield this.provider.call(r,e)}))}sendTransaction(t){return Ft(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),r=yield this.signTransaction(e);return yield this.provider.sendTransaction(r)}))}getChainId(){return Ft(this,void 0,void 0,(function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return Ft(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return Ft(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return Ft(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===jt.indexOf(e)&&Gt.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=function(t){const e={};for(const r in t)e[r]=t[r];return e}(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then((e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&Gt.throwArgumentError("from address mismatch","transaction",t),e[0]))),e}populateTransaction(t){return Ft(this,void 0,void 0,(function*(){const e=yield Dt(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then((t=>Ft(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&Gt.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})))),e.to.catch((t=>{})));const r=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!r?0!==e.type&&1!==e.type||!r||Gt.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):Gt.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(r&&Gt.throwError("network does not support EIP-1559",Ut.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):Gt.throwError("failed to get consistent fee data",Ut.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch((t=>{if(qt.indexOf(t.code)>=0)throw t;return Gt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Ut.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})}))),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then((e=>(0!==e[1]&&e[0]!==e[1]&&Gt.throwArgumentError("chainId address mismatch","transaction",t),e[0]))),yield Dt(e)}))}_checkProvider(t){this.provider||Gt.throwError("missing provider",Ut.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class Kt extends zt{constructor(t,e){Gt.checkNew(new.target,Kt),super(),Bt(this,"address",t),Bt(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then((()=>{Gt.throwError(t,Ut.errors.UNSUPPORTED_OPERATION,{operation:e})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new Kt(this.address,t)}}var Ht=r(3684),$t=r(7827),Vt=r(6274),Wt=r(8197),Yt=r(4478),Jt=r(2768),Xt=r(1964),Zt=r(9380),Qt=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const te=new y.Yd("wallet/5.5.0");class ee extends f.E{constructor(t,e){if(te.checkNew(new.target,ee),super(),null!=(r=t)&&(0,m.A7)(r.privateKey,32)&&null!=r.address){const e=new Jt.Et(t.privateKey);if((0,g.zG)(this,"_signingKey",(()=>e)),(0,g.zG)(this,"address",(0,v.db)(this.publicKey)),this.address!==(0,d.Kn)(t.address)&&te.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(t){const e=t.mnemonic;return e&&e.phrase}(t)){const e=t.mnemonic;(0,g.zG)(this,"_mnemonic",(()=>({phrase:e.phrase,path:e.path||Vt.cD,locale:e.locale||"en"})));const r=this.mnemonic,n=Vt.m$.fromMnemonic(r.phrase,null,r.locale).derivePath(r.path);(0,v.db)(n.privateKey)!==this.address&&te.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else(0,g.zG)(this,"_mnemonic",(()=>null))}else{if(Jt.Et.isSigningKey(t))"secp256k1"!==t.curve&&te.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),(0,g.zG)(this,"_signingKey",(()=>t));else{"string"==typeof t&&t.match(/^[0-9a-f]*$/i)&&64===t.length&&(t="0x"+t);const e=new Jt.Et(t);(0,g.zG)(this,"_signingKey",(()=>e))}(0,g.zG)(this,"_mnemonic",(()=>null)),(0,g.zG)(this,"address",(0,v.db)(this.publicKey))}var r;e&&!c.zt.isProvider(e)&&te.throwArgumentError("invalid provider","provider",e),(0,g.zG)(this,"provider",e||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(t){return new ee(this,t)}signTransaction(t){return(0,g.mE)(t).then((e=>{null!=e.from&&((0,d.Kn)(e.from)!==this.address&&te.throwArgumentError("transaction from address mismatch","transaction.from",t.from),delete e.from);const r=this._signingKey().signDigest((0,Wt.w)((0,v.qC)(e)));return(0,v.qC)(e,r)}))}signMessage(t){return Qt(this,void 0,void 0,(function*(){return(0,m.gV)(this._signingKey().signDigest((0,Ht.r)(t)))}))}_signTypedData(t,e,r){return Qt(this,void 0,void 0,(function*(){const n=yield $t.E.resolveNames(t,e,r,(t=>(null==this.provider&&te.throwError("cannot resolve ENS names without a provider",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:t}),this.provider.resolveName(t))));return(0,m.gV)(this._signingKey().signDigest($t.E.hash(n.domain,e,n.value)))}))}encrypt(t,e,r){if("function"!=typeof e||r||(r=e,e={}),r&&"function"!=typeof r)throw new Error("invalid callback");return e||(e={}),(0,Xt.HI)(this,t,e,r)}static createRandom(t){let e=(0,Yt.O)(16);t||(t={}),t.extraEntropy&&(e=(0,m.lE)((0,m.p3)((0,Wt.w)((0,m.zo)([e,t.extraEntropy])),0,16)));const r=(0,Vt.JJ)(e,t.locale);return ee.fromMnemonic(r,t.path,t.locale)}static fromEncryptedJson(t,e,r){return(0,Zt.w)(t,e,r).then((t=>new ee(t)))}static fromEncryptedJsonSync(t,e){return new ee((0,Zt.qz)(t,e))}static fromMnemonic(t,e,r){return e||(e=Vt.cD),new ee(Vt.m$.fromMnemonic(t,null,r).derivePath(e))}}function re(t,e){return(0,v.RJ)((0,Ht.r)(t),e)}function ne(t,e,r,n){return(0,v.RJ)($t.E.hash(t,e,r),n)}const ie="0x0000000000000000000000000000000000000000";var oe=r(7328),se=r.n(oe);let ae=!1,ue=!1;const le={debug:1,default:2,info:2,warning:3,error:4,off:5};let he=le.default,ce=null;const fe=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var de,pe;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(de||(de={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(pe||(pe={}));const me="0123456789abcdef";class ge{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==le[r]&&this.throwArgumentError("invalid log level name","logLevel",t),he>le[r]||console.log.apply(console,e)}debug(...t){this._log(ge.levels.DEBUG,t)}info(...t){this._log(ge.levels.INFO,t)}warn(...t){this._log(ge.levels.WARNING,t)}makeError(t,e,r){if(ue)return this.makeError("censored error",e,{});e||(e=ge.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=me[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case pe.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case pe.CALL_EXCEPTION:case pe.INSUFFICIENT_FUNDS:case pe.MISSING_NEW:case pe.NONCE_EXPIRED:case pe.REPLACEMENT_UNDERPRICED:case pe.TRANSACTION_REPLACED:case pe.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,ge.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),fe&&this.throwError("platform missing String.prototype.normalize",ge.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:fe})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,ge.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,ge.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,ge.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",ge.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",ge.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",ge.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return ce||(ce=new ge("logger/5.7.0")),ce}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",ge.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ae){if(!t)return;this.globalLogger().throwError("error censorship permanent",ge.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ue=!!t,ae=!!e}static setLogLevel(t){const e=le[t.toLowerCase()];null!=e?he=e:ge.globalLogger().warn("invalid log level - "+t)}static from(t){return new ge(t)}}ge.errors=pe,ge.levels=de;const ve=new ge("bytes/5.7.0");function ye(t){return"number"==typeof t&&t==t&&t%1==0}function be(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!ye(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function we(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Ee="0123456789abcdef";var Me=se().BN;const Ae=new ge("bignumber/5.7.0"),_e={};let Ne=!1;class Se{constructor(t,e){t!==_e&&Ae.throwError("cannot call constructor directly; use BigNumber.from",ge.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return ke(Re(this).fromTwos(t))}toTwos(t){return ke(Re(this).toTwos(t))}abs(){return"-"===this._hex[0]?Se.from(this._hex.substring(1)):this}add(t){return ke(Re(this).add(Re(t)))}sub(t){return ke(Re(this).sub(Re(t)))}div(t){return Se.from(t).isZero()&&xe("division-by-zero","div"),ke(Re(this).div(Re(t)))}mul(t){return ke(Re(this).mul(Re(t)))}mod(t){const e=Re(t);return e.isNeg()&&xe("division-by-zero","mod"),ke(Re(this).umod(e))}pow(t){const e=Re(t);return e.isNeg()&&xe("negative-power","pow"),ke(Re(this).pow(e))}and(t){const e=Re(t);return(this.isNegative()||e.isNeg())&&xe("unbound-bitwise-result","and"),ke(Re(this).and(e))}or(t){const e=Re(t);return(this.isNegative()||e.isNeg())&&xe("unbound-bitwise-result","or"),ke(Re(this).or(e))}xor(t){const e=Re(t);return(this.isNegative()||e.isNeg())&&xe("unbound-bitwise-result","xor"),ke(Re(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&xe("negative-width","mask"),ke(Re(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&xe("negative-width","shl"),ke(Re(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&xe("negative-width","shr"),ke(Re(this).shrn(t))}eq(t){return Re(this).eq(Re(t))}lt(t){return Re(this).lt(Re(t))}lte(t){return Re(this).lte(Re(t))}gt(t){return Re(this).gt(Re(t))}gte(t){return Re(this).gte(Re(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Re(this).isZero()}toNumber(){try{return Re(this).toNumber()}catch(t){xe("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Ae.throwError("this platform does not support BigInt",ge.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Ne||(Ne=!0,Ae.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ae.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ge.errors.UNEXPECTED_ARGUMENT,{}):Ae.throwError("BigNumber.toString does not accept parameters",ge.errors.UNEXPECTED_ARGUMENT,{})),Re(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Se)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Se(_e,Te(t)):t.match(/^-?[0-9]+$/)?new Se(_e,Te(new Me(t))):Ae.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&xe("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&xe("overflow","BigNumber.from",t),Se.from(String(t));const e=t;if("bigint"==typeof e)return Se.from(e.toString());if(be(e))return Se.from(function(t,e){if(e||(e={}),"number"==typeof t){ve.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Ee[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t))return t.toHexString();if(we(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":ve.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(be(t)){let e="0x";for(let r=0;r>4]+Ee[15&n]}return e}return ve.throwArgumentError("invalid hexlify value","value",t)}(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Se.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(we(t)||"-"===t[0]&&we(t.substring(1))))return Se.from(t)}return Ae.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Te(t){if("string"!=typeof t)return Te(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Ae.throwArgumentError("invalid hex","value",t),"0x00"===(t=Te(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function ke(t){return Se.from(Te(t))}function Re(t){const e=Se.from(t).toHexString();return"-"===e[0]?new Me("-"+e.substring(3),16):new Me(e.substring(2),16)}function xe(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),Ae.throwError(t,ge.errors.NUMERIC_FAULT,n)}const Oe=Se.from(-1),Ie=Se.from(0),Ce=Se.from(1),Pe=Se.from(2),Le=Se.from("1000000000000000000"),Ue=Se.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Be=Se.from("-0x8000000000000000000000000000000000000000000000000000000000000000"),De=Se.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Fe="0x0000000000000000000000000000000000000000000000000000000000000000",Ge="Ξ";var je=r(9861),qe=r(7727),ze=r(7218),Ke=r(8339),He=r(3951),$e=r(4242),Ve=r(8341),We=r(2882),Ye=r.n(We);const Je="providers/5.5.2";var Xe=r(9279);const Ze=new y.Yd(Je);class Qe{constructor(){Ze.checkNew(new.target,Qe),this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),r=this.bigNumber.bind(this),n=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),s=this.hex.bind(this),a=this.number.bind(this),u=this.type.bind(this);return t.transaction={hash:o,type:u,accessList:Qe.allowNull(this.accessList.bind(this),null),blockHash:Qe.allowNull(o,null),blockNumber:Qe.allowNull(a,null),transactionIndex:Qe.allowNull(a,null),confirmations:Qe.allowNull(a,null),from:e,gasPrice:Qe.allowNull(r),maxPriorityFeePerGas:Qe.allowNull(r),maxFeePerGas:Qe.allowNull(r),gasLimit:r,to:Qe.allowNull(e,null),value:r,nonce:a,data:i,r:Qe.allowNull(this.uint256),s:Qe.allowNull(this.uint256),v:Qe.allowNull(a),creates:Qe.allowNull(e,null),raw:Qe.allowNull(i)},t.transactionRequest={from:Qe.allowNull(e),nonce:Qe.allowNull(a),gasLimit:Qe.allowNull(r),gasPrice:Qe.allowNull(r),maxPriorityFeePerGas:Qe.allowNull(r),maxFeePerGas:Qe.allowNull(r),to:Qe.allowNull(e),value:Qe.allowNull(r),data:Qe.allowNull((t=>this.data(t,!0))),type:Qe.allowNull(a),accessList:Qe.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:o,address:e,topics:Qe.arrayOf(o),data:i,logIndex:a,blockHash:o},t.receipt={to:Qe.allowNull(this.address,null),from:Qe.allowNull(this.address,null),contractAddress:Qe.allowNull(e,null),transactionIndex:a,root:Qe.allowNull(s),gasUsed:r,logsBloom:Qe.allowNull(i),blockHash:o,transactionHash:o,logs:Qe.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Qe.allowNull(a,null),cumulativeGasUsed:r,effectiveGasPrice:Qe.allowNull(r),status:Qe.allowNull(a),type:u},t.block={hash:o,parentHash:o,number:a,timestamp:a,nonce:Qe.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:e,extraData:i,transactions:Qe.allowNull(Qe.arrayOf(o)),baseFeePerGas:Qe.allowNull(r)},t.blockWithTransactions=(0,g.DC)(t.block),t.blockWithTransactions.transactions=Qe.allowNull(Qe.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:Qe.allowNull(n,void 0),toBlock:Qe.allowNull(n,void 0),blockHash:Qe.allowNull(o,void 0),address:Qe.allowNull(e,void 0),topics:Qe.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:Qe.allowNull(a),blockHash:Qe.allowNull(o),transactionIndex:a,removed:Qe.allowNull(this.boolean.bind(this)),address:e,data:Qe.allowFalsish(i,"0x"),topics:Qe.arrayOf(o),transactionHash:o,logIndex:a},t}accessList(t){return(0,v.z7)(t||[])}number(t){return"0x"===t?0:p.O$.from(t).toNumber()}type(t){return"0x"===t||null==t?0:p.O$.from(t).toNumber()}bigNumber(t){return p.O$.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),(0,m.A7)(t))?t.toLowerCase():Ze.throwArgumentError("invalid hash","value",t)}data(t,e){const r=this.hex(t,e);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+t);return r}address(t){return(0,d.Kn)(t)}callAddress(t){if(!(0,m.A7)(t,32))return null;const e=(0,d.Kn)((0,m.p3)(t,12));return e===Xe.d?null:e}contractAddress(t){return(0,d.CR)(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";if("latest"===t||"pending"===t)return t;if("number"==typeof t||(0,m.A7)(t))return(0,m.$P)(t);throw new Error("invalid blockTag")}hash(t,e){const r=this.hex(t,e);return 32!==(0,m.E1)(r)?Ze.throwArgumentError("invalid hash","value",t):r}difficulty(t){if(null==t)return null;const e=p.O$.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!(0,m.A7)(t))throw new Error("invalid uint256");return(0,m.$m)(t,32)}_block(t,e){null!=t.author&&null==t.miner&&(t.miner=t.author);const r=null!=t._difficulty?t._difficulty:t.difficulty,n=Qe.check(e,t);return n._difficulty=null==r?null:p.O$.from(r),n}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return Qe.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&p.O$.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1!==t.type&&2!==t.type||null!=t.accessList||(t.accessList=[]);const e=Qe.check(this.formats.transaction,t);if(null!=t.chainId){let r=t.chainId;(0,m.A7)(r)&&(r=p.O$.from(r).toNumber()),e.chainId=r}else{let r=t.networkId;null==r&&null==e.v&&(r=t.chainId),(0,m.A7)(r)&&(r=p.O$.from(r).toNumber()),"number"!=typeof r&&null!=e.v&&(r=(e.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),e.chainId=r}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return(0,v.Qc)(t)}receiptLog(t){return Qe.check(this.formats.receiptLog,t)}receipt(t){const e=Qe.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=p.O$.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&&Ze.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):Ze.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&&Ze.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map((t=>this.topics(t))):null!=t?this.hash(t,!0):null}filter(t){return Qe.check(this.formats.filter,t)}filterLog(t){return Qe.check(this.formats.filterLog,t)}static check(t,e){const r={};for(const n in t)try{const i=t[n](e[n]);void 0!==i&&(r[n]=i)}catch(t){throw t.checkKey=n,t.checkValue=e[n],t}return r}static allowNull(t,e){return function(r){return null==r?e:t(r)}}static allowFalsish(t,e){return function(r){return r?t(r):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const r=[];return e.forEach((function(e){r.push(t(e))})),r}}}function tr(t){return t&&"function"==typeof t.isCommunityResource}function er(t){return tr(t)&&t.isCommunityResource()}let rr=!1;function nr(){rr||(rr=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var ir=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const or=new y.Yd(Je);function sr(t){return null==t?"null":(32!==(0,m.E1)(t)&&or.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function ar(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map((t=>{if(Array.isArray(t)){const e={};t.forEach((t=>{e[sr(t)]=!0}));const r=Object.keys(e);return r.sort(),r.join("|")}return sr(t)})).join("&")}function ur(t){if("string"==typeof t){if(t=t.toLowerCase(),32===(0,m.E1)(t))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+ar(t);if(c.Sg.isForkEvent(t))throw or.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+ar(t.topics||[])}throw new Error("invalid event - "+t)}function lr(){return(new Date).getTime()}function hr(t){return new Promise((e=>{setTimeout(e,t)}))}const cr=["block","network","pending","poll"];class fr{constructor(t,e,r){(0,g.zG)(this,"tag",t),(0,g.zG)(this,"listener",e),(0,g.zG)(this,"once",r)}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],r=""===(n=t[2])?[]:n.split(/&/g).map((t=>{if(""===t)return[];const e=t.split("|").map((t=>"null"===t?null:t));return 1===e.length?e[0]:e}));var n;const i={};return r.length>0&&(i.topics=r),e&&"*"!==e&&(i.address=e),i}pollable(){return this.tag.indexOf(":")>=0||cr.indexOf(this.tag)>=0}}const dr={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function pr(t){return(0,m.$m)(p.O$.from(t).toHexString(),32)}function mr(t){return qe.eU.encode((0,m.zo)([t,(0,m.p3)((0,He.JQ)((0,He.JQ)(t)),0,4)]))}const gr=new RegExp("^(ipfs)://(.*)$","i"),vr=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),gr,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function yr(t){try{return(0,$e.ZN)(br(t))}catch(t){}return null}function br(t){if("0x"===t)return null;const e=p.O$.from((0,m.p3)(t,0,32)).toNumber(),r=p.O$.from((0,m.p3)(t,e,e+32)).toNumber();return(0,m.p3)(t,e+32,e+32+r)}function wr(t){return`https://gateway.ipfs.io/ipfs/${t.substring(7)}`}class Er{constructor(t,e,r,n){(0,g.zG)(this,"provider",t),(0,g.zG)(this,"name",r),(0,g.zG)(this,"address",t.formatter.address(e)),(0,g.zG)(this,"_resolvedAddress",n)}_fetchBytes(t,e){return ir(this,void 0,void 0,(function*(){const r={to:this.address,data:(0,m.xs)([t,(0,Ke.VM)(this.name),e||"0x"])};try{return br(yield this.provider.call(r))}catch(t){return t.code,y.Yd.errors.CALL_EXCEPTION,null}}))}_getAddress(t,e){const r=dr[String(t)];if(null==r&&or.throwError(`unsupported coin type: ${t}`,y.Yd.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===r.ilk)return this.provider.formatter.address(e);const n=(0,m.lE)(e);if(null!=r.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return mr((0,m.zo)([[r.p2pkh],"0x"+t[2]]))}}if(null!=r.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return mr((0,m.zo)([[r.p2sh],"0x"+t[2]]))}}if(null!=r.prefix){const t=n[1];let e=n[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&n.length===2+t&&t>=1&&t<=75){const t=Ye().toWords(n.slice(2));return t.unshift(e),Ye().encode(r.prefix,t)}}return null}getAddress(t){return ir(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t)try{const t={to:this.address,data:"0x3b3b57de"+(0,Ke.VM)(this.name).substring(2)},e=yield this.provider.call(t);return"0x"===e||e===ze.R?null:this.provider.formatter.callAddress(e)}catch(t){if(t.code===y.Yd.errors.CALL_EXCEPTION)return null;throw t}const e=yield this._fetchBytes("0xf1cb7e06",pr(t));if(null==e||"0x"===e)return null;const r=this._getAddress(t,e);return null==r&&or.throwError("invalid or unsupported coin data",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),r}))}getAvatar(){return ir(this,void 0,void 0,(function*(){const t=[{type:"name",content:this.name}];try{const e=yield this.getText("avatar");if(null==e)return null;for(let r=0;r{})),this._ready().catch((t=>{}));else{const e=(0,g.tu)(new.target,"getNetwork")(t);e?((0,g.zG)(this,"_network",e),this.emit("network",e,null)):or.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ir(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||or.throwError("no network detected",y.Yd.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:(0,g.zG)(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return(0,Ve.$l)((()=>this._ready().then((t=>t),(t=>{if(t.code!==y.Yd.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))))}static getFormatter(){return null==Mr&&(Mr=new Qe),Mr}static getNetwork(t){return(0,je.H)(null==t?"homestead":t)}_getInternalBlockNumber(t){return ir(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const r=yield e;if(lr()-r.respTime<=t)return r.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=lr(),r=(0,g.mE)({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((t=>null),(t=>t))}).then((({blockNumber:t,networkError:n})=>{if(n)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),n;const i=lr();return(t=p.O$.from(t).toNumber()){this._internalBlockNumber===r&&(this._internalBlockNumber=null)})),(yield r).blockNumber}))}poll(){return ir(this,void 0,void 0,(function*(){const t=Ar++,e=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(r),this.emit("poll",t,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)or.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",or.makeError("network block skew detected",y.Yd.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let t=this._emitted.block+1;t<=r;t++)this.emit("block",t);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach((t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&r-e>12&&delete this._emitted[t]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach((t=>{switch(t.type){case"tx":{const r=t.hash;let n=this.getTransactionReceipt(r).then((t=>t&&null!=t.blockNumber?(this._emitted["t:"+r]=t.blockNumber,this.emit(r,t),null):null)).catch((t=>{this.emit("error",t)}));e.push(n);break}case"filter":{const n=t.filter;n.fromBlock=this._lastBlockNumber+1,n.toBlock=r;const i=this.getLogs(n).then((t=>{0!==t.length&&t.forEach((t=>{this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(n,t)}))})).catch((t=>{this.emit("error",t)}));e.push(i);break}}})),this._lastBlockNumber=r,Promise.all(e).then((()=>{this.emit("didPoll",t)})).catch((t=>{this.emit("error",t)}))}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return ir(this,void 0,void 0,(function*(){return or.throwError("provider does not support network detection",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return ir(this,void 0,void 0,(function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",e,t),yield hr(0),this._network;const r=or.makeError("underlying network changed",y.Yd.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",r),r}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((t=>{this._setFastBlockNumber(t)}),(t=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const t=lr();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&tthis._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,r){return ir(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==e?1:e,r||0,null)}))}_waitForTransaction(t,e,r,n){return ir(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(t);return(i?i.confirmations:0)>=e?i:new Promise(((i,o)=>{const s=[];let a=!1;const u=function(){return!!a||(a=!0,s.forEach((t=>{t()})),!1)},l=t=>{t.confirmations{this.removeListener(t,l)})),n){let r=n.startBlock,i=null;const l=s=>ir(this,void 0,void 0,(function*(){a||(yield hr(1e3),this.getTransactionCount(n.from).then((h=>ir(this,void 0,void 0,(function*(){if(!a){if(h<=n.nonce)r=s;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==i&&(i=r-3,i{a||this.once("block",l)})))}));if(a)return;this.once("block",l),s.push((()=>{this.removeListener("block",l)}))}if("number"==typeof r&&r>0){const t=setTimeout((()=>{u()||o(or.makeError("timeout exceeded",y.Yd.errors.TIMEOUT,{timeout:r}))}),r);t.unref&&t.unref(),s.push((()=>{clearTimeout(t)}))}}))}))}getBlockNumber(){return ir(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return p.O$.from(t)}catch(e){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}}))}getBalance(t,e){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,g.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getBalance",r);try{return p.O$.from(n)}catch(t){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"getBalance",params:r,result:n,error:t})}}))}getTransactionCount(t,e){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,g.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getTransactionCount",r);try{return p.O$.from(n).toNumber()}catch(t){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:n,error:t})}}))}getCode(t,e){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,g.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getCode",r);try{return(0,m.Dv)(n)}catch(t){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"getCode",params:r,result:n,error:t})}}))}getStorageAt(t,e,r){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield(0,g.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(r),position:Promise.resolve(e).then((t=>(0,m.$P)(t)))}),i=yield this.perform("getStorageAt",n);try{return(0,m.Dv)(i)}catch(t){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:i,error:t})}}))}_wrapTransaction(t,e,r){if(null!=e&&32!==(0,m.E1)(e))throw new Error("invalid response - sendTransaction");const n=t;return null!=e&&t.hash!==e&&or.throwError("Transaction hash mismatch from Provider.sendTransaction.",y.Yd.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),n.wait=(e,n)=>ir(this,void 0,void 0,(function*(){let i;null==e&&(e=1),null==n&&(n=0),0!==e&&null!=r&&(i={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:r});const o=yield this._waitForTransaction(t.hash,e,n,i);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&&or.throwError("transaction failed",y.Yd.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),n}sendTransaction(t){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then((t=>(0,m.Dv)(t))),r=this.formatter.transaction(t);null==r.confirmations&&(r.confirmations=0);const n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(r,t,n)}catch(t){throw t.transaction=r,t.transactionHash=r.hash,t}}))}_getTransactionRequest(t){return ir(this,void 0,void 0,(function*(){const e=yield t,r={};return["from","to"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?this._getAddress(t):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?p.O$.from(t):null)))})),["type"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>null!=t?t:null)))})),e.accessList&&(r.accessList=this.formatter.accessList(e.accessList)),["data"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?(0,m.Dv)(t):null)))})),this.formatter.transactionRequest(yield(0,g.mE)(r))}))}_getFilter(t){return ir(this,void 0,void 0,(function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach((r=>{null!=t[r]&&(e[r]=t[r])})),["fromBlock","toBlock"].forEach((r=>{null!=t[r]&&(e[r]=this._getBlockTag(t[r]))})),this.formatter.filter(yield(0,g.mE)(e))}))}call(t,e){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,g.mE)({transaction:this._getTransactionRequest(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("call",r);try{return(0,m.Dv)(n)}catch(t){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"call",params:r,result:n,error:t})}}))}estimateGas(t){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield(0,g.mE)({transaction:this._getTransactionRequest(t)}),r=yield this.perform("estimateGas",e);try{return p.O$.from(r)}catch(t){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"estimateGas",params:e,result:r,error:t})}}))}_getAddress(t){return ir(this,void 0,void 0,(function*(){"string"!=typeof(t=yield t)&&or.throwArgumentError("invalid address or ENS name","name",t);const e=yield this.resolveName(t);return null==e&&or.throwError("ENS name not configured",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(t)})`}),e}))}_getBlock(t,e){return ir(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;let r=-128;const n={includeTransactions:!!e};if((0,m.A7)(t,32))n.blockHash=t;else try{n.blockTag=yield this._getBlockTag(t),(0,m.A7)(n.blockTag)&&(r=parseInt(n.blockTag.substring(2),16))}catch(e){or.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",t)}return(0,Ve.$l)((()=>ir(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",n);if(null==t)return null!=n.blockHash&&null==this._emitted["b:"+n.blockHash]||null!=n.blockTag&&r>this._emitted.block?null:void 0;if(e){let e=null;for(let r=0;rthis._wrapTransaction(t))),r}return this.formatter.block(t)}))),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return ir(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return(0,Ve.$l)((()=>ir(this,void 0,void 0,(function*(){const r=yield this.perform("getTransaction",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;const n=this.formatter.transactionResponse(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return this._wrapTransaction(n)}))),{oncePoll:this})}))}getTransactionReceipt(t){return ir(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return(0,Ve.$l)((()=>ir(this,void 0,void 0,(function*(){const r=yield this.perform("getTransactionReceipt",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;if(null==r.blockHash)return;const n=this.formatter.receipt(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return n}))),{oncePoll:this})}))}getLogs(t){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield(0,g.mE)({filter:this._getFilter(t)}),r=yield this.perform("getLogs",e);return r.forEach((t=>{null==t.removed&&(t.removed=!1)})),Qe.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return ir(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return ir(this,void 0,void 0,(function*(){if("number"==typeof(t=yield t)&&t<0){t%1&&or.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)}))}getResolver(t){return ir(this,void 0,void 0,(function*(){try{const e=yield this._getResolver(t);return null==e?null:new Er(this,e,t)}catch(t){if(t.code===y.Yd.errors.CALL_EXCEPTION)return null;throw t}}))}_getResolver(t){return ir(this,void 0,void 0,(function*(){const e=yield this.getNetwork();e.ensAddress||or.throwError("network does not support ENS",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"ENS",network:e.name});const r={to:e.ensAddress,data:"0x0178b8bf"+(0,Ke.VM)(t).substring(2)};try{return this.formatter.callAddress(yield this.call(r))}catch(t){if(t.code===y.Yd.errors.CALL_EXCEPTION)return null;throw t}}))}resolveName(t){return ir(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if((0,m.A7)(t))throw e}"string"!=typeof t&&or.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null}))}lookupAddress(t){return ir(this,void 0,void 0,(function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(e);if(!r)return null;let n=(0,m.lE)(yield this.call({to:r,data:"0x691f3431"+(0,Ke.VM)(e).substring(2)}));if(n.length<32||!p.O$.from(n.slice(0,32)).eq(32))return null;if(n=n.slice(32),n.length<32)return null;const i=p.O$.from(n.slice(0,32)).toNumber();if(n=n.slice(32),i>n.length)return null;const o=(0,$e.ZN)(n.slice(0,i));return(yield this.resolveName(o))!=t?null:o}))}getAvatar(t){return ir(this,void 0,void 0,(function*(){let e=null;if((0,m.A7)(t)){const r=this.formatter.address(t),n=r.substring(2).toLowerCase()+".addr.reverse",i=yield this._getResolver(n);if(!i)return null;e=new Er(this,i,"_",r)}else if(e=yield this.getResolver(t),!e)return null;const r=yield e.getAvatar();return null==r?null:r.url}))}perform(t,e){return or.throwError(t+" not implemented",y.Yd.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_stopEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_addEventListener(t,e,r){const n=new fr(ur(t),e,r);return this._events.push(n),this._startEvent(n),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let r=!1,n=[],i=ur(t);return this._events=this._events.filter((t=>t.tag!==i||(setTimeout((()=>{t.listener.apply(this,e)}),0),r=!0,!t.once||(n.push(t),!1)))),n.forEach((t=>{this._stopEvent(t)})),r}listenerCount(t){if(!t)return this._events.length;let e=ur(t);return this._events.filter((t=>t.tag===e)).length}listeners(t){if(null==t)return this._events.map((t=>t.listener));let e=ur(t);return this._events.filter((t=>t.tag===e)).map((t=>t.listener))}off(t,e){if(null==e)return this.removeAllListeners(t);const r=[];let n=!1,i=ur(t);return this._events=this._events.filter((t=>t.tag!==i||t.listener!=e||!!n||(n=!0,r.push(t),!1))),r.forEach((t=>{this._stopEvent(t)})),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const r=ur(t);this._events=this._events.filter((t=>t.tag!==r||(e.push(t),!1)))}return e.forEach((t=>{this._stopEvent(t)})),this}}var Nr=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Sr=new y.Yd(Je),Tr=["call","estimateGas"];function kr(t,e,r){if("call"===t&&e.code===y.Yd.errors.SERVER_ERROR){const t=e.error;if(t&&t.message.match("reverted")&&(0,m.A7)(t.data))return t.data;Sr.throwError("missing revert data in call exception",y.Yd.errors.CALL_EXCEPTION,{error:e,data:"0x"})}let n=e.message;e.code===y.Yd.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?n=e.error.message:"string"==typeof e.body?n=e.body:"string"==typeof e.responseText&&(n=e.responseText),n=(n||"").toLowerCase();const i=r.transaction||r.signedTransaction;throw n.match(/insufficient funds|base fee exceeds gas limit/)&&Sr.throwError("insufficient funds for intrinsic transaction cost",y.Yd.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:i}),n.match(/nonce too low/)&&Sr.throwError("nonce has already been used",y.Yd.errors.NONCE_EXPIRED,{error:e,method:t,transaction:i}),n.match(/replacement transaction underpriced/)&&Sr.throwError("replacement fee too low",y.Yd.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:i}),n.match(/only replay-protected/)&&Sr.throwError("legacy pre-eip-155 transactions not supported",y.Yd.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:i}),Tr.indexOf(t)>=0&&n.match(/gas required exceeds allowance|always failing transaction|execution reverted/)&&Sr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",y.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:i}),e}function Rr(t){return new Promise((function(e){setTimeout(e,t)}))}function xr(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function Or(t){return t?t.toLowerCase():t}const Ir={};class Cr extends f.E{constructor(t,e,r){if(Sr.checkNew(new.target,Cr),super(),t!==Ir)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");(0,g.zG)(this,"provider",e),null==r&&(r=0),"string"==typeof r?((0,g.zG)(this,"_address",this.provider.formatter.address(r)),(0,g.zG)(this,"_index",null)):"number"==typeof r?((0,g.zG)(this,"_index",r),(0,g.zG)(this,"_address",null)):Sr.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(t){return Sr.throwError("cannot alter JSON-RPC Signer connection",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Pr(Ir,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((t=>(t.length<=this._index&&Sr.throwError("unknown account #"+this._index,y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index]))))}sendUncheckedTransaction(t){t=(0,g.DC)(t);const e=this.getAddress().then((t=>(t&&(t=t.toLowerCase()),t)));if(null==t.gasLimit){const r=(0,g.DC)(t);r.from=e,t.gasLimit=this.provider.estimateGas(r)}return null!=t.to&&(t.to=Promise.resolve(t.to).then((t=>Nr(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.provider.resolveName(t);return null==e&&Sr.throwArgumentError("provided ENS name resolves to null","tx.to",t),e}))))),(0,g.mE)({tx:(0,g.mE)(t),sender:e}).then((({tx:e,sender:r})=>{null!=e.from?e.from.toLowerCase()!==r&&Sr.throwArgumentError("from address mismatch","transaction",t):e.from=r;const n=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[n]).then((t=>t),(t=>kr("sendTransaction",t,n)))}))}signTransaction(t){return Sr.throwError("signing transactions is unsupported",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return Nr(this,void 0,void 0,(function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(t);try{return yield(0,Ve.$l)((()=>Nr(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(r);if(null!==t)return this.provider._wrapTransaction(t,r,e)}))),{oncePoll:this.provider})}catch(t){throw t.transactionHash=r,t}}))}signMessage(t){return Nr(this,void 0,void 0,(function*(){const e="string"==typeof t?(0,$e.Y0)(t):t,r=yield this.getAddress();return yield this.provider.send("personal_sign",[(0,m.Dv)(e),r.toLowerCase()])}))}_legacySignMessage(t){return Nr(this,void 0,void 0,(function*(){const e="string"==typeof t?(0,$e.Y0)(t):t,r=yield this.getAddress();return yield this.provider.send("eth_sign",[r.toLowerCase(),(0,m.Dv)(e)])}))}_signTypedData(t,e,r){return Nr(this,void 0,void 0,(function*(){const n=yield $t.E.resolveNames(t,e,r,(t=>this.provider.resolveName(t))),i=yield this.getAddress();return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify($t.E.getPayload(n.domain,e,n.value))])}))}unlock(t){return Nr(this,void 0,void 0,(function*(){const e=this.provider,r=yield this.getAddress();return e.send("personal_unlockAccount",[r.toLowerCase(),t,null])}))}}class Pr extends Cr{sendTransaction(t){return this.sendUncheckedTransaction(t).then((t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)})))}}const Lr={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Ur extends _r{constructor(t,e){Sr.checkNew(new.target,Ur);let r=e;null==r&&(r=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then((e=>{t(e)}),(t=>{e(t)}))}),0)}))),super(r),t||(t=(0,g.tu)(this.constructor,"defaultUrl")()),"string"==typeof t?(0,g.zG)(this,"connection",Object.freeze({url:t})):(0,g.zG)(this,"connection",Object.freeze((0,g.DC)(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Nr(this,void 0,void 0,(function*(){yield Rr(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=(0,g.tu)(this.constructor,"getNetwork");try{return e(p.O$.from(t).toNumber())}catch(e){return Sr.throwError("could not detect network",y.Yd.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return Sr.throwError("could not detect network",y.Yd.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new Cr(Ir,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((t=>t.map((t=>this.formatter.address(t)))))}send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:(0,g.p$)(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(n&&this._cache[t])return this._cache[t];const i=(0,Ve.rd)(this.connection,JSON.stringify(r),xr).then((t=>(this.emit("debug",{action:"response",request:r,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",error:t,request:r,provider:this}),t}));return n&&(this._cache[t]=i,setTimeout((()=>{this._cache[t]=null}),0)),i}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[Or(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[Or(e.address),e.blockTag]];case"getCode":return["eth_getCode",[Or(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[Or(e.address),e.position,e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[(0,g.tu)(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[(0,g.tu)(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=Or(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return Nr(this,void 0,void 0,(function*(){if("call"===t||"estimateGas"===t){const t=e.transaction;if(t&&null!=t.type&&p.O$.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((e=(0,g.DC)(e)).transaction=(0,g.DC)(t),delete e.transaction.type)}}const r=this.prepareRequest(t,e);null==r&&Sr.throwError(t+" not implemented",y.Yd.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(r[0],r[1])}catch(r){return kr(t,r,e)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then((function(r){return function n(){t.send("eth_getFilterChanges",[r]).then((function(r){if(t._pendingFilter!=e)return null;let n=Promise.resolve();return r.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",n=n.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),n.then((function(){return Rr(1e3)}))})).then((function(){if(t._pendingFilter==e)return setTimeout((function(){n()}),0),null;t.send("eth_uninstallFilter",[r])})).catch((t=>{}))}(),r})).catch((t=>{}))}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const r=(0,g.DC)(Lr);if(e)for(const t in e)e[t]&&(r[t]=!0);(0,g.uj)(t,r);const n={};return["gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(e){if(null==t[e])return;const r=(0,m.$P)(t[e]);"gasLimit"===e&&(e="gas"),n[e]=r})),["from","to","data"].forEach((function(e){null!=t[e]&&(n[e]=(0,m.Dv)(t[e]))})),t.accessList&&(n.accessList=(0,v.z7)(t.accessList)),n}}let Br=null;try{if(Br=WebSocket,null==Br)throw new Error("inject please")}catch(t){const e=new y.Yd(Je);Br=function(){e.throwError("WebSockets not supported in this environment",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var Dr=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Fr=new y.Yd(Je);let Gr=1;class jr extends Ur{constructor(t,e){"any"===e&&Fr.throwError("WebSocketProvider does not support 'any' network yet",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),super(t,e),this._pollingInterval=-1,this._wsReady=!1,(0,g.zG)(this,"_websocket",new Br(this.connection.url)),(0,g.zG)(this,"_requests",{}),(0,g.zG)(this,"_subs",{}),(0,g.zG)(this,"_subIds",{}),(0,g.zG)(this,"_detectNetwork",super.detectNetwork()),this._websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach((t=>{this._websocket.send(this._requests[t].payload)}))},this._websocket.onmessage=t=>{const e=t.data,r=JSON.parse(e);if(null!=r.id){const t=String(r.id),n=this._requests[t];if(delete this._requests[t],void 0!==r.result)n.callback(null,r.result),this.emit("debug",{action:"response",request:JSON.parse(n.payload),response:r.result,provider:this});else{let t=null;r.error?(t=new Error(r.error.message||"unknown error"),(0,g.zG)(t,"code",r.error.code||null),(0,g.zG)(t,"response",e)):t=new Error("unknown error"),n.callback(t,void 0),this.emit("debug",{action:"response",error:t,request:JSON.parse(n.payload),provider:this})}}else if("eth_subscription"===r.method){const t=this._subs[r.params.subscription];t&&t.processFunc(r.params.result)}else console.warn("this should not happen")};const r=setInterval((()=>{this.emit("poll")}),1e3);r.unref&&r.unref()}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(t){Fr.throwError("cannot reset events block on WebSocketProvider",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(t){Fr.throwError("cannot set polling interval on WebSocketProvider",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return Dr(this,void 0,void 0,(function*(){return null}))}set polling(t){t&&Fr.throwError("cannot set polling on WebSocketProvider",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(t,e){const r=Gr++;return new Promise(((n,i)=>{const o=JSON.stringify({method:t,params:e,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(o),provider:this}),this._requests[String(r)]={callback:function(t,e){return t?i(t):n(e)},payload:o},this._wsReady&&this._websocket.send(o)}))}static defaultUrl(){return"ws://localhost:8546"}_subscribe(t,e,r){return Dr(this,void 0,void 0,(function*(){let n=this._subIds[t];null==n&&(n=Promise.all(e).then((t=>this.send("eth_subscribe",t))),this._subIds[t]=n);const i=yield n;this._subs[i]={tag:t,processFunc:r}}))}_startEvent(t){switch(t.type){case"block":this._subscribe("block",["newHeads"],(t=>{const e=p.O$.from(t.number).toNumber();this._emitted.block=e,this.emit("block",e)}));break;case"pending":this._subscribe("pending",["newPendingTransactions"],(t=>{this.emit("pending",t)}));break;case"filter":this._subscribe(t.tag,["logs",this._getFilter(t.filter)],(e=>{null==e.removed&&(e.removed=!1),this.emit(t.filter,this.formatter.filterLog(e))}));break;case"tx":{const e=t=>{const e=t.hash;this.getTransactionReceipt(e).then((t=>{t&&this.emit(e,t)}))};e(t),this._subscribe("tx",["newHeads"],(t=>{this._events.filter((t=>"tx"===t.type)).forEach(e)}));break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",t)}}_stopEvent(t){let e=t.tag;if("tx"===t.type){if(this._events.filter((t=>"tx"===t.type)).length)return;e="tx"}else if(this.listenerCount(t.event))return;const r=this._subIds[e];r&&(delete this._subIds[e],r.then((t=>{this._subs[t]&&(delete this._subs[t],this.send("eth_unsubscribe",[t]))})))}destroy(){return Dr(this,void 0,void 0,(function*(){this._websocket.readyState===Br.CONNECTING&&(yield new Promise((t=>{this._websocket.onopen=function(){t(!0)},this._websocket.onerror=function(){t(!1)}}))),this._websocket.close(1e3)}))}}const qr=new y.Yd(Je);class zr extends Ur{detectNetwork(){const t=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return e=this,r=void 0,i=function*(){let e=this.network;return null==e&&(e=yield t.detectNetwork.call(this),e||qr.throwError("no network detected",y.Yd.errors.UNKNOWN_ERROR,{}),null==this._network&&((0,g.zG)(this,"_network",e),this.emit("network",e,null))),e},new((n=void 0)||(n=Promise))((function(t,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(t){t(r)}))).then(s,a)}u((i=i.apply(e,r||[])).next())}));var e,r,n,i}}class Kr extends zr{constructor(t,e){qr.checkAbstract(new.target,Kr),t=(0,g.tu)(new.target,"getNetwork")(t),e=(0,g.tu)(new.target,"getApiKey")(e),super((0,g.tu)(new.target,"getUrl")(t,e),t),"string"==typeof e?(0,g.zG)(this,"apiKey",e):null!=e&&Object.keys(e).forEach((t=>{(0,g.zG)(this,t,e[t])}))}_startPending(){qr.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(t){return qr.throwError("API provider does not support signing",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(t){return t}static getUrl(t,e){return qr.throwError("not implemented; sub-classes must override getUrl",y.Yd.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const Hr=new y.Yd(Je),$r="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class Vr extends jr{constructor(t,e){const r=new Wr(t,e);super(r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi."),r.network),(0,g.zG)(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===$r}}class Wr extends Kr{static getWebSocketProvider(t,e){return new Vr(t,e)}static getApiKey(t){return null==t?$r:(t&&"string"!=typeof t&&Hr.throwArgumentError("invalid apiKey","apiKey",t),t)}static getUrl(t,e){let r=null;switch(t.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"ropsten":r="eth-ropsten.alchemyapi.io/v2/";break;case"rinkeby":r="eth-rinkeby.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.alchemyapi.io/v2/";break;case"kovan":r="eth-kovan.alchemyapi.io/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-rinkeby":r="arb-rinkeby.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-kovan":r="opt-kovan.g.alchemy.com/v2/";break;default:Hr.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+e,throttleCallback:(t,r)=>(e===$r&&nr(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===$r}}const Yr=new y.Yd(Je);class Jr extends Kr{static getApiKey(t){return null!=t&&Yr.throwArgumentError("apiKey not supported for cloudflare","apiKey",t),null}static getUrl(t,e){let r=null;return"homestead"===t.name?r="https://cloudflare-eth.com/":Yr.throwArgumentError("unsupported network","network",arguments[0]),r}perform(t,e){const r=Object.create(null,{perform:{get:()=>super.perform}});return n=this,i=void 0,s=function*(){return"getBlockNumber"===t?(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number:r.perform.call(this,t,e)},new((o=void 0)||(o=Promise))((function(t,e){function r(t){try{u(s.next(t))}catch(t){e(t)}}function a(t){try{u(s.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(r,a)}u((s=s.apply(n,i||[])).next())}));var n,i,o,s}}var Xr=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Zr=new y.Yd(Je);function Qr(t){const e={};for(let r in t){if(null==t[r])continue;let n=t[r];"type"===r&&0===n||(n={type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?(0,m.$P)((0,m.Dv)(n)):"accessList"===r?"["+(0,v.z7)(n).map((t=>`{address:"${t.address}",storageKeys:["${t.storageKeys.join('","')}"]}`)).join(",")+"]":(0,m.Dv)(n),e[r]=n)}return e}function tn(t){if(0==t.status&&("No records found"===t.message||"No transactions found"===t.message))return t.result;if(1!=t.status||"OK"!=t.message){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function en(t){if(t&&0==t.status&&"NOTOK"==t.message&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if("2.0"!=t.jsonrpc){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function rn(t){if("pending"===t)throw new Error("pending not supported");return"latest"===t?t:parseInt(t.substring(2),16)}const nn="9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB";function on(t,e,r){if("call"===t&&e.code===y.Yd.errors.SERVER_ERROR){const t=e.error;if(t&&(t.message.match(/reverted/i)||t.message.match(/VM execution error/i))){let r=t.data;if(r&&(r="0x"+r.replace(/^.*0x/i,"")),(0,m.A7)(r))return r;Zr.throwError("missing revert data in call exception",y.Yd.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===y.Yd.errors.SERVER_ERROR&&(e.error&&"string"==typeof e.error.message?n=e.error.message:"string"==typeof e.body?n=e.body:"string"==typeof e.responseText&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&Zr.throwError("insufficient funds for intrinsic transaction cost",y.Yd.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&Zr.throwError("nonce has already been used",y.Yd.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&Zr.throwError("replacement fee too low",y.Yd.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&Zr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",y.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class sn extends _r{constructor(t,e){Zr.checkNew(new.target,sn),super(t),(0,g.zG)(this,"baseUrl",this.getBaseUrl()),(0,g.zG)(this,"apiKey",e||nn)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"ropsten":return"https://api-ropsten.etherscan.io";case"rinkeby":return"https://api-rinkeby.etherscan.io";case"kovan":return"https://api-kovan.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io"}return Zr.throwArgumentError("unsupported network","network",name)}getUrl(t,e){const r=Object.keys(e).reduce(((t,r)=>{const n=e[r];return null!=n&&(t+=`&${r}=${n}`),t}),""),n=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${t}${r}${n}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(t,e){return e.module=t,e.apikey=this.apiKey,e}fetch(t,e,r){return Xr(this,void 0,void 0,(function*(){const n=r?this.getPostUrl():this.getUrl(t,e),i=r?this.getPostData(t,e):null,o="proxy"===t?en:tn;this.emit("debug",{action:"request",request:n,provider:this});const s={url:n,throttleSlotInterval:1e3,throttleCallback:(t,e)=>(this.isCommunityResource()&&nr(),Promise.resolve(!0))};let a=null;i&&(s.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(i).map((t=>`${t}=${i[t]}`)).join("&"));const u=yield(0,Ve.rd)(s,a,o||en);return this.emit("debug",{action:"response",request:n,response:(0,g.p$)(u),provider:this}),u}))}detectNetwork(){return Xr(this,void 0,void 0,(function*(){return this.network}))}perform(t,e){const r=Object.create(null,{perform:{get:()=>super.perform}});return Xr(this,void 0,void 0,(function*(){switch(t){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:e.address,tag:e.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:e.address,tag:e.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:e.address,tag:e.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:e.address,position:e.position,tag:e.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:e.signedTransaction},!0).catch((t=>on("sendTransaction",t,e.signedTransaction)));case"getBlock":if(e.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:e.blockTag,boolean:e.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:e.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:e.transactionHash});case"call":{if("latest"!==e.blockTag)throw new Error("EtherscanProvider does not support blockTag for call");const t=Qr(e.transaction);t.module="proxy",t.action="eth_call";try{return yield this.fetch("proxy",t,!0)}catch(t){return on("call",t,e.transaction)}}case"estimateGas":{const t=Qr(e.transaction);t.module="proxy",t.action="eth_estimateGas";try{return yield this.fetch("proxy",t,!0)}catch(t){return on("estimateGas",t,e.transaction)}}case"getLogs":{const t={action:"getLogs"};if(e.filter.fromBlock&&(t.fromBlock=rn(e.filter.fromBlock)),e.filter.toBlock&&(t.toBlock=rn(e.filter.toBlock)),e.filter.address&&(t.address=e.filter.address),e.filter.topics&&e.filter.topics.length>0&&(e.filter.topics.length>1&&Zr.throwError("unsupported topic count",y.Yd.errors.UNSUPPORTED_OPERATION,{topics:e.filter.topics}),1===e.filter.topics.length)){const r=e.filter.topics[0];"string"==typeof r&&66===r.length||Zr.throwError("unsupported topic format",y.Yd.errors.UNSUPPORTED_OPERATION,{topic0:r}),t.topic0=r}const r=yield this.fetch("logs",t);let n={};for(let t=0;t{["contractAddress","to"].forEach((function(e){""==t[e]&&delete t[e]})),null==t.creates&&null!=t.contractAddress&&(t.creates=t.contractAddress);const e=this.formatter.transactionResponse(t);return t.timeStamp&&(e.timestamp=parseInt(t.timeStamp)),e}))}))}isCommunityResource(){return this.apiKey===nn}}var an=r(2472),un=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const ln=new y.Yd(Je);function hn(){return(new Date).getTime()}function cn(t){let e=null;for(let r=0;re?null:(n+i)/2}function dn(t){if(null===t)return"null";if("number"==typeof t||"boolean"==typeof t)return JSON.stringify(t);if("string"==typeof t)return t;if(p.O$.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map((t=>dn(t))));if("object"==typeof t){const e=Object.keys(t);return e.sort(),"{"+e.map((e=>{let r=t[e];return r="function"==typeof r?"[function]":dn(r),JSON.stringify(e)+":"+r})).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let pn=1;function mn(t){let e=null,r=null,n=new Promise((n=>{e=function(){r&&(clearTimeout(r),r=null),n()},r=setTimeout(e,t)}));return{cancel:e,getPromise:function(){return n},wait:t=>(n=n.then(t),n)}}const gn=[y.Yd.errors.CALL_EXCEPTION,y.Yd.errors.INSUFFICIENT_FUNDS,y.Yd.errors.NONCE_EXPIRED,y.Yd.errors.REPLACEMENT_UNDERPRICED,y.Yd.errors.UNPREDICTABLE_GAS_LIMIT],vn=["address","args","errorArgs","errorSignature","method","transaction"];function yn(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function bn(t,e){return un(this,void 0,void 0,(function*(){const r=t.provider;return null!=r.blockNumber&&r.blockNumber>=e||-1===e?r:(0,Ve.$l)((()=>new Promise(((n,i)=>{setTimeout((function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)}),0)}))),{oncePoll:r})}))}function wn(t,e,r,n){return un(this,void 0,void 0,(function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&(0,m.A7)(n.blockTag)&&(i=yield bn(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&(0,m.A7)(n.blockTag)&&(i=yield bn(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&(0,m.A7)(n.blockTag)&&(i=yield bn(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&(0,m.A7)(n.blockTag)&&(i=yield bn(t,e)),i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let r=n.filter;return(r.fromBlock&&(0,m.A7)(r.fromBlock)||r.toBlock&&(0,m.A7)(r.toBlock))&&(i=yield bn(t,e)),i.getLogs(r)}}return ln.throwError("unknown method error",y.Yd.errors.UNKNOWN_ERROR,{method:r,params:n})}))}class En extends _r{constructor(t,e){ln.checkNew(new.target,En),0===t.length&&ln.throwArgumentError("missing providers","providers",t);const r=t.map(((t,e)=>{if(c.zt.isProvider(t)){const e=er(t)?2e3:750,r=1;return Object.freeze({provider:t,weight:1,stallTimeout:e,priority:r})}const r=(0,g.DC)(t);null==r.priority&&(r.priority=1),null==r.stallTimeout&&(r.stallTimeout=er(t)?2e3:750),null==r.weight&&(r.weight=1);const n=r.weight;return(n%1||n>512||n<1)&&ln.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${e}].weight`,n),Object.freeze(r)})),n=r.reduce(((t,e)=>t+e.weight),0);null==e?e=n/2:e>n&&ln.throwArgumentError("quorum will always fail; larger than total weight","quorum",e);let i=cn(r.map((t=>t.provider.network)));null==i&&(i=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then(t,e)}),0)}))),super(i),(0,g.zG)(this,"providerConfigs",Object.freeze(r)),(0,g.zG)(this,"quorum",e),this._highestBlockNumber=-1}detectNetwork(){return un(this,void 0,void 0,(function*(){return cn(yield Promise.all(this.providerConfigs.map((t=>t.provider.getNetwork()))))}))}perform(t,e){return un(this,void 0,void 0,(function*(){if("sendTransaction"===t){const t=yield Promise.all(this.providerConfigs.map((t=>t.provider.sendTransaction(e.signedTransaction).then((t=>t.hash),(t=>t)))));for(let e=0;et.result));let n=fn(e.map((t=>t.result)),2);if(null!=n)return n=Math.ceil(n),r.indexOf(n+1)>=0&&n++,n>=t._highestBlockNumber&&(t._highestBlockNumber=n),t._highestBlockNumber};case"getGasPrice":return function(t){const e=t.map((t=>t.result));return e.sort(),e[Math.floor(e.length/2)]};case"getEtherPrice":return function(t){return fn(t.map((t=>t.result)))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(t){return null==t?null:((t=(0,g.DC)(t)).confirmations=-1,dn(t))};break;case"getBlock":n=r.includeTransactions?function(t){return null==t?null:((t=(0,g.DC)(t)).transactions=t.transactions.map((t=>((t=(0,g.DC)(t)).confirmations=-1,t))),dn(t))}:function(t){return null==t?null:dn(t)};break;default:throw new Error("unknown method: "+e)}return function(t,e){return function(r){const n={};r.forEach((e=>{const r=t(e.result);n[r]||(n[r]={count:0,result:e.result}),n[r].count++}));const i=Object.keys(n);for(let t=0;t=e)return r.result}}}(n,t.quorum)}(this,t,e),n=(0,an.y)(this.providerConfigs.map(g.DC));n.sort(((t,e)=>t.priority-e.priority));const i=this._highestBlockNumber;let o=0,s=!0;for(;;){const a=hn();let u=n.filter((t=>t.runner&&a-t.startt+e.weight),0);for(;u{r.staller=null})),r.runner=wn(r,i,t,e).then((n=>{r.done=!0,r.result=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:yn(r,hn()),request:{method:t,params:(0,g.p$)(e)},provider:this})}),(n=>{r.done=!0,r.error=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:yn(r,hn()),request:{method:t,params:(0,g.p$)(e)},provider:this})})),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:yn(r,null),request:{method:t,params:(0,g.p$)(e)},provider:this}),u+=r.weight}const l=[];n.forEach((t=>{!t.done&&t.runner&&(l.push(t.runner),t.staller&&l.push(t.staller.getPromise()))})),l.length&&(yield Promise.race(l));const h=n.filter((t=>t.done&&null==t.error));if(h.length>=this.quorum){const t=r(h);if(void 0!==t)return n.forEach((t=>{t.staller&&t.staller.cancel(),t.cancelled=!0})),t;s||(yield mn(100).getPromise()),s=!1}const c=n.reduce(((t,e)=>{if(!e.done||null==e.error)return t;const r=e.error.code;return gn.indexOf(r)>=0&&(t[r]||(t[r]={error:e.error,weight:0}),t[r].weight+=e.weight),t}),{});if(Object.keys(c).forEach((t=>{const e=c[t];if(e.weight{t.staller&&t.staller.cancel(),t.cancelled=!0}));const r=e.error,i={};vn.forEach((t=>{null!=r[t]&&(i[t]=r[t])})),ln.throwError(r.reason||r.message,t,i)})),0===n.filter((t=>!t.done)).length)break}return n.forEach((t=>{t.staller&&t.staller.cancel(),t.cancelled=!0})),ln.throwError("failed to meet quorum",y.Yd.errors.SERVER_ERROR,{method:t,params:e,results:n.map((t=>yn(t))),provider:this})}))}}const Mn=null,An=new y.Yd(Je),_n="84842078b09946638c03157f83405213";class Nn extends jr{constructor(t,e){const r=new Sn(t,e),n=r.connection;n.password&&An.throwError("INFURA WebSocket project secrets unsupported",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"}),super(n.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/"),t),(0,g.zG)(this,"apiKey",r.projectId),(0,g.zG)(this,"projectId",r.projectId),(0,g.zG)(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===_n}}class Sn extends Kr{static getWebSocketProvider(t,e){return new Nn(t,e)}static getApiKey(t){const e={apiKey:_n,projectId:_n,projectSecret:null};return null==t||("string"==typeof t?e.projectId=t:null!=t.projectSecret?(An.assertArgument("string"==typeof t.projectId,"projectSecret requires a projectId","projectId",t.projectId),An.assertArgument("string"==typeof t.projectSecret,"invalid projectSecret","projectSecret","[REDACTED]"),e.projectId=t.projectId,e.projectSecret=t.projectSecret):t.projectId&&(e.projectId=t.projectId),e.apiKey=e.projectId),e}static getUrl(t,e){let r=null;switch(t?t.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"ropsten":r="ropsten.infura.io";break;case"rinkeby":r="rinkeby.infura.io";break;case"kovan":r="kovan.infura.io";break;case"goerli":r="goerli.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-kovan":r="optimism-kovan.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-rinkeby":r="arbitrum-rinkeby.infura.io";break;default:An.throwError("unsupported network",y.Yd.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const n={allowGzip:!0,url:"https://"+r+"/v3/"+e.projectId,throttleCallback:(t,r)=>(e.projectId===_n&&nr(),Promise.resolve(!0))};return null!=e.projectSecret&&(n.user="",n.password=e.projectSecret),n}isCommunityResource(){return this.projectId===_n}}class Tn extends Ur{send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const n={request:r,resolve:null,reject:null},i=new Promise(((t,e)=>{n.resolve=t,n.reject=e}));return this._pendingBatch.push(n),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const e=t.map((t=>t.request));return this.emit("debug",{action:"requestBatch",request:(0,g.p$)(e),provider:this}),(0,Ve.rd)(this.connection,JSON.stringify(e)).then((r=>{this.emit("debug",{action:"response",request:e,response:r,provider:this}),t.forEach(((t,e)=>{const n=r[e];if(n.error){const e=new Error(n.error.message);e.code=n.error.code,e.data=n.error.data,t.reject(e)}else t.resolve(n.result)}))}),(r=>{this.emit("debug",{action:"response",error:r,request:e,provider:this}),t.forEach((t=>{t.reject(r)}))}))}),10)),i}}const kn=new y.Yd(Je);class Rn extends Kr{static getApiKey(t){return t&&"string"!=typeof t&&kn.throwArgumentError("invalid apiKey","apiKey",t),t||"ETHERS_JS_SHARED"}static getUrl(t,e){kn.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(t.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:kn.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+e}}const xn=new y.Yd(Je),On={homestead:"6004bcd10040261633ade990",ropsten:"6004bd4d0040261633ade991",rinkeby:"6004bda20040261633ade994",goerli:"6004bd860040261633ade992"};class In extends Kr{constructor(t,e){if(null==e){const r=(0,g.tu)(new.target,"getNetwork")(t);if(r){const t=On[r.name];t&&(e={applicationId:t,loadBalancer:!0})}null==e&&xn.throwError("unsupported network",y.Yd.errors.INVALID_ARGUMENT,{argument:"network",value:t})}super(t,e)}static getApiKey(t){null==t&&xn.throwArgumentError("PocketProvider.getApiKey does not support null apiKey","apiKey",t);const e={applicationId:null,loadBalancer:!1,applicationSecretKey:null};return"string"==typeof t?e.applicationId=t:null!=t.applicationSecretKey?(xn.assertArgument("string"==typeof t.applicationId,"applicationSecretKey requires an applicationId","applicationId",t.applicationId),xn.assertArgument("string"==typeof t.applicationSecretKey,"invalid applicationSecretKey","applicationSecretKey","[REDACTED]"),e.applicationId=t.applicationId,e.applicationSecretKey=t.applicationSecretKey,e.loadBalancer=!!t.loadBalancer):t.applicationId?(xn.assertArgument("string"==typeof t.applicationId,"apiKey.applicationId must be a string","apiKey.applicationId",t.applicationId),e.applicationId=t.applicationId,e.loadBalancer=!!t.loadBalancer):xn.throwArgumentError("unsupported PocketProvider apiKey","apiKey",t),e}static getUrl(t,e){let r=null;switch(t?t.name:"unknown"){case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"goerli":r="eth-goerli.gateway.pokt.network";break;default:xn.throwError("unsupported network",y.Yd.errors.INVALID_ARGUMENT,{argument:"network",value:t})}let n=null;n=e.loadBalancer?`https://${r}/v1/lb/${e.applicationId}`:`https://${r}/v1/${e.applicationId}`;const i={url:n,headers:{}};return null!=e.applicationSecretKey&&(i.user="",i.password=e.applicationSecretKey),i}isCommunityResource(){return this.applicationId===On[this.network.name]}}const Cn=new y.Yd(Je);let Pn=1;function Ln(t,e){const r="Web3LegacyFetcher";return function(t,n){const i={method:t,params:n,id:Pn++,jsonrpc:"2.0"};return new Promise(((t,n)=>{this.emit("debug",{action:"request",fetcher:r,request:(0,g.p$)(i),provider:this}),e(i,((e,o)=>{if(e)return this.emit("debug",{action:"response",fetcher:r,error:e,request:i,provider:this}),n(e);if(this.emit("debug",{action:"response",fetcher:r,request:i,response:o,provider:this}),o.error){const t=new Error(o.error.message);return t.code=o.error.code,t.data=o.error.data,n(t)}t(o.result)}))}))}}class Un extends Ur{constructor(t,e){Cn.checkNew(new.target,Un),null==t&&Cn.throwArgumentError("missing provider","provider",t);let r=null,n=null,i=null;"function"==typeof t?(r="unknown:",n=t):(r=t.host||t.path||"",!r&&t.isMetaMask&&(r="metamask"),i=t,t.request?(""===r&&(r="eip-1193:"),n=function(t){return function(e,r){null==r&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:(0,g.p$)(n),provider:this}),t.request(n).then((t=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:t,provider:this}),t}))}}(t)):t.sendAsync?n=Ln(0,t.sendAsync.bind(t)):t.send?n=Ln(0,t.send.bind(t)):Cn.throwArgumentError("unsupported provider","provider",t),r||(r="unknown:")),super(r,e),(0,g.zG)(this,"jsonRpcFetchFunc",n),(0,g.zG)(this,"provider",i)}send(t,e){return this.jsonRpcFetchFunc(t,e)}}const Bn=new y.Yd(Je);function Dn(t,e){if(null==t&&(t="homestead"),"string"==typeof t){const e=t.match(/^(ws|http)s?:/i);if(e)switch(e[1]){case"http":return new Ur(t);case"ws":return new jr(t);default:Bn.throwArgumentError("unsupported URL scheme","network",t)}}const r=(0,je.H)(t);return r&&r._defaultProvider||Bn.throwError("unsupported getDefaultProvider network",y.Yd.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:En,AlchemyProvider:Wr,CloudflareProvider:Jr,EtherscanProvider:sn,InfuraProvider:Sn,JsonRpcProvider:Ur,NodesmithProvider:Rn,PocketProvider:In,Web3Provider:Un,IpcProvider:Mn},e)}var Fn=r(1094),Gn=r.n(Fn);let jn=!1,qn=!1;const zn={debug:1,default:2,info:2,warning:3,error:4,off:5};let Kn=zn.default,Hn=null;const $n=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Vn,Wn;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Vn||(Vn={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Wn||(Wn={}));const Yn="0123456789abcdef";class Jn{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==zn[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Kn>zn[r]||console.log.apply(console,e)}debug(...t){this._log(Jn.levels.DEBUG,t)}info(...t){this._log(Jn.levels.INFO,t)}warn(...t){this._log(Jn.levels.WARNING,t)}makeError(t,e,r){if(qn)return this.makeError("censored error",e,{});e||(e=Jn.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Yn[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Wn.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Wn.CALL_EXCEPTION:case Wn.INSUFFICIENT_FUNDS:case Wn.MISSING_NEW:case Wn.NONCE_EXPIRED:case Wn.REPLACEMENT_UNDERPRICED:case Wn.TRANSACTION_REPLACED:case Wn.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Jn.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),$n&&this.throwError("platform missing String.prototype.normalize",Jn.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:$n})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Jn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Jn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,Jn.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Jn.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Jn.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Jn.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Hn||(Hn=new Jn("logger/5.7.0")),Hn}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Jn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),jn){if(!t)return;this.globalLogger().throwError("error censorship permanent",Jn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}qn=!!t,jn=!!e}static setLogLevel(t){const e=zn[t.toLowerCase()];null!=e?Kn=e:Jn.globalLogger().warn("invalid log level - "+t)}static from(t){return new Jn(t)}}Jn.errors=Wn,Jn.levels=Vn;const Xn=new Jn("bytes/5.7.0");function Zn(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Zn(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Qn(t){return"number"==typeof t&&t==t&&t%1==0}function ti(t,e){if(e||(e={}),"number"==typeof t){Xn.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Zn(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Xn.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?Zn(new Uint8Array(t)):Xn.throwArgumentError("invalid arrayify value","value",t)}const ei=new Jn("strings/5.7.0");var ri,ni;function ii(t,e,r,n,i){if(t===ni.BAD_PREFIX||t===ni.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n>6==2;n++)t++;return t}return t===ni.OVERRUN?r.length-e-1:0}function oi(t){return e=function(t,e=ri.current){e!=ri.current&&(ei.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return ti(r)}(t),"0x"+Gn().keccak_256(ti(e));var e}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(ri||(ri={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(ni||(ni={})),Object.freeze({error:function(t,e,r,n,i){return ei.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:ii,replace:function(t,e,r,n,i){return t===ni.OVERLONG?(n.push(i),0):(n.push(65533),ii(t,e,r))}}),new Jn("properties/5.7.0");const si=new Jn("wordlists/5.5.0");class ai{constructor(t){si.checkAbstract(new.target,ai),function(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}(this,"locale",t)}split(t){return t.toLowerCase().split(/ +/g)}join(t){return t.join(" ")}static check(t){const e=[];for(let r=0;r<2048;r++){const n=t.getWord(r);if(r!==t.getWordIndex(n))return"0x";e.push(n)}return oi(e.join("\n")+"\n")}static register(t,e){e||(e=t.locale)}}let ui=null;function li(t){if(null==ui&&(ui="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==ai.check(t)))throw ui=null,new Error("BIP39 Wordlist for en (English) FAILED")}const hi=new class extends ai{constructor(){super("en")}getWord(t){return li(this),ui[t]}getWordIndex(t){return li(this),ui.indexOf(t)}};ai.register(hi);const ci={en:hi};let fi=!1,di=!1;const pi={debug:1,default:2,info:2,warning:3,error:4,off:5};let mi=pi.default,gi=null;const vi=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var yi,bi;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(yi||(yi={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(bi||(bi={}));const wi="0123456789abcdef";class Ei{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==pi[r]&&this.throwArgumentError("invalid log level name","logLevel",t),mi>pi[r]||console.log.apply(console,e)}debug(...t){this._log(Ei.levels.DEBUG,t)}info(...t){this._log(Ei.levels.INFO,t)}warn(...t){this._log(Ei.levels.WARNING,t)}makeError(t,e,r){if(di)return this.makeError("censored error",e,{});e||(e=Ei.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=wi[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case bi.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case bi.CALL_EXCEPTION:case bi.INSUFFICIENT_FUNDS:case bi.MISSING_NEW:case bi.NONCE_EXPIRED:case bi.REPLACEMENT_UNDERPRICED:case bi.TRANSACTION_REPLACED:case bi.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Ei.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),vi&&this.throwError("platform missing String.prototype.normalize",Ei.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:vi})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Ei.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Ei.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,Ei.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Ei.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Ei.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Ei.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return gi||(gi=new Ei("logger/5.7.0")),gi}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Ei.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),fi){if(!t)return;this.globalLogger().throwError("error censorship permanent",Ei.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}di=!!t,fi=!!e}static setLogLevel(t){const e=pi[t.toLowerCase()];null!=e?mi=e:Ei.globalLogger().warn("invalid log level - "+t)}static from(t){return new Ei(t)}}Ei.errors=bi,Ei.levels=yi;const Mi=new Ei("bytes/5.7.0");function Ai(t){return!!t.toHexString}function _i(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return _i(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Ni(t){return"number"==typeof t&&t==t&&t%1==0}function Si(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Ni(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Ti(t,e){if(e||(e={}),"number"==typeof t){Mi.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),_i(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Ai(t)&&(t=t.toHexString()),Ri(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Mi.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;tTi(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),_i(n)}function Ri(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const xi="0123456789abcdef";function Oi(t,e){if(e||(e={}),"number"==typeof t){Mi.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=xi[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Ai(t))return t.toHexString();if(Ri(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":Mi.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Si(t)){let e="0x";for(let r=0;r>4]+xi[15&n]}return e}return Mi.throwArgumentError("invalid hexlify value","value",t)}function Ii(t,e){for("string"!=typeof t?t=Oi(t):Ri(t)||Mi.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Mi.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}const Ci=new Ei("properties/5.7.0");function Pi(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function Li(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}const Ui={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Bi(t){if(null==t||Ui[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rFi(t))));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&Pi(e,r,Fi(n))}return e}return Ci.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Fi(t){return Di(t)}class Gi{constructor(t){for(const e in t)this[e]=Fi(t[e])}}const ji="abi/5.5.0";var qi=r(8020),zi=r.n(qi)().BN;const Ki=new Ei("bignumber/5.7.0"),Hi={};let $i=!1;class Vi{constructor(t,e){t!==Hi&&Ki.throwError("cannot call constructor directly; use BigNumber.from",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Yi(Ji(this).fromTwos(t))}toTwos(t){return Yi(Ji(this).toTwos(t))}abs(){return"-"===this._hex[0]?Vi.from(this._hex.substring(1)):this}add(t){return Yi(Ji(this).add(Ji(t)))}sub(t){return Yi(Ji(this).sub(Ji(t)))}div(t){return Vi.from(t).isZero()&&Xi("division-by-zero","div"),Yi(Ji(this).div(Ji(t)))}mul(t){return Yi(Ji(this).mul(Ji(t)))}mod(t){const e=Ji(t);return e.isNeg()&&Xi("division-by-zero","mod"),Yi(Ji(this).umod(e))}pow(t){const e=Ji(t);return e.isNeg()&&Xi("negative-power","pow"),Yi(Ji(this).pow(e))}and(t){const e=Ji(t);return(this.isNegative()||e.isNeg())&&Xi("unbound-bitwise-result","and"),Yi(Ji(this).and(e))}or(t){const e=Ji(t);return(this.isNegative()||e.isNeg())&&Xi("unbound-bitwise-result","or"),Yi(Ji(this).or(e))}xor(t){const e=Ji(t);return(this.isNegative()||e.isNeg())&&Xi("unbound-bitwise-result","xor"),Yi(Ji(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Xi("negative-width","mask"),Yi(Ji(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Xi("negative-width","shl"),Yi(Ji(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Xi("negative-width","shr"),Yi(Ji(this).shrn(t))}eq(t){return Ji(this).eq(Ji(t))}lt(t){return Ji(this).lt(Ji(t))}lte(t){return Ji(this).lte(Ji(t))}gt(t){return Ji(this).gt(Ji(t))}gte(t){return Ji(this).gte(Ji(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Ji(this).isZero()}toNumber(){try{return Ji(this).toNumber()}catch(t){Xi("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Ki.throwError("this platform does not support BigInt",Ei.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?$i||($i=!0,Ki.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ki.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ei.errors.UNEXPECTED_ARGUMENT,{}):Ki.throwError("BigNumber.toString does not accept parameters",Ei.errors.UNEXPECTED_ARGUMENT,{})),Ji(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Vi)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Vi(Hi,Wi(t)):t.match(/^-?[0-9]+$/)?new Vi(Hi,Wi(new zi(t))):Ki.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Xi("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&Xi("overflow","BigNumber.from",t),Vi.from(String(t));const e=t;if("bigint"==typeof e)return Vi.from(e.toString());if(Si(e))return Vi.from(Oi(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Vi.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Ri(t)||"-"===t[0]&&Ri(t.substring(1))))return Vi.from(t)}return Ki.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Wi(t){if("string"!=typeof t)return Wi(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Ki.throwArgumentError("invalid hex","value",t),"0x00"===(t=Wi(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Yi(t){return Vi.from(Wi(t))}function Ji(t){const e=Vi.from(t).toHexString();return"-"===e[0]?new zi("-"+e.substring(3),16):new zi(e.substring(2),16)}function Xi(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),Ki.throwError(t,Ei.errors.NUMERIC_FAULT,n)}const Zi=new Ei(ji);function Qi(t){const e=[],r=function(t,n){if(Array.isArray(n))for(let i in n){const o=t.slice();o.push(i);try{r(o,n[i])}catch(t){e.push({path:o,error:t})}}};return r([],t),e}class to{constructor(t,e,r,n){this.name=t,this.type=e,this.localName=r,this.dynamic=n}_throwError(t,e){Zi.throwArgumentError(t,this.localName,e)}}class eo{constructor(t){Pi(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return function(t){let e="0x";return t.forEach((t=>{e+=Oi(t).substring(2)})),e}(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(ki(t._data))}writeBytes(t){let e=Ti(t);const r=e.length%this.wordSize;return r&&(e=ki([e,this._padding.slice(r)])),this._writeData(e)}_getValue(t){let e=Ti(Vi.from(t));return e.length>this.wordSize&&Zi.throwError("value out-of-bounds",Ei.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=ki([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class ro{constructor(t,e,r,n){Pi(this,"_data",Ti(t)),Pi(this,"wordSize",e||32),Pi(this,"_coerceFunc",r),Pi(this,"allowLoose",n),this._offset=0}get data(){return Oi(this._data)}get consumed(){return this._offset}static coerce(t,e){let r=t.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):ro.coerce(t,e)}_peekBytes(t,e,r){let n=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?n=e:Zi.throwError("data out-of-bounds",Ei.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(t){return new ro(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let r=this._peekBytes(0,t,!!e);return this._offset+=r.length,r.slice(0,t)}readValue(){return Vi.from(this.readBytes(this.wordSize))}}function no(t){return"0x"+Gn().keccak_256(Ti(t))}const io=new Ei("address/5.7.0");function oo(t){Ri(t,20)||io.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=Ti(no(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const so={};for(let t=0;t<10;t++)so[String(t)]=String(t);for(let t=0;t<26;t++)so[String.fromCharCode(65+t)]=String(10+t);const ao=Math.floor((uo=9007199254740991,Math.log10?Math.log10(uo):Math.log(uo)/Math.LN10));var uo;function lo(t){let e=null;if("string"!=typeof t&&io.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=oo(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&io.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>so[t])).join("");for(;e.length>=ao;){let t=e.substring(0,ao);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&io.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new zi(r,36).toString(16);e.length<40;)e="0"+e;e=oo("0x"+e)}else io.throwArgumentError("invalid address","address",t);var r;return e}class ho extends to{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=lo(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return lo(Ii(t.readValue().toHexString(),20))}}class co extends to{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const fo=new Ei(ji);function po(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let t={};n=e.map((e=>{const n=e.localName;return n||fo.throwError("cannot encode object for signature with missing names",Ei.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]&&fo.throwError("cannot encode object for signature with duplicate names",Ei.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]=!0,r[n]}))}else fo.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&fo.throwArgumentError("types/value length mismatch","tuple",r);let i=new eo(t.wordSize),o=new eo(t.wordSize),s=[];e.forEach(((t,e)=>{let r=n[e];if(t.dynamic){let e=o.length;t.encode(o,r);let n=i.writeUpdatableValue();s.push((t=>{n(t+e)}))}else t.encode(i,r)})),s.forEach((t=>{t(i.length)}));let a=t.appendWriter(i);return a+=t.appendWriter(o),a}function mo(t,e){let r=[],n=t.subReader(0);e.forEach((e=>{let i=null;if(e.dynamic){let r=t.readValue(),o=n.subReader(r.toNumber());try{i=e.decode(o)}catch(t){if(t.code===Ei.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(t.code===Ei.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}null!=i&&r.push(i)}));const i=e.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});e.forEach(((t,e)=>{let n=t.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const o=r[e];o instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}}):r[n]=o}));for(let t=0;t{throw e}})}return Object.freeze(r)}class go extends to{constructor(t,e,r){super("array",t.type+"["+(e>=0?e:"")+"]",r,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let r=0;rt._data.length&&fo.throwError("insufficient data length",Ei.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let r=[];for(let t=0;t>6==2;n++)t++;return t}return t===Ro.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(ko||(ko={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Ro||(Ro={}));const Oo=Object.freeze({error:function(t,e,r,n,i){return To.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:xo,replace:function(t,e,r,n,i){return t===Ro.OVERLONG?(n.push(i),0):(n.push(65533),xo(t,e,r))}});function Io(t,e=ko.current){e!=ko.current&&(To.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return Ti(r)}function Co(t,e){return function(t,e){null==e&&(e=Oo.error),t=Ti(t);const r=[];let n=0;for(;n>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?Ro.UNEXPECTED_CONTINUE:Ro.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e(Ro.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i1114111?n+=e(Ro.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e(Ro.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e(Ro.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}class Po extends yo{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,Io(e))}decode(t){return Co(super.decode(t))}}class Lo extends to{constructor(t,e){let r=!1;const n=[];t.forEach((t=>{t.dynamic&&(r=!0),n.push(t.type)})),super("tuple","tuple("+n.join(",")+")",e,r),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});return this.coders.forEach(((r,n)=>{let i=r.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[n]))})),Object.freeze(t)}encode(t,e){return po(t,this.coders,e)}decode(t){return t.coerce(this.name,mo(t,this.coders))}}const Uo=new Ei(ji),Bo={};let Do={calldata:!0,memory:!0,storage:!0},Fo={calldata:!0,memory:!0};function Go(t,e){if("bytes"===t||"string"===t){if(Do[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&Fo[e])return!0;return(Do[e]||"payable"===e)&&Uo.throwArgumentError("invalid modifier","name",e),!1}function jo(t,e){for(let r in e)Pi(t,r,e[r])}const qo=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),zo=new RegExp(/^(.*)\[([0-9]*)\]$/);class Ko{constructor(t,e){t!==Bo&&Uo.throwError("use fromString",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),jo(this,e);let r=this.type.match(zo);jo(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Ko.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=qo.sighash),qo[t]||Uo.throwArgumentError("invalid format type","format",t),t===qo.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==qo.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===qo.full?", ":",")+")"):e+=this.type,t!==qo.sighash&&(!0===this.indexed&&(e+=" indexed"),t===qo.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?Ko.fromString(t,e):Ko.fromObject(t)}static fromObject(t){return Ko.isParamType(t)?t:new Ko(Bo,{name:t.name||null,type:es(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(Ko.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function n(e){Uo.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function i(t){let r={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(r.indexed=!1),r}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},s=o;for(let r=0;rKo.fromString(t,e)))}class $o{constructor(t,e){t!==Bo&&Uo.throwError("use a static from method",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),jo(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return $o.isFragment(t)?t:"string"==typeof t?$o.fromString(t):$o.fromObject(t)}static fromObject(t){if($o.isFragment(t))return t;switch(t.type){case"function":return Zo.fromObject(t);case"event":return Vo.fromObject(t);case"constructor":return Xo.fromObject(t);case"error":return ts.fromObject(t);case"fallback":case"receive":return null}return Uo.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Vo.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?Zo.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Xo.fromString(t.trim()):"error"===t.split(" ")[0]?ts.fromString(t.substring(5).trim()):Uo.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class Vo extends $o{format(t){if(t||(t=qo.sighash),qo[t]||Uo.throwArgumentError("invalid format type","format",t),t===qo.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==qo.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===qo.full?", ":",")+") ",t!==qo.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?Vo.fromString(t):Vo.fromObject(t)}static fromObject(t){if(Vo.isEventFragment(t))return t;"event"!==t.type&&Uo.throwArgumentError("invalid event object","value",t);const e={name:ns(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Ko.fromObject):[],type:"event"};return new Vo(Bo,e)}static fromString(t){let e=t.match(is);e||Uo.throwArgumentError("invalid event string","value",t);let r=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":r=!0;break;case"":break;default:Uo.warn("unknown modifier: "+t)}})),Vo.fromObject({name:e[1].trim(),anonymous:r,inputs:Ho(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function Wo(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&Uo.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Uo.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=Vi.from(r[1]),r[0]):t}function Yo(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function Jo(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&Uo.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&Uo.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||Uo.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Uo.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&Uo.throwArgumentError("unable to determine stateMutability","value",t),e}class Xo extends $o{format(t){if(t||(t=qo.sighash),qo[t]||Uo.throwArgumentError("invalid format type","format",t),t===qo.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===qo.sighash&&Uo.throwError("cannot format a constructor for sighash",Ei.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===qo.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Xo.fromString(t):Xo.fromObject(t)}static fromObject(t){if(Xo.isConstructorFragment(t))return t;"constructor"!==t.type&&Uo.throwArgumentError("invalid constructor object","value",t);let e=Jo(t);e.constant&&Uo.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Ko.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?Vi.from(t.gas):null};return new Xo(Bo,r)}static fromString(t){let e={type:"constructor"},r=(t=Wo(t,e)).match(is);return r&&"constructor"===r[1].trim()||Uo.throwArgumentError("invalid constructor string","value",t),e.inputs=Ho(r[2].trim(),!1),Yo(r[3].trim(),e),Xo.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class Zo extends Xo{format(t){if(t||(t=qo.sighash),qo[t]||Uo.throwArgumentError("invalid format type","format",t),t===qo.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==qo.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===qo.full?", ":",")+") ",t!==qo.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?Zo.fromString(t):Zo.fromObject(t)}static fromObject(t){if(Zo.isFunctionFragment(t))return t;"function"!==t.type&&Uo.throwArgumentError("invalid function object","value",t);let e=Jo(t);const r={type:t.type,name:ns(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(Ko.fromObject):[],outputs:t.outputs?t.outputs.map(Ko.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?Vi.from(t.gas):null};return new Zo(Bo,r)}static fromString(t){let e={type:"function"},r=(t=Wo(t,e)).split(" returns ");r.length>2&&Uo.throwArgumentError("invalid function string","value",t);let n=r[0].match(is);if(n||Uo.throwArgumentError("invalid function signature","value",t),e.name=n[1].trim(),e.name&&ns(e.name),e.inputs=Ho(n[2],!1),Yo(n[3].trim(),e),r.length>1){let n=r[1].match(is);""==n[1].trim()&&""==n[3].trim()||Uo.throwArgumentError("unexpected tokens","value",t),e.outputs=Ho(n[2],!1)}else e.outputs=[];return Zo.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function Qo(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||Uo.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ts extends $o{format(t){if(t||(t=qo.sighash),qo[t]||Uo.throwArgumentError("invalid format type","format",t),t===qo.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==qo.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===qo.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?ts.fromString(t):ts.fromObject(t)}static fromObject(t){if(ts.isErrorFragment(t))return t;"error"!==t.type&&Uo.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:ns(t.name),inputs:t.inputs?t.inputs.map(Ko.fromObject):[]};return Qo(new ts(Bo,e))}static fromString(t){let e={type:"error"},r=t.match(is);return r||Uo.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&ns(e.name),e.inputs=Ho(r[2],!1),Qo(ts.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function es(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const rs=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function ns(t){return t&&t.match(rs)||Uo.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const is=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"),os=new Ei(ji),ss=new RegExp(/^bytes([0-9]*)$/),as=new RegExp(/^(u?int)([0-9]*)$/);class us{constructor(t){os.checkNew(new.target,us),Pi(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new ho(t.name);case"bool":return new vo(t.name);case"string":return new Po(t.name);case"bytes":return new bo(t.name);case"array":return new go(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new Lo((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new Eo(t.name)}let e=t.type.match(as);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&os.throwArgumentError("invalid "+e[1]+" bit length","param",t),new So(r/8,"int"===e[1],t.name)}if(e=t.type.match(ss),e){let r=parseInt(e[1]);return(0===r||r>32)&&os.throwArgumentError("invalid bytes length","param",t),new wo(r,t.name)}return os.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new ro(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new eo(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(Ko.from(t))));return new Lo(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&os.throwError("types/values length mismatch",Ei.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map((t=>this._getCoder(Ko.from(t)))),n=new Lo(r,"_"),i=this._getWriter();return n.encode(i,e),i.data}decode(t,e,r){const n=t.map((t=>this._getCoder(Ko.from(t))));return new Lo(n,"_").decode(this._getReader(Ti(e),r))}}const ls=new us;function hs(t){return no(Io(t))}const cs=new Ei(ji);class fs extends Gi{}class ds extends Gi{}class ps extends Gi{}class ms extends Gi{static isIndexed(t){return!(!t||!t._isIndexed)}}const gs={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function vs(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class ys{constructor(t){cs.checkNew(new.target,ys);let e=[];e="string"==typeof t?JSON.parse(t):t,Pi(this,"fragments",e.map((t=>$o.from(t))).filter((t=>null!=t))),Pi(this,"_abiCoder",Li(new.target,"getAbiCoder")()),Pi(this,"functions",{}),Pi(this,"errors",{}),Pi(this,"events",{}),Pi(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void cs.warn("duplicate definition - constructor"):void Pi(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let r=t.format();e[r]?cs.warn("duplicate definition - "+r):e[r]=t})),this.deploy||Pi(this,"deploy",Xo.from({payable:!1,type:"constructor"})),Pi(this,"_isInterface",!0)}format(t){t||(t=qo.full),t===qo.sighash&&cs.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===qo.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return ls}static getAddress(t){return lo(t)}static getSighash(t){return r=0,4,"string"!=typeof(e=hs(t.format()))?e=Oi(e):(!Ri(e)||e.length%2)&&Mi.throwArgumentError("invalid hexData","value",e),r=2+2*r,"0x"+e.substring(r,10);var e,r}static getEventTopic(t){return hs(t.format())}getFunction(t){if(Ri(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];cs.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===r.length?cs.throwArgumentError("no matching function","name",e):r.length>1&&cs.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const e=this.functions[Zo.fromString(t).format()];return e||cs.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(Ri(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];cs.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===r.length?cs.throwArgumentError("no matching event","name",e):r.length>1&&cs.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const e=this.events[Vo.fromString(t).format()];return e||cs.throwArgumentError("no matching event","signature",t),e}getError(t){if(Ri(t)){const e=Li(this.constructor,"getSighash");for(const r in this.errors)if(t===e(this.errors[r]))return this.errors[r];cs.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===r.length?cs.throwArgumentError("no matching error","name",e):r.length>1&&cs.throwArgumentError("multiple matching errors","name",e),this.errors[r[0]]}const e=this.errors[Zo.fromString(t).format()];return e||cs.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return Li(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),Li(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const r=Ti(e);return Oi(r.slice(0,4))!==this.getSighash(t)&&cs.throwArgumentError(`data signature does not match error ${t.name}.`,"data",Oi(r)),this._decodeParams(t.inputs,r.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),Oi(ki([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const r=Ti(e);return Oi(r.slice(0,4))!==this.getSighash(t)&&cs.throwArgumentError(`data signature does not match function ${t.name}.`,"data",Oi(r)),this._decodeParams(t.inputs,r.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),Oi(ki([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let r=Ti(e),n=null,i=null,o=null,s=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,r)}catch(t){}break;case 4:{const t=Oi(r.slice(0,4)),e=gs[t];if(e)i=this._abiCoder.decode(e.inputs,r.slice(4)),o=e.name,s=e.signature,e.reason&&(n=i[0]);else try{const e=this.getError(t);i=this._abiCoder.decode(e.inputs,r.slice(4)),o=e.name,s=e.format()}catch(t){console.log(t)}break}}return cs.throwError("call revert exception",Ei.errors.CALL_EXCEPTION,{method:t.format(),errorArgs:i,errorName:o,errorSignature:s,reason:n})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),Oi(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&cs.throwError("too many arguments for "+t.format(),Ei.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let r=[];t.anonymous||r.push(this.getEventTopic(t));const n=(t,e)=>"string"===t.type?hs(e):"bytes"===t.type?no(Oi(e)):("address"===t.type&&this._abiCoder.encode(["address"],[e]),Ii(Oi(e),32));for(e.forEach(((e,i)=>{let o=t.inputs[i];o.indexed?null==e?r.push(null):"array"===o.baseType||"tuple"===o.baseType?cs.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?r.push(e.map((t=>n(o,t)))):r.push(n(o,e)):null!=e&&cs.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const r=[],n=[],i=[];return t.anonymous||r.push(this.getEventTopic(t)),e.length!==t.inputs.length&&cs.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const s=e[o];if(t.indexed)if("string"===t.type)r.push(hs(s));else if("bytes"===t.type)r.push(no(s));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([t.type],[s]))}else n.push(t),i.push(s)})),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(t,e,r){if("string"==typeof t&&(t=this.getEvent(t)),null!=r&&!t.anonymous){let e=this.getEventTopic(t);Ri(r[0],32)&&r[0].toLowerCase()===e||cs.throwError("fragment/topic mismatch",Ei.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:r[0]}),r=r.slice(1)}let n=[],i=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(n.push(Ko.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(n.push(t),o.push(!1)):(i.push(t),o.push(!1))}));let s=null!=r?this._abiCoder.decode(n,ki(r)):null,a=this._abiCoder.decode(i,e,!0),u=[],l=0,h=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==s)u[e]=new ms({_isIndexed:!0,hash:null});else if(o[e])u[e]=new ms({_isIndexed:!0,hash:s[h++]});else try{u[e]=s[h++]}catch(t){u[e]=t}else try{u[e]=a[l++]}catch(t){u[e]=t}if(t.name&&null==u[t.name]){const r=u[e];r instanceof Error?Object.defineProperty(u,t.name,{enumerable:!0,get:()=>{throw vs(`property ${JSON.stringify(t.name)}`,r)}}):u[t.name]=r}}));for(let t=0;t{throw vs(`index ${t}`,e)}})}return Object.freeze(u)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new ds({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:Vi.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new fs({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=Oi(t);let r=this.getError(e.substring(0,10).toLowerCase());return r?new ps({args:this._abiCoder.decode(r.inputs,"0x"+e.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(t){return!(!t||!t._isInterface)}}let bs=!1,ws=!1;const Es={debug:1,default:2,info:2,warning:3,error:4,off:5};let Ms=Es.default,As=null;const _s=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Ns,Ss;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Ns||(Ns={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Ss||(Ss={}));const Ts="0123456789abcdef";class ks{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Es[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Ms>Es[r]||console.log.apply(console,e)}debug(...t){this._log(ks.levels.DEBUG,t)}info(...t){this._log(ks.levels.INFO,t)}warn(...t){this._log(ks.levels.WARNING,t)}makeError(t,e,r){if(ws)return this.makeError("censored error",e,{});e||(e=ks.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Ts[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Ss.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Ss.CALL_EXCEPTION:case Ss.INSUFFICIENT_FUNDS:case Ss.MISSING_NEW:case Ss.NONCE_EXPIRED:case Ss.REPLACEMENT_UNDERPRICED:case Ss.TRANSACTION_REPLACED:case Ss.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,ks.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),_s&&this.throwError("platform missing String.prototype.normalize",ks.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_s})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,ks.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,ks.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,ks.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",ks.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",ks.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",ks.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return As||(As=new ks("logger/5.7.0")),As}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",ks.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),bs){if(!t)return;this.globalLogger().throwError("error censorship permanent",ks.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ws=!!t,bs=!!e}static setLogLevel(t){const e=Es[t.toLowerCase()];null!=e?Ms=e:ks.globalLogger().warn("invalid log level - "+t)}static from(t){return new ks(t)}}ks.errors=Ss,ks.levels=Ns;const Rs=new ks("bytes/5.7.0");function xs(t){return!!t.toHexString}function Os(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Os(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Is(t){return"number"==typeof t&&t==t&&t%1==0}function Cs(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Is(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Ps(t,e){if(e||(e={}),"number"==typeof t){Rs.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Os(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),xs(t)&&(t=t.toHexString()),Ls(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Rs.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t>4]+Us[15&n]}return e}return Rs.throwArgumentError("invalid hexlify value","value",t)}function Ds(t){if("string"!=typeof t)t=Bs(t);else if(!Ls(t)||t.length%2)return null;return(t.length-2)/2}function Fs(t,e,r){return"string"!=typeof t?t=Bs(t):(!Ls(t)||t.length%2)&&Rs.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}var Gs=r(5205),js=r.n(Gs)().BN;const qs=new ks("bignumber/5.7.0"),zs={};let Ks=!1;class Hs{constructor(t,e){t!==zs&&qs.throwError("cannot call constructor directly; use BigNumber.from",ks.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Vs(Ws(this).fromTwos(t))}toTwos(t){return Vs(Ws(this).toTwos(t))}abs(){return"-"===this._hex[0]?Hs.from(this._hex.substring(1)):this}add(t){return Vs(Ws(this).add(Ws(t)))}sub(t){return Vs(Ws(this).sub(Ws(t)))}div(t){return Hs.from(t).isZero()&&Ys("division-by-zero","div"),Vs(Ws(this).div(Ws(t)))}mul(t){return Vs(Ws(this).mul(Ws(t)))}mod(t){const e=Ws(t);return e.isNeg()&&Ys("division-by-zero","mod"),Vs(Ws(this).umod(e))}pow(t){const e=Ws(t);return e.isNeg()&&Ys("negative-power","pow"),Vs(Ws(this).pow(e))}and(t){const e=Ws(t);return(this.isNegative()||e.isNeg())&&Ys("unbound-bitwise-result","and"),Vs(Ws(this).and(e))}or(t){const e=Ws(t);return(this.isNegative()||e.isNeg())&&Ys("unbound-bitwise-result","or"),Vs(Ws(this).or(e))}xor(t){const e=Ws(t);return(this.isNegative()||e.isNeg())&&Ys("unbound-bitwise-result","xor"),Vs(Ws(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Ys("negative-width","mask"),Vs(Ws(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Ys("negative-width","shl"),Vs(Ws(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Ys("negative-width","shr"),Vs(Ws(this).shrn(t))}eq(t){return Ws(this).eq(Ws(t))}lt(t){return Ws(this).lt(Ws(t))}lte(t){return Ws(this).lte(Ws(t))}gt(t){return Ws(this).gt(Ws(t))}gte(t){return Ws(this).gte(Ws(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Ws(this).isZero()}toNumber(){try{return Ws(this).toNumber()}catch(t){Ys("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return qs.throwError("this platform does not support BigInt",ks.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Ks||(Ks=!0,qs.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?qs.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ks.errors.UNEXPECTED_ARGUMENT,{}):qs.throwError("BigNumber.toString does not accept parameters",ks.errors.UNEXPECTED_ARGUMENT,{})),Ws(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Hs)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Hs(zs,$s(t)):t.match(/^-?[0-9]+$/)?new Hs(zs,$s(new js(t))):qs.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Ys("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&Ys("overflow","BigNumber.from",t),Hs.from(String(t));const e=t;if("bigint"==typeof e)return Hs.from(e.toString());if(Cs(e))return Hs.from(Bs(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Hs.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Ls(t)||"-"===t[0]&&Ls(t.substring(1))))return Hs.from(t)}return qs.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function $s(t){if("string"!=typeof t)return $s(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&qs.throwArgumentError("invalid hex","value",t),"0x00"===(t=$s(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Vs(t){return Hs.from($s(t))}function Ws(t){const e=Hs.from(t).toHexString();return"-"===e[0]?new js("-"+e.substring(3),16):new js(e.substring(2),16)}function Ys(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),qs.throwError(t,ks.errors.NUMERIC_FAULT,n)}function Js(t){return"0x"+Gn().keccak_256(Ps(t))}const Xs=new ks("rlp/5.7.0");function Zs(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function Qs(t){if(Array.isArray(t)){let e=[];if(t.forEach((function(t){e=e.concat(Qs(t))})),e.length<=55)return e.unshift(192+e.length),e;const r=Zs(e.length);return r.unshift(247+r.length),r.concat(e)}var e;Ls(e=t)&&!(e.length%2)||Cs(e)||Xs.throwArgumentError("RLP object must be BytesLike","object",t);const r=Array.prototype.slice.call(Ps(t));if(1===r.length&&r[0]<=127)return r;if(r.length<=55)return r.unshift(128+r.length),r;const n=Zs(r.length);return n.unshift(183+n.length),n.concat(r)}const ta=new ks("address/5.5.0");function ea(t){Ls(t,20)||ta.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=Ps(Js(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const ra={};for(let t=0;t<10;t++)ra[String(t)]=String(t);for(let t=0;t<26;t++)ra[String.fromCharCode(65+t)]=String(10+t);const na=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function ia(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>ra[t])).join("");for(;e.length>=na;){let t=e.substring(0,na);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function oa(t){let e=null;if("string"!=typeof t&&ta.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=ea(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&ta.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==ia(t)&&ta.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new js(r,36).toString(16);e.length<40;)e="0"+e;e=ea("0x"+e)}else ta.throwArgumentError("invalid address","address",t);var r;return e}function sa(t){try{return oa(t),!0}catch(t){}return!1}function aa(t){let e=(r=oa(t).substring(2),new js(r,16).toString(36)).toUpperCase();for(var r;e.length<30;)e="0"+e;return"XE"+ia("XE00"+e)+e}function ua(t){let e=null;try{e=oa(t.from)}catch(e){ta.throwArgumentError("missing from address","transaction",t)}return oa(Fs(Js(Bs(Qs([e,function(t){let e=Ps(t);if(0===e.length)return e;let r=0;for(;rPs(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),Os(n)}(["0xff",oa(t),e,r])),12))}let ha=!1,ca=!1;const fa={debug:1,default:2,info:2,warning:3,error:4,off:5};let da=fa.default,pa=null;const ma=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var ga,va;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(ga||(ga={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(va||(va={}));const ya="0123456789abcdef";class ba{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==fa[r]&&this.throwArgumentError("invalid log level name","logLevel",t),da>fa[r]||console.log.apply(console,e)}debug(...t){this._log(ba.levels.DEBUG,t)}info(...t){this._log(ba.levels.INFO,t)}warn(...t){this._log(ba.levels.WARNING,t)}makeError(t,e,r){if(ca)return this.makeError("censored error",e,{});e||(e=ba.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=ya[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case va.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case va.CALL_EXCEPTION:case va.INSUFFICIENT_FUNDS:case va.MISSING_NEW:case va.NONCE_EXPIRED:case va.REPLACEMENT_UNDERPRICED:case va.TRANSACTION_REPLACED:case va.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,ba.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),ma&&this.throwError("platform missing String.prototype.normalize",ba.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ma})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,ba.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,ba.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,ba.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",ba.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",ba.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",ba.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return pa||(pa=new ba("logger/5.7.0")),pa}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",ba.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ha){if(!t)return;this.globalLogger().throwError("error censorship permanent",ba.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ca=!!t,ha=!!e}static setLogLevel(t){const e=fa[t.toLowerCase()];null!=e?da=e:ba.globalLogger().warn("invalid log level - "+t)}static from(t){return new ba(t)}}ba.errors=va,ba.levels=ga;const wa=new ba("bytes/5.7.0");function Ea(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ea(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Ma(t){return"number"==typeof t&&t==t&&t%1==0}function Aa(t,e){if(e||(e={}),"number"==typeof t){wa.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Ea(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":wa.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?Ea(new Uint8Array(t)):wa.throwArgumentError("invalid arrayify value","value",t)}function _a(t){t=atob(t);const e=[];for(let r=0;r{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Ia,Ca;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Ia||(Ia={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Ca||(Ca={}));const Pa="0123456789abcdef";class La{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==ka[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Ra>ka[r]||console.log.apply(console,e)}debug(...t){this._log(La.levels.DEBUG,t)}info(...t){this._log(La.levels.INFO,t)}warn(...t){this._log(La.levels.WARNING,t)}makeError(t,e,r){if(Ta)return this.makeError("censored error",e,{});e||(e=La.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Pa[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Ca.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Ca.CALL_EXCEPTION:case Ca.INSUFFICIENT_FUNDS:case Ca.MISSING_NEW:case Ca.NONCE_EXPIRED:case Ca.REPLACEMENT_UNDERPRICED:case Ca.TRANSACTION_REPLACED:case Ca.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,La.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Oa&&this.throwError("platform missing String.prototype.normalize",La.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Oa})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,La.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,La.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,La.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",La.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",La.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",La.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return xa||(xa=new La("logger/5.7.0")),xa}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",La.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Sa){if(!t)return;this.globalLogger().throwError("error censorship permanent",La.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Ta=!!t,Sa=!!e}static setLogLevel(t){const e=ka[t.toLowerCase()];null!=e?Ra=e:La.globalLogger().warn("invalid log level - "+t)}static from(t){return new La(t)}}La.errors=Ca,La.levels=Ia;const Ua=new La("bytes/5.7.0");function Ba(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ba(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Da(t){return"number"==typeof t&&t==t&&t%1==0}function Fa(t,e){if(e||(e={}),"number"==typeof t){Ua.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Ba(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Ua.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?Ba(new Uint8Array(t)):Ua.throwArgumentError("invalid arrayify value","value",t)}function Ga(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new La("properties/5.7.0");class ja{constructor(t){Ga(this,"alphabet",t),Ga(this,"base",t.length),Ga(this,"_alphabetMap",{}),Ga(this,"_leader",t.charAt(0));for(let e=0;e0;)r.push(n%this.base),n=n/this.base|0}let n="";for(let t=0;0===e[t]&&t=0;--t)n+=this.alphabet[r[t]];return n}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let r=0;r>=8;for(;i>0;)e.push(255&i),i>>=8}for(let r=0;t[r]===this._leader&&r{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Ya,Ja;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Ya||(Ya={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Ja||(Ja={}));const Xa="0123456789abcdef";class Za{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Ha[r]&&this.throwArgumentError("invalid log level name","logLevel",t),$a>Ha[r]||console.log.apply(console,e)}debug(...t){this._log(Za.levels.DEBUG,t)}info(...t){this._log(Za.levels.INFO,t)}warn(...t){this._log(Za.levels.WARNING,t)}makeError(t,e,r){if(Ka)return this.makeError("censored error",e,{});e||(e=Za.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Xa[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Ja.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Ja.CALL_EXCEPTION:case Ja.INSUFFICIENT_FUNDS:case Ja.MISSING_NEW:case Ja.NONCE_EXPIRED:case Ja.REPLACEMENT_UNDERPRICED:case Ja.TRANSACTION_REPLACED:case Ja.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Za.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Wa&&this.throwError("platform missing String.prototype.normalize",Za.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Wa})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Za.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Za.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,Za.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Za.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Za.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Za.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Va||(Va=new Za("logger/5.7.0")),Va}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Za.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),za){if(!t)return;this.globalLogger().throwError("error censorship permanent",Za.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Ka=!!t,za=!!e}static setLogLevel(t){const e=Ha[t.toLowerCase()];null!=e?$a=e:Za.globalLogger().warn("invalid log level - "+t)}static from(t){return new Za(t)}}Za.errors=Ja,Za.levels=Ya;const Qa=new Za("bytes/5.5.0");function tu(t){return!!t.toHexString}function eu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return eu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function ru(t){return lu(t)&&!(t.length%2)||iu(t)}function nu(t){return"number"==typeof t&&t==t&&t%1==0}function iu(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!nu(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function ou(t,e){if(e||(e={}),"number"==typeof t){Qa.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),eu(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),tu(t)&&(t=t.toHexString()),lu(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":Qa.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;tou(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),eu(n)}function au(t){let e=ou(t);if(0===e.length)return e;let r=0;for(;re&&Qa.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),eu(r)}function lu(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const hu="0123456789abcdef";function cu(t,e){if(e||(e={}),"number"==typeof t){Qa.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=hu[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),tu(t))return t.toHexString();if(lu(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":Qa.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(iu(t)){let e="0x";for(let r=0;r>4]+hu[15&n]}return e}return Qa.throwArgumentError("invalid hexlify value","value",t)}function fu(t){if("string"!=typeof t)t=cu(t);else if(!lu(t)||t.length%2)return null;return(t.length-2)/2}function du(t,e,r){return"string"!=typeof t?t=cu(t):(!lu(t)||t.length%2)&&Qa.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function pu(t){let e="0x";return t.forEach((t=>{e+=cu(t).substring(2)})),e}function mu(t){const e=gu(cu(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function gu(t){"string"!=typeof t&&(t=cu(t)),lu(t)||Qa.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&Qa.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function yu(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(ru(t)){const r=ou(t);65!==r.length&&Qa.throwArgumentError("invalid signature string; must be 65 bytes","signature",t),e.r=cu(r.slice(0,32)),e.s=cu(r.slice(32,64)),e.v=r[64],e.v<27&&(0===e.v||1===e.v?e.v+=27:Qa.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=cu(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=uu(ou(e._vs),32);e._vs=cu(r);const n=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=n:e.recoveryParam!==n&&Qa.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const i=cu(r);null==e.s?e.s=i:e.s!==i&&Qa.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?Qa.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&Qa.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&lu(e.r)?e.r=vu(e.r,32):Qa.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&lu(e.s)?e.s=vu(e.s,32):Qa.throwArgumentError("signature missing or invalid s","signature",t);const r=ou(e.s);r[0]>=128&&Qa.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=cu(r);e._vs&&(lu(e._vs)||Qa.throwArgumentError("signature invalid _vs","signature",t),e._vs=vu(e._vs,32)),null==e._vs?e._vs=n:e._vs!==n&&Qa.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e}function bu(t){return cu(su([(t=yu(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}let wu=!1,Eu=!1;const Mu={debug:1,default:2,info:2,warning:3,error:4,off:5};let Au=Mu.default,_u=null;const Nu=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Su,Tu;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Su||(Su={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Tu||(Tu={}));const ku="0123456789abcdef";class Ru{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Mu[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Au>Mu[r]||console.log.apply(console,e)}debug(...t){this._log(Ru.levels.DEBUG,t)}info(...t){this._log(Ru.levels.INFO,t)}warn(...t){this._log(Ru.levels.WARNING,t)}makeError(t,e,r){if(Eu)return this.makeError("censored error",e,{});e||(e=Ru.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=ku[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Tu.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Tu.CALL_EXCEPTION:case Tu.INSUFFICIENT_FUNDS:case Tu.MISSING_NEW:case Tu.NONCE_EXPIRED:case Tu.REPLACEMENT_UNDERPRICED:case Tu.TRANSACTION_REPLACED:case Tu.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Ru.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Nu&&this.throwError("platform missing String.prototype.normalize",Ru.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Nu})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Ru.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Ru.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,Ru.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Ru.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Ru.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Ru.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return _u||(_u=new Ru("logger/5.7.0")),_u}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Ru.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),wu){if(!t)return;this.globalLogger().throwError("error censorship permanent",Ru.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Eu=!!t,wu=!!e}static setLogLevel(t){const e=Mu[t.toLowerCase()];null!=e?Au=e:Ru.globalLogger().warn("invalid log level - "+t)}static from(t){return new Ru(t)}}Ru.errors=Tu,Ru.levels=Su;const xu=new Ru("bytes/5.7.0");function Ou(t){return!!t.toHexString}function Iu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Iu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Cu(t){return"number"==typeof t&&t==t&&t%1==0}function Pu(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Cu(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Lu(t,e){if(e||(e={}),"number"==typeof t){xu.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Iu(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Ou(t)&&(t=t.toHexString()),Bu(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":xu.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;tLu(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),Iu(n)}function Bu(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Du="0123456789abcdef";function Fu(t,e){if(e||(e={}),"number"==typeof t){xu.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Du[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Ou(t))return t.toHexString();if(Bu(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":xu.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Pu(t)){let e="0x";for(let r=0;r>4]+Du[15&n]}return e}return xu.throwArgumentError("invalid hexlify value","value",t)}function Gu(t){let e="0x";return t.forEach((t=>{e+=Fu(t).substring(2)})),e}function ju(t,e){for("string"!=typeof t?t=Fu(t):Bu(t)||xu.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&xu.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function qu(t){return"0x"+Gn().keccak_256(Lu(t))}const zu=new Ru("strings/5.7.0");var Ku,Hu;function $u(t,e,r,n,i){if(t===Hu.BAD_PREFIX||t===Hu.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n>6==2;n++)t++;return t}return t===Hu.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Ku||(Ku={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Hu||(Hu={}));const Vu=Object.freeze({error:function(t,e,r,n,i){return zu.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:$u,replace:function(t,e,r,n,i){return t===Hu.OVERLONG?(n.push(i),0):(n.push(65533),$u(t,e,r))}});function Wu(t,e=Ku.current){e!=Ku.current&&(zu.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return Lu(r)}function Yu(t){return t.map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function Ju(t,e=Ku.current){return function(t,e){null==e&&(e=Vu.error),t=Lu(t);const r=[];let n=0;for(;n>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?Hu.UNEXPECTED_CONTINUE:Hu.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e(Hu.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i1114111?n+=e(Hu.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e(Hu.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e(Hu.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}(Wu(t,e))}const Xu="Ethereum Signed Message:\n";function Zu(t){return"string"==typeof t&&(t=Wu(t)),qu(Uu([Wu(Xu),Wu(String(t.length)),t]))}function Qu(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,n={};return t.split(",").forEach((t=>{let i=t.split(":");r+=parseInt(i[0],16),n[r]=e(i[1])})),n}function tl(t){let e=0;return t.split(",").map((t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:n,h:e}}))}function el(t,e){let r=0;for(let n=0;n=r&&t<=r+i.h&&(t-r)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(t-r))continue;return i}}return null}const rl=tl("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),nl="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((t=>parseInt(t,16))),il=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],ol=Qu("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),sl=Qu("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),al=Qu("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r{if(nl.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=el(t,il);if(e)return[t+e.s];let r=ol[t];if(r)return r;let n=sl[t];return n?[t+n[0]]:al[t]||null}(t);return e||[t]})),e=r.reduce(((t,e)=>(e.forEach((e=>{t.push(e)})),t)),[]),e=Ju(Yu(e),Ku.NFKC),e.forEach((t=>{if(el(t,ul))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),e.forEach((t=>{if(el(t,rl))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=Yu(e);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");return n}const hl="hash/5.5.0",cl=new Ru(hl),fl=new Uint8Array(32);fl.fill(0);const dl=new RegExp("^((.*)\\.)?([^.]+)$");function pl(t){try{const e=t.split(".");for(let t=0;t0&&(10===arguments[0]?El||(El=!0,bl.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?bl.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ru.errors.UNEXPECTED_ARGUMENT,{}):bl.throwError("BigNumber.toString does not accept parameters",Ru.errors.UNEXPECTED_ARGUMENT,{})),Nl(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Ml)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Ml(wl,Al(t)):t.match(/^-?[0-9]+$/)?new Ml(wl,Al(new yl(t))):bl.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Sl("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&Sl("overflow","BigNumber.from",t),Ml.from(String(t));const e=t;if("bigint"==typeof e)return Ml.from(e.toString());if(Pu(e))return Ml.from(Fu(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Ml.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Bu(t)||"-"===t[0]&&Bu(t.substring(1))))return Ml.from(t)}return bl.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Al(t){if("string"!=typeof t)return Al(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&bl.throwArgumentError("invalid hex","value",t),"0x00"===(t=Al(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function _l(t){return Ml.from(Al(t))}function Nl(t){const e=Ml.from(t).toHexString();return"-"===e[0]?new yl("-"+e.substring(3),16):new yl(e.substring(2),16)}function Sl(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),bl.throwError(t,Ru.errors.NUMERIC_FAULT,n)}const Tl=new Ru("address/5.7.0");function kl(t){Bu(t,20)||Tl.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=Lu(qu(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Rl={};for(let t=0;t<10;t++)Rl[String(t)]=String(t);for(let t=0;t<26;t++)Rl[String.fromCharCode(65+t)]=String(10+t);const xl=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Ol(t){let e=null;if("string"!=typeof t&&Tl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=kl(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Tl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Rl[t])).join("");for(;e.length>=xl;){let t=e.substring(0,xl);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&Tl.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new yl(r,36).toString(16);e.length<40;)e="0"+e;e=kl("0x"+e)}else Tl.throwArgumentError("invalid address","address",t);var r;return e}const Il=new Ru("properties/5.7.0");function Cl(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function Pl(t){const e={};for(const r in t)e[r]=t[r];return e}const Ll={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Ul(t){if(null==t||Ll[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rDl(t))));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&Cl(e,r,Dl(n))}return e}return Il.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Dl(t){return Bl(t)}const Fl=new Ru(hl),Gl=new Uint8Array(32);Gl.fill(0);const jl=Ml.from(-1),ql=Ml.from(0),zl=Ml.from(1),Kl=Ml.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Hl=ju(zl.toHexString(),32),$l=ju(ql.toHexString(),32),Vl={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Wl=["name","version","chainId","verifyingContract","salt"];function Yl(t){return function(e){return"string"!=typeof e&&Fl.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Jl={name:Yl("name"),version:Yl("version"),chainId:function(t){try{return Ml.from(t).toString()}catch(t){}return Fl.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return Ol(t).toLowerCase()}catch(t){}return Fl.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=Lu(t);if(32!==e.length)throw new Error("bad length");return Fu(e)}catch(t){}return Fl.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function Xl(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],n=parseInt(e[2]||"256");(n%8!=0||n>256||e[2]&&e[2]!==String(n))&&Fl.throwArgumentError("invalid numeric width","type",t);const i=Kl.mask(r?n-1:n),o=r?i.add(zl).mul(jl):ql;return function(e){const r=Ml.from(e);return(r.lt(o)||r.gt(i))&&Fl.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),ju(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&Fl.throwArgumentError("invalid bytes width","type",t),function(e){return Lu(e).length!==r&&Fl.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=Lu(t),r=e.length%32;return r?Gu([e,Gl.slice(r)]):Fu(e)}(e)}}}switch(t){case"address":return function(t){return ju(Ol(t),32)};case"bool":return function(t){return t?Hl:$l};case"bytes":return function(t){return qu(t)};case"string":return function(t){return gl(t)}}return null}function Zl(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class Ql{constructor(t){Cl(this,"types",Object.freeze(Dl(t))),Cl(this,"_encoderCache",{}),Cl(this,"_types",{});const e={},r={},n={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],n[t]={}}));for(const n in t){const i={};t[n].forEach((o=>{i[o.name]&&Fl.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",t),i[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&Fl.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t),Xl(s)||(r[s]||Fl.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const i=Object.keys(r).filter((t=>0===r[t].length));0===i.length?Fl.throwArgumentError("missing primary type","types",t):i.length>1&&Fl.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),Cl(this,"primaryType",i[0]),function i(o,s){s[o]&&Fl.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(i(t,s),Object.keys(s).forEach((e=>{n[e][t]=!0})))})),delete s[o]}(this.primaryType,{});for(const e in n){const r=Object.keys(n[e]);r.sort(),this._types[e]=Zl(e,t[e])+r.map((e=>Zl(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=Xl(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),n=parseInt(e[3]);return e=>{n>=0&&e.length!==n&&Fl.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(qu)),qu(Gu(i))}}const r=this.types[t];if(r){const e=gl(this._types[t]);return t=>{const n=r.map((({name:e,type:r})=>{const n=this.getEncoder(r)(t[e]);return this._types[r]?qu(n):n}));return n.unshift(e),Gu(n)}}return Fl.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||Fl.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return qu(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(Xl(t))return r(t,e);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=parseInt(n[3]);return i>=0&&e.length!==i&&Fl.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const i=this.types[t];return i?i.reduce(((t,{name:n,type:i})=>(t[n]=this._visit(i,e[n],r),t)),{}):Fl.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new Ql(t)}static getPrimaryType(t){return Ql.from(t).primaryType}static hashStruct(t,e,r){return Ql.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=Vl[r];n||Fl.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>Wl.indexOf(t.name)-Wl.indexOf(e.name))),Ql.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return Gu(["0x1901",Ql.hashDomain(t),Ql.from(e).hash(r)])}static hash(t,e,r){return qu(Ql.encode(t,e,r))}static resolveNames(t,e,r,n){return i=this,o=void 0,a=function*(){t=Pl(t);const i={};t.verifyingContract&&!Bu(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=Ql.from(e);o.visit(r,((t,e)=>("address"!==t||Bu(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:r}},new((s=void 0)||(s=Promise))((function(t,e){function r(t){try{u(a.next(t))}catch(t){e(t)}}function n(t){try{u(a.throw(t))}catch(t){e(t)}}function u(e){var i;e.done?t(e.value):(i=e.value,i instanceof s?i:new s((function(t){t(i)}))).then(r,n)}u((a=a.apply(i,o||[])).next())}));var i,o,s,a}static getPayload(t,e,r){Ql.hashDomain(t);const n={},i=[];Wl.forEach((e=>{const r=t[e];null!=r&&(n[e]=Jl[e](r),i.push({name:e,type:Vl[e]}))}));const o=Ql.from(e),s=Pl(e);return s.EIP712Domain?Fl.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=i,o.encode(r),{types:s,domain:n,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return Fu(Lu(e));if(t.match(/^u?int/))return Ml.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&Fl.throwArgumentError("invalid string","value",e),e}return Fl.throwArgumentError("unsupported type","type",t)}))}}}let th=!1,eh=!1;const rh={debug:1,default:2,info:2,warning:3,error:4,off:5};let nh=rh.default,ih=null;const oh=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var sh,ah;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(sh||(sh={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(ah||(ah={}));const uh="0123456789abcdef";class lh{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==rh[r]&&this.throwArgumentError("invalid log level name","logLevel",t),nh>rh[r]||console.log.apply(console,e)}debug(...t){this._log(lh.levels.DEBUG,t)}info(...t){this._log(lh.levels.INFO,t)}warn(...t){this._log(lh.levels.WARNING,t)}makeError(t,e,r){if(eh)return this.makeError("censored error",e,{});e||(e=lh.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=uh[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case ah.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case ah.CALL_EXCEPTION:case ah.INSUFFICIENT_FUNDS:case ah.MISSING_NEW:case ah.NONCE_EXPIRED:case ah.REPLACEMENT_UNDERPRICED:case ah.TRANSACTION_REPLACED:case ah.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,lh.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),oh&&this.throwError("platform missing String.prototype.normalize",lh.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:oh})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,lh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,lh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,lh.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",lh.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",lh.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",lh.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return ih||(ih=new lh("logger/5.7.0")),ih}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",lh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),th){if(!t)return;this.globalLogger().throwError("error censorship permanent",lh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}eh=!!t,th=!!e}static setLogLevel(t){const e=rh[t.toLowerCase()];null!=e?nh=e:lh.globalLogger().warn("invalid log level - "+t)}static from(t){return new lh(t)}}lh.errors=ah,lh.levels=sh;const hh=new lh("bytes/5.7.0");function ch(t){return!!t.toHexString}function fh(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return fh(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function dh(t){return"number"==typeof t&&t==t&&t%1==0}function ph(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!dh(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function mh(t,e){if(e||(e={}),"number"==typeof t){hh.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),fh(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),ch(t)&&(t=t.toHexString()),vh(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":hh.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;tmh(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),fh(n)}function vh(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const yh="0123456789abcdef";function bh(t,e){if(e||(e={}),"number"==typeof t){hh.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=yh[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),ch(t))return t.toHexString();if(vh(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":hh.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(ph(t)){let e="0x";for(let r=0;r>4]+yh[15&n]}return e}return hh.throwArgumentError("invalid hexlify value","value",t)}function wh(t,e,r){return"string"!=typeof t?t=bh(t):(!vh(t)||t.length%2)&&hh.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Eh(t,e){for("string"!=typeof t?t=bh(t):vh(t)||hh.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&hh.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Mh(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new lh("properties/5.7.0");class Ah{constructor(t){Mh(this,"alphabet",t),Mh(this,"base",t.length),Mh(this,"_alphabetMap",{}),Mh(this,"_leader",t.charAt(0));for(let e=0;e0;)r.push(n%this.base),n=n/this.base|0}let n="";for(let t=0;0===e[t]&&t=0;--t)n+=this.alphabet[r[t]];return n}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let r=0;r>=8;for(;i>0;)e.push(255&i),i>>=8}for(let r=0;t[r]===this._leader&&r0&&(10===arguments[0]?xh||(xh=!0,kh.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?kh.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",lh.errors.UNEXPECTED_ARGUMENT,{}):kh.throwError("BigNumber.toString does not accept parameters",lh.errors.UNEXPECTED_ARGUMENT,{})),Ph(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Oh)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Oh(Rh,Ih(t)):t.match(/^-?[0-9]+$/)?new Oh(Rh,Ih(new Th(t))):kh.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Lh("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&Lh("overflow","BigNumber.from",t),Oh.from(String(t));const e=t;if("bigint"==typeof e)return Oh.from(e.toString());if(ph(e))return Oh.from(bh(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Oh.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(vh(t)||"-"===t[0]&&vh(t.substring(1))))return Oh.from(t)}return kh.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Ih(t){if("string"!=typeof t)return Ih(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&kh.throwArgumentError("invalid hex","value",t),"0x00"===(t=Ih(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Ch(t){return Oh.from(Ih(t))}function Ph(t){const e=Oh.from(t).toHexString();return"-"===e[0]?new Th("-"+e.substring(3),16):new Th(e.substring(2),16)}function Lh(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),kh.throwError(t,lh.errors.NUMERIC_FAULT,n)}const Uh=new lh("strings/5.7.0");var Bh,Dh;function Fh(t,e,r,n,i){if(t===Dh.BAD_PREFIX||t===Dh.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n>6==2;n++)t++;return t}return t===Dh.OVERRUN?r.length-e-1:0}function Gh(t,e=Bh.current){e!=Bh.current&&(Uh.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return mh(r)}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Bh||(Bh={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Dh||(Dh={})),Object.freeze({error:function(t,e,r,n,i){return Uh.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:Fh,replace:function(t,e,r,n,i){return t===Dh.OVERLONG?(n.push(i),0):(n.push(65533),Fh(t,e,r))}});var jh,qh=r(3715),zh=r.n(qh);!function(t){t.sha256="sha256",t.sha512="sha512"}(jh||(jh={}));const Kh=new lh("sha2/5.7.0");function Hh(t){return"0x"+zh().sha256().update(mh(t)).digest("hex")}function $h(t,e,r){return jh[t]||Kh.throwError("unsupported algorithm "+t,lh.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),"0x"+zh().hmac(zh()[t],mh(e)).update(mh(r)).digest("hex")}function Vh(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},t(r,r.exports),r.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self&&self;var Wh=Yh;function Yh(t,e){if(!t)throw new Error(e||"Assertion failed")}Yh.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Jh=Vh((function(t,e){var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}})),Xh=Vh((function(t,e){var r=e;r.assert=Wh,r.toArray=Jh.toArray,r.zero2=Jh.zero2,r.toHex=Jh.toHex,r.encode=Jh.encode,r.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,l=e.andln(3)+o&3;3===u&&(u=-1),3===l&&(l=-1),s=0==(1&u)?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==l?u:-u,r[0].push(s),a=0==(1&l)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==u?l:-l,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new(Sh())(t,"hex","le")}})),Zh=Xh.getNAF,Qh=Xh.getJSF,tc=Xh.assert;function ec(t,e){this.type=t,this.p=new(Sh())(e.p,16),this.red=e.prime?Sh().red(e.prime):Sh().mont(this.p),this.zero=new(Sh())(0).toRed(this.red),this.one=new(Sh())(1).toRed(this.red),this.two=new(Sh())(2).toRed(this.red),this.n=e.n&&new(Sh())(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var rc=ec;function nc(t,e){this.curve=t,this.type=e,this.precomputed=null}ec.prototype.point=function(){throw new Error("Not implemented")},ec.prototype.validate=function(){throw new Error("Not implemented")},ec.prototype._fixedNafMul=function(t,e){tc(t.precomputed);var r=t._getDoubles(),n=Zh(e,1,this._bitLength),i=(1<=o;u--)s=(s<<1)+n[u];a.push(s)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),c=i;c>0;c--){for(o=0;o=0;a--){for(var u=0;a>=0&&0===o[a];a--)u++;if(a>=0&&u++,s=s.dblp(u),a<0)break;var l=o[a];tc(0!==l),s="affine"===t.type?l>0?s.mixedAdd(i[l-1>>1]):s.mixedAdd(i[-l-1>>1].neg()):l>0?s.add(i[l-1>>1]):s.add(i[-l-1>>1].neg())}return"affine"===t.type?s.toP():s},ec.prototype._wnafMulAdd=function(t,e,r,n,i){var o,s,a,u=this._wnafT1,l=this._wnafT2,h=this._wnafT3,c=0;for(o=0;o=1;o-=2){var d=o-1,p=o;if(1===u[d]&&1===u[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=Qh(r[d],r[p]);for(c=Math.max(v[0].length,c),h[d]=new Array(c),h[p]=new Array(c),s=0;s=0;o--){for(var M=0;o>=0;){var A=!0;for(s=0;s=0&&M++,w=w.dblp(M),o<0)break;for(s=0;s0?a=l[s][_-1>>1]:_<0&&(a=l[s][-_-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},nc.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=e,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},sc.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),l=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(l).neg()}},sc.prototype.pointFromX=function(t,e){(t=new(Sh())(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},sc.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},sc.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},uc.prototype.isInfinity=function(){return this.inf},uc.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},uc.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},uc.prototype.getX=function(){return this.x.fromRed()},uc.prototype.getY=function(){return this.y.fromRed()},uc.prototype.mul=function(t){return t=new(Sh())(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},uc.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},uc.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},uc.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},uc.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},uc.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},ic(lc,rc.BasePoint),sc.prototype.jpoint=function(t,e,r){return new lc(this,t,e,r)},lc.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},lc.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},lc.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),h=l.redMul(a),c=n.redMul(l),f=u.redSqr().redIAdd(h).redISub(c).redISub(c),d=u.redMul(c.redISub(f)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(f,d,p)},lc.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),h=r.redMul(u),c=a.redSqr().redIAdd(l).redISub(h).redISub(h),f=a.redMul(h.redISub(c)).redISub(i.redMul(l)),d=this.z.redMul(s);return this.curve.jpoint(c,f,d)},lc.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},lc.prototype.inspect=function(){return this.isInfinity()?"":""},lc.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var hc=Vh((function(t,e){var r=e;r.base=rc,r.short=ac,r.mont=null,r.edwards=null})),cc=Vh((function(t,e){var r,n=e,i=Xh.assert;function o(t){"short"===t.type?this.curve=new hc.short(t):"edwards"===t.type?this.curve=new hc.edwards(t):this.curve=new hc.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:zh().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:zh().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:zh().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:zh().sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:zh().sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zh().sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zh().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){r=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:zh().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function fc(t){if(!(this instanceof fc))return new fc(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Jh.toArray(t.entropy,t.entropyEnc||"hex"),r=Jh.toArray(t.nonce,t.nonceEnc||"hex"),n=Jh.toArray(t.pers,t.persEnc||"hex");Wh(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var dc=fc;fc.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},fc.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=Jh.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var vc=Xh.assert;function yc(t,e){if(t instanceof yc)return t;this._importDER(t,e)||(vc(t.r&&t.s,"Signature without r or s"),this.r=new(Sh())(t.r,16),this.s=new(Sh())(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var bc=yc;function wc(){this.place=0}function Ec(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return!(i<=127)&&(e.place=s,i)}function Mc(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}yc.prototype._importDER=function(t,e){t=Xh.toArray(t,e);var r=new wc;if(48!==t[r.place++])return!1;var n=Ec(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var i=Ec(t,r);if(!1===i)return!1;var o=t.slice(r.place,i+r.place);if(r.place+=i,2!==t[r.place++])return!1;var s=Ec(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new(Sh())(o),this.s=new(Sh())(a),this.recoveryParam=null,!0},yc.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=Mc(e),r=Mc(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];Ac(n,e.length),(n=n.concat(e)).push(2),Ac(n,r.length);var i=n.concat(r),o=[48];return Ac(o,i.length),o=o.concat(i),Xh.encode(o,t)};var _c=function(){throw new Error("unsupported")},Nc=Xh.assert;function Sc(t){if(!(this instanceof Sc))return new Sc(t);"string"==typeof t&&(Nc(Object.prototype.hasOwnProperty.call(cc,t),"Unknown curve "+t),t=cc[t]),t instanceof cc.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Tc=Sc;Sc.prototype.keyPair=function(t){return new gc(this,t)},Sc.prototype.keyFromPrivate=function(t,e){return gc.fromPrivate(this,t,e)},Sc.prototype.keyFromPublic=function(t,e){return gc.fromPublic(this,t,e)},Sc.prototype.genKeyPair=function(t){t||(t={});for(var e=new dc({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||_c(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new(Sh())(2));;){var i=new(Sh())(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Sc.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Sc.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new(Sh())(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),s=t.toArray("be",i),a=new dc({hash:this.hash,entropy:o,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new(Sh())(1)),l=0;;l++){var h=n.k?n.k(l):new(Sh())(a.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(u)>=0)){var c=this.g.mul(h);if(!c.isInfinity()){var f=c.getX(),d=f.umod(this.n);if(0!==d.cmpn(0)){var p=h.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(c.getY().isOdd()?1:0)|(0!==f.cmp(d)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new bc({r:d,s:p,recoveryParam:m})}}}}}},Sc.prototype.verify=function(t,e,r,n){t=this._truncateToN(new(Sh())(t,16)),r=this.keyFromPublic(r,n);var i=(e=new bc(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,a=o.invm(this.n),u=a.mul(t).umod(this.n),l=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},Sc.prototype.recoverPubKey=function(t,e,r,n){Nc((3&r)===r,"The recovery param is more than two bits"),e=new bc(e,n);var i=this.n,o=new(Sh())(t),s=e.r,a=e.s,u=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var h=e.r.invm(i),c=i.sub(o).mul(h).umod(i),f=a.mul(h).umod(i);return this.g.mulAdd(c,s,f)},Sc.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new bc(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var kc=Vh((function(t,e){var r=e;r.version="6.5.4",r.utils=Xh,r.rand=function(){throw new Error("unsupported")},r.curve=hc,r.curves=cc,r.ec=Tc,r.eddsa=null})).ec;const Rc=new lh("signing-key/5.7.0");let xc=null;function Oc(){return xc||(xc=new kc("secp256k1")),xc}class Ic{constructor(t){Mh(this,"curve","secp256k1"),Mh(this,"privateKey",bh(t)),32!==function(t){if("string"!=typeof t)t=bh(t);else if(!vh(t)||t.length%2)return null;return(t.length-2)/2}(this.privateKey)&&Rc.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=Oc().keyFromPrivate(mh(this.privateKey));Mh(this,"publicKey","0x"+e.getPublic(!1,"hex")),Mh(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Mh(this,"_isSigningKey",!0)}_addPoint(t){const e=Oc().keyFromPublic(mh(this.publicKey)),r=Oc().keyFromPublic(mh(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=Oc().keyFromPrivate(mh(this.privateKey)),r=mh(t);32!==r.length&&Rc.throwArgumentError("bad digest length","digest",t);const n=e.sign(r,{canonical:!0});return function(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(vh(r=t)&&!(r.length%2)||ph(r)){let r=mh(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=bh(r.slice(0,32)),e.s=bh(r.slice(32,64))):65===r.length?(e.r=bh(r.slice(0,32)),e.s=bh(r.slice(32,64)),e.v=r[64]):hh.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:hh.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=bh(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=mh(t)).length>e&&hh.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),fh(r)}(mh(e._vs),32);e._vs=bh(r);const n=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=n:e.recoveryParam!==n&&hh.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const i=bh(r);null==e.s?e.s=i:e.s!==i&&hh.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?hh.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&hh.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&vh(e.r)?e.r=Eh(e.r,32):hh.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&vh(e.s)?e.s=Eh(e.s,32):hh.throwArgumentError("signature missing or invalid s","signature",t);const r=mh(e.s);r[0]>=128&&hh.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=bh(r);e._vs&&(vh(e._vs)||hh.throwArgumentError("signature invalid _vs","signature",t),e._vs=Eh(e._vs,32)),null==e._vs?e._vs=n:e._vs!==n&&hh.throwArgumentError("signature _vs mismatch v and s","signature",t)}var r;return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}({recoveryParam:n.recoveryParam,r:Eh("0x"+n.r.toString(16),32),s:Eh("0x"+n.s.toString(16),32)})}computeSharedSecret(t){const e=Oc().keyFromPrivate(mh(this.privateKey)),r=Oc().keyFromPublic(mh(Cc(t)));return Eh("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function Cc(t,e){const r=mh(t);if(32===r.length){const t=new Ic(r);return e?"0x"+Oc().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?bh(r):"0x"+Oc().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+Oc().keyFromPublic(r).getPublic(!0,"hex"):bh(r):Rc.throwArgumentError("invalid public or private key","key","[REDACTED]")}function Pc(t){return"0x"+Gn().keccak_256(mh(t))}const Lc=new lh("address/5.7.0");function Uc(t){vh(t,20)||Lc.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=mh(Pc(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Bc={};for(let t=0;t<10;t++)Bc[String(t)]=String(t);for(let t=0;t<26;t++)Bc[String.fromCharCode(65+t)]=String(10+t);const Dc=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Fc(t){let e=null;if("string"!=typeof t&&Lc.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Uc(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Lc.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Bc[t])).join("");for(;e.length>=Dc;){let t=e.substring(0,Dc);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&Lc.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Th(r,36).toString(16);e.length<40;)e="0"+e;e=Uc("0x"+e)}else Lc.throwArgumentError("invalid address","address",t);var r;return e}var Gc;new lh("transactions/5.7.0"),function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(Gc||(Gc={}));const jc=new lh("wordlists/5.7.0");class qc{constructor(t){jc.checkAbstract(new.target,qc),Mh(this,"locale",t)}split(t){return t.toLowerCase().split(/ +/g)}join(t){return t.join(" ")}static check(t){const e=[];for(let r=0;r<2048;r++){const n=t.getWord(r);if(r!==t.getWordIndex(n))return"0x";e.push(n)}return Pc(Gh(e.join("\n")+"\n"))}static register(t,e){e||(e=t.locale)}}let zc=null;function Kc(t){if(null==zc&&(zc="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==qc.check(t)))throw zc=null,new Error("BIP39 Wordlist for en (English) FAILED")}const Hc=new class extends qc{constructor(){super("en")}getWord(t){return Kc(this),zc[t]}getWordIndex(t){return Kc(this),zc.indexOf(t)}};qc.register(Hc);const $c={en:Hc},Vc=new lh("hdnode/5.5.0"),Wc=Oh.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Yc=Gh("Bitcoin seed"),Jc=2147483648;function Xc(t){return(1<=256)throw new Error("Depth too large!");return Qc(gh([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",bh(this.depth),this.parentFingerprint,Eh(bh(this.index),4),this.chainCode,null!=this.privateKey?gh(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new nf(ef,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(t){if(t>4294967295)throw new Error("invalid index - "+String(t));let e=this.path;e&&(e+="/"+(t&~Jc));const r=new Uint8Array(37);if(t&Jc){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(mh(this.privateKey),1),e&&(e+="'")}else r.set(mh(this.publicKey));for(let e=24;e>=0;e-=8)r[33+(e>>3)]=t>>24-e&255;const n=mh($h(jh.sha512,this.chainCode,r)),i=n.slice(0,32),o=n.slice(32);let s=null,a=null;this.privateKey?s=Zc(Oh.from(i).add(this.privateKey).mod(Wc)):a=new Ic(bh(i))._addPoint(this.publicKey);let u=e;const l=this.mnemonic;return l&&(u=Object.freeze({phrase:l.phrase,path:e,locale:l.locale||"en"})),new nf(ef,s,a,this.fingerprint,Zc(o),t,this.depth+1,u)}derivePath(t){const e=t.split("/");if(0===e.length||"m"===e[0]&&0!==this.depth)throw new Error("invalid path - "+t);"m"===e[0]&&e.shift();let r=this;for(let t=0;t=Jc)throw new Error("invalid path index - "+n);r=r._derive(Jc+t)}else{if(!n.match(/^[0-9]+$/))throw new Error("invalid path component - "+n);{const t=parseInt(n);if(t>=Jc)throw new Error("invalid path index - "+n);r=r._derive(t)}}}return r}static _fromSeed(t,e){const r=mh(t);if(r.length<16||r.length>64)throw new Error("invalid seed");const n=mh($h(jh.sha512,Yc,r));return new nf(ef,Zc(n.slice(0,32)),null,"0x00000000",Zc(n.slice(32)),0,0,e)}static fromMnemonic(t,e,r){return t=af(sf(t,r=tf(r)),r),nf._fromSeed(of(t,e),{phrase:t,path:"m",locale:r.locale})}static fromSeed(t){return nf._fromSeed(t,null)}static fromExtendedKey(t){const e=_h.decode(t);82===e.length&&Qc(e.slice(0,78))===t||Vc.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const r=e[4],n=bh(e.slice(5,9)),i=parseInt(bh(e.slice(9,13)).substring(2),16),o=bh(e.slice(13,45)),s=e.slice(45,78);switch(bh(e.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new nf(ef,null,bh(s),n,o,i,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new nf(ef,bh(s.slice(1)),null,n,o,i,r,null)}return Vc.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function of(t,e){e||(e="");const r=Gh("mnemonic"+e,Bh.NFKD);return function(t,e,r,n,i){let o;t=mh(t),e=mh(e);let s=1;const a=new Uint8Array(64),u=new Uint8Array(e.length+4);let l,h;u.set(e);for(let r=1;r<=s;r++){u[e.length]=r>>24&255,u[e.length+1]=r>>16&255,u[e.length+2]=r>>8&255,u[e.length+3]=255&r;let n=mh($h(i,t,u));o||(o=n.length,h=new Uint8Array(o),s=Math.ceil(64/o),l=64-(s-1)*o),h.set(n);for(let e=1;e<2048;e++){n=mh($h(i,t,n));for(let t=0;t>3]|=1<<7-i%8),i++}const o=32*r.length/3,s=Xc(r.length/3);if((mh(Hh(n.slice(0,o/8)))[0]&s)!=(n[n.length-1]&s))throw new Error("invalid checksum");return bh(n.slice(0,o/8))}function af(t,e){if(e=tf(e),(t=mh(t)).length%4!=0||t.length<16||t.length>32)throw new Error("invalid entropy");const r=[0];let n=11;for(let e=0;e8?(r[r.length-1]<<=8,r[r.length-1]|=t[e],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=t[e]>>8-n,r.push(t[e]&(1<<8-n)-1),n+=3);const i=t.length/4,o=mh(Hh(t))[0]&Xc(i);return r[r.length-1]<<=i,r[r.length-1]|=o>>8-i,e.join(r.map((t=>e.getWord(t))))}function uf(t,e){try{return sf(t,e),!0}catch(t){}return!1}function lf(t){return("number"!=typeof t||t<0||t>=Jc||t%1)&&Vc.throwArgumentError("invalid account index","index",t),`m/44'/60'/${t}'/0/0`}let hf=!1,cf=!1;const ff={debug:1,default:2,info:2,warning:3,error:4,off:5};let df=ff.default,pf=null;const mf=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var gf,vf;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(gf||(gf={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(vf||(vf={}));const yf="0123456789abcdef";class bf{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==ff[r]&&this.throwArgumentError("invalid log level name","logLevel",t),df>ff[r]||console.log.apply(console,e)}debug(...t){this._log(bf.levels.DEBUG,t)}info(...t){this._log(bf.levels.INFO,t)}warn(...t){this._log(bf.levels.WARNING,t)}makeError(t,e,r){if(cf)return this.makeError("censored error",e,{});e||(e=bf.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=yf[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case vf.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case vf.CALL_EXCEPTION:case vf.INSUFFICIENT_FUNDS:case vf.MISSING_NEW:case vf.NONCE_EXPIRED:case vf.REPLACEMENT_UNDERPRICED:case vf.TRANSACTION_REPLACED:case vf.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,bf.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),mf&&this.throwError("platform missing String.prototype.normalize",bf.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:mf})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,bf.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,bf.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,bf.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",bf.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",bf.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",bf.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return pf||(pf=new bf("logger/5.7.0")),pf}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",bf.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),hf){if(!t)return;this.globalLogger().throwError("error censorship permanent",bf.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}cf=!!t,hf=!!e}static setLogLevel(t){const e=ff[t.toLowerCase()];null!=e?df=e:bf.globalLogger().warn("invalid log level - "+t)}static from(t){return new bf(t)}}bf.errors=vf,bf.levels=gf;const wf=new bf("bytes/5.7.0");function Ef(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ef(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Mf(t){return"number"==typeof t&&t==t&&t%1==0}function Af(t,e){if(e||(e={}),"number"==typeof t){wf.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Ef(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),_f(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":wf.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?Ef(new Uint8Array(t)):wf.throwArgumentError("invalid arrayify value","value",t)}function _f(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var Nf=r(557),Sf=r.n(Nf)().BN;new bf("bignumber/5.7.0");const Tf=new bf("address/5.7.0");function kf(t){_f(t,20)||Tf.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=Af((i=r,"0x"+Gn().keccak_256(Af(i))));var i;for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Rf={};for(let t=0;t<10;t++)Rf[String(t)]=String(t);for(let t=0;t<26;t++)Rf[String.fromCharCode(65+t)]=String(10+t);const xf=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Of(t){let e=null;if("string"!=typeof t&&Tf.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=kf(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Tf.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Rf[t])).join("");for(;e.length>=xf;){let t=e.substring(0,xf);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&Tf.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Sf(r,36).toString(16);e.length<40;)e="0"+e;e=kf("0x"+e)}else Tf.throwArgumentError("invalid address","address",t);var r;return e}function If(t){if(function(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return e.encseed&&e.ethaddr}(t))try{return Of(JSON.parse(t).ethaddr)}catch(t){return null}if(function(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return!(!e.version||parseInt(e.version)!==e.version||3!==parseInt(e.version))}(t))try{return Of(JSON.parse(t).address)}catch(t){return null}return null}let Cf=!1,Pf=!1;const Lf={debug:1,default:2,info:2,warning:3,error:4,off:5};let Uf=Lf.default,Bf=null;const Df=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Ff,Gf;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Ff||(Ff={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Gf||(Gf={}));const jf="0123456789abcdef";class qf{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Lf[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Uf>Lf[r]||console.log.apply(console,e)}debug(...t){this._log(qf.levels.DEBUG,t)}info(...t){this._log(qf.levels.INFO,t)}warn(...t){this._log(qf.levels.WARNING,t)}makeError(t,e,r){if(Pf)return this.makeError("censored error",e,{});e||(e=qf.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=jf[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Gf.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Gf.CALL_EXCEPTION:case Gf.INSUFFICIENT_FUNDS:case Gf.MISSING_NEW:case Gf.NONCE_EXPIRED:case Gf.REPLACEMENT_UNDERPRICED:case Gf.TRANSACTION_REPLACED:case Gf.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,qf.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Df&&this.throwError("platform missing String.prototype.normalize",qf.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Df})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,qf.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,qf.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,qf.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",qf.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",qf.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",qf.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Bf||(Bf=new qf("logger/5.7.0")),Bf}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",qf.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Cf){if(!t)return;this.globalLogger().throwError("error censorship permanent",qf.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Pf=!!t,Cf=!!e}static setLogLevel(t){const e=Lf[t.toLowerCase()];null!=e?Uf=e:qf.globalLogger().warn("invalid log level - "+t)}static from(t){return new qf(t)}}qf.errors=Gf,qf.levels=Ff;const zf=new qf("bytes/5.7.0");function Kf(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Kf(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Hf(t){return"number"==typeof t&&t==t&&t%1==0}function $f(t,e){if(e||(e={}),"number"==typeof t){zf.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Kf(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":zf.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?Kf(new Uint8Array(t)):zf.throwArgumentError("invalid arrayify value","value",t)}function Vf(t){return"0x"+Gn().keccak_256($f(t))}let Wf=!1,Yf=!1;const Jf={debug:1,default:2,info:2,warning:3,error:4,off:5};let Xf=Jf.default,Zf=null;const Qf=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var td,ed;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(td||(td={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(ed||(ed={}));const rd="0123456789abcdef";class nd{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Jf[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Xf>Jf[r]||console.log.apply(console,e)}debug(...t){this._log(nd.levels.DEBUG,t)}info(...t){this._log(nd.levels.INFO,t)}warn(...t){this._log(nd.levels.WARNING,t)}makeError(t,e,r){if(Yf)return this.makeError("censored error",e,{});e||(e=nd.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=rd[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;n.length&&(t+=" ("+n.join(", ")+")");const o=new Error(t);return o.reason=i,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,nd.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Qf&&this.throwError("platform missing String.prototype.normalize",nd.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Qf})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,nd.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,nd.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,nd.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",nd.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",nd.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",nd.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Zf||(Zf=new nd("logger/5.5.0")),Zf}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",nd.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Wf){if(!t)return;this.globalLogger().throwError("error censorship permanent",nd.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Yf=!!t,Wf=!!e}static setLogLevel(t){const e=Jf[t.toLowerCase()];null!=e?Xf=e:nd.globalLogger().warn("invalid log level - "+t)}static from(t){return new nd(t)}}nd.errors=ed,nd.levels=td;let id=!1,od=!1;const sd={debug:1,default:2,info:2,warning:3,error:4,off:5};let ad=sd.default,ud=null;const ld=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var hd,cd;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(hd||(hd={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(cd||(cd={}));const fd="0123456789abcdef";class dd{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==sd[r]&&this.throwArgumentError("invalid log level name","logLevel",t),ad>sd[r]||console.log.apply(console,e)}debug(...t){this._log(dd.levels.DEBUG,t)}info(...t){this._log(dd.levels.INFO,t)}warn(...t){this._log(dd.levels.WARNING,t)}makeError(t,e,r){if(od)return this.makeError("censored error",e,{});e||(e=dd.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=fd[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case cd.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case cd.CALL_EXCEPTION:case cd.INSUFFICIENT_FUNDS:case cd.MISSING_NEW:case cd.NONCE_EXPIRED:case cd.REPLACEMENT_UNDERPRICED:case cd.TRANSACTION_REPLACED:case cd.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,dd.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),ld&&this.throwError("platform missing String.prototype.normalize",dd.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ld})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,dd.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,dd.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,dd.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",dd.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",dd.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",dd.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return ud||(ud=new dd("logger/5.7.0")),ud}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",dd.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),id){if(!t)return;this.globalLogger().throwError("error censorship permanent",dd.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}od=!!t,id=!!e}static setLogLevel(t){const e=sd[t.toLowerCase()];null!=e?ad=e:dd.globalLogger().warn("invalid log level - "+t)}static from(t){return new dd(t)}}dd.errors=cd,dd.levels=hd;const pd=new dd("bytes/5.7.0");function md(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return md(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function gd(t){return"number"==typeof t&&t==t&&t%1==0}function vd(t,e){if(e||(e={}),"number"==typeof t){pd.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),md(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":pd.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?md(new Uint8Array(t)):pd.throwArgumentError("invalid arrayify value","value",t)}var yd;!function(t){t.sha256="sha256",t.sha512="sha512"}(yd||(yd={}));const bd=new dd("sha2/5.5.0");function wd(t){return"0x"+zh().ripemd160().update(vd(t)).digest("hex")}function Ed(t){return"0x"+zh().sha256().update(vd(t)).digest("hex")}function Md(t){return"0x"+zh().sha512().update(vd(t)).digest("hex")}function Ad(t,e,r){return yd[t]||bd.throwError("unsupported algorithm "+t,dd.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),"0x"+zh().hmac(zh()[t],vd(e)).update(vd(r)).digest("hex")}const _d=new RegExp("^bytes([0-9]+)$"),Nd=new RegExp("^(u?int)([0-9]*)$"),Sd=new RegExp("^(.*)\\[([0-9]*)\\]$"),Td="0000000000000000000000000000000000000000000000000000000000000000",kd=new y.Yd("solidity/5.5.0");function Rd(t,e,r){switch(t){case"address":return r?(0,m.Bu)(e,32):(0,m.lE)(e);case"string":return(0,$e.Y0)(e);case"bytes":return(0,m.lE)(e);case"bool":return e=e?"0x01":"0x00",r?(0,m.Bu)(e,32):(0,m.lE)(e)}let n=t.match(Nd);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!=0||0===i||i>256)&&kd.throwArgumentError("invalid number type","type",t),r&&(i=256),e=p.O$.from(e).toTwos(i),(0,m.Bu)(e,i/8)}if(n=t.match(_d),n){const i=parseInt(n[1]);return(String(i)!==n[1]||0===i||i>32)&&kd.throwArgumentError("invalid bytes type","type",t),(0,m.lE)(e).byteLength!==i&&kd.throwArgumentError(`invalid value for ${t}`,"value",e),r?(0,m.lE)((e+Td).substring(0,66)):e}if(n=t.match(Sd),n&&Array.isArray(e)){const r=n[1];parseInt(n[2]||String(e.length))!=e.length&&kd.throwArgumentError(`invalid array length for ${t}`,"value",e);const i=[];return e.forEach((function(t){i.push(Rd(r,t,!0))})),(0,m.zo)(i)}return kd.throwArgumentError("invalid type","type",t)}function xd(t,e){t.length!=e.length&&kd.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach((function(t,n){r.push(Rd(t,e[n]))})),(0,m.Dv)((0,m.zo)(r))}function Od(t,e){return(0,Wt.w)(xd(t,e))}function Id(t,e){return(0,He.JQ)(xd(t,e))}let Cd=!1,Pd=!1;const Ld={debug:1,default:2,info:2,warning:3,error:4,off:5};let Ud=Ld.default,Bd=null;const Dd=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Fd,Gd;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Fd||(Fd={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Gd||(Gd={}));const jd="0123456789abcdef";class qd{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Ld[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Ud>Ld[r]||console.log.apply(console,e)}debug(...t){this._log(qd.levels.DEBUG,t)}info(...t){this._log(qd.levels.INFO,t)}warn(...t){this._log(qd.levels.WARNING,t)}makeError(t,e,r){if(Pd)return this.makeError("censored error",e,{});e||(e=qd.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=jd[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Gd.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Gd.CALL_EXCEPTION:case Gd.INSUFFICIENT_FUNDS:case Gd.MISSING_NEW:case Gd.NONCE_EXPIRED:case Gd.REPLACEMENT_UNDERPRICED:case Gd.TRANSACTION_REPLACED:case Gd.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,qd.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Dd&&this.throwError("platform missing String.prototype.normalize",qd.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Dd})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,qd.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,qd.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,qd.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",qd.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",qd.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",qd.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Bd||(Bd=new qd("logger/5.7.0")),Bd}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",qd.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Cd){if(!t)return;this.globalLogger().throwError("error censorship permanent",qd.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Pd=!!t,Cd=!!e}static setLogLevel(t){const e=Ld[t.toLowerCase()];null!=e?Ud=e:qd.globalLogger().warn("invalid log level - "+t)}static from(t){return new qd(t)}}qd.errors=Gd,qd.levels=Fd;const zd=new qd("bytes/5.7.0");function Kd(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Kd(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Hd(t){return"number"==typeof t&&t==t&&t%1==0}function $d(t,e){if(e||(e={}),"number"==typeof t){zd.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Kd(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":zd.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?Kd(new Uint8Array(t)):zd.throwArgumentError("invalid arrayify value","value",t)}const Vd=new qd("random/5.5.1"),Wd=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("unable to locate global object")}();let Yd=Wd.crypto||Wd.msCrypto;function Jd(t){(t<=0||t>1024||t%1||t!=t)&&Vd.throwArgumentError("invalid length","length",t);const e=new Uint8Array(t);return Yd.getRandomValues(e),$d(e)}function Xd(t){for(let e=(t=t.slice()).length-1;e>0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}Yd&&Yd.getRandomValues||(Vd.warn("WARNING: Missing strong random number source"),Yd={getRandomValues:function(t){return Vd.throwError("no secure random source avaialble",qd.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});let Zd=!1,Qd=!1;const tp={debug:1,default:2,info:2,warning:3,error:4,off:5};let ep=tp.default,rp=null;const np=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var ip,op;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(ip||(ip={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(op||(op={}));const sp="0123456789abcdef";class ap{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==tp[r]&&this.throwArgumentError("invalid log level name","logLevel",t),ep>tp[r]||console.log.apply(console,e)}debug(...t){this._log(ap.levels.DEBUG,t)}info(...t){this._log(ap.levels.INFO,t)}warn(...t){this._log(ap.levels.WARNING,t)}makeError(t,e,r){if(Qd)return this.makeError("censored error",e,{});e||(e=ap.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=sp[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case op.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case op.CALL_EXCEPTION:case op.INSUFFICIENT_FUNDS:case op.MISSING_NEW:case op.NONCE_EXPIRED:case op.REPLACEMENT_UNDERPRICED:case op.TRANSACTION_REPLACED:case op.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,ap.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),np&&this.throwError("platform missing String.prototype.normalize",ap.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:np})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,ap.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,ap.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,ap.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",ap.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",ap.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",ap.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return rp||(rp=new ap("logger/5.7.0")),rp}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",ap.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Zd){if(!t)return;this.globalLogger().throwError("error censorship permanent",ap.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Qd=!!t,Zd=!!e}static setLogLevel(t){const e=tp[t.toLowerCase()];null!=e?ep=e:ap.globalLogger().warn("invalid log level - "+t)}static from(t){return new ap(t)}}ap.errors=op,ap.levels=ip;var up=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const lp=new ap("properties/5.5.0");function hp(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function cp(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function fp(t){return up(this,void 0,void 0,(function*(){const e=Object.keys(t).map((e=>{const r=t[e];return Promise.resolve(r).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}))}function dp(t,e){t&&"object"==typeof t||lp.throwArgumentError("invalid object","object",t),Object.keys(t).forEach((r=>{e[r]||lp.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)}))}function pp(t){const e={};for(const r in t)e[r]=t[r];return e}const mp={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function gp(t){if(null==t||mp[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;ryp(t))));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&hp(e,r,yp(n))}return e}return lp.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function yp(t){return vp(t)}let bp=!1,wp=!1;const Ep={debug:1,default:2,info:2,warning:3,error:4,off:5};let Mp=Ep.default,Ap=null;const _p=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Np,Sp;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Np||(Np={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Sp||(Sp={}));const Tp="0123456789abcdef";class kp{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Ep[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Mp>Ep[r]||console.log.apply(console,e)}debug(...t){this._log(kp.levels.DEBUG,t)}info(...t){this._log(kp.levels.INFO,t)}warn(...t){this._log(kp.levels.WARNING,t)}makeError(t,e,r){if(wp)return this.makeError("censored error",e,{});e||(e=kp.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Tp[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Sp.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Sp.CALL_EXCEPTION:case Sp.INSUFFICIENT_FUNDS:case Sp.MISSING_NEW:case Sp.NONCE_EXPIRED:case Sp.REPLACEMENT_UNDERPRICED:case Sp.TRANSACTION_REPLACED:case Sp.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,kp.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),_p&&this.throwError("platform missing String.prototype.normalize",kp.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_p})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,kp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,kp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,kp.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",kp.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",kp.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",kp.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Ap||(Ap=new kp("logger/5.7.0")),Ap}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",kp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),bp){if(!t)return;this.globalLogger().throwError("error censorship permanent",kp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}wp=!!t,bp=!!e}static setLogLevel(t){const e=Ep[t.toLowerCase()];null!=e?Mp=e:kp.globalLogger().warn("invalid log level - "+t)}static from(t){return new kp(t)}}kp.errors=Sp,kp.levels=Np;const Rp=new kp("bytes/5.7.0");function xp(t){return!!t.toHexString}function Op(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Op(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Ip(t){return"number"==typeof t&&t==t&&t%1==0}function Cp(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Ip(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Pp(t,e){if(e||(e={}),"number"==typeof t){Rp.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Op(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),xp(t)&&(t=t.toHexString()),Lp(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Rp.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t>4]+Up[15&n]}return e}return Rp.throwArgumentError("invalid hexlify value","value",t)}const Dp=new kp("rlp/5.5.0");function Fp(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function Gp(t,e,r){let n=0;for(let i=0;ie+1+n&&Dp.throwError("child data too short",kp.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function Kp(t,e){if(0===t.length&&Dp.throwError("data too short",kp.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&Dp.throwError("data short segment too short",kp.errors.BUFFER_OVERRUN,{});const n=Gp(t,e+1,r);return e+1+r+n>t.length&&Dp.throwError("data long segment too short",kp.errors.BUFFER_OVERRUN,{}),zp(t,e,e+1+r,r+n)}if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&Dp.throwError("data array too short",kp.errors.BUFFER_OVERRUN,{}),zp(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&Dp.throwError("data array too short",kp.errors.BUFFER_OVERRUN,{});const n=Gp(t,e+1,r);return e+1+r+n>t.length&&Dp.throwError("data array too short",kp.errors.BUFFER_OVERRUN,{}),{consumed:1+r+n,result:Bp(t.slice(e+1+r,e+1+r+n))}}if(t[e]>=128){const r=t[e]-128;return e+1+r>t.length&&Dp.throwError("data too short",kp.errors.BUFFER_OVERRUN,{}),{consumed:1+r,result:Bp(t.slice(e+1,e+1+r))}}return{consumed:1,result:Bp(t[e])}}function Hp(t){const e=Pp(t),r=Kp(e,0);return r.consumed!==e.length&&Dp.throwArgumentError("invalid rlp data","data",t),r.result}function $p(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},t(r,r.exports),r.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self&&self;var Vp=Wp;function Wp(t,e){if(!t)throw new Error(e||"Assertion failed")}Wp.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Yp=$p((function(t,e){var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}})),Jp=$p((function(t,e){var r=e;r.assert=Vp,r.toArray=Yp.toArray,r.zero2=Yp.zero2,r.toHex=Yp.toHex,r.encode=Yp.encode,r.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,l=e.andln(3)+o&3;3===u&&(u=-1),3===l&&(l=-1),s=0==(1&u)?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==l?u:-u,r[0].push(s),a=0==(1&l)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==u?l:-l,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new(B())(t,"hex","le")}})),Xp=Jp.getNAF,Zp=Jp.getJSF,Qp=Jp.assert;function tm(t,e){this.type=t,this.p=new(B())(e.p,16),this.red=e.prime?B().red(e.prime):B().mont(this.p),this.zero=new(B())(0).toRed(this.red),this.one=new(B())(1).toRed(this.red),this.two=new(B())(2).toRed(this.red),this.n=e.n&&new(B())(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var em=tm;function rm(t,e){this.curve=t,this.type=e,this.precomputed=null}tm.prototype.point=function(){throw new Error("Not implemented")},tm.prototype.validate=function(){throw new Error("Not implemented")},tm.prototype._fixedNafMul=function(t,e){Qp(t.precomputed);var r=t._getDoubles(),n=Xp(e,1,this._bitLength),i=(1<=o;u--)s=(s<<1)+n[u];a.push(s)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),c=i;c>0;c--){for(o=0;o=0;a--){for(var u=0;a>=0&&0===o[a];a--)u++;if(a>=0&&u++,s=s.dblp(u),a<0)break;var l=o[a];Qp(0!==l),s="affine"===t.type?l>0?s.mixedAdd(i[l-1>>1]):s.mixedAdd(i[-l-1>>1].neg()):l>0?s.add(i[l-1>>1]):s.add(i[-l-1>>1].neg())}return"affine"===t.type?s.toP():s},tm.prototype._wnafMulAdd=function(t,e,r,n,i){var o,s,a,u=this._wnafT1,l=this._wnafT2,h=this._wnafT3,c=0;for(o=0;o=1;o-=2){var d=o-1,p=o;if(1===u[d]&&1===u[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=Zp(r[d],r[p]);for(c=Math.max(v[0].length,c),h[d]=new Array(c),h[p]=new Array(c),s=0;s=0;o--){for(var M=0;o>=0;){var A=!0;for(s=0;s=0&&M++,w=w.dblp(M),o<0)break;for(s=0;s0?a=l[s][_-1>>1]:_<0&&(a=l[s][-_-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},rm.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=e,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},om.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),l=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(l).neg()}},om.prototype.pointFromX=function(t,e){(t=new(B())(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},om.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},om.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},am.prototype.isInfinity=function(){return this.inf},am.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},am.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},am.prototype.getX=function(){return this.x.fromRed()},am.prototype.getY=function(){return this.y.fromRed()},am.prototype.mul=function(t){return t=new(B())(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},am.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},am.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},am.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},am.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},am.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},nm(um,em.BasePoint),om.prototype.jpoint=function(t,e,r){return new um(this,t,e,r)},um.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},um.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},um.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),h=l.redMul(a),c=n.redMul(l),f=u.redSqr().redIAdd(h).redISub(c).redISub(c),d=u.redMul(c.redISub(f)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(f,d,p)},um.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),h=r.redMul(u),c=a.redSqr().redIAdd(l).redISub(h).redISub(h),f=a.redMul(h.redISub(c)).redISub(i.redMul(l)),d=this.z.redMul(s);return this.curve.jpoint(c,f,d)},um.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},um.prototype.inspect=function(){return this.isInfinity()?"":""},um.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var lm=$p((function(t,e){var r=e;r.base=em,r.short=sm,r.mont=null,r.edwards=null})),hm=$p((function(t,e){var r,n=e,i=Jp.assert;function o(t){"short"===t.type?this.curve=new lm.short(t):"edwards"===t.type?this.curve=new lm.edwards(t):this.curve=new lm.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:zh().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:zh().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:zh().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:zh().sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:zh().sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zh().sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zh().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){r=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:zh().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function cm(t){if(!(this instanceof cm))return new cm(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Yp.toArray(t.entropy,t.entropyEnc||"hex"),r=Yp.toArray(t.nonce,t.nonceEnc||"hex"),n=Yp.toArray(t.pers,t.persEnc||"hex");Vp(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var fm=cm;cm.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},cm.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=Yp.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var gm=Jp.assert;function vm(t,e){if(t instanceof vm)return t;this._importDER(t,e)||(gm(t.r&&t.s,"Signature without r or s"),this.r=new(B())(t.r,16),this.s=new(B())(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var ym=vm;function bm(){this.place=0}function wm(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return!(i<=127)&&(e.place=s,i)}function Em(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}vm.prototype._importDER=function(t,e){t=Jp.toArray(t,e);var r=new bm;if(48!==t[r.place++])return!1;var n=wm(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var i=wm(t,r);if(!1===i)return!1;var o=t.slice(r.place,i+r.place);if(r.place+=i,2!==t[r.place++])return!1;var s=wm(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new(B())(o),this.s=new(B())(a),this.recoveryParam=null,!0},vm.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=Em(e),r=Em(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];Mm(n,e.length),(n=n.concat(e)).push(2),Mm(n,r.length);var i=n.concat(r),o=[48];return Mm(o,i.length),o=o.concat(i),Jp.encode(o,t)};var Am=function(){throw new Error("unsupported")},_m=Jp.assert;function Nm(t){if(!(this instanceof Nm))return new Nm(t);"string"==typeof t&&(_m(Object.prototype.hasOwnProperty.call(hm,t),"Unknown curve "+t),t=hm[t]),t instanceof hm.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Sm=Nm;Nm.prototype.keyPair=function(t){return new mm(this,t)},Nm.prototype.keyFromPrivate=function(t,e){return mm.fromPrivate(this,t,e)},Nm.prototype.keyFromPublic=function(t,e){return mm.fromPublic(this,t,e)},Nm.prototype.genKeyPair=function(t){t||(t={});for(var e=new fm({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||Am(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new(B())(2));;){var i=new(B())(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Nm.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Nm.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new(B())(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),s=t.toArray("be",i),a=new fm({hash:this.hash,entropy:o,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new(B())(1)),l=0;;l++){var h=n.k?n.k(l):new(B())(a.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(u)>=0)){var c=this.g.mul(h);if(!c.isInfinity()){var f=c.getX(),d=f.umod(this.n);if(0!==d.cmpn(0)){var p=h.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(c.getY().isOdd()?1:0)|(0!==f.cmp(d)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new ym({r:d,s:p,recoveryParam:m})}}}}}},Nm.prototype.verify=function(t,e,r,n){t=this._truncateToN(new(B())(t,16)),r=this.keyFromPublic(r,n);var i=(e=new ym(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,a=o.invm(this.n),u=a.mul(t).umod(this.n),l=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},Nm.prototype.recoverPubKey=function(t,e,r,n){_m((3&r)===r,"The recovery param is more than two bits"),e=new ym(e,n);var i=this.n,o=new(B())(t),s=e.r,a=e.s,u=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var h=e.r.invm(i),c=i.sub(o).mul(h).umod(i),f=a.mul(h).umod(i);return this.g.mulAdd(c,s,f)},Nm.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new ym(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Tm=$p((function(t,e){var r=e;r.version="6.5.4",r.utils=Jp,r.rand=function(){throw new Error("unsupported")},r.curve=lm,r.curves=hm,r.ec=Sm,r.eddsa=null})).ec;let km=!1,Rm=!1;const xm={debug:1,default:2,info:2,warning:3,error:4,off:5};let Om=xm.default,Im=null;const Cm=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Pm,Lm;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Pm||(Pm={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Lm||(Lm={}));const Um="0123456789abcdef";class Bm{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==xm[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Om>xm[r]||console.log.apply(console,e)}debug(...t){this._log(Bm.levels.DEBUG,t)}info(...t){this._log(Bm.levels.INFO,t)}warn(...t){this._log(Bm.levels.WARNING,t)}makeError(t,e,r){if(Rm)return this.makeError("censored error",e,{});e||(e=Bm.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Um[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Lm.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Lm.CALL_EXCEPTION:case Lm.INSUFFICIENT_FUNDS:case Lm.MISSING_NEW:case Lm.NONCE_EXPIRED:case Lm.REPLACEMENT_UNDERPRICED:case Lm.TRANSACTION_REPLACED:case Lm.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Bm.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Cm&&this.throwError("platform missing String.prototype.normalize",Bm.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Cm})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Bm.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Bm.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,Bm.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Bm.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Bm.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Bm.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Im||(Im=new Bm("logger/5.7.0")),Im}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Bm.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),km){if(!t)return;this.globalLogger().throwError("error censorship permanent",Bm.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Rm=!!t,km=!!e}static setLogLevel(t){const e=xm[t.toLowerCase()];null!=e?Om=e:Bm.globalLogger().warn("invalid log level - "+t)}static from(t){return new Bm(t)}}Bm.errors=Lm,Bm.levels=Pm;const Dm=new Bm("bytes/5.7.0");function Fm(t){return!!t.toHexString}function Gm(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Gm(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function jm(t){return"number"==typeof t&&t==t&&t%1==0}function qm(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!jm(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function zm(t,e){if(e||(e={}),"number"==typeof t){Dm.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Gm(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Fm(t)&&(t=t.toHexString()),Km(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Dm.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t>4]+Hm[15&n]}return e}return Dm.throwArgumentError("invalid hexlify value","value",t)}function Vm(t,e){for("string"!=typeof t?t=$m(t):Km(t)||Dm.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Dm.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Wm(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Km(r=t)&&!(r.length%2)||qm(r)){let r=zm(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=$m(r.slice(0,32)),e.s=$m(r.slice(32,64))):65===r.length?(e.r=$m(r.slice(0,32)),e.s=$m(r.slice(32,64)),e.v=r[64]):Dm.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:Dm.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=$m(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=zm(t)).length>e&&Dm.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Gm(r)}(zm(e._vs),32);e._vs=$m(r);const n=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=n:e.recoveryParam!==n&&Dm.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const i=$m(r);null==e.s?e.s=i:e.s!==i&&Dm.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?Dm.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&Dm.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&Km(e.r)?e.r=Vm(e.r,32):Dm.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&Km(e.s)?e.s=Vm(e.s,32):Dm.throwArgumentError("signature missing or invalid s","signature",t);const r=zm(e.s);r[0]>=128&&Dm.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=$m(r);e._vs&&(Km(e._vs)||Dm.throwArgumentError("signature invalid _vs","signature",t),e._vs=Vm(e._vs,32)),null==e._vs?e._vs=n:e._vs!==n&&Dm.throwArgumentError("signature _vs mismatch v and s","signature",t)}var r;return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Ym(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new Bm("properties/5.7.0");const Jm=new Bm("signing-key/5.5.0");let Xm=null;function Zm(){return Xm||(Xm=new Tm("secp256k1")),Xm}class Qm{constructor(t){Ym(this,"curve","secp256k1"),Ym(this,"privateKey",$m(t));const e=Zm().keyFromPrivate(zm(this.privateKey));Ym(this,"publicKey","0x"+e.getPublic(!1,"hex")),Ym(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Ym(this,"_isSigningKey",!0)}_addPoint(t){const e=Zm().keyFromPublic(zm(this.publicKey)),r=Zm().keyFromPublic(zm(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=Zm().keyFromPrivate(zm(this.privateKey)),r=zm(t);32!==r.length&&Jm.throwArgumentError("bad digest length","digest",t);const n=e.sign(r,{canonical:!0});return Wm({recoveryParam:n.recoveryParam,r:Vm("0x"+n.r.toString(16),32),s:Vm("0x"+n.s.toString(16),32)})}computeSharedSecret(t){const e=Zm().keyFromPrivate(zm(this.privateKey)),r=Zm().keyFromPublic(zm(eg(t)));return Vm("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function tg(t,e){const r=Wm(e),n={r:zm(r.r),s:zm(r.s)};return"0x"+Zm().recoverPubKey(zm(t),n,r.recoveryParam).encode("hex",!1)}function eg(t,e){const r=zm(t);if(32===r.length){const t=new Qm(r);return e?"0x"+Zm().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?$m(r):"0x"+Zm().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+Zm().keyFromPublic(r).getPublic(!0,"hex"):$m(r):Jm.throwArgumentError("invalid public or private key","key","[REDACTED]")}let rg=!1,ng=!1;const ig={debug:1,default:2,info:2,warning:3,error:4,off:5};let og=ig.default,sg=null;const ag=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var ug,lg;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(ug||(ug={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(lg||(lg={}));const hg="0123456789abcdef";class cg{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==ig[r]&&this.throwArgumentError("invalid log level name","logLevel",t),og>ig[r]||console.log.apply(console,e)}debug(...t){this._log(cg.levels.DEBUG,t)}info(...t){this._log(cg.levels.INFO,t)}warn(...t){this._log(cg.levels.WARNING,t)}makeError(t,e,r){if(ng)return this.makeError("censored error",e,{});e||(e=cg.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=hg[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case lg.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case lg.CALL_EXCEPTION:case lg.INSUFFICIENT_FUNDS:case lg.MISSING_NEW:case lg.NONCE_EXPIRED:case lg.REPLACEMENT_UNDERPRICED:case lg.TRANSACTION_REPLACED:case lg.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,cg.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),ag&&this.throwError("platform missing String.prototype.normalize",cg.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ag})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,cg.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,cg.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,cg.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",cg.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",cg.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",cg.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return sg||(sg=new cg("logger/5.7.0")),sg}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",cg.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),rg){if(!t)return;this.globalLogger().throwError("error censorship permanent",cg.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ng=!!t,rg=!!e}static setLogLevel(t){const e=ig[t.toLowerCase()];null!=e?og=e:cg.globalLogger().warn("invalid log level - "+t)}static from(t){return new cg(t)}}cg.errors=lg,cg.levels=ug;const fg=new cg("bytes/5.7.0");function dg(t){return!!t.toHexString}function pg(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return pg(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function mg(t){return"number"==typeof t&&t==t&&t%1==0}function gg(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!mg(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function vg(t,e){if(e||(e={}),"number"==typeof t){fg.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),pg(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),dg(t)&&(t=t.toHexString()),yg(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":fg.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t>6==2;n++)t++;return t}return t===Mg.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Eg||(Eg={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Mg||(Mg={}));const _g=Object.freeze({error:function(t,e,r,n,i){return wg.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:Ag,replace:function(t,e,r,n,i){return t===Mg.OVERLONG?(n.push(i),0):(n.push(65533),Ag(t,e,r))}});function Ng(t,e){null==e&&(e=_g.error),t=vg(t);const r=[];let n=0;for(;n>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?Mg.UNEXPECTED_CONTINUE:Mg.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e(Mg.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i1114111?n+=e(Mg.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e(Mg.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e(Mg.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}function Sg(t,e=Eg.current){e!=Eg.current&&(wg.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return vg(r)}function Tg(t){const e="0000"+t.toString(16);return"\\u"+e.substring(e.length-4)}function kg(t,e){return'"'+Ng(t,e).map((t=>{if(t<256){switch(t){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(t>=32&&t<127)return String.fromCharCode(t)}return t<=65535?Tg(t):Tg(55296+((t-=65536)>>10&1023))+Tg(56320+(1023&t))})).join("")+'"'}function Rg(t){return t.map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function xg(t,e){return Rg(Ng(t,e))}function Og(t,e=Eg.current){return Ng(Sg(t,e))}function Ig(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,n={};return t.split(",").forEach((t=>{let i=t.split(":");r+=parseInt(i[0],16),n[r]=e(i[1])})),n}function Cg(t){let e=0;return t.split(",").map((t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:n,h:e}}))}function Pg(t,e){let r=0;for(let n=0;n=r&&t<=r+i.h&&(t-r)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(t-r))continue;return i}}return null}const Lg=Cg("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),Ug="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((t=>parseInt(t,16))),Bg=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],Dg=Ig("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Fg=Ig("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Gg=Ig("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r{if(Ug.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=Pg(t,Bg);if(e)return[t+e.s];let r=Dg[t];if(r)return r;let n=Fg[t];return n?[t+n[0]]:Gg[t]||null}(t);return e||[t]})),e=r.reduce(((t,e)=>(e.forEach((e=>{t.push(e)})),t)),[]),e=Og(Rg(e),Eg.NFKC),e.forEach((t=>{if(Pg(t,jg))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),e.forEach((t=>{if(Pg(t,Lg))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=Rg(e);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");if(n.length>63)throw new Error("too long");return n}const zg="0x0000000000000000000000000000000000000000000000000000000000000000";function Kg(t){const e=Sg(t);if(e.length>31)throw new Error("bytes32 string must be less than 32 bytes");return function(t,e){if(e||(e={}),"number"==typeof t){fg.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=bg[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),dg(t))return t.toHexString();if(yg(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":fg.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(gg(t)){let e="0x";for(let r=0;r>4]+bg[15&n]}return e}return fg.throwArgumentError("invalid hexlify value","value",t)}(function(t){const e=t.map((t=>vg(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),pg(n)}([e,zg]).slice(0,32))}function Hg(t){const e=vg(t);if(32!==e.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==e[31])throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;0===e[r-1];)r--;return xg(e.slice(0,r))}let $g=!1,Vg=!1;const Wg={debug:1,default:2,info:2,warning:3,error:4,off:5};let Yg=Wg.default,Jg=null;const Xg=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Zg,Qg;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Zg||(Zg={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Qg||(Qg={}));const tv="0123456789abcdef";class ev{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Wg[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Yg>Wg[r]||console.log.apply(console,e)}debug(...t){this._log(ev.levels.DEBUG,t)}info(...t){this._log(ev.levels.INFO,t)}warn(...t){this._log(ev.levels.WARNING,t)}makeError(t,e,r){if(Vg)return this.makeError("censored error",e,{});e||(e=ev.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=tv[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Qg.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Qg.CALL_EXCEPTION:case Qg.INSUFFICIENT_FUNDS:case Qg.MISSING_NEW:case Qg.NONCE_EXPIRED:case Qg.REPLACEMENT_UNDERPRICED:case Qg.TRANSACTION_REPLACED:case Qg.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,ev.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Xg&&this.throwError("platform missing String.prototype.normalize",ev.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Xg})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,ev.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,ev.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,ev.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",ev.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",ev.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",ev.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Jg||(Jg=new ev("logger/5.7.0")),Jg}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",ev.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),$g){if(!t)return;this.globalLogger().throwError("error censorship permanent",ev.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Vg=!!t,$g=!!e}static setLogLevel(t){const e=Wg[t.toLowerCase()];null!=e?Yg=e:ev.globalLogger().warn("invalid log level - "+t)}static from(t){return new ev(t)}}ev.errors=Qg,ev.levels=Zg;const rv=new ev("bytes/5.7.0");function nv(t){return!!t.toHexString}function iv(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return iv(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function ov(t){return hv(t)&&!(t.length%2)||av(t)}function sv(t){return"number"==typeof t&&t==t&&t%1==0}function av(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!sv(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function uv(t,e){if(e||(e={}),"number"==typeof t){rv.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),iv(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),nv(t)&&(t=t.toHexString()),hv(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":rv.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t>4]+cv[15&n]}return e}return rv.throwArgumentError("invalid hexlify value","value",t)}function dv(t){if("string"!=typeof t)t=fv(t);else if(!hv(t)||t.length%2)return null;return(t.length-2)/2}function pv(t,e,r){return"string"!=typeof t?t=fv(t):(!hv(t)||t.length%2)&&rv.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function mv(t){let e="0x";return t.forEach((t=>{e+=fv(t).substring(2)})),e}function gv(t,e){for("string"!=typeof t?t=fv(t):hv(t)||rv.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&rv.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function vv(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(ov(t)){let r=uv(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=fv(r.slice(0,32)),e.s=fv(r.slice(32,64))):65===r.length?(e.r=fv(r.slice(0,32)),e.s=fv(r.slice(32,64)),e.v=r[64]):rv.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:rv.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=fv(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=uv(t)).length>e&&rv.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),iv(r)}(uv(e._vs),32);e._vs=fv(r);const n=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=n:e.recoveryParam!==n&&rv.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const i=fv(r);null==e.s?e.s=i:e.s!==i&&rv.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?rv.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&rv.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&hv(e.r)?e.r=gv(e.r,32):rv.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&hv(e.s)?e.s=gv(e.s,32):rv.throwArgumentError("signature missing or invalid s","signature",t);const r=uv(e.s);r[0]>=128&&rv.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=fv(r);e._vs&&(hv(e._vs)||rv.throwArgumentError("signature invalid _vs","signature",t),e._vs=gv(e._vs,32)),null==e._vs?e._vs=n:e._vs!==n&&rv.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}var yv=r(4336),bv=r.n(yv),wv=bv().BN;const Ev=new ev("bignumber/5.7.0"),Mv={};let Av=!1;class _v{constructor(t,e){t!==Mv&&Ev.throwError("cannot call constructor directly; use BigNumber.from",ev.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Sv(Tv(this).fromTwos(t))}toTwos(t){return Sv(Tv(this).toTwos(t))}abs(){return"-"===this._hex[0]?_v.from(this._hex.substring(1)):this}add(t){return Sv(Tv(this).add(Tv(t)))}sub(t){return Sv(Tv(this).sub(Tv(t)))}div(t){return _v.from(t).isZero()&&kv("division-by-zero","div"),Sv(Tv(this).div(Tv(t)))}mul(t){return Sv(Tv(this).mul(Tv(t)))}mod(t){const e=Tv(t);return e.isNeg()&&kv("division-by-zero","mod"),Sv(Tv(this).umod(e))}pow(t){const e=Tv(t);return e.isNeg()&&kv("negative-power","pow"),Sv(Tv(this).pow(e))}and(t){const e=Tv(t);return(this.isNegative()||e.isNeg())&&kv("unbound-bitwise-result","and"),Sv(Tv(this).and(e))}or(t){const e=Tv(t);return(this.isNegative()||e.isNeg())&&kv("unbound-bitwise-result","or"),Sv(Tv(this).or(e))}xor(t){const e=Tv(t);return(this.isNegative()||e.isNeg())&&kv("unbound-bitwise-result","xor"),Sv(Tv(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&kv("negative-width","mask"),Sv(Tv(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&kv("negative-width","shl"),Sv(Tv(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&kv("negative-width","shr"),Sv(Tv(this).shrn(t))}eq(t){return Tv(this).eq(Tv(t))}lt(t){return Tv(this).lt(Tv(t))}lte(t){return Tv(this).lte(Tv(t))}gt(t){return Tv(this).gt(Tv(t))}gte(t){return Tv(this).gte(Tv(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Tv(this).isZero()}toNumber(){try{return Tv(this).toNumber()}catch(t){kv("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Ev.throwError("this platform does not support BigInt",ev.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Av||(Av=!0,Ev.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ev.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ev.errors.UNEXPECTED_ARGUMENT,{}):Ev.throwError("BigNumber.toString does not accept parameters",ev.errors.UNEXPECTED_ARGUMENT,{})),Tv(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof _v)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new _v(Mv,Nv(t)):t.match(/^-?[0-9]+$/)?new _v(Mv,Nv(new wv(t))):Ev.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&kv("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&kv("overflow","BigNumber.from",t),_v.from(String(t));const e=t;if("bigint"==typeof e)return _v.from(e.toString());if(av(e))return _v.from(fv(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return _v.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(hv(t)||"-"===t[0]&&hv(t.substring(1))))return _v.from(t)}return Ev.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Nv(t){if("string"!=typeof t)return Nv(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Ev.throwArgumentError("invalid hex","value",t),"0x00"===(t=Nv(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Sv(t){return _v.from(Nv(t))}function Tv(t){const e=_v.from(t).toHexString();return"-"===e[0]?new wv("-"+e.substring(3),16):new wv(e.substring(2),16)}function kv(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),Ev.throwError(t,ev.errors.NUMERIC_FAULT,n)}function Rv(t){return"0x"+Gn().keccak_256(uv(t))}const xv=new ev("address/5.7.0");function Ov(t){hv(t,20)||xv.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=uv(Rv(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Iv={};for(let t=0;t<10;t++)Iv[String(t)]=String(t);for(let t=0;t<26;t++)Iv[String.fromCharCode(65+t)]=String(10+t);const Cv=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Pv(t){let e=null;if("string"!=typeof t&&xv.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Ov(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&xv.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Iv[t])).join("");for(;e.length>=Cv;){let t=e.substring(0,Cv);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&xv.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new wv(r,36).toString(16);e.length<40;)e="0"+e;e=Ov("0x"+e)}else xv.throwArgumentError("invalid address","address",t);var r;return e}const Lv=_v.from(0),Uv=new ev("properties/5.7.0");function Bv(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}const Dv=new ev("rlp/5.7.0");function Fv(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function Gv(t,e,r){let n=0;for(let i=0;ie+1+n&&Dv.throwError("child data too short",ev.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function Kv(t,e){if(0===t.length&&Dv.throwError("data too short",ev.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&Dv.throwError("data short segment too short",ev.errors.BUFFER_OVERRUN,{});const n=Gv(t,e+1,r);return e+1+r+n>t.length&&Dv.throwError("data long segment too short",ev.errors.BUFFER_OVERRUN,{}),zv(t,e,e+1+r,r+n)}if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&Dv.throwError("data array too short",ev.errors.BUFFER_OVERRUN,{}),zv(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&Dv.throwError("data array too short",ev.errors.BUFFER_OVERRUN,{});const n=Gv(t,e+1,r);return e+1+r+n>t.length&&Dv.throwError("data array too short",ev.errors.BUFFER_OVERRUN,{}),{consumed:1+r+n,result:fv(t.slice(e+1+r,e+1+r+n))}}if(t[e]>=128){const r=t[e]-128;return e+1+r>t.length&&Dv.throwError("data too short",ev.errors.BUFFER_OVERRUN,{}),{consumed:1+r,result:fv(t.slice(e+1,e+1+r))}}return{consumed:1,result:fv(t[e])}}function Hv(t){const e=uv(t),r=Kv(e,0);return r.consumed!==e.length&&Dv.throwArgumentError("invalid rlp data","data",t),r.result}function $v(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},t(r,r.exports),r.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self&&self;var Vv=Wv;function Wv(t,e){if(!t)throw new Error(e||"Assertion failed")}Wv.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Yv=$v((function(t,e){var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}})),Jv=$v((function(t,e){var r=e;r.assert=Vv,r.toArray=Yv.toArray,r.zero2=Yv.zero2,r.toHex=Yv.toHex,r.encode=Yv.encode,r.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,l=e.andln(3)+o&3;3===u&&(u=-1),3===l&&(l=-1),s=0==(1&u)?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==l?u:-u,r[0].push(s),a=0==(1&l)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==u?l:-l,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new(bv())(t,"hex","le")}})),Xv=Jv.getNAF,Zv=Jv.getJSF,Qv=Jv.assert;function ty(t,e){this.type=t,this.p=new(bv())(e.p,16),this.red=e.prime?bv().red(e.prime):bv().mont(this.p),this.zero=new(bv())(0).toRed(this.red),this.one=new(bv())(1).toRed(this.red),this.two=new(bv())(2).toRed(this.red),this.n=e.n&&new(bv())(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var ey=ty;function ry(t,e){this.curve=t,this.type=e,this.precomputed=null}ty.prototype.point=function(){throw new Error("Not implemented")},ty.prototype.validate=function(){throw new Error("Not implemented")},ty.prototype._fixedNafMul=function(t,e){Qv(t.precomputed);var r=t._getDoubles(),n=Xv(e,1,this._bitLength),i=(1<=o;u--)s=(s<<1)+n[u];a.push(s)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),c=i;c>0;c--){for(o=0;o=0;a--){for(var u=0;a>=0&&0===o[a];a--)u++;if(a>=0&&u++,s=s.dblp(u),a<0)break;var l=o[a];Qv(0!==l),s="affine"===t.type?l>0?s.mixedAdd(i[l-1>>1]):s.mixedAdd(i[-l-1>>1].neg()):l>0?s.add(i[l-1>>1]):s.add(i[-l-1>>1].neg())}return"affine"===t.type?s.toP():s},ty.prototype._wnafMulAdd=function(t,e,r,n,i){var o,s,a,u=this._wnafT1,l=this._wnafT2,h=this._wnafT3,c=0;for(o=0;o=1;o-=2){var d=o-1,p=o;if(1===u[d]&&1===u[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=Zv(r[d],r[p]);for(c=Math.max(v[0].length,c),h[d]=new Array(c),h[p]=new Array(c),s=0;s=0;o--){for(var M=0;o>=0;){var A=!0;for(s=0;s=0&&M++,w=w.dblp(M),o<0)break;for(s=0;s0?a=l[s][_-1>>1]:_<0&&(a=l[s][-_-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},ry.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=e,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},oy.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),l=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(l).neg()}},oy.prototype.pointFromX=function(t,e){(t=new(bv())(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},oy.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},oy.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},ay.prototype.isInfinity=function(){return this.inf},ay.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},ay.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},ay.prototype.getX=function(){return this.x.fromRed()},ay.prototype.getY=function(){return this.y.fromRed()},ay.prototype.mul=function(t){return t=new(bv())(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},ay.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},ay.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},ay.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},ay.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},ay.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},ny(uy,ey.BasePoint),oy.prototype.jpoint=function(t,e,r){return new uy(this,t,e,r)},uy.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},uy.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},uy.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),h=l.redMul(a),c=n.redMul(l),f=u.redSqr().redIAdd(h).redISub(c).redISub(c),d=u.redMul(c.redISub(f)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(f,d,p)},uy.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),h=r.redMul(u),c=a.redSqr().redIAdd(l).redISub(h).redISub(h),f=a.redMul(h.redISub(c)).redISub(i.redMul(l)),d=this.z.redMul(s);return this.curve.jpoint(c,f,d)},uy.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},uy.prototype.inspect=function(){return this.isInfinity()?"":""},uy.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var ly=$v((function(t,e){var r=e;r.base=ey,r.short=sy,r.mont=null,r.edwards=null})),hy=$v((function(t,e){var r,n=e,i=Jv.assert;function o(t){"short"===t.type?this.curve=new ly.short(t):"edwards"===t.type?this.curve=new ly.edwards(t):this.curve=new ly.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:zh().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:zh().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:zh().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:zh().sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:zh().sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zh().sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zh().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){r=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:zh().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function cy(t){if(!(this instanceof cy))return new cy(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Yv.toArray(t.entropy,t.entropyEnc||"hex"),r=Yv.toArray(t.nonce,t.nonceEnc||"hex"),n=Yv.toArray(t.pers,t.persEnc||"hex");Vv(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var fy=cy;cy.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},cy.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=Yv.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var gy=Jv.assert;function vy(t,e){if(t instanceof vy)return t;this._importDER(t,e)||(gy(t.r&&t.s,"Signature without r or s"),this.r=new(bv())(t.r,16),this.s=new(bv())(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var yy=vy;function by(){this.place=0}function wy(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return!(i<=127)&&(e.place=s,i)}function Ey(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}vy.prototype._importDER=function(t,e){t=Jv.toArray(t,e);var r=new by;if(48!==t[r.place++])return!1;var n=wy(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var i=wy(t,r);if(!1===i)return!1;var o=t.slice(r.place,i+r.place);if(r.place+=i,2!==t[r.place++])return!1;var s=wy(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new(bv())(o),this.s=new(bv())(a),this.recoveryParam=null,!0},vy.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=Ey(e),r=Ey(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];My(n,e.length),(n=n.concat(e)).push(2),My(n,r.length);var i=n.concat(r),o=[48];return My(o,i.length),o=o.concat(i),Jv.encode(o,t)};var Ay=function(){throw new Error("unsupported")},_y=Jv.assert;function Ny(t){if(!(this instanceof Ny))return new Ny(t);"string"==typeof t&&(_y(Object.prototype.hasOwnProperty.call(hy,t),"Unknown curve "+t),t=hy[t]),t instanceof hy.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Sy=Ny;Ny.prototype.keyPair=function(t){return new my(this,t)},Ny.prototype.keyFromPrivate=function(t,e){return my.fromPrivate(this,t,e)},Ny.prototype.keyFromPublic=function(t,e){return my.fromPublic(this,t,e)},Ny.prototype.genKeyPair=function(t){t||(t={});for(var e=new fy({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||Ay(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new(bv())(2));;){var i=new(bv())(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Ny.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Ny.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new(bv())(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),s=t.toArray("be",i),a=new fy({hash:this.hash,entropy:o,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new(bv())(1)),l=0;;l++){var h=n.k?n.k(l):new(bv())(a.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(u)>=0)){var c=this.g.mul(h);if(!c.isInfinity()){var f=c.getX(),d=f.umod(this.n);if(0!==d.cmpn(0)){var p=h.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(c.getY().isOdd()?1:0)|(0!==f.cmp(d)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new yy({r:d,s:p,recoveryParam:m})}}}}}},Ny.prototype.verify=function(t,e,r,n){t=this._truncateToN(new(bv())(t,16)),r=this.keyFromPublic(r,n);var i=(e=new yy(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,a=o.invm(this.n),u=a.mul(t).umod(this.n),l=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},Ny.prototype.recoverPubKey=function(t,e,r,n){_y((3&r)===r,"The recovery param is more than two bits"),e=new yy(e,n);var i=this.n,o=new(bv())(t),s=e.r,a=e.s,u=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var h=e.r.invm(i),c=i.sub(o).mul(h).umod(i),f=a.mul(h).umod(i);return this.g.mulAdd(c,s,f)},Ny.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new yy(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Ty=$v((function(t,e){var r=e;r.version="6.5.4",r.utils=Jv,r.rand=function(){throw new Error("unsupported")},r.curve=ly,r.curves=hy,r.ec=Sy,r.eddsa=null})).ec;const ky=new ev("signing-key/5.7.0");let Ry=null;function xy(){return Ry||(Ry=new Ty("secp256k1")),Ry}class Oy{constructor(t){Bv(this,"curve","secp256k1"),Bv(this,"privateKey",fv(t)),32!==dv(this.privateKey)&&ky.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=xy().keyFromPrivate(uv(this.privateKey));Bv(this,"publicKey","0x"+e.getPublic(!1,"hex")),Bv(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Bv(this,"_isSigningKey",!0)}_addPoint(t){const e=xy().keyFromPublic(uv(this.publicKey)),r=xy().keyFromPublic(uv(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=xy().keyFromPrivate(uv(this.privateKey)),r=uv(t);32!==r.length&&ky.throwArgumentError("bad digest length","digest",t);const n=e.sign(r,{canonical:!0});return vv({recoveryParam:n.recoveryParam,r:gv("0x"+n.r.toString(16),32),s:gv("0x"+n.s.toString(16),32)})}computeSharedSecret(t){const e=xy().keyFromPrivate(uv(this.privateKey)),r=xy().keyFromPublic(uv(Iy(t)));return gv("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function Iy(t,e){const r=uv(t);if(32===r.length){const t=new Oy(r);return e?"0x"+xy().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?fv(r):"0x"+xy().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+xy().keyFromPublic(r).getPublic(!0,"hex"):fv(r):ky.throwArgumentError("invalid public or private key","key","[REDACTED]")}const Cy=new ev("transactions/5.5.0");var Py;function Ly(t){return"0x"===t?null:Pv(t)}function Uy(t){return"0x"===t?Lv:_v.from(t)}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(Py||(Py={}));const By=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],Dy={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function Fy(t){return Pv(pv(Rv(pv(Iy(t),1)),12))}function Gy(t,e){return Fy(function(t,e){const r=vv(e),n={r:uv(r.r),s:uv(r.s)};return"0x"+xy().recoverPubKey(uv(t),n,r.recoveryParam).encode("hex",!1)}(uv(t),e))}function jy(t,e){const r=lv(_v.from(t).toHexString());return r.length>32&&Cy.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function qy(t,e){return{address:Pv(t),storageKeys:(e||[]).map(((e,r)=>(32!==dv(e)&&Cy.throwArgumentError("invalid access list storageKey",`accessList[${t}:${r}]`,e),e.toLowerCase())))}}function zy(t){if(Array.isArray(t))return t.map(((t,e)=>Array.isArray(t)?(t.length>2&&Cy.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),qy(t[0],t[1])):qy(t.address,t.storageKeys)));const e=Object.keys(t).map((e=>{const r=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return qy(e,Object.keys(r).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function Ky(t){return zy(t).map((t=>[t.address,t.storageKeys]))}function Hy(t,e){if(null!=t.gasPrice){const e=_v.from(t.gasPrice),r=_v.from(t.maxFeePerGas||0);e.eq(r)||Cy.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:r})}const r=[jy(t.chainId||0,"chainId"),jy(t.nonce||0,"nonce"),jy(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),jy(t.maxFeePerGas||0,"maxFeePerGas"),jy(t.gasLimit||0,"gasLimit"),null!=t.to?Pv(t.to):"0x",jy(t.value||0,"value"),t.data||"0x",Ky(t.accessList||[])];if(e){const t=vv(e);r.push(jy(t.recoveryParam,"recoveryParam")),r.push(lv(t.r)),r.push(lv(t.s))}return mv(["0x02",qv(r)])}function $y(t,e){const r=[jy(t.chainId||0,"chainId"),jy(t.nonce||0,"nonce"),jy(t.gasPrice||0,"gasPrice"),jy(t.gasLimit||0,"gasLimit"),null!=t.to?Pv(t.to):"0x",jy(t.value||0,"value"),t.data||"0x",Ky(t.accessList||[])];if(e){const t=vv(e);r.push(jy(t.recoveryParam,"recoveryParam")),r.push(lv(t.r)),r.push(lv(t.s))}return mv(["0x01",qv(r)])}function Vy(t,e){if(null==t.type||0===t.type)return null!=t.accessList&&Cy.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",t),function(t,e){var r,n;n=Dy,(r=t)&&"object"==typeof r||Uv.throwArgumentError("invalid object","object",r),Object.keys(r).forEach((t=>{n[t]||Uv.throwArgumentError("invalid object key - "+t,"transaction:"+t,r)}));const i=[];By.forEach((function(e){let r=t[e.name]||[];const n={};e.numeric&&(n.hexPad="left"),r=uv(fv(r,n)),e.length&&r.length!==e.length&&r.length>0&&Cy.throwArgumentError("invalid length for "+e.name,"transaction:"+e.name,r),e.maxLength&&(r=lv(r),r.length>e.maxLength&&Cy.throwArgumentError("invalid length for "+e.name,"transaction:"+e.name,r)),i.push(fv(r))}));let o=0;if(null!=t.chainId?(o=t.chainId,"number"!=typeof o&&Cy.throwArgumentError("invalid transaction.chainId","transaction",t)):e&&!ov(e)&&e.v>28&&(o=Math.floor((e.v-35)/2)),0!==o&&(i.push(fv(o)),i.push("0x"),i.push("0x")),!e)return qv(i);const s=vv(e);let a=27+s.recoveryParam;return 0!==o?(i.pop(),i.pop(),i.pop(),a+=2*o+8,s.v>28&&s.v!==a&&Cy.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e)):s.v!==a&&Cy.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e),i.push(fv(a)),i.push(lv(uv(s.r))),i.push(lv(uv(s.s))),qv(i)}(t,e);switch(t.type){case 1:return $y(t,e);case 2:return Hy(t,e)}return Cy.throwError(`unsupported transaction type: ${t.type}`,ev.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:t.type})}function Wy(t,e,r){try{const r=Uy(e[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");t.v=r}catch(t){Cy.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=gv(e[1],32),t.s=gv(e[2],32);try{const e=Rv(r(t));t.from=Gy(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){console.log(t)}}function Yy(t){const e=uv(t);if(e[0]>127)return function(t){const e=Hv(t);9!==e.length&&6!==e.length&&Cy.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:Uy(e[0]).toNumber(),gasPrice:Uy(e[1]),gasLimit:Uy(e[2]),to:Ly(e[3]),value:Uy(e[4]),data:e[5],chainId:0};if(6===e.length)return r;try{r.v=_v.from(e[6]).toNumber()}catch(t){return console.log(t),r}if(r.r=gv(e[7],32),r.s=gv(e[8],32),_v.from(r.r).isZero()&&_v.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);0!==r.chainId&&(i.push(fv(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const o=Rv(qv(i));try{r.from=Gy(o,{r:fv(r.r),s:fv(r.s),recoveryParam:n})}catch(t){console.log(t)}r.hash=Rv(t)}return r.type=null,r}(e);switch(e[0]){case 1:return function(t){const e=Hv(t.slice(1));8!==e.length&&11!==e.length&&Cy.throwArgumentError("invalid component count for transaction type: 1","payload",fv(t));const r={type:1,chainId:Uy(e[0]).toNumber(),nonce:Uy(e[1]).toNumber(),gasPrice:Uy(e[2]),gasLimit:Uy(e[3]),to:Ly(e[4]),value:Uy(e[5]),data:e[6],accessList:zy(e[7])};return 8===e.length||(r.hash=Rv(t),Wy(r,e.slice(8),$y)),r}(e);case 2:return function(t){const e=Hv(t.slice(1));9!==e.length&&12!==e.length&&Cy.throwArgumentError("invalid component count for transaction type: 2","payload",fv(t));const r=Uy(e[2]),n=Uy(e[3]),i={type:2,chainId:Uy(e[0]).toNumber(),nonce:Uy(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:Uy(e[4]),to:Ly(e[5]),value:Uy(e[6]),data:e[7],accessList:zy(e[8])};return 9===e.length||(i.hash=Rv(t),Wy(i,e.slice(9),Hy)),i}(e)}return Cy.throwError(`unsupported transaction type: ${e[0]}`,ev.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}var Jy=r(335);const Xy=new y.Yd("units/5.5.0"),Zy=["wei","kwei","mwei","gwei","szabo","finney","ether"];function Qy(t){const e=String(t).split(".");(e.length>2||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||"."===t||"-."===t)&&Xy.throwArgumentError("invalid value","value",t);let r=e[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0");let i="";for(2===e.length&&(i="."+(e[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);const o=[];for(;r.length;){if(r.length<=3){o.unshift(r);break}{const t=r.length-3;o.unshift(r.substring(t)),r=r.substring(0,t)}}return n+o.join(",")+i}function tb(t,e){if("string"==typeof e){const t=Zy.indexOf(e);-1!==t&&(e=3*t)}return(0,Jy.S5)(t,null!=e?e:18)}function eb(t,e){if("string"!=typeof t&&Xy.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=Zy.indexOf(e);-1!==t&&(e=3*t)}return(0,Jy.Ox)(t,null!=e?e:18)}function rb(t){return tb(t,18)}function nb(t){return eb(t,18)}let ib=!1,ob=!1;const sb={debug:1,default:2,info:2,warning:3,error:4,off:5};let ab=sb.default,ub=null;const lb=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var hb,cb;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(hb||(hb={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(cb||(cb={}));const fb="0123456789abcdef";class db{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==sb[r]&&this.throwArgumentError("invalid log level name","logLevel",t),ab>sb[r]||console.log.apply(console,e)}debug(...t){this._log(db.levels.DEBUG,t)}info(...t){this._log(db.levels.INFO,t)}warn(...t){this._log(db.levels.WARNING,t)}makeError(t,e,r){if(ob)return this.makeError("censored error",e,{});e||(e=db.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=fb[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case cb.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case cb.CALL_EXCEPTION:case cb.INSUFFICIENT_FUNDS:case cb.MISSING_NEW:case cb.NONCE_EXPIRED:case cb.REPLACEMENT_UNDERPRICED:case cb.TRANSACTION_REPLACED:case cb.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,db.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),lb&&this.throwError("platform missing String.prototype.normalize",db.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:lb})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,db.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,db.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,db.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",db.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",db.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",db.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return ub||(ub=new db("logger/5.7.0")),ub}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",db.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ib){if(!t)return;this.globalLogger().throwError("error censorship permanent",db.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ob=!!t,ib=!!e}static setLogLevel(t){const e=sb[t.toLowerCase()];null!=e?ab=e:db.globalLogger().warn("invalid log level - "+t)}static from(t){return new db(t)}}db.errors=cb,db.levels=hb;const pb=new db("bytes/5.7.0");function mb(t){return!!t.toHexString}function gb(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return gb(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function vb(t){return"number"==typeof t&&t==t&&t%1==0}function yb(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!vb(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bb(t,e){if(e||(e={}),"number"==typeof t){pb.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),gb(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),mb(t)&&(t=t.toHexString()),wb(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":pb.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t>6==2;n++)t++;return t}return t===Tb.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Sb||(Sb={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Tb||(Tb={}));const Rb=Object.freeze({error:function(t,e,r,n,i){return Nb.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:kb,replace:function(t,e,r,n,i){return t===Tb.OVERLONG?(n.push(i),0):(n.push(65533),kb(t,e,r))}});function xb(t,e=Sb.current){e!=Sb.current&&(Nb.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return bb(r)}function Ob(t,e){return function(t,e){null==e&&(e=Rb.error),t=bb(t);const r=[];let n=0;for(;n>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?Tb.UNEXPECTED_CONTINUE:Tb.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e(Tb.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i1114111?n+=e(Tb.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e(Tb.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e(Tb.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}var Ib=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};function Cb(t,e){return Ib(this,void 0,void 0,(function*(){null==e&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};!0!==e.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client");const n=yield fetch(t,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach(((t,e)=>{o[e.toLowerCase()]=t})):n.headers.keys().forEach((t=>{o[t.toLowerCase()]=n.headers.get(t)})),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:bb(new Uint8Array(i))}}))}var Pb=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Lb=new db("web/5.5.1");function Ub(t){return new Promise((e=>{setTimeout(e,t)}))}function Bb(t,e){if(null==t)return null;if("string"==typeof t)return t;if(function(t){return wb(t)&&!(t.length%2)||yb(t)}(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return Ob(t)}catch(t){}return function(t,e){if(e||(e={}),"number"==typeof t){pb.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Eb[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),mb(t))return t.toHexString();if(wb(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":pb.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(yb(t)){let e="0x";for(let r=0;r>4]+Eb[15&n]}return e}return pb.throwArgumentError("invalid hexlify value","value",t)}(t)}return t}function Db(t,e,r){const n="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;Lb.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const i="object"==typeof t?t.throttleCallback:null,o="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;Lb.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s={};let a=null;const u={method:"GET"};let l=!1,h=12e4;if("string"==typeof t)a=t;else if("object"==typeof t){if(null!=t&&null!=t.url||Lb.throwArgumentError("missing URL","connection.url",t),a=t.url,"number"==typeof t.timeout&&t.timeout>0&&(h=t.timeout),t.headers)for(const e in t.headers)s[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(l=!0);if(u.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==a.substring(0,6)&&!0!==t.allowInsecureAuthentication&&Lb.throwError("basic authentication requires a secure https url",db.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;s.authorization={key:"Authorization",value:"Basic "+Ab(xb(e))}}}const c=new RegExp("^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$","i"),f=a?a.match(c):null;if(f)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":f[1]},body:Mb(f[2])};let e=t.body;return r&&(e=r(t.body,t)),Promise.resolve(e)}catch(t){Lb.throwError("processing response error",db.errors.SERVER_ERROR,{body:Bb(f[1],f[2]),error:t,requestBody:null,requestMethod:"GET",url:a})}e&&(u.method="POST",u.body=e,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(e.length)}));const d={};Object.keys(s).forEach((t=>{const e=s[t];d[e.key]=e.value})),u.headers=d;const p=function(){let t=null;return{promise:new Promise((function(e,r){h&&(t=setTimeout((()=>{null!=t&&(t=null,r(Lb.makeError("timeout",db.errors.TIMEOUT,{requestBody:Bb(u.body,d["content-type"]),requestMethod:u.method,timeout:h,url:a})))}),h))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),m=function(){return Pb(this,void 0,void 0,(function*(){for(let t=0;t=300)&&(p.cancel(),Lb.throwError("bad response",db.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:Bb(s,e.headers?e.headers["content-type"]:null),requestBody:Bb(u.body,d["content-type"]),requestMethod:u.method,url:a})),r)try{const t=yield r(s,e);return p.cancel(),t}catch(r){if(r.throttleRetry&&t"content-type"===t.toLowerCase())).length||(r.headers=_b(r.headers),r.headers["content-type"]="application/json"):r.headers={"content-type":"application/json"},t=r}return Db(t,n,((t,e)=>{let n=null;if(null!=t)try{n=JSON.parse(Ob(t))}catch(e){Lb.throwError("invalid JSON",db.errors.SERVER_ERROR,{body:t,error:e})}return r&&(n=r(n,e)),n}))}function Gb(t,e){return e||(e={}),null==(e=_b(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,n){let i=null,o=!1;const s=()=>!o&&(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout((()=>{s()&&n(new Error("timeout"))}),e.timeout));const a=e.retryLimit;let u=0;!function i(){return t().then((function(t){if(void 0!==t)s()&&r(t);else if(e.oncePoll)e.oncePoll.once("poll",i);else if(e.onceBlock)e.onceBlock.once("block",i);else if(!o){if(u++,u>a)return void(s()&&n(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,u)));te.ceiling&&(t=e.ceiling),setTimeout(i,t)}return null}),(function(t){s()&&n(t)}))}()}))}const jb="ethers/5.5.3",qb=new nd(jb);try{const t=window;null==t._ethers&&(t._ethers=u)}catch(t){}},8020:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(9649).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},5205:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(7801).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},7328:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(6658).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},5336:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(6042).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},9578:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(4801).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},557:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(8067).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},4336:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(991).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},3413:(t,e,r)=>{"use strict";r.r(e),r.d(e,{Accordion:()=>u,Carousel:()=>y,Collapse:()=>d,Dial:()=>ve,Dismiss:()=>A,Drawer:()=>Yt,Dropdown:()=>Bt,Modal:()=>zt,Popover:()=>fe,Tabs:()=>te,Tooltip:()=>se,initAccordions:()=>a,initCarousels:()=>v,initCollapses:()=>f,initDials:()=>ge,initDismisses:()=>M,initDrawers:()=>Wt,initDropdowns:()=>Ut,initFlowbite:()=>ye,initModals:()=>qt,initPopovers:()=>ce,initTabs:()=>Qt,initTooltips:()=>oe});const n=function(){function t(t,e){void 0===e&&(e=[]),this._eventType=t,this._eventFunctions=e}return t.prototype.init=function(){var t=this;this._eventFunctions.forEach((function(e){"undefined"!=typeof window&&window.addEventListener(t._eventType,e)}))},t}();var i=function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r0&&x(n.width)/t.offsetWidth||1,o=t.offsetHeight>0&&x(n.height)/t.offsetHeight||1);var s=(N(t)?_(t):window).visualViewport,a=!I()&&r,u=(n.left+(a&&s?s.offsetLeft:0))/i,l=(n.top+(a&&s?s.offsetTop:0))/o,h=n.width/i,c=n.height/o;return{width:h,height:c,top:l,right:u+h,bottom:l+c,left:u,x:u,y:l}}function P(t){var e=_(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function L(t){return t?(t.nodeName||"").toLowerCase():null}function U(t){return((N(t)?t.ownerDocument:t.document)||window.document).documentElement}function B(t){return C(U(t)).left+P(t).scrollLeft}function D(t){return _(t).getComputedStyle(t)}function F(t){var e=D(t),r=e.overflow,n=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(r+i+n)}function G(t,e,r){void 0===r&&(r=!1);var n,i,o=S(e),s=S(e)&&function(t){var e=t.getBoundingClientRect(),r=x(e.width)/t.offsetWidth||1,n=x(e.height)/t.offsetHeight||1;return 1!==r||1!==n}(e),a=U(e),u=C(t,s,r),l={scrollLeft:0,scrollTop:0},h={x:0,y:0};return(o||!o&&!r)&&(("body"!==L(e)||F(a))&&(l=(n=e)!==_(n)&&S(n)?{scrollLeft:(i=n).scrollLeft,scrollTop:i.scrollTop}:P(n)),S(e)?((h=C(e,!0)).x+=e.clientLeft,h.y+=e.clientTop):a&&(h.x=B(a))),{x:u.left+l.scrollLeft-h.x,y:u.top+l.scrollTop-h.y,width:u.width,height:u.height}}function j(t){var e=C(t),r=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-r)<=1&&(r=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:r,height:n}}function q(t){return"html"===L(t)?t:t.assignedSlot||t.parentNode||(T(t)?t.host:null)||U(t)}function z(t){return["html","body","#document"].indexOf(L(t))>=0?t.ownerDocument.body:S(t)&&F(t)?t:z(q(t))}function K(t,e){var r;void 0===e&&(e=[]);var n=z(t),i=n===(null==(r=t.ownerDocument)?void 0:r.body),o=_(n),s=i?[o].concat(o.visualViewport||[],F(n)?n:[]):n,a=e.concat(s);return i?a:a.concat(K(q(s)))}function H(t){return["table","td","th"].indexOf(L(t))>=0}function $(t){return S(t)&&"fixed"!==D(t).position?t.offsetParent:null}function V(t){for(var e=_(t),r=$(t);r&&H(r)&&"static"===D(r).position;)r=$(r);return r&&("html"===L(r)||"body"===L(r)&&"static"===D(r).position)?e:r||function(t){var e=/firefox/i.test(O());if(/Trident/i.test(O())&&S(t)&&"fixed"===D(t).position)return null;var r=q(t);for(T(r)&&(r=r.host);S(r)&&["html","body"].indexOf(L(r))<0;){var n=D(r);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return r;r=r.parentNode}return null}(t)||e}var W="top",Y="bottom",J="right",X="left",Z="auto",Q=[W,Y,J,X],tt="start",et="end",rt="viewport",nt="popper",it=Q.reduce((function(t,e){return t.concat([e+"-"+tt,e+"-"+et])}),[]),ot=[].concat(Q,[Z]).reduce((function(t,e){return t.concat([e,e+"-"+tt,e+"-"+et])}),[]),st=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function at(t){var e=new Map,r=new Set,n=[];function i(t){r.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!r.has(t)){var n=e.get(t);n&&i(n)}})),n.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){r.has(t.name)||i(t)})),n}var ut={placement:"bottom",modifiers:[],strategy:"absolute"};function lt(){for(var t=arguments.length,e=new Array(t),r=0;r=0?"x":"y"}function mt(t){var e,r=t.reference,n=t.element,i=t.placement,o=i?ft(i):null,s=i?dt(i):null,a=r.x+r.width/2-n.width/2,u=r.y+r.height/2-n.height/2;switch(o){case W:e={x:a,y:r.y-n.height};break;case Y:e={x:a,y:r.y+r.height};break;case J:e={x:r.x+r.width,y:u};break;case X:e={x:r.x-n.width,y:u};break;default:e={x:r.x,y:r.y}}var l=o?pt(o):null;if(null!=l){var h="y"===l?"height":"width";switch(s){case tt:e[l]=e[l]-(r[h]/2-n[h]/2);break;case et:e[l]=e[l]+(r[h]/2-n[h]/2)}}return e}var gt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function vt(t){var e,r=t.popper,n=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,a=t.position,u=t.gpuAcceleration,l=t.adaptive,h=t.roundOffsets,c=t.isFixed,f=s.x,d=void 0===f?0:f,p=s.y,m=void 0===p?0:p,g="function"==typeof h?h({x:d,y:m}):{x:d,y:m};d=g.x,m=g.y;var v=s.hasOwnProperty("x"),y=s.hasOwnProperty("y"),b=X,w=W,E=window;if(l){var M=V(r),A="clientHeight",N="clientWidth";M===_(r)&&"static"!==D(M=U(r)).position&&"absolute"===a&&(A="scrollHeight",N="scrollWidth"),(i===W||(i===X||i===J)&&o===et)&&(w=Y,m-=(c&&M===E&&E.visualViewport?E.visualViewport.height:M[A])-n.height,m*=u?1:-1),i!==X&&(i!==W&&i!==Y||o!==et)||(b=J,d-=(c&&M===E&&E.visualViewport?E.visualViewport.width:M[N])-n.width,d*=u?1:-1)}var S,T=Object.assign({position:a},l&>),k=!0===h?function(t,e){var r=t.x,n=t.y,i=e.devicePixelRatio||1;return{x:x(r*i)/i||0,y:x(n*i)/i||0}}({x:d,y:m},_(r)):{x:d,y:m};return d=k.x,m=k.y,u?Object.assign({},T,((S={})[w]=y?"0":"",S[b]=v?"0":"",S.transform=(E.devicePixelRatio||1)<=1?"translate("+d+"px, "+m+"px)":"translate3d("+d+"px, "+m+"px, 0)",S)):Object.assign({},T,((e={})[w]=y?m+"px":"",e[b]=v?d+"px":"",e.transform="",e))}var yt={left:"right",right:"left",bottom:"top",top:"bottom"};function bt(t){return t.replace(/left|right|bottom|top/g,(function(t){return yt[t]}))}var wt={start:"end",end:"start"};function Et(t){return t.replace(/start|end/g,(function(t){return wt[t]}))}function Mt(t,e){var r=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(r&&T(r)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function At(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function _t(t,e,r){return e===rt?At(function(t,e){var r=_(t),n=U(t),i=r.visualViewport,o=n.clientWidth,s=n.clientHeight,a=0,u=0;if(i){o=i.width,s=i.height;var l=I();(l||!l&&"fixed"===e)&&(a=i.offsetLeft,u=i.offsetTop)}return{width:o,height:s,x:a+B(t),y:u}}(t,r)):N(e)?function(t,e){var r=C(t,!1,"fixed"===e);return r.top=r.top+t.clientTop,r.left=r.left+t.clientLeft,r.bottom=r.top+t.clientHeight,r.right=r.left+t.clientWidth,r.width=t.clientWidth,r.height=t.clientHeight,r.x=r.left,r.y=r.top,r}(e,r):At(function(t){var e,r=U(t),n=P(t),i=null==(e=t.ownerDocument)?void 0:e.body,o=k(r.scrollWidth,r.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=k(r.scrollHeight,r.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-n.scrollLeft+B(t),u=-n.scrollTop;return"rtl"===D(i||r).direction&&(a+=k(r.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:u}}(U(t)))}function Nt(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function St(t,e){return e.reduce((function(e,r){return e[r]=t,e}),{})}function Tt(t,e){void 0===e&&(e={});var r=e,n=r.placement,i=void 0===n?t.placement:n,o=r.strategy,s=void 0===o?t.strategy:o,a=r.boundary,u=void 0===a?"clippingParents":a,l=r.rootBoundary,h=void 0===l?rt:l,c=r.elementContext,f=void 0===c?nt:c,d=r.altBoundary,p=void 0!==d&&d,m=r.padding,g=void 0===m?0:m,v=Nt("number"!=typeof g?g:St(g,Q)),y=f===nt?"reference":nt,b=t.rects.popper,w=t.elements[p?y:f],E=function(t,e,r,n){var i="clippingParents"===e?function(t){var e=K(q(t)),r=["absolute","fixed"].indexOf(D(t).position)>=0&&S(t)?V(t):t;return N(r)?e.filter((function(t){return N(t)&&Mt(t,r)&&"body"!==L(t)})):[]}(t):[].concat(e),o=[].concat(i,[r]),s=o[0],a=o.reduce((function(e,r){var i=_t(t,r,n);return e.top=k(i.top,e.top),e.right=R(i.right,e.right),e.bottom=R(i.bottom,e.bottom),e.left=k(i.left,e.left),e}),_t(t,s,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(N(w)?w:w.contextElement||U(t.elements.popper),u,h,s),M=C(t.elements.reference),A=mt({reference:M,element:b,strategy:"absolute",placement:i}),_=At(Object.assign({},b,A)),T=f===nt?_:M,x={top:E.top-T.top+v.top,bottom:T.bottom-E.bottom+v.bottom,left:E.left-T.left+v.left,right:T.right-E.right+v.right},O=t.modifiersData.offset;if(f===nt&&O){var I=O[i];Object.keys(x).forEach((function(t){var e=[J,Y].indexOf(t)>=0?1:-1,r=[W,Y].indexOf(t)>=0?"y":"x";x[t]+=I[r]*e}))}return x}function kt(t,e,r){return k(t,R(e,r))}function Rt(t,e,r){return void 0===r&&(r={x:0,y:0}),{top:t.top-e.height-r.y,right:t.right-e.width+r.x,bottom:t.bottom-e.height+r.y,left:t.left-e.width-r.x}}function xt(t){return[W,J,Y,X].some((function(e){return t[e]>=0}))}var Ot=ht({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,r=t.instance,n=t.options,i=n.scroll,o=void 0===i||i,s=n.resize,a=void 0===s||s,u=_(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&l.forEach((function(t){t.addEventListener("scroll",r.update,ct)})),a&&u.addEventListener("resize",r.update,ct),function(){o&&l.forEach((function(t){t.removeEventListener("scroll",r.update,ct)})),a&&u.removeEventListener("resize",r.update,ct)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,r=t.name;e.modifiersData[r]=mt({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,r=t.options,n=r.gpuAcceleration,i=void 0===n||n,o=r.adaptive,s=void 0===o||o,a=r.roundOffsets,u=void 0===a||a,l={placement:ft(e.placement),variation:dt(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,vt(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:u})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,vt(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var r=e.styles[t]||{},n=e.attributes[t]||{},i=e.elements[t];S(i)&&L(i)&&(Object.assign(i.style,r),Object.keys(n).forEach((function(t){var e=n[t];!1===e?i.removeAttribute(t):i.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,r={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,r.popper),e.styles=r,e.elements.arrow&&Object.assign(e.elements.arrow.style,r.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],i=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:r[t]).reduce((function(t,e){return t[e]="",t}),{});S(n)&&L(n)&&(Object.assign(n.style,o),Object.keys(i).forEach((function(t){n.removeAttribute(t)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,r=t.options,n=t.name,i=r.offset,o=void 0===i?[0,0]:i,s=ot.reduce((function(t,r){return t[r]=function(t,e,r){var n=ft(t),i=[X,W].indexOf(n)>=0?-1:1,o="function"==typeof r?r(Object.assign({},e,{placement:t})):r,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[X,J].indexOf(n)>=0?{x:a,y:s}:{x:s,y:a}}(r,e.rects,o),t}),{}),a=s[e.placement],u=a.x,l=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=u,e.modifiersData.popperOffsets.y+=l),e.modifiersData[n]=s}},{name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,r=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var i=r.mainAxis,o=void 0===i||i,s=r.altAxis,a=void 0===s||s,u=r.fallbackPlacements,l=r.padding,h=r.boundary,c=r.rootBoundary,f=r.altBoundary,d=r.flipVariations,p=void 0===d||d,m=r.allowedAutoPlacements,g=e.options.placement,v=ft(g),y=u||(v!==g&&p?function(t){if(ft(t)===Z)return[];var e=bt(t);return[Et(t),e,Et(e)]}(g):[bt(g)]),b=[g].concat(y).reduce((function(t,r){return t.concat(ft(r)===Z?function(t,e){void 0===e&&(e={});var r=e,n=r.placement,i=r.boundary,o=r.rootBoundary,s=r.padding,a=r.flipVariations,u=r.allowedAutoPlacements,l=void 0===u?ot:u,h=dt(n),c=h?a?it:it.filter((function(t){return dt(t)===h})):Q,f=c.filter((function(t){return l.indexOf(t)>=0}));0===f.length&&(f=c);var d=f.reduce((function(e,r){return e[r]=Tt(t,{placement:r,boundary:i,rootBoundary:o,padding:s})[ft(r)],e}),{});return Object.keys(d).sort((function(t,e){return d[t]-d[e]}))}(e,{placement:r,boundary:h,rootBoundary:c,padding:l,flipVariations:p,allowedAutoPlacements:m}):r)}),[]),w=e.rects.reference,E=e.rects.popper,M=new Map,A=!0,_=b[0],N=0;N=0,x=R?"width":"height",O=Tt(e,{placement:S,boundary:h,rootBoundary:c,altBoundary:f,padding:l}),I=R?k?J:X:k?Y:W;w[x]>E[x]&&(I=bt(I));var C=bt(I),P=[];if(o&&P.push(O[T]<=0),a&&P.push(O[I]<=0,O[C]<=0),P.every((function(t){return t}))){_=S,A=!1;break}M.set(S,P)}if(A)for(var L=function(t){var e=b.find((function(e){var r=M.get(e);if(r)return r.slice(0,t).every((function(t){return t}))}));if(e)return _=e,"break"},U=p?3:1;U>0&&"break"!==L(U);U--);e.placement!==_&&(e.modifiersData[n]._skip=!0,e.placement=_,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,r=t.options,n=t.name,i=r.mainAxis,o=void 0===i||i,s=r.altAxis,a=void 0!==s&&s,u=r.boundary,l=r.rootBoundary,h=r.altBoundary,c=r.padding,f=r.tether,d=void 0===f||f,p=r.tetherOffset,m=void 0===p?0:p,g=Tt(e,{boundary:u,rootBoundary:l,padding:c,altBoundary:h}),v=ft(e.placement),y=dt(e.placement),b=!y,w=pt(v),E="x"===w?"y":"x",M=e.modifiersData.popperOffsets,A=e.rects.reference,_=e.rects.popper,N="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,S="number"==typeof N?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),T=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,x={x:0,y:0};if(M){if(o){var O,I="y"===w?W:X,C="y"===w?Y:J,P="y"===w?"height":"width",L=M[w],U=L+g[I],B=L-g[C],D=d?-_[P]/2:0,F=y===tt?A[P]:_[P],G=y===tt?-_[P]:-A[P],q=e.elements.arrow,z=d&&q?j(q):{width:0,height:0},K=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},H=K[I],$=K[C],Z=kt(0,A[P],z[P]),Q=b?A[P]/2-D-Z-H-S.mainAxis:F-Z-H-S.mainAxis,et=b?-A[P]/2+D+Z+$+S.mainAxis:G+Z+$+S.mainAxis,rt=e.elements.arrow&&V(e.elements.arrow),nt=rt?"y"===w?rt.clientTop||0:rt.clientLeft||0:0,it=null!=(O=null==T?void 0:T[w])?O:0,ot=L+et-it,st=kt(d?R(U,L+Q-it-nt):U,L,d?k(B,ot):B);M[w]=st,x[w]=st-L}if(a){var at,ut="x"===w?W:X,lt="x"===w?Y:J,ht=M[E],ct="y"===E?"height":"width",mt=ht+g[ut],gt=ht-g[lt],vt=-1!==[W,X].indexOf(v),yt=null!=(at=null==T?void 0:T[E])?at:0,bt=vt?mt:ht-A[ct]-_[ct]-yt+S.altAxis,wt=vt?ht+A[ct]+_[ct]-yt-S.altAxis:gt,Et=d&&vt?function(t,e,r){var n=kt(t,e,r);return n>r?r:n}(bt,ht,wt):kt(d?bt:mt,ht,d?wt:gt);M[E]=Et,x[E]=Et-ht}e.modifiersData[n]=x}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,r=t.state,n=t.name,i=t.options,o=r.elements.arrow,s=r.modifiersData.popperOffsets,a=ft(r.placement),u=pt(a),l=[X,J].indexOf(a)>=0?"height":"width";if(o&&s){var h=function(t,e){return Nt("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:St(t,Q))}(i.padding,r),c=j(o),f="y"===u?W:X,d="y"===u?Y:J,p=r.rects.reference[l]+r.rects.reference[u]-s[u]-r.rects.popper[l],m=s[u]-r.rects.reference[u],g=V(o),v=g?"y"===u?g.clientHeight||0:g.clientWidth||0:0,y=p/2-m/2,b=h[f],w=v-c[l]-h[d],E=v/2-c[l]/2+y,M=kt(b,E,w),A=u;r.modifiersData[n]=((e={})[A]=M,e.centerOffset=M-E,e)}},effect:function(t){var e=t.state,r=t.options.element,n=void 0===r?"[data-popper-arrow]":r;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&Mt(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,r=t.name,n=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=Tt(e,{elementContext:"reference"}),a=Tt(e,{altBoundary:!0}),u=Rt(s,n),l=Rt(a,i,o),h=xt(u),c=xt(l);e.modifiersData[r]={referenceClippingOffsets:u,popperEscapeOffsets:l,isReferenceHidden:h,hasPopperEscaped:c},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":c})}}]}),It=function(){return It=Object.assign||function(t){for(var e,r=1,n=arguments.length;r{var n=e;n.utils=r(6436),n.common=r(5772),n.sha=r(9041),n.ripemd=r(2949),n.hmac=r(2344),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},5772:(t,e,r)=>{"use strict";var n=r(6436),i=r(9746);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=o,o.prototype.update=function(t,e){if(t=n.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o{"use strict";var n=r(6436),i=r(9746);function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(e,r))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e{"use strict";var n=r(6436),i=r(5772),o=n.rotl32,s=n.sum32,a=n.sum32_3,u=n.sum32_4,l=i.BlockHash;function h(){if(!(this instanceof h))return new h;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function c(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function f(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function d(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}n.inherits(h,l),e.ripemd160=h,h.blockSize=512,h.outSize=160,h.hmacStrength=192,h.padLength=64,h.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],l=this.h[3],h=this.h[4],y=r,b=n,w=i,E=l,M=h,A=0;A<80;A++){var _=s(o(u(r,c(A,n,i,l),t[p[A]+e],f(A)),g[A]),h);r=h,h=l,l=o(i,10),i=n,n=_,_=s(o(u(y,c(79-A,b,w,E),t[m[A]+e],d(A)),v[A]),M),y=M,M=E,E=o(w,10),w=b,b=_}_=a(this.h[1],i,E),this.h[1]=a(this.h[2],l,M),this.h[2]=a(this.h[3],h,y),this.h[3]=a(this.h[4],r,b),this.h[4]=a(this.h[0],n,w),this.h[0]=_},h.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],m=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],v=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},9041:(t,e,r)=>{"use strict";e.sha1=r(4761),e.sha224=r(799),e.sha256=r(9344),e.sha384=r(772),e.sha512=r(5900)},4761:(t,e,r)=>{"use strict";var n=r(6436),i=r(5772),o=r(7038),s=n.rotl32,a=n.sum32,u=n.sum32_5,l=o.ft_1,h=i.BlockHash,c=[1518500249,1859775393,2400959708,3395469782];function f(){if(!(this instanceof f))return new f;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(f,h),t.exports=f,f.blockSize=512,f.outSize=160,f.hmacStrength=80,f.padLength=64,f.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n{"use strict";var n=r(6436),i=r(9344);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},9344:(t,e,r)=>{"use strict";var n=r(6436),i=r(5772),o=r(7038),s=r(9746),a=n.sum32,u=n.sum32_4,l=n.sum32_5,h=o.ch32,c=o.maj32,f=o.s0_256,d=o.s1_256,p=o.g0_256,m=o.g1_256,g=i.BlockHash,v=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function y(){if(!(this instanceof y))return new y;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=v,this.W=new Array(64)}n.inherits(y,g),t.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n{"use strict";var n=r(6436),i=r(5900);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},5900:(t,e,r)=>{"use strict";var n=r(6436),i=r(5772),o=r(9746),s=n.rotr64_hi,a=n.rotr64_lo,u=n.shr64_hi,l=n.shr64_lo,h=n.sum64,c=n.sum64_hi,f=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,m=n.sum64_5_hi,g=n.sum64_5_lo,v=i.BlockHash,y=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function b(){if(!(this instanceof b))return new b;v.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function w(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function E(t,e,r,n,i,o){var s=e&n^~e&o;return s<0&&(s+=4294967296),s}function M(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function A(t,e,r,n,i,o){var s=e&n^e&o^n&o;return s<0&&(s+=4294967296),s}function _(t,e){var r=s(t,e,28)^s(e,t,2)^s(e,t,7);return r<0&&(r+=4294967296),r}function N(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function S(t,e){var r=a(t,e,14)^a(t,e,18)^a(e,t,9);return r<0&&(r+=4294967296),r}function T(t,e){var r=s(t,e,1)^s(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function k(t,e){var r=a(t,e,1)^a(t,e,8)^l(t,e,7);return r<0&&(r+=4294967296),r}function R(t,e){var r=a(t,e,19)^a(e,t,29)^l(t,e,6);return r<0&&(r+=4294967296),r}n.inherits(b,v),t.exports=b,b.blockSize=1024,b.outSize=512,b.hmacStrength=192,b.padLength=128,b.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n{"use strict";var n=r(6436).rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function s(t,e,r){return t^e^r}e.ft_1=function(t,e,r,n){return 0===t?i(e,r,n):1===t||3===t?s(e,r,n):2===t?o(e,r,n):void 0},e.ch32=i,e.maj32=o,e.p32=s,e.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},e.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},e.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},e.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},6436:(t,e,r)=>{"use strict";var n=r(9746),i=r(5717);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,r[n++]=63&s|128):o(t,i)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i>>0}return s},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,s,a){var u=0,l=e;return u+=(l=l+n>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,s,a,u,l){var h=0,c=e;return h+=(c=c+n>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,n,i,o,s,a,u,l){return e+n+o+a+l>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},5717:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},1094:(t,e,r)=>{var n;!function(){"use strict";var i="input is invalid type",o="object"==typeof window,s=o?window:{};s.JS_SHA3_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!s.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?s=r.g:a&&(s=self);var u=!s.JS_SHA3_NO_COMMON_JS&&t.exports,l=r.amdO,h=!s.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,c="0123456789abcdef".split(""),f=[4,1024,262144,67108864],d=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],m=[224,256,384,512],g=[128,256],v=["hex","buffer","arrayBuffer","array","digest"],y={128:168,256:136};!s.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!h||!s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var b=function(t,e,r){return function(n){return new P(t,e,t).update(n)[r]()}},w=function(t,e,r){return function(n,i){return new P(t,e,i).update(n)[r]()}},E=function(t,e,r){return function(e,n,i,o){return S["cshake"+t].update(e,n,i,o)[r]()}},M=function(t,e,r){return function(e,n,i,o){return S["kmac"+t].update(e,n,i,o)[r]()}},A=function(t,e,r,n){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function L(t,e,r){P.call(this,t,e,r)}P.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(i);if(null===t)throw new Error(i);if(h&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||h&&ArrayBuffer.isView(t)))throw new Error(i);e=!0}for(var n,o,s=this.blocks,a=this.byteCount,u=t.length,l=this.blockCount,c=0,f=this.s;c>2]|=t[c]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(s[n>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=a){for(this.start=n-a,this.block=s[l],n=0;n>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),this.update(i),i.length},P.prototype.encodeString=function(t){var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(i);if(null===t)throw new Error(i);if(h&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||h&&ArrayBuffer.isView(t)))throw new Error(i);e=!0}var n=0,o=t.length;if(e)n=o;else for(var s=0;s=57344?n+=3:(a=65536+((1023&a)<<10|1023&t.charCodeAt(++s)),n+=4)}return n+=this.encode(8*n),this.update(t),n},P.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e>4&15]+c[15&t]+c[t>>12&15]+c[t>>8&15]+c[t>>20&15]+c[t>>16&15]+c[t>>28&15]+c[t>>24&15];s%e==0&&(U(r),o=0)}return i&&(t=r[o],a+=c[t>>4&15]+c[15&t],i>1&&(a+=c[t>>12&15]+c[t>>8&15]),i>2&&(a+=c[t>>20&15]+c[t>>16&15])),a},P.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(t);s>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;a%r==0&&U(n)}return o&&(t=a<<2,e=n[s],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},L.prototype=new P,L.prototype.finalize=function(){return this.encode(this.outputBits,!0),P.prototype.finalize.call(this)};var U=function(t){var e,r,n,i,o,s,a,u,l,h,c,f,d,m,g,v,y,b,w,E,M,A,_,N,S,T,k,R,x,O,I,C,P,L,U,B,D,F,G,j,q,z,K,H,$,V,W,Y,J,X,Z,Q,tt,et,rt,nt,it,ot,st,at,ut,lt,ht;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],l=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),r=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|l>>>31),r=o^(l<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(h<<1|c>>>31),r=a^(c<<1|h>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(f<<1|d>>>31),r=l^(d<<1|f>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=h^(i<<1|o>>>31),r=c^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,m=t[0],g=t[1],V=t[11]<<4|t[10]>>>28,W=t[10]<<4|t[11]>>>28,R=t[20]<<3|t[21]>>>29,x=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,L=t[2]<<1|t[3]>>>31,U=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,y=t[12]<<12|t[13]>>>20,Y=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,O=t[33]<<13|t[32]>>>19,I=t[32]<<13|t[33]>>>19,lt=t[42]<<2|t[43]>>>30,ht=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,B=t[14]<<6|t[15]>>>26,D=t[15]<<6|t[14]>>>26,b=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Z=t[35]<<15|t[34]>>>17,C=t[45]<<29|t[44]>>>3,P=t[44]<<29|t[45]>>>3,N=t[6]<<28|t[7]>>>4,S=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,F=t[26]<<25|t[27]>>>7,G=t[27]<<25|t[26]>>>7,E=t[36]<<21|t[37]>>>11,M=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,H=t[8]<<27|t[9]>>>5,$=t[9]<<27|t[8]>>>5,T=t[18]<<20|t[19]>>>12,k=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,j=t[38]<<8|t[39]>>>24,q=t[39]<<8|t[38]>>>24,A=t[48]<<14|t[49]>>>18,_=t[49]<<14|t[48]>>>18,t[0]=m^~v&b,t[1]=g^~y&w,t[10]=N^~T&R,t[11]=S^~k&x,t[20]=L^~B&F,t[21]=U^~D&G,t[30]=H^~V&Y,t[31]=$^~W&J,t[40]=et^~nt&ot,t[41]=rt^~it&st,t[2]=v^~b&E,t[3]=y^~w&M,t[12]=T^~R&O,t[13]=k^~x&I,t[22]=B^~F&j,t[23]=D^~G&q,t[32]=V^~Y&X,t[33]=W^~J&Z,t[42]=nt^~ot&at,t[43]=it^~st&ut,t[4]=b^~E&A,t[5]=w^~M&_,t[14]=R^~O&C,t[15]=x^~I&P,t[24]=F^~j&z,t[25]=G^~q&K,t[34]=Y^~X&Q,t[35]=J^~Z&tt,t[44]=ot^~at<,t[45]=st^~ut&ht,t[6]=E^~A&m,t[7]=M^~_&g,t[16]=O^~C&N,t[17]=I^~P&S,t[26]=j^~z&L,t[27]=q^~K&U,t[36]=X^~Q&H,t[37]=Z^~tt&$,t[46]=at^~lt&et,t[47]=ut^~ht&rt,t[8]=A^~m&v,t[9]=_^~g&y,t[18]=C^~N&T,t[19]=P^~S&k,t[28]=z^~L&B,t[29]=K^~U&D,t[38]=Q^~H&V,t[39]=tt^~$&W,t[48]=lt^~et&nt,t[49]=ht^~rt&it,t[0]^=p[n],t[1]^=p[n+1]};if(u)t.exports=S;else{for(k=0;k{function e(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=e,e.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},7635:function(t){"use strict";!function(e){const r=2147483647;function n(t){const e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);let r=1779033703,n=3144134277,i=1013904242,o=2773480762,s=1359893119,a=2600822924,u=528734635,l=1541459225;const h=new Uint32Array(64);function c(t){let c=0,f=t.length;for(;f>=64;){let d,p,m,g,v,y=r,b=n,w=i,E=o,M=s,A=a,_=u,N=l;for(p=0;p<16;p++)m=c+4*p,h[p]=(255&t[m])<<24|(255&t[m+1])<<16|(255&t[m+2])<<8|255&t[m+3];for(p=16;p<64;p++)d=h[p-2],g=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,d=h[p-15],v=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3,h[p]=(g+h[p-7]|0)+(v+h[p-16]|0)|0;for(p=0;p<64;p++)g=(((M>>>6|M<<26)^(M>>>11|M<<21)^(M>>>25|M<<7))+(M&A^~M&_)|0)+(N+(e[p]+h[p]|0)|0)|0,v=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&b^y&w^b&w)|0,N=_,_=A,A=M,M=E+g|0,E=w,w=b,b=y,y=g+v|0;r=r+y|0,n=n+b|0,i=i+w|0,o=o+E|0,s=s+M|0,a=a+A|0,u=u+_|0,l=l+N|0,c+=64,f-=64}}c(t);let f,d=t.length%64,p=t.length/536870912|0,m=t.length<<3,g=d<56?56:120,v=t.slice(t.length-d,t.length);for(v.push(128),f=d+1;f>>24&255),v.push(p>>>16&255),v.push(p>>>8&255),v.push(p>>>0&255),v.push(m>>>24&255),v.push(m>>>16&255),v.push(m>>>8&255),v.push(m>>>0&255),c(v),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255,l>>>24&255,l>>>16&255,l>>>8&255,l>>>0&255]}function i(t,e,r){t=t.length<=64?t:n(t);const i=64+e.length+4,o=new Array(i),s=new Array(64);let a,u=[];for(a=0;a<64;a++)o[a]=54;for(a=0;a=i-4;t--){if(o[t]++,o[t]<=255)return;o[t]=0}}for(;r>=32;)l(),u=u.concat(n(s.concat(n(o)))),r-=32;return r>0&&(l(),u=u.concat(n(s.concat(n(o))).slice(0,r))),u}function o(t,e,r,n,i){let o;for(l(t,16*(2*r-1),i,0,16),o=0;o<2*r;o++)u(t,16*o,i,16),a(i,n),l(i,0,t,e+16*o,16);for(o=0;o>>32-e}function a(t,e){l(t,0,e,0,16);for(let t=8;t>0;t-=2)e[4]^=s(e[0]+e[12],7),e[8]^=s(e[4]+e[0],9),e[12]^=s(e[8]+e[4],13),e[0]^=s(e[12]+e[8],18),e[9]^=s(e[5]+e[1],7),e[13]^=s(e[9]+e[5],9),e[1]^=s(e[13]+e[9],13),e[5]^=s(e[1]+e[13],18),e[14]^=s(e[10]+e[6],7),e[2]^=s(e[14]+e[10],9),e[6]^=s(e[2]+e[14],13),e[10]^=s(e[6]+e[2],18),e[3]^=s(e[15]+e[11],7),e[7]^=s(e[3]+e[15],9),e[11]^=s(e[7]+e[3],13),e[15]^=s(e[11]+e[7],18),e[1]^=s(e[0]+e[3],7),e[2]^=s(e[1]+e[0],9),e[3]^=s(e[2]+e[1],13),e[0]^=s(e[3]+e[2],18),e[6]^=s(e[5]+e[4],7),e[7]^=s(e[6]+e[5],9),e[4]^=s(e[7]+e[6],13),e[5]^=s(e[4]+e[7],18),e[11]^=s(e[10]+e[9],7),e[8]^=s(e[11]+e[10],9),e[9]^=s(e[8]+e[11],13),e[10]^=s(e[9]+e[8],18),e[12]^=s(e[15]+e[14],7),e[13]^=s(e[12]+e[15],9),e[14]^=s(e[13]+e[12],13),e[15]^=s(e[14]+e[13],18);for(let r=0;r<16;++r)t[r]+=e[r]}function u(t,e,r,n){for(let i=0;i=256)return!1}return!0}function c(t,e){if("number"!=typeof t||t%1)throw new Error("invalid "+e);return t}function f(t,e,n,s,a,f,d){if(n=c(n,"N"),s=c(s,"r"),a=c(a,"p"),f=c(f,"dkLen"),0===n||0!=(n&n-1))throw new Error("N must be power of 2");if(n>r/128/s)throw new Error("N too large");if(s>r/128/a)throw new Error("r too large");if(!h(t))throw new Error("password must be an array or buffer");if(t=Array.prototype.slice.call(t),!h(e))throw new Error("salt must be an array or buffer");e=Array.prototype.slice.call(e);let p=i(t,e,128*a*s);const m=new Uint32Array(32*a*s);for(let t=0;tR&&(e=R);for(let t=0;tR&&(e=R);for(let t=0;t>0&255),p.push(m[t]>>8&255),p.push(m[t]>>16&255),p.push(m[t]>>24&255);const r=i(t,p,f);return d&&d(null,1,r),r}d&&x(O)};if(!d)for(;;){const t=O();if(null!=t)return t}O()}const d={scrypt:function(t,e,r,n,i,o,s){return new Promise((function(a,u){let l=0;s&&s(0),f(t,e,r,n,i,o,(function(t,e,r){if(t)u(t);else if(r)s&&1!==l&&s(1),a(new Uint8Array(r));else if(s&&e!==l)return l=e,s(e)}))}))},syncScrypt:function(t,e,r,n,i,o){return new Uint8Array(f(t,e,r,n,i,o))}};t.exports=d}()},2156:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ParsedMessage=void 0;const i=n(r(5528)),o=n(r(8737));e.ParsedMessage=class{constructor(t){const e=new i.default('\nsign-in-with-ethereum =\n domain %s" wants you to sign in with your Ethereum account:" LF\n address LF\n LF\n [ statement LF ]\n LF\n %s"URI: " URI LF\n %s"Version: " version LF\n %s"Chain ID: " chain-id LF\n %s"Nonce: " nonce LF\n %s"Issued At: " issued-at\n [ LF %s"Expiration Time: " expiration-time ]\n [ LF %s"Not Before: " not-before ]\n [ LF %s"Request ID: " request-id ]\n [ LF %s"Resources:"\n resources ]\n\ndomain = authority\n\naddress = "0x" 40*40HEXDIG\n ; Must also conform to captilization\n ; checksum encoding specified in EIP-55\n ; where applicable (EOAs).\n\nstatement = *( reserved / unreserved / " " )\n ; The purpose is to exclude LF (line breaks).\n\nversion = "1"\n\nnonce = 8*( ALPHA / DIGIT )\n\nissued-at = date-time\nexpiration-time = date-time\nnot-before = date-time\n\nrequest-id = *pchar\n\nchain-id = 1*DIGIT\n ; See EIP-155 for valid CHAIN_IDs.\n\nresources = *( LF resource )\n\nresource = "- " URI\n\n; ------------------------------------------------------------------------------\n; RFC 3986\n\nURI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]\n\nhier-part = "//" authority path-abempty\n / path-absolute\n / path-rootless\n / path-empty\n\nscheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )\n\nauthority = [ userinfo "@" ] host [ ":" port ]\nuserinfo = *( unreserved / pct-encoded / sub-delims / ":" )\nhost = IP-literal / IPv4address / reg-name\nport = *DIGIT\n\nIP-literal = "[" ( IPv6address / IPvFuture ) "]"\n\nIPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )\n\nIPv6address = 6( h16 ":" ) ls32\n / "::" 5( h16 ":" ) ls32\n / [ h16 ] "::" 4( h16 ":" ) ls32\n / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32\n / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32\n / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32\n / [ *4( h16 ":" ) h16 ] "::" ls32\n / [ *5( h16 ":" ) h16 ] "::" h16\n / [ *6( h16 ":" ) h16 ] "::"\n\nh16 = 1*4HEXDIG\nls32 = ( h16 ":" h16 ) / IPv4address\nIPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet\ndec-octet = DIGIT ; 0-9\n / %x31-39 DIGIT ; 10-99\n / "1" 2DIGIT ; 100-199\n / "2" %x30-34 DIGIT ; 200-249\n / "25" %x30-35 ; 250-255\n\nreg-name = *( unreserved / pct-encoded / sub-delims )\n\npath-abempty = *( "/" segment )\npath-absolute = "/" [ segment-nz *( "/" segment ) ]\npath-rootless = segment-nz *( "/" segment )\npath-empty = 0pchar\n\nsegment = *pchar\nsegment-nz = 1*pchar\n\npchar = unreserved / pct-encoded / sub-delims / ":" / "@"\n\nquery = *( pchar / "/" / "?" )\n\nfragment = *( pchar / "/" / "?" )\n\npct-encoded = "%" HEXDIG HEXDIG\n\nunreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"\nreserved = gen-delims / sub-delims\ngen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"\nsub-delims = "!" / "$" / "&" / "\'" / "(" / ")"\n / "*" / "+" / "," / ";" / "="\n\n; ------------------------------------------------------------------------------\n; RFC 3339\n\ndate-fullyear = 4DIGIT\ndate-month = 2DIGIT ; 01-12\ndate-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on\n ; month/year\ntime-hour = 2DIGIT ; 00-23\ntime-minute = 2DIGIT ; 00-59\ntime-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second\n ; rules\ntime-secfrac = "." 1*DIGIT\ntime-numoffset = ("+" / "-") time-hour ":" time-minute\ntime-offset = "Z" / time-numoffset\n\npartial-time = time-hour ":" time-minute ":" time-second\n [time-secfrac]\nfull-date = date-fullyear "-" date-month "-" date-mday\nfull-time = partial-time time-offset\n\ndate-time = full-date "T" full-time\n\n; ------------------------------------------------------------------------------\n; RFC 5234\n\nALPHA = %x41-5A / %x61-7A ; A-Z / a-z\nLF = %x0A\n ; linefeed\nDIGIT = %x30-39\n ; 0-9\nHEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n');if(e.generate(),e.errors.length)throw console.error(e.errorsToAscii()),console.error(e.linesToAscii()),console.log(e.displayAttributeErrors()),new Error("ABNF grammar has errors");const r=e.toObject(),n=new o.default.parser;n.ast=new o.default.ast;const s=o.default.ids;n.ast.callbacks.domain=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.domain=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks.address=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.address=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks.statement=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.statement=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks.uri=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.uri||(i.uri=o.default.utils.charsToString(e,r,n))),a},n.ast.callbacks.version=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.version=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks["chain-id"]=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.chainId=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks.nonce=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.nonce=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks["issued-at"]=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.issuedAt=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks["expiration-time"]=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.expirationTime=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks["not-before"]=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.notBefore=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks["request-id"]=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.requestId=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks.resources=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.resources=o.default.utils.charsToString(e,r,n).slice(3).split("\n- ")),a};const a=n.parse(r,"sign-in-with-ethereum",t);if(!a.success)throw new Error(`Invalid message: ${JSON.stringify(a)}`);const u={};n.ast.translate(u);for(const[t,e]of Object.entries(u))this[t]=e}}},7956:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.generateNonce=e.checkContractWalletSignature=e.SiweMessage=e.SignatureType=e.ErrorTypes=void 0;const i=r(1416),o=r(9954),s=r(2156),a=r(3270);var u;!function(t){t.INVALID_SIGNATURE="Invalid signature.",t.EXPIRED_MESSAGE="Expired message.",t.MALFORMED_SESSION="Malformed session."}(u=e.ErrorTypes||(e.ErrorTypes={})),(e.SignatureType||(e.SignatureType={})).PERSONAL_SIGNATURE="Personal signature";class l{constructor(t){if("string"==typeof t){const e=new s.ParsedMessage(t);this.domain=e.domain,this.address=e.address,this.statement=e.statement,this.uri=e.uri,this.version=e.version,this.nonce=e.nonce,this.issuedAt=e.issuedAt,this.expirationTime=e.expirationTime,this.notBefore=e.notBefore,this.requestId=e.requestId,this.chainId=e.chainId,this.resources=e.resources}else Object.assign(this,t)}regexFromMessage(t){return new a.ParsedMessage(t).match}toMessage(){const t=`${this.domain} wants you to sign in with your Ethereum account:`,r=`URI: ${this.uri}`;let n=[t,this.address].join("\n");const i=`Version: ${this.version}`;this.nonce||(this.nonce=(0,e.generateNonce)());const o=[r,i,"Chain ID: "+this.chainId||0,`Nonce: ${this.nonce}`];if(this.issuedAt&&Date.parse(this.issuedAt),this.issuedAt=this.issuedAt?this.issuedAt:(new Date).toISOString(),o.push(`Issued At: ${this.issuedAt}`),this.expirationTime){const t=`Expiration Time: ${this.expirationTime}`;o.push(t)}this.notBefore&&o.push(`Not Before: ${this.notBefore}`),this.requestId&&o.push(`Request ID: ${this.requestId}`),this.resources&&o.push(["Resources:",...this.resources.map((t=>`- ${t}`))].join("\n"));let s=o.join("\n");return this.statement&&(n=[n,this.statement].join("\n\n")),[n,s].join("\n\n")}signMessage(){return console&&console.warn&&console.warn("signMessage method is deprecated, use prepareMessage instead."),this.prepareMessage()}prepareMessage(){let t;return this.version,t=this.toMessage(),t}validate(t=this.signature,r){return n(this,void 0,void 0,(function*(){return new Promise(((i,s)=>n(this,void 0,void 0,(function*(){const n=this.prepareMessage();try{let s=[];if(n||s.push("`message`"),t||s.push("`signature`"),this.address||s.push("`address`"),s.length>0)throw new Error(`${u.MALFORMED_SESSION} missing: ${s.join(", ")}.`);const a=o.ethers.utils.verifyMessage(n,t);if(a!==this.address)try{if(!(yield(0,e.checkContractWalletSignature)(this,r)))throw new Error(`${u.INVALID_SIGNATURE}: ${a} !== ${this.address}`)}catch(t){throw t}const h=new l(n);if(h.expirationTime){const t=new Date(h.expirationTime).getTime();if(isNaN(t))throw new Error(`${u.MALFORMED_SESSION} invalid expiration date.`);if((new Date).getTime()>=t)throw new Error(u.EXPIRED_MESSAGE)}i(h)}catch(t){s(t)}}))))}))}}e.SiweMessage=l,e.checkContractWalletSignature=(t,e)=>n(void 0,void 0,void 0,(function*(){if(!e)return!1;const r=["function isValidSignature(bytes32 _message, bytes _signature) public view returns (bool)"];try{const n=new o.Contract(t.address,r,e),i=o.utils.hashMessage(t.signMessage());return yield n.isValidSignature(i,t.signature)}catch(t){throw t}})),e.generateNonce=()=>(0,i.randomStringForEntropy)(96)},3270:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ParsedMessage=void 0;const r="(([^:?#]+):)?(([^?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))",n="([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(.[0-9]+)?(([Zz])|([+|-]([01][0-9]|2[0-3]):[0-5][0-9]))",i=`^(?([^?#]*)) wants you to sign in with your Ethereum account:\\n(?
0x[a-zA-Z0-9]{40})\\n\\n((?[^\\n]+)\\n)?\\nURI: (?${r}?)\\nVersion: (?1)\\nChain ID: (?[0-9]+)\\nNonce: (?[a-zA-Z0-9]{8,})\\nIssued At: (?${n})(\\nExpiration Time: (?${n}))?(\\nNot Before: (?${n}))?(\\nRequest ID: (?[-._~!$&'()*+,;=:@%a-zA-Z0-9]*))?(\\nResources:(?(\\n- ${r}?)+))?$`;e.ParsedMessage=class{constructor(t){var e,r,n,o,s,a,u,l,h,c,f,d,p;let m=new RegExp(i,"g").exec(t);if(!m)throw new Error("Message did not match the regular expression.");this.match=m,this.domain=null===(e=null==m?void 0:m.groups)||void 0===e?void 0:e.domain,this.address=null===(r=null==m?void 0:m.groups)||void 0===r?void 0:r.address,this.statement=null===(n=null==m?void 0:m.groups)||void 0===n?void 0:n.statement,this.uri=null===(o=null==m?void 0:m.groups)||void 0===o?void 0:o.uri,this.version=null===(s=null==m?void 0:m.groups)||void 0===s?void 0:s.version,this.nonce=null===(a=null==m?void 0:m.groups)||void 0===a?void 0:a.nonce,this.chainId=null===(u=null==m?void 0:m.groups)||void 0===u?void 0:u.chainId,this.issuedAt=null===(l=null==m?void 0:m.groups)||void 0===l?void 0:l.issuedAt,this.expirationTime=null===(h=null==m?void 0:m.groups)||void 0===h?void 0:h.expirationTime,this.notBefore=null===(c=null==m?void 0:m.groups)||void 0===c?void 0:c.notBefore,this.requestId=null===(f=null==m?void 0:m.groups)||void 0===f?void 0:f.requestId,this.resources=null===(p=null===(d=null==m?void 0:m.groups)||void 0===d?void 0:d.resources)||void 0===p?void 0:p.split("\n- ").slice(1)}}},7544:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(7956),e)},9954:(t,e,r)=>{"use strict";r.r(e),r.d(e,{BaseContract:()=>I,BigNumber:()=>d.O$,Contract:()=>C,ContractFactory:()=>P,FixedNumber:()=>L.xs,Signer:()=>c.E,VoidSigner:()=>c.b,Wallet:()=>$,Wordlist:()=>nr.D,constants:()=>n,errors:()=>v.jK,ethers:()=>a,getDefaultProvider:()=>er,logger:()=>Gr,providers:()=>i,utils:()=>s,version:()=>Fr,wordlists:()=>rr.E});var n={};r.r(n),r.d(n,{AddressZero:()=>Y.d,EtherSymbol:()=>Z,HashZero:()=>X.R,MaxInt256:()=>J.PS,MaxUint256:()=>J.Bz,MinInt256:()=>J.$B,NegativeOne:()=>J.tL,One:()=>J.fh,Two:()=>J.Py,WeiPerEther:()=>J.Ce,Zero:()=>J._Y});var i={};r.r(i),r.d(i,{AlchemyProvider:()=>le,AlchemyWebSocketProvider:()=>ue,AnkrProvider:()=>de,BaseProvider:()=>Dt,CloudflareProvider:()=>me,EtherscanProvider:()=>Ae,FallbackProvider:()=>De,Formatter:()=>ht,InfuraProvider:()=>ze,InfuraWebSocketProvider:()=>qe,IpcProvider:()=>Fe,JsonRpcBatchProvider:()=>Ke,JsonRpcProvider:()=>Xt,JsonRpcSigner:()=>Wt,NodesmithProvider:()=>$e,PocketProvider:()=>Ye,Provider:()=>h.zt,Resolver:()=>Lt,StaticJsonRpcProvider:()=>ie,UrlJsonRpcProvider:()=>oe,Web3Provider:()=>Qe,WebSocketProvider:()=>re,getDefaultProvider:()=>er,getNetwork:()=>Q.H,isCommunityResourcable:()=>ct,isCommunityResource:()=>ft,showThrottleMessage:()=>pt});var o={};r.r(o),r.d(o,{decode:()=>tt.J,encode:()=>tt.c});var s={};r.r(s),r.d(s,{AbiCoder:()=>ir.R,ConstructorFragment:()=>or.Xg,ErrorFragment:()=>or.IC,EventFragment:()=>or.QV,FormatTypes:()=>or.pc,Fragment:()=>or.HY,FunctionFragment:()=>or.YW,HDNode:()=>D.m$,Indexed:()=>l.Hk,Interface:()=>l.vU,LogDescription:()=>l.CC,Logger:()=>v.Yd,ParamType:()=>or._R,RLP:()=>vr,SigningKey:()=>j.Et,SupportedAlgorithm:()=>Dr.p,TransactionDescription:()=>l.vk,TransactionTypes:()=>g.em,UnicodeNormalizationForm:()=>it.Uj,Utf8ErrorFuncs:()=>it.te,Utf8ErrorReason:()=>it.Uw,_TypedDataEncoder:()=>B.E,_fetchData:()=>ot.MY,_toEscapedUtf8String:()=>it.U$,accessListify:()=>g.z7,arrayify:()=>p.lE,base58:()=>et.eU,base64:()=>o,checkProperties:()=>m.uj,checkResultErrors:()=>u.BR,commify:()=>Cr,computeAddress:()=>g.db,computeHmac:()=>nt.Gy,computePublicKey:()=>j.VW,concat:()=>p.zo,deepCopy:()=>m.p$,defaultAbiCoder:()=>ir.$,defaultPath:()=>D.cD,defineReadOnly:()=>m.zG,dnsEncode:()=>rt.Kn,entropyToMnemonic:()=>D.JJ,fetchJson:()=>ot.rd,formatBytes32String:()=>Rr,formatEther:()=>Ur,formatUnits:()=>Pr,getAccountPath:()=>D.ny,getAddress:()=>f.Kn,getContractAddress:()=>f.CR,getCreate2Address:()=>f.hB,getIcapAddress:()=>f.vU,getJsonWalletAddress:()=>ar.Rb,getStatic:()=>m.tu,hashMessage:()=>U.r,hexConcat:()=>p.xs,hexDataLength:()=>p.E1,hexDataSlice:()=>p.p3,hexStripZeros:()=>p.Ou,hexValue:()=>p.$P,hexZeroPad:()=>p.$m,hexlify:()=>p.Dv,id:()=>sr.id,isAddress:()=>f.UJ,isBytes:()=>p._t,isBytesLike:()=>p.Zq,isHexString:()=>p.A7,isValidMnemonic:()=>D.xh,isValidName:()=>rt.r1,joinSignature:()=>p.gV,keccak256:()=>F.w,mnemonicToEntropy:()=>D.oy,mnemonicToSeed:()=>D.OI,namehash:()=>rt.VM,nameprep:()=>kr,parseBytes32String:()=>xr,parseEther:()=>Br,parseTransaction:()=>g.Qc,parseUnits:()=>Lr,poll:()=>ot.$l,randomBytes:()=>G.O,recoverAddress:()=>g.RJ,recoverPublicKey:()=>j.LO,resolveProperties:()=>m.mE,ripemd160:()=>nt.bP,serializeTransaction:()=>g.qC,sha256:()=>nt.JQ,sha512:()=>nt.o,shallowCopy:()=>m.DC,shuffled:()=>_e.y,solidityKeccak256:()=>mr,solidityPack:()=>pr,soliditySha256:()=>gr,splitSignature:()=>p.N,stripZeros:()=>p.G1,toUtf8Bytes:()=>it.Y0,toUtf8CodePoints:()=>it.XL,toUtf8String:()=>it.ZN,verifyMessage:()=>V,verifyTypedData:()=>W,zeroPad:()=>p.Bu});var a={};r.r(a),r.d(a,{BaseContract:()=>I,BigNumber:()=>d.O$,Contract:()=>C,ContractFactory:()=>P,FixedNumber:()=>L.xs,Signer:()=>c.E,VoidSigner:()=>c.b,Wallet:()=>$,Wordlist:()=>nr.D,constants:()=>n,errors:()=>v.jK,getDefaultProvider:()=>er,logger:()=>Gr,providers:()=>i,utils:()=>s,version:()=>Fr,wordlists:()=>rr.E});var u=r(1184),l=r(8198),h=r(4353),c=r(8171),f=r(4594),d=r(2593),p=r(3286),m=r(3587),g=r(4377),v=r(711),y=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const b=new v.Yd("contracts/5.7.0"),w={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0,ccipReadEnabled:!0};function E(t,e){return y(this,void 0,void 0,(function*(){const r=yield e;"string"!=typeof r&&b.throwArgumentError("invalid address or ENS name","name",r);try{return(0,f.Kn)(r)}catch(t){}t||b.throwError("a provider or signer is needed to resolve ENS names",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return null==n&&b.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n}))}function M(t,e,r){return y(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,n)=>M(t,Array.isArray(e)?e[n]:e[r.name],r)))):"address"===r.type?yield E(t,e):"tuple"===r.type?yield M(t,e,r.components):"array"===r.baseType?Array.isArray(e)?yield Promise.all(e.map((e=>M(t,e,r.arrayChildren)))):Promise.reject(b.makeError("invalid value for array",v.Yd.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e}))}function A(t,e,r){return y(this,void 0,void 0,(function*(){let n={};r.length===e.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=(0,m.DC)(r.pop())),b.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=(0,m.mE)({override:E(t.signer,n.from),signer:t.signer.getAddress()}).then((t=>y(this,void 0,void 0,(function*(){return(0,f.Kn)(t.signer)!==t.override&&b.throwError("Contract with a Signer cannot override from",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})))):n.from=t.signer.getAddress():n.from&&(n.from=E(t.provider,n.from));const i=yield(0,m.mE)({args:M(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:(0,m.mE)(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},a=i.overrides;if(null!=a.nonce&&(s.nonce=d.O$.from(a.nonce).toNumber()),null!=a.gasLimit&&(s.gasLimit=d.O$.from(a.gasLimit)),null!=a.gasPrice&&(s.gasPrice=d.O$.from(a.gasPrice)),null!=a.maxFeePerGas&&(s.maxFeePerGas=d.O$.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(s.maxPriorityFeePerGas=d.O$.from(a.maxPriorityFeePerGas)),null!=a.from&&(s.from=a.from),null!=a.type&&(s.type=a.type),null!=a.accessList&&(s.accessList=(0,g.z7)(a.accessList)),null==s.gasLimit&&null!=e.gas){let t=21e3;const r=(0,p.lE)(o);for(let e=0;enull!=n[t]));return u.length&&b.throwError(`cannot override ${u.map((t=>JSON.stringify(t))).join(",")}`,v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),s}))}function _(t,e){const r=e.wait.bind(e);e.wait=e=>r(e).then((e=>(e.events=e.logs.map((r=>{let n=(0,m.p$)(r),i=null;try{i=t.interface.parseLog(r)}catch(t){}return i&&(n.args=i.args,n.decode=(e,r)=>t.interface.decodeEventLog(i.eventFragment,e,r),n.event=i.name,n.eventSignature=i.signature),n.removeListener=()=>t.provider,n.getBlock=()=>t.provider.getBlock(e.blockHash),n.getTransaction=()=>t.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(e),n})),e)))}function N(t,e,r){const n=t.signer||t.provider;return function(...i){return y(this,void 0,void 0,(function*(){let o;if(i.length===e.inputs.length+1&&"object"==typeof i[i.length-1]){const t=(0,m.DC)(i.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,i.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const s=yield A(t,e,i),a=yield n.call(s,o);try{let n=t.interface.decodeFunctionResult(e,a);return r&&1===e.outputs.length&&(n=n[0]),n}catch(e){throw e.code===v.Yd.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=i,e.transaction=s),e}}))}}function S(t,e,r){return e.constant?N(t,e,r):function(t,e){return function(...r){return y(this,void 0,void 0,(function*(){t.signer||b.throwError("sending a transaction requires a signer",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const n=yield A(t,e,r),i=yield t.signer.sendTransaction(n);return _(t,i),i}))}}(t,e)}function T(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map((t=>Array.isArray(t)?t.join("|"):t)).join(":"):""):"*"}class k{constructor(t,e){(0,m.zG)(this,"tag",t),(0,m.zG)(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter((r=>!(!e&&r.listener===t&&(e=!0,1))))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((t=>t.listener))}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter((e=>{const r=t.slice();return setTimeout((()=>{e.listener.apply(this,r)}),0),!e.once})),e}prepareEvent(t){}getEmit(t){return[t]}}class R extends k{constructor(){super("error",null)}}class x extends k{constructor(t,e,r,n){const i={address:t};let o=e.getEventTopic(r);n?(o!==n[0]&&b.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[o],super(T(i),i),(0,m.zG)(this,"address",t),(0,m.zG)(this,"interface",e),(0,m.zG)(this,"fragment",r)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=(0,u.BR)(t.args);if(e.length)throw e[0].error;const r=(t.args||[]).slice();return r.push(t),r}}class O extends k{constructor(t,e){super("*",{address:t}),(0,m.zG)(this,"address",t),(0,m.zG)(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,r)=>this.interface.decodeEventLog(e.eventFragment,t,r),t.args=e.args}catch(t){}}}class I{constructor(t,e,r){(0,m.zG)(this,"interface",(0,m.tu)(new.target,"getInterface")(e)),null==r?((0,m.zG)(this,"provider",null),(0,m.zG)(this,"signer",null)):c.E.isSigner(r)?((0,m.zG)(this,"provider",r.provider||null),(0,m.zG)(this,"signer",r)):h.zt.isProvider(r)?((0,m.zG)(this,"provider",r),(0,m.zG)(this,"signer",null)):b.throwArgumentError("invalid signer or provider","signerOrProvider",r),(0,m.zG)(this,"callStatic",{}),(0,m.zG)(this,"estimateGas",{}),(0,m.zG)(this,"functions",{}),(0,m.zG)(this,"populateTransaction",{}),(0,m.zG)(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach((e=>{const r=this.interface.events[e];(0,m.zG)(this.filters,e,((...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,t)}))),t[r.name]||(t[r.name]=[]),t[r.name].push(e)})),Object.keys(t).forEach((e=>{const r=t[e];1===r.length?(0,m.zG)(this.filters,e,this.filters[r[0]]):b.warn(`Duplicate definition of ${e} (${r.join(", ")})`)}))}if((0,m.zG)(this,"_runningEvents",{}),(0,m.zG)(this,"_wrappedEmits",{}),null==t&&b.throwArgumentError("invalid contract address or ENS name","addressOrName",t),(0,m.zG)(this,"address",t),this.provider)(0,m.zG)(this,"resolvedAddress",E(this.provider,t));else try{(0,m.zG)(this,"resolvedAddress",Promise.resolve((0,f.Kn)(t)))}catch(t){b.throwError("provider is required to use ENS name as contract address",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((t=>{}));const n={},i={};Object.keys(this.interface.functions).forEach((t=>{const e=this.interface.functions[t];if(i[t])b.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{i[t]=!0;{const r=e.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(t)}null==this[t]&&(0,m.zG)(this,t,S(this,e,!0)),null==this.functions[t]&&(0,m.zG)(this.functions,t,S(this,e,!1)),null==this.callStatic[t]&&(0,m.zG)(this.callStatic,t,N(this,e,!0)),null==this.populateTransaction[t]&&(0,m.zG)(this.populateTransaction,t,function(t,e){return function(...r){return A(t,e,r)}}(this,e)),null==this.estimateGas[t]&&(0,m.zG)(this.estimateGas,t,function(t,e){const r=t.signer||t.provider;return function(...n){return y(this,void 0,void 0,(function*(){r||b.throwError("estimate require a provider or signer",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield A(t,e,n);return yield r.estimateGas(i)}))}}(this,e))}})),Object.keys(n).forEach((t=>{const e=n[t];if(e.length>1)return;t=t.substring(1);const r=e[0];try{null==this[t]&&(0,m.zG)(this,t,this[r])}catch(t){}null==this.functions[t]&&(0,m.zG)(this.functions,t,this.functions[r]),null==this.callStatic[t]&&(0,m.zG)(this.callStatic,t,this.callStatic[r]),null==this.populateTransaction[t]&&(0,m.zG)(this.populateTransaction,t,this.populateTransaction[r]),null==this.estimateGas[t]&&(0,m.zG)(this.estimateGas,t,this.estimateGas[r])}))}static getContractAddress(t){return(0,f.CR)(t)}static getInterface(t){return l.vU.isInterface(t)?t:new l.vU(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,t).then((t=>("0x"===t&&b.throwError("contract not deployed",v.Yd.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(t){this.signer||b.throwError("sending a transactions require a signer",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=(0,m.DC)(t||{});return["from","to"].forEach((function(t){null!=e[t]&&b.throwError("cannot override "+t,v.Yd.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(e)))}connect(t){"string"==typeof t&&(t=new c.b(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&(0,m.zG)(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return l.Hk.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new R);if("event"===t)return this._normalizeRunningEvent(new k("event",null));if("*"===t)return this._normalizeRunningEvent(new O(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new x(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new x(this.address,this.interface,r,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new k(T(e),e))}return this._normalizeRunningEvent(new O(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,r){const n=(0,m.p$)(e);return n.removeListener=()=>{r&&(t.removeListener(r),this._checkRunningEvents(t))},n.getBlock=()=>this.provider.getBlock(e.blockHash),n.getTransaction=()=>this.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(n),n}_addEventListener(t,e,r){if(this.provider||b.throwError("events require a provider or a signer with a provider",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,r),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const r=r=>{let n=this._wrapEvent(t,r,e);if(null==n.decodeError)try{const e=t.getEmit(n);this.emit(t.filter,...e)}catch(t){n.decodeError=t.error}null!=t.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[t.tag]=r,null!=t.filter&&this.provider.on(t.filter,r)}}queryFilter(t,e,r){const n=this._getRunningEvent(t),i=(0,m.DC)(n.filter);return"string"==typeof e&&(0,p.A7)(e,32)?(null!=r&&b.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=e):(i.fromBlock=null!=e?e:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then((t=>t.map((t=>this._wrapEvent(n,t,null)))))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const r=this._getRunningEvent(t),n=r.run(e)>0;return this._checkRunningEvents(r),n}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce(((t,e)=>t+this._runningEvents[e].listenerCount()),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach((e=>{t.push(e)}));return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const r=this._getRunningEvent(t);return r.removeListener(e),this._checkRunningEvents(r),this}removeListener(t,e){return this.off(t,e)}}class C extends I{}class P{constructor(t,e,r){let n=null;n="string"==typeof e?e:(0,p._t)(e)?(0,p.Dv)(e):e&&"string"==typeof e.object?e.object:"!","0x"!==n.substring(0,2)&&(n="0x"+n),(!(0,p.A7)(n)||n.length%2)&&b.throwArgumentError("invalid bytecode","bytecode",e),r&&!c.E.isSigner(r)&&b.throwArgumentError("invalid signer","signer",r),(0,m.zG)(this,"bytecode",n),(0,m.zG)(this,"interface",(0,m.tu)(new.target,"getInterface")(t)),(0,m.zG)(this,"signer",r||null)}getDeployTransaction(...t){let e={};if(t.length===this.interface.deploy.inputs.length+1&&"object"==typeof t[t.length-1]){e=(0,m.DC)(t.pop());for(const t in e)if(!w[t])throw new Error("unknown transaction override "+t)}return["data","from","to"].forEach((t=>{null!=e[t]&&b.throwError("cannot override "+t,v.Yd.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.value&&(d.O$.from(e.value).isZero()||this.interface.deploy.payable||b.throwError("non-payable constructor cannot override value",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:e.value})),b.checkArgumentCount(t.length,this.interface.deploy.inputs.length," in Contract constructor"),e.data=(0,p.Dv)((0,p.zo)([this.bytecode,this.interface.encodeDeploy(t)])),e}deploy(...t){return y(this,void 0,void 0,(function*(){let e={};t.length===this.interface.deploy.inputs.length+1&&(e=t.pop()),b.checkArgumentCount(t.length,this.interface.deploy.inputs.length," in Contract constructor");const r=yield M(this.signer,t,this.interface.deploy.inputs);r.push(e);const n=this.getDeployTransaction(...r),i=yield this.signer.sendTransaction(n),o=(0,m.tu)(this.constructor,"getContractAddress")(i),s=(0,m.tu)(this.constructor,"getContract")(o,this.interface,this.signer);return _(s,i),(0,m.zG)(s,"deployTransaction",i),s}))}attach(t){return this.constructor.getContract(t,this.interface,this.signer)}connect(t){return new this.constructor(this.interface,this.bytecode,t)}static fromSolidity(t,e){null==t&&b.throwError("missing compiler output",v.Yd.errors.MISSING_ARGUMENT,{argument:"compilerOutput"}),"string"==typeof t&&(t=JSON.parse(t));const r=t.abi;let n=null;return t.bytecode?n=t.bytecode:t.evm&&t.evm.bytecode&&(n=t.evm.bytecode),new this(r,n,e)}static getInterface(t){return C.getInterface(t)}static getContractAddress(t){return(0,f.CR)(t)}static getContract(t,e,r){return new C(t,e,r)}}var L=r(335),U=r(3684),B=r(7827),D=r(6274),F=r(8197),G=r(4478),j=r(2768),q=r(1964),z=r(9380),K=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const H=new v.Yd("wallet/5.7.0");class $ extends c.E{constructor(t,e){if(super(),null!=(r=t)&&(0,p.A7)(r.privateKey,32)&&null!=r.address){const e=new j.Et(t.privateKey);if((0,m.zG)(this,"_signingKey",(()=>e)),(0,m.zG)(this,"address",(0,g.db)(this.publicKey)),this.address!==(0,f.Kn)(t.address)&&H.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(t){const e=t.mnemonic;return e&&e.phrase}(t)){const e=t.mnemonic;(0,m.zG)(this,"_mnemonic",(()=>({phrase:e.phrase,path:e.path||D.cD,locale:e.locale||"en"})));const r=this.mnemonic,n=D.m$.fromMnemonic(r.phrase,null,r.locale).derivePath(r.path);(0,g.db)(n.privateKey)!==this.address&&H.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else(0,m.zG)(this,"_mnemonic",(()=>null))}else{if(j.Et.isSigningKey(t))"secp256k1"!==t.curve&&H.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),(0,m.zG)(this,"_signingKey",(()=>t));else{"string"==typeof t&&t.match(/^[0-9a-f]*$/i)&&64===t.length&&(t="0x"+t);const e=new j.Et(t);(0,m.zG)(this,"_signingKey",(()=>e))}(0,m.zG)(this,"_mnemonic",(()=>null)),(0,m.zG)(this,"address",(0,g.db)(this.publicKey))}var r;e&&!h.zt.isProvider(e)&&H.throwArgumentError("invalid provider","provider",e),(0,m.zG)(this,"provider",e||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(t){return new $(this,t)}signTransaction(t){return(0,m.mE)(t).then((e=>{null!=e.from&&((0,f.Kn)(e.from)!==this.address&&H.throwArgumentError("transaction from address mismatch","transaction.from",t.from),delete e.from);const r=this._signingKey().signDigest((0,F.w)((0,g.qC)(e)));return(0,g.qC)(e,r)}))}signMessage(t){return K(this,void 0,void 0,(function*(){return(0,p.gV)(this._signingKey().signDigest((0,U.r)(t)))}))}_signTypedData(t,e,r){return K(this,void 0,void 0,(function*(){const n=yield B.E.resolveNames(t,e,r,(t=>(null==this.provider&&H.throwError("cannot resolve ENS names without a provider",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:t}),this.provider.resolveName(t))));return(0,p.gV)(this._signingKey().signDigest(B.E.hash(n.domain,e,n.value)))}))}encrypt(t,e,r){if("function"!=typeof e||r||(r=e,e={}),r&&"function"!=typeof r)throw new Error("invalid callback");return e||(e={}),(0,q.HI)(this,t,e,r)}static createRandom(t){let e=(0,G.O)(16);t||(t={}),t.extraEntropy&&(e=(0,p.lE)((0,p.p3)((0,F.w)((0,p.zo)([e,t.extraEntropy])),0,16)));const r=(0,D.JJ)(e,t.locale);return $.fromMnemonic(r,t.path,t.locale)}static fromEncryptedJson(t,e,r){return(0,z.w)(t,e,r).then((t=>new $(t)))}static fromEncryptedJsonSync(t,e){return new $((0,z.qz)(t,e))}static fromMnemonic(t,e,r){return e||(e=D.cD),new $(D.m$.fromMnemonic(t,null,r).derivePath(e))}}function V(t,e){return(0,g.RJ)((0,U.r)(t),e)}function W(t,e,r,n){return(0,g.RJ)(B.E.hash(t,e,r),n)}var Y=r(9279),J=r(1046),X=r(7218);const Z="Ξ";var Q=r(9861),tt=r(9567),et=r(7727),rt=r(8339),nt=r(3951),it=r(4242),ot=r(8341),st=r(2882),at=r.n(st);const ut="providers/5.7.2",lt=new v.Yd(ut);class ht{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),r=this.bigNumber.bind(this),n=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),s=this.hex.bind(this),a=this.number.bind(this),u=this.type.bind(this);return t.transaction={hash:o,type:u,accessList:ht.allowNull(this.accessList.bind(this),null),blockHash:ht.allowNull(o,null),blockNumber:ht.allowNull(a,null),transactionIndex:ht.allowNull(a,null),confirmations:ht.allowNull(a,null),from:e,gasPrice:ht.allowNull(r),maxPriorityFeePerGas:ht.allowNull(r),maxFeePerGas:ht.allowNull(r),gasLimit:r,to:ht.allowNull(e,null),value:r,nonce:a,data:i,r:ht.allowNull(this.uint256),s:ht.allowNull(this.uint256),v:ht.allowNull(a),creates:ht.allowNull(e,null),raw:ht.allowNull(i)},t.transactionRequest={from:ht.allowNull(e),nonce:ht.allowNull(a),gasLimit:ht.allowNull(r),gasPrice:ht.allowNull(r),maxPriorityFeePerGas:ht.allowNull(r),maxFeePerGas:ht.allowNull(r),to:ht.allowNull(e),value:ht.allowNull(r),data:ht.allowNull((t=>this.data(t,!0))),type:ht.allowNull(a),accessList:ht.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:o,address:e,topics:ht.arrayOf(o),data:i,logIndex:a,blockHash:o},t.receipt={to:ht.allowNull(this.address,null),from:ht.allowNull(this.address,null),contractAddress:ht.allowNull(e,null),transactionIndex:a,root:ht.allowNull(s),gasUsed:r,logsBloom:ht.allowNull(i),blockHash:o,transactionHash:o,logs:ht.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:ht.allowNull(a,null),cumulativeGasUsed:r,effectiveGasPrice:ht.allowNull(r),status:ht.allowNull(a),type:u},t.block={hash:ht.allowNull(o),parentHash:o,number:a,timestamp:a,nonce:ht.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:ht.allowNull(e),extraData:i,transactions:ht.allowNull(ht.arrayOf(o)),baseFeePerGas:ht.allowNull(r)},t.blockWithTransactions=(0,m.DC)(t.block),t.blockWithTransactions.transactions=ht.allowNull(ht.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:ht.allowNull(n,void 0),toBlock:ht.allowNull(n,void 0),blockHash:ht.allowNull(o,void 0),address:ht.allowNull(e,void 0),topics:ht.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:ht.allowNull(a),blockHash:ht.allowNull(o),transactionIndex:a,removed:ht.allowNull(this.boolean.bind(this)),address:e,data:ht.allowFalsish(i,"0x"),topics:ht.arrayOf(o),transactionHash:o,logIndex:a},t}accessList(t){return(0,g.z7)(t||[])}number(t){return"0x"===t?0:d.O$.from(t).toNumber()}type(t){return"0x"===t||null==t?0:d.O$.from(t).toNumber()}bigNumber(t){return d.O$.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),(0,p.A7)(t))?t.toLowerCase():lt.throwArgumentError("invalid hash","value",t)}data(t,e){const r=this.hex(t,e);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+t);return r}address(t){return(0,f.Kn)(t)}callAddress(t){if(!(0,p.A7)(t,32))return null;const e=(0,f.Kn)((0,p.p3)(t,12));return e===Y.d?null:e}contractAddress(t){return(0,f.CR)(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";switch(t){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return t}if("number"==typeof t||(0,p.A7)(t))return(0,p.$P)(t);throw new Error("invalid blockTag")}hash(t,e){const r=this.hex(t,e);return 32!==(0,p.E1)(r)?lt.throwArgumentError("invalid hash","value",t):r}difficulty(t){if(null==t)return null;const e=d.O$.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!(0,p.A7)(t))throw new Error("invalid uint256");return(0,p.$m)(t,32)}_block(t,e){null!=t.author&&null==t.miner&&(t.miner=t.author);const r=null!=t._difficulty?t._difficulty:t.difficulty,n=ht.check(e,t);return n._difficulty=null==r?null:d.O$.from(r),n}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return ht.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&d.O$.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1!==t.type&&2!==t.type||null!=t.accessList||(t.accessList=[]);const e=ht.check(this.formats.transaction,t);if(null!=t.chainId){let r=t.chainId;(0,p.A7)(r)&&(r=d.O$.from(r).toNumber()),e.chainId=r}else{let r=t.networkId;null==r&&null==e.v&&(r=t.chainId),(0,p.A7)(r)&&(r=d.O$.from(r).toNumber()),"number"!=typeof r&&null!=e.v&&(r=(e.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),e.chainId=r}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return(0,g.Qc)(t)}receiptLog(t){return ht.check(this.formats.receiptLog,t)}receipt(t){const e=ht.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=d.O$.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&<.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):lt.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&<.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map((t=>this.topics(t))):null!=t?this.hash(t,!0):null}filter(t){return ht.check(this.formats.filter,t)}filterLog(t){return ht.check(this.formats.filterLog,t)}static check(t,e){const r={};for(const n in t)try{const i=t[n](e[n]);void 0!==i&&(r[n]=i)}catch(t){throw t.checkKey=n,t.checkValue=e[n],t}return r}static allowNull(t,e){return function(r){return null==r?e:t(r)}}static allowFalsish(t,e){return function(r){return r?t(r):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const r=[];return e.forEach((function(e){r.push(t(e))})),r}}}function ct(t){return t&&"function"==typeof t.isCommunityResource}function ft(t){return ct(t)&&t.isCommunityResource()}let dt=!1;function pt(){dt||(dt=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var mt=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const gt=new v.Yd(ut);function vt(t){return null==t?"null":(32!==(0,p.E1)(t)&>.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function yt(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map((t=>{if(Array.isArray(t)){const e={};t.forEach((t=>{e[vt(t)]=!0}));const r=Object.keys(e);return r.sort(),r.join("|")}return vt(t)})).join("&")}function bt(t){if("string"==typeof t){if(t=t.toLowerCase(),32===(0,p.E1)(t))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+yt(t);if(h.Sg.isForkEvent(t))throw gt.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+yt(t.topics||[])}throw new Error("invalid event - "+t)}function wt(){return(new Date).getTime()}function Et(t){return new Promise((e=>{setTimeout(e,t)}))}const Mt=["block","network","pending","poll"];class At{constructor(t,e,r){(0,m.zG)(this,"tag",t),(0,m.zG)(this,"listener",e),(0,m.zG)(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],r=""===(n=t[2])?[]:n.split(/&/g).map((t=>{if(""===t)return[];const e=t.split("|").map((t=>"null"===t?null:t));return 1===e.length?e[0]:e}));var n;const i={};return r.length>0&&(i.topics=r),e&&"*"!==e&&(i.address=e),i}pollable(){return this.tag.indexOf(":")>=0||Mt.indexOf(this.tag)>=0}}const _t={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Nt(t){return(0,p.$m)(d.O$.from(t).toHexString(),32)}function St(t){return et.eU.encode((0,p.zo)([t,(0,p.p3)((0,nt.JQ)((0,nt.JQ)(t)),0,4)]))}const Tt=new RegExp("^(ipfs)://(.*)$","i"),kt=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Tt,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Rt(t,e){try{return(0,it.ZN)(xt(t,e))}catch(t){}return null}function xt(t,e){if("0x"===t)return null;const r=d.O$.from((0,p.p3)(t,e,e+32)).toNumber(),n=d.O$.from((0,p.p3)(t,r,r+32)).toNumber();return(0,p.p3)(t,r+32,r+32+n)}function Ot(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):gt.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function It(t){const e=(0,p.lE)(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function Ct(t){if(t.length%32==0)return t;const e=new Uint8Array(32*Math.ceil(t.length/32));return e.set(t),e}function Pt(t){const e=[];let r=0;for(let n=0;nd.O$.from(t).eq(1))).catch((t=>{if(t.code===v.Yd.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t}))),this._supportsEip2544}_fetch(t,e){return mt(this,void 0,void 0,(function*(){const r={to:this.address,ccipReadEnabled:!0,data:(0,p.xs)([t,(0,rt.VM)(this.name),e||"0x"])};let n=!1;(yield this.supportsWildcard())&&(n=!0,r.data=(0,p.xs)(["0x9061b923",Pt([(0,rt.Kn)(this.name),r.data])]));try{let t=yield this.provider.call(r);return(0,p.lE)(t).length%32==4&>.throwError("resolver threw error",v.Yd.errors.CALL_EXCEPTION,{transaction:r,data:t}),n&&(t=xt(t,0)),t}catch(t){if(t.code===v.Yd.errors.CALL_EXCEPTION)return null;throw t}}))}_fetchBytes(t,e){return mt(this,void 0,void 0,(function*(){const r=yield this._fetch(t,e);return null!=r?xt(r,0):null}))}_getAddress(t,e){const r=_t[String(t)];if(null==r&>.throwError(`unsupported coin type: ${t}`,v.Yd.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===r.ilk)return this.provider.formatter.address(e);const n=(0,p.lE)(e);if(null!=r.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return St((0,p.zo)([[r.p2pkh],"0x"+t[2]]))}}if(null!=r.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return St((0,p.zo)([[r.p2sh],"0x"+t[2]]))}}if(null!=r.prefix){const t=n[1];let e=n[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&n.length===2+t&&t>=1&&t<=75){const t=at().toWords(n.slice(2));return t.unshift(e),at().encode(r.prefix,t)}}return null}getAddress(t){return mt(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t)try{const t=yield this._fetch("0x3b3b57de");return"0x"===t||t===X.R?null:this.provider.formatter.callAddress(t)}catch(t){if(t.code===v.Yd.errors.CALL_EXCEPTION)return null;throw t}const e=yield this._fetchBytes("0xf1cb7e06",Nt(t));if(null==e||"0x"===e)return null;const r=this._getAddress(t,e);return null==r&>.throwError("invalid or unsupported coin data",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),r}))}getAvatar(){return mt(this,void 0,void 0,(function*(){const t=[{type:"name",content:this.name}];try{const e=yield this.getText("avatar");if(null==e)return null;for(let r=0;rt[e]))}return gt.throwError("invalid or unsupported content hash data",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})}))}getText(t){return mt(this,void 0,void 0,(function*(){let e=(0,it.Y0)(t);e=(0,p.zo)([Nt(64),Nt(e.length),e]),e.length%32!=0&&(e=(0,p.zo)([e,(0,p.$m)("0x",32-t.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",(0,p.Dv)(e));return null==r||"0x"===r?null:(0,it.ZN)(r)}))}}let Ut=null,Bt=1;class Dt extends h.zt{constructor(t){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),(0,m.zG)(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch((t=>{})),this._ready().catch((t=>{}));else{const e=(0,m.tu)(new.target,"getNetwork")(t);e?((0,m.zG)(this,"_network",e),this.emit("network",e,null)):gt.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return mt(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||gt.throwError("no network detected",v.Yd.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:(0,m.zG)(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return(0,ot.$l)((()=>this._ready().then((t=>t),(t=>{if(t.code!==v.Yd.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))))}static getFormatter(){return null==Ut&&(Ut=new ht),Ut}static getNetwork(t){return(0,Q.H)(null==t?"homestead":t)}ccipReadFetch(t,e,r){return mt(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===r.length)return null;const n=t.to.toLowerCase(),i=e.toLowerCase(),o=[];for(let t=0;t=0?null:JSON.stringify({data:i,sender:n}),u=yield(0,ot.rd)({url:s,errorPassThrough:!0},a,((t,e)=>(t.status=e.statusCode,t)));if(u.data)return u.data;const l=u.message||"unknown error";if(u.status>=400&&u.status<500)return gt.throwError(`response not found during CCIP fetch: ${l}`,v.Yd.errors.SERVER_ERROR,{url:e,errorMessage:l});o.push(l)}return gt.throwError(`error encountered during CCIP fetch: ${o.map((t=>JSON.stringify(t))).join(", ")}`,v.Yd.errors.SERVER_ERROR,{urls:r,errorMessages:o})}))}_getInternalBlockNumber(t){return mt(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const r=yield e;if(wt()-r.respTime<=t)return r.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=wt(),r=(0,m.mE)({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((t=>null),(t=>t))}).then((({blockNumber:t,networkError:n})=>{if(n)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),n;const i=wt();return(t=d.O$.from(t).toNumber()){this._internalBlockNumber===r&&(this._internalBlockNumber=null)})),(yield r).blockNumber}))}poll(){return mt(this,void 0,void 0,(function*(){const t=Bt++,e=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(r),this.emit("poll",t,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)gt.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",gt.makeError("network block skew detected",v.Yd.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let t=this._emitted.block+1;t<=r;t++)this.emit("block",t);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach((t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&r-e>12&&delete this._emitted[t]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach((t=>{switch(t.type){case"tx":{const r=t.hash;let n=this.getTransactionReceipt(r).then((t=>t&&null!=t.blockNumber?(this._emitted["t:"+r]=t.blockNumber,this.emit(r,t),null):null)).catch((t=>{this.emit("error",t)}));e.push(n);break}case"filter":if(!t._inflight){t._inflight=!0,-2===t._lastBlockNumber&&(t._lastBlockNumber=r-1);const n=t.filter;n.fromBlock=t._lastBlockNumber+1,n.toBlock=r;const i=n.toBlock-this._maxFilterBlockRange;i>n.fromBlock&&(n.fromBlock=i),n.fromBlock<0&&(n.fromBlock=0);const o=this.getLogs(n).then((e=>{t._inflight=!1,0!==e.length&&e.forEach((e=>{e.blockNumber>t._lastBlockNumber&&(t._lastBlockNumber=e.blockNumber),this._emitted["b:"+e.blockHash]=e.blockNumber,this._emitted["t:"+e.transactionHash]=e.blockNumber,this.emit(n,e)}))})).catch((e=>{this.emit("error",e),t._inflight=!1}));e.push(o)}}})),this._lastBlockNumber=r,Promise.all(e).then((()=>{this.emit("didPoll",t)})).catch((t=>{this.emit("error",t)}))}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return mt(this,void 0,void 0,(function*(){return gt.throwError("provider does not support network detection",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return mt(this,void 0,void 0,(function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",e,t),yield Et(0),this._network;const r=gt.makeError("underlying network changed",v.Yd.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",r),r}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((t=>{this._setFastBlockNumber(t)}),(t=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const t=wt();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&tthis._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,r){return mt(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==e?1:e,r||0,null)}))}_waitForTransaction(t,e,r,n){return mt(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(t);return(i?i.confirmations:0)>=e?i:new Promise(((i,o)=>{const s=[];let a=!1;const u=function(){return!!a||(a=!0,s.forEach((t=>{t()})),!1)},l=t=>{t.confirmations{this.removeListener(t,l)})),n){let r=n.startBlock,i=null;const l=s=>mt(this,void 0,void 0,(function*(){a||(yield Et(1e3),this.getTransactionCount(n.from).then((h=>mt(this,void 0,void 0,(function*(){if(!a){if(h<=n.nonce)r=s;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==i&&(i=r-3,i{a||this.once("block",l)})))}));if(a)return;this.once("block",l),s.push((()=>{this.removeListener("block",l)}))}if("number"==typeof r&&r>0){const t=setTimeout((()=>{u()||o(gt.makeError("timeout exceeded",v.Yd.errors.TIMEOUT,{timeout:r}))}),r);t.unref&&t.unref(),s.push((()=>{clearTimeout(t)}))}}))}))}getBlockNumber(){return mt(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return d.O$.from(t)}catch(e){return gt.throwError("bad result from backend",v.Yd.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}}))}getBalance(t,e){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,m.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getBalance",r);try{return d.O$.from(n)}catch(t){return gt.throwError("bad result from backend",v.Yd.errors.SERVER_ERROR,{method:"getBalance",params:r,result:n,error:t})}}))}getTransactionCount(t,e){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,m.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getTransactionCount",r);try{return d.O$.from(n).toNumber()}catch(t){return gt.throwError("bad result from backend",v.Yd.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:n,error:t})}}))}getCode(t,e){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,m.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getCode",r);try{return(0,p.Dv)(n)}catch(t){return gt.throwError("bad result from backend",v.Yd.errors.SERVER_ERROR,{method:"getCode",params:r,result:n,error:t})}}))}getStorageAt(t,e,r){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield(0,m.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(r),position:Promise.resolve(e).then((t=>(0,p.$P)(t)))}),i=yield this.perform("getStorageAt",n);try{return(0,p.Dv)(i)}catch(t){return gt.throwError("bad result from backend",v.Yd.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:i,error:t})}}))}_wrapTransaction(t,e,r){if(null!=e&&32!==(0,p.E1)(e))throw new Error("invalid response - sendTransaction");const n=t;return null!=e&&t.hash!==e&>.throwError("Transaction hash mismatch from Provider.sendTransaction.",v.Yd.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),n.wait=(e,n)=>mt(this,void 0,void 0,(function*(){let i;null==e&&(e=1),null==n&&(n=0),0!==e&&null!=r&&(i={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:r});const o=yield this._waitForTransaction(t.hash,e,n,i);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&>.throwError("transaction failed",v.Yd.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),n}sendTransaction(t){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then((t=>(0,p.Dv)(t))),r=this.formatter.transaction(t);null==r.confirmations&&(r.confirmations=0);const n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(r,t,n)}catch(t){throw t.transaction=r,t.transactionHash=r.hash,t}}))}_getTransactionRequest(t){return mt(this,void 0,void 0,(function*(){const e=yield t,r={};return["from","to"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?this._getAddress(t):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?d.O$.from(t):null)))})),["type"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>null!=t?t:null)))})),e.accessList&&(r.accessList=this.formatter.accessList(e.accessList)),["data"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?(0,p.Dv)(t):null)))})),this.formatter.transactionRequest(yield(0,m.mE)(r))}))}_getFilter(t){return mt(this,void 0,void 0,(function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach((r=>{null!=t[r]&&(e[r]=t[r])})),["fromBlock","toBlock"].forEach((r=>{null!=t[r]&&(e[r]=this._getBlockTag(t[r]))})),this.formatter.filter(yield(0,m.mE)(e))}))}_call(t,e,r){return mt(this,void 0,void 0,(function*(){r>=10&>.throwError("CCIP read exceeded maximum redirections",v.Yd.errors.SERVER_ERROR,{redirects:r,transaction:t});const n=t.to,i=yield this.perform("call",{transaction:t,blockTag:e});if(r>=0&&"latest"===e&&null!=n&&"0x556f1830"===i.substring(0,10)&&(0,p.E1)(i)%32==4)try{const o=(0,p.p3)(i,4),s=(0,p.p3)(o,0,32);d.O$.from(s).eq(n)||gt.throwError("CCIP Read sender did not match",v.Yd.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i});const a=[],u=d.O$.from((0,p.p3)(o,32,64)).toNumber(),l=d.O$.from((0,p.p3)(o,u,u+32)).toNumber(),h=(0,p.p3)(o,u+32);for(let e=0;emt(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",n);if(null==t)return null!=n.blockHash&&null==this._emitted["b:"+n.blockHash]||null!=n.blockTag&&r>this._emitted.block?null:void 0;if(e){let e=null;for(let r=0;rthis._wrapTransaction(t))),r}return this.formatter.block(t)}))),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return mt(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return(0,ot.$l)((()=>mt(this,void 0,void 0,(function*(){const r=yield this.perform("getTransaction",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;const n=this.formatter.transactionResponse(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return this._wrapTransaction(n)}))),{oncePoll:this})}))}getTransactionReceipt(t){return mt(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return(0,ot.$l)((()=>mt(this,void 0,void 0,(function*(){const r=yield this.perform("getTransactionReceipt",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;if(null==r.blockHash)return;const n=this.formatter.receipt(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return n}))),{oncePoll:this})}))}getLogs(t){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield(0,m.mE)({filter:this._getFilter(t)}),r=yield this.perform("getLogs",e);return r.forEach((t=>{null==t.removed&&(t.removed=!1)})),ht.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return mt(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return mt(this,void 0,void 0,(function*(){if("number"==typeof(t=yield t)&&t<0){t%1&>.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)}))}getResolver(t){return mt(this,void 0,void 0,(function*(){let e=t;for(;;){if(""===e||"."===e)return null;if("eth"!==t&&"eth"===e)return null;const r=yield this._getResolver(e,"getResolver");if(null!=r){const n=new Lt(this,r,t);return e===t||(yield n.supportsWildcard())?n:null}e=e.split(".").slice(1).join(".")}}))}_getResolver(t,e){return mt(this,void 0,void 0,(function*(){null==e&&(e="ENS");const r=yield this.getNetwork();r.ensAddress||gt.throwError("network does not support ENS",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:e,network:r.name});try{const e=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+(0,rt.VM)(t).substring(2)});return this.formatter.callAddress(e)}catch(t){}return null}))}resolveName(t){return mt(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if((0,p.A7)(t))throw e}"string"!=typeof t&>.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null}))}lookupAddress(t){return mt(this,void 0,void 0,(function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(e,"lookupAddress");if(null==r)return null;const n=Rt(yield this.call({to:r,data:"0x691f3431"+(0,rt.VM)(e).substring(2)}),0);return(yield this.resolveName(n))!=t?null:n}))}getAvatar(t){return mt(this,void 0,void 0,(function*(){let e=null;if((0,p.A7)(t)){const r=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"getAvatar");if(!n)return null;e=new Lt(this,n,r);try{const t=yield e.getAvatar();if(t)return t.url}catch(t){if(t.code!==v.Yd.errors.CALL_EXCEPTION)throw t}try{const t=Rt(yield this.call({to:n,data:"0x691f3431"+(0,rt.VM)(r).substring(2)}),0);e=yield this.getResolver(t)}catch(t){if(t.code!==v.Yd.errors.CALL_EXCEPTION)throw t;return null}}else if(e=yield this.getResolver(t),!e)return null;const r=yield e.getAvatar();return null==r?null:r.url}))}perform(t,e){return gt.throwError(t+" not implemented",v.Yd.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_stopEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_addEventListener(t,e,r){const n=new At(bt(t),e,r);return this._events.push(n),this._startEvent(n),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let r=!1,n=[],i=bt(t);return this._events=this._events.filter((t=>t.tag!==i||(setTimeout((()=>{t.listener.apply(this,e)}),0),r=!0,!t.once||(n.push(t),!1)))),n.forEach((t=>{this._stopEvent(t)})),r}listenerCount(t){if(!t)return this._events.length;let e=bt(t);return this._events.filter((t=>t.tag===e)).length}listeners(t){if(null==t)return this._events.map((t=>t.listener));let e=bt(t);return this._events.filter((t=>t.tag===e)).map((t=>t.listener))}off(t,e){if(null==e)return this.removeAllListeners(t);const r=[];let n=!1,i=bt(t);return this._events=this._events.filter((t=>t.tag!==i||t.listener!=e||!!n||(n=!0,r.push(t),!1))),r.forEach((t=>{this._stopEvent(t)})),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const r=bt(t);this._events=this._events.filter((t=>t.tag!==r||(e.push(t),!1)))}return e.forEach((t=>{this._stopEvent(t)})),this}}var Ft=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Gt=new v.Yd(ut),jt=["call","estimateGas"];function qt(t,e){if(null==t)return null;if("string"==typeof t.message&&t.message.match("reverted")){const r=(0,p.A7)(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if("object"==typeof t){for(const r in t){const n=qt(t[r],e);if(n)return n}return null}if("string"==typeof t)try{return qt(JSON.parse(t),e)}catch(t){}return null}function zt(t,e,r){const n=r.transaction||r.signedTransaction;if("call"===t){const t=qt(e,!0);if(t)return t.data;Gt.throwError("missing revert data in call exception; Transaction reverted without a reason string",v.Yd.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if("estimateGas"===t){let r=qt(e.body,!1);null==r&&(r=qt(e,!1)),r&&Gt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",v.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{reason:r.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===v.Yd.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?i=e.error.message:"string"==typeof e.body?i=e.body:"string"==typeof e.responseText&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&Gt.throwError("insufficient funds for intrinsic transaction cost",v.Yd.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&Gt.throwError("nonce has already been used",v.Yd.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&Gt.throwError("replacement fee too low",v.Yd.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&Gt.throwError("legacy pre-eip-155 transactions not supported",v.Yd.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),jt.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&Gt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",v.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Kt(t){return new Promise((function(e){setTimeout(e,t)}))}function Ht(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function $t(t){return t?t.toLowerCase():t}const Vt={};class Wt extends c.E{constructor(t,e,r){if(super(),t!==Vt)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");(0,m.zG)(this,"provider",e),null==r&&(r=0),"string"==typeof r?((0,m.zG)(this,"_address",this.provider.formatter.address(r)),(0,m.zG)(this,"_index",null)):"number"==typeof r?((0,m.zG)(this,"_index",r),(0,m.zG)(this,"_address",null)):Gt.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(t){return Gt.throwError("cannot alter JSON-RPC Signer connection",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Yt(Vt,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((t=>(t.length<=this._index&&Gt.throwError("unknown account #"+this._index,v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index]))))}sendUncheckedTransaction(t){t=(0,m.DC)(t);const e=this.getAddress().then((t=>(t&&(t=t.toLowerCase()),t)));if(null==t.gasLimit){const r=(0,m.DC)(t);r.from=e,t.gasLimit=this.provider.estimateGas(r)}return null!=t.to&&(t.to=Promise.resolve(t.to).then((t=>Ft(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.provider.resolveName(t);return null==e&&Gt.throwArgumentError("provided ENS name resolves to null","tx.to",t),e}))))),(0,m.mE)({tx:(0,m.mE)(t),sender:e}).then((({tx:e,sender:r})=>{null!=e.from?e.from.toLowerCase()!==r&&Gt.throwArgumentError("from address mismatch","transaction",t):e.from=r;const n=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[n]).then((t=>t),(t=>("string"==typeof t.message&&t.message.match(/user denied/i)&&Gt.throwError("user rejected transaction",v.Yd.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:e}),zt("sendTransaction",t,n))))}))}signTransaction(t){return Gt.throwError("signing transactions is unsupported",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return Ft(this,void 0,void 0,(function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(t);try{return yield(0,ot.$l)((()=>Ft(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(r);if(null!==t)return this.provider._wrapTransaction(t,r,e)}))),{oncePoll:this.provider})}catch(t){throw t.transactionHash=r,t}}))}signMessage(t){return Ft(this,void 0,void 0,(function*(){const e="string"==typeof t?(0,it.Y0)(t):t,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[(0,p.Dv)(e),r.toLowerCase()])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&Gt.throwError("user rejected signing",v.Yd.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:t}),e}}))}_legacySignMessage(t){return Ft(this,void 0,void 0,(function*(){const e="string"==typeof t?(0,it.Y0)(t):t,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),(0,p.Dv)(e)])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&Gt.throwError("user rejected signing",v.Yd.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:t}),e}}))}_signTypedData(t,e,r){return Ft(this,void 0,void 0,(function*(){const n=yield B.E.resolveNames(t,e,r,(t=>this.provider.resolveName(t))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(B.E.getPayload(n.domain,e,n.value))])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&Gt.throwError("user rejected signing",v.Yd.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:n.domain,types:e,value:n.value}}),t}}))}unlock(t){return Ft(this,void 0,void 0,(function*(){const e=this.provider,r=yield this.getAddress();return e.send("personal_unlockAccount",[r.toLowerCase(),t,null])}))}}class Yt extends Wt{sendTransaction(t){return this.sendUncheckedTransaction(t).then((t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)})))}}const Jt={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Xt extends Dt{constructor(t,e){let r=e;null==r&&(r=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then((e=>{t(e)}),(t=>{e(t)}))}),0)}))),super(r),t||(t=(0,m.tu)(this.constructor,"defaultUrl")()),"string"==typeof t?(0,m.zG)(this,"connection",Object.freeze({url:t})):(0,m.zG)(this,"connection",Object.freeze((0,m.DC)(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Ft(this,void 0,void 0,(function*(){yield Kt(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=(0,m.tu)(this.constructor,"getNetwork");try{return e(d.O$.from(t).toNumber())}catch(e){return Gt.throwError("could not detect network",v.Yd.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return Gt.throwError("could not detect network",v.Yd.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new Wt(Vt,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((t=>t.map((t=>this.formatter.address(t)))))}send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:(0,m.p$)(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(n&&this._cache[t])return this._cache[t];const i=(0,ot.rd)(this.connection,JSON.stringify(r),Ht).then((t=>(this.emit("debug",{action:"response",request:r,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",error:t,request:r,provider:this}),t}));return n&&(this._cache[t]=i,setTimeout((()=>{this._cache[t]=null}),0)),i}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[$t(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[$t(e.address),e.blockTag]];case"getCode":return["eth_getCode",[$t(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[$t(e.address),(0,p.$m)(e.position,32),e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[(0,m.tu)(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[(0,m.tu)(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=$t(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return Ft(this,void 0,void 0,(function*(){if("call"===t||"estimateGas"===t){const t=e.transaction;if(t&&null!=t.type&&d.O$.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((e=(0,m.DC)(e)).transaction=(0,m.DC)(t),delete e.transaction.type)}}const r=this.prepareRequest(t,e);null==r&&Gt.throwError(t+" not implemented",v.Yd.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(r[0],r[1])}catch(r){return zt(t,r,e)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then((function(r){return function n(){t.send("eth_getFilterChanges",[r]).then((function(r){if(t._pendingFilter!=e)return null;let n=Promise.resolve();return r.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",n=n.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),n.then((function(){return Kt(1e3)}))})).then((function(){if(t._pendingFilter==e)return setTimeout((function(){n()}),0),null;t.send("eth_uninstallFilter",[r])})).catch((t=>{}))}(),r})).catch((t=>{}))}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const r=(0,m.DC)(Jt);if(e)for(const t in e)e[t]&&(r[t]=!0);(0,m.uj)(t,r);const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(e){if(null==t[e])return;const r=(0,p.$P)(d.O$.from(t[e]));"gasLimit"===e&&(e="gas"),n[e]=r})),["from","to","data"].forEach((function(e){null!=t[e]&&(n[e]=(0,p.Dv)(t[e]))})),t.accessList&&(n.accessList=(0,g.z7)(t.accessList)),n}}let Zt=null;try{if(Zt=WebSocket,null==Zt)throw new Error("inject please")}catch(t){const e=new v.Yd(ut);Zt=function(){e.throwError("WebSockets not supported in this environment",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var Qt=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const te=new v.Yd(ut);let ee=1;class re extends Xt{constructor(t,e){"any"===e&&te.throwError("WebSocketProvider does not support 'any' network yet",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),super("string"==typeof t?t:"_websocket",e),this._pollingInterval=-1,this._wsReady=!1,"string"==typeof t?(0,m.zG)(this,"_websocket",new Zt(this.connection.url)):(0,m.zG)(this,"_websocket",t),(0,m.zG)(this,"_requests",{}),(0,m.zG)(this,"_subs",{}),(0,m.zG)(this,"_subIds",{}),(0,m.zG)(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach((t=>{this.websocket.send(this._requests[t].payload)}))},this.websocket.onmessage=t=>{const e=t.data,r=JSON.parse(e);if(null!=r.id){const t=String(r.id),n=this._requests[t];if(delete this._requests[t],void 0!==r.result)n.callback(null,r.result),this.emit("debug",{action:"response",request:JSON.parse(n.payload),response:r.result,provider:this});else{let t=null;r.error?(t=new Error(r.error.message||"unknown error"),(0,m.zG)(t,"code",r.error.code||null),(0,m.zG)(t,"response",e)):t=new Error("unknown error"),n.callback(t,void 0),this.emit("debug",{action:"response",error:t,request:JSON.parse(n.payload),provider:this})}}else if("eth_subscription"===r.method){const t=this._subs[r.params.subscription];t&&t.processFunc(r.params.result)}else console.warn("this should not happen")};const r=setInterval((()=>{this.emit("poll")}),1e3);r.unref&&r.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(t){te.throwError("cannot reset events block on WebSocketProvider",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(t){te.throwError("cannot set polling interval on WebSocketProvider",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return Qt(this,void 0,void 0,(function*(){return null}))}set polling(t){t&&te.throwError("cannot set polling on WebSocketProvider",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(t,e){const r=ee++;return new Promise(((n,i)=>{const o=JSON.stringify({method:t,params:e,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(o),provider:this}),this._requests[String(r)]={callback:function(t,e){return t?i(t):n(e)},payload:o},this._wsReady&&this.websocket.send(o)}))}static defaultUrl(){return"ws://localhost:8546"}_subscribe(t,e,r){return Qt(this,void 0,void 0,(function*(){let n=this._subIds[t];null==n&&(n=Promise.all(e).then((t=>this.send("eth_subscribe",t))),this._subIds[t]=n);const i=yield n;this._subs[i]={tag:t,processFunc:r}}))}_startEvent(t){switch(t.type){case"block":this._subscribe("block",["newHeads"],(t=>{const e=d.O$.from(t.number).toNumber();this._emitted.block=e,this.emit("block",e)}));break;case"pending":this._subscribe("pending",["newPendingTransactions"],(t=>{this.emit("pending",t)}));break;case"filter":this._subscribe(t.tag,["logs",this._getFilter(t.filter)],(e=>{null==e.removed&&(e.removed=!1),this.emit(t.filter,this.formatter.filterLog(e))}));break;case"tx":{const e=t=>{const e=t.hash;this.getTransactionReceipt(e).then((t=>{t&&this.emit(e,t)}))};e(t),this._subscribe("tx",["newHeads"],(t=>{this._events.filter((t=>"tx"===t.type)).forEach(e)}));break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",t)}}_stopEvent(t){let e=t.tag;if("tx"===t.type){if(this._events.filter((t=>"tx"===t.type)).length)return;e="tx"}else if(this.listenerCount(t.event))return;const r=this._subIds[e];r&&(delete this._subIds[e],r.then((t=>{this._subs[t]&&(delete this._subs[t],this.send("eth_unsubscribe",[t]))})))}destroy(){return Qt(this,void 0,void 0,(function*(){this.websocket.readyState===Zt.CONNECTING&&(yield new Promise((t=>{this.websocket.onopen=function(){t(!0)},this.websocket.onerror=function(){t(!1)}}))),this.websocket.close(1e3)}))}}const ne=new v.Yd(ut);class ie extends Xt{detectNetwork(){const t=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return e=this,r=void 0,i=function*(){let e=this.network;return null==e&&(e=yield t.detectNetwork.call(this),e||ne.throwError("no network detected",v.Yd.errors.UNKNOWN_ERROR,{}),null==this._network&&((0,m.zG)(this,"_network",e),this.emit("network",e,null))),e},new((n=void 0)||(n=Promise))((function(t,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(t){t(r)}))).then(s,a)}u((i=i.apply(e,r||[])).next())}));var e,r,n,i}}class oe extends ie{constructor(t,e){ne.checkAbstract(new.target,oe),t=(0,m.tu)(new.target,"getNetwork")(t),e=(0,m.tu)(new.target,"getApiKey")(e),super((0,m.tu)(new.target,"getUrl")(t,e),t),"string"==typeof e?(0,m.zG)(this,"apiKey",e):null!=e&&Object.keys(e).forEach((t=>{(0,m.zG)(this,t,e[t])}))}_startPending(){ne.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(t){return ne.throwError("API provider does not support signing",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(t){return t}static getUrl(t,e){return ne.throwError("not implemented; sub-classes must override getUrl",v.Yd.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const se=new v.Yd(ut),ae="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class ue extends re{constructor(t,e){const r=new le(t,e);super(r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi."),r.network),(0,m.zG)(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===ae}}class le extends oe{static getWebSocketProvider(t,e){return new ue(t,e)}static getApiKey(t){return null==t?ae:(t&&"string"!=typeof t&&se.throwArgumentError("invalid apiKey","apiKey",t),t)}static getUrl(t,e){let r=null;switch(t.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.g.alchemy.com/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":r="arb-goerli.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":r="opt-goerli.g.alchemy.com/v2/";break;default:se.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+e,throttleCallback:(t,r)=>(e===ae&&pt(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===ae}}const he=new v.Yd(ut),ce="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function fe(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return he.throwArgumentError("unsupported network","name",t)}class de extends oe{isCommunityResource(){return this.apiKey===ce}static getApiKey(t){return null==t?ce:t}static getUrl(t,e){null==e&&(e=ce);const r={allowGzip:!0,url:"https://"+fe(t.name)+e,throttleCallback:(t,r)=>(e.apiKey===ce&&pt(),Promise.resolve(!0))};return null!=e.projectSecret&&(r.user="",r.password=e.projectSecret),r}}const pe=new v.Yd(ut);class me extends oe{static getApiKey(t){return null!=t&&pe.throwArgumentError("apiKey not supported for cloudflare","apiKey",t),null}static getUrl(t,e){let r=null;return"homestead"===t.name?r="https://cloudflare-eth.com/":pe.throwArgumentError("unsupported network","network",arguments[0]),r}perform(t,e){const r=Object.create(null,{perform:{get:()=>super.perform}});return n=this,i=void 0,s=function*(){return"getBlockNumber"===t?(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number:r.perform.call(this,t,e)},new((o=void 0)||(o=Promise))((function(t,e){function r(t){try{u(s.next(t))}catch(t){e(t)}}function a(t){try{u(s.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(r,a)}u((s=s.apply(n,i||[])).next())}));var n,i,o,s}}var ge=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const ve=new v.Yd(ut);function ye(t){const e={};for(let r in t){if(null==t[r])continue;let n=t[r];"type"===r&&0===n||(n={type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?(0,p.$P)((0,p.Dv)(n)):"accessList"===r?"["+(0,g.z7)(n).map((t=>`{address:"${t.address}",storageKeys:["${t.storageKeys.join('","')}"]}`)).join(",")+"]":(0,p.Dv)(n),e[r]=n)}return e}function be(t){if(0==t.status&&("No records found"===t.message||"No transactions found"===t.message))return t.result;if(1!=t.status||"string"!=typeof t.message||!t.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function we(t){if(t&&0==t.status&&"NOTOK"==t.message&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if("2.0"!=t.jsonrpc){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function Ee(t){if("pending"===t)throw new Error("pending not supported");return"latest"===t?t:parseInt(t.substring(2),16)}function Me(t,e,r){if("call"===t&&e.code===v.Yd.errors.SERVER_ERROR){const t=e.error;if(t&&(t.message.match(/reverted/i)||t.message.match(/VM execution error/i))){let r=t.data;if(r&&(r="0x"+r.replace(/^.*0x/i,"")),(0,p.A7)(r))return r;ve.throwError("missing revert data in call exception",v.Yd.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===v.Yd.errors.SERVER_ERROR&&(e.error&&"string"==typeof e.error.message?n=e.error.message:"string"==typeof e.body?n=e.body:"string"==typeof e.responseText&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&ve.throwError("insufficient funds for intrinsic transaction cost",v.Yd.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ve.throwError("nonce has already been used",v.Yd.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&ve.throwError("replacement fee too low",v.Yd.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&ve.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",v.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class Ae extends Dt{constructor(t,e){super(t),(0,m.zG)(this,"baseUrl",this.getBaseUrl()),(0,m.zG)(this,"apiKey",e||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return ve.throwArgumentError("unsupported network","network",this.network.name)}getUrl(t,e){const r=Object.keys(e).reduce(((t,r)=>{const n=e[r];return null!=n&&(t+=`&${r}=${n}`),t}),""),n=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${t}${r}${n}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(t,e){return e.module=t,e.apikey=this.apiKey,e}fetch(t,e,r){return ge(this,void 0,void 0,(function*(){const n=r?this.getPostUrl():this.getUrl(t,e),i=r?this.getPostData(t,e):null,o="proxy"===t?we:be;this.emit("debug",{action:"request",request:n,provider:this});const s={url:n,throttleSlotInterval:1e3,throttleCallback:(t,e)=>(this.isCommunityResource()&&pt(),Promise.resolve(!0))};let a=null;i&&(s.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(i).map((t=>`${t}=${i[t]}`)).join("&"));const u=yield(0,ot.rd)(s,a,o||we);return this.emit("debug",{action:"response",request:n,response:(0,m.p$)(u),provider:this}),u}))}detectNetwork(){return ge(this,void 0,void 0,(function*(){return this.network}))}perform(t,e){const r=Object.create(null,{perform:{get:()=>super.perform}});return ge(this,void 0,void 0,(function*(){switch(t){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:e.address,tag:e.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:e.address,tag:e.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:e.address,tag:e.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:e.address,position:e.position,tag:e.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:e.signedTransaction},!0).catch((t=>Me("sendTransaction",t,e.signedTransaction)));case"getBlock":if(e.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:e.blockTag,boolean:e.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:e.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:e.transactionHash});case"call":{if("latest"!==e.blockTag)throw new Error("EtherscanProvider does not support blockTag for call");const t=ye(e.transaction);t.module="proxy",t.action="eth_call";try{return yield this.fetch("proxy",t,!0)}catch(t){return Me("call",t,e.transaction)}}case"estimateGas":{const t=ye(e.transaction);t.module="proxy",t.action="eth_estimateGas";try{return yield this.fetch("proxy",t,!0)}catch(t){return Me("estimateGas",t,e.transaction)}}case"getLogs":{const t={action:"getLogs"};if(e.filter.fromBlock&&(t.fromBlock=Ee(e.filter.fromBlock)),e.filter.toBlock&&(t.toBlock=Ee(e.filter.toBlock)),e.filter.address&&(t.address=e.filter.address),e.filter.topics&&e.filter.topics.length>0&&(e.filter.topics.length>1&&ve.throwError("unsupported topic count",v.Yd.errors.UNSUPPORTED_OPERATION,{topics:e.filter.topics}),1===e.filter.topics.length)){const r=e.filter.topics[0];"string"==typeof r&&66===r.length||ve.throwError("unsupported topic format",v.Yd.errors.UNSUPPORTED_OPERATION,{topic0:r}),t.topic0=r}const r=yield this.fetch("logs",t);let n={};for(let t=0;t{["contractAddress","to"].forEach((function(e){""==t[e]&&delete t[e]})),null==t.creates&&null!=t.contractAddress&&(t.creates=t.contractAddress);const e=this.formatter.transactionResponse(t);return t.timeStamp&&(e.timestamp=parseInt(t.timeStamp)),e}))}))}isCommunityResource(){return null==this.apiKey}}var _e=r(2472),Ne=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Se=new v.Yd(ut);function Te(){return(new Date).getTime()}function ke(t){let e=null;for(let r=0;re?null:(n+i)/2}function xe(t){if(null===t)return"null";if("number"==typeof t||"boolean"==typeof t)return JSON.stringify(t);if("string"==typeof t)return t;if(d.O$.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map((t=>xe(t))));if("object"==typeof t){const e=Object.keys(t);return e.sort(),"{"+e.map((e=>{let r=t[e];return r="function"==typeof r?"[function]":xe(r),JSON.stringify(e)+":"+r})).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let Oe=1;function Ie(t){let e=null,r=null,n=new Promise((n=>{e=function(){r&&(clearTimeout(r),r=null),n()},r=setTimeout(e,t)}));return{cancel:e,getPromise:function(){return n},wait:t=>(n=n.then(t),n)}}const Ce=[v.Yd.errors.CALL_EXCEPTION,v.Yd.errors.INSUFFICIENT_FUNDS,v.Yd.errors.NONCE_EXPIRED,v.Yd.errors.REPLACEMENT_UNDERPRICED,v.Yd.errors.UNPREDICTABLE_GAS_LIMIT],Pe=["address","args","errorArgs","errorSignature","method","transaction"];function Le(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function Ue(t,e){return Ne(this,void 0,void 0,(function*(){const r=t.provider;return null!=r.blockNumber&&r.blockNumber>=e||-1===e?r:(0,ot.$l)((()=>new Promise(((n,i)=>{setTimeout((function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)}),0)}))),{oncePoll:r})}))}function Be(t,e,r,n){return Ne(this,void 0,void 0,(function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&(0,p.A7)(n.blockTag)&&(i=yield Ue(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&(0,p.A7)(n.blockTag)&&(i=yield Ue(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&(0,p.A7)(n.blockTag)&&(i=yield Ue(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&(0,p.A7)(n.blockTag)&&(i=yield Ue(t,e)),"call"===r&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let r=n.filter;return(r.fromBlock&&(0,p.A7)(r.fromBlock)||r.toBlock&&(0,p.A7)(r.toBlock))&&(i=yield Ue(t,e)),i.getLogs(r)}}return Se.throwError("unknown method error",v.Yd.errors.UNKNOWN_ERROR,{method:r,params:n})}))}class De extends Dt{constructor(t,e){0===t.length&&Se.throwArgumentError("missing providers","providers",t);const r=t.map(((t,e)=>{if(h.zt.isProvider(t)){const e=ft(t)?2e3:750,r=1;return Object.freeze({provider:t,weight:1,stallTimeout:e,priority:r})}const r=(0,m.DC)(t);null==r.priority&&(r.priority=1),null==r.stallTimeout&&(r.stallTimeout=ft(t)?2e3:750),null==r.weight&&(r.weight=1);const n=r.weight;return(n%1||n>512||n<1)&&Se.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${e}].weight`,n),Object.freeze(r)})),n=r.reduce(((t,e)=>t+e.weight),0);null==e?e=n/2:e>n&&Se.throwArgumentError("quorum will always fail; larger than total weight","quorum",e);let i=ke(r.map((t=>t.provider.network)));null==i&&(i=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then(t,e)}),0)}))),super(i),(0,m.zG)(this,"providerConfigs",Object.freeze(r)),(0,m.zG)(this,"quorum",e),this._highestBlockNumber=-1}detectNetwork(){return Ne(this,void 0,void 0,(function*(){return ke(yield Promise.all(this.providerConfigs.map((t=>t.provider.getNetwork()))))}))}perform(t,e){return Ne(this,void 0,void 0,(function*(){if("sendTransaction"===t){const t=yield Promise.all(this.providerConfigs.map((t=>t.provider.sendTransaction(e.signedTransaction).then((t=>t.hash),(t=>t)))));for(let e=0;et.result));let n=Re(e.map((t=>t.result)),2);if(null!=n)return n=Math.ceil(n),r.indexOf(n+1)>=0&&n++,n>=t._highestBlockNumber&&(t._highestBlockNumber=n),t._highestBlockNumber};case"getGasPrice":return function(t){const e=t.map((t=>t.result));return e.sort(),e[Math.floor(e.length/2)]};case"getEtherPrice":return function(t){return Re(t.map((t=>t.result)))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(t){return null==t?null:((t=(0,m.DC)(t)).confirmations=-1,xe(t))};break;case"getBlock":n=r.includeTransactions?function(t){return null==t?null:((t=(0,m.DC)(t)).transactions=t.transactions.map((t=>((t=(0,m.DC)(t)).confirmations=-1,t))),xe(t))}:function(t){return null==t?null:xe(t)};break;default:throw new Error("unknown method: "+e)}return function(t,e){return function(r){const n={};r.forEach((e=>{const r=t(e.result);n[r]||(n[r]={count:0,result:e.result}),n[r].count++}));const i=Object.keys(n);for(let t=0;t=e)return r.result}}}(n,t.quorum)}(this,t,e),n=(0,_e.y)(this.providerConfigs.map(m.DC));n.sort(((t,e)=>t.priority-e.priority));const i=this._highestBlockNumber;let o=0,s=!0;for(;;){const a=Te();let u=n.filter((t=>t.runner&&a-t.startt+e.weight),0);for(;u{r.staller=null})),r.runner=Be(r,i,t,e).then((n=>{r.done=!0,r.result=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:Le(r,Te()),request:{method:t,params:(0,m.p$)(e)},provider:this})}),(n=>{r.done=!0,r.error=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:Le(r,Te()),request:{method:t,params:(0,m.p$)(e)},provider:this})})),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:Le(r,null),request:{method:t,params:(0,m.p$)(e)},provider:this}),u+=r.weight}const l=[];n.forEach((t=>{!t.done&&t.runner&&(l.push(t.runner),t.staller&&l.push(t.staller.getPromise()))})),l.length&&(yield Promise.race(l));const h=n.filter((t=>t.done&&null==t.error));if(h.length>=this.quorum){const t=r(h);if(void 0!==t)return n.forEach((t=>{t.staller&&t.staller.cancel(),t.cancelled=!0})),t;s||(yield Ie(100).getPromise()),s=!1}const c=n.reduce(((t,e)=>{if(!e.done||null==e.error)return t;const r=e.error.code;return Ce.indexOf(r)>=0&&(t[r]||(t[r]={error:e.error,weight:0}),t[r].weight+=e.weight),t}),{});if(Object.keys(c).forEach((t=>{const e=c[t];if(e.weight{t.staller&&t.staller.cancel(),t.cancelled=!0}));const r=e.error,i={};Pe.forEach((t=>{null!=r[t]&&(i[t]=r[t])})),Se.throwError(r.reason||r.message,t,i)})),0===n.filter((t=>!t.done)).length)break}return n.forEach((t=>{t.staller&&t.staller.cancel(),t.cancelled=!0})),Se.throwError("failed to meet quorum",v.Yd.errors.SERVER_ERROR,{method:t,params:e,results:n.map((t=>Le(t))),provider:this})}))}}const Fe=null,Ge=new v.Yd(ut),je="84842078b09946638c03157f83405213";class qe extends re{constructor(t,e){const r=new ze(t,e),n=r.connection;n.password&&Ge.throwError("INFURA WebSocket project secrets unsupported",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"}),super(n.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/"),t),(0,m.zG)(this,"apiKey",r.projectId),(0,m.zG)(this,"projectId",r.projectId),(0,m.zG)(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===je}}class ze extends oe{static getWebSocketProvider(t,e){return new qe(t,e)}static getApiKey(t){const e={apiKey:je,projectId:je,projectSecret:null};return null==t||("string"==typeof t?e.projectId=t:null!=t.projectSecret?(Ge.assertArgument("string"==typeof t.projectId,"projectSecret requires a projectId","projectId",t.projectId),Ge.assertArgument("string"==typeof t.projectSecret,"invalid projectSecret","projectSecret","[REDACTED]"),e.projectId=t.projectId,e.projectSecret=t.projectSecret):t.projectId&&(e.projectId=t.projectId),e.apiKey=e.projectId),e}static getUrl(t,e){let r=null;switch(t?t.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"goerli":r="goerli.infura.io";break;case"sepolia":r="sepolia.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-goerli":r="optimism-goerli.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":r="arbitrum-goerli.infura.io";break;default:Ge.throwError("unsupported network",v.Yd.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const n={allowGzip:!0,url:"https://"+r+"/v3/"+e.projectId,throttleCallback:(t,r)=>(e.projectId===je&&pt(),Promise.resolve(!0))};return null!=e.projectSecret&&(n.user="",n.password=e.projectSecret),n}isCommunityResource(){return this.projectId===je}}class Ke extends Xt{send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const n={request:r,resolve:null,reject:null},i=new Promise(((t,e)=>{n.resolve=t,n.reject=e}));return this._pendingBatch.push(n),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const e=t.map((t=>t.request));return this.emit("debug",{action:"requestBatch",request:(0,m.p$)(e),provider:this}),(0,ot.rd)(this.connection,JSON.stringify(e)).then((r=>{this.emit("debug",{action:"response",request:e,response:r,provider:this}),t.forEach(((t,e)=>{const n=r[e];if(n.error){const e=new Error(n.error.message);e.code=n.error.code,e.data=n.error.data,t.reject(e)}else t.resolve(n.result)}))}),(r=>{this.emit("debug",{action:"response",error:r,request:e,provider:this}),t.forEach((t=>{t.reject(r)}))}))}),10)),i}}const He=new v.Yd(ut);class $e extends oe{static getApiKey(t){return t&&"string"!=typeof t&&He.throwArgumentError("invalid apiKey","apiKey",t),t||"ETHERS_JS_SHARED"}static getUrl(t,e){He.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(t.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:He.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+e}}const Ve=new v.Yd(ut),We="62e1ad51b37b8e00394bda3b";class Ye extends oe{static getApiKey(t){const e={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return null==t?e.applicationId=We:"string"==typeof t?e.applicationId=t:null!=t.applicationSecretKey?(e.applicationId=t.applicationId,e.applicationSecretKey=t.applicationSecretKey):t.applicationId?e.applicationId=t.applicationId:Ve.throwArgumentError("unsupported PocketProvider apiKey","apiKey",t),e}static getUrl(t,e){let r=null;switch(t?t.name:"unknown"){case"goerli":r="eth-goerli.gateway.pokt.network";break;case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"kovan":r="poa-kovan.gateway.pokt.network";break;case"matic":r="poly-mainnet.gateway.pokt.network";break;case"maticmum":r="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;default:Ve.throwError("unsupported network",v.Yd.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const n={headers:{},url:`https://${r}/v1/lb/${e.applicationId}`};return null!=e.applicationSecretKey&&(n.user="",n.password=e.applicationSecretKey),n}isCommunityResource(){return this.applicationId===We}}const Je=new v.Yd(ut);let Xe=1;function Ze(t,e){const r="Web3LegacyFetcher";return function(t,n){const i={method:t,params:n,id:Xe++,jsonrpc:"2.0"};return new Promise(((t,n)=>{this.emit("debug",{action:"request",fetcher:r,request:(0,m.p$)(i),provider:this}),e(i,((e,o)=>{if(e)return this.emit("debug",{action:"response",fetcher:r,error:e,request:i,provider:this}),n(e);if(this.emit("debug",{action:"response",fetcher:r,request:i,response:o,provider:this}),o.error){const t=new Error(o.error.message);return t.code=o.error.code,t.data=o.error.data,n(t)}t(o.result)}))}))}}class Qe extends Xt{constructor(t,e){null==t&&Je.throwArgumentError("missing provider","provider",t);let r=null,n=null,i=null;"function"==typeof t?(r="unknown:",n=t):(r=t.host||t.path||"",!r&&t.isMetaMask&&(r="metamask"),i=t,t.request?(""===r&&(r="eip-1193:"),n=function(t){return function(e,r){null==r&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:(0,m.p$)(n),provider:this}),t.request(n).then((t=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:t,provider:this}),t}))}}(t)):t.sendAsync?n=Ze(0,t.sendAsync.bind(t)):t.send?n=Ze(0,t.send.bind(t)):Je.throwArgumentError("unsupported provider","provider",t),r||(r="unknown:")),super(r,e),(0,m.zG)(this,"jsonRpcFetchFunc",n),(0,m.zG)(this,"provider",i)}send(t,e){return this.jsonRpcFetchFunc(t,e)}}const tr=new v.Yd(ut);function er(t,e){if(null==t&&(t="homestead"),"string"==typeof t){const e=t.match(/^(ws|http)s?:/i);if(e)switch(e[1].toLowerCase()){case"http":case"https":return new Xt(t);case"ws":case"wss":return new re(t);default:tr.throwArgumentError("unsupported URL scheme","network",t)}}const r=(0,Q.H)(t);return r&&r._defaultProvider||tr.throwError("unsupported getDefaultProvider network",v.Yd.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:De,AlchemyProvider:le,AnkrProvider:de,CloudflareProvider:me,EtherscanProvider:Ae,InfuraProvider:ze,JsonRpcProvider:Xt,NodesmithProvider:$e,PocketProvider:Ye,Web3Provider:Qe,IpcProvider:Fe},e)}var rr=r(9855),nr=r(8659),ir=r(2734),or=r(1388),sr=r(2046),ar=r(7949);const ur=new RegExp("^bytes([0-9]+)$"),lr=new RegExp("^(u?int)([0-9]*)$"),hr=new RegExp("^(.*)\\[([0-9]*)\\]$"),cr="0000000000000000000000000000000000000000000000000000000000000000",fr=new v.Yd("solidity/5.7.0");function dr(t,e,r){switch(t){case"address":return r?(0,p.Bu)(e,32):(0,p.lE)(e);case"string":return(0,it.Y0)(e);case"bytes":return(0,p.lE)(e);case"bool":return e=e?"0x01":"0x00",r?(0,p.Bu)(e,32):(0,p.lE)(e)}let n=t.match(lr);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!=0||0===i||i>256)&&fr.throwArgumentError("invalid number type","type",t),r&&(i=256),e=d.O$.from(e).toTwos(i),(0,p.Bu)(e,i/8)}if(n=t.match(ur),n){const i=parseInt(n[1]);return(String(i)!==n[1]||0===i||i>32)&&fr.throwArgumentError("invalid bytes type","type",t),(0,p.lE)(e).byteLength!==i&&fr.throwArgumentError(`invalid value for ${t}`,"value",e),r?(0,p.lE)((e+cr).substring(0,66)):e}if(n=t.match(hr),n&&Array.isArray(e)){const r=n[1];parseInt(n[2]||String(e.length))!=e.length&&fr.throwArgumentError(`invalid array length for ${t}`,"value",e);const i=[];return e.forEach((function(t){i.push(dr(r,t,!0))})),(0,p.zo)(i)}return fr.throwArgumentError("invalid type","type",t)}function pr(t,e){t.length!=e.length&&fr.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach((function(t,n){r.push(dr(t,e[n]))})),(0,p.Dv)((0,p.zo)(r))}function mr(t,e){return(0,F.w)(pr(t,e))}function gr(t,e){return(0,nt.JQ)(pr(t,e))}var vr=r(1843);function yr(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,n={};return t.split(",").forEach((t=>{let i=t.split(":");r+=parseInt(i[0],16),n[r]=e(i[1])})),n}function br(t){let e=0;return t.split(",").map((t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:n,h:e}}))}function wr(t,e){let r=0;for(let n=0;n=r&&t<=r+i.h&&(t-r)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(t-r))continue;return i}}return null}const Er=br("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),Mr="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((t=>parseInt(t,16))),Ar=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],_r=yr("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Nr=yr("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Sr=yr("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r{if(Mr.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=wr(t,Ar);if(e)return[t+e.s];let r=_r[t];if(r)return r;let n=Nr[t];return n?[t+n[0]]:Sr[t]||null}(t);return e||[t]})),e=r.reduce(((t,e)=>(e.forEach((e=>{t.push(e)})),t)),[]),e=(0,it.XL)((0,it.uu)(e),it.Uj.NFKC),e.forEach((t=>{if(wr(t,Tr))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),e.forEach((t=>{if(wr(t,Er))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=(0,it.uu)(e);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");return n}function Rr(t){const e=(0,it.Y0)(t);if(e.length>31)throw new Error("bytes32 string must be less than 32 bytes");return(0,p.Dv)((0,p.zo)([e,X.R]).slice(0,32))}function xr(t){const e=(0,p.lE)(t);if(32!==e.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==e[31])throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;0===e[r-1];)r--;return(0,it.ZN)(e.slice(0,r))}const Or=new v.Yd("units/5.7.0"),Ir=["wei","kwei","mwei","gwei","szabo","finney","ether"];function Cr(t){const e=String(t).split(".");(e.length>2||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||"."===t||"-."===t)&&Or.throwArgumentError("invalid value","value",t);let r=e[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0");let i="";for(2===e.length&&(i="."+(e[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);const o=[];for(;r.length;){if(r.length<=3){o.unshift(r);break}{const t=r.length-3;o.unshift(r.substring(t)),r=r.substring(0,t)}}return n+o.join(",")+i}function Pr(t,e){if("string"==typeof e){const t=Ir.indexOf(e);-1!==t&&(e=3*t)}return(0,L.S5)(t,null!=e?e:18)}function Lr(t,e){if("string"!=typeof t&&Or.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=Ir.indexOf(e);-1!==t&&(e=3*t)}return(0,L.Ox)(t,null!=e?e:18)}function Ur(t){return Pr(t,18)}function Br(t){return Lr(t,18)}var Dr=r(1261);const Fr="ethers/5.7.2",Gr=new v.Yd(Fr);try{const t=window;null==t._ethers&&(t._ethers=a)}catch(t){}},4376:function(t,e){"use strict";var r=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initBooks=void 0;var n=r(3413),i=document.querySelector("#add-book-modal"),o={placement:"bottom-right",closable:!0,onHide:function(){console.log("modal is hidden")},onShow:function(){console.log("user id: ")},onToggle:function(){console.log("modal has been toggled")}},s=new n.Modal(i,o);e.initBooks=function(){var t=document.querySelector("#modalAddCloseButton");t&&t.addEventListener("click",(function(){s.hide()}))}},8891:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initComments=void 0,e.initComments=function(){var t=document.querySelectorAll("#delete_comment_btn"),e=document.querySelector("#comment_id");t&&e&&t.forEach((function(t){return t.addEventListener("click",(function(){var r=t.getAttribute("data-comment-id");e.value=r}))}));var r=document.querySelectorAll("#edit_comment_btn"),n=document.querySelector("#edit_comment_id"),i=document.querySelector("#edit_comment_text");r&&n&&i&&r.forEach((function(t){return t.addEventListener("click",(function(){var e=t.getAttribute("data-edit-comment-id"),r=t.getAttribute("data-edit-comment-text");n.value=e,i.value=r}))}))}},7086:function(t,e){"use strict";var r=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initQuill=void 0;var n=r(5389);e.initQuill=function(){var t=[["bold","italic","underline"],[{list:"ordered"},{list:"bullet"}],[{header:[1,2,3,4,5,6,!1]}],[{indent:"-1"},{indent:"+1"}],["clean"]];document.querySelectorAll(".quill-editor").forEach((function(e){var r=e.id;r?new n("#"+r,{theme:"snow",modules:{toolbar:t}}):console.error("Please set attribute id to element with class .quill-editor")}))}},8147:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initQuillValueToInput=void 0,e.initQuillValueToInput=function(){document.querySelectorAll(".quill-editor").forEach((function(t){var e=t.id;e?t.addEventListener("DOMSubtreeModified",(function(){!function(t){var e=document.querySelector("#".concat(t,"-input"));if(e){var r=document.querySelector("#"+t).innerHTML;e.value=r}}(e)})):console.error("Please set attribute id to element with class .quill-editor")}))}},9446:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initTheme=void 0,e.initTheme=function(){var t=document.querySelectorAll("#theme-toggle-dark-icon"),e=document.querySelectorAll("#theme-toggle-light-icon");"dark"===localStorage.getItem("color-theme")||!("color-theme"in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?e.forEach((function(t){t.classList.remove("hidden")})):t.forEach((function(t){t.classList.remove("hidden")})),document.querySelectorAll("#theme-toggle").forEach((function(r){r.addEventListener("click",(function(){t.forEach((function(t){t.classList.toggle("hidden")})),e.forEach((function(t){t.classList.toggle("hidden")})),localStorage.getItem("color-theme")?"light"===localStorage.getItem("color-theme")?(document.documentElement.classList.add("dark"),localStorage.setItem("color-theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("color-theme","light")):document.documentElement.classList.contains("dark")?(document.documentElement.classList.remove("dark"),localStorage.setItem("color-theme","light")):(document.documentElement.classList.add("dark"),localStorage.setItem("color-theme","dark"))}))}))}},4970:function(t,e){"use strict";var r=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0?e.classList.add("text-green-500"):l<0&&e.classList.add("text-red-500"),h=u.current_user_vote,o(h),[2]}}))}))}(t,e,s)}))}))}))}},2548:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]1)return e.map((function(e){return t(e)}));var n=e[0];if("string"!=typeof n.blotName&&"string"!=typeof n.attrName)throw new o("Invalid definition");if("abstract"===n.blotName)throw new o("Cannot register abstract class");return h[n.blotName||n.attrName]=n,"string"==typeof n.keyName?a[n.keyName]=n:(null!=n.className&&(u[n.className]=n),null!=n.tagName&&(Array.isArray(n.tagName)?n.tagName=n.tagName.map((function(t){return t.toUpperCase()})):n.tagName=n.tagName.toUpperCase(),(Array.isArray(n.tagName)?n.tagName:[n.tagName]).forEach((function(t){null!=l[t]&&null!=n.className||(l[t]=n)})))),n}},function(t,e,r){var n=r(51),i=r(11),o=r(3),s=r(20),a=String.fromCharCode(0),u=function(t){Array.isArray(t)?this.ops=t:null!=t&&Array.isArray(t.ops)?this.ops=t.ops:this.ops=[]};u.prototype.insert=function(t,e){var r={};return 0===t.length?this:(r.insert=t,null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(r.attributes=e),this.push(r))},u.prototype.delete=function(t){return t<=0?this:this.push({delete:t})},u.prototype.retain=function(t,e){if(t<=0)return this;var r={retain:t};return null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(r.attributes=e),this.push(r)},u.prototype.push=function(t){var e=this.ops.length,r=this.ops[e-1];if(t=o(!0,{},t),"object"==typeof r){if("number"==typeof t.delete&&"number"==typeof r.delete)return this.ops[e-1]={delete:r.delete+t.delete},this;if("number"==typeof r.delete&&null!=t.insert&&(e-=1,"object"!=typeof(r=this.ops[e-1])))return this.ops.unshift(t),this;if(i(t.attributes,r.attributes)){if("string"==typeof t.insert&&"string"==typeof r.insert)return this.ops[e-1]={insert:r.insert+t.insert},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this;if("number"==typeof t.retain&&"number"==typeof r.retain)return this.ops[e-1]={retain:r.retain+t.retain},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this}}return e===this.ops.length?this.ops.push(t):this.ops.splice(e,0,t),this},u.prototype.chop=function(){var t=this.ops[this.ops.length-1];return t&&t.retain&&!t.attributes&&this.ops.pop(),this},u.prototype.filter=function(t){return this.ops.filter(t)},u.prototype.forEach=function(t){this.ops.forEach(t)},u.prototype.map=function(t){return this.ops.map(t)},u.prototype.partition=function(t){var e=[],r=[];return this.forEach((function(n){(t(n)?e:r).push(n)})),[e,r]},u.prototype.reduce=function(t,e){return this.ops.reduce(t,e)},u.prototype.changeLength=function(){return this.reduce((function(t,e){return e.insert?t+s.length(e):e.delete?t-e.delete:t}),0)},u.prototype.length=function(){return this.reduce((function(t,e){return t+s.length(e)}),0)},u.prototype.slice=function(t,e){t=t||0,"number"!=typeof e&&(e=1/0);for(var r=[],n=s.iterator(this.ops),i=0;i0&&(e.push(t.ops[0]),e.ops=e.ops.concat(t.ops.slice(1))),e},u.prototype.diff=function(t,e){if(this.ops===t.ops)return new u;var r=[this,t].map((function(e){return e.map((function(r){if(null!=r.insert)return"string"==typeof r.insert?r.insert:a;throw new Error("diff() called "+(e===t?"on":"with")+" non-document")})).join("")})),o=new u,l=n(r[0],r[1],e),h=s.iterator(this.ops),c=s.iterator(t.ops);return l.forEach((function(t){for(var e=t[1].length;e>0;){var r=0;switch(t[0]){case n.INSERT:r=Math.min(c.peekLength(),e),o.push(c.next(r));break;case n.DELETE:r=Math.min(e,h.peekLength()),h.next(r),o.delete(r);break;case n.EQUAL:r=Math.min(h.peekLength(),c.peekLength(),e);var a=h.next(r),u=c.next(r);i(a.insert,u.insert)?o.retain(r,s.attributes.diff(a.attributes,u.attributes)):o.push(u).delete(r)}e-=r}})),o.chop()},u.prototype.eachLine=function(t,e){e=e||"\n";for(var r=s.iterator(this.ops),n=new u,i=0;r.hasNext();){if("insert"!==r.peekType())return;var o=r.peek(),a=s.length(o)-r.peekLength(),l="string"==typeof o.insert?o.insert.indexOf(e,a)-a:-1;if(l<0)n.push(r.next());else if(l>0)n.push(r.next(l));else{if(!1===t(n,r.next(1).attributes||{},i))return;i+=1,n=new u}}n.length()>0&&t(n,{},i)},u.prototype.transform=function(t,e){if(e=!!e,"number"==typeof t)return this.transformPosition(t,e);for(var r=s.iterator(this.ops),n=s.iterator(t.ops),i=new u;r.hasNext()||n.hasNext();)if("insert"!==r.peekType()||!e&&"insert"===n.peekType())if("insert"===n.peekType())i.push(n.next());else{var o=Math.min(r.peekLength(),n.peekLength()),a=r.next(o),l=n.next(o);if(a.delete)continue;l.delete?i.push(l):i.retain(o,s.attributes.transform(a.attributes,l.attributes,e))}else i.retain(s.length(r.next()));return i.chop()},u.prototype.transformPosition=function(t,e){e=!!e;for(var r=s.iterator(this.ops),n=0;r.hasNext()&&n<=t;){var i=r.peekLength(),o=r.peekType();r.next(),"delete"!==o?("insert"===o&&(n0&&(t1&&void 0!==arguments[1]&&arguments[1];if(r&&(0===t||t>=this.length()-1)){var n=this.clone();return 0===t?(this.parent.insertBefore(n,this),this):(this.parent.insertBefore(n,this.next),n)}var o=i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"split",this).call(this,t,r);return this.cache={},o}}]),e}(a.default.Block);function v(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return null==t?e:("function"==typeof t.formats&&(e=(0,o.default)(e,t.formats())),null==t.parent||"scroll"==t.parent.blotName||t.parent.statics.scope!==t.statics.scope?e:v(t.parent,e))}g.blotName="block",g.tagName="P",g.defaultChild="break",g.allowedChildren=[l.default,a.default.Embed,h.default],e.bubbleFormats=v,e.BlockEmbed=m,e.default=g},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.overload=e.expandConfig=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=w(e,n),this.container=this.options.container,null==this.container)return y.error("Invalid Quill container",e);this.options.debug&&t.debug(this.options.debug);var i=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new u.default,this.scroll=h.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new a.default(this.scroll),this.selection=new f.default(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.theme.init(),this.emitter.on(u.default.events.EDITOR_CHANGE,(function(t){t===u.default.events.TEXT_CHANGE&&r.root.classList.toggle("ql-blank",r.editor.isBlank())})),this.emitter.on(u.default.events.SCROLL_UPDATE,(function(t,e){var n=r.selection.lastRange,i=n&&0===n.length?n.index:void 0;E.call(r,(function(){return r.editor.update(null,e,i)}),t)}));var o=this.clipboard.convert("
"+i+"


");this.setContents(o),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return o(t,null,[{key:"debug",value:function(t){!0===t&&(t="log"),p.default.level(t)}},{key:"find",value:function(t){return t.__quill||h.default.find(t)}},{key:"import",value:function(t){return null==this.imports[t]&&y.error("Cannot import "+t+". Are you sure it was registered?"),this.imports[t]}},{key:"register",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof t){var i=t.attrName||t.blotName;"string"==typeof i?this.register("formats/"+i,t,e):Object.keys(t).forEach((function(n){r.register(n,t[n],e)}))}else null==this.imports[t]||n||y.warn("Overwriting "+t+" with",e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&"abstract"!==e.blotName?h.default.register(e):t.startsWith("modules")&&"function"==typeof e.register&&e.register()}}]),o(t,[{key:"addContainer",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof t){var r=t;(t=document.createElement("div")).classList.add(r)}return this.container.insertBefore(t,e),t}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(t,e,r){var n=this,o=M(t,e,r),s=i(o,4);return t=s[0],e=s[1],r=s[3],E.call(this,(function(){return n.editor.deleteText(t,e)}),r,t,-1*e)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(t),this.container.classList.toggle("ql-disabled",!t)}},{key:"focus",value:function(){var t=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=t,this.scrollIntoView()}},{key:"format",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u.default.sources.API;return E.call(this,(function(){var n=r.getSelection(!0),i=new s.default;if(null==n)return i;if(h.default.query(t,h.default.Scope.BLOCK))i=r.editor.formatLine(n.index,n.length,v({},t,e));else{if(0===n.length)return r.selection.format(t,e),i;i=r.editor.formatText(n.index,n.length,v({},t,e))}return r.setSelection(n,u.default.sources.SILENT),i}),n)}},{key:"formatLine",value:function(t,e,r,n,o){var s,a=this,u=M(t,e,r,n,o),l=i(u,4);return t=l[0],e=l[1],s=l[2],o=l[3],E.call(this,(function(){return a.editor.formatLine(t,e,s)}),o,t,0)}},{key:"formatText",value:function(t,e,r,n,o){var s,a=this,u=M(t,e,r,n,o),l=i(u,4);return t=l[0],e=l[1],s=l[2],o=l[3],E.call(this,(function(){return a.editor.formatText(t,e,s)}),o,t,0)}},{key:"getBounds",value:function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;e="number"==typeof t?this.selection.getBounds(t,r):this.selection.getBounds(t.index,t.length);var n=this.container.getBoundingClientRect();return{bottom:e.bottom-n.top,height:e.height,left:e.left-n.left,right:e.right-n.left,top:e.top-n.top,width:e.width}}},{key:"getContents",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-t,r=M(t,e),n=i(r,2);return t=n[0],e=n[1],this.editor.getContents(t,e)}},{key:"getFormat",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof t?this.editor.getFormat(t,e):this.editor.getFormat(t.index,t.length)}},{key:"getIndex",value:function(t){return t.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(t){return this.scroll.leaf(t)}},{key:"getLine",value:function(t){return this.scroll.line(t)}},{key:"getLines",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof t?this.scroll.lines(t.index,t.length):this.scroll.lines(t,e)}},{key:"getModule",value:function(t){return this.theme.modules[t]}},{key:"getSelection",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-t,r=M(t,e),n=i(r,2);return t=n[0],e=n[1],this.editor.getText(t,e)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(e,r,n){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.sources.API;return E.call(this,(function(){return i.editor.insertEmbed(e,r,n)}),o,e)}},{key:"insertText",value:function(t,e,r,n,o){var s,a=this,u=M(t,0,r,n,o),l=i(u,4);return t=l[0],s=l[2],o=l[3],E.call(this,(function(){return a.editor.insertText(t,e,s)}),o,t,e.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(t,e,r){this.clipboard.dangerouslyPasteHTML(t,e,r)}},{key:"removeFormat",value:function(t,e,r){var n=this,o=M(t,e,r),s=i(o,4);return t=s[0],e=s[1],r=s[3],E.call(this,(function(){return n.editor.removeFormat(t,e)}),r,t)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.default.sources.API;return E.call(this,(function(){t=new s.default(t);var r=e.getLength(),n=e.editor.deleteText(0,r),i=e.editor.applyDelta(t),o=i.ops[i.ops.length-1];return null!=o&&"string"==typeof o.insert&&"\n"===o.insert[o.insert.length-1]&&(e.editor.deleteText(e.getLength()-1,1),i.delete(1)),n.compose(i)}),r)}},{key:"setSelection",value:function(e,r,n){if(null==e)this.selection.setRange(null,r||t.sources.API);else{var o=M(e,r,n),s=i(o,4);e=s[0],r=s[1],n=s[3],this.selection.setRange(new c.Range(e,r),n),n!==u.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.default.sources.API,r=(new s.default).insert(t);return this.setContents(r,e)}},{key:"update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.default.sources.USER,e=this.scroll.update(t);return this.selection.update(t),e}},{key:"updateContents",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.default.sources.API;return E.call(this,(function(){return t=new s.default(t),e.editor.applyDelta(t,r)}),r,!0)}}]),t}();function w(t,e){if((e=(0,d.default)(!0,{container:t,modules:{clipboard:!0,keyboard:!0,history:!0}},e)).theme&&e.theme!==b.DEFAULTS.theme){if(e.theme=b.import("themes/"+e.theme),null==e.theme)throw new Error("Invalid theme "+e.theme+". Did you register it?")}else e.theme=m.default;var r=(0,d.default)(!0,{},e.theme.DEFAULTS);[r,e].forEach((function(t){t.modules=t.modules||{},Object.keys(t.modules).forEach((function(e){!0===t.modules[e]&&(t.modules[e]={})}))}));var n=Object.keys(r.modules).concat(Object.keys(e.modules)).reduce((function(t,e){var r=b.import("modules/"+e);return null==r?y.error("Cannot load "+e+" module. Are you sure you registered it?"):t[e]=r.DEFAULTS||{},t}),{});return null!=e.modules&&e.modules.toolbar&&e.modules.toolbar.constructor!==Object&&(e.modules.toolbar={container:e.modules.toolbar}),e=(0,d.default)(!0,{},b.DEFAULTS,{modules:n},r,e),["bounds","container","scrollingContainer"].forEach((function(t){"string"==typeof e[t]&&(e[t]=document.querySelector(e[t]))})),e.modules=Object.keys(e.modules).reduce((function(t,r){return e.modules[r]&&(t[r]=e.modules[r]),t}),{}),e}function E(t,e,r,n){if(this.options.strict&&!this.isEnabled()&&e===u.default.sources.USER)return new s.default;var i=null==r?null:this.getSelection(),o=this.editor.delta,a=t();if(null!=i&&(!0===r&&(r=i.index),null==n?i=A(i,a,e):0!==n&&(i=A(i,r,n,e)),this.setSelection(i,u.default.sources.SILENT)),a.length()>0){var l,h,c=[u.default.events.TEXT_CHANGE,a,o,e];(l=this.emitter).emit.apply(l,[u.default.events.EDITOR_CHANGE].concat(c)),e!==u.default.sources.SILENT&&(h=this.emitter).emit.apply(h,c)}return a}function M(t,e,r,i,o){var s={};return"number"==typeof t.index&&"number"==typeof t.length?"number"!=typeof e?(o=i,i=r,r=e,e=t.length,t=t.index):(e=t.length,t=t.index):"number"!=typeof e&&(o=i,i=r,r=e,e=0),"object"===(void 0===r?"undefined":n(r))?(s=r,o=i):"string"==typeof r&&(null!=i?s[r]=i:o=r),[t,e,s,o=o||u.default.sources.API]}function A(t,e,r,n){if(null==t)return null;var o=void 0,a=void 0;if(e instanceof s.default){var l=[t.index,t.index+t.length].map((function(t){return e.transformPosition(t,n!==u.default.sources.USER)})),h=i(l,2);o=h[0],a=h[1]}else{var f=[t.index,t.index+t.length].map((function(t){return t=0?t+r:Math.max(e,t+r)})),d=i(f,2);o=d[0],a=d[1]}return new c.Range(o,a-o)}b.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},b.events=u.default.events,b.sources=u.default.sources,b.version="1.3.6",b.imports={delta:s.default,parchment:h.default,"core/module":l.default,"core/theme":m.default},e.expandConfig=w,e.overload=M,e.default=b},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var r=0;r0){var r=this.parent.isolate(this.offset(),this.length());this.moveChildren(r),r.wrap(this)}}}],[{key:"compare",value:function(t,r){var n=e.order.indexOf(t),i=e.order.indexOf(r);return n>=0||i>=0?n-i:t===r?0:t1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.quill=e,this.options=r};n.DEFAULTS={},e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=["error","warn","log","info"],i="warn";function o(t){if(n.indexOf(t)<=n.indexOf(i)){for(var e,r=arguments.length,o=Array(r>1?r-1:0),s=1;s=0;l--)if(c[l]!=f[l])return!1;for(l=c.length-1;l>=0;l--)if(h=c[l],!s(t[h],e[h],r))return!1;return typeof t==typeof e}(t,e,r))};function a(t){return null==t}function u(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length||"function"!=typeof t.copy||"function"!=typeof t.slice||t.length>0&&"number"!=typeof t[0])}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(1),i=function(){function t(t,e,r){void 0===r&&(r={}),this.attrName=t,this.keyName=e;var i=n.Scope.TYPE&n.Scope.ATTRIBUTE;null!=r.scope?this.scope=r.scope&n.Scope.LEVEL|i:this.scope=n.Scope.ATTRIBUTE,null!=r.whitelist&&(this.whitelist=r.whitelist)}return t.keys=function(t){return[].map.call(t.attributes,(function(t){return t.name}))},t.prototype.add=function(t,e){return!!this.canAdd(t,e)&&(t.setAttribute(this.keyName,e),!0)},t.prototype.canAdd=function(t,e){return null!=n.query(t,n.Scope.BLOT&(this.scope|n.Scope.TYPE))&&(null==this.whitelist||("string"==typeof e?this.whitelist.indexOf(e.replace(/["']/g,""))>-1:this.whitelist.indexOf(e)>-1))},t.prototype.remove=function(t){t.removeAttribute(this.keyName)},t.prototype.value=function(t){var e=t.getAttribute(this.keyName);return this.canAdd(t,e)&&e?e:""},t}();e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.Code=void 0;var n=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function t(t,e){for(var r=0;r=t+r)){var s=this.newlineIndex(t,!0)+1,u=o-s+1,l=this.isolate(s,u),h=l.next;l.format(n,i),h instanceof e&&h.formatAt(0,t-s+r-u,n,i)}}}},{key:"insertAt",value:function(t,e,r){if(null==r){var i=this.descendant(h.default,t),o=n(i,2),s=o[0],a=o[1];s.insertAt(a,e)}}},{key:"length",value:function(){var t=this.domNode.textContent.length;return this.domNode.textContent.endsWith("\n")?t:t+1}},{key:"newlineIndex",value:function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return this.domNode.textContent.slice(0,t).lastIndexOf("\n");var e=this.domNode.textContent.slice(t).indexOf("\n");return e>-1?t+e:-1}},{key:"optimize",value:function(t){this.domNode.textContent.endsWith("\n")||this.appendChild(a.default.create("text","\n")),o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t);var r=this.next;null!=r&&r.prev===this&&r.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===r.statics.formats(r.domNode)&&(r.optimize(t),r.moveChildren(this),r.remove())}},{key:"replace",value:function(t){o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"replace",this).call(this,t),[].slice.call(this.domNode.querySelectorAll("*")).forEach((function(t){var e=a.default.find(t);null==e?t.parentNode.removeChild(t):e instanceof a.default.Embed?e.remove():e.unwrap()}))}}],[{key:"create",value:function(t){var r=o(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return r.setAttribute("spellcheck",!1),r}},{key:"formats",value:function(){return!0}}]),e}(u.default);g.blotName="code-block",g.tagName="PRE",g.TAB=" ",e.Code=m,e.default=g},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function t(t,e){for(var r=0;r=o&&!d.endsWith("\n")&&(r=!0),e.scroll.insertAt(t,d);var p=e.scroll.line(t),m=i(p,2),v=m[0],y=m[1],b=(0,g.default)({},(0,c.bubbleFormats)(v));if(v instanceof f.default){var w=v.descendant(u.default.Leaf,y),E=i(w,1)[0];b=(0,g.default)(b,(0,c.bubbleFormats)(E))}h=a.default.attributes.diff(b,h)||{}}else if("object"===n(s.insert)){var M=Object.keys(s.insert)[0];if(null==M)return t;e.scroll.insertAt(t,M,s.insert[M])}o+=l}return Object.keys(h).forEach((function(r){e.scroll.formatAt(t,l,r,h[r])})),t+l}),0),t.reduce((function(t,r){return"number"==typeof r.delete?(e.scroll.deleteAt(t,r.delete),t):t+(r.retain||r.insert.length||1)}),0),this.scroll.batchEnd(),this.update(t)}},{key:"deleteText",value:function(t,e){return this.scroll.deleteAt(t,e),this.update((new s.default).retain(t).delete(e))}},{key:"formatLine",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.scroll.update(),Object.keys(n).forEach((function(i){if(null==r.scroll.whitelist||r.scroll.whitelist[i]){var o=r.scroll.lines(t,Math.max(e,1)),s=e;o.forEach((function(e){var o=e.length();if(e instanceof l.default){var a=t-e.offset(r.scroll),u=e.newlineIndex(a+s)-a+1;e.formatAt(a,u,i,n[i])}else e.format(i,n[i]);s-=o}))}})),this.scroll.optimize(),this.update((new s.default).retain(t).retain(e,(0,p.default)(n)))}},{key:"formatText",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(n).forEach((function(i){r.scroll.formatAt(t,e,i,n[i])})),this.update((new s.default).retain(t).retain(e,(0,p.default)(n)))}},{key:"getContents",value:function(t,e){return this.delta.slice(t,t+e)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce((function(t,e){return t.concat(e.delta())}),new s.default)}},{key:"getFormat",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],n=[];0===e?this.scroll.path(t).forEach((function(t){var e=i(t,1)[0];e instanceof f.default?r.push(e):e instanceof u.default.Leaf&&n.push(e)})):(r=this.scroll.lines(t,e),n=this.scroll.descendants(u.default.Leaf,t,e));var o=[r,n].map((function(t){if(0===t.length)return{};for(var e=(0,c.bubbleFormats)(t.shift());Object.keys(e).length>0;){var r=t.shift();if(null==r)return e;e=w((0,c.bubbleFormats)(r),e)}return e}));return g.default.apply(g.default,o)}},{key:"getText",value:function(t,e){return this.getContents(t,e).filter((function(t){return"string"==typeof t.insert})).map((function(t){return t.insert})).join("")}},{key:"insertEmbed",value:function(t,e,r){return this.scroll.insertAt(t,e,r),this.update((new s.default).retain(t).insert(function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}({},e,r)))}},{key:"insertText",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(t,e),Object.keys(n).forEach((function(i){r.scroll.formatAt(t,e.length,i,n[i])})),this.update((new s.default).retain(t).insert(e,(0,p.default)(n)))}},{key:"isBlank",value:function(){if(0==this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;var t=this.scroll.children.head;return t.statics.blotName===f.default.blotName&&!(t.children.length>1)&&t.children.head instanceof d.default}},{key:"removeFormat",value:function(t,e){var r=this.getText(t,e),n=this.scroll.line(t+e),o=i(n,2),a=o[0],u=o[1],h=0,c=new s.default;null!=a&&(h=a instanceof l.default?a.newlineIndex(u)-u+1:a.length()-u,c=a.delta().slice(u,u+h-1).insert("\n"));var f=this.getContents(t,e+h).diff((new s.default).insert(r).concat(c)),d=(new s.default).retain(t).concat(f);return this.applyDelta(d)}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=this.delta;if(1===e.length&&"characterData"===e[0].type&&e[0].target.data.match(y)&&u.default.find(e[0].target)){var i=u.default.find(e[0].target),o=(0,c.bubbleFormats)(i),a=i.offset(this.scroll),l=e[0].oldValue.replace(h.default.CONTENTS,""),f=(new s.default).insert(l),d=(new s.default).insert(i.value());t=(new s.default).retain(a).concat(f.diff(d,r)).reduce((function(t,e){return e.insert?t.insert(e.insert,o):t.push(e)}),new s.default),this.delta=n.compose(t)}else this.delta=this.getDelta(),t&&(0,m.default)(n.compose(t),this.delta)||(t=n.diff(this.delta,r));return t}}]),t}();function w(t,e){return Object.keys(e).reduce((function(r,n){return null==t[n]||(e[n]===t[n]?r[n]=e[n]:Array.isArray(e[n])?e[n].indexOf(t[n])<0&&(r[n]=e[n].concat([t[n]])):r[n]=[e[n],t[n]]),r}),{})}e.default=b},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.Range=void 0;var n=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:0;c(this,t),this.index=e,this.length=r},p=function(){function t(e,r){var n=this;c(this,t),this.emitter=r,this.scroll=e,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=o.default.create("cursor",this),this.lastRange=this.savedRange=new d(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,(function(){n.mouseDown||setTimeout(n.update.bind(n,u.default.sources.USER),1)})),this.emitter.on(u.default.events.EDITOR_CHANGE,(function(t,e){t===u.default.events.TEXT_CHANGE&&e.length()>0&&n.update(u.default.sources.SILENT)})),this.emitter.on(u.default.events.SCROLL_BEFORE_UPDATE,(function(){if(n.hasFocus()){var t=n.getNativeRange();null!=t&&t.start.node!==n.cursor.textNode&&n.emitter.once(u.default.events.SCROLL_UPDATE,(function(){try{n.setNativeRange(t.start.node,t.start.offset,t.end.node,t.end.offset)}catch(t){}}))}})),this.emitter.on(u.default.events.SCROLL_OPTIMIZE,(function(t,e){if(e.range){var r=e.range,i=r.startNode,o=r.startOffset,s=r.endNode,a=r.endOffset;n.setNativeRange(i,o,s,a)}})),this.update(u.default.sources.SILENT)}return i(t,[{key:"handleComposition",value:function(){var t=this;this.root.addEventListener("compositionstart",(function(){t.composing=!0})),this.root.addEventListener("compositionend",(function(){if(t.composing=!1,t.cursor.parent){var e=t.cursor.restore();if(!e)return;setTimeout((function(){t.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)}),1)}}))}},{key:"handleDragging",value:function(){var t=this;this.emitter.listenDOM("mousedown",document.body,(function(){t.mouseDown=!0})),this.emitter.listenDOM("mouseup",document.body,(function(){t.mouseDown=!1,t.update(u.default.sources.USER)}))}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(t,e){if(null==this.scroll.whitelist||this.scroll.whitelist[t]){this.scroll.update();var r=this.getNativeRange();if(null!=r&&r.native.collapsed&&!o.default.query(t,o.default.Scope.BLOCK)){if(r.start.node!==this.cursor.textNode){var n=o.default.find(r.start.node,!1);if(null==n)return;if(n instanceof o.default.Leaf){var i=n.split(r.start.offset);n.parent.insertBefore(this.cursor,i)}else n.insertBefore(this.cursor,r.start.node);this.cursor.attach()}this.cursor.format(t,e),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}}},{key:"getBounds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.scroll.length();t=Math.min(t,r-1),e=Math.min(t+e,r-1)-t;var i=void 0,o=this.scroll.leaf(t),s=n(o,2),a=s[0],u=s[1];if(null==a)return null;var l=a.position(u,!0),h=n(l,2);i=h[0],u=h[1];var c=document.createRange();if(e>0){c.setStart(i,u);var f=this.scroll.leaf(t+e),d=n(f,2);if(a=d[0],u=d[1],null==a)return null;var p=a.position(u,!0),m=n(p,2);return i=m[0],u=m[1],c.setEnd(i,u),c.getBoundingClientRect()}var g="left",v=void 0;return i instanceof Text?(u0&&(g="right")),{bottom:v.top+v.height,height:v.height,left:v[g],right:v[g],top:v.top,width:0}}},{key:"getNativeRange",value:function(){var t=document.getSelection();if(null==t||t.rangeCount<=0)return null;var e=t.getRangeAt(0);if(null==e)return null;var r=this.normalizeNative(e);return f.info("getNativeRange",r),r}},{key:"getRange",value:function(){var t=this.getNativeRange();return null==t?[null,null]:[this.normalizedToRange(t),t]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(t){var e=this,r=[[t.start.node,t.start.offset]];t.native.collapsed||r.push([t.end.node,t.end.offset]);var i=r.map((function(t){var r=n(t,2),i=r[0],s=r[1],a=o.default.find(i,!0),u=a.offset(e.scroll);return 0===s?u:a instanceof o.default.Container?u+a.length():u+a.index(i,s)})),s=Math.min(Math.max.apply(Math,h(i)),this.scroll.length()-1),a=Math.min.apply(Math,[s].concat(h(i)));return new d(a,s-a)}},{key:"normalizeNative",value:function(t){if(!m(this.root,t.startContainer)||!t.collapsed&&!m(this.root,t.endContainer))return null;var e={start:{node:t.startContainer,offset:t.startOffset},end:{node:t.endContainer,offset:t.endOffset},native:t};return[e.start,e.end].forEach((function(t){for(var e=t.node,r=t.offset;!(e instanceof Text)&&e.childNodes.length>0;)if(e.childNodes.length>r)e=e.childNodes[r],r=0;else{if(e.childNodes.length!==r)break;r=(e=e.lastChild)instanceof Text?e.data.length:e.childNodes.length+1}t.node=e,t.offset=r})),e}},{key:"rangeToNative",value:function(t){var e=this,r=t.collapsed?[t.index]:[t.index,t.index+t.length],i=[],o=this.scroll.length();return r.forEach((function(t,r){t=Math.min(o-1,t);var s,a=e.scroll.leaf(t),u=n(a,2),l=u[0],h=u[1],c=l.position(h,0!==r),f=n(c,2);s=f[0],h=f[1],i.push(s,h)})),i.length<2&&(i=i.concat(i)),i}},{key:"scrollIntoView",value:function(t){var e=this.lastRange;if(null!=e){var r=this.getBounds(e.index,e.length);if(null!=r){var i=this.scroll.length()-1,o=this.scroll.line(Math.min(e.index,i)),s=n(o,1)[0],a=s;if(e.length>0){var u=this.scroll.line(Math.min(e.index+e.length,i));a=n(u,1)[0]}if(null!=s&&null!=a){var l=t.getBoundingClientRect();r.topl.bottom&&(t.scrollTop+=r.bottom-l.bottom)}}}}},{key:"setNativeRange",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(f.info("setNativeRange",t,e,r,n),null==t||null!=this.root.parentNode&&null!=t.parentNode&&null!=r.parentNode){var o=document.getSelection();if(null!=o)if(null!=t){this.hasFocus()||this.root.focus();var s=(this.getNativeRange()||{}).native;if(null==s||i||t!==s.startContainer||e!==s.startOffset||r!==s.endContainer||n!==s.endOffset){"BR"==t.tagName&&(e=[].indexOf.call(t.parentNode.childNodes,t),t=t.parentNode),"BR"==r.tagName&&(n=[].indexOf.call(r.parentNode.childNodes,r),r=r.parentNode);var a=document.createRange();a.setStart(t,e),a.setEnd(r,n),o.removeAllRanges(),o.addRange(a)}}else o.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u.default.sources.API;if("string"==typeof e&&(r=e,e=!1),f.info("setRange",t),null!=t){var n=this.rangeToNative(t);this.setNativeRange.apply(this,h(n).concat([e]))}else this.setNativeRange(null);this.update(r)}},{key:"update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.default.sources.USER,e=this.lastRange,r=this.getRange(),i=n(r,2),o=i[0],l=i[1];if(this.lastRange=o,null!=this.lastRange&&(this.savedRange=this.lastRange),!(0,a.default)(e,this.lastRange)){var h;!this.composing&&null!=l&&l.native.collapsed&&l.start.node!==this.cursor.textNode&&this.cursor.restore();var c,f=[u.default.events.SELECTION_CHANGE,(0,s.default)(this.lastRange),(0,s.default)(e),t];(h=this.emitter).emit.apply(h,[u.default.events.EDITOR_CHANGE].concat(f)),t!==u.default.sources.SILENT&&(c=this.emitter).emit.apply(c,f)}}}]),t}();function m(t,e){try{e.parentNode}catch(t){return!1}return e instanceof Text&&(e=e.parentNode),t.contains(e)}e.Range=d,e.default=p},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,i=function(){function t(t,e){for(var r=0;r0&&(r+=1),[this.parent.domNode,r]},e.prototype.value=function(){return(t={})[this.statics.blotName]=this.statics.value(this.domNode)||!0,t;var t},e.scope=s.Scope.INLINE_BLOT,e}(o.default);e.default=a},function(t,e,r){var n=r(11),i=r(3),o={attributes:{compose:function(t,e,r){"object"!=typeof t&&(t={}),"object"!=typeof e&&(e={});var n=i(!0,{},e);for(var o in r||(n=Object.keys(n).reduce((function(t,e){return null!=n[e]&&(t[e]=n[e]),t}),{})),t)void 0!==t[o]&&void 0===e[o]&&(n[o]=t[o]);return Object.keys(n).length>0?n:void 0},diff:function(t,e){"object"!=typeof t&&(t={}),"object"!=typeof e&&(e={});var r=Object.keys(t).concat(Object.keys(e)).reduce((function(r,i){return n(t[i],e[i])||(r[i]=void 0===e[i]?null:e[i]),r}),{});return Object.keys(r).length>0?r:void 0},transform:function(t,e,r){if("object"!=typeof t)return e;if("object"==typeof e){if(!r)return e;var n=Object.keys(e).reduce((function(r,n){return void 0===t[n]&&(r[n]=e[n]),r}),{});return Object.keys(n).length>0?n:void 0}}},iterator:function(t){return new s(t)},length:function(t){return"number"==typeof t.delete?t.delete:"number"==typeof t.retain?t.retain:"string"==typeof t.insert?t.insert.length:1}};function s(t){this.ops=t,this.index=0,this.offset=0}s.prototype.hasNext=function(){return this.peekLength()<1/0},s.prototype.next=function(t){t||(t=1/0);var e=this.ops[this.index];if(e){var r=this.offset,n=o.length(e);if(t>=n-r?(t=n-r,this.index+=1,this.offset=0):this.offset+=t,"number"==typeof e.delete)return{delete:t};var i={};return e.attributes&&(i.attributes=e.attributes),"number"==typeof e.retain?i.retain=t:"string"==typeof e.insert?i.insert=e.insert.substr(r,t):i.insert=e.insert,i}return{retain:1/0}},s.prototype.peek=function(){return this.ops[this.index]},s.prototype.peekLength=function(){return this.ops[this.index]?o.length(this.ops[this.index])-this.offset:1/0},s.prototype.peekType=function(){return this.ops[this.index]?"number"==typeof this.ops[this.index].delete?"delete":"number"==typeof this.ops[this.index].retain?"retain":"insert":"retain"},t.exports=o},function(t,e){var r=function(){"use strict";function t(t,e){return null!=e&&t instanceof e}var e,r,n;try{e=Map}catch(t){e=function(){}}try{r=Set}catch(t){r=function(){}}try{n=Promise}catch(t){n=function(){}}function i(o,a,u,l,h){"object"==typeof a&&(u=a.depth,l=a.prototype,h=a.includeNonEnumerable,a=a.circular);var c=[],f=[],d="undefined"!=typeof Buffer;return void 0===a&&(a=!0),void 0===u&&(u=1/0),function o(u,p){if(null===u)return null;if(0===p)return u;var m,g;if("object"!=typeof u)return u;if(t(u,e))m=new e;else if(t(u,r))m=new r;else if(t(u,n))m=new n((function(t,e){u.then((function(e){t(o(e,p-1))}),(function(t){e(o(t,p-1))}))}));else if(i.__isArray(u))m=[];else if(i.__isRegExp(u))m=new RegExp(u.source,s(u)),u.lastIndex&&(m.lastIndex=u.lastIndex);else if(i.__isDate(u))m=new Date(u.getTime());else{if(d&&Buffer.isBuffer(u))return m=new Buffer(u.length),u.copy(m),m;t(u,Error)?m=Object.create(u):void 0===l?(g=Object.getPrototypeOf(u),m=Object.create(g)):(m=Object.create(l),g=l)}if(a){var v=c.indexOf(u);if(-1!=v)return f[v];c.push(u),f.push(m)}for(var y in t(u,e)&&u.forEach((function(t,e){var r=o(e,p-1),n=o(t,p-1);m.set(r,n)})),t(u,r)&&u.forEach((function(t){var e=o(t,p-1);m.add(e)})),u){var b;g&&(b=Object.getOwnPropertyDescriptor(g,y)),b&&null==b.set||(m[y]=o(u[y],p-1))}if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(u);for(y=0;y0){if(a instanceof u.BlockEmbed||d instanceof u.BlockEmbed)return void this.optimize();if(a instanceof c.default){var p=a.newlineIndex(a.length(),!0);if(p>-1&&(a=a.split(p+1))===d)return void this.optimize()}else if(d instanceof c.default){var m=d.newlineIndex(0);m>-1&&d.split(m+1)}var g=d.children.head instanceof h.default?null:d.children.head;a.moveChildren(d,g),a.remove()}this.optimize()}},{key:"enable",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",t)}},{key:"formatAt",value:function(t,r,n,i){(null==this.whitelist||this.whitelist[n])&&(o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"formatAt",this).call(this,t,r,n,i),this.optimize())}},{key:"insertAt",value:function(t,r,n){if(null==n||null==this.whitelist||this.whitelist[r]){if(t>=this.length())if(null==n||null==s.default.query(r,s.default.Scope.BLOCK)){var i=s.default.create(this.statics.defaultChild);this.appendChild(i),null==n&&r.endsWith("\n")&&(r=r.slice(0,-1)),i.insertAt(0,r,n)}else{var a=s.default.create(r,n);this.appendChild(a)}else o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertAt",this).call(this,t,r,n);this.optimize()}}},{key:"insertBefore",value:function(t,r){if(t.statics.scope===s.default.Scope.INLINE_BLOT){var n=s.default.create(this.statics.defaultChild);n.appendChild(t),t=n}o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertBefore",this).call(this,t,r)}},{key:"leaf",value:function(t){return this.path(t).pop()||[null,-1]}},{key:"line",value:function(t){return t===this.length()?this.line(t-1):this.descendant(p,t)}},{key:"lines",value:function(){return function t(e,r,n){var i=[],o=n;return e.children.forEachAt(r,n,(function(e,r,n){p(e)?i.push(e):e instanceof s.default.Container&&(i=i.concat(t(e,r,o))),o-=n})),i}(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE)}},{key:"optimize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!0!==this.batch&&(o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t,r),t.length>0&&this.emitter.emit(a.default.events.SCROLL_OPTIMIZE,t,r))}},{key:"path",value:function(t){return o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"path",this).call(this,t).slice(1)}},{key:"update",value:function(t){if(!0!==this.batch){var r=a.default.sources.USER;"string"==typeof t&&(r=t),Array.isArray(t)||(t=this.observer.takeRecords()),t.length>0&&this.emitter.emit(a.default.events.SCROLL_BEFORE_UPDATE,r,t),o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"update",this).call(this,t.concat([])),t.length>0&&this.emitter.emit(a.default.events.SCROLL_UPDATE,r,t)}}}]),e}(s.default.Scroll);m.blotName="scroll",m.className="ql-editor",m.tagName="DIV",m.defaultChild="block",m.allowedChildren=[l.default,u.BlockEmbed,f.default],e.default=m},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SHORTKEY=e.default=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=T(t);if(null==n||null==n.key)return v.warn("Attempted to add invalid keyboard binding",n);"function"==typeof e&&(e={handler:e}),"function"==typeof r&&(r={handler:r}),n=(0,u.default)(n,e,r),this.bindings[n.key]=this.bindings[n.key]||[],this.bindings[n.key].push(n)}},{key:"listen",value:function(){var t=this;this.quill.root.addEventListener("keydown",(function(r){if(!r.defaultPrevented){var o=r.which||r.keyCode,s=(t.bindings[o]||[]).filter((function(t){return e.match(r,t)}));if(0!==s.length){var u=t.quill.getSelection();if(null!=u&&t.quill.hasFocus()){var l=t.quill.getLine(u.index),h=i(l,2),f=h[0],d=h[1],p=t.quill.getLeaf(u.index),m=i(p,2),g=m[0],v=m[1],y=0===u.length?[g,v]:t.quill.getLeaf(u.index+u.length),b=i(y,2),w=b[0],E=b[1],M=g instanceof c.default.Text?g.value().slice(0,v):"",A=w instanceof c.default.Text?w.value().slice(E):"",_={collapsed:0===u.length,empty:0===u.length&&f.length()<=1,format:t.quill.getFormat(u),offset:d,prefix:M,suffix:A};s.some((function(e){if(null!=e.collapsed&&e.collapsed!==_.collapsed)return!1;if(null!=e.empty&&e.empty!==_.empty)return!1;if(null!=e.offset&&e.offset!==_.offset)return!1;if(Array.isArray(e.format)){if(e.format.every((function(t){return null==_.format[t]})))return!1}else if("object"===n(e.format)&&!Object.keys(e.format).every((function(t){return!0===e.format[t]?null!=_.format[t]:!1===e.format[t]?null==_.format[t]:(0,a.default)(e.format[t],_.format[t])})))return!1;return!(null!=e.prefix&&!e.prefix.test(_.prefix)||null!=e.suffix&&!e.suffix.test(_.suffix)||!0===e.handler.call(t,u,_))}))&&r.preventDefault()}}}}))}}]),e}(p.default);function w(t,e){var r,n=t===b.keys.LEFT?"prefix":"suffix";return g(r={key:t,shiftKey:e,altKey:null},n,/^$/),g(r,"handler",(function(r){var n=r.index;t===b.keys.RIGHT&&(n+=r.length+1);var o=this.quill.getLeaf(n);return!(i(o,1)[0]instanceof c.default.Embed&&(t===b.keys.LEFT?e?this.quill.setSelection(r.index-1,r.length+1,f.default.sources.USER):this.quill.setSelection(r.index-1,f.default.sources.USER):e?this.quill.setSelection(r.index,r.length+1,f.default.sources.USER):this.quill.setSelection(r.index+r.length+1,f.default.sources.USER),1))})),r}function E(t,e){if(!(0===t.index||this.quill.getLength()<=1)){var r=this.quill.getLine(t.index),n=i(r,1)[0],o={};if(0===e.offset){var s=this.quill.getLine(t.index-1),a=i(s,1)[0];if(null!=a&&a.length()>1){var u=n.formats(),l=this.quill.getFormat(t.index-1,1);o=h.default.attributes.diff(u,l)||{}}}var c=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(e.prefix)?2:1;this.quill.deleteText(t.index-c,c,f.default.sources.USER),Object.keys(o).length>0&&this.quill.formatLine(t.index-c,c,o,f.default.sources.USER),this.quill.focus()}}function M(t,e){var r=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(!(t.index>=this.quill.getLength()-r)){var n={},o=0,s=this.quill.getLine(t.index),a=i(s,1)[0];if(e.offset>=a.length()-1){var u=this.quill.getLine(t.index+1),l=i(u,1)[0];if(l){var c=a.formats(),d=this.quill.getFormat(t.index,1);n=h.default.attributes.diff(c,d)||{},o=l.length()}}this.quill.deleteText(t.index,r,f.default.sources.USER),Object.keys(n).length>0&&this.quill.formatLine(t.index+o-1,r,n,f.default.sources.USER)}}function A(t){var e=this.quill.getLines(t),r={};if(e.length>1){var n=e[0].formats(),i=e[e.length-1].formats();r=h.default.attributes.diff(i,n)||{}}this.quill.deleteText(t,f.default.sources.USER),Object.keys(r).length>0&&this.quill.formatLine(t.index,1,r,f.default.sources.USER),this.quill.setSelection(t.index,f.default.sources.SILENT),this.quill.focus()}function _(t,e){var r=this;t.length>0&&this.quill.scroll.deleteAt(t.index,t.length);var n=Object.keys(e.format).reduce((function(t,r){return c.default.query(r,c.default.Scope.BLOCK)&&!Array.isArray(e.format[r])&&(t[r]=e.format[r]),t}),{});this.quill.insertText(t.index,"\n",n,f.default.sources.USER),this.quill.setSelection(t.index+1,f.default.sources.SILENT),this.quill.focus(),Object.keys(e.format).forEach((function(t){null==n[t]&&(Array.isArray(e.format[t])||"link"!==t&&r.quill.format(t,e.format[t],f.default.sources.USER))}))}function N(t){return{key:b.keys.TAB,shiftKey:!t,format:{"code-block":!0},handler:function(e){var r=c.default.query("code-block"),n=e.index,o=e.length,s=this.quill.scroll.descendant(r,n),a=i(s,2),u=a[0],l=a[1];if(null!=u){var h=this.quill.getIndex(u),d=u.newlineIndex(l,!0)+1,p=u.newlineIndex(h+l+o),m=u.domNode.textContent.slice(d,p).split("\n");l=0,m.forEach((function(e,i){t?(u.insertAt(d+l,r.TAB),l+=r.TAB.length,0===i?n+=r.TAB.length:o+=r.TAB.length):e.startsWith(r.TAB)&&(u.deleteAt(d+l,r.TAB.length),l-=r.TAB.length,0===i?n-=r.TAB.length:o-=r.TAB.length),l+=e.length+1})),this.quill.update(f.default.sources.USER),this.quill.setSelection(n,o,f.default.sources.SILENT)}}}}function S(t){return{key:t[0].toUpperCase(),shortKey:!0,handler:function(e,r){this.quill.format(t,!r.format[t],f.default.sources.USER)}}}function T(t){if("string"==typeof t||"number"==typeof t)return T({key:t});if("object"===(void 0===t?"undefined":n(t))&&(t=(0,s.default)(t,!1)),"string"==typeof t.key)if(null!=b.keys[t.key.toUpperCase()])t.key=b.keys[t.key.toUpperCase()];else{if(1!==t.key.length)return null;t.key=t.key.toUpperCase().charCodeAt(0)}return t.shortKey&&(t[y]=t.shortKey,delete t.shortKey),t}b.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},b.DEFAULTS={bindings:{bold:S("bold"),italic:S("italic"),underline:S("underline"),indent:{key:b.keys.TAB,format:["blockquote","indent","list"],handler:function(t,e){if(e.collapsed&&0!==e.offset)return!0;this.quill.format("indent","+1",f.default.sources.USER)}},outdent:{key:b.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(t,e){if(e.collapsed&&0!==e.offset)return!0;this.quill.format("indent","-1",f.default.sources.USER)}},"outdent backspace":{key:b.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(t,e){null!=e.format.indent?this.quill.format("indent","-1",f.default.sources.USER):null!=e.format.list&&this.quill.format("list",!1,f.default.sources.USER)}},"indent code-block":N(!0),"outdent code-block":N(!1),"remove tab":{key:b.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(t){this.quill.deleteText(t.index-1,1,f.default.sources.USER)}},tab:{key:b.keys.TAB,handler:function(t){this.quill.history.cutoff();var e=(new l.default).retain(t.index).delete(t.length).insert("\t");this.quill.updateContents(e,f.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index+1,f.default.sources.SILENT)}},"list empty enter":{key:b.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(t,e){this.quill.format("list",!1,f.default.sources.USER),e.format.indent&&this.quill.format("indent",!1,f.default.sources.USER)}},"checklist enter":{key:b.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(t){var e=this.quill.getLine(t.index),r=i(e,2),n=r[0],o=r[1],s=(0,u.default)({},n.formats(),{list:"checked"}),a=(new l.default).retain(t.index).insert("\n",s).retain(n.length()-o-1).retain(1,{list:"unchecked"});this.quill.updateContents(a,f.default.sources.USER),this.quill.setSelection(t.index+1,f.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:b.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(t,e){var r=this.quill.getLine(t.index),n=i(r,2),o=n[0],s=n[1],a=(new l.default).retain(t.index).insert("\n",e.format).retain(o.length()-s-1).retain(1,{header:null});this.quill.updateContents(a,f.default.sources.USER),this.quill.setSelection(t.index+1,f.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(t,e){var r=e.prefix.length,n=this.quill.getLine(t.index),o=i(n,2),s=o[0],a=o[1];if(a>r)return!0;var u=void 0;switch(e.prefix.trim()){case"[]":case"[ ]":u="unchecked";break;case"[x]":u="checked";break;case"-":case"*":u="bullet";break;default:u="ordered"}this.quill.insertText(t.index," ",f.default.sources.USER),this.quill.history.cutoff();var h=(new l.default).retain(t.index-a).delete(r+1).retain(s.length()-2-a).retain(1,{list:u});this.quill.updateContents(h,f.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index-r,f.default.sources.SILENT)}},"code exit":{key:b.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(t){var e=this.quill.getLine(t.index),r=i(e,2),n=r[0],o=r[1],s=(new l.default).retain(t.index+n.length()-o-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(s,f.default.sources.USER)}},"embed left":w(b.keys.LEFT,!1),"embed left shift":w(b.keys.LEFT,!0),"embed right":w(b.keys.RIGHT,!1),"embed right shift":w(b.keys.RIGHT,!0)}},e.default=b,e.SHORTKEY=y},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0},i=function(){function t(t,e){for(var r=0;r-1}s.blotName="link",s.tagName="A",s.SANITIZED_URL="about:blank",s.PROTOCOL_WHITELIST=["http","https","mailto","tel"],e.default=s,e.sanitize=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]&&arguments[1],r=this.container.querySelector(".ql-selected");if(t!==r&&(null!=r&&r.classList.remove("ql-selected"),null!=t&&(t.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(t.parentNode.children,t),t.hasAttribute("data-value")?this.label.setAttribute("data-value",t.getAttribute("data-value")):this.label.removeAttribute("data-value"),t.hasAttribute("data-label")?this.label.setAttribute("data-label",t.getAttribute("data-label")):this.label.removeAttribute("data-label"),e))){if("function"==typeof Event)this.select.dispatchEvent(new Event("change"));else if("object"===("undefined"==typeof Event?"undefined":n(Event))){var i=document.createEvent("Event");i.initEvent("change",!0,!0),this.select.dispatchEvent(i)}this.close()}}},{key:"update",value:function(){var t=void 0;if(this.select.selectedIndex>-1){var e=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];t=this.select.options[this.select.selectedIndex],this.selectItem(e)}else this.selectItem(null);var r=null!=t&&t!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",r)}}]),t}();e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=v(r(0)),i=v(r(5)),o=r(4),s=v(o),a=v(r(16)),u=v(r(25)),l=v(r(24)),h=v(r(35)),c=v(r(6)),f=v(r(22)),d=v(r(7)),p=v(r(55)),m=v(r(42)),g=v(r(23));function v(t){return t&&t.__esModule?t:{default:t}}i.default.register({"blots/block":s.default,"blots/block/embed":o.BlockEmbed,"blots/break":a.default,"blots/container":u.default,"blots/cursor":l.default,"blots/embed":h.default,"blots/inline":c.default,"blots/scroll":f.default,"blots/text":d.default,"modules/clipboard":p.default,"modules/history":m.default,"modules/keyboard":g.default}),n.default.register(s.default,a.default,l.default,c.default,f.default,d.default),e.default=i.default},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(1),i=function(){function t(t){this.domNode=t,this.domNode[n.DATA_KEY]={blot:this}}return Object.defineProperty(t.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),t.create=function(t){if(null==this.tagName)throw new n.ParchmentError("Blot definition missing tagName");var e;return Array.isArray(this.tagName)?("string"==typeof t&&(t=t.toUpperCase(),parseInt(t).toString()===t&&(t=parseInt(t))),e="number"==typeof t?document.createElement(this.tagName[t-1]):this.tagName.indexOf(t)>-1?document.createElement(t):document.createElement(this.tagName[0])):e=document.createElement(this.tagName),this.className&&e.classList.add(this.className),e},t.prototype.attach=function(){null!=this.parent&&(this.scroll=this.parent.scroll)},t.prototype.clone=function(){var t=this.domNode.cloneNode(!1);return n.create(t)},t.prototype.detach=function(){null!=this.parent&&this.parent.removeChild(this),delete this.domNode[n.DATA_KEY]},t.prototype.deleteAt=function(t,e){this.isolate(t,e).remove()},t.prototype.formatAt=function(t,e,r,i){var o=this.isolate(t,e);if(null!=n.query(r,n.Scope.BLOT)&&i)o.wrap(r,i);else if(null!=n.query(r,n.Scope.ATTRIBUTE)){var s=n.create(this.statics.scope);o.wrap(s),s.format(r,i)}},t.prototype.insertAt=function(t,e,r){var i=null==r?n.create("text",e):n.create(e,r),o=this.split(t);this.parent.insertBefore(i,o)},t.prototype.insertInto=function(t,e){void 0===e&&(e=null),null!=this.parent&&this.parent.children.remove(this);var r=null;t.children.insertBefore(this,e),null!=e&&(r=e.domNode),this.domNode.parentNode==t.domNode&&this.domNode.nextSibling==r||t.domNode.insertBefore(this.domNode,r),this.parent=t,this.attach()},t.prototype.isolate=function(t,e){var r=this.split(t);return r.split(e),r},t.prototype.length=function(){return 1},t.prototype.offset=function(t){return void 0===t&&(t=this.parent),null==this.parent||this==t?0:this.parent.children.offset(this)+this.parent.offset(t)},t.prototype.optimize=function(t){null!=this.domNode[n.DATA_KEY]&&delete this.domNode[n.DATA_KEY].mutations},t.prototype.remove=function(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},t.prototype.replace=function(t){null!=t.parent&&(t.parent.insertBefore(this,t.next),t.remove())},t.prototype.replaceWith=function(t,e){var r="string"==typeof t?n.create(t,e):t;return r.replace(this),r},t.prototype.split=function(t,e){return 0===t?this:this.next},t.prototype.update=function(t,e){},t.prototype.wrap=function(t,e){var r="string"==typeof t?n.create(t,e):t;return null!=this.parent&&this.parent.insertBefore(r,this.next),r.appendChild(this),r},t.blotName="abstract",t}();e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(12),i=r(32),o=r(33),s=r(1),a=function(){function t(t){this.attributes={},this.domNode=t,this.build()}return t.prototype.attribute=function(t,e){e?t.add(this.domNode,e)&&(null!=t.value(this.domNode)?this.attributes[t.attrName]=t:delete this.attributes[t.attrName]):(t.remove(this.domNode),delete this.attributes[t.attrName])},t.prototype.build=function(){var t=this;this.attributes={};var e=n.default.keys(this.domNode),r=i.default.keys(this.domNode),a=o.default.keys(this.domNode);e.concat(r).concat(a).forEach((function(e){var r=s.query(e,s.Scope.ATTRIBUTE);r instanceof n.default&&(t.attributes[r.attrName]=r)}))},t.prototype.copy=function(t){var e=this;Object.keys(this.attributes).forEach((function(r){var n=e.attributes[r].value(e.domNode);t.format(r,n)}))},t.prototype.move=function(t){var e=this;this.copy(t),Object.keys(this.attributes).forEach((function(t){e.attributes[t].remove(e.domNode)})),this.attributes={}},t.prototype.values=function(){var t=this;return Object.keys(this.attributes).reduce((function(e,r){return e[r]=t.attributes[r].value(t.domNode),e}),{})},t}();e.default=a},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function o(t,e){return(t.getAttribute("class")||"").split(/\s+/).filter((function(t){return 0===t.indexOf(e+"-")}))}Object.defineProperty(e,"__esModule",{value:!0});var s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.keys=function(t){return(t.getAttribute("class")||"").split(/\s+/).map((function(t){return t.split("-").slice(0,-1).join("-")}))},e.prototype.add=function(t,e){return!!this.canAdd(t,e)&&(this.remove(t),t.classList.add(this.keyName+"-"+e),!0)},e.prototype.remove=function(t){o(t,this.keyName).forEach((function(e){t.classList.remove(e)})),0===t.classList.length&&t.removeAttribute("class")},e.prototype.value=function(t){var e=(o(t,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(t,e)?e:""},e}(r(12).default);e.default=s},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function o(t){var e=t.split("-"),r=e.slice(1).map((function(t){return t[0].toUpperCase()+t.slice(1)})).join("");return e[0]+r}Object.defineProperty(e,"__esModule",{value:!0});var s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.keys=function(t){return(t.getAttribute("style")||"").split(";").map((function(t){return t.split(":")[0].trim()}))},e.prototype.add=function(t,e){return!!this.canAdd(t,e)&&(t.style[o(this.keyName)]=e,!0)},e.prototype.remove=function(t){t.style[o(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")},e.prototype.value=function(t){var e=t.style[o(this.keyName)];return this.canAdd(t,e)?e:""},e}(r(12).default);e.default=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var r=0;rn&&this.stack.undo.length>0){var i=this.stack.undo.pop();r=r.compose(i.undo),t=i.redo.compose(t)}else this.lastRecorded=n;this.stack.undo.push({redo:t,undo:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(t){this.stack.undo.forEach((function(e){e.undo=t.transform(e.undo,!0),e.redo=t.transform(e.redo,!0)})),this.stack.redo.forEach((function(e){e.undo=t.transform(e.undo,!0),e.redo=t.transform(e.redo,!0)}))}},{key:"undo",value:function(){this.change("undo","redo")}}]),e}(s(r(9)).default);function u(t){var e=t.reduce((function(t,e){return t+(e.delete||0)}),0),r=t.length()-e;return function(t){var e=t.ops[t.ops.length-1];return null!=e&&(null!=e.insert?"string"==typeof e.insert&&e.insert.endsWith("\n"):null!=e.attributes&&Object.keys(e.attributes).some((function(t){return null!=i.default.query(t,i.default.Scope.BLOCK)})))}(t)&&(r-=1),r}a.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1},e.default=a,e.getLastChangeIndex=u},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.BaseTooltip=void 0;var n=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"link",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null!=e?this.textbox.value=e:t!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+t)||""),this.root.setAttribute("data-mode",t)}},{key:"restoreFocus",value:function(){var t=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=t}},{key:"save",value:function(){var t,e,r=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":var n=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",r,a.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",r,a.default.sources.USER)),this.quill.root.scrollTop=n;break;case"video":r=(e=(t=r).match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/))?(e[1]||"https")+"://www.youtube.com/embed/"+e[2]+"?showinfo=0":(e=t.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(e[1]||"https")+"://player.vimeo.com/video/"+e[2]+"/":t;case"formula":if(!r)break;var i=this.quill.getSelection(!0);if(null!=i){var o=i.index+i.length;this.quill.insertEmbed(o,this.root.getAttribute("data-mode"),r,a.default.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(o+1," ",a.default.sources.USER),this.quill.setSelection(o+2,a.default.sources.USER)}}this.textbox.value="",this.hide()}}]),e}(d.default);function N(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.forEach((function(e){var n=document.createElement("option");e===r?n.setAttribute("selected","selected"):n.setAttribute("value",e),t.appendChild(n)}))}e.BaseTooltip=_,e.default=A},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){this.head=this.tail=null,this.length=0}return t.prototype.append=function(){for(var t=[],e=0;e1&&this.append.apply(this,t.slice(1))},t.prototype.contains=function(t){for(var e,r=this.iterator();e=r();)if(e===t)return!0;return!1},t.prototype.insertBefore=function(t,e){t&&(t.next=e,null!=e?(t.prev=e.prev,null!=e.prev&&(e.prev.next=t),e.prev=t,e===this.head&&(this.head=t)):null!=this.tail?(this.tail.next=t,t.prev=this.tail,this.tail=t):(t.prev=null,this.head=this.tail=t),this.length+=1)},t.prototype.offset=function(t){for(var e=0,r=this.head;null!=r;){if(r===t)return e;e+=r.length(),r=r.next}return-1},t.prototype.remove=function(t){this.contains(t)&&(null!=t.prev&&(t.prev.next=t.next),null!=t.next&&(t.next.prev=t.prev),t===this.head&&(this.head=t.next),t===this.tail&&(this.tail=t.prev),this.length-=1)},t.prototype.iterator=function(t){return void 0===t&&(t=this.head),function(){var e=t;return null!=t&&(t=t.next),e}},t.prototype.find=function(t,e){void 0===e&&(e=!1);for(var r,n=this.iterator();r=n();){var i=r.length();if(ts?r(n,t-s,Math.min(e,s+u-t)):r(n,0,Math.min(u,t+e-s)),s+=u}},t.prototype.map=function(t){return this.reduce((function(e,r){return e.push(t(r)),e}),[])},t.prototype.reduce=function(t,e){for(var r,n=this.iterator();r=n();)e=t(e,r);return e},t}();e.default=n},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=r(17),s=r(1),a={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},u=function(t){function e(e){var r=t.call(this,e)||this;return r.scroll=r,r.observer=new MutationObserver((function(t){r.update(t)})),r.observer.observe(r.domNode,a),r.attach(),r}return i(e,t),e.prototype.detach=function(){t.prototype.detach.call(this),this.observer.disconnect()},e.prototype.deleteAt=function(e,r){this.update(),0===e&&r===this.length()?this.children.forEach((function(t){t.remove()})):t.prototype.deleteAt.call(this,e,r)},e.prototype.formatAt=function(e,r,n,i){this.update(),t.prototype.formatAt.call(this,e,r,n,i)},e.prototype.insertAt=function(e,r,n){this.update(),t.prototype.insertAt.call(this,e,r,n)},e.prototype.optimize=function(e,r){var n=this;void 0===e&&(e=[]),void 0===r&&(r={}),t.prototype.optimize.call(this,r);for(var i=[].slice.call(this.observer.takeRecords());i.length>0;)e.push(i.pop());for(var a=function(t,e){void 0===e&&(e=!0),null!=t&&t!==n&&null!=t.domNode.parentNode&&(null==t.domNode[s.DATA_KEY].mutations&&(t.domNode[s.DATA_KEY].mutations=[]),e&&a(t.parent))},u=function(t){null!=t.domNode[s.DATA_KEY]&&null!=t.domNode[s.DATA_KEY].mutations&&(t instanceof o.default&&t.children.forEach(u),t.optimize(r))},l=e,h=0;l.length>0;h+=1){if(h>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(l.forEach((function(t){var e=s.find(t.target,!0);null!=e&&(e.domNode===t.target&&("childList"===t.type?(a(s.find(t.previousSibling,!1)),[].forEach.call(t.addedNodes,(function(t){var e=s.find(t,!1);a(e,!1),e instanceof o.default&&e.children.forEach((function(t){a(t,!1)}))}))):"attributes"===t.type&&a(e.prev)),a(e))})),this.children.forEach(u),i=(l=[].slice.call(this.observer.takeRecords())).slice();i.length>0;)e.push(i.pop())}},e.prototype.update=function(e,r){var n=this;void 0===r&&(r={}),(e=e||this.observer.takeRecords()).map((function(t){var e=s.find(t.target,!0);return null==e?null:null==e.domNode[s.DATA_KEY].mutations?(e.domNode[s.DATA_KEY].mutations=[t],e):(e.domNode[s.DATA_KEY].mutations.push(t),null)})).forEach((function(t){null!=t&&t!==n&&null!=t.domNode[s.DATA_KEY]&&t.update(t.domNode[s.DATA_KEY].mutations||[],r)})),null!=this.domNode[s.DATA_KEY].mutations&&t.prototype.update.call(this,this.domNode[s.DATA_KEY].mutations,r),this.optimize(e,r)},e.blotName="scroll",e.defaultChild="block",e.scope=s.Scope.BLOCK_BLOT,e.tagName="DIV",e}(o.default);e.default=u},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=r(18),s=r(1),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.formats=function(r){if(r.tagName!==e.tagName)return t.formats.call(this,r)},e.prototype.format=function(r,n){var i=this;r!==this.statics.blotName||n?t.prototype.format.call(this,r,n):(this.children.forEach((function(t){t instanceof o.default||(t=t.wrap(e.blotName,!0)),i.attributes.copy(t)})),this.unwrap())},e.prototype.formatAt=function(e,r,n,i){null!=this.formats()[n]||s.query(n,s.Scope.ATTRIBUTE)?this.isolate(e,r).format(n,i):t.prototype.formatAt.call(this,e,r,n,i)},e.prototype.optimize=function(r){t.prototype.optimize.call(this,r);var n=this.formats();if(0===Object.keys(n).length)return this.unwrap();var i=this.next;i instanceof e&&i.prev===this&&function(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t)if(t[r]!==e[r])return!1;return!0}(n,i.formats())&&(i.moveChildren(this),i.remove())},e.blotName="inline",e.scope=s.Scope.INLINE_BLOT,e.tagName="SPAN",e}(o.default);e.default=a},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=r(18),s=r(1),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.formats=function(r){var n=s.query(e.blotName).tagName;if(r.tagName!==n)return t.formats.call(this,r)},e.prototype.format=function(r,n){null!=s.query(r,s.Scope.BLOCK)&&(r!==this.statics.blotName||n?t.prototype.format.call(this,r,n):this.replaceWith(e.blotName))},e.prototype.formatAt=function(e,r,n,i){null!=s.query(n,s.Scope.BLOCK)?this.format(n,i):t.prototype.formatAt.call(this,e,r,n,i)},e.prototype.insertAt=function(e,r,n){if(null==n||null!=s.query(r,s.Scope.INLINE))t.prototype.insertAt.call(this,e,r,n);else{var i=this.split(e),o=s.create(r,n);i.parent.insertBefore(o,i)}},e.prototype.update=function(e,r){navigator.userAgent.match(/Trident/)?this.build():t.prototype.update.call(this,e,r)},e.blotName="block",e.scope=s.Scope.BLOCK_BLOT,e.tagName="P",e}(o.default);e.default=a},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.formats=function(t){},e.prototype.format=function(e,r){t.prototype.formatAt.call(this,0,this.length(),e,r)},e.prototype.formatAt=function(e,r,n,i){0===e&&r===this.length()?this.format(n,i):t.prototype.formatAt.call(this,e,r,n,i)},e.prototype.formats=function(){return this.statics.formats(this.domNode)},e}(r(19).default);e.default=o},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=r(19),s=r(1),a=function(t){function e(e){var r=t.call(this,e)||this;return r.text=r.statics.value(r.domNode),r}return i(e,t),e.create=function(t){return document.createTextNode(t)},e.value=function(t){var e=t.data;return e.normalize&&(e=e.normalize()),e},e.prototype.deleteAt=function(t,e){this.domNode.data=this.text=this.text.slice(0,t)+this.text.slice(t+e)},e.prototype.index=function(t,e){return this.domNode===t?e:-1},e.prototype.insertAt=function(e,r,n){null==n?(this.text=this.text.slice(0,e)+r+this.text.slice(e),this.domNode.data=this.text):t.prototype.insertAt.call(this,e,r,n)},e.prototype.length=function(){return this.text.length},e.prototype.optimize=function(r){t.prototype.optimize.call(this,r),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof e&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},e.prototype.position=function(t,e){return void 0===e&&(e=!1),[this.domNode,t]},e.prototype.split=function(t,e){if(void 0===e&&(e=!1),!e){if(0===t)return this;if(t===this.length())return this.next}var r=s.create(this.domNode.splitText(t));return this.parent.insertBefore(r,this.next),this.text=this.statics.value(this.domNode),r},e.prototype.update=function(t,e){var r=this;t.some((function(t){return"characterData"===t.type&&t.target===r.domNode}))&&(this.text=this.statics.value(this.domNode))},e.prototype.value=function(){return this.text},e.blotName="text",e.scope=s.Scope.INLINE_BLOT,e}(o.default);e.default=a},function(t,e,r){"use strict";var n=document.createElement("div");if(n.classList.toggle("test-class",!1),n.classList.contains("test-class")){var i=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return arguments.length>1&&!this.contains(t)==!e?e:i.call(this,t)}}String.prototype.startsWith||(String.prototype.startsWith=function(t,e){return e=e||0,this.substr(e,t.length)===t}),String.prototype.endsWith||(String.prototype.endsWith=function(t,e){var r=this.toString();("number"!=typeof e||!isFinite(e)||Math.floor(e)!==e||e>r.length)&&(e=r.length),e-=t.length;var n=r.indexOf(t,e);return-1!==n&&n===e}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,r=Object(this),n=r.length>>>0,i=arguments[1],o=0;oe.length?t:e,c=t.length>e.length?e:t,f=h.indexOf(c);if(-1!=f)return l=[[n,h.substring(0,f)],[i,c],[n,h.substring(f+c.length)]],t.length>e.length&&(l[0][0]=l[2][0]=r),l;if(1==c.length)return[[r,t],[n,e]];var d=function(t,e){var r=t.length>e.length?t:e,n=t.length>e.length?e:t;if(r.length<4||2*n.length=t.length?[n,i,o,s,c]:null}var o,s,l,h,c,f=i(r,n,Math.ceil(r.length/4)),d=i(r,n,Math.ceil(r.length/2));return f||d?(o=d?f&&f[4].length>d[4].length?f:d:f,t.length>e.length?(s=o[0],l=o[1],h=o[2],c=o[3]):(h=o[0],c=o[1],s=o[2],l=o[3]),[s,l,h,c,o[4]]):null}(t,e);if(d){var p=d[0],m=d[1],g=d[2],v=d[3],y=d[4],b=o(p,g),w=o(m,v);return b.concat([[i,y]],w)}return function(t,e){for(var i=t.length,o=e.length,a=Math.ceil((i+o)/2),u=a,l=2*a,h=new Array(l),c=new Array(l),f=0;fi)g+=2;else if(M>o)m+=2;else if(p&&(N=u+d-w)>=0&&N=(_=i-c[N]))return s(t,e,T,M)}for(var A=-b+v;A<=b-y;A+=2){for(var _,N=u+A,S=(_=A==-b||A!=b&&c[N-1]i)y+=2;else if(S>o)v+=2;else if(!p){var T;if((E=u+d-A)>=0&&E=(_=i-_)))return s(t,e,T,M)}}}return[[r,t],[n,e]]}(t,e)}(t=t.substring(0,t.length-f),e=e.substring(0,e.length-f));return d&&m.unshift([i,d]),p&&m.push([i,p]),l(m),null!=h&&(m=function(t,e){var n=function(t,e){if(0===e)return[i,t];for(var n=0,o=0;o0&&o.splice(s+2,0,[u[0],l]),c(o,s,3)}return t}(m,h)),function(t){for(var e=!1,o=function(t){return t.charCodeAt(0)>=56320&&t.charCodeAt(0)<=57343},s=2;s=55296&&a.charCodeAt(a.length-1)<=56319)&&t[s-1][0]===r&&o(t[s-1][1])&&t[s][0]===n&&o(t[s][1])&&(e=!0,t[s-1][1]=t[s-2][1].slice(-1)+t[s-1][1],t[s][1]=t[s-2][1].slice(-1)+t[s][1],t[s-2][1]=t[s-2][1].slice(0,-1));var a;if(!e)return t;var u=[];for(s=0;s0&&u.push(t[s]);return u}(m)}function s(t,e,r,n){var i=t.substring(0,r),s=e.substring(0,n),a=t.substring(r),u=e.substring(n),l=o(i,s),h=o(a,u);return l.concat(h)}function a(t,e){if(!t||!e||t.charAt(0)!=e.charAt(0))return 0;for(var r=0,n=Math.min(t.length,e.length),i=n,o=0;r1?(0!==s&&0!==h&&(0!==(e=a(f,c))&&(o-s-h>0&&t[o-s-h-1][0]==i?t[o-s-h-1][1]+=f.substring(0,e):(t.splice(0,0,[i,f.substring(0,e)]),o++),f=f.substring(e),c=c.substring(e)),0!==(e=u(f,c))&&(t[o][1]=f.substring(f.length-e)+t[o][1],f=f.substring(0,f.length-e),c=c.substring(0,c.length-e))),0===s?t.splice(o-h,s+h,[n,f]):0===h?t.splice(o-s,s+h,[r,c]):t.splice(o-s-h,s+h,[r,c],[n,f]),o=o-s-h+(s?1:0)+(h?1:0)+1):0!==o&&t[o-1][0]==i?(t[o-1][1]+=t[o][1],t.splice(o,1)):o++,h=0,s=0,c="",f=""}""===t[t.length-1][1]&&t.pop();var d=!1;for(o=1;o=0&&n>=e-1;n--)if(n+1=700)&&(r.bold=!0),Object.keys(r).length>0&&(e=T(e,r)),parseFloat(n.textIndent||0)>0&&(e=(new a.default).insert("\t").concat(e)),e}],["li",function(t,e){var r=u.default.query(t);if(null==r||"list-item"!==r.blotName||!R(e,"\n"))return e;for(var n=-1,i=t.parentNode;!i.classList.contains("ql-clipboard");)"list"===(u.default.query(i)||{}).blotName&&(n+=1),i=i.parentNode;return n<=0?e:e.compose((new a.default).retain(e.length()-1).retain(1,{indent:n}))}],["b",I.bind(I,"bold")],["i",I.bind(I,"italic")],["style",function(){return new a.default}]],_=[f.AlignAttribute,g.DirectionAttribute].reduce((function(t,e){return t[e.keyName]=e,t}),{}),N=[f.AlignStyle,d.BackgroundStyle,m.ColorStyle,g.DirectionStyle,v.FontStyle,y.SizeStyle].reduce((function(t,e){return t[e.keyName]=e,t}),{}),S=function(t){function e(t,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return n.quill.root.addEventListener("paste",n.onPaste.bind(n)),n.container=n.quill.addContainer("ql-clipboard"),n.container.setAttribute("contenteditable",!0),n.container.setAttribute("tabindex",-1),n.matchers=[],A.concat(n.options.matchers).forEach((function(t){var e=i(t,2),o=e[0],s=e[1];(r.matchVisual||s!==U)&&n.addMatcher(o,s)})),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),o(e,[{key:"addMatcher",value:function(t,e){this.matchers.push([t,e])}},{key:"convert",value:function(t){if("string"==typeof t)return this.container.innerHTML=t.replace(/\>\r?\n +\<"),this.convert();var e=this.quill.getFormat(this.quill.selection.savedRange.index);if(e[p.default.blotName]){var r=this.container.innerText;return this.container.innerHTML="",(new a.default).insert(r,w({},p.default.blotName,e[p.default.blotName]))}var n=this.prepareMatching(),o=i(n,2),s=o[0],u=o[1],l=O(this.container,s,u);return R(l,"\n")&&null==l.ops[l.ops.length-1].attributes&&(l=l.compose((new a.default).retain(l.length()-1).delete(1))),E.log("convert",this.container.innerHTML,l),this.container.innerHTML="",l}},{key:"dangerouslyPasteHTML",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default.sources.API;if("string"==typeof t)this.quill.setContents(this.convert(t),e),this.quill.setSelection(0,l.default.sources.SILENT);else{var n=this.convert(e);this.quill.updateContents((new a.default).retain(t).concat(n),r),this.quill.setSelection(t+n.length(),l.default.sources.SILENT)}}},{key:"onPaste",value:function(t){var e=this;if(!t.defaultPrevented&&this.quill.isEnabled()){var r=this.quill.getSelection(),n=(new a.default).retain(r.index),i=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(l.default.sources.SILENT),setTimeout((function(){n=n.concat(e.convert()).delete(r.length),e.quill.updateContents(n,l.default.sources.USER),e.quill.setSelection(n.length()-r.length,l.default.sources.SILENT),e.quill.scrollingContainer.scrollTop=i,e.quill.focus()}),1)}}},{key:"prepareMatching",value:function(){var t=this,e=[],r=[];return this.matchers.forEach((function(n){var o=i(n,2),s=o[0],a=o[1];switch(s){case Node.TEXT_NODE:r.push(a);break;case Node.ELEMENT_NODE:e.push(a);break;default:[].forEach.call(t.container.querySelectorAll(s),(function(t){t[M]=t[M]||[],t[M].push(a)}))}})),[e,r]}}]),e}(c.default);function T(t,e,r){return"object"===(void 0===e?"undefined":n(e))?Object.keys(e).reduce((function(t,r){return T(t,r,e[r])}),t):t.reduce((function(t,n){return n.attributes&&n.attributes[e]?t.push(n):t.insert(n.insert,(0,s.default)({},w({},e,r),n.attributes))}),new a.default)}function k(t){if(t.nodeType!==Node.ELEMENT_NODE)return{};var e="__ql-computed-style";return t[e]||(t[e]=window.getComputedStyle(t))}function R(t,e){for(var r="",n=t.ops.length-1;n>=0&&r.length-1}function O(t,e,r){return t.nodeType===t.TEXT_NODE?r.reduce((function(e,r){return r(t,e)}),new a.default):t.nodeType===t.ELEMENT_NODE?[].reduce.call(t.childNodes||[],(function(n,i){var o=O(i,e,r);return i.nodeType===t.ELEMENT_NODE&&(o=e.reduce((function(t,e){return e(i,t)}),o),o=(i[M]||[]).reduce((function(t,e){return e(i,t)}),o)),n.concat(o)}),new a.default):new a.default}function I(t,e,r){return T(r,t,!0)}function C(t,e){var r=u.default.Attributor.Attribute.keys(t),n=u.default.Attributor.Class.keys(t),i=u.default.Attributor.Style.keys(t),o={};return r.concat(n).concat(i).forEach((function(e){var r=u.default.query(e,u.default.Scope.ATTRIBUTE);null!=r&&(o[r.attrName]=r.value(t),o[r.attrName])||(null==(r=_[e])||r.attrName!==e&&r.keyName!==e||(o[r.attrName]=r.value(t)||void 0),null==(r=N[e])||r.attrName!==e&&r.keyName!==e||(r=N[e],o[r.attrName]=r.value(t)||void 0))})),Object.keys(o).length>0&&(e=T(e,o)),e}function P(t,e){var r=u.default.query(t);if(null==r)return e;if(r.prototype instanceof u.default.Embed){var n={},i=r.value(t);null!=i&&(n[r.blotName]=i,e=(new a.default).insert(n,r.formats(t)))}else"function"==typeof r.formats&&(e=T(e,r.blotName,r.formats(t)));return e}function L(t,e){return R(e,"\n")||(x(t)||e.length()>0&&t.nextSibling&&x(t.nextSibling))&&e.insert("\n"),e}function U(t,e){if(x(t)&&null!=t.nextElementSibling&&!R(e,"\n\n")){var r=t.offsetHeight+parseFloat(k(t).marginTop)+parseFloat(k(t).marginBottom);t.nextElementSibling.offsetTop>t.offsetTop+1.5*r&&e.insert("\n")}return e}function B(t,e){var r=t.data;if("O:P"===t.parentNode.tagName)return e.insert(r.trim());if(0===r.trim().length&&t.parentNode.classList.contains("ql-clipboard"))return e;if(!k(t.parentNode).whiteSpace.startsWith("pre")){var n=function(t,e){return(e=e.replace(/[^\u00a0]/g,"")).length<1&&t?" ":e};r=(r=r.replace(/\r\n/g," ").replace(/\n/g," ")).replace(/\s\s+/g,n.bind(n,!0)),(null==t.previousSibling&&x(t.parentNode)||null!=t.previousSibling&&x(t.previousSibling))&&(r=r.replace(/^\s+/,n.bind(n,!1))),(null==t.nextSibling&&x(t.parentNode)||null!=t.nextSibling&&x(t.nextSibling))&&(r=r.replace(/\s+$/,n.bind(n,!1)))}return e.insert(r)}S.DEFAULTS={matchers:[],matchVisual:!0},e.default=S,e.matchAttributor=C,e.matchBlot=P,e.matchNewline=L,e.matchSpacing=U,e.matchText=B},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,i=function(){function t(t,e){for(var r=0;r '},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,i=function(){function t(t,e){for(var r=0;rn.right&&(o=n.right-i.right,this.root.style.left=e+o+"px"),i.leftn.bottom){var s=i.bottom-i.top,a=t.bottom-t.top+s;this.root.style.top=r-a+"px",this.root.classList.add("ql-flip")}return o}},{key:"show",value:function(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}]),t}();e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0},i=function(){function t(t,e){for(var r=0;r','','',''].join(""),e.default=v},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=L(r(29)),i=r(36),o=r(38),s=r(64),a=L(r(65)),u=L(r(66)),l=r(67),h=L(l),c=r(37),f=r(26),d=r(39),p=r(40),m=L(r(56)),g=L(r(68)),v=L(r(27)),y=L(r(69)),b=L(r(70)),w=L(r(71)),E=L(r(72)),M=L(r(73)),A=r(13),_=L(A),N=L(r(74)),S=L(r(75)),T=L(r(57)),k=L(r(41)),R=L(r(28)),x=L(r(59)),O=L(r(60)),I=L(r(61)),C=L(r(108)),P=L(r(62));function L(t){return t&&t.__esModule?t:{default:t}}n.default.register({"attributors/attribute/direction":o.DirectionAttribute,"attributors/class/align":i.AlignClass,"attributors/class/background":c.BackgroundClass,"attributors/class/color":f.ColorClass,"attributors/class/direction":o.DirectionClass,"attributors/class/font":d.FontClass,"attributors/class/size":p.SizeClass,"attributors/style/align":i.AlignStyle,"attributors/style/background":c.BackgroundStyle,"attributors/style/color":f.ColorStyle,"attributors/style/direction":o.DirectionStyle,"attributors/style/font":d.FontStyle,"attributors/style/size":p.SizeStyle},!0),n.default.register({"formats/align":i.AlignClass,"formats/direction":o.DirectionClass,"formats/indent":s.IndentClass,"formats/background":c.BackgroundStyle,"formats/color":f.ColorStyle,"formats/font":d.FontClass,"formats/size":p.SizeClass,"formats/blockquote":a.default,"formats/code-block":_.default,"formats/header":u.default,"formats/list":h.default,"formats/bold":m.default,"formats/code":A.Code,"formats/italic":g.default,"formats/link":v.default,"formats/script":y.default,"formats/strike":b.default,"formats/underline":w.default,"formats/image":E.default,"formats/video":M.default,"formats/list/item":l.ListItem,"modules/formula":N.default,"modules/syntax":S.default,"modules/toolbar":T.default,"themes/bubble":C.default,"themes/snow":P.default,"ui/icons":k.default,"ui/picker":R.default,"ui/icon-picker":O.default,"ui/color-picker":x.default,"ui/tooltip":I.default},!0),e.default=n.default},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IndentClass=void 0;var n,i=function(){function t(t,e){for(var r=0;r0&&this.children.tail.format(t,e)}},{key:"formats",value:function(){return t={},e=this.statics.blotName,r=this.statics.formats(this.domNode),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t;var t,e,r}},{key:"insertBefore",value:function(t,r){if(t instanceof f)i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertBefore",this).call(this,t,r);else{var n=null==r?this.length():r.offset(this),o=this.split(n);o.parent.insertBefore(t,o)}}},{key:"optimize",value:function(t){i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t);var r=this.next;null!=r&&r.prev===this&&r.statics.blotName===this.statics.blotName&&r.domNode.tagName===this.domNode.tagName&&r.domNode.getAttribute("data-checked")===this.domNode.getAttribute("data-checked")&&(r.moveChildren(this),r.remove())}},{key:"replace",value:function(t){if(t.statics.blotName!==this.statics.blotName){var r=o.default.create(this.statics.defaultChild);t.moveChildren(r),this.appendChild(r)}i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"replace",this).call(this,t)}}]),e}(a.default);d.blotName="list",d.scope=o.default.Scope.BLOCK_BLOT,d.tagName=["OL","UL"],d.defaultChild="list-item",d.allowedChildren=[f],e.ListItem=f,e.default=d},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,i=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(((n=r(56))&&n.__esModule?n:{default:n}).default);i.blotName="italic",i.tagName=["EM","I"],e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,i=function(){function t(t,e){for(var r=0;r-1?r?this.domNode.setAttribute(t,r):this.domNode.removeAttribute(t):o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"format",this).call(this,t,r)}}],[{key:"create",value:function(t){var r=o(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return"string"==typeof t&&r.setAttribute("src",this.sanitize(t)),r}},{key:"formats",value:function(t){return u.reduce((function(e,r){return t.hasAttribute(r)&&(e[r]=t.getAttribute(r)),e}),{})}},{key:"match",value:function(t){return/\.(jpe?g|gif|png)$/.test(t)||/^data:image\/.+;base64/.test(t)}},{key:"sanitize",value:function(t){return(0,a.sanitize)(t,["http","https","data"])?t:"//:0"}},{key:"value",value:function(t){return t.getAttribute("src")}}]),e}(s.default.Embed);l.blotName="image",l.tagName="IMG",e.default=l},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,i=function(){function t(t,e){for(var r=0;r-1?r?this.domNode.setAttribute(t,r):this.domNode.removeAttribute(t):o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"format",this).call(this,t,r)}}],[{key:"create",value:function(t){var r=o(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return r.setAttribute("frameborder","0"),r.setAttribute("allowfullscreen",!0),r.setAttribute("src",this.sanitize(t)),r}},{key:"formats",value:function(t){return u.reduce((function(e,r){return t.hasAttribute(r)&&(e[r]=t.getAttribute(r)),e}),{})}},{key:"sanitize",value:function(t){return a.default.sanitize(t)}},{key:"value",value:function(t){return t.getAttribute("src")}}]),e}(s.BlockEmbed);l.blotName="video",l.className="ql-video",l.tagName="IFRAME",e.default=l},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.FormulaBlot=void 0;var n=function(){function t(t,e){for(var r=0;r0||null==this.cachedText)&&(this.domNode.innerHTML=t(e),this.domNode.normalize(),this.attach()),this.cachedText=e)}}]),e}(u(r(13)).default);f.className="ql-syntax";var d=new o.default.Attributor.Class("token","hljs",{scope:o.default.Scope.INLINE}),p=function(t){function e(t,r){l(this,e);var n=h(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));if("function"!=typeof n.options.highlight)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");var i=null;return n.quill.on(s.default.events.SCROLL_OPTIMIZE,(function(){clearTimeout(i),i=setTimeout((function(){n.highlight(),i=null}),n.options.interval)})),n.highlight(),n}return c(e,t),n(e,null,[{key:"register",value:function(){s.default.register(d,!0),s.default.register(f,!0)}}]),n(e,[{key:"highlight",value:function(){var t=this;if(!this.quill.selection.composing){this.quill.update(s.default.sources.USER);var e=this.quill.getSelection();this.quill.scroll.descendants(f).forEach((function(e){e.highlight(t.options.highlight)})),this.quill.update(s.default.sources.SILENT),null!=e&&this.quill.setSelection(e,s.default.sources.SILENT)}}}]),e}(a.default);p.DEFAULTS={highlight:null==window.hljs?null:function(t){return window.hljs.highlightAuto(t).value},interval:1e3},e.CodeBlock=f,e.CodeToken=d,e.default=p},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.BubbleTooltip=void 0;var n=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0},i=function(){function t(t,e){for(var r=0;r0&&i===s.default.sources.USER){n.show(),n.root.style.left="0px",n.root.style.width="",n.root.style.width=n.root.offsetWidth+"px";var o=n.quill.getLines(e.index,e.length);if(1===o.length)n.position(n.quill.getBounds(e));else{var a=o[o.length-1],u=n.quill.getIndex(a),h=Math.min(a.length()-1,e.index+e.length-u),c=n.quill.getBounds(new l.Range(u,h));n.position(c)}}else document.activeElement!==n.textbox&&n.quill.hasFocus()&&n.hide()})),n}return p(e,t),i(e,[{key:"listen",value:function(){var t=this;n(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"listen",this).call(this),this.root.querySelector(".ql-close").addEventListener("click",(function(){t.root.classList.remove("ql-editing")})),this.quill.on(s.default.events.SCROLL_OPTIMIZE,(function(){setTimeout((function(){if(!t.root.classList.contains("ql-hidden")){var e=t.quill.getSelection();null!=e&&t.position(t.quill.getBounds(e))}}),1)}))}},{key:"cancel",value:function(){this.show()}},{key:"position",value:function(t){var r=n(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"position",this).call(this,t),i=this.root.querySelector(".ql-tooltip-arrow");if(i.style.marginLeft="",0===r)return r;i.style.marginLeft=-1*r-i.offsetWidth/2+"px"}}]),e}(a.BaseTooltip);v.TEMPLATE=['','
','','',"
"].join(""),e.BubbleTooltip=v,e.default=g},function(t,e,r){t.exports=r(63)}]).default},t.exports=e()},8677:()=>{},2808:()=>{},5883:()=>{},6601:()=>{},9649:()=>{},7801:()=>{},6658:()=>{},6042:()=>{},4801:()=>{},8067:()=>{},991:()=>{}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.amdO={},r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{"use strict";var t=r(7319),e=r(7086),n=r(2548),i=r(1974),o=r(8147),s=r(8891),a=r(4970),u=r(9446),l=r(4376);(0,t.initBooks)(),(0,e.initContributors)(),(0,i.initQuill)(),(0,o.initQuillValueToInput)(),(0,n.initWallet)(),(0,s.initComments)(),(0,a.initVote)(),(0,u.initTheme)(),(0,l.initApprove)()})()})(); \ No newline at end of file +(()=>{var t={5851:(t,e,r)=>{"use strict";r.d(e,{i:()=>n});const n="abi/5.7.0"},2734:(t,e,r)=>{"use strict";r.d(e,{R:()=>x,$:()=>O});var n=r(3286),i=r(3587),o=r(711),s=r(5851),a=r(1184),u=r(4594);class l extends a.XI{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=(0,u.Kn)(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return(0,u.Kn)((0,n.$m)(t.readValue().toHexString(),20))}}class h extends a.XI{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const c=new o.Yd(s.i);function f(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let t={};n=e.map((e=>{const n=e.localName;return n||c.throwError("cannot encode object for signature with missing names",o.Yd.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]&&c.throwError("cannot encode object for signature with duplicate names",o.Yd.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]=!0,r[n]}))}else c.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&c.throwArgumentError("types/value length mismatch","tuple",r);let i=new a.QV(t.wordSize),s=new a.QV(t.wordSize),u=[];e.forEach(((t,e)=>{let r=n[e];if(t.dynamic){let e=s.length;t.encode(s,r);let n=i.writeUpdatableValue();u.push((t=>{n(t+e)}))}else t.encode(i,r)})),u.forEach((t=>{t(i.length)}));let l=t.appendWriter(i);return l+=t.appendWriter(s),l}function d(t,e){let r=[],n=t.subReader(0);e.forEach((e=>{let i=null;if(e.dynamic){let r=t.readValue(),s=n.subReader(r.toNumber());try{i=e.decode(s)}catch(t){if(t.code===o.Yd.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(t.code===o.Yd.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}null!=i&&r.push(i)}));const i=e.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});e.forEach(((t,e)=>{let n=t.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const o=r[e];o instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}}):r[n]=o}));for(let t=0;t{throw e}})}return Object.freeze(r)}class p extends a.XI{constructor(t,e,r){super("array",t.type+"["+(e>=0?e:"")+"]",r,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let r=0;rt._data.length&&c.throwError("insufficient data length",o.Yd.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let r=[];for(let t=0;t{t.dynamic&&(r=!0),n.push(t.type)})),super("tuple","tuple("+n.join(",")+")",e,r),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});return this.coders.forEach(((r,n)=>{let i=r.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[n]))})),Object.freeze(t)}encode(t,e){return f(t,this.coders,e)}decode(t){return t.coerce(this.name,d(t,this.coders))}}var S=r(1388);const T=new o.Yd(s.i),k=new RegExp(/^bytes([0-9]*)$/),R=new RegExp(/^(u?int)([0-9]*)$/);class x{constructor(t){(0,i.zG)(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new l(t.name);case"bool":return new m(t.name);case"string":return new _(t.name);case"bytes":return new v(t.name);case"array":return new p(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new N((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new b(t.name)}let e=t.type.match(R);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&T.throwArgumentError("invalid "+e[1]+" bit length","param",t),new M(r/8,"int"===e[1],t.name)}if(e=t.type.match(k),e){let r=parseInt(e[1]);return(0===r||r>32)&&T.throwArgumentError("invalid bytes length","param",t),new y(r,t.name)}return T.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new a.Ej(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new a.QV(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(S._R.from(t))));return new N(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&T.throwError("types/values length mismatch",o.Yd.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map((t=>this._getCoder(S._R.from(t)))),n=new N(r,"_"),i=this._getWriter();return n.encode(i,e),i.data}decode(t,e,r){const i=t.map((t=>this._getCoder(S._R.from(t))));return new N(i,"_").decode(this._getReader((0,n.lE)(e),r))}}const O=new x},1184:(t,e,r)=>{"use strict";r.d(e,{BR:()=>l,Ej:()=>f,QV:()=>c,XI:()=>h});var n=r(3286),i=r(2593),o=r(3587),s=r(711),a=r(5851);const u=new s.Yd(a.i);function l(t){const e=[],r=function(t,n){if(Array.isArray(n))for(let i in n){const o=t.slice();o.push(i);try{r(o,n[i])}catch(t){e.push({path:o,error:t})}}};return r([],t),e}class h{constructor(t,e,r,n){this.name=t,this.type=e,this.localName=r,this.dynamic=n}_throwError(t,e){u.throwArgumentError(t,this.localName,e)}}class c{constructor(t){(0,o.zG)(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return(0,n.xs)(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData((0,n.zo)(t._data))}writeBytes(t){let e=(0,n.lE)(t);const r=e.length%this.wordSize;return r&&(e=(0,n.zo)([e,this._padding.slice(r)])),this._writeData(e)}_getValue(t){let e=(0,n.lE)(i.O$.from(t));return e.length>this.wordSize&&u.throwError("value out-of-bounds",s.Yd.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=(0,n.zo)([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class f{constructor(t,e,r,i){(0,o.zG)(this,"_data",(0,n.lE)(t)),(0,o.zG)(this,"wordSize",e||32),(0,o.zG)(this,"_coerceFunc",r),(0,o.zG)(this,"allowLoose",i),this._offset=0}get data(){return(0,n.Dv)(this._data)}get consumed(){return this._offset}static coerce(t,e){let r=t.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):f.coerce(t,e)}_peekBytes(t,e,r){let n=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?n=e:u.throwError("data out-of-bounds",s.Yd.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(t){return new f(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let r=this._peekBytes(0,t,!!e);return this._offset+=r.length,r.slice(0,t)}readValue(){return i.O$.from(this.readBytes(this.wordSize))}}},1388:(t,e,r)=>{"use strict";r.d(e,{HY:()=>v,IC:()=>N,QV:()=>y,Xg:()=>M,YW:()=>A,_R:()=>m,pc:()=>d});var n=r(2593),i=r(3587),o=r(711),s=r(5851);const a=new o.Yd(s.i),u={};let l={calldata:!0,memory:!0,storage:!0},h={calldata:!0,memory:!0};function c(t,e){if("bytes"===t||"string"===t){if(l[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&h[e])return!0;return(l[e]||"payable"===e)&&a.throwArgumentError("invalid modifier","name",e),!1}function f(t,e){for(let r in e)(0,i.zG)(t,r,e[r])}const d=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),p=new RegExp(/^(.*)\[([0-9]*)\]$/);class m{constructor(t,e){t!==u&&a.throwError("use fromString",o.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),f(this,e);let r=this.type.match(p);f(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:m.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=d.sighash),d[t]||a.throwArgumentError("invalid format type","format",t),t===d.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==d.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===d.full?", ":",")+")"):e+=this.type,t!==d.sighash&&(!0===this.indexed&&(e+=" indexed"),t===d.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?m.fromString(t,e):m.fromObject(t)}static fromObject(t){return m.isParamType(t)?t:new m(u,{name:t.name||null,type:S(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(m.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function n(e){a.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function i(t){let r={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(r.indexed=!1),r}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},s=o;for(let r=0;rm.fromString(t,e)))}class v{constructor(t,e){t!==u&&a.throwError("use a static from method",o.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),f(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return v.isFragment(t)?t:"string"==typeof t?v.fromString(t):v.fromObject(t)}static fromObject(t){if(v.isFragment(t))return t;switch(t.type){case"function":return A.fromObject(t);case"event":return y.fromObject(t);case"constructor":return M.fromObject(t);case"error":return N.fromObject(t);case"fallback":case"receive":return null}return a.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?y.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?A.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?M.fromString(t.trim()):"error"===t.split(" ")[0]?N.fromString(t.substring(5).trim()):a.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class y extends v{format(t){if(t||(t=d.sighash),d[t]||a.throwArgumentError("invalid format type","format",t),t===d.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==d.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ",t!==d.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?y.fromString(t):y.fromObject(t)}static fromObject(t){if(y.isEventFragment(t))return t;"event"!==t.type&&a.throwArgumentError("invalid event object","value",t);const e={name:k(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(m.fromObject):[],type:"event"};return new y(u,e)}static fromString(t){let e=t.match(R);e||a.throwArgumentError("invalid event string","value",t);let r=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":r=!0;break;case"":break;default:a.warn("unknown modifier: "+t)}})),y.fromObject({name:e[1].trim(),anonymous:r,inputs:g(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function b(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&a.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||a.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=n.O$.from(r[1]),r[0]):t}function w(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function E(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&a.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&a.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||a.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&a.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&a.throwArgumentError("unable to determine stateMutability","value",t),e}class M extends v{format(t){if(t||(t=d.sighash),d[t]||a.throwArgumentError("invalid format type","format",t),t===d.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===d.sighash&&a.throwError("cannot format a constructor for sighash",o.Yd.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?M.fromString(t):M.fromObject(t)}static fromObject(t){if(M.isConstructorFragment(t))return t;"constructor"!==t.type&&a.throwArgumentError("invalid constructor object","value",t);let e=E(t);e.constant&&a.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(m.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?n.O$.from(t.gas):null};return new M(u,r)}static fromString(t){let e={type:"constructor"},r=(t=b(t,e)).match(R);return r&&"constructor"===r[1].trim()||a.throwArgumentError("invalid constructor string","value",t),e.inputs=g(r[2].trim(),!1),w(r[3].trim(),e),M.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class A extends M{format(t){if(t||(t=d.sighash),d[t]||a.throwArgumentError("invalid format type","format",t),t===d.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==d.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ",t!==d.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?A.fromString(t):A.fromObject(t)}static fromObject(t){if(A.isFunctionFragment(t))return t;"function"!==t.type&&a.throwArgumentError("invalid function object","value",t);let e=E(t);const r={type:t.type,name:k(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(m.fromObject):[],outputs:t.outputs?t.outputs.map(m.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?n.O$.from(t.gas):null};return new A(u,r)}static fromString(t){let e={type:"function"},r=(t=b(t,e)).split(" returns ");r.length>2&&a.throwArgumentError("invalid function string","value",t);let n=r[0].match(R);if(n||a.throwArgumentError("invalid function signature","value",t),e.name=n[1].trim(),e.name&&k(e.name),e.inputs=g(n[2],!1),w(n[3].trim(),e),r.length>1){let n=r[1].match(R);""==n[1].trim()&&""==n[3].trim()||a.throwArgumentError("unexpected tokens","value",t),e.outputs=g(n[2],!1)}else e.outputs=[];return A.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function _(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||a.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class N extends v{format(t){if(t||(t=d.sighash),d[t]||a.throwArgumentError("invalid format type","format",t),t===d.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==d.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?N.fromString(t):N.fromObject(t)}static fromObject(t){if(N.isErrorFragment(t))return t;"error"!==t.type&&a.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:k(t.name),inputs:t.inputs?t.inputs.map(m.fromObject):[]};return _(new N(u,e))}static fromString(t){let e={type:"error"},r=t.match(R);return r||a.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&k(e.name),e.inputs=g(r[2],!1),_(N.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function S(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const T=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function k(t){return t&&t.match(T)||a.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const R=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$")},8198:(t,e,r)=>{"use strict";r.d(e,{CC:()=>p,Hk:()=>v,vU:()=>w,vk:()=>m});var n=r(4594),i=r(2593),o=r(3286),s=r(2046),a=r(8197),u=r(3587),l=r(2734),h=r(1388),c=r(711),f=r(5851);const d=new c.Yd(f.i);class p extends u.dk{}class m extends u.dk{}class g extends u.dk{}class v extends u.dk{static isIndexed(t){return!(!t||!t._isIndexed)}}const y={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function b(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class w{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,(0,u.zG)(this,"fragments",e.map((t=>h.HY.from(t))).filter((t=>null!=t))),(0,u.zG)(this,"_abiCoder",(0,u.tu)(new.target,"getAbiCoder")()),(0,u.zG)(this,"functions",{}),(0,u.zG)(this,"errors",{}),(0,u.zG)(this,"events",{}),(0,u.zG)(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void d.warn("duplicate definition - constructor"):void(0,u.zG)(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let r=t.format();e[r]?d.warn("duplicate definition - "+r):e[r]=t})),this.deploy||(0,u.zG)(this,"deploy",h.Xg.from({payable:!1,type:"constructor"})),(0,u.zG)(this,"_isInterface",!0)}format(t){t||(t=h.pc.full),t===h.pc.sighash&&d.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===h.pc.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return l.$}static getAddress(t){return(0,n.Kn)(t)}static getSighash(t){return(0,o.p3)((0,s.id)(t.format()),0,4)}static getEventTopic(t){return(0,s.id)(t.format())}getFunction(t){if((0,o.A7)(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];d.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===r.length?d.throwArgumentError("no matching function","name",e):r.length>1&&d.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const e=this.functions[h.YW.fromString(t).format()];return e||d.throwArgumentError("no matching function","signature",t),e}getEvent(t){if((0,o.A7)(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];d.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===r.length?d.throwArgumentError("no matching event","name",e):r.length>1&&d.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const e=this.events[h.QV.fromString(t).format()];return e||d.throwArgumentError("no matching event","signature",t),e}getError(t){if((0,o.A7)(t)){const e=(0,u.tu)(this.constructor,"getSighash");for(const r in this.errors)if(t===e(this.errors[r]))return this.errors[r];d.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===r.length?d.throwArgumentError("no matching error","name",e):r.length>1&&d.throwArgumentError("multiple matching errors","name",e),this.errors[r[0]]}const e=this.errors[h.YW.fromString(t).format()];return e||d.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return(0,u.tu)(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),(0,u.tu)(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const r=(0,o.lE)(e);return(0,o.Dv)(r.slice(0,4))!==this.getSighash(t)&&d.throwArgumentError(`data signature does not match error ${t.name}.`,"data",(0,o.Dv)(r)),this._decodeParams(t.inputs,r.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),(0,o.Dv)((0,o.zo)([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const r=(0,o.lE)(e);return(0,o.Dv)(r.slice(0,4))!==this.getSighash(t)&&d.throwArgumentError(`data signature does not match function ${t.name}.`,"data",(0,o.Dv)(r)),this._decodeParams(t.inputs,r.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),(0,o.Dv)((0,o.zo)([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let r=(0,o.lE)(e),n=null,i="",s=null,a=null,u=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,r)}catch(t){}break;case 4:{const t=(0,o.Dv)(r.slice(0,4)),e=y[t];if(e)s=this._abiCoder.decode(e.inputs,r.slice(4)),a=e.name,u=e.signature,e.reason&&(n=s[0]),"Error"===a?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:"Panic"===a&&(i=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const e=this.getError(t);s=this._abiCoder.decode(e.inputs,r.slice(4)),a=e.name,u=e.format()}catch(t){}break}}return d.throwError("call revert exception"+i,c.Yd.errors.CALL_EXCEPTION,{method:t.format(),data:(0,o.Dv)(e),errorArgs:s,errorName:a,errorSignature:u,reason:n})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),(0,o.Dv)(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&d.throwError("too many arguments for "+t.format(),c.Yd.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let r=[];t.anonymous||r.push(this.getEventTopic(t));const n=(t,e)=>"string"===t.type?(0,s.id)(e):"bytes"===t.type?(0,a.w)((0,o.Dv)(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=i.O$.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),(0,o.$m)((0,o.Dv)(e),32));for(e.forEach(((e,i)=>{let o=t.inputs[i];o.indexed?null==e?r.push(null):"array"===o.baseType||"tuple"===o.baseType?d.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?r.push(e.map((t=>n(o,t)))):r.push(n(o,e)):null!=e&&d.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const r=[],n=[],i=[];return t.anonymous||r.push(this.getEventTopic(t)),e.length!==t.inputs.length&&d.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const u=e[o];if(t.indexed)if("string"===t.type)r.push((0,s.id)(u));else if("bytes"===t.type)r.push((0,a.w)(u));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([t.type],[u]))}else n.push(t),i.push(u)})),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(t,e,r){if("string"==typeof t&&(t=this.getEvent(t)),null!=r&&!t.anonymous){let e=this.getEventTopic(t);(0,o.A7)(r[0],32)&&r[0].toLowerCase()===e||d.throwError("fragment/topic mismatch",c.Yd.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:r[0]}),r=r.slice(1)}let n=[],i=[],s=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(n.push(h._R.fromObject({type:"bytes32",name:t.name})),s.push(!0)):(n.push(t),s.push(!1)):(i.push(t),s.push(!1))}));let a=null!=r?this._abiCoder.decode(n,(0,o.zo)(r)):null,u=this._abiCoder.decode(i,e,!0),l=[],f=0,p=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==a)l[e]=new v({_isIndexed:!0,hash:null});else if(s[e])l[e]=new v({_isIndexed:!0,hash:a[p++]});else try{l[e]=a[p++]}catch(t){l[e]=t}else try{l[e]=u[f++]}catch(t){l[e]=t}if(t.name&&null==l[t.name]){const r=l[e];r instanceof Error?Object.defineProperty(l,t.name,{enumerable:!0,get:()=>{throw b(`property ${JSON.stringify(t.name)}`,r)}}):l[t.name]=r}}));for(let t=0;t{throw b(`index ${t}`,e)}})}return Object.freeze(l)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new m({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:i.O$.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new p({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=(0,o.Dv)(t);let r=this.getError(e.substring(0,10).toLowerCase());return r?new g({args:this._abiCoder.decode(r.inputs,"0x"+e.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(t){return!(!t||!t._isInterface)}}},4353:(t,e,r)=>{"use strict";r.d(e,{Sg:()=>a,zt:()=>u});var n=r(2593),i=r(3587),o=r(711);const s=new o.Yd("abstract-provider/5.7.0");class a extends i.dk{static isForkEvent(t){return!(!t||!t._isForkEvent)}}class u{constructor(){s.checkAbstract(new.target,u),(0,i.zG)(this,"_isProvider",!0)}getFeeData(){return t=this,e=void 0,o=function*(){const{block:t,gasPrice:e}=yield(0,i.mE)({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((t=>null))});let r=null,o=null,s=null;return t&&t.baseFeePerGas&&(r=t.baseFeePerGas,s=n.O$.from("1500000000"),o=t.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:r,maxFeePerGas:o,maxPriorityFeePerGas:s,gasPrice:e}},new((r=void 0)||(r=Promise))((function(n,i){function s(t){try{u(o.next(t))}catch(t){i(t)}}function a(t){try{u(o.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((o=o.apply(t,e||[])).next())}));var t,e,r,o}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}},8171:(t,e,r)=>{"use strict";r.d(e,{E:()=>l,b:()=>h});var n=r(3587),i=r(711),o=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const s=new i.Yd("abstract-signer/5.7.0"),a=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],u=[i.Yd.errors.INSUFFICIENT_FUNDS,i.Yd.errors.NONCE_EXPIRED,i.Yd.errors.REPLACEMENT_UNDERPRICED];class l{constructor(){s.checkAbstract(new.target,l),(0,n.zG)(this,"_isSigner",!0)}getBalance(t){return o(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return o(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return o(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const e=yield(0,n.mE)(this.checkTransaction(t));return yield this.provider.estimateGas(e)}))}call(t,e){return o(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield(0,n.mE)(this.checkTransaction(t));return yield this.provider.call(r,e)}))}sendTransaction(t){return o(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),r=yield this.signTransaction(e);return yield this.provider.sendTransaction(r)}))}getChainId(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return o(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===a.indexOf(e)&&s.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=(0,n.DC)(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then((e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&s.throwArgumentError("from address mismatch","transaction",t),e[0]))),e}populateTransaction(t){return o(this,void 0,void 0,(function*(){const e=yield(0,n.mE)(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then((t=>o(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&s.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})))),e.to.catch((t=>{})));const r=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!r?0!==e.type&&1!==e.type||!r||s.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):s.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(r&&s.throwError("network does not support EIP-1559",i.Yd.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):s.throwError("failed to get consistent fee data",i.Yd.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch((t=>{if(u.indexOf(t.code)>=0)throw t;return s.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",i.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})}))),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then((e=>(0!==e[1]&&e[0]!==e[1]&&s.throwArgumentError("chainId address mismatch","transaction",t),e[0]))),yield(0,n.mE)(e)}))}_checkProvider(t){this.provider||s.throwError("missing provider",i.Yd.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class h extends l{constructor(t,e){super(),(0,n.zG)(this,"address",t),(0,n.zG)(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then((()=>{s.throwError(t,i.Yd.errors.UNSUPPORTED_OPERATION,{operation:e})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new h(this.address,t)}}},4594:(t,e,r)=>{"use strict";r.d(e,{Kn:()=>d,CR:()=>g,hB:()=>v,vU:()=>m,UJ:()=>p});var n=r(3286),i=r(2593),o=r(8197),s=r(1843);const a=new(r(711).Yd)("address/5.7.0");function u(t){(0,n.A7)(t,20)||a.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const i=(0,n.lE)((0,o.w)(r));for(let t=0;t<40;t+=2)i[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&i[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const l={};for(let t=0;t<10;t++)l[String(t)]=String(t);for(let t=0;t<26;t++)l[String.fromCharCode(65+t)]=String(10+t);const h=Math.floor((c=9007199254740991,Math.log10?Math.log10(c):Math.log(c)/Math.LN10));var c;function f(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>l[t])).join("");for(;e.length>=h;){let t=e.substring(0,h);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function d(t){let e=null;if("string"!=typeof t&&a.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=u(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&a.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==f(t)&&a.throwArgumentError("bad icap checksum","address",t),e=(0,i.g$)(t.substring(4));e.length<40;)e="0"+e;e=u("0x"+e)}else a.throwArgumentError("invalid address","address",t);return e}function p(t){try{return d(t),!0}catch(t){}return!1}function m(t){let e=(0,i.t2)(d(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+f("XE00"+e)+e}function g(t){let e=null;try{e=d(t.from)}catch(e){a.throwArgumentError("missing from address","transaction",t)}const r=(0,n.G1)((0,n.lE)(i.O$.from(t.nonce).toHexString()));return d((0,n.p3)((0,o.w)((0,s.encode)([e,r])),12))}function v(t,e,r){return 32!==(0,n.E1)(e)&&a.throwArgumentError("salt must be 32 bytes","salt",e),32!==(0,n.E1)(r)&&a.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),d((0,n.p3)((0,o.w)((0,n.zo)(["0xff",d(t),e,r])),12))}},9567:(t,e,r)=>{"use strict";r.d(e,{J:()=>i,c:()=>o});var n=r(3286);function i(t){t=atob(t);const e=[];for(let r=0;r{"use strict";r.d(e,{eU:()=>s});var n=r(3286),i=r(3587);class o{constructor(t){(0,i.zG)(this,"alphabet",t),(0,i.zG)(this,"base",t.length),(0,i.zG)(this,"_alphabetMap",{}),(0,i.zG)(this,"_leader",t.charAt(0));for(let e=0;e0;)r.push(n%this.base),n=n/this.base|0}let i="";for(let t=0;0===e[t]&&t=0;--t)i+=this.alphabet[r[t]];return i}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let r=0;r>=8;for(;i>0;)e.push(255&i),i>>=8}for(let r=0;t[r]===this._leader&&r{"use strict";r.d(e,{i:()=>n});const n="bignumber/5.7.0"},2593:(t,e,r)=>{"use strict";r.d(e,{O$:()=>p,Zm:()=>f,g$:()=>b,t2:()=>w});var n=r(3877),i=r.n(n),o=r(3286),s=r(711),a=r(8794),u=i().BN;const l=new s.Yd(a.i),h={},c=9007199254740991;function f(t){return null!=t&&(p.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||(0,o.A7)(t)||"bigint"==typeof t||(0,o._t)(t))}let d=!1;class p{constructor(t,e){t!==h&&l.throwError("cannot call constructor directly; use BigNumber.from",s.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return g(v(this).fromTwos(t))}toTwos(t){return g(v(this).toTwos(t))}abs(){return"-"===this._hex[0]?p.from(this._hex.substring(1)):this}add(t){return g(v(this).add(v(t)))}sub(t){return g(v(this).sub(v(t)))}div(t){return p.from(t).isZero()&&y("division-by-zero","div"),g(v(this).div(v(t)))}mul(t){return g(v(this).mul(v(t)))}mod(t){const e=v(t);return e.isNeg()&&y("division-by-zero","mod"),g(v(this).umod(e))}pow(t){const e=v(t);return e.isNeg()&&y("negative-power","pow"),g(v(this).pow(e))}and(t){const e=v(t);return(this.isNegative()||e.isNeg())&&y("unbound-bitwise-result","and"),g(v(this).and(e))}or(t){const e=v(t);return(this.isNegative()||e.isNeg())&&y("unbound-bitwise-result","or"),g(v(this).or(e))}xor(t){const e=v(t);return(this.isNegative()||e.isNeg())&&y("unbound-bitwise-result","xor"),g(v(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&y("negative-width","mask"),g(v(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&y("negative-width","shl"),g(v(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&y("negative-width","shr"),g(v(this).shrn(t))}eq(t){return v(this).eq(v(t))}lt(t){return v(this).lt(v(t))}lte(t){return v(this).lte(v(t))}gt(t){return v(this).gt(v(t))}gte(t){return v(this).gte(v(t))}isNegative(){return"-"===this._hex[0]}isZero(){return v(this).isZero()}toNumber(){try{return v(this).toNumber()}catch(t){y("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return l.throwError("this platform does not support BigInt",s.Yd.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?d||(d=!0,l.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?l.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",s.Yd.errors.UNEXPECTED_ARGUMENT,{}):l.throwError("BigNumber.toString does not accept parameters",s.Yd.errors.UNEXPECTED_ARGUMENT,{})),v(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof p)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new p(h,m(t)):t.match(/^-?[0-9]+$/)?new p(h,m(new u(t))):l.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&y("underflow","BigNumber.from",t),(t>=c||t<=-c)&&y("overflow","BigNumber.from",t),p.from(String(t));const e=t;if("bigint"==typeof e)return p.from(e.toString());if((0,o._t)(e))return p.from((0,o.Dv)(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return p.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&((0,o.A7)(t)||"-"===t[0]&&(0,o.A7)(t.substring(1))))return p.from(t)}return l.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function m(t){if("string"!=typeof t)return m(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&l.throwArgumentError("invalid hex","value",t),"0x00"===(t=m(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function g(t){return p.from(m(t))}function v(t){const e=p.from(t).toHexString();return"-"===e[0]?new u("-"+e.substring(3),16):new u(e.substring(2),16)}function y(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),l.throwError(t,s.Yd.errors.NUMERIC_FAULT,n)}function b(t){return new u(t,36).toString(16)}function w(t){return new u(t,16).toString(36)}},335:(t,e,r)=>{"use strict";r.d(e,{Ox:()=>m,S5:()=>p,xs:()=>v});var n=r(3286),i=r(711),o=r(8794),s=r(2593);const a=new i.Yd(o.i),u={},l=s.O$.from(0),h=s.O$.from(-1);function c(t,e,r,n){const o={fault:e,operation:r};return void 0!==n&&(o.value=n),a.throwError(t,i.Yd.errors.NUMERIC_FAULT,o)}let f="0";for(;f.length<256;)f+=f;function d(t){if("number"!=typeof t)try{t=s.O$.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+f.substring(0,t):a.throwArgumentError("invalid decimal size","decimals",t)}function p(t,e){null==e&&(e=0);const r=d(e),n=(t=s.O$.from(t)).lt(l);n&&(t=t.mul(h));let i=t.mod(r).toString();for(;i.length2&&a.throwArgumentError("too many decimal points","value",t);let o=i[0],u=i[1];for(o||(o="0"),u||(u="0");"0"===u[u.length-1];)u=u.substring(0,u.length-1);for(u.length>r.length-1&&c("fractional component exceeds decimals","underflow","parseFixed"),""===u&&(u="0");u.lengthnull==t[e]?n:(typeof t[e]!==r&&a.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&a.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&a.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new g(u,e,r,n)}}class v{constructor(t,e,r,n){t!==u&&a.throwError("cannot use FixedNumber constructor; use FixedNumber.from",i.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=e,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&a.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=m(this._value,this.format.decimals),r=m(t._value,t.format.decimals);return v.fromValue(e.add(r),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=m(this._value,this.format.decimals),r=m(t._value,t.format.decimals);return v.fromValue(e.sub(r),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=m(this._value,this.format.decimals),r=m(t._value,t.format.decimals);return v.fromValue(e.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=m(this._value,this.format.decimals),r=m(t._value,t.format.decimals);return v.fromValue(e.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=v.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(e=e.subUnsafe(y.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=v.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(e=e.addUnsafe(y.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&a.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const r=v.from("1"+f.substring(0,t),this.format),n=b.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){if(null==t)return this._hex;t%8&&a.throwArgumentError("invalid byte width","width",t);const e=s.O$.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString();return(0,n.$m)(e,t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return v.fromString(this._value,t)}static fromValue(t,e,r){return null!=r||null==e||(0,s.Zm)(e)||(r=e,e=null),null==e&&(e=0),null==r&&(r="fixed"),v.fromString(p(t,e),g.from(r))}static fromString(t,e){null==e&&(e="fixed");const r=g.from(e),i=m(t,r.decimals);!r.signed&&i.lt(l)&&c("unsigned value cannot be negative","overflow","value",t);let o=null;r.signed?o=i.toTwos(r.width).toHexString():(o=i.toHexString(),o=(0,n.$m)(o,r.width/8));const s=p(i,r.decimals);return new v(u,o,s,r)}static fromBytes(t,e){null==e&&(e="fixed");const r=g.from(e);if((0,n.lE)(t).length>r.width/8)throw new Error("overflow");let i=s.O$.from(t);r.signed&&(i=i.fromTwos(r.width));const o=i.toTwos((r.signed?0:1)+r.width).toHexString(),a=p(i,r.decimals);return new v(u,o,a,r)}static from(t,e){if("string"==typeof t)return v.fromString(t,e);if((0,n._t)(t))return v.fromBytes(t,e);try{return v.fromValue(t,0,e)}catch(t){if(t.code!==i.Yd.errors.INVALID_ARGUMENT)throw t}return a.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const y=v.from(1),b=v.from("0.5")},3877:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(8677).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},3286:(t,e,r)=>{"use strict";r.d(e,{lE:()=>l,zo:()=>h,xs:()=>y,E1:()=>g,p3:()=>v,Ou:()=>w,$P:()=>b,$m:()=>E,Dv:()=>m,_t:()=>u,Zq:()=>s,A7:()=>d,gV:()=>A,N:()=>M,G1:()=>c,Bu:()=>f});const n=new(r(711).Yd)("bytes/5.7.0");function i(t){return!!t.toHexString}function o(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function s(t){return d(t)&&!(t.length%2)||u(t)}function a(t){return"number"==typeof t&&t==t&&t%1==0}function u(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!a(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function l(t,e){if(e||(e={}),"number"==typeof t){n.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),o(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),i(t)&&(t=t.toHexString()),d(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":n.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;tl(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),o(n)}function c(t){let e=l(t);if(0===e.length)return e;let r=0;for(;re&&n.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),o(r)}function d(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const p="0123456789abcdef";function m(t,e){if(e||(e={}),"number"==typeof t){n.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=p[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),i(t))return t.toHexString();if(d(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":n.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(u(t)){let e="0x";for(let r=0;r>4]+p[15&n]}return e}return n.throwArgumentError("invalid hexlify value","value",t)}function g(t){if("string"!=typeof t)t=m(t);else if(!d(t)||t.length%2)return null;return(t.length-2)/2}function v(t,e,r){return"string"!=typeof t?t=m(t):(!d(t)||t.length%2)&&n.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function y(t){let e="0x";return t.forEach((t=>{e+=m(t).substring(2)})),e}function b(t){const e=w(m(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function w(t){"string"!=typeof t&&(t=m(t)),d(t)||n.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&n.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function M(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(s(t)){let r=l(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=m(r.slice(0,32)),e.s=m(r.slice(32,64))):65===r.length?(e.r=m(r.slice(0,32)),e.s=m(r.slice(32,64)),e.v=r[64]):n.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:n.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=m(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=f(l(e._vs),32);e._vs=m(r);const i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&n.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const o=m(r);null==e.s?e.s=o:e.s!==o&&n.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?n.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&n.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&d(e.r)?e.r=E(e.r,32):n.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&d(e.s)?e.s=E(e.s,32):n.throwArgumentError("signature missing or invalid s","signature",t);const r=l(e.s);r[0]>=128&&n.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=m(r);e._vs&&(d(e._vs)||n.throwArgumentError("signature invalid _vs","signature",t),e._vs=E(e._vs,32)),null==e._vs?e._vs=i:e._vs!==i&&n.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function A(t){return m(h([(t=M(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}},9279:(t,e,r)=>{"use strict";r.d(e,{d:()=>n});const n="0x0000000000000000000000000000000000000000"},1046:(t,e,r)=>{"use strict";r.d(e,{$B:()=>h,Bz:()=>l,Ce:()=>u,PS:()=>c,Py:()=>a,_Y:()=>o,fh:()=>s,tL:()=>i});var n=r(2593);const i=n.O$.from(-1),o=n.O$.from(0),s=n.O$.from(1),a=n.O$.from(2),u=n.O$.from("1000000000000000000"),l=n.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),h=n.O$.from("-0x8000000000000000000000000000000000000000000000000000000000000000"),c=n.O$.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")},7218:(t,e,r)=>{"use strict";r.d(e,{R:()=>n});const n="0x0000000000000000000000000000000000000000000000000000000000000000"},5644:(t,e,r)=>{"use strict";r.d(e,{i:()=>n});const n="hash/5.7.0"},2046:(t,e,r)=>{"use strict";r.d(e,{id:()=>o});var n=r(8197),i=r(4242);function o(t){return(0,n.w)((0,i.Y0)(t))}},3684:(t,e,r)=>{"use strict";r.d(e,{r:()=>a});var n=r(3286),i=r(8197),o=r(4242);const s="Ethereum Signed Message:\n";function a(t){return"string"==typeof t&&(t=(0,o.Y0)(t)),(0,i.w)((0,n.zo)([(0,o.Y0)(s),(0,o.Y0)(String(t.length)),t]))}},8339:(t,e,r)=>{"use strict";r.d(e,{Kn:()=>C,r1:()=>O,VM:()=>I});var n=r(3286),i=r(4242),o=r(8197),s=r(711),a=r(5644);function u(t,e){null==e&&(e=1);const r=[],n=r.forEach,i=function(t,e){n.call(t,(function(t){e>0&&Array.isArray(t)?i(t,e-1):r.push(t)}))};return i(t,e),r}function l(t){return 1&t?~t>>1:t>>1}function h(t,e){let r=Array(t);for(let n=0,i=-1;ne[t])):r}function d(t,e,r){let n=Array(t).fill(void 0).map((()=>[]));for(let i=0;in[e].push(t)));return n}function p(t,e){let r=1+e(),n=e(),i=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(r)}return e}(e);return u(d(i.length,1+t,e).map(((t,e)=>{const o=t[0],s=t.slice(1);return Array(i[e]).fill(void 0).map(((t,e)=>{let i=e*n;return[o+e*r,s.map((t=>t+i))]}))})))}function m(t,e){return d(1+e(),1+t,e).map((t=>[t[0],t.slice(1)]))}const g=function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,o=[0,1];for(let t=1;t>--u&1}const c=Math.pow(2,31),f=c>>>1,d=f>>1,p=c-1;let m=0;for(let t=0;t<31;t++)m=m<<1|h();let g=[],v=0,y=c;for(;;){let t=Math.floor(((m-v+1)*i-1)/y),e=0,r=n;for(;r-e>1;){let n=e+r>>>1;t>>1|h(),s=s<<1^f,a=(a^f)<<1|f|1;v=s,y=1+a-s}let b=n-4;return g.map((e=>{switch(e-b){case 3:return b+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return b+256+(t[a++]<<8|t[a++]);case 1:return b+t[a++];default:return e-1}}))}((0,r(9567).J)("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))),v=new Set(f(g)),y=new Set(f(g)),b=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(p(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(m(r,t))}return function(t){const e={};for(let r=0;rt-e));return function r(){let n=[];for(;;){let i=f(t,e);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.sort(((t,e)=>e.set.size-t.set.size));let i=t(),o=i%3;i=i/3|0;let s=!!(1&i);return i>>=1,{branches:n,valid:o,fe0f:s,save:1==i,check:2==i}}()}(g),E=45,M=95;function A(t){return(0,i.XL)(t)}function _(t){return t.filter((t=>65039!=t))}function N(t){for(let e of t.split(".")){let t=A(e);try{for(let e=t.lastIndexOf(M)-1;e>=0;e--)if(t[e]!==M)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every((t=>t<128))&&t[2]===E&&t[3]===E)throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${e}": ${t.message}`)}}return t}function S(t,e){var r;let n,i,o=w,s=[],a=t.length;for(e&&(e.length=0);a;){let u=t[--a];if(o=null===(r=o.branches.find((t=>t.set.has(u))))||void 0===r?void 0:r.node,!o)break;if(o.save)i=u;else if(o.check&&u===i)break;s.push(u),o.fe0f&&(s.push(65039),a>0&&65039==t[a-1]&&a--),o.valid&&(n=s.slice(),2==o.valid&&n.splice(1,1),e&&e.push(...t.slice(a).reverse()),t.length=a)}return n}const T=new s.Yd(a.i),k=new Uint8Array(32);function R(t){if(0===t.length)throw new Error("invalid ENS name; empty component");return t}function x(t){const e=(0,i.Y0)(function(t){return N(function(t,e){let r=A(t).reverse(),n=[];for(;r.length;){let t=S(r);if(t){n.push(...e(t));continue}let i=r.pop();if(v.has(i)){n.push(i);continue}if(y.has(i))continue;let o=b[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);n.push(...o)}return N(String.fromCodePoint(...n).normalize("NFC"))}(t,_))}(t)),r=[];if(0===t.length)return r;let n=0;for(let t=0;t=e.length)throw new Error("invalid ENS name; empty component");return r.push(R(e.slice(n))),r}function O(t){try{return 0!==x(t).length}catch(t){}return!1}function I(t){"string"!=typeof t&&T.throwArgumentError("invalid ENS name; not a string","name",t);let e=k;const r=x(t);for(;r.length;)e=(0,o.w)((0,n.zo)([e,(0,o.w)(r.pop())]));return(0,n.Dv)(e)}function C(t){return(0,n.Dv)((0,n.zo)(x(t).map((t=>{if(t.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const e=new Uint8Array(t.length+1);return e.set(t,1),e[0]=e.length-1,e}))))+"00"}k.fill(0)},7827:(t,e,r)=>{"use strict";r.d(e,{E:()=>N});var n=r(4594),i=r(2593),o=r(3286),s=r(8197),a=r(3587),u=r(711),l=r(5644),h=r(2046);const c=new u.Yd(l.i),f=new Uint8Array(32);f.fill(0);const d=i.O$.from(-1),p=i.O$.from(0),m=i.O$.from(1),g=i.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),v=(0,o.$m)(m.toHexString(),32),y=(0,o.$m)(p.toHexString(),32),b={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},w=["name","version","chainId","verifyingContract","salt"];function E(t){return function(e){return"string"!=typeof e&&c.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const M={name:E("name"),version:E("version"),chainId:function(t){try{return i.O$.from(t).toString()}catch(t){}return c.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return(0,n.Kn)(t).toLowerCase()}catch(t){}return c.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=(0,o.lE)(t);if(32!==e.length)throw new Error("bad length");return(0,o.Dv)(e)}catch(t){}return c.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function A(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],n=parseInt(e[2]||"256");(n%8!=0||n>256||e[2]&&e[2]!==String(n))&&c.throwArgumentError("invalid numeric width","type",t);const s=g.mask(r?n-1:n),a=r?s.add(m).mul(d):p;return function(e){const r=i.O$.from(e);return(r.lt(a)||r.gt(s))&&c.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),(0,o.$m)(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&c.throwArgumentError("invalid bytes width","type",t),function(e){return(0,o.lE)(e).length!==r&&c.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=(0,o.lE)(t),r=e.length%32;return r?(0,o.xs)([e,f.slice(r)]):(0,o.Dv)(e)}(e)}}}switch(t){case"address":return function(t){return(0,o.$m)((0,n.Kn)(t),32)};case"bool":return function(t){return t?v:y};case"bytes":return function(t){return(0,s.w)(t)};case"string":return function(t){return(0,h.id)(t)}}return null}function _(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class N{constructor(t){(0,a.zG)(this,"types",Object.freeze((0,a.p$)(t))),(0,a.zG)(this,"_encoderCache",{}),(0,a.zG)(this,"_types",{});const e={},r={},n={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],n[t]={}}));for(const n in t){const i={};t[n].forEach((o=>{i[o.name]&&c.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",t),i[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&c.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t),A(s)||(r[s]||c.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const i=Object.keys(r).filter((t=>0===r[t].length));0===i.length?c.throwArgumentError("missing primary type","types",t):i.length>1&&c.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),(0,a.zG)(this,"primaryType",i[0]),function i(o,s){s[o]&&c.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(i(t,s),Object.keys(s).forEach((e=>{n[e][t]=!0})))})),delete s[o]}(this.primaryType,{});for(const e in n){const r=Object.keys(n[e]);r.sort(),this._types[e]=_(e,t[e])+r.map((e=>_(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=A(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),n=parseInt(e[3]);return e=>{n>=0&&e.length!==n&&c.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(s.w)),(0,s.w)((0,o.xs)(i))}}const r=this.types[t];if(r){const e=(0,h.id)(this._types[t]);return t=>{const n=r.map((({name:e,type:r})=>{const n=this.getEncoder(r)(t[e]);return this._types[r]?(0,s.w)(n):n}));return n.unshift(e),(0,o.xs)(n)}}return c.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||c.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return(0,s.w)(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(A(t))return r(t,e);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=parseInt(n[3]);return i>=0&&e.length!==i&&c.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const i=this.types[t];return i?i.reduce(((t,{name:n,type:i})=>(t[n]=this._visit(i,e[n],r),t)),{}):c.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new N(t)}static getPrimaryType(t){return N.from(t).primaryType}static hashStruct(t,e,r){return N.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=b[r];n||c.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>w.indexOf(t.name)-w.indexOf(e.name))),N.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return(0,o.xs)(["0x1901",N.hashDomain(t),N.from(e).hash(r)])}static hash(t,e,r){return(0,s.w)(N.encode(t,e,r))}static resolveNames(t,e,r,n){return i=this,s=void 0,l=function*(){t=(0,a.DC)(t);const i={};t.verifyingContract&&!(0,o.A7)(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const s=N.from(e);s.visit(r,((t,e)=>("address"!==t||(0,o.A7)(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),r=s.visit(r,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:r}},new((u=void 0)||(u=Promise))((function(t,e){function r(t){try{o(l.next(t))}catch(t){e(t)}}function n(t){try{o(l.throw(t))}catch(t){e(t)}}function o(e){var i;e.done?t(e.value):(i=e.value,i instanceof u?i:new u((function(t){t(i)}))).then(r,n)}o((l=l.apply(i,s||[])).next())}));var i,s,u,l}static getPayload(t,e,r){N.hashDomain(t);const n={},s=[];w.forEach((e=>{const r=t[e];null!=r&&(n[e]=M[e](r),s.push({name:e,type:b[e]}))}));const u=N.from(e),l=(0,a.DC)(e);return l.EIP712Domain?c.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):l.EIP712Domain=s,u.encode(r),{types:l,domain:n,primaryType:u.primaryType,message:u.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return(0,o.Dv)((0,o.lE)(e));if(t.match(/^u?int/))return i.O$.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&c.throwArgumentError("invalid string","value",e),e}return c.throwArgumentError("unsupported type","type",t)}))}}}},6274:(t,e,r)=>{"use strict";r.d(e,{m$:()=>_,cD:()=>A,JJ:()=>T,ny:()=>R,xh:()=>k,oy:()=>S,OI:()=>N});var n=r(7727),i=r(3286),o=r(2593),s=r(4242),a=r(5306),u=r(3587),l=r(2768),h=r(3951),c=r(1261),f=r(4377),d=r(9855);const p=new(r(711).Yd)("hdnode/5.7.0"),m=o.O$.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),g=(0,s.Y0)("Bitcoin seed"),v=2147483648;function y(t){return(1<=256)throw new Error("Depth too large!");return w((0,i.zo)([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",(0,i.Dv)(this.depth),this.parentFingerprint,(0,i.$m)((0,i.Dv)(this.index),4),this.chainCode,null!=this.privateKey?(0,i.zo)(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new _(M,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(t){if(t>4294967295)throw new Error("invalid index - "+String(t));let e=this.path;e&&(e+="/"+(t&~v));const r=new Uint8Array(37);if(t&v){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set((0,i.lE)(this.privateKey),1),e&&(e+="'")}else r.set((0,i.lE)(this.publicKey));for(let e=24;e>=0;e-=8)r[33+(e>>3)]=t>>24-e&255;const n=(0,i.lE)((0,h.Gy)(c.p.sha512,this.chainCode,r)),s=n.slice(0,32),a=n.slice(32);let u=null,f=null;this.privateKey?u=b(o.O$.from(s).add(this.privateKey).mod(m)):f=new l.Et((0,i.Dv)(s))._addPoint(this.publicKey);let d=e;const p=this.mnemonic;return p&&(d=Object.freeze({phrase:p.phrase,path:e,locale:p.locale||"en"})),new _(M,u,f,this.fingerprint,b(a),t,this.depth+1,d)}derivePath(t){const e=t.split("/");if(0===e.length||"m"===e[0]&&0!==this.depth)throw new Error("invalid path - "+t);"m"===e[0]&&e.shift();let r=this;for(let t=0;t=v)throw new Error("invalid path index - "+n);r=r._derive(v+t)}else{if(!n.match(/^[0-9]+$/))throw new Error("invalid path component - "+n);{const t=parseInt(n);if(t>=v)throw new Error("invalid path index - "+n);r=r._derive(t)}}}return r}static _fromSeed(t,e){const r=(0,i.lE)(t);if(r.length<16||r.length>64)throw new Error("invalid seed");const n=(0,i.lE)((0,h.Gy)(c.p.sha512,g,r));return new _(M,b(n.slice(0,32)),null,"0x00000000",b(n.slice(32)),0,0,e)}static fromMnemonic(t,e,r){return t=T(S(t,r=E(r)),r),_._fromSeed(N(t,e),{phrase:t,path:"m",locale:r.locale})}static fromSeed(t){return _._fromSeed(t,null)}static fromExtendedKey(t){const e=n.eU.decode(t);82===e.length&&w(e.slice(0,78))===t||p.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const r=e[4],o=(0,i.Dv)(e.slice(5,9)),s=parseInt((0,i.Dv)(e.slice(9,13)).substring(2),16),a=(0,i.Dv)(e.slice(13,45)),u=e.slice(45,78);switch((0,i.Dv)(e.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new _(M,null,(0,i.Dv)(u),o,a,s,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==u[0])break;return new _(M,(0,i.Dv)(u.slice(1)),null,o,a,s,r,null)}return p.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function N(t,e){e||(e="");const r=(0,s.Y0)("mnemonic"+e,s.Uj.NFKD);return(0,a.n)((0,s.Y0)(t,s.Uj.NFKD),r,2048,64,"sha512")}function S(t,e){e=E(e),p.checkNormalize();const r=e.split(t);if(r.length%3!=0)throw new Error("invalid mnemonic");const n=(0,i.lE)(new Uint8Array(Math.ceil(11*r.length/8)));let o=0;for(let t=0;t>3]|=1<<7-o%8),o++}const s=32*r.length/3,a=y(r.length/3);if(((0,i.lE)((0,h.JQ)(n.slice(0,s/8)))[0]&a)!=(n[n.length-1]&a))throw new Error("invalid checksum");return(0,i.Dv)(n.slice(0,s/8))}function T(t,e){if(e=E(e),(t=(0,i.lE)(t)).length%4!=0||t.length<16||t.length>32)throw new Error("invalid entropy");const r=[0];let n=11;for(let e=0;e8?(r[r.length-1]<<=8,r[r.length-1]|=t[e],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=t[e]>>8-n,r.push(t[e]&(1<<8-n)-1),n+=3);const o=t.length/4,s=(0,i.lE)((0,h.JQ)(t))[0]&y(o);return r[r.length-1]<<=o,r[r.length-1]|=s>>8-o,e.join(r.map((t=>e.getWord(t))))}function k(t,e){try{return S(t,e),!0}catch(t){}return!1}function R(t){return("number"!=typeof t||t<0||t>=v||t%1)&&p.throwArgumentError("invalid account index","index",t),`m/44'/60'/${t}'/0/0`}},9816:(t,e,r)=>{"use strict";r.d(e,{i:()=>n});const n="json-wallets/5.7.0"},9380:(t,e,r)=>{"use strict";r.d(e,{w:()=>b,qz:()=>w});var n=r(8826),i=r.n(n),o=r(4594),s=r(3286),a=r(8197),u=r(5306),l=r(4242),h=r(3587),c=r(711),f=r(9816),d=r(7013);const p=new c.Yd(f.i);class m extends h.dk{isCrowdsaleAccount(t){return!(!t||!t._isCrowdsaleAccount)}}function g(t,e){const r=JSON.parse(t);e=(0,d.Ij)(e);const n=(0,o.Kn)((0,d.gx)(r,"ethaddr")),h=(0,d.p3)((0,d.gx)(r,"encseed"));h&&h.length%16==0||p.throwArgumentError("invalid encseed","json",t);const c=(0,s.lE)((0,u.n)(e,e,2e3,32,"sha256")).slice(0,16),f=h.slice(0,16),g=h.slice(16),v=new(i().ModeOfOperation.cbc)(c,f),y=i().padding.pkcs7.strip((0,s.lE)(v.decrypt(g)));let b="";for(let t=0;t{"use strict";r.d(e,{LW:()=>i,Rb:()=>s,aO:()=>o});var n=r(4594);function i(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return e.encseed&&e.ethaddr}function o(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return!(!e.version||parseInt(e.version)!==e.version||3!==parseInt(e.version))}function s(t){if(i(t))try{return(0,n.Kn)(JSON.parse(t).ethaddr)}catch(t){return null}if(o(t))try{return(0,n.Kn)(JSON.parse(t).address)}catch(t){return null}return null}},1964:(t,e,r)=>{"use strict";r.d(e,{HI:()=>k,hb:()=>S,pe:()=>T});var n=r(8826),i=r.n(n),o=r(7635),s=r.n(o),a=r(4594),u=r(3286),l=r(6274),h=r(8197),c=r(5306),f=r(4478),d=r(3587),p=r(4377),m=r(7013),g=r(711),v=r(9816),y=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const b=new g.Yd(v.i);function w(t){return null!=t&&t.mnemonic&&t.mnemonic.phrase}class E extends d.dk{isKeystoreAccount(t){return!(!t||!t._isKeystoreAccount)}}function M(t,e){const r=(0,m.p3)((0,m.gx)(t,"crypto/ciphertext"));if((0,u.Dv)((0,h.w)((0,u.zo)([e.slice(16,32),r]))).substring(2)!==(0,m.gx)(t,"crypto/mac").toLowerCase())throw new Error("invalid password");const n=function(t,e,r){if("aes-128-ctr"===(0,m.gx)(t,"crypto/cipher")){const n=(0,m.p3)((0,m.gx)(t,"crypto/cipherparams/iv")),o=new(i().Counter)(n),s=new(i().ModeOfOperation.ctr)(e,o);return(0,u.lE)(s.decrypt(r))}return null}(t,e.slice(0,16),r);n||b.throwError("unsupported cipher",g.Yd.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const o=e.slice(32,64),s=(0,p.db)(n);if(t.address){let e=t.address.toLowerCase();if("0x"!==e.substring(0,2)&&(e="0x"+e),(0,a.Kn)(e)!==s)throw new Error("address mismatch")}const c={_isKeystoreAccount:!0,address:s,privateKey:(0,u.Dv)(n)};if("0.1"===(0,m.gx)(t,"x-ethers/version")){const e=(0,m.p3)((0,m.gx)(t,"x-ethers/mnemonicCiphertext")),r=(0,m.p3)((0,m.gx)(t,"x-ethers/mnemonicCounter")),n=new(i().Counter)(r),s=new(i().ModeOfOperation.ctr)(o,n),a=(0,m.gx)(t,"x-ethers/path")||l.cD,h=(0,m.gx)(t,"x-ethers/locale")||"en",f=(0,u.lE)(s.decrypt(e));try{const t=(0,l.JJ)(f,h),e=l.m$.fromMnemonic(t,null,h).derivePath(a);if(e.privateKey!=c.privateKey)throw new Error("mnemonic mismatch");c.mnemonic=e.mnemonic}catch(t){if(t.code!==g.Yd.errors.INVALID_ARGUMENT||"wordlist"!==t.argument)throw t}}return new E(c)}function A(t,e,r,n,i){return(0,u.lE)((0,c.n)(t,e,r,n,i))}function _(t,e,r,n,i){return Promise.resolve(A(t,e,r,n,i))}function N(t,e,r,n,i){const o=(0,m.Ij)(e),s=(0,m.gx)(t,"crypto/kdf");if(s&&"string"==typeof s){const e=function(t,e){return b.throwArgumentError("invalid key-derivation function parameters",t,e)};if("scrypt"===s.toLowerCase()){const r=(0,m.p3)((0,m.gx)(t,"crypto/kdfparams/salt")),a=parseInt((0,m.gx)(t,"crypto/kdfparams/n")),u=parseInt((0,m.gx)(t,"crypto/kdfparams/r")),l=parseInt((0,m.gx)(t,"crypto/kdfparams/p"));a&&u&&l||e("kdf",s),0!=(a&a-1)&&e("N",a);const h=parseInt((0,m.gx)(t,"crypto/kdfparams/dklen"));return 32!==h&&e("dklen",h),n(o,r,a,u,l,64,i)}if("pbkdf2"===s.toLowerCase()){const n=(0,m.p3)((0,m.gx)(t,"crypto/kdfparams/salt"));let i=null;const s=(0,m.gx)(t,"crypto/kdfparams/prf");"hmac-sha256"===s?i="sha256":"hmac-sha512"===s?i="sha512":e("prf",s);const a=parseInt((0,m.gx)(t,"crypto/kdfparams/c")),u=parseInt((0,m.gx)(t,"crypto/kdfparams/dklen"));return 32!==u&&e("dklen",u),r(o,n,a,u,i)}}return b.throwArgumentError("unsupported key-derivation function","kdf",s)}function S(t,e){const r=JSON.parse(t);return M(r,N(r,e,A,s().syncScrypt))}function T(t,e,r){return y(this,void 0,void 0,(function*(){const n=JSON.parse(t);return M(n,yield N(n,e,_,s().scrypt,r))}))}function k(t,e,r,n){try{if((0,a.Kn)(t.address)!==(0,p.db)(t.privateKey))throw new Error("address/privateKey mismatch");if(w(t)){const e=t.mnemonic;if(l.m$.fromMnemonic(e.phrase,null,e.locale).derivePath(e.path||l.cD).privateKey!=t.privateKey)throw new Error("mnemonic mismatch")}}catch(t){return Promise.reject(t)}"function"!=typeof r||n||(n=r,r={}),r||(r={});const o=(0,u.lE)(t.privateKey),c=(0,m.Ij)(e);let d=null,g=null,v=null;if(w(t)){const e=t.mnemonic;d=(0,u.lE)((0,l.oy)(e.phrase,e.locale||"en")),g=e.path||l.cD,v=e.locale||"en"}let y=r.client;y||(y="ethers.js");let b=null;b=r.salt?(0,u.lE)(r.salt):(0,f.O)(32);let E=null;if(r.iv){if(E=(0,u.lE)(r.iv),16!==E.length)throw new Error("invalid iv")}else E=(0,f.O)(16);let M=null;if(r.uuid){if(M=(0,u.lE)(r.uuid),16!==M.length)throw new Error("invalid uuid")}else M=(0,f.O)(16);let A=1<<17,_=8,N=1;return r.scrypt&&(r.scrypt.N&&(A=r.scrypt.N),r.scrypt.r&&(_=r.scrypt.r),r.scrypt.p&&(N=r.scrypt.p)),s().scrypt(c,b,A,_,N,64,n).then((e=>{const r=(e=(0,u.lE)(e)).slice(0,16),n=e.slice(16,32),s=e.slice(32,64),a=new(i().Counter)(E),l=new(i().ModeOfOperation.ctr)(r,a),c=(0,u.lE)(l.encrypt(o)),p=(0,h.w)((0,u.zo)([n,c])),w={address:t.address.substring(2).toLowerCase(),id:(0,m.EH)(M),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:(0,u.Dv)(E).substring(2)},ciphertext:(0,u.Dv)(c).substring(2),kdf:"scrypt",kdfparams:{salt:(0,u.Dv)(b).substring(2),n:A,dklen:32,p:N,r:_},mac:p.substring(2)}};if(d){const t=(0,f.O)(16),e=new(i().Counter)(t),r=new(i().ModeOfOperation.ctr)(s,e),n=(0,u.lE)(r.encrypt(d)),o=new Date,a=o.getUTCFullYear()+"-"+(0,m.VP)(o.getUTCMonth()+1,2)+"-"+(0,m.VP)(o.getUTCDate(),2)+"T"+(0,m.VP)(o.getUTCHours(),2)+"-"+(0,m.VP)(o.getUTCMinutes(),2)+"-"+(0,m.VP)(o.getUTCSeconds(),2)+".0Z";w["x-ethers"]={client:y,gethFilename:"UTC--"+a+"--"+w.address,mnemonicCounter:(0,u.Dv)(t).substring(2),mnemonicCiphertext:(0,u.Dv)(n).substring(2),path:g,locale:v,version:"0.1"}}return JSON.stringify(w)}))}},7013:(t,e,r)=>{"use strict";r.d(e,{EH:()=>l,Ij:()=>a,VP:()=>s,gx:()=>u,p3:()=>o});var n=r(3286),i=r(4242);function o(t){return"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),(0,n.lE)(t)}function s(t,e){for(t=String(t);t.length{"use strict";r.d(e,{w:()=>s});var n=r(1094),i=r.n(n),o=r(3286);function s(t){return"0x"+i().keccak_256((0,o.lE)(t))}},711:(t,e,r)=>{"use strict";r.d(e,{jK:()=>h,Yd:()=>f});let n=!1,i=!1;const o={debug:1,default:2,info:2,warning:3,error:4,off:5};let s=o.default,a=null;const u=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var l,h;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(l||(l={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(h||(h={}));const c="0123456789abcdef";class f{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==o[r]&&this.throwArgumentError("invalid log level name","logLevel",t),s>o[r]||console.log.apply(console,e)}debug(...t){this._log(f.levels.DEBUG,t)}info(...t){this._log(f.levels.INFO,t)}warn(...t){this._log(f.levels.WARNING,t)}makeError(t,e,r){if(i)return this.makeError("censored error",e,{});e||(e=f.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=c[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const o=t;let s="";switch(e){case h.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case h.CALL_EXCEPTION:case h.INSUFFICIENT_FUNDS:case h.MISSING_NEW:case h.NONCE_EXPIRED:case h.REPLACEMENT_UNDERPRICED:case h.TRANSACTION_REPLACED:case h.UNPREDICTABLE_GAS_LIMIT:s=e}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const a=new Error(t);return a.reason=o,a.code=e,Object.keys(r).forEach((function(t){a[t]=r[t]})),a}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,f.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),u&&this.throwError("platform missing String.prototype.normalize",f.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:u})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,f.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,f.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,f.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",f.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",f.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",f.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return a||(a=new f("logger/5.7.0")),a}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",f.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),n){if(!t)return;this.globalLogger().throwError("error censorship permanent",f.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!t,n=!!e}static setLogLevel(t){const e=o[t.toLowerCase()];null!=e?s=e:f.globalLogger().warn("invalid log level - "+t)}static from(t){return new f(t)}}f.errors=h,f.levels=l},9861:(t,e,r)=>{"use strict";r.d(e,{H:()=>h});const n=new(r(711).Yd)("networks/5.7.1");function i(t){const e=function(e,r){null==r&&(r={});const n=[];if(e.InfuraProvider&&"-"!==r.infura)try{n.push(new e.InfuraProvider(t,r.infura))}catch(t){}if(e.EtherscanProvider&&"-"!==r.etherscan)try{n.push(new e.EtherscanProvider(t,r.etherscan))}catch(t){}if(e.AlchemyProvider&&"-"!==r.alchemy)try{n.push(new e.AlchemyProvider(t,r.alchemy))}catch(t){}if(e.PocketProvider&&"-"!==r.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const o=new e.PocketProvider(t,r.pocket);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(t){}}if(e.CloudflareProvider&&"-"!==r.cloudflare)try{n.push(new e.CloudflareProvider(t))}catch(t){}if(e.AnkrProvider&&"-"!==r.ankr)try{const i=["ropsten"],o=new e.AnkrProvider(t,r.ankr);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(t){}if(0===n.length)return null;if(e.FallbackProvider){let i=1;return null!=r.quorum?i=r.quorum:"homestead"===t&&(i=2),new e.FallbackProvider(n,i)}return n[0]};return e.renetwork=function(t){return i(t)},e}function o(t,e){const r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(t,e):null};return r.renetwork=function(e){return o(t,e)},r}const s={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:i("homestead")},a={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:i("ropsten")},u={chainId:63,name:"classicMordor",_defaultProvider:o("https://www.ethercluster.com/mordor","classicMordor")},l={unspecified:{chainId:0,name:"unspecified"},homestead:s,mainnet:s,morden:{chainId:2,name:"morden"},ropsten:a,testnet:a,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:i("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:i("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:i("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:i("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:o("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:u,classicTestnet:u,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:o("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:i("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:i("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function h(t){if(null==t)return null;if("number"==typeof t){for(const e in l){const r=l[e];if(r.chainId===t)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"==typeof t){const e=l[t];return null==e?null:{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress,_defaultProvider:e._defaultProvider||null}}const e=l[t.name];if(!e)return"number"!=typeof t.chainId&&n.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==e.chainId&&n.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;var i;return null==r&&e._defaultProvider&&(r=(i=e._defaultProvider)&&"function"==typeof i.renetwork?e._defaultProvider.renetwork(t):e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}},5306:(t,e,r)=>{"use strict";r.d(e,{n:()=>o});var n=r(3286),i=r(3951);function o(t,e,r,o,s){let a;t=(0,n.lE)(t),e=(0,n.lE)(e);let u=1;const l=new Uint8Array(o),h=new Uint8Array(e.length+4);let c,f;h.set(e);for(let d=1;d<=u;d++){h[e.length]=d>>24&255,h[e.length+1]=d>>16&255,h[e.length+2]=d>>8&255,h[e.length+3]=255&d;let p=(0,n.lE)((0,i.Gy)(s,t,h));a||(a=p.length,f=new Uint8Array(a),u=Math.ceil(o/a),c=o-(u-1)*a),f.set(p);for(let e=1;e{"use strict";r.d(e,{dk:()=>m,uj:()=>l,p$:()=>p,zG:()=>s,tu:()=>a,mE:()=>u,DC:()=>h});var n=r(711),i=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const o=new n.Yd("properties/5.7.0");function s(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function a(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function u(t){return i(this,void 0,void 0,(function*(){const e=Object.keys(t).map((e=>{const r=t[e];return Promise.resolve(r).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}))}function l(t,e){t&&"object"==typeof t||o.throwArgumentError("invalid object","object",t),Object.keys(t).forEach((r=>{e[r]||o.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)}))}function h(t){const e={};for(const r in t)e[r]=t[r];return e}const c={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function f(t){if(null==t||c[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rp(t))));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&s(e,r,p(n))}return e}return o.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function p(t){return d(t)}class m{constructor(t){for(const e in t)this[e]=p(t[e])}}},4478:(t,e,r)=>{"use strict";r.d(e,{O:()=>u});var n=r(3286),i=r(711);const o=new i.Yd("random/5.7.0"),s=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("unable to locate global object")}();let a=s.crypto||s.msCrypto;function u(t){(t<=0||t>1024||t%1||t!=t)&&o.throwArgumentError("invalid length","length",t);const e=new Uint8Array(t);return a.getRandomValues(e),(0,n.lE)(e)}a&&a.getRandomValues||(o.warn("WARNING: Missing strong random number source"),a={getRandomValues:function(t){return o.throwError("no secure random source avaialble",i.Yd.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}})},2472:(t,e,r)=>{"use strict";function n(t){for(let e=(t=t.slice()).length-1;e>0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}r.d(e,{y:()=>n})},1843:(t,e,r)=>{"use strict";r.r(e),r.d(e,{decode:()=>f,encode:()=>l});var n=r(3286),i=r(711);const o=new i.Yd("rlp/5.7.0");function s(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function a(t,e,r){let n=0;for(let i=0;ie+1+n&&o.throwError("child data too short",i.Yd.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:s}}function c(t,e){if(0===t.length&&o.throwError("data too short",i.Yd.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&o.throwError("data short segment too short",i.Yd.errors.BUFFER_OVERRUN,{});const n=a(t,e+1,r);return e+1+r+n>t.length&&o.throwError("data long segment too short",i.Yd.errors.BUFFER_OVERRUN,{}),h(t,e,e+1+r,r+n)}if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&o.throwError("data array too short",i.Yd.errors.BUFFER_OVERRUN,{}),h(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&o.throwError("data array too short",i.Yd.errors.BUFFER_OVERRUN,{});const s=a(t,e+1,r);return e+1+r+s>t.length&&o.throwError("data array too short",i.Yd.errors.BUFFER_OVERRUN,{}),{consumed:1+r+s,result:(0,n.Dv)(t.slice(e+1+r,e+1+r+s))}}if(t[e]>=128){const r=t[e]-128;return e+1+r>t.length&&o.throwError("data too short",i.Yd.errors.BUFFER_OVERRUN,{}),{consumed:1+r,result:(0,n.Dv)(t.slice(e+1,e+1+r))}}return{consumed:1,result:(0,n.Dv)(t[e])}}function f(t){const e=(0,n.lE)(t),r=c(e,0);return r.consumed!==e.length&&o.throwArgumentError("invalid rlp data","data",t),r.result}},3951:(t,e,r)=>{"use strict";r.d(e,{Gy:()=>f,bP:()=>l,JQ:()=>h,o:()=>c});var n=r(3715),i=r.n(n),o=r(3286),s=r(1261),a=r(711);const u=new a.Yd("sha2/5.7.0");function l(t){return"0x"+i().ripemd160().update((0,o.lE)(t)).digest("hex")}function h(t){return"0x"+i().sha256().update((0,o.lE)(t)).digest("hex")}function c(t){return"0x"+i().sha512().update((0,o.lE)(t)).digest("hex")}function f(t,e,r){return s.p[t]||u.throwError("unsupported algorithm "+t,a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),"0x"+i().hmac(i()[t],(0,o.lE)(e)).update((0,o.lE)(r)).digest("hex")}},1261:(t,e,r)=>{"use strict";var n;r.d(e,{p:()=>n}),function(t){t.sha256="sha256",t.sha512="sha512"}(n||(n={}))},2768:(t,e,r)=>{"use strict";r.d(e,{Et:()=>W,VW:()=>J,LO:()=>Y});var n=r(2500),i=r.n(n),o=r(3715),s=r.n(o);function a(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},t(r,r.exports),r.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self&&self;var u=l;function l(t,e){if(!t)throw new Error(e||"Assertion failed")}l.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var h=a((function(t,e){var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}})),c=a((function(t,e){var r=e;r.assert=u,r.toArray=h.toArray,r.zero2=h.zero2,r.toHex=h.toHex,r.encode=h.encode,r.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,l=e.andln(3)+o&3;3===u&&(u=-1),3===l&&(l=-1),s=0==(1&u)?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==l?u:-u,r[0].push(s),a=0==(1&l)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==u?l:-l,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new(i())(t,"hex","le")}})),f=c.getNAF,d=c.getJSF,p=c.assert;function m(t,e){this.type=t,this.p=new(i())(e.p,16),this.red=e.prime?i().red(e.prime):i().mont(this.p),this.zero=new(i())(0).toRed(this.red),this.one=new(i())(1).toRed(this.red),this.two=new(i())(2).toRed(this.red),this.n=e.n&&new(i())(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var g=m;function v(t,e){this.curve=t,this.type=e,this.precomputed=null}m.prototype.point=function(){throw new Error("Not implemented")},m.prototype.validate=function(){throw new Error("Not implemented")},m.prototype._fixedNafMul=function(t,e){p(t.precomputed);var r=t._getDoubles(),n=f(e,1,this._bitLength),i=(1<=o;u--)s=(s<<1)+n[u];a.push(s)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),c=i;c>0;c--){for(o=0;o=0;a--){for(var u=0;a>=0&&0===o[a];a--)u++;if(a>=0&&u++,s=s.dblp(u),a<0)break;var l=o[a];p(0!==l),s="affine"===t.type?l>0?s.mixedAdd(i[l-1>>1]):s.mixedAdd(i[-l-1>>1].neg()):l>0?s.add(i[l-1>>1]):s.add(i[-l-1>>1].neg())}return"affine"===t.type?s.toP():s},m.prototype._wnafMulAdd=function(t,e,r,n,i){var o,s,a,u=this._wnafT1,l=this._wnafT2,h=this._wnafT3,c=0;for(o=0;o=1;o-=2){var m=o-1,g=o;if(1===u[m]&&1===u[g]){var v=[e[m],null,null,e[g]];0===e[m].y.cmp(e[g].y)?(v[1]=e[m].add(e[g]),v[2]=e[m].toJ().mixedAdd(e[g].neg())):0===e[m].y.cmp(e[g].y.redNeg())?(v[1]=e[m].toJ().mixedAdd(e[g]),v[2]=e[m].add(e[g].neg())):(v[1]=e[m].toJ().mixedAdd(e[g]),v[2]=e[m].toJ().mixedAdd(e[g].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],b=d(r[m],r[g]);for(c=Math.max(b[0].length,c),h[m]=new Array(c),h[g]=new Array(c),s=0;s=0;o--){for(var _=0;o>=0;){var N=!0;for(s=0;s=0&&_++,M=M.dblp(_),o<0)break;for(s=0;s0?a=l[s][S-1>>1]:S<0&&(a=l[s][-S-1>>1].neg()),M="affine"===a.type?M.mixedAdd(a):M.add(a))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},v.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(s=e,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},w.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),l=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(l).neg()}},w.prototype.pointFromX=function(t,e){(t=new(i())(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(n=n.redNeg()),this.point(t,n)},w.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},w.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},M.prototype.isInfinity=function(){return this.inf},M.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},M.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},M.prototype.getX=function(){return this.x.fromRed()},M.prototype.getY=function(){return this.y.fromRed()},M.prototype.mul=function(t){return t=new(i())(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},M.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},M.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},M.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},M.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},M.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},y(A,g.BasePoint),w.prototype.jpoint=function(t,e,r){return new A(this,t,e,r)},A.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},A.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},A.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),h=l.redMul(a),c=n.redMul(l),f=u.redSqr().redIAdd(h).redISub(c).redISub(c),d=u.redMul(c.redISub(f)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(f,d,p)},A.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),h=r.redMul(u),c=a.redSqr().redIAdd(l).redISub(h).redISub(h),f=a.redMul(h.redISub(c)).redISub(i.redMul(l)),d=this.z.redMul(s);return this.curve.jpoint(c,f,d)},A.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},A.prototype.inspect=function(){return this.isInfinity()?"":""},A.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var _=a((function(t,e){var r=e;r.base=g,r.short=E,r.mont=null,r.edwards=null})),N=a((function(t,e){var r,n=e,i=c.assert;function o(t){"short"===t.type?this.curve=new _.short(t):"edwards"===t.type?this.curve=new _.edwards(t):this.curve=new _.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:s().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:s().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:s().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:s().sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:s().sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s().sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){r=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:s().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function S(t){if(!(this instanceof S))return new S(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=h.toArray(t.entropy,t.entropyEnc||"hex"),r=h.toArray(t.nonce,t.nonceEnc||"hex"),n=h.toArray(t.pers,t.persEnc||"hex");u(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var T=S;S.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},S.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=h.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var O=c.assert;function I(t,e){if(t instanceof I)return t;this._importDER(t,e)||(O(t.r&&t.s,"Signature without r or s"),this.r=new(i())(t.r,16),this.s=new(i())(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var C=I;function P(){this.place=0}function L(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return!(i<=127)&&(e.place=s,i)}function U(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}I.prototype._importDER=function(t,e){t=c.toArray(t,e);var r=new P;if(48!==t[r.place++])return!1;var n=L(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var o=L(t,r);if(!1===o)return!1;var s=t.slice(r.place,o+r.place);if(r.place+=o,2!==t[r.place++])return!1;var a=L(t,r);if(!1===a)return!1;if(t.length!==a+r.place)return!1;var u=t.slice(r.place,a+r.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}return this.r=new(i())(s),this.s=new(i())(u),this.recoveryParam=null,!0},I.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=U(e),r=U(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];B(n,e.length),(n=n.concat(e)).push(2),B(n,r.length);var i=n.concat(r),o=[48];return B(o,i.length),o=o.concat(i),c.encode(o,t)};var D=function(){throw new Error("unsupported")},F=c.assert;function G(t){if(!(this instanceof G))return new G(t);"string"==typeof t&&(F(Object.prototype.hasOwnProperty.call(N,t),"Unknown curve "+t),t=N[t]),t instanceof N.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var j=G;G.prototype.keyPair=function(t){return new x(this,t)},G.prototype.keyFromPrivate=function(t,e){return x.fromPrivate(this,t,e)},G.prototype.keyFromPublic=function(t,e){return x.fromPublic(this,t,e)},G.prototype.genKeyPair=function(t){t||(t={});for(var e=new T({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||D(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new(i())(2));;){var o=new(i())(e.generate(r));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}},G.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},G.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new(i())(t,16));for(var o=this.n.byteLength(),s=e.getPrivate().toArray("be",o),a=t.toArray("be",o),u=new T({hash:this.hash,entropy:s,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),l=this.n.sub(new(i())(1)),h=0;;h++){var c=n.k?n.k(h):new(i())(u.generate(this.n.byteLength()));if(!((c=this._truncateToN(c,!0)).cmpn(1)<=0||c.cmp(l)>=0)){var f=this.g.mul(c);if(!f.isInfinity()){var d=f.getX(),p=d.umod(this.n);if(0!==p.cmpn(0)){var m=c.invm(this.n).mul(p.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var g=(f.getY().isOdd()?1:0)|(0!==d.cmp(p)?2:0);return n.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new C({r:p,s:m,recoveryParam:g})}}}}}},G.prototype.verify=function(t,e,r,n){t=this._truncateToN(new(i())(t,16)),r=this.keyFromPublic(r,n);var o=(e=new C(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,u=s.invm(this.n),l=u.mul(t).umod(this.n),h=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(l,r.getPublic(),h)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(l,r.getPublic(),h)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},G.prototype.recoverPubKey=function(t,e,r,n){F((3&r)===r,"The recovery param is more than two bits"),e=new C(e,n);var o=this.n,s=new(i())(t),a=e.r,u=e.s,l=1&r,h=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");a=h?this.curve.pointFromX(a.add(this.curve.n),l):this.curve.pointFromX(a,l);var c=e.r.invm(o),f=o.sub(s).mul(c).umod(o),d=u.mul(c).umod(o);return this.g.mulAdd(f,a,d)},G.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new C(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var q=a((function(t,e){var r=e;r.version="6.5.4",r.utils=c,r.rand=function(){throw new Error("unsupported")},r.curve=_,r.curves=N,r.ec=j,r.eddsa=null})).ec,z=r(3286),K=r(3587);const H=new(r(711).Yd)("signing-key/5.7.0");let $=null;function V(){return $||($=new q("secp256k1")),$}class W{constructor(t){(0,K.zG)(this,"curve","secp256k1"),(0,K.zG)(this,"privateKey",(0,z.Dv)(t)),32!==(0,z.E1)(this.privateKey)&&H.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=V().keyFromPrivate((0,z.lE)(this.privateKey));(0,K.zG)(this,"publicKey","0x"+e.getPublic(!1,"hex")),(0,K.zG)(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),(0,K.zG)(this,"_isSigningKey",!0)}_addPoint(t){const e=V().keyFromPublic((0,z.lE)(this.publicKey)),r=V().keyFromPublic((0,z.lE)(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=V().keyFromPrivate((0,z.lE)(this.privateKey)),r=(0,z.lE)(t);32!==r.length&&H.throwArgumentError("bad digest length","digest",t);const n=e.sign(r,{canonical:!0});return(0,z.N)({recoveryParam:n.recoveryParam,r:(0,z.$m)("0x"+n.r.toString(16),32),s:(0,z.$m)("0x"+n.s.toString(16),32)})}computeSharedSecret(t){const e=V().keyFromPrivate((0,z.lE)(this.privateKey)),r=V().keyFromPublic((0,z.lE)(J(t)));return(0,z.$m)("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function Y(t,e){const r=(0,z.N)(e),n={r:(0,z.lE)(r.r),s:(0,z.lE)(r.s)};return"0x"+V().recoverPubKey((0,z.lE)(t),n,r.recoveryParam).encode("hex",!1)}function J(t,e){const r=(0,z.lE)(t);if(32===r.length){const t=new W(r);return e?"0x"+V().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?(0,z.Dv)(r):"0x"+V().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+V().keyFromPublic(r).getPublic(!0,"hex"):(0,z.Dv)(r):H.throwArgumentError("invalid public or private key","key","[REDACTED]")}},2500:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(2808).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},4242:(t,e,r)=>{"use strict";r.d(e,{Uj:()=>o,te:()=>u,Uw:()=>s,U$:()=>f,uu:()=>d,Y0:()=>h,XL:()=>m,ZN:()=>p});var n=r(3286);const i=new(r(711).Yd)("strings/5.7.0");var o,s;function a(t,e,r,n,i){if(t===s.BAD_PREFIX||t===s.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n>6==2;n++)t++;return t}return t===s.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(o||(o={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(s||(s={}));const u=Object.freeze({error:function(t,e,r,n,o){return i.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:a,replace:function(t,e,r,n,i){return t===s.OVERLONG?(n.push(i),0):(n.push(65533),a(t,e,r))}});function l(t,e){null==e&&(e=u.error),t=(0,n.lE)(t);const r=[];let i=0;for(;i>7==0){r.push(n);continue}let o=null,a=null;if(192==(224&n))o=1,a=127;else if(224==(240&n))o=2,a=2047;else{if(240!=(248&n)){i+=e(128==(192&n)?s.UNEXPECTED_CONTINUE:s.BAD_PREFIX,i-1,t,r);continue}o=3,a=65535}if(i-1+o>=t.length){i+=e(s.OVERRUN,i-1,t,r);continue}let u=n&(1<<8-o-1)-1;for(let n=0;n1114111?i+=e(s.OUT_OF_RANGE,i-1-o,t,r,u):u>=55296&&u<=57343?i+=e(s.UTF16_SURROGATE,i-1-o,t,r,u):u<=a?i+=e(s.OVERLONG,i-1-o,t,r,u):r.push(u))}return r}function h(t,e=o.current){e!=o.current&&(i.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return(0,n.lE)(r)}function c(t){const e="0000"+t.toString(16);return"\\u"+e.substring(e.length-4)}function f(t,e){return'"'+l(t,e).map((t=>{if(t<256){switch(t){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(t>=32&&t<127)return String.fromCharCode(t)}return t<=65535?c(t):c(55296+((t-=65536)>>10&1023))+c(56320+(1023&t))})).join("")+'"'}function d(t){return t.map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function p(t,e){return d(l(t,e))}function m(t,e=o.current){return l(h(t,e))}},4377:(t,e,r)=>{"use strict";r.d(e,{em:()=>d,z7:()=>M,db:()=>y,Qc:()=>k,RJ:()=>b,qC:()=>S});var n=r(4594),i=r(2593),o=r(3286),s=r(1046),a=r(8197),u=r(3587),l=r(1843),h=r(2768),c=r(711);const f=new c.Yd("transactions/5.7.0");var d;function p(t){return"0x"===t?null:(0,n.Kn)(t)}function m(t){return"0x"===t?s._Y:i.O$.from(t)}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(d||(d={}));const g=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],v={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function y(t){const e=(0,h.VW)(t);return(0,n.Kn)((0,o.p3)((0,a.w)((0,o.p3)(e,1)),12))}function b(t,e){return y((0,h.LO)((0,o.lE)(t),e))}function w(t,e){const r=(0,o.G1)(i.O$.from(t).toHexString());return r.length>32&&f.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function E(t,e){return{address:(0,n.Kn)(t),storageKeys:(e||[]).map(((e,r)=>(32!==(0,o.E1)(e)&&f.throwArgumentError("invalid access list storageKey",`accessList[${t}:${r}]`,e),e.toLowerCase())))}}function M(t){if(Array.isArray(t))return t.map(((t,e)=>Array.isArray(t)?(t.length>2&&f.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),E(t[0],t[1])):E(t.address,t.storageKeys)));const e=Object.keys(t).map((e=>{const r=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return E(e,Object.keys(r).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function A(t){return M(t).map((t=>[t.address,t.storageKeys]))}function _(t,e){if(null!=t.gasPrice){const e=i.O$.from(t.gasPrice),r=i.O$.from(t.maxFeePerGas||0);e.eq(r)||f.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:r})}const r=[w(t.chainId||0,"chainId"),w(t.nonce||0,"nonce"),w(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),w(t.maxFeePerGas||0,"maxFeePerGas"),w(t.gasLimit||0,"gasLimit"),null!=t.to?(0,n.Kn)(t.to):"0x",w(t.value||0,"value"),t.data||"0x",A(t.accessList||[])];if(e){const t=(0,o.N)(e);r.push(w(t.recoveryParam,"recoveryParam")),r.push((0,o.G1)(t.r)),r.push((0,o.G1)(t.s))}return(0,o.xs)(["0x02",l.encode(r)])}function N(t,e){const r=[w(t.chainId||0,"chainId"),w(t.nonce||0,"nonce"),w(t.gasPrice||0,"gasPrice"),w(t.gasLimit||0,"gasLimit"),null!=t.to?(0,n.Kn)(t.to):"0x",w(t.value||0,"value"),t.data||"0x",A(t.accessList||[])];if(e){const t=(0,o.N)(e);r.push(w(t.recoveryParam,"recoveryParam")),r.push((0,o.G1)(t.r)),r.push((0,o.G1)(t.s))}return(0,o.xs)(["0x01",l.encode(r)])}function S(t,e){if(null==t.type||0===t.type)return null!=t.accessList&&f.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",t),function(t,e){(0,u.uj)(t,v);const r=[];g.forEach((function(e){let n=t[e.name]||[];const i={};e.numeric&&(i.hexPad="left"),n=(0,o.lE)((0,o.Dv)(n,i)),e.length&&n.length!==e.length&&n.length>0&&f.throwArgumentError("invalid length for "+e.name,"transaction:"+e.name,n),e.maxLength&&(n=(0,o.G1)(n),n.length>e.maxLength&&f.throwArgumentError("invalid length for "+e.name,"transaction:"+e.name,n)),r.push((0,o.Dv)(n))}));let n=0;if(null!=t.chainId?(n=t.chainId,"number"!=typeof n&&f.throwArgumentError("invalid transaction.chainId","transaction",t)):e&&!(0,o.Zq)(e)&&e.v>28&&(n=Math.floor((e.v-35)/2)),0!==n&&(r.push((0,o.Dv)(n)),r.push("0x"),r.push("0x")),!e)return l.encode(r);const i=(0,o.N)(e);let s=27+i.recoveryParam;return 0!==n?(r.pop(),r.pop(),r.pop(),s+=2*n+8,i.v>28&&i.v!==s&&f.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e)):i.v!==s&&f.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e),r.push((0,o.Dv)(s)),r.push((0,o.G1)((0,o.lE)(i.r))),r.push((0,o.G1)((0,o.lE)(i.s))),l.encode(r)}(t,e);switch(t.type){case 1:return N(t,e);case 2:return _(t,e)}return f.throwError(`unsupported transaction type: ${t.type}`,c.Yd.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:t.type})}function T(t,e,r){try{const r=m(e[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");t.v=r}catch(t){f.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=(0,o.$m)(e[1],32),t.s=(0,o.$m)(e[2],32);try{const e=(0,a.w)(r(t));t.from=b(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){}}function k(t){const e=(0,o.lE)(t);if(e[0]>127)return function(t){const e=l.decode(t);9!==e.length&&6!==e.length&&f.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:m(e[0]).toNumber(),gasPrice:m(e[1]),gasLimit:m(e[2]),to:p(e[3]),value:m(e[4]),data:e[5],chainId:0};if(6===e.length)return r;try{r.v=i.O$.from(e[6]).toNumber()}catch(t){return r}if(r.r=(0,o.$m)(e[7],32),r.s=(0,o.$m)(e[8],32),i.O$.from(r.r).isZero()&&i.O$.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);0!==r.chainId&&(i.push((0,o.Dv)(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const s=(0,a.w)(l.encode(i));try{r.from=b(s,{r:(0,o.Dv)(r.r),s:(0,o.Dv)(r.s),recoveryParam:n})}catch(t){}r.hash=(0,a.w)(t)}return r.type=null,r}(e);switch(e[0]){case 1:return function(t){const e=l.decode(t.slice(1));8!==e.length&&11!==e.length&&f.throwArgumentError("invalid component count for transaction type: 1","payload",(0,o.Dv)(t));const r={type:1,chainId:m(e[0]).toNumber(),nonce:m(e[1]).toNumber(),gasPrice:m(e[2]),gasLimit:m(e[3]),to:p(e[4]),value:m(e[5]),data:e[6],accessList:M(e[7])};return 8===e.length||(r.hash=(0,a.w)(t),T(r,e.slice(8),N)),r}(e);case 2:return function(t){const e=l.decode(t.slice(1));9!==e.length&&12!==e.length&&f.throwArgumentError("invalid component count for transaction type: 2","payload",(0,o.Dv)(t));const r=m(e[2]),n=m(e[3]),i={type:2,chainId:m(e[0]).toNumber(),nonce:m(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:m(e[4]),to:p(e[5]),value:m(e[6]),data:e[7],accessList:M(e[8])};return 9===e.length||(i.hash=(0,a.w)(t),T(i,e.slice(9),_)),i}(e)}return f.throwError(`unsupported transaction type: ${e[0]}`,c.Yd.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}},8341:(t,e,r)=>{"use strict";r.d(e,{MY:()=>p,rd:()=>m,$l:()=>g});var n=r(9567),i=r(3286),o=r(3587),s=r(4242),a=r(711),u=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};function l(t,e){return u(this,void 0,void 0,(function*(){null==e&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(!0!==e.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),null!=e.fetchOptions){const t=e.fetchOptions;t.mode&&(r.mode=t.mode),t.cache&&(r.cache=t.cache),t.credentials&&(r.credentials=t.credentials),t.redirect&&(r.redirect=t.redirect),t.referrer&&(r.referrer=t.referrer)}const n=yield fetch(t,r),o=yield n.arrayBuffer(),s={};return n.headers.forEach?n.headers.forEach(((t,e)=>{s[e.toLowerCase()]=t})):n.headers.keys().forEach((t=>{s[t.toLowerCase()]=n.headers.get(t)})),{headers:s,statusCode:n.status,statusMessage:n.statusText,body:(0,i.lE)(new Uint8Array(o))}}))}var h=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const c=new a.Yd("web/5.7.1");function f(t){return new Promise((e=>{setTimeout(e,t)}))}function d(t,e){if(null==t)return null;if("string"==typeof t)return t;if((0,i.Zq)(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return(0,s.ZN)(t)}catch(t){}return(0,i.Dv)(t)}return t}function p(t,e,r){const i="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;c.assertArgument(i>0&&i%1==0,"invalid connection throttle limit","connection.throttleLimit",i);const u="object"==typeof t?t.throttleCallback:null,p="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;c.assertArgument(p>0&&p%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",p);const m="object"==typeof t&&!!t.errorPassThrough,g={};let v=null;const y={method:"GET"};let b=!1,w=12e4;if("string"==typeof t)v=t;else if("object"==typeof t){if(null!=t&&null!=t.url||c.throwArgumentError("missing URL","connection.url",t),v=t.url,"number"==typeof t.timeout&&t.timeout>0&&(w=t.timeout),t.headers)for(const e in t.headers)g[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(b=!0);if(y.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==v.substring(0,6)&&!0!==t.allowInsecureAuthentication&&c.throwError("basic authentication requires a secure https url",a.Yd.errors.INVALID_ARGUMENT,{argument:"url",url:v,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;g.authorization={key:"Authorization",value:"Basic "+(0,n.c)((0,s.Y0)(e))}}null!=t.skipFetchSetup&&(y.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(y.fetchOptions=(0,o.DC)(t.fetchOptions))}const E=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),M=v?v.match(E):null;if(M)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":M[1]||"text/plain"},body:M[2]?(0,n.J)(M[3]):(A=M[3],(0,s.Y0)(A.replace(/%([0-9a-f][0-9a-f])/gi,((t,e)=>String.fromCharCode(parseInt(e,16))))))};let e=t.body;return r&&(e=r(t.body,t)),Promise.resolve(e)}catch(t){c.throwError("processing response error",a.Yd.errors.SERVER_ERROR,{body:d(M[1],M[2]),error:t,requestBody:null,requestMethod:"GET",url:v})}var A;e&&(y.method="POST",y.body=e,null==g["content-type"]&&(g["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==g["content-length"]&&(g["content-length"]={key:"Content-Length",value:String(e.length)}));const _={};Object.keys(g).forEach((t=>{const e=g[t];_[e.key]=e.value})),y.headers=_;const N=function(){let t=null;return{promise:new Promise((function(e,r){w&&(t=setTimeout((()=>{null!=t&&(t=null,r(c.makeError("timeout",a.Yd.errors.TIMEOUT,{requestBody:d(y.body,_["content-type"]),requestMethod:y.method,timeout:w,url:v})))}),w))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),S=function(){return h(this,void 0,void 0,(function*(){for(let t=0;t=300)&&(N.cancel(),c.throwError("bad response",a.Yd.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:d(n,e.headers?e.headers["content-type"]:null),requestBody:d(y.body,_["content-type"]),requestMethod:y.method,url:v})),r)try{const t=yield r(n,e);return N.cancel(),t}catch(r){if(r.throttleRetry&&t"content-type"===t.toLowerCase())).length||(r.headers=(0,o.DC)(r.headers),r.headers["content-type"]="application/json"):r.headers={"content-type":"application/json"},t=r}return p(t,n,((t,e)=>{let n=null;if(null!=t)try{n=JSON.parse((0,s.ZN)(t))}catch(e){c.throwError("invalid JSON",a.Yd.errors.SERVER_ERROR,{body:t,error:e})}return r&&(n=r(n,e)),n}))}function g(t,e){return e||(e={}),null==(e=(0,o.DC)(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,n){let i=null,o=!1;const s=()=>!o&&(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout((()=>{s()&&n(new Error("timeout"))}),e.timeout));const a=e.retryLimit;let u=0;!function i(){return t().then((function(t){if(void 0!==t)s()&&r(t);else if(e.oncePoll)e.oncePoll.once("poll",i);else if(e.onceBlock)e.onceBlock.once("block",i);else if(!o){if(u++,u>a)return void(s()&&n(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,u)));te.ceiling&&(t=e.ceiling),setTimeout(i,t)}return null}),(function(t){s()&&n(t)}))}()}))}},8659:(t,e,r)=>{"use strict";r.d(e,{D:()=>s});var n=r(2046),i=r(3587);const o=new(r(711).Yd)("wordlists/5.7.0");class s{constructor(t){o.checkAbstract(new.target,s),(0,i.zG)(this,"locale",t)}split(t){return t.toLowerCase().split(/ +/g)}join(t){return t.join(" ")}static check(t){const e=[];for(let r=0;r<2048;r++){const n=t.getWord(r);if(r!==t.getWordIndex(n))return"0x";e.push(n)}return(0,n.id)(e.join("\n")+"\n")}static register(t,e){e||(e=t.locale)}}},9855:(t,e,r)=>{"use strict";r.d(e,{E:()=>u});var n=r(8659);let i=null;function o(t){if(null==i&&(i="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==n.D.check(t)))throw i=null,new Error("BIP39 Wordlist for en (English) FAILED")}class s extends n.D{constructor(){super("en")}getWord(t){return o(this),i[t]}getWordIndex(t){return o(this),i.indexOf(t)}}const a=new s;n.D.register(a);const u={en:a}},8099:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(7117);function i(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}function o(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}function s(t,e){return void 0===e&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function a(t,e){return void 0===e&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}function u(t,e){return void 0===e&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}function l(t,e){return void 0===e&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}function h(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}function c(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}function f(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),h(t/4294967296>>>0,e,r),h(t>>>0,e,r+4),e}function d(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),c(t>>>0,e,r),c(t/4294967296>>>0,e,r+4),e}e.readInt16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16},e.readUint16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])>>>0},e.readInt16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])<<16>>16},e.readUint16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])>>>0},e.writeUint16BE=i,e.writeInt16BE=i,e.writeUint16LE=o,e.writeInt16LE=o,e.readInt32BE=s,e.readUint32BE=a,e.readInt32LE=u,e.readUint32LE=l,e.writeUint32BE=h,e.writeInt32BE=h,e.writeUint32LE=c,e.writeInt32LE=c,e.readInt64BE=function(t,e){void 0===e&&(e=0);var r=s(t,e),n=s(t,e+4);return 4294967296*r+n-4294967296*(n>>31)},e.readUint64BE=function(t,e){return void 0===e&&(e=0),4294967296*a(t,e)+a(t,e+4)},e.readInt64LE=function(t,e){void 0===e&&(e=0);var r=u(t,e);return 4294967296*u(t,e+4)+r-4294967296*(r>>31)},e.readUint64LE=function(t,e){void 0===e&&(e=0);var r=l(t,e);return 4294967296*l(t,e+4)+r},e.writeUint64BE=f,e.writeInt64BE=f,e.writeUint64LE=d,e.writeInt64LE=d,e.readUintBE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=t/8+r-1;o>=r;o--)n+=e[o]*i,i*=256;return n},e.readUintLE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o=i;s--)r[s]=e/o&255,o*=256;return r},e.writeUintLE=function(t,e,r,i){if(void 0===r&&(r=new Uint8Array(t/8)),void 0===i&&(i=0),t%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var o=1,s=i;s{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.mul=Math.imul||function(t,e){var r=65535&t,n=65535&e;return r*n+((t>>>16&65535)*n+r*(e>>>16&65535)<<16>>>0)|0},e.add=function(t,e){return t+e|0},e.sub=function(t,e){return t-e|0},e.rotl=function(t,e){return t<>>32-e},e.rotr=function(t,e){return t<<32-e|t>>>e},e.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(t){return e.isInteger(t)&&t>=-e.MAX_SAFE_INTEGER&&t<=e.MAX_SAFE_INTEGER}},1416:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const n=r(6008),i=r(8099),o=r(7309);function s(t,r=e.defaultRandomSource){return r.randomBytes(t)}e.defaultRandomSource=new n.SystemRandomSource,e.randomBytes=s,e.randomUint32=function(t=e.defaultRandomSource){const r=s(4,t),n=(0,i.readUint32LE)(r);return(0,o.wipe)(r),n};const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function u(t,r=a,n=e.defaultRandomSource){if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let i="";const u=r.length,l=256-256%u;for(;t>0;){const e=s(Math.ceil(256*t/l),n);for(let n=0;n0;n++){const o=e[n];o{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BrowserRandomSource=void 0,e.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const t="undefined"!=typeof self?self.crypto||self.msCrypto:null;t&&void 0!==t.getRandomValues&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const e=new Uint8Array(t);for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NodeRandomSource=void 0;const n=r(7309);e.NodeRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const t=r(5883);t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let e=this._crypto.randomBytes(t);if(e.length!==t)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(t);for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SystemRandomSource=void 0;const n=r(5455),i=r(8871);e.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)}}},7309:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.wipe=function(t){for(var e=0;e255)return!1;return!0}function i(t,e){if(t.buffer&&ArrayBuffer.isView(t)&&"Uint8Array"===t.name)return e&&(t=t.slice?t.slice():Array.prototype.slice.call(t)),t;if(Array.isArray(t)){if(!n(t))throw new Error("Array contains invalid value: "+t);return new Uint8Array(t)}if(r(t.length)&&n(t))return new Uint8Array(t);throw new Error("unsupported array-like object")}function o(t){return new Uint8Array(t)}function s(t,e,r,n,i){null==n&&null==i||(t=t.slice?t.slice(n,i):Array.prototype.slice.call(t,n,i)),e.set(t,r)}var a,u={toBytes:function(t){var e=[],r=0;for(t=encodeURI(t);r191&&n<224?(e.push(String.fromCharCode((31&n)<<6|63&t[r+1])),r+=2):(e.push(String.fromCharCode((15&n)<<12|(63&t[r+1])<<6|63&t[r+2])),r+=3)}return e.join("")}},l=(a="0123456789abcdef",{toBytes:function(t){for(var e=[],r=0;r>4]+a[15&n])}return e.join("")}}),h={16:10,24:12,32:14},c=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],f=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],d=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],p=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],m=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],g=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],v=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],b=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],w=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],E=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],M=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],A=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],_=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],N=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function S(t){for(var e=[],r=0;r>2,this._Ke[r][e%4]=o[e],this._Kd[t-r][e%4]=o[e];for(var s,a=0,u=i;u>16&255]<<24^f[s>>8&255]<<16^f[255&s]<<8^f[s>>24&255]^c[a]<<24,a+=1,8!=i)for(e=1;e>8&255]<<8^f[s>>16&255]<<16^f[s>>24&255]<<24,e=i/2+1;e>2,d=u%4,this._Ke[l][d]=o[e],this._Kd[t-l][d]=o[e++],u++}for(var l=1;l>24&255]^A[s>>16&255]^_[s>>8&255]^N[255&s]},T.prototype.encrypt=function(t){if(16!=t.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var e=this._Ke.length-1,r=[0,0,0,0],n=S(t),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var s=1;s>24&255]^m[n[(i+1)%4]>>16&255]^g[n[(i+2)%4]>>8&255]^v[255&n[(i+3)%4]]^this._Ke[s][i];n=r.slice()}var a,u=o(16);for(i=0;i<4;i++)a=this._Ke[e][i],u[4*i]=255&(f[n[i]>>24&255]^a>>24),u[4*i+1]=255&(f[n[(i+1)%4]>>16&255]^a>>16),u[4*i+2]=255&(f[n[(i+2)%4]>>8&255]^a>>8),u[4*i+3]=255&(f[255&n[(i+3)%4]]^a);return u},T.prototype.decrypt=function(t){if(16!=t.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var e=this._Kd.length-1,r=[0,0,0,0],n=S(t),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var s=1;s>24&255]^b[n[(i+3)%4]>>16&255]^w[n[(i+2)%4]>>8&255]^E[255&n[(i+1)%4]]^this._Kd[s][i];n=r.slice()}var a,u=o(16);for(i=0;i<4;i++)a=this._Kd[e][i],u[4*i]=255&(d[n[i]>>24&255]^a>>24),u[4*i+1]=255&(d[n[(i+3)%4]>>16&255]^a>>16),u[4*i+2]=255&(d[n[(i+2)%4]>>8&255]^a>>8),u[4*i+3]=255&(d[255&n[(i+1)%4]]^a);return u};var k=function(t){if(!(this instanceof k))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new T(t)};k.prototype.encrypt=function(t){if((t=i(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=o(t.length),r=o(16),n=0;n=0;--e)this._counter[e]=t%256,t>>=8},I.prototype.setBytes=function(t){if(16!=(t=i(t,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=t},I.prototype.increment=function(){for(var t=15;t>=0;t--){if(255!==this._counter[t]){this._counter[t]++;break}this._counter[t]=0}};var C=function(t,e){if(!(this instanceof C))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",e instanceof I||(e=new I(e)),this._counter=e,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new T(t)};C.prototype.encrypt=function(t){for(var e=i(t,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=t.length-e,n=0;n{t.exports=function(t){const e="api.js: ",n=this,i=r(8737),o=r(979),s=r(1789),a=new(r(3737)),{attributes:u,showAttributes:l,showAttributeErrors:h,showRuleDependencies:c}=r(8862),f=r(2595),d=function(t,e,r){const n=``,o="",s=``,a="";let u,l="";for(;Array.isArray(t)&&0!==t.length;){if("number"!=typeof e)throw new Error("abnfToHtml: beg must be type number");if(e>=t.length)break;u="number"!=typeof r||e+r>=t.length?t.length:e+r;let h=0;for(let r=e;r=32&&e<=126)switch(1===h?(l+=o,h=0):2===h&&(l+=a,h=0),e){case 32:l+=" ";break;case 60:l+="<";break;case 62:l+=">";break;case 38:l+="&";break;case 34:l+=""";break;case 39:l+="'";break;case 92:l+="\";break;default:l+=String.fromCharCode(e)}else 9===e||10===e||13===e?(0===h?(l+=n,h=1):2===h&&(l+=a+n,h=1),9===e&&(l+="TAB"),10===e&&(l+="LF"),13===e&&(l+="CR")):(0===h?(l+=s,h=2):1===h&&(l+=o+s,h=2),l+=`\\x${i.utils.charToHex(e)}`)}2===h&&(l+=a),1===h&&(l+=o);break}return l},p=function(t,e,r){let n="";for(let i=e;i=32&&e<=126)n+=String.fromCharCode(e);else switch(e){case 9:n+="\\t";break;case 10:n+="\\n";break;case 13:n+="\\r";break;default:n+="\\unknown"}}return n};let m,g=!1,v=!1,y=!1,b=!1,w=0;if(this.errors=[],Buffer.isBuffer(t))this.chars=o.decode("BINARY",t);else if(Array.isArray(t))this.chars=t.slice();else{if("string"!=typeof t)throw new Error(`${e}input source is not a string, byte Buffer or character array`);this.chars=o.decode("STRING",t)}this.sabnf=o.encode("STRING",this.chars),this.scan=function(t,e){this.lines=s(this.chars,this.errors,t,e),g=!0},this.parse=function(t,r){if(!g)throw new Error(`${e}grammar not scanned`);a.syntax(this.chars,this.lines,this.errors,t,r),v=!0},this.translate=function(){if(!v)throw new Error(`${e}grammar not scanned and parsed`);const t=a.semantic(this.chars,this.lines,this.errors);0===this.errors.length&&(this.rules=t.rules,this.udts=t.udts,m=t.lineMap,y=!0)},this.attributes=function(){if(!y)throw new Error(`${e}grammar not scanned, parsed and translated`);return w=u(this.rules,this.udts,m,this.errors),b=!0,w},this.generate=function(t){if(this.lines=s(this.chars,this.errors,t),this.errors.length)return;if(a.syntax(this.chars,this.lines,this.errors,t),this.errors.length)return;const e=a.semantic(this.chars,this.lines,this.errors);this.errors.length||(this.rules=e.rules,this.udts=e.udts,m=e.lineMap,w=u(this.rules,this.udts,m,this.errors),b=!0)},this.displayRules=function(t="index"){if(!y)throw new Error(`${e}grammar not scanned, parsed and translated`);return f(this.rules,this.udts,t)},this.displayRuleDependencies=function(t="index"){if(!b)throw new Error(`${e}no attributes - must be preceeded by call to attributes()`);return c(t)},this.displayAttributes=function(t="index"){if(!b)throw new Error(`${e}no attributes - must be preceeded by call to attributes()`);return w&&h(t),l(t)},this.displayAttributeErrors=function(){if(!b)throw new Error(`${e}no attributes - must be preceeded by call to attributes()`);return h()},this.toSource=function(t){if(!b)throw new Error(`${e}can't generate parser source - must be preceeded by call to attributes()`);if(w)throw new Error(`${e}can't generate parser source - attributes have ${w} errors`);return a.generateSource(this.chars,this.lines,this.rules,this.udts,t)},this.toObject=function(){if(!b)throw new Error(`${e}can't generate parser source - must be preceeded by call to attributes()`);if(w)throw new Error(`${e}can't generate parser source - attributes have ${w} errors`);return a.generateObject(this.sabnf,this.rules,this.udts)},this.errorsToAscii=function(){return function(t,e,r){let n,i,o,s;return n="",t.forEach((t=>{i=e[t.line],n+=`${i.lineNo}: `,n+=`${i.beginChar}: `,n+=t.char-i.beginChar+": ",o=i.beginChar,s=t.char-i.beginChar,n+=p(r,o,s),n+=" >> ",o=t.char,s=i.beginChar+i.length-t.char,n+=p(r,o,s),n+="\n",n+=`${i.lineNo}: `,n+=`${i.beginChar}: `,n+=t.char-i.beginChar+": ",n+="error: ",n+=t.msg,n+="\n"})),n}(this.errors,this.lines,this.chars)},this.errorsToHtml=function(t){return function(t,e,r,n){const[o]=i;let s="";const a=`»`;return s+=`

\n`,n&&"string"==typeof n&&(s+=`\n`),s+="\n",t.forEach((t=>{let n,o,u,l,h,c="",f="";0===e.length?(h=a,o=0):(n=e[t.line],u=n.beginChar,t.char>u&&(c=d(r,u,t.char-u)),u=t.char,l=n.beginChar+n.length,u",s+=``,s+="\n",s+="",s+=``,s+="\n")})),s+="
${n}
line
no.
line
offset
error
offset

text
${t.line}${n.beginChar}${o}${h}
↑: ${i.utils.stringToAsciiHtml(t.msg)}

\n",s}(this.errors,this.lines,this.chars,t)},this.linesToAscii=function(){return function(t){let e="Annotated Input Grammar";return t.forEach((t=>{e+="\n",e+=`line no: ${t.lineNo}`,e+=` : char index: ${t.beginChar}`,e+=` : length: ${t.length}`,e+=` : abnf: ${p(n.chars,t.beginChar,t.length)}`})),e+="\n",e}(this.lines)},this.linesToHtml=function(){return function(t){let e="";return e+=`\n`,e+="\n",e+="",e+="",e+="\n",t.forEach((t=>{e+="",e+=`",e+="\n"})),e+="
Annotated Input Grammar
line
no.
first
char

length

text
${t.lineNo}`,e+=`${t.beginChar}`,e+=`${t.length}`,e+=`${d(n.chars,t.beginChar,t.length)}`,e+="
\n",e}(this.lines)}}},8862:(t,e,r)=>{t.exports=function(){const t=r(8276),{ruleAttributes:e,showAttributes:n,showAttributeErrors:i}=r(4246),{ruleDependencies:o,showRuleDependencies:s}=r(7008);class a{constructor(t,e){this.rules=t,this.udts=e,this.ruleCount=t.length,this.udtCount=e.length,this.startRule=0,this.dependenciesComplete=!1,this.attributesComplete=!1,this.isMutuallyRecursive=!1,this.ruleIndexes=this.indexArray(this.ruleCount),this.ruleAlphaIndexes=this.indexArray(this.ruleCount),this.ruleTypeIndexes=this.indexArray(this.ruleCount),this.udtIndexes=this.indexArray(this.udtCount),this.udtAlphaIndexes=this.indexArray(this.udtCount),this.attrsErrorCount=0,this.attrs=[],this.attrsErrors=[],this.attrsWorking=[],this.ruleDeps=[];for(let e=0;e0)for(let r=0;r0)for(let r=0;rthis.rules[e].lower?1:0}compUdtsAlpha(t,e){return this.udts[t].lowerthis.udts[e].lower?1:0}compRulesType(t,e){return this.ruleDeps[t].recursiveTypethis.ruleDeps[e].recursiveType?1:0}compRulesGroup(e,r){if(this.ruleDeps[e].recursiveType===t.ATTR_MR&&this.ruleDeps[r].recursiveType===t.ATTR_MR){if(this.ruleDeps[e].groupNumberthis.ruleDeps[r].groupNumber)return 1}return 0}}return{attributes:function(t=[],r=[],n=[],i=[]){const s=new a(t,r);return o(s),e(s),s.attrsErrorCount&&i.push({line:0,char:0,msg:`${s.attrsErrorCount} attribute errors`}),s.attrsErrorCount},showAttributes:n,showAttributeErrors:i,showRuleDependencies:s}}()},3737:(t,e,r)=>{t.exports=function(){const t=r(8737),e=t.ids,n=new(r(4216)),i=new(r(1832)),o=new(r(3610)),s=new t.parser;s.ast=new t.ast,s.callbacks=n.callbacks,s.ast.callbacks=i.callbacks;const a=function(t,e,r){if(e<0||e>=r)return-1;for(let r=0;r=t[r].beginChar&&e{const r=[],n=[];let i=0;t.opcodes.forEach((t=>{t.type===e.ALT&&1===t.children.length||t.type===e.CAT&&1===t.children.length||t.type===e.REP&&1===t.min&&1===t.max?n.push(null):(n.push(i),r.push(t),i+=1)})),n.push(i),r.forEach((t=>{if(t.type===e.ALT||t.type===e.CAT)for(let e=0;e{d.push(t.lower),h+=t.opcodes.length,t.opcodes.forEach((t=>{switch(t.type){case e.ALT:m+=1;break;case e.CAT:g+=1;break;case e.RNM:v+=1;break;case e.UDT:y+=1;break;case e.REP:b+=1;break;case e.AND:w+=1;break;case e.NOT:E+=1;break;case e.BKA:S+=1;break;case e.BKN:T+=1;break;case e.BKR:N+=1;break;case e.ABG:k+=1;break;case e.AEN:R+=1;break;case e.TLS:for(M+=1,s=0;sf&&(f=t.string[s]);break;case e.TBS:for(A+=1,s=0;sf&&(f=t.string[s]);break;case e.TRG:_+=1,t.minf&&(f=t.max);break;default:throw new Error("generateSource: unrecognized opcode")}}))})),d.sort(),i.length>0&&(i.forEach((t=>{p.push(t.lower)})),p.sort());let x,O="module.exports";return o&&"string"==typeof o&&(O=`let ${o}`),l+="// copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved
\n",l+="// license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)
\n",l+="//\n",l+="// Generated by apg-js, Version 4.0.0 [apg-js](https://github.com/ldthomas/apg-js)\n",l+=`${O} = function grammar(){\n`,l+=" // ```\n",l+=" // SUMMARY\n",l+=` // rules = ${n.length}\n`,l+=` // udts = ${i.length}\n`,l+=` // opcodes = ${h}\n`,l+=" // --- ABNF original opcodes\n",l+=` // ALT = ${m}\n`,l+=` // CAT = ${g}\n`,l+=` // REP = ${b}\n`,l+=` // RNM = ${v}\n`,l+=` // TLS = ${M}\n`,l+=` // TBS = ${A}\n`,l+=` // TRG = ${_}\n`,l+=" // --- SABNF superset opcodes\n",l+=` // UDT = ${y}\n`,l+=` // AND = ${w}\n`,l+=` // NOT = ${E}\n`,l+=` // BKA = ${S}\n`,l+=` // BKN = ${T}\n`,l+=` // BKR = ${N}\n`,l+=` // ABG = ${k}\n`,l+=` // AEN = ${R}\n`,l+=" // characters = [",l+=M+A+_===0?" none defined ]":`${c} - ${f}]`,y>0&&(l+=" + user defined"),l+="\n",l+=" // ```\n",l+=" /* OBJECT IDENTIFIER (for internal parser use) */\n",l+=" this.grammarObject = 'grammarObject';\n",l+="\n",l+=" /* RULES */\n",l+=" this.rules = [];\n",n.forEach(((t,e)=>{let r=" this.rules[";r+=e,r+="] = {name: '",r+=t.name,r+="', lower: '",r+=t.lower,r+="', index: ",r+=t.index,r+=", isBkr: ",r+=t.isBkr,r+="};\n",l+=r})),l+="\n",l+=" /* UDTS */\n",l+=" this.udts = [];\n",i.length>0&&i.forEach(((t,e)=>{let r=" this.udts[";r+=e,r+="] = {name: '",r+=t.name,r+="', lower: '",r+=t.lower,r+="', index: ",r+=t.index,r+=", empty: ",r+=t.empty,r+=", isBkr: ",r+=t.isBkr,r+="};\n",l+=r})),l+="\n",l+=" /* OPCODES */\n",n.forEach(((t,r)=>{r>0&&(l+="\n"),l+=` /* ${t.name} */\n`,l+=` this.rules[${r}].opcodes = [];\n`,t.opcodes.forEach(((t,o)=>{let s;switch(t.type){case e.ALT:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, children: [${t.children.toString()}]};// ALT\n`;break;case e.CAT:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, children: [${t.children.toString()}]};// CAT\n`;break;case e.RNM:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, index: ${t.index}};// RNM(${n[t.index].name})\n`;break;case e.BKR:t.index>=n.length?(a=i[t.index-n.length].name,u=i[t.index-n.length].lower):(a=n[t.index].name,u=n[t.index].lower),s="%i",t.bkrCase===e.BKR_MODE_CS&&(s="%s"),t.bkrMode===e.BKR_MODE_UM?s+="%u":s+="%p",a=s+a,l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, index: ${t.index}, lower: '${u}', bkrCase: ${t.bkrCase}, bkrMode: ${t.bkrMode}};// BKR(\\${a})\n`;break;case e.UDT:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, empty: ${t.empty}, index: ${t.index}};// UDT(${i[t.index].name})\n`;break;case e.REP:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, min: ${t.min}, max: ${t.max}};// REP\n`;break;case e.AND:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}};// AND\n`;break;case e.NOT:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}};// NOT\n`;break;case e.ABG:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}};// ABG(%^)\n`;break;case e.AEN:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}};// AEN(%$)\n`;break;case e.BKA:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}};// BKA\n`;break;case e.BKN:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}};// BKN\n`;break;case e.TLS:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, string: [${t.string.toString()}]};// TLS\n`;break;case e.TBS:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, string: [${t.string.toString()}]};// TBS\n`;break;case e.TRG:l+=` this.rules[${r}].opcodes[${o}] = {type: ${t.type}, min: ${t.min}, max: ${t.max}};// TRG\n`;break;default:throw new Error("parser.js: ~143: unrecognized opcode")}}))})),l+="\n",l+=" // The `toString()` function will display the original grammar file(s) that produced these opcodes.\n",l+=" this.toString = function toString(){\n",l+=' let str = "";\n',r.forEach((e=>{const r=e.beginChar+e.length;x="",l+=' str += "';for(let n=e.beginChar;n{i.push(t.lower)})),i.sort(),r.length>0&&(r.forEach((t=>{o.push(t.lower)})),o.sort()),n.callbacks=[],i.forEach((t=>{n.callbacks[t]=!1})),r.length>0&&o.forEach((t=>{n.callbacks[t]=!1})),n.rules=e,n.udts=r,n.toString=function(){return s},n}}},4246:(t,e,r)=>{t.exports=function(){const t=r(8276);let e=null;function n(t){return!(t.left||t.nested||t.right||t.cyclic)&&t.empty}function i(t){return!!(t.left||t.nested||t.right||t.cyclic)}function o(e,r,a,u){e.attrInit(u);const l=r[a];switch(l.type){case t.ALT:!function(t,e,r,n){let i=0;const s=e[r],a=s.children.length,u=[];for(i=0;i=0;r-=1){if(t[r].right)return!0;if(!t[r].empty)return!1}return!1}(h,l),s.nested=function(t,e){let r=0,o=0,s=0;for(r=0;r=0;r-=1)if(t[r].left&&!t[r].leaf)for(o=r-1;o>=0;o-=1)if(!n(t[o]))return!0;for(r=0;r=t.ruleCount?(n.empty=t.udts[i.index-t.ruleCount].empty,n.finite=!0):(s(t,i.index,n),n.left=!1,n.nested=!1,n.right=!1,n.cyclic=!1)}(e,r,a,u);break;case t.AND:case t.NOT:case t.BKA:case t.BKN:o(e,r,a+1,u),u.empty=!0;break;case t.TLS:u.empty=!r[a].string.length,u.finite=!0,u.cyclic=!1;break;case t.TBS:case t.TRG:u.empty=!1,u.finite=!0,u.cyclic=!1;break;case t.UDT:u.empty=l.empty,u.finite=!0,u.cyclic=!1;break;case t.ABG:case t.AEN:u.empty=!0,u.finite=!0,u.cyclic=!1;break;default:throw new Error(`unknown opcode type: ${l}`)}}function s(t,e,r){const n=t.attrsWorking[e];n.isComplete?t.attrCopy(r,n):n.isOpen?e===t.startRule?e===t.startRule&&(r.left=!0,r.right=!0,r.cyclic=!0,r.leaf=!0):r.finite=!0:(n.isOpen=!0,o(t,n.rule.opcodes,0,r),n.left=r.left,n.right=r.right,n.nested=r.nested,n.empty=r.empty,n.finite=r.finite,n.cyclic=r.cyclic,n.leaf=!1,n.isOpen=!1,n.isComplete=!0)}const a=t=>t?"t":"f",u=t=>t?"e":"f",l=(r,n,i,o)=>{let s=`${r}:${n}:`;return s+=`${u(i.left)} `,s+=`${a(i.nested)} `,s+=`${a(i.right)} `,s+=`${u(i.cyclic)} `,s+=(i.finite?"t":"e")+" ",s+=`${a(i.empty)}:`,s+=`${e.typeToString(o.recursiveType)}:`,s+=o.recursiveType===t.ATTR_MR?o.groupNumber:"-",s+=`:${i.rule.name}\n`,s},h=()=>{let t="LEGEND - t=true, f=false, e=error\n";return t+="sequence:rule index:left nested right cyclic finite empty:type:group number:rule name\n","LEGEND - t=true, f=false, e=error\nsequence:rule index:left nested right cyclic finite empty:type:group number:rule name\n"},c=t=>{let r=0,n=0,i=null,o=null,s="",{ruleIndexes:a}=e;for(97===t?a=e.ruleAlphaIndexes:116===t&&(a=e.ruleTypeIndexes),r=0;r{e=t;let r=0,n=0;const i=e.attrGen();for(r=0;r{if(!e.attributesComplete)throw new Error("rule-attributes.js:showAttributes: attributes not available");let r="";const n="RULE ATTRIBUTES\n";return 97===t.charCodeAt(0)?(r+="alphabetical by rule name\n",r+=n,r+=h(),r+=c(97)):116===t.charCodeAt(0)?(r+="ordered by rule type\n",r+=n,r+=h(),r+=c(116)):(r+="ordered by rule index\n",r+=n,r+=h(),r+=c()),r},showAttributeErrors:()=>{let t=null,r=null,n="";if(n+="RULE ATTRIBUTES WITH ERRORS\n",n+=h(),e.attrsErrorCount)for(let i=0;i{t.exports=(()=>{const t=r(8276);let e=null;const n=(e,r,i,o)=>{let s=0,a=0;const u=r[i];o[i]=!0;const l=u.rule.opcodes;for(s=0;s{let r=0,n=0,i=0,o=0;const s=e.ruleCount-1,a=e.udtCount-1;let u="",l="";const h="=> ";let c=!1,f=null,{ruleIndexes:d}=e,{udtIndexes:p}=e;for(97===t?(d=e.ruleAlphaIndexes,p=e.udtAlphaIndexes):116===t&&(d=e.ruleTypeIndexes,p=e.udtAlphaIndexes),r=0;r-1?f.groupNumber:"-",l+=":"),l+=" ",u+=`${l+e.rules[d[r]].name}\n`,c=!0,i=0,o=u.length,u+=l,n=0;n100&&n!==s&&(u+=`\n${l}${h}`,o=u.length);if(e.udtCount)for(n=0;n100&&n!==a&&(u+=`\n${l}${h}`,o=u.length);for(0===i&&(u+="=> \n"),!1===c&&(u+="\n"),c=!0,i=0,o=u.length,u+=l,n=0;n100&&n!==s&&(u+=`\n${l}${h}`,o=u.length);0===i&&(u+="<= \n"),!1===c&&(u+="\n"),u+="\n"}return u};return{ruleDependencies:r=>{e=r;let i=0,o=0,s=0,a=null,u=null,l=!1;e.dependenciesComplete=!1;const h=e.falseArray(e.ruleCount);for(i=0;i-1,e.ruleAlphaIndexes.sort(e.compRulesAlpha),e.ruleTypeIndexes.sort(e.compRulesAlpha),e.ruleTypeIndexes.sort(e.compRulesType),e.isMutuallyRecursive&&e.ruleTypeIndexes.sort(e.compRulesGroup),e.udtCount&&e.udtAlphaIndexes.sort(e.compUdtsAlpha),e.dependenciesComplete=!0},showRuleDependencies:(t="index")=>{let r="RULE DEPENDENCIES(index:type:[group number:])\n";return r+="=> refers to rule names\n",r+="<= referenced by rule names\n",e.dependenciesComplete?(97===t.charCodeAt(0)?(r+="alphabetical by rule name\n",r+=i(97)):116===t.charCodeAt(0)?(r+="ordered by rule type\n",r+=i(116)):(r+="ordered by rule index\n",r+=i(null)),r):r}}})()},3610:t=>{t.exports=function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"File",lower:"file",index:0,isBkr:!1},this.rules[1]={name:"BlankLine",lower:"blankline",index:1,isBkr:!1},this.rules[2]={name:"Rule",lower:"rule",index:2,isBkr:!1},this.rules[3]={name:"RuleLookup",lower:"rulelookup",index:3,isBkr:!1},this.rules[4]={name:"RuleNameTest",lower:"rulenametest",index:4,isBkr:!1},this.rules[5]={name:"RuleName",lower:"rulename",index:5,isBkr:!1},this.rules[6]={name:"RuleNameError",lower:"rulenameerror",index:6,isBkr:!1},this.rules[7]={name:"DefinedAsTest",lower:"definedastest",index:7,isBkr:!1},this.rules[8]={name:"DefinedAsError",lower:"definedaserror",index:8,isBkr:!1},this.rules[9]={name:"DefinedAs",lower:"definedas",index:9,isBkr:!1},this.rules[10]={name:"Defined",lower:"defined",index:10,isBkr:!1},this.rules[11]={name:"IncAlt",lower:"incalt",index:11,isBkr:!1},this.rules[12]={name:"RuleError",lower:"ruleerror",index:12,isBkr:!1},this.rules[13]={name:"LineEndError",lower:"lineenderror",index:13,isBkr:!1},this.rules[14]={name:"Alternation",lower:"alternation",index:14,isBkr:!1},this.rules[15]={name:"Concatenation",lower:"concatenation",index:15,isBkr:!1},this.rules[16]={name:"Repetition",lower:"repetition",index:16,isBkr:!1},this.rules[17]={name:"Modifier",lower:"modifier",index:17,isBkr:!1},this.rules[18]={name:"Predicate",lower:"predicate",index:18,isBkr:!1},this.rules[19]={name:"BasicElement",lower:"basicelement",index:19,isBkr:!1},this.rules[20]={name:"BasicElementErr",lower:"basicelementerr",index:20,isBkr:!1},this.rules[21]={name:"Group",lower:"group",index:21,isBkr:!1},this.rules[22]={name:"GroupError",lower:"grouperror",index:22,isBkr:!1},this.rules[23]={name:"GroupOpen",lower:"groupopen",index:23,isBkr:!1},this.rules[24]={name:"GroupClose",lower:"groupclose",index:24,isBkr:!1},this.rules[25]={name:"Option",lower:"option",index:25,isBkr:!1},this.rules[26]={name:"OptionError",lower:"optionerror",index:26,isBkr:!1},this.rules[27]={name:"OptionOpen",lower:"optionopen",index:27,isBkr:!1},this.rules[28]={name:"OptionClose",lower:"optionclose",index:28,isBkr:!1},this.rules[29]={name:"RnmOp",lower:"rnmop",index:29,isBkr:!1},this.rules[30]={name:"BkrOp",lower:"bkrop",index:30,isBkr:!1},this.rules[31]={name:"bkrModifier",lower:"bkrmodifier",index:31,isBkr:!1},this.rules[32]={name:"cs",lower:"cs",index:32,isBkr:!1},this.rules[33]={name:"ci",lower:"ci",index:33,isBkr:!1},this.rules[34]={name:"um",lower:"um",index:34,isBkr:!1},this.rules[35]={name:"pm",lower:"pm",index:35,isBkr:!1},this.rules[36]={name:"bkr-name",lower:"bkr-name",index:36,isBkr:!1},this.rules[37]={name:"rname",lower:"rname",index:37,isBkr:!1},this.rules[38]={name:"uname",lower:"uname",index:38,isBkr:!1},this.rules[39]={name:"ename",lower:"ename",index:39,isBkr:!1},this.rules[40]={name:"UdtOp",lower:"udtop",index:40,isBkr:!1},this.rules[41]={name:"udt-non-empty",lower:"udt-non-empty",index:41,isBkr:!1},this.rules[42]={name:"udt-empty",lower:"udt-empty",index:42,isBkr:!1},this.rules[43]={name:"RepOp",lower:"repop",index:43,isBkr:!1},this.rules[44]={name:"AltOp",lower:"altop",index:44,isBkr:!1},this.rules[45]={name:"CatOp",lower:"catop",index:45,isBkr:!1},this.rules[46]={name:"StarOp",lower:"starop",index:46,isBkr:!1},this.rules[47]={name:"AndOp",lower:"andop",index:47,isBkr:!1},this.rules[48]={name:"NotOp",lower:"notop",index:48,isBkr:!1},this.rules[49]={name:"BkaOp",lower:"bkaop",index:49,isBkr:!1},this.rules[50]={name:"BknOp",lower:"bknop",index:50,isBkr:!1},this.rules[51]={name:"AbgOp",lower:"abgop",index:51,isBkr:!1},this.rules[52]={name:"AenOp",lower:"aenop",index:52,isBkr:!1},this.rules[53]={name:"TrgOp",lower:"trgop",index:53,isBkr:!1},this.rules[54]={name:"TbsOp",lower:"tbsop",index:54,isBkr:!1},this.rules[55]={name:"TlsOp",lower:"tlsop",index:55,isBkr:!1},this.rules[56]={name:"TlsCase",lower:"tlscase",index:56,isBkr:!1},this.rules[57]={name:"TlsOpen",lower:"tlsopen",index:57,isBkr:!1},this.rules[58]={name:"TlsClose",lower:"tlsclose",index:58,isBkr:!1},this.rules[59]={name:"TlsString",lower:"tlsstring",index:59,isBkr:!1},this.rules[60]={name:"StringTab",lower:"stringtab",index:60,isBkr:!1},this.rules[61]={name:"ClsOp",lower:"clsop",index:61,isBkr:!1},this.rules[62]={name:"ClsOpen",lower:"clsopen",index:62,isBkr:!1},this.rules[63]={name:"ClsClose",lower:"clsclose",index:63,isBkr:!1},this.rules[64]={name:"ClsString",lower:"clsstring",index:64,isBkr:!1},this.rules[65]={name:"ProsVal",lower:"prosval",index:65,isBkr:!1},this.rules[66]={name:"ProsValOpen",lower:"prosvalopen",index:66,isBkr:!1},this.rules[67]={name:"ProsValString",lower:"prosvalstring",index:67,isBkr:!1},this.rules[68]={name:"ProsValClose",lower:"prosvalclose",index:68,isBkr:!1},this.rules[69]={name:"rep-min",lower:"rep-min",index:69,isBkr:!1},this.rules[70]={name:"rep-min-max",lower:"rep-min-max",index:70,isBkr:!1},this.rules[71]={name:"rep-max",lower:"rep-max",index:71,isBkr:!1},this.rules[72]={name:"rep-num",lower:"rep-num",index:72,isBkr:!1},this.rules[73]={name:"dString",lower:"dstring",index:73,isBkr:!1},this.rules[74]={name:"xString",lower:"xstring",index:74,isBkr:!1},this.rules[75]={name:"bString",lower:"bstring",index:75,isBkr:!1},this.rules[76]={name:"Dec",lower:"dec",index:76,isBkr:!1},this.rules[77]={name:"Hex",lower:"hex",index:77,isBkr:!1},this.rules[78]={name:"Bin",lower:"bin",index:78,isBkr:!1},this.rules[79]={name:"dmin",lower:"dmin",index:79,isBkr:!1},this.rules[80]={name:"dmax",lower:"dmax",index:80,isBkr:!1},this.rules[81]={name:"bmin",lower:"bmin",index:81,isBkr:!1},this.rules[82]={name:"bmax",lower:"bmax",index:82,isBkr:!1},this.rules[83]={name:"xmin",lower:"xmin",index:83,isBkr:!1},this.rules[84]={name:"xmax",lower:"xmax",index:84,isBkr:!1},this.rules[85]={name:"dnum",lower:"dnum",index:85,isBkr:!1},this.rules[86]={name:"bnum",lower:"bnum",index:86,isBkr:!1},this.rules[87]={name:"xnum",lower:"xnum",index:87,isBkr:!1},this.rules[88]={name:"alphanum",lower:"alphanum",index:88,isBkr:!1},this.rules[89]={name:"owsp",lower:"owsp",index:89,isBkr:!1},this.rules[90]={name:"wsp",lower:"wsp",index:90,isBkr:!1},this.rules[91]={name:"space",lower:"space",index:91,isBkr:!1},this.rules[92]={name:"comment",lower:"comment",index:92,isBkr:!1},this.rules[93]={name:"LineEnd",lower:"lineend",index:93,isBkr:!1},this.rules[94]={name:"LineContinue",lower:"linecontinue",index:94,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:3,min:0,max:1/0},this.rules[0].opcodes[1]={type:1,children:[2,3,4]},this.rules[0].opcodes[2]={type:4,index:1},this.rules[0].opcodes[3]={type:4,index:2},this.rules[0].opcodes[4]={type:4,index:12},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,5,7]},this.rules[1].opcodes[1]={type:3,min:0,max:1/0},this.rules[1].opcodes[2]={type:1,children:[3,4]},this.rules[1].opcodes[3]={type:6,string:[32]},this.rules[1].opcodes[4]={type:6,string:[9]},this.rules[1].opcodes[5]={type:3,min:0,max:1},this.rules[1].opcodes[6]={type:4,index:92},this.rules[1].opcodes[7]={type:4,index:93},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[2].opcodes[1]={type:4,index:3},this.rules[2].opcodes[2]={type:4,index:89},this.rules[2].opcodes[3]={type:4,index:14},this.rules[2].opcodes[4]={type:1,children:[5,8]},this.rules[2].opcodes[5]={type:2,children:[6,7]},this.rules[2].opcodes[6]={type:4,index:89},this.rules[2].opcodes[7]={type:4,index:93},this.rules[2].opcodes[8]={type:2,children:[9,10]},this.rules[2].opcodes[9]={type:4,index:13},this.rules[2].opcodes[10]={type:4,index:93},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:2,children:[1,2,3]},this.rules[3].opcodes[1]={type:4,index:4},this.rules[3].opcodes[2]={type:4,index:89},this.rules[3].opcodes[3]={type:4,index:7},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:4,index:5},this.rules[4].opcodes[2]={type:4,index:6},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:4,index:88},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:3,min:1,max:1/0},this.rules[6].opcodes[1]={type:1,children:[2,3]},this.rules[6].opcodes[2]={type:5,min:33,max:60},this.rules[6].opcodes[3]={type:5,min:62,max:126},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:1,children:[1,2]},this.rules[7].opcodes[1]={type:4,index:9},this.rules[7].opcodes[2]={type:4,index:8},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:3,min:1,max:2},this.rules[8].opcodes[1]={type:5,min:33,max:126},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:1,children:[1,2]},this.rules[9].opcodes[1]={type:4,index:11},this.rules[9].opcodes[2]={type:4,index:10},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:6,string:[61]},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:6,string:[61,47]},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:2,children:[1,6]},this.rules[12].opcodes[1]={type:3,min:1,max:1/0},this.rules[12].opcodes[2]={type:1,children:[3,4,5]},this.rules[12].opcodes[3]={type:5,min:32,max:126},this.rules[12].opcodes[4]={type:6,string:[9]},this.rules[12].opcodes[5]={type:4,index:94},this.rules[12].opcodes[6]={type:4,index:93},this.rules[13].opcodes=[],this.rules[13].opcodes[0]={type:3,min:1,max:1/0},this.rules[13].opcodes[1]={type:1,children:[2,3,4]},this.rules[13].opcodes[2]={type:5,min:32,max:126},this.rules[13].opcodes[3]={type:6,string:[9]},this.rules[13].opcodes[4]={type:4,index:94},this.rules[14].opcodes=[],this.rules[14].opcodes[0]={type:2,children:[1,2]},this.rules[14].opcodes[1]={type:4,index:15},this.rules[14].opcodes[2]={type:3,min:0,max:1/0},this.rules[14].opcodes[3]={type:2,children:[4,5,6]},this.rules[14].opcodes[4]={type:4,index:89},this.rules[14].opcodes[5]={type:4,index:44},this.rules[14].opcodes[6]={type:4,index:15},this.rules[15].opcodes=[],this.rules[15].opcodes[0]={type:2,children:[1,2]},this.rules[15].opcodes[1]={type:4,index:16},this.rules[15].opcodes[2]={type:3,min:0,max:1/0},this.rules[15].opcodes[3]={type:2,children:[4,5]},this.rules[15].opcodes[4]={type:4,index:45},this.rules[15].opcodes[5]={type:4,index:16},this.rules[16].opcodes=[],this.rules[16].opcodes[0]={type:2,children:[1,3]},this.rules[16].opcodes[1]={type:3,min:0,max:1},this.rules[16].opcodes[2]={type:4,index:17},this.rules[16].opcodes[3]={type:1,children:[4,5,6,7]},this.rules[16].opcodes[4]={type:4,index:21},this.rules[16].opcodes[5]={type:4,index:25},this.rules[16].opcodes[6]={type:4,index:19},this.rules[16].opcodes[7]={type:4,index:20},this.rules[17].opcodes=[],this.rules[17].opcodes[0]={type:1,children:[1,5]},this.rules[17].opcodes[1]={type:2,children:[2,3]},this.rules[17].opcodes[2]={type:4,index:18},this.rules[17].opcodes[3]={type:3,min:0,max:1},this.rules[17].opcodes[4]={type:4,index:43},this.rules[17].opcodes[5]={type:4,index:43},this.rules[18].opcodes=[],this.rules[18].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[18].opcodes[1]={type:4,index:49},this.rules[18].opcodes[2]={type:4,index:50},this.rules[18].opcodes[3]={type:4,index:47},this.rules[18].opcodes[4]={type:4,index:48},this.rules[19].opcodes=[],this.rules[19].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10]},this.rules[19].opcodes[1]={type:4,index:40},this.rules[19].opcodes[2]={type:4,index:29},this.rules[19].opcodes[3]={type:4,index:53},this.rules[19].opcodes[4]={type:4,index:54},this.rules[19].opcodes[5]={type:4,index:55},this.rules[19].opcodes[6]={type:4,index:61},this.rules[19].opcodes[7]={type:4,index:30},this.rules[19].opcodes[8]={type:4,index:51},this.rules[19].opcodes[9]={type:4,index:52},this.rules[19].opcodes[10]={type:4,index:65},this.rules[20].opcodes=[],this.rules[20].opcodes[0]={type:3,min:1,max:1/0},this.rules[20].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[20].opcodes[2]={type:5,min:33,max:40},this.rules[20].opcodes[3]={type:5,min:42,max:46},this.rules[20].opcodes[4]={type:5,min:48,max:92},this.rules[20].opcodes[5]={type:5,min:94,max:126},this.rules[21].opcodes=[],this.rules[21].opcodes[0]={type:2,children:[1,2,3]},this.rules[21].opcodes[1]={type:4,index:23},this.rules[21].opcodes[2]={type:4,index:14},this.rules[21].opcodes[3]={type:1,children:[4,5]},this.rules[21].opcodes[4]={type:4,index:24},this.rules[21].opcodes[5]={type:4,index:22},this.rules[22].opcodes=[],this.rules[22].opcodes[0]={type:3,min:1,max:1/0},this.rules[22].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[22].opcodes[2]={type:5,min:33,max:40},this.rules[22].opcodes[3]={type:5,min:42,max:46},this.rules[22].opcodes[4]={type:5,min:48,max:92},this.rules[22].opcodes[5]={type:5,min:94,max:126},this.rules[23].opcodes=[],this.rules[23].opcodes[0]={type:2,children:[1,2]},this.rules[23].opcodes[1]={type:6,string:[40]},this.rules[23].opcodes[2]={type:4,index:89},this.rules[24].opcodes=[],this.rules[24].opcodes[0]={type:2,children:[1,2]},this.rules[24].opcodes[1]={type:4,index:89},this.rules[24].opcodes[2]={type:6,string:[41]},this.rules[25].opcodes=[],this.rules[25].opcodes[0]={type:2,children:[1,2,3]},this.rules[25].opcodes[1]={type:4,index:27},this.rules[25].opcodes[2]={type:4,index:14},this.rules[25].opcodes[3]={type:1,children:[4,5]},this.rules[25].opcodes[4]={type:4,index:28},this.rules[25].opcodes[5]={type:4,index:26},this.rules[26].opcodes=[],this.rules[26].opcodes[0]={type:3,min:1,max:1/0},this.rules[26].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[26].opcodes[2]={type:5,min:33,max:40},this.rules[26].opcodes[3]={type:5,min:42,max:46},this.rules[26].opcodes[4]={type:5,min:48,max:92},this.rules[26].opcodes[5]={type:5,min:94,max:126},this.rules[27].opcodes=[],this.rules[27].opcodes[0]={type:2,children:[1,2]},this.rules[27].opcodes[1]={type:6,string:[91]},this.rules[27].opcodes[2]={type:4,index:89},this.rules[28].opcodes=[],this.rules[28].opcodes[0]={type:2,children:[1,2]},this.rules[28].opcodes[1]={type:4,index:89},this.rules[28].opcodes[2]={type:6,string:[93]},this.rules[29].opcodes=[],this.rules[29].opcodes[0]={type:4,index:88},this.rules[30].opcodes=[],this.rules[30].opcodes[0]={type:2,children:[1,2,4]},this.rules[30].opcodes[1]={type:6,string:[92]},this.rules[30].opcodes[2]={type:3,min:0,max:1},this.rules[30].opcodes[3]={type:4,index:31},this.rules[30].opcodes[4]={type:4,index:36},this.rules[31].opcodes=[],this.rules[31].opcodes[0]={type:1,children:[1,7,13,19]},this.rules[31].opcodes[1]={type:2,children:[2,3]},this.rules[31].opcodes[2]={type:4,index:32},this.rules[31].opcodes[3]={type:3,min:0,max:1},this.rules[31].opcodes[4]={type:1,children:[5,6]},this.rules[31].opcodes[5]={type:4,index:34},this.rules[31].opcodes[6]={type:4,index:35},this.rules[31].opcodes[7]={type:2,children:[8,9]},this.rules[31].opcodes[8]={type:4,index:33},this.rules[31].opcodes[9]={type:3,min:0,max:1},this.rules[31].opcodes[10]={type:1,children:[11,12]},this.rules[31].opcodes[11]={type:4,index:34},this.rules[31].opcodes[12]={type:4,index:35},this.rules[31].opcodes[13]={type:2,children:[14,15]},this.rules[31].opcodes[14]={type:4,index:34},this.rules[31].opcodes[15]={type:3,min:0,max:1},this.rules[31].opcodes[16]={type:1,children:[17,18]},this.rules[31].opcodes[17]={type:4,index:32},this.rules[31].opcodes[18]={type:4,index:33},this.rules[31].opcodes[19]={type:2,children:[20,21]},this.rules[31].opcodes[20]={type:4,index:35},this.rules[31].opcodes[21]={type:3,min:0,max:1},this.rules[31].opcodes[22]={type:1,children:[23,24]},this.rules[31].opcodes[23]={type:4,index:32},this.rules[31].opcodes[24]={type:4,index:33},this.rules[32].opcodes=[],this.rules[32].opcodes[0]={type:6,string:[37,115]},this.rules[33].opcodes=[],this.rules[33].opcodes[0]={type:6,string:[37,105]},this.rules[34].opcodes=[],this.rules[34].opcodes[0]={type:6,string:[37,117]},this.rules[35].opcodes=[],this.rules[35].opcodes[0]={type:6,string:[37,112]},this.rules[36].opcodes=[],this.rules[36].opcodes[0]={type:1,children:[1,2,3]},this.rules[36].opcodes[1]={type:4,index:38},this.rules[36].opcodes[2]={type:4,index:39},this.rules[36].opcodes[3]={type:4,index:37},this.rules[37].opcodes=[],this.rules[37].opcodes[0]={type:4,index:88},this.rules[38].opcodes=[],this.rules[38].opcodes[0]={type:2,children:[1,2]},this.rules[38].opcodes[1]={type:6,string:[117,95]},this.rules[38].opcodes[2]={type:4,index:88},this.rules[39].opcodes=[],this.rules[39].opcodes[0]={type:2,children:[1,2]},this.rules[39].opcodes[1]={type:6,string:[101,95]},this.rules[39].opcodes[2]={type:4,index:88},this.rules[40].opcodes=[],this.rules[40].opcodes[0]={type:1,children:[1,2]},this.rules[40].opcodes[1]={type:4,index:42},this.rules[40].opcodes[2]={type:4,index:41},this.rules[41].opcodes=[],this.rules[41].opcodes[0]={type:2,children:[1,2]},this.rules[41].opcodes[1]={type:6,string:[117,95]},this.rules[41].opcodes[2]={type:4,index:88},this.rules[42].opcodes=[],this.rules[42].opcodes[0]={type:2,children:[1,2]},this.rules[42].opcodes[1]={type:6,string:[101,95]},this.rules[42].opcodes[2]={type:4,index:88},this.rules[43].opcodes=[],this.rules[43].opcodes[0]={type:1,children:[1,5,8,11,12]},this.rules[43].opcodes[1]={type:2,children:[2,3,4]},this.rules[43].opcodes[2]={type:4,index:69},this.rules[43].opcodes[3]={type:4,index:46},this.rules[43].opcodes[4]={type:4,index:71},this.rules[43].opcodes[5]={type:2,children:[6,7]},this.rules[43].opcodes[6]={type:4,index:69},this.rules[43].opcodes[7]={type:4,index:46},this.rules[43].opcodes[8]={type:2,children:[9,10]},this.rules[43].opcodes[9]={type:4,index:46},this.rules[43].opcodes[10]={type:4,index:71},this.rules[43].opcodes[11]={type:4,index:46},this.rules[43].opcodes[12]={type:4,index:70},this.rules[44].opcodes=[],this.rules[44].opcodes[0]={type:2,children:[1,2]},this.rules[44].opcodes[1]={type:6,string:[47]},this.rules[44].opcodes[2]={type:4,index:89},this.rules[45].opcodes=[],this.rules[45].opcodes[0]={type:4,index:90},this.rules[46].opcodes=[],this.rules[46].opcodes[0]={type:6,string:[42]},this.rules[47].opcodes=[],this.rules[47].opcodes[0]={type:6,string:[38]},this.rules[48].opcodes=[],this.rules[48].opcodes[0]={type:6,string:[33]},this.rules[49].opcodes=[],this.rules[49].opcodes[0]={type:6,string:[38,38]},this.rules[50].opcodes=[],this.rules[50].opcodes[0]={type:6,string:[33,33]},this.rules[51].opcodes=[],this.rules[51].opcodes[0]={type:6,string:[37,94]},this.rules[52].opcodes=[],this.rules[52].opcodes[0]={type:6,string:[37,36]},this.rules[53].opcodes=[],this.rules[53].opcodes[0]={type:2,children:[1,2]},this.rules[53].opcodes[1]={type:6,string:[37]},this.rules[53].opcodes[2]={type:1,children:[3,8,13]},this.rules[53].opcodes[3]={type:2,children:[4,5,6,7]},this.rules[53].opcodes[4]={type:4,index:76},this.rules[53].opcodes[5]={type:4,index:79},this.rules[53].opcodes[6]={type:6,string:[45]},this.rules[53].opcodes[7]={type:4,index:80},this.rules[53].opcodes[8]={type:2,children:[9,10,11,12]},this.rules[53].opcodes[9]={type:4,index:77},this.rules[53].opcodes[10]={type:4,index:83},this.rules[53].opcodes[11]={type:6,string:[45]},this.rules[53].opcodes[12]={type:4,index:84},this.rules[53].opcodes[13]={type:2,children:[14,15,16,17]},this.rules[53].opcodes[14]={type:4,index:78},this.rules[53].opcodes[15]={type:4,index:81},this.rules[53].opcodes[16]={type:6,string:[45]},this.rules[53].opcodes[17]={type:4,index:82},this.rules[54].opcodes=[],this.rules[54].opcodes[0]={type:2,children:[1,2]},this.rules[54].opcodes[1]={type:6,string:[37]},this.rules[54].opcodes[2]={type:1,children:[3,10,17]},this.rules[54].opcodes[3]={type:2,children:[4,5,6]},this.rules[54].opcodes[4]={type:4,index:76},this.rules[54].opcodes[5]={type:4,index:73},this.rules[54].opcodes[6]={type:3,min:0,max:1/0},this.rules[54].opcodes[7]={type:2,children:[8,9]},this.rules[54].opcodes[8]={type:6,string:[46]},this.rules[54].opcodes[9]={type:4,index:73},this.rules[54].opcodes[10]={type:2,children:[11,12,13]},this.rules[54].opcodes[11]={type:4,index:77},this.rules[54].opcodes[12]={type:4,index:74},this.rules[54].opcodes[13]={type:3,min:0,max:1/0},this.rules[54].opcodes[14]={type:2,children:[15,16]},this.rules[54].opcodes[15]={type:6,string:[46]},this.rules[54].opcodes[16]={type:4,index:74},this.rules[54].opcodes[17]={type:2,children:[18,19,20]},this.rules[54].opcodes[18]={type:4,index:78},this.rules[54].opcodes[19]={type:4,index:75},this.rules[54].opcodes[20]={type:3,min:0,max:1/0},this.rules[54].opcodes[21]={type:2,children:[22,23]},this.rules[54].opcodes[22]={type:6,string:[46]},this.rules[54].opcodes[23]={type:4,index:75},this.rules[55].opcodes=[],this.rules[55].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[55].opcodes[1]={type:4,index:56},this.rules[55].opcodes[2]={type:4,index:57},this.rules[55].opcodes[3]={type:4,index:59},this.rules[55].opcodes[4]={type:4,index:58},this.rules[56].opcodes=[],this.rules[56].opcodes[0]={type:3,min:0,max:1},this.rules[56].opcodes[1]={type:1,children:[2,3]},this.rules[56].opcodes[2]={type:7,string:[37,105]},this.rules[56].opcodes[3]={type:7,string:[37,115]},this.rules[57].opcodes=[],this.rules[57].opcodes[0]={type:6,string:[34]},this.rules[58].opcodes=[],this.rules[58].opcodes[0]={type:6,string:[34]},this.rules[59].opcodes=[],this.rules[59].opcodes[0]={type:3,min:0,max:1/0},this.rules[59].opcodes[1]={type:1,children:[2,3,4]},this.rules[59].opcodes[2]={type:5,min:32,max:33},this.rules[59].opcodes[3]={type:5,min:35,max:126},this.rules[59].opcodes[4]={type:4,index:60},this.rules[60].opcodes=[],this.rules[60].opcodes[0]={type:6,string:[9]},this.rules[61].opcodes=[],this.rules[61].opcodes[0]={type:2,children:[1,2,3]},this.rules[61].opcodes[1]={type:4,index:62},this.rules[61].opcodes[2]={type:4,index:64},this.rules[61].opcodes[3]={type:4,index:63},this.rules[62].opcodes=[],this.rules[62].opcodes[0]={type:6,string:[39]},this.rules[63].opcodes=[],this.rules[63].opcodes[0]={type:6,string:[39]},this.rules[64].opcodes=[],this.rules[64].opcodes[0]={type:3,min:0,max:1/0},this.rules[64].opcodes[1]={type:1,children:[2,3,4]},this.rules[64].opcodes[2]={type:5,min:32,max:38},this.rules[64].opcodes[3]={type:5,min:40,max:126},this.rules[64].opcodes[4]={type:4,index:60},this.rules[65].opcodes=[],this.rules[65].opcodes[0]={type:2,children:[1,2,3]},this.rules[65].opcodes[1]={type:4,index:66},this.rules[65].opcodes[2]={type:4,index:67},this.rules[65].opcodes[3]={type:4,index:68},this.rules[66].opcodes=[],this.rules[66].opcodes[0]={type:6,string:[60]},this.rules[67].opcodes=[],this.rules[67].opcodes[0]={type:3,min:0,max:1/0},this.rules[67].opcodes[1]={type:1,children:[2,3,4]},this.rules[67].opcodes[2]={type:5,min:32,max:61},this.rules[67].opcodes[3]={type:5,min:63,max:126},this.rules[67].opcodes[4]={type:4,index:60},this.rules[68].opcodes=[],this.rules[68].opcodes[0]={type:6,string:[62]},this.rules[69].opcodes=[],this.rules[69].opcodes[0]={type:4,index:72},this.rules[70].opcodes=[],this.rules[70].opcodes[0]={type:4,index:72},this.rules[71].opcodes=[],this.rules[71].opcodes[0]={type:4,index:72},this.rules[72].opcodes=[],this.rules[72].opcodes[0]={type:3,min:1,max:1/0},this.rules[72].opcodes[1]={type:5,min:48,max:57},this.rules[73].opcodes=[],this.rules[73].opcodes[0]={type:4,index:85},this.rules[74].opcodes=[],this.rules[74].opcodes[0]={type:4,index:87},this.rules[75].opcodes=[],this.rules[75].opcodes[0]={type:4,index:86},this.rules[76].opcodes=[],this.rules[76].opcodes[0]={type:1,children:[1,2]},this.rules[76].opcodes[1]={type:6,string:[68]},this.rules[76].opcodes[2]={type:6,string:[100]},this.rules[77].opcodes=[],this.rules[77].opcodes[0]={type:1,children:[1,2]},this.rules[77].opcodes[1]={type:6,string:[88]},this.rules[77].opcodes[2]={type:6,string:[120]},this.rules[78].opcodes=[],this.rules[78].opcodes[0]={type:1,children:[1,2]},this.rules[78].opcodes[1]={type:6,string:[66]},this.rules[78].opcodes[2]={type:6,string:[98]},this.rules[79].opcodes=[],this.rules[79].opcodes[0]={type:4,index:85},this.rules[80].opcodes=[],this.rules[80].opcodes[0]={type:4,index:85},this.rules[81].opcodes=[],this.rules[81].opcodes[0]={type:4,index:86},this.rules[82].opcodes=[],this.rules[82].opcodes[0]={type:4,index:86},this.rules[83].opcodes=[],this.rules[83].opcodes[0]={type:4,index:87},this.rules[84].opcodes=[],this.rules[84].opcodes[0]={type:4,index:87},this.rules[85].opcodes=[],this.rules[85].opcodes[0]={type:3,min:1,max:1/0},this.rules[85].opcodes[1]={type:5,min:48,max:57},this.rules[86].opcodes=[],this.rules[86].opcodes[0]={type:3,min:1,max:1/0},this.rules[86].opcodes[1]={type:5,min:48,max:49},this.rules[87].opcodes=[],this.rules[87].opcodes[0]={type:3,min:1,max:1/0},this.rules[87].opcodes[1]={type:1,children:[2,3,4]},this.rules[87].opcodes[2]={type:5,min:48,max:57},this.rules[87].opcodes[3]={type:5,min:65,max:70},this.rules[87].opcodes[4]={type:5,min:97,max:102},this.rules[88].opcodes=[],this.rules[88].opcodes[0]={type:2,children:[1,4]},this.rules[88].opcodes[1]={type:1,children:[2,3]},this.rules[88].opcodes[2]={type:5,min:97,max:122},this.rules[88].opcodes[3]={type:5,min:65,max:90},this.rules[88].opcodes[4]={type:3,min:0,max:1/0},this.rules[88].opcodes[5]={type:1,children:[6,7,8,9]},this.rules[88].opcodes[6]={type:5,min:97,max:122},this.rules[88].opcodes[7]={type:5,min:65,max:90},this.rules[88].opcodes[8]={type:5,min:48,max:57},this.rules[88].opcodes[9]={type:6,string:[45]},this.rules[89].opcodes=[],this.rules[89].opcodes[0]={type:3,min:0,max:1/0},this.rules[89].opcodes[1]={type:4,index:91},this.rules[90].opcodes=[],this.rules[90].opcodes[0]={type:3,min:1,max:1/0},this.rules[90].opcodes[1]={type:4,index:91},this.rules[91].opcodes=[],this.rules[91].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[91].opcodes[1]={type:6,string:[32]},this.rules[91].opcodes[2]={type:6,string:[9]},this.rules[91].opcodes[3]={type:4,index:92},this.rules[91].opcodes[4]={type:4,index:94},this.rules[92].opcodes=[],this.rules[92].opcodes[0]={type:2,children:[1,2]},this.rules[92].opcodes[1]={type:6,string:[59]},this.rules[92].opcodes[2]={type:3,min:0,max:1/0},this.rules[92].opcodes[3]={type:1,children:[4,5]},this.rules[92].opcodes[4]={type:5,min:32,max:126},this.rules[92].opcodes[5]={type:6,string:[9]},this.rules[93].opcodes=[],this.rules[93].opcodes[0]={type:1,children:[1,2,3]},this.rules[93].opcodes[1]={type:6,string:[13,10]},this.rules[93].opcodes[2]={type:6,string:[10]},this.rules[93].opcodes[3]={type:6,string:[13]},this.rules[94].opcodes=[],this.rules[94].opcodes[0]={type:2,children:[1,5]},this.rules[94].opcodes[1]={type:1,children:[2,3,4]},this.rules[94].opcodes[2]={type:6,string:[13,10]},this.rules[94].opcodes[3]={type:6,string:[10]},this.rules[94].opcodes[4]={type:6,string:[13]},this.rules[94].opcodes[5]={type:1,children:[6,7]},this.rules[94].opcodes[6]={type:6,string:[32]},this.rules[94].opcodes[7]={type:6,string:[9]},this.toString=function(){let t="";return t+=";\n",t+="; ABNF for JavaScript APG 2.0 SABNF\n",t+="; RFC 5234 with some restrictions and additions.\n",t+="; Updated 11/24/2015 for RFC 7405 case-sensitive literal string notation\n",t+='; - accepts %s"string" as a case-sensitive string\n',t+='; - accepts %i"string" as a case-insensitive string\n',t+='; - accepts "string" as a case-insensitive string\n',t+=";\n",t+="; Some restrictions:\n",t+="; 1. Rules must begin at first character of each line.\n",t+="; Indentations on first rule and rules thereafter are not allowed.\n",t+="; 2. Relaxed line endings. CRLF, LF or CR are accepted as valid line ending.\n",t+="; 3. Prose values, i.e. , are accepted as valid grammar syntax.\n",t+="; However, a working parser cannot be generated from them.\n",t+=";\n",t+="; Super set (SABNF) additions:\n",t+="; 1. Look-ahead (syntactic predicate) operators are accepted as element prefixes.\n",t+="; & is the positive look-ahead operator, succeeds and backtracks if the look-ahead phrase is found\n",t+="; ! is the negative look-ahead operator, succeeds and backtracks if the look-ahead phrase is NOT found\n",t+="; e.g. &%d13 or &rule or !(A / B)\n",t+="; 2. User-Defined Terminals (UDT) of the form, u_name and e_name are accepted.\n",t+="; 'name' is alpha followed by alpha/num/hyphen just like a rule name.\n",t+="; u_name may be used as an element but no rule definition is given.\n",t+="; e.g. rule = A / u_myUdt\n",t+='; A = "a"\n',t+="; would be a valid grammar.\n",t+="; 3. Case-sensitive, single-quoted strings are accepted.\n",t+="; e.g. 'abc' would be equivalent to %d97.98.99\n",t+='; (kept for backward compatibility, but superseded by %s"abc") \n',t+="; New 12/26/2015\n",t+="; 4. Look-behind operators are accepted as element prefixes.\n",t+="; && is the positive look-behind operator, succeeds and backtracks if the look-behind phrase is found\n",t+="; !! is the negative look-behind operator, succeeds and backtracks if the look-behind phrase is NOT found\n",t+="; e.g. &&%d13 or &&rule or !!(A / B)\n",t+="; 5. Back reference operators, i.e. \\rulename, are accepted.\n",t+="; A back reference operator acts like a TLS or TBS terminal except that the phrase it attempts\n",t+="; to match is a phrase previously matched by the rule 'rulename'.\n",t+="; There are two modes of previous phrase matching - the parent-frame mode and the universal mode.\n",t+="; In universal mode, \\rulename matches the last match to 'rulename' regardless of where it was found.\n",t+="; In parent-frame mode, \\rulename matches only the last match found on the parent's frame or parse tree level.\n",t+="; Back reference modifiers can be used to specify case and mode.\n",t+="; \\A defaults to case-insensitive and universal mode, e.g. \\A === \\%i%uA\n",t+="; Modifiers %i and %s determine case-insensitive and case-sensitive mode, respectively.\n",t+="; Modifiers %u and %p determine universal mode and parent frame mode, respectively.\n",t+="; Case and mode modifiers can appear in any order, e.g. \\%s%pA === \\%p%sA. \n",t+="; 7. String begin anchor, ABG(%^) matches the beginning of the input string location.\n",t+="; Returns EMPTY or NOMATCH. Never consumes any characters.\n",t+="; 8. String end anchor, AEN(%$) matches the end of the input string location.\n",t+="; Returns EMPTY or NOMATCH. Never consumes any characters.\n",t+=";\n",t+="File = *(BlankLine / Rule / RuleError)\n",t+="BlankLine = *(%d32/%d9) [comment] LineEnd\n",t+="Rule = RuleLookup owsp Alternation ((owsp LineEnd)\n",t+=" / (LineEndError LineEnd))\n",t+="RuleLookup = RuleNameTest owsp DefinedAsTest\n",t+="RuleNameTest = RuleName/RuleNameError\n",t+="RuleName = alphanum\n",t+="RuleNameError = 1*(%d33-60/%d62-126)\n",t+="DefinedAsTest = DefinedAs / DefinedAsError\n",t+="DefinedAsError = 1*2%d33-126\n",t+="DefinedAs = IncAlt / Defined\n",t+="Defined = %d61\n",t+="IncAlt = %d61.47\n",t+="RuleError = 1*(%d32-126 / %d9 / LineContinue) LineEnd\n",t+="LineEndError = 1*(%d32-126 / %d9 / LineContinue)\n",t+="Alternation = Concatenation *(owsp AltOp Concatenation)\n",t+="Concatenation = Repetition *(CatOp Repetition)\n",t+="Repetition = [Modifier] (Group / Option / BasicElement / BasicElementErr)\n",t+="Modifier = (Predicate [RepOp])\n",t+=" / RepOp\n",t+="Predicate = BkaOp\n",t+=" / BknOp\n",t+=" / AndOp\n",t+=" / NotOp\n",t+="BasicElement = UdtOp\n",t+=" / RnmOp\n",t+=" / TrgOp\n",t+=" / TbsOp\n",t+=" / TlsOp\n",t+=" / ClsOp\n",t+=" / BkrOp\n",t+=" / AbgOp\n",t+=" / AenOp\n",t+=" / ProsVal\n",t+="BasicElementErr = 1*(%d33-40/%d42-46/%d48-92/%d94-126)\n",t+="Group = GroupOpen Alternation (GroupClose / GroupError)\n",t+="GroupError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr\n",t+="GroupOpen = %d40 owsp\n",t+="GroupClose = owsp %d41\n",t+="Option = OptionOpen Alternation (OptionClose / OptionError)\n",t+="OptionError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr\n",t+="OptionOpen = %d91 owsp\n",t+="OptionClose = owsp %d93\n",t+="RnmOp = alphanum\n",t+="BkrOp = %d92 [bkrModifier] bkr-name\n",t+="bkrModifier = (cs [um / pm]) / (ci [um / pm]) / (um [cs /ci]) / (pm [cs / ci])\n",t+="cs = '%s'\n",t+="ci = '%i'\n",t+="um = '%u'\n",t+="pm = '%p'\n",t+="bkr-name = uname / ename / rname\n",t+="rname = alphanum\n",t+="uname = %d117.95 alphanum\n",t+="ename = %d101.95 alphanum\n",t+="UdtOp = udt-empty\n",t+=" / udt-non-empty\n",t+="udt-non-empty = %d117.95 alphanum\n",t+="udt-empty = %d101.95 alphanum\n",t+="RepOp = (rep-min StarOp rep-max)\n",t+=" / (rep-min StarOp)\n",t+=" / (StarOp rep-max)\n",t+=" / StarOp\n",t+=" / rep-min-max\n",t+="AltOp = %d47 owsp\n",t+="CatOp = wsp\n",t+="StarOp = %d42\n",t+="AndOp = %d38\n",t+="NotOp = %d33\n",t+="BkaOp = %d38.38\n",t+="BknOp = %d33.33\n",t+="AbgOp = %d37.94\n",t+="AenOp = %d37.36\n",t+="TrgOp = %d37 ((Dec dmin %d45 dmax) / (Hex xmin %d45 xmax) / (Bin bmin %d45 bmax))\n",t+="TbsOp = %d37 ((Dec dString *(%d46 dString)) / (Hex xString *(%d46 xString)) / (Bin bString *(%d46 bString)))\n",t+="TlsOp = TlsCase TlsOpen TlsString TlsClose\n",t+='TlsCase = ["%i" / "%s"]\n',t+="TlsOpen = %d34\n",t+="TlsClose = %d34\n",t+="TlsString = *(%d32-33/%d35-126/StringTab)\n",t+="StringTab = %d9\n",t+="ClsOp = ClsOpen ClsString ClsClose\n",t+="ClsOpen = %d39\n",t+="ClsClose = %d39\n",t+="ClsString = *(%d32-38/%d40-126/StringTab)\n",t+="ProsVal = ProsValOpen ProsValString ProsValClose\n",t+="ProsValOpen = %d60\n",t+="ProsValString = *(%d32-61/%d63-126/StringTab)\n",t+="ProsValClose = %d62\n",t+="rep-min = rep-num\n",t+="rep-min-max = rep-num\n",t+="rep-max = rep-num\n",t+="rep-num = 1*(%d48-57)\n",t+="dString = dnum\n",t+="xString = xnum\n",t+="bString = bnum\n",t+="Dec = (%d68/%d100)\n",t+="Hex = (%d88/%d120)\n",t+="Bin = (%d66/%d98)\n",t+="dmin = dnum\n",t+="dmax = dnum\n",t+="bmin = bnum\n",t+="bmax = bnum\n",t+="xmin = xnum\n",t+="xmax = xnum\n",t+="dnum = 1*(%d48-57)\n",t+="bnum = 1*%d48-49\n",t+="xnum = 1*(%d48-57 / %d65-70 / %d97-102)\n",t+=";\n",t+="; Basics\n",t+="alphanum = (%d97-122/%d65-90) *(%d97-122/%d65-90/%d48-57/%d45)\n",t+="owsp = *space\n",t+="wsp = 1*space\n",t+="space = %d32\n",t+=" / %d9\n",t+=" / comment\n",t+=" / LineContinue\n",t+="comment = %d59 *(%d32-126 / %d9)\n",t+="LineEnd = %d13.10\n",t+=" / %d10\n",t+=" / %d13\n",t+="LineContinue = (%d13.10 / %d10 / %d13) (%d32 / %d9)\n",";\n; ABNF for JavaScript APG 2.0 SABNF\n; RFC 5234 with some restrictions and additions.\n; Updated 11/24/2015 for RFC 7405 case-sensitive literal string notation\n; - accepts %s\"string\" as a case-sensitive string\n; - accepts %i\"string\" as a case-insensitive string\n; - accepts \"string\" as a case-insensitive string\n;\n; Some restrictions:\n; 1. Rules must begin at first character of each line.\n; Indentations on first rule and rules thereafter are not allowed.\n; 2. Relaxed line endings. CRLF, LF or CR are accepted as valid line ending.\n; 3. Prose values, i.e. , are accepted as valid grammar syntax.\n; However, a working parser cannot be generated from them.\n;\n; Super set (SABNF) additions:\n; 1. Look-ahead (syntactic predicate) operators are accepted as element prefixes.\n; & is the positive look-ahead operator, succeeds and backtracks if the look-ahead phrase is found\n; ! is the negative look-ahead operator, succeeds and backtracks if the look-ahead phrase is NOT found\n; e.g. &%d13 or &rule or !(A / B)\n; 2. User-Defined Terminals (UDT) of the form, u_name and e_name are accepted.\n; 'name' is alpha followed by alpha/num/hyphen just like a rule name.\n; u_name may be used as an element but no rule definition is given.\n; e.g. rule = A / u_myUdt\n; A = \"a\"\n; would be a valid grammar.\n; 3. Case-sensitive, single-quoted strings are accepted.\n; e.g. 'abc' would be equivalent to %d97.98.99\n; (kept for backward compatibility, but superseded by %s\"abc\") \n; New 12/26/2015\n; 4. Look-behind operators are accepted as element prefixes.\n; && is the positive look-behind operator, succeeds and backtracks if the look-behind phrase is found\n; !! is the negative look-behind operator, succeeds and backtracks if the look-behind phrase is NOT found\n; e.g. &&%d13 or &&rule or !!(A / B)\n; 5. Back reference operators, i.e. \\rulename, are accepted.\n; A back reference operator acts like a TLS or TBS terminal except that the phrase it attempts\n; to match is a phrase previously matched by the rule 'rulename'.\n; There are two modes of previous phrase matching - the parent-frame mode and the universal mode.\n; In universal mode, \\rulename matches the last match to 'rulename' regardless of where it was found.\n; In parent-frame mode, \\rulename matches only the last match found on the parent's frame or parse tree level.\n; Back reference modifiers can be used to specify case and mode.\n; \\A defaults to case-insensitive and universal mode, e.g. \\A === \\%i%uA\n; Modifiers %i and %s determine case-insensitive and case-sensitive mode, respectively.\n; Modifiers %u and %p determine universal mode and parent frame mode, respectively.\n; Case and mode modifiers can appear in any order, e.g. \\%s%pA === \\%p%sA. \n; 7. String begin anchor, ABG(%^) matches the beginning of the input string location.\n; Returns EMPTY or NOMATCH. Never consumes any characters.\n; 8. String end anchor, AEN(%$) matches the end of the input string location.\n; Returns EMPTY or NOMATCH. Never consumes any characters.\n;\nFile = *(BlankLine / Rule / RuleError)\nBlankLine = *(%d32/%d9) [comment] LineEnd\nRule = RuleLookup owsp Alternation ((owsp LineEnd)\n / (LineEndError LineEnd))\nRuleLookup = RuleNameTest owsp DefinedAsTest\nRuleNameTest = RuleName/RuleNameError\nRuleName = alphanum\nRuleNameError = 1*(%d33-60/%d62-126)\nDefinedAsTest = DefinedAs / DefinedAsError\nDefinedAsError = 1*2%d33-126\nDefinedAs = IncAlt / Defined\nDefined = %d61\nIncAlt = %d61.47\nRuleError = 1*(%d32-126 / %d9 / LineContinue) LineEnd\nLineEndError = 1*(%d32-126 / %d9 / LineContinue)\nAlternation = Concatenation *(owsp AltOp Concatenation)\nConcatenation = Repetition *(CatOp Repetition)\nRepetition = [Modifier] (Group / Option / BasicElement / BasicElementErr)\nModifier = (Predicate [RepOp])\n / RepOp\nPredicate = BkaOp\n / BknOp\n / AndOp\n / NotOp\nBasicElement = UdtOp\n / RnmOp\n / TrgOp\n / TbsOp\n / TlsOp\n / ClsOp\n / BkrOp\n / AbgOp\n / AenOp\n / ProsVal\nBasicElementErr = 1*(%d33-40/%d42-46/%d48-92/%d94-126)\nGroup = GroupOpen Alternation (GroupClose / GroupError)\nGroupError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr\nGroupOpen = %d40 owsp\nGroupClose = owsp %d41\nOption = OptionOpen Alternation (OptionClose / OptionError)\nOptionError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr\nOptionOpen = %d91 owsp\nOptionClose = owsp %d93\nRnmOp = alphanum\nBkrOp = %d92 [bkrModifier] bkr-name\nbkrModifier = (cs [um / pm]) / (ci [um / pm]) / (um [cs /ci]) / (pm [cs / ci])\ncs = '%s'\nci = '%i'\num = '%u'\npm = '%p'\nbkr-name = uname / ename / rname\nrname = alphanum\nuname = %d117.95 alphanum\nename = %d101.95 alphanum\nUdtOp = udt-empty\n / udt-non-empty\nudt-non-empty = %d117.95 alphanum\nudt-empty = %d101.95 alphanum\nRepOp = (rep-min StarOp rep-max)\n / (rep-min StarOp)\n / (StarOp rep-max)\n / StarOp\n / rep-min-max\nAltOp = %d47 owsp\nCatOp = wsp\nStarOp = %d42\nAndOp = %d38\nNotOp = %d33\nBkaOp = %d38.38\nBknOp = %d33.33\nAbgOp = %d37.94\nAenOp = %d37.36\nTrgOp = %d37 ((Dec dmin %d45 dmax) / (Hex xmin %d45 xmax) / (Bin bmin %d45 bmax))\nTbsOp = %d37 ((Dec dString *(%d46 dString)) / (Hex xString *(%d46 xString)) / (Bin bString *(%d46 bString)))\nTlsOp = TlsCase TlsOpen TlsString TlsClose\nTlsCase = [\"%i\" / \"%s\"]\nTlsOpen = %d34\nTlsClose = %d34\nTlsString = *(%d32-33/%d35-126/StringTab)\nStringTab = %d9\nClsOp = ClsOpen ClsString ClsClose\nClsOpen = %d39\nClsClose = %d39\nClsString = *(%d32-38/%d40-126/StringTab)\nProsVal = ProsValOpen ProsValString ProsValClose\nProsValOpen = %d60\nProsValString = *(%d32-61/%d63-126/StringTab)\nProsValClose = %d62\nrep-min = rep-num\nrep-min-max = rep-num\nrep-max = rep-num\nrep-num = 1*(%d48-57)\ndString = dnum\nxString = xnum\nbString = bnum\nDec = (%d68/%d100)\nHex = (%d88/%d120)\nBin = (%d66/%d98)\ndmin = dnum\ndmax = dnum\nbmin = bnum\nbmax = bnum\nxmin = xnum\nxmax = xnum\ndnum = 1*(%d48-57)\nbnum = 1*%d48-49\nxnum = 1*(%d48-57 / %d65-70 / %d97-102)\n;\n; Basics\nalphanum = (%d97-122/%d65-90) *(%d97-122/%d65-90/%d48-57/%d45)\nowsp = *space\nwsp = 1*space\nspace = %d32\n / %d9\n / comment\n / LineContinue\ncomment = %d59 *(%d32-126 / %d9)\nLineEnd = %d13.10\n / %d10\n / %d13\nLineContinue = (%d13.10 / %d10 / %d13) (%d32 / %d9)\n"}}},3479:(t,e,r)=>{const n=r(8276),i=r(8544),o=[];o.line=function(t,e,r,i,o){return t===n.SEM_PRE?(o.endLength=0,o.textLength=0,o.invalidCount=0):o.lines.push({lineNo:o.lines.length,beginChar:r,length:i,textLength:o.textLength,endType:o.endType,invalidChars:o.invalidCount}),n.SEM_OK},o["line-text"]=function(t,e,r,i,o){return t===n.SEM_PRE&&(o.textLength=i),n.SEM_OK},o["last-line"]=function(t,e,r,i,o){return t===n.SEM_PRE?(o.endLength=0,o.textLength=0,o.invalidCount=0):o.strict?(o.lines.push({lineNo:o.lines.length,beginChar:r,length:i,textLength:i,endType:"none",invalidChars:o.invalidCount}),o.errors.push({line:o.lineNo,char:r+i,msg:"no line end on last line - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})):(e.push(10),o.lines.push({lineNo:o.lines.length,beginChar:r,length:i+1,textLength:i,endType:"LF",invalidChars:o.invalidCount})),n.SEM_OK},o.invalid=function(t,e,r,o,s){return t===n.SEM_PRE&&s.errors.push({line:s.lineNo,char:r,msg:`invalid character found '\\x${i.charToHex(e[r])}'`}),n.SEM_OK},o.end=function(t,e,r,i,o){return t===n.SEM_POST&&(o.lineNo+=1),n.SEM_OK},o.lf=function(t,e,r,i,o){return t===n.SEM_PRE&&(o.endType="LF",o.strict&&o.errors.push({line:o.lineNo,char:r,msg:"line end character LF(\\n, \\x0A) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),n.SEM_OK},o.cr=function(t,e,r,i,o){return t===n.SEM_PRE&&(o.endType="CR",o.strict&&o.errors.push({line:o.lineNo,char:r,msg:"line end character CR(\\r, \\x0D) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),n.SEM_OK},o.crlf=function(t,e,r,i,o){return t===n.SEM_PRE&&(o.endType="CRLF"),n.SEM_OK},e.callbacks=o},6410:t=>{t.exports=function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"file",lower:"file",index:0,isBkr:!1},this.rules[1]={name:"line",lower:"line",index:1,isBkr:!1},this.rules[2]={name:"line-text",lower:"line-text",index:2,isBkr:!1},this.rules[3]={name:"last-line",lower:"last-line",index:3,isBkr:!1},this.rules[4]={name:"valid",lower:"valid",index:4,isBkr:!1},this.rules[5]={name:"invalid",lower:"invalid",index:5,isBkr:!1},this.rules[6]={name:"end",lower:"end",index:6,isBkr:!1},this.rules[7]={name:"CRLF",lower:"crlf",index:7,isBkr:!1},this.rules[8]={name:"LF",lower:"lf",index:8,isBkr:!1},this.rules[9]={name:"CR",lower:"cr",index:9,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:2,children:[1,3]},this.rules[0].opcodes[1]={type:3,min:0,max:1/0},this.rules[0].opcodes[2]={type:4,index:1},this.rules[0].opcodes[3]={type:3,min:0,max:1},this.rules[0].opcodes[4]={type:4,index:3},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,2]},this.rules[1].opcodes[1]={type:4,index:2},this.rules[1].opcodes[2]={type:4,index:6},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:3,min:0,max:1/0},this.rules[2].opcodes[1]={type:1,children:[2,3]},this.rules[2].opcodes[2]={type:4,index:4},this.rules[2].opcodes[3]={type:4,index:5},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:3,min:1,max:1/0},this.rules[3].opcodes[1]={type:1,children:[2,3]},this.rules[3].opcodes[2]={type:4,index:4},this.rules[3].opcodes[3]={type:4,index:5},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:5,min:32,max:126},this.rules[4].opcodes[2]={type:6,string:[9]},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[5].opcodes[1]={type:5,min:0,max:8},this.rules[5].opcodes[2]={type:5,min:11,max:12},this.rules[5].opcodes[3]={type:5,min:14,max:31},this.rules[5].opcodes[4]={type:5,min:127,max:4294967295},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:1,children:[1,2,3]},this.rules[6].opcodes[1]={type:4,index:7},this.rules[6].opcodes[2]={type:4,index:8},this.rules[6].opcodes[3]={type:4,index:9},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:6,string:[13,10]},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:6,string:[10]},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:6,string:[13]},this.toString=function(){let t="";return t+="file = *line [last-line]\n",t+="line = line-text end\n",t+="line-text = *(valid/invalid)\n",t+="last-line = 1*(valid/invalid)\n",t+="valid = %d32-126 / %d9\n",t+="invalid = %d0-8 / %d11-12 /%d14-31 / %x7f-ffffffff\n",t+="end = CRLF / LF / CR\n",t+="CRLF = %d13.10\n",t+="LF = %d10\n",t+="CR = %d13\n","file = *line [last-line]\nline = line-text end\nline-text = *(valid/invalid)\nlast-line = 1*(valid/invalid)\nvalid = %d32-126 / %d9\ninvalid = %d0-8 / %d11-12 /%d14-31 / %x7f-ffffffff\nend = CRLF / LF / CR\nCRLF = %d13.10\nLF = %d10\nCR = %d13\n"}}},1789:(t,e,r)=>{t.exports=function(t,e,n,i){const o=r(8737),s=new(r(6410)),{callbacks:a}=r(3479),u=[],l=new o.parser;if(l.ast=new o.ast,l.ast.callbacks=a,i){if("traceObject"!==i.traceObject)throw new TypeError("scanner.js: trace argument is not a trace object");l.trace=i}if(!0!==l.parse(s,"file",t).success)return void e.push({line:0,char:0,msg:"syntax analysis error analyzing input SABNF grammar"});const h={lines:u,lineNo:0,errors:e,strict:!!n};return l.ast.translate(h),u}},1832:(t,e,r)=>{t.exports=function(){const t=r(8737),e=t.ids,n=function(){this.names=[],this.add=function(t){let e=-1;return-1===this.get(t)&&(e={name:t,lower:t.toLowerCase(),index:this.names.length},this.names.push(e)),e},this.get=function(t){let e=-1;const r=t.toLowerCase();for(let t=0;t=48&&e<=57)e-=48;else if(e>=65&&e<=70)e-=55;else{if(!(e>=97&&e<=102))throw new Error("hexnum out of range");e-=87}n=16*n+e}return n};this.callbacks=[],this.callbacks.abgop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.ABG}),s},this.callbacks.aenop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.AEN}),s},this.callbacks.alternation=function(t,r,n,i,o){let s=e.SEM_OK;if(t===e.SEM_PRE){const t=!0;for(;t;){if(null===o.definedas){s=e.SEM_SKIP;break}if(null===o.topStack){if("="===o.definedas){o.topStack={alt:{type:e.ALT,children:[]},cat:null},o.altStack.push(o.topStack),o.opcodes.push(o.topStack.alt);break}o.topStack={alt:o.opcodes[0],cat:null},o.altStack.push(o.topStack);break}o.topStack={alt:{type:e.ALT,children:[]},cat:null},o.altStack.push(o.topStack),o.opcodes.push(o.topStack.alt);break}}else t===e.SEM_POST&&(o.altStack.pop(),o.altStack.length>0?o.topStack=o.altStack[o.altStack.length-1]:o.topStack=null);return s},this.callbacks.andop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.AND}),s},this.callbacks.bmax=function(t,r,n,i,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.max=o(r,n,i)),a},this.callbacks.bmin=function(t,r,n,i,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.min=o(r,n,i)),a},this.callbacks.bkaop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.BKA}),s},this.callbacks.bknop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.BKN}),s},this.callbacks.bkrop=function(r,n,i,o,s){const a=e.SEM_OK;return r===e.SEM_PRE?(s.ci=!0,s.cs=!1,s.um=!0,s.pm=!1):r===e.SEM_POST&&s.opcodes.push({type:e.BKR,bkrCase:!0===s.cs?e.BKR_MODE_CS:e.BKR_MODE_CI,bkrMode:!0===s.pm?e.BKR_MODE_PM:e.BKR_MODE_UM,index:{phraseIndex:s.bkrname.phraseIndex,name:t.utils.charsToString(n,s.bkrname.phraseIndex,s.bkrname.phraseLength)}}),a},this.callbacks["bkr-name"]=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.bkrname={phraseIndex:n,phraseLength:i}),s},this.callbacks.bstring=function(t,r,n,i,s){const a=e.SEM_OK;return t===e.SEM_POST&&s.tbsstr.push(o(r,n,i)),a},this.callbacks.clsop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(i<=2?o.opcodes.push({type:e.TLS,string:[]}):o.opcodes.push({type:e.TBS,string:r.slice(n+1,n+i-1)})),s},this.callbacks.ci=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.ci=!0),s},this.callbacks.cs=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.cs=!0),s},this.callbacks.um=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.um=!0),s},this.callbacks.pm=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.pm=!0),s},this.callbacks.concatenation=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE?(o.topStack.alt.children.push(o.opcodes.length),o.topStack.cat={type:e.CAT,children:[]},o.opcodes.push(o.topStack.cat)):t===e.SEM_POST&&(o.topStack.cat=null),s},this.callbacks.defined=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.definedas="="),s},this.callbacks.dmax=function(t,r,n,o,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.max=i(r,n,o)),a},this.callbacks.dmin=function(t,r,n,o,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.min=i(r,n,o)),a},this.callbacks.dstring=function(t,r,n,o,s){const a=e.SEM_OK;return t===e.SEM_POST&&s.tbsstr.push(i(r,n,o)),a},this.callbacks.file=function(t,r,i,o,s){const a=e.SEM_OK;if(t===e.SEM_PRE)s.ruleNames=new n,s.udtNames=new n,s.rules=[],s.udts=[],s.rulesLineMap=[],s.opcodes=[],s.altStack=[],s.topStack=null,s.topRule=null;else if(t===e.SEM_POST){let t;s.rules.forEach((r=>{r.isBkr=!1,r.opcodes.forEach((r=>{r.type===e.RNM&&(t=s.ruleNames.get(r.index.name),-1===t?(s.errors.push({line:s.findLine(s.lines,r.index.phraseIndex,s.charsLength),char:r.index.phraseIndex,msg:`Rule name '${r.index.name}' used but not defined.`}),r.index=-1):r.index=t.index)}))})),s.udts.forEach((t=>{t.isBkr=!1})),s.rules.forEach((r=>{r.opcodes.forEach((n=>{n.type===e.BKR&&(r.hasBkr=!0,t=s.ruleNames.get(n.index.name),-1!==t?(s.rules[t.index].isBkr=!0,n.index=t.index):(t=s.udtNames.get(n.index.name),-1!==t?(s.udts[t.index].isBkr=!0,n.index=s.rules.length+t.index):(s.errors.push({line:s.findLine(s.lines,n.index.phraseIndex,s.charsLength),char:n.index.phraseIndex,msg:`Back reference name '${n.index.name}' refers to undefined rule or unamed UDT.`}),n.index=-1)))}))}))}return a},this.callbacks.incalt=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&(o.definedas="=/"),s},this.callbacks.notop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.NOT}),s},this.callbacks.optionopen=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&o.opcodes.push({type:e.REP,min:0,max:1,char:n}),s},this.callbacks["rep-max"]=function(t,r,n,o,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.max=i(r,n,o)),a},this.callbacks["rep-min"]=function(t,r,n,o,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.min=i(r,n,o)),a},this.callbacks["rep-min-max"]=function(t,r,n,o,s){const a=e.SEM_OK;return t===e.SEM_POST&&(s.max=i(r,n,o),s.min=s.max),a},this.callbacks.repetition=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE&&o.topStack.cat.children.push(o.opcodes.length),s},this.callbacks.repop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE?(o.min=0,o.max=1/0,o.topRep={type:e.REP,min:0,max:1/0},o.opcodes.push(o.topRep)):t===e.SEM_POST&&(o.min>o.max&&o.errors.push({line:o.findLine(o.lines,n,o.charsLength),char:n,msg:`repetition min cannot be greater than max: min: ${o.min}: max: ${o.max}`}),o.topRep.min=o.min,o.topRep.max=o.max),s},this.callbacks.rnmop=function(r,n,i,o,s){const a=e.SEM_OK;return r===e.SEM_POST&&s.opcodes.push({type:e.RNM,index:{phraseIndex:i,name:t.utils.charsToString(n,i,o)}}),a},this.callbacks.rule=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE&&(o.altStack.length=0,o.topStack=null,o.rulesLineMap.push({line:o.findLine(o.lines,n,o.charsLength),char:n})),s},this.callbacks.rulelookup=function(t,r,n,i,o){const s=e.SEM_OK;if(t===e.SEM_PRE)o.ruleName="",o.definedas="";else if(t===e.SEM_POST){let t;"="===o.definedas?(t=o.ruleNames.add(o.ruleName),-1===t?(o.definedas=null,o.errors.push({line:o.findLine(o.lines,n,o.charsLength),char:n,msg:`Rule name '${o.ruleName}' previously defined.`})):(o.topRule={name:t.name,lower:t.lower,opcodes:[],index:t.index},o.rules.push(o.topRule),o.opcodes=o.topRule.opcodes)):(t=o.ruleNames.get(o.ruleName),-1===t?(o.definedas=null,o.errors.push({line:o.findLine(o.lines,n,o.charsLength),char:n,msg:`Rule name '${o.ruleName}' for incremental alternate not previously defined.`})):(o.topRule=o.rules[t.index],o.opcodes=o.topRule.opcodes))}return s},this.callbacks.rulename=function(r,n,i,o,s){const a=e.SEM_OK;return r===e.SEM_PRE&&(s.ruleName=t.utils.charsToString(n,i,o)),a},this.callbacks.tbsop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE?o.tbsstr=[]:t===e.SEM_POST&&o.opcodes.push({type:e.TBS,string:o.tbsstr}),s},this.callbacks.tlscase=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_POST&&i>0&&(83===r[n+1]||115===r[n+1])&&(o.tlscase=!1),s},this.callbacks.tlsstring=function(t,r,n,i,o){const s=e.SEM_OK;if(t===e.SEM_POST)if(o.tlscase){const t=r.slice(n,n+i);for(let e=0;e=65&&t[e]<=90&&(t[e]+=32);o.opcodes.push({type:e.TLS,string:t})}else o.opcodes.push({type:e.TBS,string:r.slice(n,n+i)});return s},this.callbacks.tlsop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE&&(o.tlscase=!0),s},this.callbacks.trgop=function(t,r,n,i,o){const s=e.SEM_OK;return t===e.SEM_PRE?(o.min=0,o.max=0):t===e.SEM_POST&&(o.min>o.max&&o.errors.push({line:o.findLine(o.lines,n,o.charsLength),char:n,msg:`TRG, (%dmin-max), min cannot be greater than max: min: ${o.min}: max: ${o.max}`}),o.opcodes.push({type:e.TRG,min:o.min,max:o.max})),s},this.callbacks["udt-empty"]=function(r,n,i,o,s){const a=e.SEM_OK;if(r===e.SEM_POST){const r=t.utils.charsToString(n,i,o);let a=s.udtNames.add(r);if(-1===a){if(a=s.udtNames.get(r),-1===a)throw new Error("semUdtEmpty: name look up error")}else s.udts.push({name:a.name,lower:a.lower,index:a.index,empty:!0});s.opcodes.push({type:e.UDT,empty:!0,index:a.index})}return a},this.callbacks["udt-non-empty"]=function(r,n,i,o,s){const a=e.SEM_OK;if(r===e.SEM_POST){const r=t.utils.charsToString(n,i,o);let a=s.udtNames.add(r);if(-1===a){if(a=s.udtNames.get(r),-1===a)throw new Error("semUdtNonEmpty: name look up error")}else s.udts.push({name:a.name,lower:a.lower,index:a.index,empty:!1});s.opcodes.push({type:e.UDT,empty:!1,index:a.index,syntax:null,semantic:null})}return a},this.callbacks.xmax=function(t,r,n,i,o){const a=e.SEM_OK;return t===e.SEM_POST&&(o.max=s(r,n,i)),a},this.callbacks.xmin=function(t,r,n,i,o){const a=e.SEM_OK;return t===e.SEM_POST&&(o.min=s(r,n,i)),a},this.callbacks.xstring=function(t,r,n,i,o){const a=e.SEM_OK;return t===e.SEM_POST&&o.tbsstr.push(s(r,n,i)),a}}},2595:t=>{t.exports=function(){const t="show-rules.js";return function(e=[],r=[],n="index"){const i="showRules";let o=[],s=[];const a=[],u=[],l=e,h=r,c=e.length,f=r.length;let d,p="RULE/UDT NAMES";if(!Array.isArray(e)||!e.length)throw new Error(`${t}:${i}: rules arg must be array with length > 0`);if(!Array.isArray(r))throw new Error(`${t}:${i}: udts arg must be array`);for(d=0;dl[e].lower?1:0})),f){for(d=0;dh[e].lower?1:0}))}if(97===n.charCodeAt(0)){for(p+=" - alphabetical by rule/UDT name\n",d=0;d{t.exports=function(){const t="syntax-callbacks.js: ",e=r(8737),n=e.ids;let i;this.callbacks=[],this.callbacks.andop=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.strict&&o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"AND operator(&) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.basicelementerr=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:!1===i.basicError&&s.errors.push({line:s.findLine(s.lines,o,s.charsLength),char:o,msg:"Unrecognized SABNF element."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.clsclose=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:break;case n.NOMATCH:s.errors.push({line:s.findLine(s.lines,i.clsOpen),char:i.clsOpen,msg:"Case-sensitive literal string('...') opened but not closed."}),i.clsOpen=null,i.basicError=!0;break;case n.MATCH:s.strict&&s.errors.push({line:s.findLine(s.lines,i.clsOpen),char:i.clsOpen,msg:"Case-sensitive string operator('...') found - strict ABNF specified."}),i.clsOpen=null;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.clsopen=function(e,r,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:i.clsOpen=o;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.clsstring=function(e,r,i,o){switch(e.state){case n.ACTIVE:o.stringTabChar=!1;break;case n.EMPTY:case n.NOMATCH:break;case n.MATCH:!1!==o.stringTabChar&&o.errors.push({line:o.findLine(o.lines,o.stringTabChar),char:o.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.definedaserror=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Expected '=' or '=/'. Not found."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.file=function(e,r,i,o){switch(e.state){case n.ACTIVE:o.altStack=[],o.repCount=0;break;case n.EMPTY:o.errors.push({line:0,char:0,msg:"grammar file is empty"});break;case n.MATCH:0===o.ruleCount&&o.errors.push({line:0,char:0,msg:"no rules defined"});break;case n.NOMATCH:throw new Error(`${t}synFile: grammar file NOMATCH: design error: should never happen.`);default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.groupclose=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:break;case n.NOMATCH:s.errors.push({line:s.findLine(s.lines,i.groupOpen),char:i.groupOpen,msg:'Group "(...)" opened but not closed.'}),i=s.altStack.pop(),i.groupError=!0;break;case n.MATCH:i=s.altStack.pop();break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.groupopen=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:i={groupOpen:o,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},s.altStack.push(i);break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.lineenderror=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Unrecognized grammar element or characters."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.lineend=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:if(1===e.phraseLength&&o.strict){const t=13===r[i]?"CR":"LF";o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:`Line end '${t}' found - strict ABNF specified, only CRLF allowed.`})}break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.notop=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.strict&&o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"NOT operator(!) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.optionclose=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:break;case n.NOMATCH:s.errors.push({line:s.findLine(s.lines,i.optionOpen),char:i.optionOpen,msg:'Option "[...]" opened but not closed.'}),i=s.altStack.pop(),i.optionError=!0;break;case n.MATCH:i=s.altStack.pop();break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.optionopen=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:i={groupOpen:null,groupError:!1,optionOpen:o,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},s.altStack.push(i);break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.prosvalclose=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:break;case n.NOMATCH:s.errors.push({line:s.findLine(s.lines,i.prosValOpen),char:i.prosValOpen,msg:"Prose value operator(<...>) opened but not closed."}),i.basicError=!0,i.prosValOpen=null;break;case n.MATCH:s.errors.push({line:s.findLine(s.lines,i.prosValOpen),char:i.prosValOpen,msg:"Prose value operator(<...>) found. The ABNF syntax is valid, but a parser cannot be generated from this grammar."}),i.prosValOpen=null;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.prosvalopen=function(e,r,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:i.prosValOpen=o;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.prosvalstring=function(e,r,i,o){switch(e.state){case n.ACTIVE:o.stringTabChar=!1;break;case n.EMPTY:case n.NOMATCH:break;case n.MATCH:!1!==o.stringTabChar&&o.errors.push({line:o.findLine(o.lines,o.stringTabChar),char:o.stringTabChar,msg:"Tab character (\\t, x09) not allowed in prose value string."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.repetition=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:break;case n.NOMATCH:case n.MATCH:o.repCount+=1;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.rule=function(e,r,o,s){switch(e.state){case n.ACTIVE:s.altStack.length=0,i={groupOpen:null,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},s.altStack.push(i);break;case n.EMPTY:throw new Error(`${t}synRule: EMPTY: rule cannot be empty`);case n.NOMATCH:break;case n.MATCH:s.ruleCount+=1;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.ruleerror=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Unrecognized SABNF line. Invalid rule, comment or blank line."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.rulenameerror=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Rule names must be alphanum and begin with alphabetic character."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.stringtab=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.stringTabChar=i;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.tlsclose=function(e,r,o,s){switch(e.state){case n.ACTIVE:case n.EMPTY:break;case n.NOMATCH:s.errors.push({line:s.findLine(s.lines,i.tlsOpen),char:i.tlsOpen,msg:'Case-insensitive literal string("...") opened but not closed.'}),i.basicError=!0,i.tlsOpen=null;break;case n.MATCH:i.tlsOpen=null;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.tlsopen=function(e,r,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:i.tlsOpen=o;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.tlsstring=function(e,r,i,o){switch(e.state){case n.ACTIVE:o.stringTabChar=!1;break;case n.EMPTY:case n.NOMATCH:break;case n.MATCH:!1!==o.stringTabChar&&o.errors.push({line:o.findLine(o.lines,o.stringTabChar),char:o.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string (see 'quoted-string' definition, RFC 7405.)"});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.udtop=function(r,i,o,s){switch(r.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:if(s.strict){const t=e.utils.charsToString(i,o,r.phraseLength);s.errors.push({line:s.findLine(s.lines,o,s.charsLength),char:o,msg:`UDT operator found(${t}) - strict ABNF specified.`})}break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.bkaop=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.strict&&o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Positive look-behind operator(&&) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.bknop=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.strict&&o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Negative look-behind operator(!!) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.bkrop=function(r,i,o,s){switch(r.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:if(s.strict){const t=e.utils.charsToString(i,o,r.phraseLength);s.errors.push({line:s.findLine(s.lines,o,s.charsLength),char:o,msg:`Back reference operator(${t}) found - strict ABNF specified.`})}break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.abgop=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.strict&&o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"Beginning of string anchor(%^) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},this.callbacks.aenop=function(e,r,i,o){switch(e.state){case n.ACTIVE:case n.EMPTY:case n.NOMATCH:break;case n.MATCH:o.strict&&o.errors.push({line:o.findLine(o.lines,i,o.charsLength),char:i,msg:"End of string anchor(%$) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}}}},979:function(t,e,r){const n=this,i=r(6322),o="UTF8",s="UTF16",a="UTF16BE",u="UTF16LE",l="UTF32",h="UTF32BE",c="UTF32LE",f="UINT7",d="ASCII",p="BINARY",m="UINT8",g="UINT16",v="UINT16LE",y="UINT16BE",b="UINT32",w="UINT32LE",E="UINT32BE",M="ESCAPED",A="STRING",_=function(t,e){switch(t){case o:return i.utf8.encode(e);case a:return i.utf16be.encode(e);case u:return i.utf16le.encode(e);case h:return i.utf32be.encode(e);case c:return i.utf32le.encode(e);case f:return i.uint7.encode(e);case m:return i.uint8.encode(e);case y:return i.uint16be.encode(e);case v:return i.uint16le.encode(e);case E:return i.uint32be.encode(e);case w:return i.uint32le.encode(e);case A:return i.string.encode(e);case M:return i.escaped.encode(e);default:throw new TypeError(`encode type "${t}" not recognized`)}};e.decode=function(t,e){return function(t){switch(t.type){case o:return i.utf8.decode(t.data,t.bom);case u:return i.utf16le.decode(t.data,t.bom);case a:return i.utf16be.decode(t.data,t.bom);case h:return i.utf32be.decode(t.data,t.bom);case c:return i.utf32le.decode(t.data,t.bom);case f:return i.uint7.decode(t.data);case m:return i.uint8.decode(t.data);case y:return i.uint16be.decode(t.data);case v:return i.uint16le.decode(t.data);case E:return i.uint32be.decode(t.data);case w:return i.uint32le.decode(t.data);case A:return i.string.decode(t.data);case M:return i.escaped.decode(t.data);default:throw new TypeError(`decode type "${t.type}" not recognized`)}}(function(t,e){if("string"!=typeof t||""===t)throw new TypeError(`type: "${t}" not recognized`);const r=function(t){const e={type:"",base64:!1},r=/^(base64:)?([a-zA-Z0-9]+)$/i.exec(t);return r&&(r[2]&&(e.type=r[2].toUpperCase()),r[1]&&(e.base64=!0)),e}(t.toUpperCase());if(r.base64){if(r.type===A)throw new TypeError(`type: "${t} "BASE64:" prefix not allowed with type ${A}`);if(Buffer.isBuffer(e))r.data=i.base64.decode(e);else{if("string"!=typeof e)throw new TypeError(`type: "${t} unrecognized data type: typeof(data): ${typeof e}`);{const t=Buffer.from(e,"ascii");r.data=i.base64.decode(t)}}}else r.data=e;switch(r.type){case o:!function(t){t.type=o;const e=t.data;t.bom=0,e.length>=3&&239===e[0]&&187===e[1]&&191===e[2]&&(t.bom=3)}(r);break;case s:case a:case u:!function(t){const e=t.data;switch(t.bom=0,t.type){case s:t.type=a,e.length>=2&&(254===e[0]&&255===e[1]?t.bom=2:255===e[0]&&254===e[1]&&(t.type=u,t.bom=2));break;case a:if(t.type=a,e.length>=2)if(254===e[0]&&255===e[1])t.bom=2;else if(255===e[0]&&254===e[1])throw new TypeError(`src type: "${a}" specified but BOM is for "${u}"`);break;case u:if(t.type=u,e.length>=0){if(254===e[0]&&255===e[1])throw new TypeError(`src type: "${u}" specified but BOM is for "${a}"`);255===e[0]&&254===e[1]&&(t.bom=2)}break;default:throw new TypeError(`UTF16 BOM: src type "${t.type}" unrecognized`)}}(r);break;case l:case h:case c:!function(t){const e=t.data;switch(t.bom=0,t.type){case l:t.type=h,e.length>=4&&(0===e[0]&&0===e[1]&&254===e[2]&&255===e[3]&&(t.bom=4),255===e[0]&&254===e[1]&&0===e[2]&&0===e[3]&&(t.type=c,t.bom=4));break;case h:if(t.type=h,e.length>=4&&(0===e[0]&&0===e[1]&&254===e[2]&&255===e[3]&&(t.bom=4),255===e[0]&&254===e[1]&&0===e[2]&&0===e[3]))throw new TypeError(`src type: ${h} specified but BOM is for ${c}"`);break;case c:if(t.type=c,e.length>=4){if(0===e[0]&&0===e[1]&&254===e[2]&&255===e[3])throw new TypeError(`src type: "${c}" specified but BOM is for "${h}"`);255===e[0]&&254===e[1]&&0===e[2]&&0===e[3]&&(t.bom=4)}break;default:throw new TypeError(`UTF32 BOM: src type "${t.type}" unrecognized`)}}(r);break;case g:r.type=y;break;case b:r.type=E;break;case d:r.type=f;break;case p:r.type=m;break;case f:case m:case v:case y:case w:case E:case A:case M:break;default:throw new TypeError(`type: "${t}" not recognized`)}if(r.type===A){if("string"!=typeof r.data)throw new TypeError(`type: "${t}" but data is not a string`)}else if(!Buffer.isBuffer(r.data))throw new TypeError(`type: "${t}" but data is not a Buffer`);return r}(t,e))},e.encode=function(t,e){let r,n;const N=function(t,e){if(!Array.isArray(e))throw new TypeError('dst chars: not array: "'+typeof e);if("string"!=typeof t)throw new TypeError('dst type: not string: "'+typeof t);const r=function(t){let e,r;const n={crlf:!1,lf:!1,base64:!1,type:""};for(;;){if(r=t,e=t.slice(0,5),"CRLF:"===e){n.crlf=!0,r=t.slice(5);break}if(e=t.slice(0,3),"LF:"===e){n.lf=!0,r=t.slice(3);break}break}return e=r.split(":"),1===e.length?n.type=e[0]:2===e.length&&"BASE64"===e[1]&&(n.base64=!0,n.type=e[0]),n}(t.toUpperCase());switch(r.type){case o:case a:case u:case h:case c:case f:case m:case v:case y:case w:case E:case M:break;case A:if(r.base64)throw new TypeError(`":BASE64" suffix not allowed with type ${A}`);break;case d:r.type=f;break;case p:r.type=m;break;case s:r.type=a;break;case l:r.type=h;break;case g:r.type=y;break;case b:r.type=E;break;default:throw new TypeError(`dst type unrecognized: "${t}" : must have form [crlf:|lf:]type[:base64]`)}return r}(t,e);return N.crlf?(r=i.lineEnds.crlf(e),n=_(N.type,r)):N.lf?(r=i.lineEnds.lf(e),n=_(N.type,r)):n=_(N.type,e),N.base64&&(n=i.base64.encode(n)),n},e.convert=function(t,e,r){return n.encode(r,n.decode(t,e))}},6322:function(t,e){const r=this,n=4294967292,i=4294967293,o=4294967294,s=4294967295,a=[0,1,3,7,15,31,63,127,255,511,1023],u=["00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F","10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F","20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F","30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F","40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F","50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F","60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F","70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F","80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F","90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF","B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF","C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF","D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF","F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"],l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),h=[];l.forEach((t=>{h.push(t.charCodeAt(0))})),e.utf8={encode(t){const e=[];return t.forEach((t=>{if(t>=0&&t<=127)e.push(t);else if(t<=2047)e.push(192+(t>>6&a[5])),e.push(128+(t&a[6]));else if(t<55296||t>57343&&t<=65535)e.push(224+(t>>12&a[4])),e.push(128+(t>>6&a[6])),e.push(128+(t&a[6]));else{if(!(t>=65536&&t<=1114111))throw new RangeError(`utf8.encode: character out of range: char: ${t}`);{const r=t>>16&a[5];e.push(240+(r>>2)),e.push(128+((r&a[2])<<4)+(t>>12&a[4])),e.push(128+(t>>6&a[6])),e.push(128+(t&a[6]))}}})),Buffer.from(e)},decode(t,e){function r(t,e){if(128!=(192&e))return i;const r=((t&a[5])<<6)+(e&a[6]);return r<128?n:r}function u(t,e,r){if(128!=(192&r)||128!=(192&e))return i;const s=((t&a[4])<<12)+((e&a[6])<<6)+(r&a[6]);return s<2048?n:s>=55296&&s<=57343?o:s}function l(t,e,r,s){if(128!=(192&s)||128!=(192&r)||128!=(192&e))return i;const u=(((t&a[3])<<2)+(e>>4&a[2])<<16)+((e&a[4])<<12)+((r&a[6])<<6)+(s&a[6]);return u<65536?n:u>1114111?o:u}let h,c,f,d,p,m;const g=t.length;let v=e?3:0;const y=[];for(;v=0&&c<=127){h=c,m=1;break}if(f=v+1,f=194&&c<=223){h=r(c,t[f]),m=2;break}if(d=v+2,d=224&&c<=239){h=u(c,t[f],t[d]),m=3;break}if(p=v+3,p=240&&c<=244){h=l(c,t[f],t[d],t[p]),m=4;break}break}if(h>1114111){const t=`byte[${v}]`;if(h===s)throw new RangeError(`utf8.decode: ill-formed UTF8 byte sequence found at: ${t}`);if(h===i)throw new RangeError(`utf8.decode: illegal trailing byte found at: ${t}`);if(h===o)throw new RangeError(`utf8.decode: code point out of range found at: ${t}`);if(h===n)throw new RangeError(`utf8.decode: non-shortest form found at: ${t}`);throw new RangeError(`utf8.decode: unrecognized error found at: ${t}`)}y.push(h),v+=m}return y}},e.utf16be={encode(t){const e=[];let r,n,i;for(let o=0;o=0&&r<=55295||r>=57344&&r<=65535)e.push(r>>8&a[8]),e.push(r&a[8]);else{if(!(r>=65536&&r<=1114111))throw new RangeError(`utf16be.encode: UTF16BE value out of range: char[${o}]: ${r}`);i=r-65536,n=55296+(i>>10),i=56320+(i&a[10]),e.push(n>>8&a[8]),e.push(n&a[8]),e.push(i>>8&a[8]),e.push(i&a[8])}return Buffer.from(e)},decode(t,e){if(t.length%2>0)throw new RangeError(`utf16be.decode: data length must be even multiple of 2: length: ${t.length}`);const r=[],n=t.length;let i,o,s,a,u,l,h=e?2:0,c=0;for(;h57343){i=u,o=2;break}if(a=h+3,a=56320&&l<=57343)){i=65536+(u-55296<<10)+(l-56320),o=4;break}}throw new RangeError(`utf16be.decode: ill-formed UTF16BE byte sequence found: byte[${h}]`)}r[c++]=i,h+=o}return r}},e.utf16le={encode(t){const e=[];let r,n,i;for(let o=0;o=0&&r<=55295||r>=57344&&r<=65535)e.push(r&a[8]),e.push(r>>8&a[8]);else{if(!(r>=65536&&r<=1114111))throw new RangeError(`utf16le.encode: UTF16LE value out of range: char[${o}]: ${r}`);i=r-65536,n=55296+(i>>10),i=56320+(i&a[10]),e.push(n&a[8]),e.push(n>>8&a[8]),e.push(i&a[8]),e.push(i>>8&a[8])}return Buffer.from(e)},decode(t,e){if(t.length%2>0)throw new RangeError(`utf16le.decode: data length must be even multiple of 2: length: ${t.length}`);const r=[],n=t.length;let i,o,s,a,u,l,h=e?2:0,c=0;for(;h57343){i=u,o=2;break}if(a=h+3,a=56320&&l<=57343)){i=65536+(u-55296<<10)+(l-56320),o=4;break}}throw new RangeError(`utf16le.decode: ill-formed UTF16LE byte sequence found: byte[${h}]`)}r[c++]=i,h+=o}return r}},e.utf32be={encode(t){const e=Buffer.alloc(4*t.length);let r=0;return t.forEach((t=>{if(t>=55296&&t<=57343||t>1114111)throw new RangeError(`utf32be.encode: UTF32BE character code out of range: char[${r/4}]: ${t}`);e[r++]=t>>24&a[8],e[r++]=t>>16&a[8],e[r++]=t>>8&a[8],e[r++]=t&a[8]})),e},decode(t,e){if(t.length%4>0)throw new RangeError(`utf32be.decode: UTF32BE byte length must be even multiple of 4: length: ${t.length}`);const r=[];let n=e?4:0;for(;n=55296&&e<=57343||e>1114111)throw new RangeError(`utf32be.decode: UTF32BE character code out of range: char[${n/4}]: ${e}`);r.push(e)}return r}},e.utf32le={encode(t){const e=Buffer.alloc(4*t.length);let r=0;return t.forEach((t=>{if(t>=55296&&t<=57343||t>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${r/4}]: ${t}`);e[r++]=t&a[8],e[r++]=t>>8&a[8],e[r++]=t>>16&a[8],e[r++]=t>>24&a[8]})),e},decode(t,e){if(t.length%4>0)throw new RangeError(`utf32be.decode: UTF32LE byte length must be even multiple of 4: length: ${t.length}`);const r=[];let n=e?4:0;for(;n=55296&&e<=57343||e>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${n/4}]: ${e}`);r.push(e)}return r}},e.uint7={encode(t){const e=Buffer.alloc(t.length);for(let r=0;r127)throw new RangeError(`uint7.encode: UINT7 character code out of range: char[${r}]: ${t[r]}`);e[r]=t[r]}return e},decode(t){const e=[];for(let r=0;r127)throw new RangeError(`uint7.decode: UINT7 character code out of range: byte[${r}]: ${t[r]}`);e[r]=t[r]}return e}},e.uint8={encode(t){const e=Buffer.alloc(t.length);for(let r=0;r255)throw new RangeError(`uint8.encode: UINT8 character code out of range: char[${r}]: ${t[r]}`);e[r]=t[r]}return e},decode(t){const e=[];for(let r=0;r{if(t>65535)throw new RangeError(`uint16be.encode: UINT16BE character code out of range: char[${r/2}]: ${t}`);e[r++]=t>>8&a[8],e[r++]=t&a[8]})),e},decode(t){if(t.length%2>0)throw new RangeError(`uint16be.decode: UINT16BE byte length must be even multiple of 2: length: ${t.length}`);const e=[];for(let r=0;r{if(t>65535)throw new RangeError(`uint16le.encode: UINT16LE character code out of range: char[${r/2}]: ${t}`);e[r++]=t&a[8],e[r++]=t>>8&a[8]})),e},decode(t){if(t.length%2>0)throw new RangeError(`uint16le.decode: UINT16LE byte length must be even multiple of 2: length: ${t.length}`);const e=[];for(let r=0;r{e[r++]=t>>24&a[8],e[r++]=t>>16&a[8],e[r++]=t>>8&a[8],e[r++]=t&a[8]})),e},decode(t){if(t.length%4>0)throw new RangeError(`uint32be.decode: UINT32BE byte length must be even multiple of 4: length: ${t.length}`);const e=[];for(let r=0;r{e[r++]=t&a[8],e[r++]=t>>8&a[8],e[r++]=t>>16&a[8],e[r++]=t>>24&a[8]})),e},decode(t){if(t.length%4>0)throw new RangeError(`uint32le.decode: UINT32LE byte length must be even multiple of 4: length: ${t.length}`);const e=[];for(let r=0;rr.utf16le.encode(t).toString("utf16le"),decode:t=>r.utf16le.decode(Buffer.from(t,"utf16le"),0)},e.escaped={encode(t){const e=[];for(let r=0;r=32&&n<=126)e.push(n);else{let t="";if(n>=0&&n<=31)t+=`\`x${u[n]}`;else if(n>=127&&n<=255)t+=`\`x${u[n]}`;else if(n>=256&&n<=65535)t+=`\`u${u[n>>8&a[8]]}${u[n&a[8]]}`;else{if(!(n>=65536&&n<=4294967295))throw new Error("escape.encode(char): char > 0xffffffff not allowed");{t+="`u{";const e=n>>24&a[8];e>0&&(t+=u[e]),t+=`${u[n>>16&a[8]]+u[n>>8&a[8]]+u[n&a[8]]}}`}}Buffer.from(t).forEach((t=>{e.push(t)}))}}return Buffer.from(e)},decode(t){function e(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function r(t,r,n){const i={char:null,nexti:t+2,error:!0};if(t+1=s)break;if(96===t[a]){o.push(96),h+=2,l=!1;break}if(120===t[a]){if(u=r(a+1,s,t),u.error)break;o.push(u.char),h=u.nexti,l=!1;break}if(117===t[a]){if(123===t[a+1]){if(u=i(a+2,s,t),u.error)break;o.push(u.char),h=u.nexti,l=!1;break}if(u=n(a+1,s,t),u.error)break;o.push(u.char),h=u.nexti,l=!1;break}break}if(l)throw new Error(`escaped.decode: ill-formed escape sequence at buf[${h}]`)}return o}};const c=10;e.lineEnds={crlf(t){const e=[];let r=0;for(;r0&&e[e.length-1]!==c&&(e.push(13),e.push(c)),e},lf(t){const e=[];let r=0;for(;r0&&e[e.length-1]!==c&&e.push(c),e}},e.base64={encode(t){if(0===t.length)return Buffer.alloc(0);let e,r,n,i=t.length%3;i=i>0?3-i:0;let o=(t.length+i)/3;const s=Buffer.alloc(4*o);i>0&&(o-=1),e=0,r=0;for(let i=0;i>18&a[6]],s[r++]=h[n>>12&a[6]],s[r++]=h[n>>6&a[6]],s[r++]=h[n&a[6]];return 0===i?s:1===i?(n=t[e++]<<16,n+=t[e]<<8,s[r++]=h[n>>18&a[6]],s[r++]=h[n>>12&a[6]],s[r++]=h[n>>6&a[6]],s[r]=h[64],s):2===i?(n=t[e]<<16,s[r++]=h[n>>18&a[6]],s[r++]=h[n>>12&a[6]],s[r++]=h[64],s[r]=h[64],s):void 0},decode(t){if(0===t.length)return Buffer.alloc(0);const e=function(t){const e=[];let r=0;for(let n=0;n=65&&i<=90){e.push(i-65);break}if(i>=97&&i<=122){e.push(i-71);break}if(i>=48&&i<=57){e.push(i+4);break}if(43===i){e.push(62);break}if(47===i){e.push(63);break}if(61===i){e.push(64),r+=1;break}throw new RangeError(`base64.decode: invalid character buf[${n}]: ${i}`)}}if(e.length%4>0)throw new RangeError(`base64.decode: string length not integral multiple of 4: ${e.length}`);switch(r){case 0:break;case 1:if(64!==e[e.length-1])throw new RangeError("base64.decode: one tail character found: not last character");break;case 2:if(64!==e[e.length-1]||64!==e[e.length-2])throw new RangeError("base64.decode: two tail characters found: not last characters");break;default:throw new RangeError(`base64.decode: more than two tail characters found: ${r}`)}return{tail:r,buf:Buffer.from(e)}}(t),{tail:r}=e,n=e.buf;let i,o,s,u=n.length/4;const l=Buffer.alloc(3*u-r);r>0&&(u-=1),o=0,i=0;for(let t=0;t>16&a[8],l[o++]=s>>8&a[8],l[o++]=s&a[8];return 1===r&&(s=n[i++]<<18,s+=n[i++]<<12,s+=n[i]<<6,l[o++]=s>>16&a[8],l[o]=s>>8&a[8]),2===r&&(s=n[i++]<<18,s+=n[i++]<<12,l[o]=s>>16&a[8]),l},toString(t){if(t.length%4>0)throw new RangeError(`base64.toString: input buffer length not multiple of 4: ${t.length}`);let e="",r=0;function n(t,n,i,o){switch(r){case 76:e+=`\r\n${t}${n}${i}${o}`,r=4;break;case 75:e+=`${t}\r\n${n}${i}${o}`,r=3;break;case 74:e+=`${t+n}\r\n${i}${o}`,r=2;break;case 73:e+=`${t+n+i}\r\n${o}`,r=1;break;default:e+=t+n+i+o,r+=4}}for(let e=0;e=65&&i<=90||i>=97&&i<=122||i>=48&&i<=57||43===i||47===i||61===i))throw new RangeError(`base64.toString: buf[${r}]: ${t[r]} : not valid base64 character code`);n(String.fromCharCode(t[e]),String.fromCharCode(t[e+1]),String.fromCharCode(t[e+2]),String.fromCharCode(t[e+3]))}var i;return e}}},580:(t,e,r)=>{t.exports=function(){const t=r(8276),e=r(8544),n=this;let i=null,o=null,s=null,a=0;const u=[],l=[],h=[],c=[];function f(t){let e="";for(let r=0;r0?c[t-1].stack:0},this.getLength=function(){return c.length},this.toXml=function(r){let n=e.charsToDec,i="decimal integer character codes";if("string"==typeof r&&r.length>=3){const t=r.slice(0,3).toLowerCase();"asc"===t?(n=e.charsToAscii,i="ASCII for printing characters, hex for non-printing"):"hex"===t?(n=e.charsToHex,i="hexadecimal integer character codes"):"uni"===t&&(n=e.charsToUnicode,i="Unicode UTF-32 integer character codes")}let o="",a=0;return o+='\n',o+=`\n`,o+=`\x3c!-- input string, ${i} --\x3e\n`,o+=f(a+2),o+=n(s),o+="\n",c.forEach((e=>{e.state===t.SEM_PRE?(a+=1,o+=f(a),o+=`\n`,o+=f(a+2),o+=n(s,e.phraseIndex,e.phraseLength),o+="\n"):(o+=f(a),o+=`\x3c!-- name="${e.name}" --\x3e\n`,a-=1)})),o+="\n",o},this.phrases=function(){const e={};let r,n;for(r=0;r{t.exports=function(){let t=-1,e=0;this.init=function(r){if("number"!=typeof r||r<=0)throw new Error("circular-buffer.js: init: circular buffer size must an integer > 0");e=Math.ceil(r),t=-1},this.increment=function(){return t+=1,(t+e)%e},this.maxSize=function(){return e},this.items=function(){return t+1},this.getListIndex=function(r){return-1===t||r<0||r>t||t-r>=e?-1:(r+e)%e},this.forEach=function(r){if(-1!==t)if(t{t.exports=function(){return"/* This file automatically generated by jsonToless() and LESS. */\n.apg-mono {\n font-family: monospace;\n}\n.apg-active {\n font-weight: bold;\n color: #000000;\n}\n.apg-match {\n font-weight: bold;\n color: #264BFF;\n}\n.apg-empty {\n font-weight: bold;\n color: #0fbd0f;\n}\n.apg-nomatch {\n font-weight: bold;\n color: #FF4000;\n}\n.apg-lh-match {\n font-weight: bold;\n color: #1A97BA;\n}\n.apg-lb-match {\n font-weight: bold;\n color: #5F1687;\n}\n.apg-remainder {\n font-weight: bold;\n color: #999999;\n}\n.apg-ctrl-char {\n font-weight: bolder;\n font-style: italic;\n font-size: 0.6em;\n}\n.apg-line-end {\n font-weight: bold;\n color: #000000;\n}\n.apg-error {\n font-weight: bold;\n color: #FF4000;\n}\n.apg-phrase {\n color: #000000;\n background-color: #8caae6;\n}\n.apg-empty-phrase {\n color: #0fbd0f;\n}\ntable.apg-state {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: left;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-state th,\ntable.apg-state td {\n text-align: left;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-state th:nth-last-child(2),\ntable.apg-state td:nth-last-child(2) {\n text-align: right;\n}\ntable.apg-state caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-stats {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-stats th,\ntable.apg-stats td {\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-stats caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-trace {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-trace caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-trace th,\ntable.apg-trace td {\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-trace th:last-child,\ntable.apg-trace th:nth-last-child(2),\ntable.apg-trace td:last-child,\ntable.apg-trace td:nth-last-child(2) {\n text-align: left;\n}\ntable.apg-grammar {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-grammar caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-grammar th,\ntable.apg-grammar td {\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-grammar th:last-child,\ntable.apg-grammar td:last-child {\n text-align: left;\n}\ntable.apg-rules {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-rules caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-rules th,\ntable.apg-rules td {\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-rules a {\n color: #003399 !important;\n}\ntable.apg-rules a:hover {\n color: #8caae6 !important;\n}\ntable.apg-attrs {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: center;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-attrs caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-attrs th,\ntable.apg-attrs td {\n text-align: center;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-attrs th:nth-child(1),\ntable.apg-attrs th:nth-child(2),\ntable.apg-attrs th:nth-child(3) {\n text-align: right;\n}\ntable.apg-attrs td:nth-child(1),\ntable.apg-attrs td:nth-child(2),\ntable.apg-attrs td:nth-child(3) {\n text-align: right;\n}\ntable.apg-attrs a {\n color: #003399 !important;\n}\ntable.apg-attrs a:hover {\n color: #8caae6 !important;\n}\n"}},8276:t=>{t.exports={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,BKR:14,BKA:15,BKN:16,ABG:17,AEN:18,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,SEM_SKIP:301,ATTR_N:400,ATTR_R:401,ATTR_MR:402,LOOKAROUND_NONE:500,LOOKAROUND_AHEAD:501,LOOKAROUND_BEHIND:502,BKR_MODE_UM:601,BKR_MODE_PM:602,BKR_MODE_CS:603,BKR_MODE_CI:604}},8737:(t,e,r)=>{t.exports={ast:r(580),circular:r(2761),ids:r(8276),parser:r(8629),stats:r(5403),trace:r(9290),utils:r(8544),emitcss:r(1593),style:r(3932)}},8629:(t,e,r)=>{t.exports=function(){const t=r(8276),e=r(8544),n="parser.js: ",i=this;let o;this.ast=null,this.stats=null,this.trace=null,this.callbacks=[];let s,a,u,l,h=null,c=null,f=0,d=0,p=0,m=null,g=null,v=null,y=null,b=null,w=0,E=1/0,M=1/0;const A=function(e,r,i){const s=`${n}evaluateRule(): `;if(e>=v.length)throw new Error(`${s}rule index: ${e} out of range`);if(r>=u)throw new Error(`${s}phrase index: ${r} out of range`);const{length:a}=h;h.push({type:t.RNM,index:e}),o(a,r,i),h.pop()},_=function(e,r,i){const s=`${n}evaluateUdt(): `;if(e>=y.length)throw new Error(`${s}udt index: ${e} out of range`);if(r>=u)throw new Error(`${s}phrase index: ${r} out of range`);const{length:a}=h;h.push({type:t.UDT,empty:y[e].empty,index:e}),o(a,r,i),h.pop()},N=function(){f=0,d=0,p=0,w=0,l=[{lookAround:t.LOOKAROUND_NONE,anchor:0,charsEnd:0,charsLength:0}],v=null,y=null,c=null,s=0,a=0,u=0,m=null,g=null,b=null,h=null},S=function(){const t=[];this.push=function(){t.push(function(){const e=t[t.length-1],r={};for(const t in e)r[t]=e[t];return r}())},this.pop=function(e){let r=e;if(r||(r=t.length-1),r<1||r>t.length)throw new Error(`${n}backRef.pop(): bad length: ${r}`);return t.length=r,t[t.length-1]},this.length=function(){return t.length},this.savePhrase=function(e,r,n){t[t.length-1][e]={phraseIndex:r,phraseLength:n}},this.getPhrase=function(e){return t[t.length-1][e]},function(){const e={};v.forEach((t=>{t.isBkr&&(e[t.lower]=null)})),y.length>0&&y.forEach((t=>{t.isBkr&&(e[t.lower]=null)})),t.push(e)}()},T=function(){const e=this;this.state=t.ACTIVE,this.phraseLength=0,this.ruleIndex=0,this.udtIndex=0,this.lookAround=l[l.length-1],this.uFrame=new S,this.pFrame=new S,this.evaluateRule=A,this.evaluateUdt=_,this.refresh=function(){e.state=t.ACTIVE,e.phraseLength=0,e.lookAround=l[l.length-1]}},k=function(){return l[l.length-1]},R=function(){return l.length>1},x=function(t,r,i){const o=`${n}initializeInputChars(): `;let l=t,h=r,f=i;if(void 0===l)throw new Error(`${o}input string is undefined`);if(null===l)throw new Error(`${o}input string is null`);if("string"==typeof l)l=e.stringToChars(l);else if(!Array.isArray(l))throw new Error(`${o}input string is not a string or array`);if(l.length>0&&"number"!=typeof l[0])throw new Error(`${o}input string not an array of integers`);if("number"!=typeof h)h=0;else if(h=Math.floor(h),h<0||h>l.length)throw new Error(`${o}input beginning index out of range: ${h}`);if("number"!=typeof f)f=l.length-h;else if(f=Math.floor(f),f<0||f>l.length-h)throw new Error(`${o}input length out of range: ${f}`);c=l,s=h,a=f,u=s+a};this.setMaxTreeDepth=function(t){if("number"!=typeof t)throw new Error(`parser: max tree depth must be integer > 0: ${t}`);if(E=Math.floor(t),E<=0)throw new Error(`parser: max tree depth must be integer > 0: ${t}`)},this.setMaxNodeHits=function(t){if("number"!=typeof t)throw new Error(`parser: max node hits must be integer > 0: ${t}`);if(M=Math.floor(t),M<=0)throw new Error(`parser: max node hits must be integer > 0: ${t}`)};const O=function(e,r,l){let f;const E=`${n}parse(): `;!function(t){const e=`${n}initializeGrammar(): `;if(!t)throw new Error(`${e}grammar object undefined`);if("grammarObject"!==t.grammarObject)throw new Error(`${e}bad grammar object`);v=t.rules,y=t.udts}(e);const M=function(t){const e=`${n}initializeStartRule(): `;let r=null;if("number"==typeof t){if(t>=v.length)throw new Error(`${e}start rule index too large: max: ${v.length}: index: ${t}`);r=t}else{if("string"!=typeof t)throw new Error(`${e}type of start rule '${typeof t}' not recognized`);{const n=t.toLowerCase();for(let t=0;ti){let t=`${n}opRNM(${e.name}): callback function error: `;throw t+=`sysData.phraseLength: ${r.phraseLength}`,t+=` must be <= remaining chars: ${i}`,new Error(t)}switch(r.state){case t.ACTIVE:if(!0!==o)throw new Error(`${n}opRNM(${e.name}): callback function return error. ACTIVE state not allowed.`);break;case t.EMPTY:r.phraseLength=0;break;case t.MATCH:0===r.phraseLength&&(r.state=t.EMPTY);break;case t.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opRNM(${e.name}): callback function return error. Unrecognized return state: ${r.state}`)}},P=function(e,r,n){let s,a,l,f,d,p;const g=h[e],y=v[g.index],w=m[y.index],E=!R();if(E&&(a=i.ast&&i.ast.ruleDefined(g.index),a&&(s=i.ast.getLength(),i.ast.down(g.index,v[g.index].name)),f=n.uFrame.length(),d=n.pFrame.length(),n.uFrame.push(),n.pFrame.push(),p=n.pFrame,n.pFrame=new S),null===w)l=h,h=y.opcodes,o(0,r,n),h=l;else{const e=u-r;n.ruleIndex=y.index,w(n,c,r,b),C(y,n,e,!0),n.state===t.ACTIVE&&(l=h,h=y.opcodes,o(0,r,n),h=l,n.ruleIndex=y.index,w(n,c,r,b),C(y,n,e,!1))}E&&(a&&(n.state===t.NOMATCH?i.ast.setLength(s):i.ast.up(g.index,y.name,r,n.phraseLength)),n.pFrame=p,n.state===t.NOMATCH?(n.uFrame.pop(f),n.pFrame.pop(d)):y.isBkr&&(n.pFrame.savePhrase(y.lower,r,n.phraseLength),n.uFrame.savePhrase(y.lower,r,n.phraseLength)))},L=function(e,r,o){let s,a,l,f,d,p;const m=h[e],w=y[m.index];o.UdtIndex=w.index;const E=!R();E&&(l=i.ast&&i.ast.udtDefined(m.index),l&&(a=v.length+m.index,s=i.ast.getLength(),i.ast.down(a,w.name)),f=o.uFrame.length(),d=o.pFrame.length(),o.uFrame.push(),o.pFrame.push(),p=o.pFrame,o.pFrame=new S);const M=u-r;g[m.index](o,c,r,b),function(e,r,i){if(r.phraseLength>i){let t=`${n}opUDT(${e.name}): callback function error: `;throw t+=`sysData.phraseLength: ${r.phraseLength}`,t+=` must be <= remaining chars: ${i}`,new Error(t)}switch(r.state){case t.ACTIVE:throw new Error(`${n}opUDT(${e.name}): callback function return error. ACTIVE state not allowed.`);case t.EMPTY:if(!1===e.empty)throw new Error(`${n}opUDT(${e.name}): callback function return error. May not return EMPTY.`);r.phraseLength=0;break;case t.MATCH:if(0===r.phraseLength){if(!1===e.empty)throw new Error(`${n}opUDT(${e.name}): callback function return error. May not return EMPTY.`);r.state=t.EMPTY}break;case t.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opUDT(${e.name}): callback function return error. Unrecognized return state: ${r.state}`)}}(w,o,M),E&&(l&&(o.state===t.NOMATCH?i.ast.setLength(s):i.ast.up(a,w.name,r,o.phraseLength)),o.pFrame=p,o.state===t.NOMATCH?(o.uFrame.pop(f),o.pFrame.pop(d)):w.isBkr&&(o.pFrame.savePhrase(w.lower,r,o.phraseLength),o.uFrame.savePhrase(w.lower,r,o.phraseLength)))},U=function(e,r,n){l.push({lookAround:t.LOOKAROUND_AHEAD,anchor:r,charsEnd:u,charsLength:a}),u=c.length,a=c.length-s,o(e+1,r,n);const i=l.pop();switch(u=i.charsEnd,a=i.charsLength,n.phraseLength=0,n.state){case t.EMPTY:case t.MATCH:n.state=t.EMPTY;break;case t.NOMATCH:n.state=t.NOMATCH;break;default:throw new Error(`opAND: invalid state ${n.state}`)}},B=function(e,r,n){l.push({lookAround:t.LOOKAROUND_AHEAD,anchor:r,charsEnd:u,charsLength:a}),u=c.length,a=c.length-s,o(e+1,r,n);const i=l.pop();switch(u=i.charsEnd,a=i.charsLength,n.phraseLength=0,n.state){case t.EMPTY:case t.MATCH:n.state=t.NOMATCH;break;case t.NOMATCH:n.state=t.EMPTY;break;default:throw new Error(`opNOT: invalid state ${n.state}`)}},D=function(e,r,n){n.state=t.NOMATCH,n.phraseLength=0,n.state=0===r?t.EMPTY:t.NOMATCH},F=function(e,r,n){n.state=t.NOMATCH,n.phraseLength=0,n.state=r===c.length?t.EMPTY:t.NOMATCH},G=function(e,r,n){switch(l.push({lookAround:t.LOOKAROUND_BEHIND,anchor:r}),o(e+1,r,n),l.pop(),n.phraseLength=0,n.state){case t.EMPTY:case t.MATCH:n.state=t.EMPTY;break;case t.NOMATCH:n.state=t.NOMATCH;break;default:throw new Error(`opBKA: invalid state ${n.state}`)}},j=function(e,r,n){switch(l.push({lookAround:t.LOOKAROUND_BEHIND,anchor:r}),o(e+1,r,n),l.pop(),n.phraseLength=0,n.state){case t.EMPTY:case t.MATCH:n.state=t.NOMATCH;break;case t.NOMATCH:n.state=t.EMPTY;break;default:throw new Error(`opBKN: invalid state ${n.state}`)}};o=function(e,r,n){let s=!0;const a=h[e];if(p+=1,p>M)throw new Error(`parser: maximum number of node hits exceeded: ${M}`);if(f+=1,f>d&&(d=f,d>E))throw new Error(`parser: maximum parse tree depth exceeded: ${E}`);if(n.refresh(),null!==i.trace){const t=k();i.trace.down(a,n.state,r,n.phraseLength,t.anchor,t.lookAround)}if(l[l.length-1].lookAround===t.LOOKAROUND_BEHIND)switch(a.type){case t.ALT:I(e,r,n);break;case t.CAT:!function(e,r,n){let s,a,u,l;const c=h[e],f=n.uFrame.length(),d=n.pFrame.length();i.ast&&(a=i.ast.getLength()),s=!0,u=r,l=0;for(let e=c.children.length-1;e>=0;e-=1)if(o(c.children[e],u,n),u-=n.phraseLength,l+=n.phraseLength,n.state===t.NOMATCH){s=!1;break}s?(n.state=0===l?t.EMPTY:t.MATCH,n.phraseLength=l):(n.state=t.NOMATCH,n.phraseLength=0,n.uFrame.pop(f),n.pFrame.pop(d),i.ast&&i.ast.setLength(a))}(e,r,n);break;case t.REP:!function(e,r,n){let s,a,u,l;const c=h[e];a=r,u=0,l=0;const f=n.uFrame.length(),d=n.pFrame.length();for(i.ast&&(s=i.ast.getLength());!(a<=0)&&(o(e+1,a,n),n.state!==t.NOMATCH)&&n.state!==t.EMPTY&&(l+=1,u+=n.phraseLength,a-=n.phraseLength,l!==c.max););n.state===t.EMPTY||l>=c.min?(n.state=0===u?t.EMPTY:t.MATCH,n.phraseLength=u):(n.state=t.NOMATCH,n.phraseLength=0,n.uFrame.pop(f),n.pFrame.pop(d),i.ast&&i.ast.setLength(s))}(e,r,n);break;case t.RNM:P(e,r,n);break;case t.UDT:L(e,r,n);break;case t.AND:U(e,r,n);break;case t.NOT:B(e,r,n);break;case t.TRG:!function(e,r,n){const i=h[e];if(n.state=t.NOMATCH,n.phraseLength=0,r>0){const e=c[r-1];i.min<=e&&e<=i.max&&(n.state=t.MATCH,n.phraseLength=1)}}(e,r,n);break;case t.TBS:!function(e,r,n){let i;const o=h[e];n.state=t.NOMATCH;const s=o.string.length,a=r-s;if(a>=0){for(i=0;i=0){for(let t=0;t=65&&i<=90&&(i+=32),i!==o.string[t])return;n.state=t.MATCH,n.phraseLength=s}}(e,r,n);break;case t.BKR:!function(e,r,n){let i,o,s,a;const u=h[e];n.state=t.NOMATCH,n.phraseLength=0,a=u.index=0){if(f){for(i=0;i=65&&o<=90&&(o+=32),s>=65&&s<=90&&(s+=32),o!==s)return;n.state=t.MATCH,n.phraseLength=p}else for(i=0;i=u)&&(o(e+1,a,n),n.state!==t.NOMATCH)&&n.state!==t.EMPTY&&(c+=1,l+=n.phraseLength,a+=n.phraseLength,c!==f.max););n.state===t.EMPTY||c>=f.min?(n.state=0===l?t.EMPTY:t.MATCH,n.phraseLength=l):(n.state=t.NOMATCH,n.phraseLength=0,n.uFrame.pop(d),n.pFrame.pop(p),i.ast&&i.ast.setLength(s))}(e,r,n);break;case t.RNM:P(e,r,n);break;case t.UDT:L(e,r,n);break;case t.AND:U(e,r,n);break;case t.NOT:B(e,r,n);break;case t.TRG:!function(e,r,n){const i=h[e];n.state=t.NOMATCH,r=65&&o<=90&&(o+=32),o!==s.string[i])return;n.state=t.MATCH,n.phraseLength=a}}else n.state=t.EMPTY}(e,r,n);break;case t.BKR:!function(e,r,n){let i,o,s,a;const l=h[e];n.state=t.NOMATCH,a=l.index=65&&o<=90&&(o+=32),s>=65&&s<=90&&(s+=32),o!==s)return;n.state=t.MATCH,n.phraseLength=m}else for(i=0;iw&&(w=r+n.phraseLength),null!==i.stats&&i.stats.collect(a,n),null!==i.trace){const t=k();i.trace.up(a,n.state,r,n.phraseLength,t.anchor,t.lookAround)}return f-=1,s}}},5403:(t,e,r)=>{t.exports=function(){const t=r(8276),e=r(8544),n=r(3932);let i=[],o=[];const s=[];let a;const u=[],l=[];this.statsObject="statsObject";const h=function(t,e){return t.lowere.lower?1:0},c=function(t,e){return t.totale.total?-1:h(t,e)},f=function(t,e){return t.indexe.index?1:0},d=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},p=function(e,r){switch(e.total+=1,r){case t.EMPTY:e.empty+=1;break;case t.MATCH:e.match+=1;break;case t.NOMATCH:e.nomatch+=1;break;default:throw new Error(`stats.js: collect(): incStat(): unrecognized state: ${r}`)}},m=function(t,e){let r="";return r+="",r+=`${t}`,r+=`${e.empty}`,r+=`${e.match}`,r+=`${e.nomatch}`,r+=`${e.total}`,r+="\n",r},g=function(){let e="";return e+=m("ALT",s[t.ALT]),e+=m("CAT",s[t.CAT]),e+=m("REP",s[t.REP]),e+=m("RNM",s[t.RNM]),e+=m("TRG",s[t.TRG]),e+=m("TBS",s[t.TBS]),e+=m("TLS",s[t.TLS]),e+=m("UDT",s[t.UDT]),e+=m("AND",s[t.AND]),e+=m("NOT",s[t.NOT]),e+=m("BKR",s[t.BKR]),e+=m("BKA",s[t.BKA]),e+=m("BKN",s[t.BKN]),e+=m("ABG",s[t.ABG]),e+=m("AEN",s[t.AEN]),e+=m("totals",a),e},v=function(){let t="";t+="\n",t+="rules\n";for(let e=0;e0&&(t+="",t+=`${u[e].name}`,t+=`${u[e].empty}`,t+=`${u[e].match}`,t+=`${u[e].nomatch}`,t+=`${u[e].total}`,t+="\n");if(o.length>0){t+="\n",t+="udts\n";for(let e=0;e0&&(t+="",t+=`${l[e].name}`,t+=`${l[e].empty}`,t+=`${l[e].match}`,t+=`${l[e].nomatch}`,t+=`${l[e].total}`,t+="\n")}return t};this.validate=function(t){let e=!1;return"string"==typeof t&&"stats"===t&&(e=!0),e},this.init=function(e,r){i=e,o=r,function(){s.length=0,a=new d,s[t.ALT]=new d,s[t.CAT]=new d,s[t.REP]=new d,s[t.RNM]=new d,s[t.TRG]=new d,s[t.TBS]=new d,s[t.TLS]=new d,s[t.UDT]=new d,s[t.AND]=new d,s[t.NOT]=new d,s[t.BKR]=new d,s[t.BKA]=new d,s[t.BKN]=new d,s[t.ABG]=new d,s[t.AEN]=new d,u.length=0;for(let t=0;t0){l.length=0;for(let t=0;t\n`,"string"==typeof e&&(r+=`${e}\n`),r+=`ops\n`,r+=`EMPTY\n`,r+=`MATCH\n`,r+=`NOMATCH\n`,r+=`totals\n`;;){if(void 0===t){r+=g();break}if(null===t){r+=g();break}if("ops"===t){r+=g();break}if("index"===t){u.sort(f),l.length>0&&l.sort(f),r+=g(),r+=v();break}if("hits"===t){u.sort(c),l.length>0&&l.sort(f),r+=g(),r+=v();break}if("alpha"===t){u.sort(h),l.length>0&&l.sort(h),r+=g(),r+=v();break}break}return r+="\n",r},this.toHtmlPage=function(t,r,n){return e.htmlToPage(this.toHtml(t,r),n)}}},3932:t=>{t.exports={CLASS_MONOSPACE:"apg-mono",CLASS_ACTIVE:"apg-active",CLASS_EMPTY:"apg-empty",CLASS_MATCH:"apg-match",CLASS_NOMATCH:"apg-nomatch",CLASS_LOOKAHEAD:"apg-lh-match",CLASS_LOOKBEHIND:"apg-lb-match",CLASS_REMAINDER:"apg-remainder",CLASS_CTRLCHAR:"apg-ctrl-char",CLASS_LINEEND:"apg-line-end",CLASS_ERROR:"apg-error",CLASS_PHRASE:"apg-phrase",CLASS_EMPTYPHRASE:"apg-empty-phrase",CLASS_STATE:"apg-state",CLASS_STATS:"apg-stats",CLASS_TRACE:"apg-trace",CLASS_GRAMMAR:"apg-grammar",CLASS_RULES:"apg-rules",CLASS_RULESLINK:"apg-rules-link",CLASS_ATTRIBUTES:"apg-attrs"}},9290:(t,e,r)=>{t.exports=function(){const t=r(8544),e=r(3932),n=new(r(2761)),i=r(8276),o="trace.js: ",s=this,a=16,u=80,l=[];let h=5e3,c=-1,f=0,d=0;const p=[];let m=null,g=null,v=null;const y=[],b=[],w=``,E=``,M=`𝜺`;this.traceObject="traceObject",this.filter={operators:[],rules:[]},this.setMaxRecords=function(t,e){c=-1,"number"==typeof t&&t>0?(h=Math.ceil(t),"number"==typeof e&&(c=Math.floor(e),c<0&&(c=-1))):h=0},this.getMaxRecords=function(){return h},this.getLastRecord=function(){return c},this.init=function(t,e,r){l.length=0,p.length=0,f=0,d=0,m=r,g=t,v=e,function(){const t=function(t){y[i.ALT]=t,y[i.CAT]=t,y[i.REP]=t,y[i.TLS]=t,y[i.TBS]=t,y[i.TRG]=t,y[i.AND]=t,y[i.NOT]=t,y[i.BKR]=t,y[i.BKA]=t,y[i.BKN]=t,y[i.ABG]=t,y[i.AEN]=t};let e=0;for(const t in s.filter.operators)e+=1;if(0!==e){for(const e in s.filter.operators){const r=e.toUpperCase();if(""===r)return void t(!0);if(""===r)return void t(!1)}t(!1);for(const t in s.filter.operators){const e=t.toUpperCase();if("ALT"===e)y[i.ALT]=!0===s.filter.operators[t];else if("CAT"===e)y[i.CAT]=!0===s.filter.operators[t];else if("REP"===e)y[i.REP]=!0===s.filter.operators[t];else if("AND"===e)y[i.AND]=!0===s.filter.operators[t];else if("NOT"===e)y[i.NOT]=!0===s.filter.operators[t];else if("TLS"===e)y[i.TLS]=!0===s.filter.operators[t];else if("TBS"===e)y[i.TBS]=!0===s.filter.operators[t];else if("TRG"===e)y[i.TRG]=!0===s.filter.operators[t];else if("BKR"===e)y[i.BKR]=!0===s.filter.operators[t];else if("BKA"===e)y[i.BKA]=!0===s.filter.operators[t];else if("BKN"===e)y[i.BKN]=!0===s.filter.operators[t];else if("ABG"===e)y[i.ABG]=!0===s.filter.operators[t];else{if("AEN"!==e)throw new Error(`${o}initOpratorFilter: '${t}' not a valid operator name. Must be , , alt, cat, rep, tls, tbs, trg, and, not, bkr, bka or bkn`);y[i.AEN]=!0===s.filter.operators[t]}}}else t(!1)}(),function(){const t=function(t){y[i.RNM]=t,y[i.UDT]=t;const e=g.length+v.length;b.length=0;for(let r=0;r"===r)return void t(!0);if(""===r)return void t(!1)}t(!1),y[i.RNM]=!0,y[i.UDT]=!0;for(const t in s.filter.rules){const e=t.toLowerCase();if(r=n.indexOf(e),r<0)throw new Error(`${o}initRuleFilter: '${t}' not a valid rule or udt name`);b[r]=!0===s.filter.rules[t]}}else t(!0)}(),n.init(h)};const A=function(t){let e=!1;return e=t.type===i.RNM?!(!y[t.type]||!b[t.index]):t.type===i.UDT?!(!y[t.type]||!b[g.length+t.index]):y[t.type],e},_=function(t){return-1===c||t<=c};this.down=function(t,e,r,i,o,s){_(f)&&A(t)&&(p.push(f),l[n.increment()]={dirUp:!1,depth:d,thisLine:f,thatLine:void 0,opcode:t,state:e,phraseIndex:r,phraseLength:i,lookAnchor:o,lookAround:s},f+=1,d+=1)},this.up=function(t,e,r,i,o,s){if(_(f)&&A(t)){const a=f,u=p.pop(),h=n.getListIndex(u);-1!==h&&(l[h].thatLine=a),d-=1,l[n.increment()]={dirUp:!0,depth:d,thisLine:a,thatLine:u,opcode:t,state:e,phraseIndex:r,phraseLength:i,lookAnchor:o,lookAround:s},f+=1}},this.toTree=function(e){const r=function(){function e(e,r){let n,o,s;if(r)switch(e.op={id:r.type,name:t.opcodeToString(r.type)},e.opData=void 0,r.type){case i.RNM:e.opData=g[r.index].name;break;case i.UDT:e.opData=v[r.index].name;break;case i.BKR:n=r.index{if(w=l[t],E&&(E=!1,w.depth>0)){const t=w.dirUp?w.depth+1:w.depth;for(let e=0;e1;)y=f.pop(),a(y,null);if(0===M.children.length)throw new Error("trace.toTree(): parse tree has no nodes");if(0===f.length)throw new Error("trace.toTree(): integrity check: dummy root node disappeared?");p=M.children[0];let A=p;for(;p&&!p.down&&!p.up;)A=p,p=p.children[0];p=A,p.leftMost=!0,p.rightMost=!0,function t(e){if(h+=1,e.branch=c,h>d&&(d=h),0===e.children.length)u+=1;else for(let r=0;r0&&(c+=1),e.children[r].leftMost=!1,e.children[r].rightMost=!1,e.leftMost&&(e.children[r].leftMost=0===r),e.rightMost&&(e.children[r].rightMost=r===e.children.length-1),t(e.children[r]);h-=1}(p),p.branch=0;const _={string:[]};for(let t=0;t`,g="";let v=!1;switch(n){case i.EMPTY:d+=M;case i.NOMATCH:case i.ACTIVE:l=o,h=0,c=o,f=r.length-c;break;case i.MATCH:l=o,h=s,c=o+h,f=r.length-c;break;default:throw new Error("unrecognized state")}return p=w,h>u?(h=u,p=E,f=0):h+f>u&&(p=E,f=u-h),h>0&&(d+=a,d+=N(t,r,l,h,v),d+=g,v=!0),f>0&&(d+=m,d+=N(t,r,c,f,v),d+=g),d+p};this.toHtml=function(r,h){let c=8;if("string"==typeof r&&r.length>=3){const t=r.toLowerCase().slice(0,3);"hex"===t?c=a:"dec"===t?c=10:"uni"===t&&(c=32)}let f="";return f+=function(t,r){let n;switch(t){case a:n="hexadecimal";break;case 10:n="decimal";break;case 8:n="ASCII";break;case 32:n="UNICODE";break;default:throw new Error(`${o}htmlHeader: unrecognized mode: ${t}`)}let i="";return i+=`

display mode: ${n}

\n`,i+=`\n`,"string"==typeof r&&(i+=``),i}(c,h),f+=function(r){if(null===g)return"";let o,h,c,f,d,p,y="";return y+="",y+="\n",n.forEach((n=>{const b=l[n];switch(o=b.thisLine,h=void 0!==b.thatLine?b.thatLine:"--",c=!1,f=!1,d=!1,b.lookAround===i.LOOKAROUND_AHEAD&&(c=!0,d=!0,p=b.lookAnchor),b.opcode.type!==i.AND&&b.opcode.type!==i.NOT||(c=!0,d=!0,p=b.phraseIndex),b.lookAround===i.LOOKAROUND_BEHIND&&(f=!0,d=!0,p=b.lookAnchor),b.opcode.type!==i.BKA&&b.opcode.type!==i.BKN||(f=!0,d=!0,p=b.phraseIndex),y+="",y+=``,y+=``,y+=``,y+=``,y+="",y+="\n"})),y+="",y+="\n",y+="
${r}
(a)(b)(c)(d)(e)(f)operatorphrase
${o}${h}${b.phraseIndex}${b.phraseLength}${b.depth}",b.state){case i.ACTIVE:y+=`↓ `;break;case i.MATCH:y+=`↑M`;break;case i.NOMATCH:y+=`↑N`;break;case i.EMPTY:y+=`↑E`;break;default:y+=`--`}if(y+="",y+=s.indent(b.depth),c?y+=``:f&&(y+=``),y+=t.opcodeToString(b.opcode.type),b.opcode.type===i.RNM&&(y+=`(${g[b.opcode.index].name}) `),b.opcode.type===i.BKR){const t=b.opcode.bkrCase===i.BKR_MODE_CI?"%i":"%s",e=b.opcode.bkrMode===i.BKR_MODE_UM?"%u":"%p";y+=`(\\${t}${e}${g[b.opcode.index].name}) `}b.opcode.type===i.UDT&&(y+=`(${v[b.opcode.index].name}) `),b.opcode.type===i.TRG&&(y+=`(${function(t,e){let r="";if(e.type===i.TRG)if(t===a||32===t){let n=e.min.toString(16).toUpperCase();n.length%2!=0&&(n=`0${n}`),r+=t===a?"%x":"U+",r+=n,n=e.max.toString(16).toUpperCase(),n.length%2!=0&&(n=`0${n}`),r+=`–${n}`}else r=`%d${e.min.toString(10)}–${e.max.toString(10)}`;return r}(r,b.opcode)}) `),b.opcode.type===i.TBS&&(y+=`(${function(t,e){let r="";if(e.type===i.TBS){const n=Math.min(e.string.length,10);if(t===a||32===t){r+=t===a?"%x":"U+";for(let t=0;t0&&(r+="."),n=e.string[t].toString(16).toUpperCase(),n.length%2!=0&&(n=`0${n}`),r+=n}}else{r="%d";for(let t=0;t0&&(r+="."),r+=e.string[t].toString(10)}n0&&(n+="."),o=r.string[e],o>=97&&o<=122?(t=o-32,n+=`${t.toString(s)}/${o.toString(s)}`.toUpperCase()):o>=65&&o<=90?(t=o,o+=32,n+=`${t.toString(s)}/${o.toString(s)}`.toUpperCase()):n+=o.toString(s).toUpperCase();i`,g=``,v="";let y=!1;switch(n){case i.EMPTY:d+=M;case i.NOMATCH:case i.MATCH:case i.ACTIVE:l=o-s,h=a-l,c=a,f=r.length-c;break;default:throw new Error("unrecognized state")}return p=w,h>u?(h=u,p=E,f=0):h+f>u&&(p=E,f=u-h),h>0&&(d+=m,d+=N(t,r,l,h,y),d+=v,y=!0),f>0&&(d+=g,d+=N(t,r,c,f,y),d+=v),d+p}(r,m,b.state,b.phraseIndex,b.phraseLength,p):c?function(t,r,n,i,o){const s=``;return S(t,r,n,i,o,s)}(r,m,b.state,b.phraseIndex,b.phraseLength):function(t,r,n,i,o){const s=``;return S(t,r,n,i,o,s)}(r,m,b.state,b.phraseIndex,b.phraseLength),y+="
(a)(b)(c)(d)(e)(f)operatorphrase
\n",y}(c),f+=function(){let t="";return t+="\n",t+=`

legend:
\n`,t+="(a) - line number
\n",t+="(b) - matching line number
\n",t+="(c) - phrase offset
\n",t+="(d) - phrase length
\n",t+="(e) - tree depth
\n",t+="(f) - operator state
\n",t+=`    -   phrase opened
\n`,t+=`    - ↑M phrase matched
\n`,t+=`    - ↑E empty phrase matched
\n`,t+=`    - ↑N phrase not matched
\n`,t+="operator - ALT, CAT, REP, RNM, TRG, TLS, TBS, UDT, AND, NOT, BKA, BKN, BKR, ABG, AEN
\n",t+="phrase   - up to 80 characters of the phrase being matched
\n",t+=`         - matched characters
\n`,t+=`         - matched characters in look ahead mode
\n`,t+=`         - matched characters in look behind mode
\n`,t+=`         - remainder characters(not yet examined by parser)
\n`,t+=`         - control characters, TAB, LF, CR, etc. (ASCII mode only)
\n`,t+=`         - ${M} empty string
\n`,t+=`         - ${w} end of input string
\n`,t+=`         - ${E} input string display truncated
\n`,t+="

\n",t+=`

\n`,t+="original ABNF operators:
\n",t+="ALT - alternation
\n",t+="CAT - concatenation
\n",t+="REP - repetition
\n",t+="RNM - rule name
\n",t+="TRG - terminal range
\n",t+="TLS - terminal literal string (case insensitive)
\n",t+="TBS - terminal binary string (case sensitive)
\n",t+="
\n",t+="super set SABNF operators:
\n",t+="UDT - user-defined terminal
\n",t+="AND - positive look ahead
\n",t+="NOT - negative look ahead
\n",t+="BKA - positive look behind
\n",t+="BKN - negative look behind
\n",t+="BKR - back reference
\n",t+="ABG - anchor - begin of input string
\n",t+="AEN - anchor - end of input string
\n",t+="

\n",t}(),f}}},8544:function(t,e,r){const n=r(3932),i=r(979),o=r(1593),s=r(8276),a="utilities.js: ",u=this,l=function(t,e,r){let n,i=e;for(;;){if(t<=0){i=0,n=0;break}if("number"!=typeof i){i=0,n=t;break}if(i>=t){i=t,n=t;break}if("number"!=typeof r){n=t;break}if(n=i+r,n>t){n=t;break}break}return{beg:i,end:n}};e.htmlToPage=function(t,e){let r;if("string"!=typeof t)throw new Error(`${a}htmlToPage: input HTML is not a string`);r="string"!=typeof e?"htmlToPage":e;let n="";return n+="\n",n+='\n',n+="\n",n+='\n',n+=`${r}\n`,n+="\n",n+="\n\n",n+=`

${new Date}

\n`,n+=t,n+="\n\n",n},e.parserResultToHtml=function(t,e){let r,i,o=null;"string"==typeof e&&""!==e&&(o=e),r=!0===t.success?`true`:`false`,i=t.state===s.EMPTY?`EMPTY`:t.state===s.MATCH?`MATCH`:t.state===s.NOMATCH?`NOMATCH`:`unrecognized`;let a="";return a+=`\n`,o&&(a+=`\n`),a+="\n",a+=`\n`,a+=`\n",a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+=`\n`,a+="
${o}
state itemvaluedescription
parser success${r}true if the parse succeeded,\n`,a+=` false otherwise`,a+="
NOTE: for success, entire string must be matched
parser state${i}EMPTY, `,a+=`MATCH or \n`,a+=`NOMATCH
string length${t.length}length of the input (sub)string
matched length${t.matched}number of input string characters matched
max matched${t.maxMatched}maximum number of input string characters matched
max tree depth${t.maxTreeDepth}maximum depth of the parse tree reached
node hits${t.nodeHits}number of parse tree node hits (opcode function calls)
input length${t.inputLength}length of full input string
sub-string begin${t.subBegin}sub-string first character index
sub-string end${t.subEnd}sub-string end-of-string index
sub-string length${t.subLength}sub-string length
\n",a},e.charsToString=function(t,e,r){let n,o;if("number"==typeof e){if(e>=t.length)return"";n=e<0?0:e}else n=0;if("number"==typeof r){if(r<=0)return"";o=r>t.length-n?t.length:n+r}else o=t.length;return ni.beg){n+=t[i.beg];for(let e=i.beg+1;ei.beg){n+=`\\x${u.charToHex(t[i.beg])}`;for(let e=i.beg+1;ei.beg)for(let e=i.beg;ei.beg)for(let e=i.beg;e=55296&&o<=57343||o>1114111?` U+${u.charToHex(t[e])}`:`&#${t[e]};`;var o;return n},e.charsToJsUnicode=function(t,e,r){let n="";if(!Array.isArray(t))throw new Error(`${a}charsToJsUnicode: input must be an array of integers`);const i=l(t.length,e,r);if(i.end>i.beg){n+=`\\u${u.charToHex(t[i.beg])}`;for(let e=i.beg+1;e=32&&r<=126?String.fromCharCode(r):`\\x${u.charToHex(r)}`}return n},e.charsToAsciiHtml=function(t,e,r){if(!Array.isArray(t))throw new Error(`${a}charsToAsciiHtml: input must be an array of integers`);let i,o="";const s=l(t.length,e,r);for(let e=s.beg;e${u.asciiChars[i]}`:i>127?`U+${u.charToHex(i)}`:u.asciiChars[i];return o},e.stringToAsciiHtml=function(t){const e=i.decode("STRING",t);return this.charsToAsciiHtml(e)}},2882:t=>{"use strict";for(var e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={},n=0;n<32;n++){var i=e.charAt(n);if(void 0!==r[i])throw new TypeError(i+" is ambiguous");r[i]=n}function o(t){var e=t>>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function s(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=o(e)^n>>5}for(e=o(e),r=0;re)return"Exceeds length limit";var n=t.toLowerCase(),i=t.toUpperCase();if(t!==n&&t!==i)return"Mixed-case string "+t;var a=(t=n).lastIndexOf("1");if(-1===a)return"No separator character for "+t;if(0===a)return"Missing prefix for "+t;var u=t.slice(0,a),l=t.slice(a+1);if(l.length<6)return"Data too short";var h=s(u);if("string"==typeof h)return h;for(var c=[],f=0;f=l.length||c.push(p)}return 1!==h?"Invalid checksum for "+t:{prefix:u,words:c}}function u(t,e,r,n){for(var i=0,o=0,s=(1<=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<=e)return"Excess padding";if(i<n)throw new TypeError("Exceeds length limit");var i=s(t=t.toLowerCase());if("string"==typeof i)throw new Error(i);for(var a=t+"1",u=0;u>5!=0)throw new Error("Non 5-bit word");i=o(i)^l,a+=e.charAt(l)}for(u=0;u<6;++u)i=o(i);for(i^=1,u=0;u<6;++u)a+=e.charAt(i>>5*(5-u)&31);return a},toWordsUnsafe:function(t){var e=u(t,8,5,!0);if(Array.isArray(e))return e},toWords:function(t){var e=u(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(t){var e=u(t,5,8,!1);if(Array.isArray(e))return e},fromWords:function(t){var e=u(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}}},3550:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(6601).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?h[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=c[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,l=new t(o),h=this.clone();if(u){for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),l[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):m(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},g.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(b,y),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new w;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return v[t]=e,e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new _(t)},i(_,A),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},_.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},9580:(t,e,r)=>{"use strict";r.r(e),r.d(e,{BaseContract:()=>C,BigNumber:()=>lt,Contract:()=>P,ContractFactory:()=>L,FixedNumber:()=>_t,Signer:()=>zt,VoidSigner:()=>Kt,Wallet:()=>ee,Wordlist:()=>ai,constants:()=>n,errors:()=>ed,ethers:()=>u,getDefaultProvider:()=>Dn,logger:()=>qb,providers:()=>i,utils:()=>a,version:()=>jb,wordlists:()=>ci});var n={};r.r(n),r.d(n,{AddressZero:()=>ie,EtherSymbol:()=>Ge,HashZero:()=>Fe,MaxInt256:()=>De,MaxUint256:()=>Ue,MinInt256:()=>Be,NegativeOne:()=>Oe,One:()=>Ce,Two:()=>Pe,WeiPerEther:()=>Le,Zero:()=>Ie});var i={};r.r(i),r.d(i,{AlchemyProvider:()=>Wr,AlchemyWebSocketProvider:()=>Vr,BaseProvider:()=>_r,CloudflareProvider:()=>Jr,EtherscanProvider:()=>sn,FallbackProvider:()=>En,Formatter:()=>Qe,InfuraProvider:()=>Sn,InfuraWebSocketProvider:()=>Nn,IpcProvider:()=>Mn,JsonRpcBatchProvider:()=>Tn,JsonRpcProvider:()=>Ur,JsonRpcSigner:()=>Cr,NodesmithProvider:()=>Rn,PocketProvider:()=>In,Provider:()=>c.zt,Resolver:()=>Er,StaticJsonRpcProvider:()=>zr,UrlJsonRpcProvider:()=>Kr,Web3Provider:()=>Un,WebSocketProvider:()=>jr,getDefaultProvider:()=>Dn,getNetwork:()=>je.H,isCommunityResourcable:()=>tr,isCommunityResource:()=>er,showThrottleMessage:()=>nr});var o={};r.r(o),r.d(o,{decode:()=>_a,encode:()=>Na});var s={};r.r(s),r.d(s,{decode:()=>Hp,encode:()=>qp});var a={};r.r(a),r.d(a,{AbiCoder:()=>us,ConstructorFragment:()=>Xo,ErrorFragment:()=>ts,EventFragment:()=>Vo,FormatTypes:()=>qo,Fragment:()=>$o,FunctionFragment:()=>Zo,HDNode:()=>nf,Indexed:()=>ms,Interface:()=>ys,LogDescription:()=>fs,Logger:()=>nd,ParamType:()=>Ko,RLP:()=>s,SigningKey:()=>Qm,SupportedAlgorithm:()=>yd,TransactionDescription:()=>ds,TransactionTypes:()=>Py,UnicodeNormalizationForm:()=>Eg,Utf8ErrorFuncs:()=>_g,Utf8ErrorReason:()=>Mg,_TypedDataEncoder:()=>Ql,_fetchData:()=>Db,_toEscapedUtf8String:()=>kg,accessListify:()=>zy,arrayify:()=>ou,base58:()=>qa,base64:()=>o,checkProperties:()=>dp,checkResultErrors:()=>Qi,commify:()=>Qy,computeAddress:()=>Fy,computeHmac:()=>Ad,computePublicKey:()=>eg,concat:()=>su,deepCopy:()=>yp,defaultAbiCoder:()=>ls,defaultPath:()=>rf,defineReadOnly:()=>hp,entropyToMnemonic:()=>af,fetchJson:()=>Fb,formatBytes32String:()=>Kg,formatEther:()=>rb,formatUnits:()=>tb,getAccountPath:()=>lf,getAddress:()=>oa,getContractAddress:()=>ua,getCreate2Address:()=>la,getIcapAddress:()=>aa,getJsonWalletAddress:()=>If,getStatic:()=>cp,hashMessage:()=>Zu,hexConcat:()=>pu,hexDataLength:()=>fu,hexDataSlice:()=>du,hexStripZeros:()=>gu,hexValue:()=>mu,hexZeroPad:()=>vu,hexlify:()=>cu,id:()=>gl,isAddress:()=>sa,isBytes:()=>iu,isBytesLike:()=>ru,isHexString:()=>lu,isValidMnemonic:()=>uf,isValidName:()=>pl,joinSignature:()=>bu,keccak256:()=>Vf,mnemonicToEntropy:()=>sf,mnemonicToSeed:()=>of,namehash:()=>ml,nameprep:()=>qg,parseBytes32String:()=>Hg,parseEther:()=>nb,parseTransaction:()=>Yy,parseUnits:()=>eb,poll:()=>Gb,randomBytes:()=>Jd,recoverAddress:()=>Gy,recoverPublicKey:()=>tg,resolveProperties:()=>fp,ripemd160:()=>wd,serializeTransaction:()=>Vy,sha256:()=>Ed,sha512:()=>Md,shallowCopy:()=>pp,shuffled:()=>Xd,solidityKeccak256:()=>Od,solidityPack:()=>xd,soliditySha256:()=>Id,splitSignature:()=>yu,stripZeros:()=>au,toUtf8Bytes:()=>Sg,toUtf8CodePoints:()=>Og,toUtf8String:()=>xg,verifyMessage:()=>re,verifyTypedData:()=>ne,zeroPad:()=>uu});var u={};r.r(u),r.d(u,{BaseContract:()=>C,BigNumber:()=>lt,Contract:()=>P,ContractFactory:()=>L,FixedNumber:()=>_t,Signer:()=>zt,VoidSigner:()=>Kt,Wallet:()=>ee,Wordlist:()=>ai,constants:()=>n,errors:()=>ed,getDefaultProvider:()=>Dn,logger:()=>qb,providers:()=>i,utils:()=>a,version:()=>jb,wordlists:()=>ci});var l=r(1184),h=r(8198),c=r(4353),f=r(8171),d=r(4594),p=r(2593),m=r(3286),g=r(3587),v=r(4377),y=r(711),b=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const w=new y.Yd("contracts/5.5.0"),E={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0};function M(t,e){return b(this,void 0,void 0,(function*(){const r=yield e;"string"!=typeof r&&w.throwArgumentError("invalid address or ENS name","name",r);try{return(0,d.Kn)(r)}catch(t){}t||w.throwError("a provider or signer is needed to resolve ENS names",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return null==n&&w.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n}))}function A(t,e,r){return b(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,n)=>A(t,Array.isArray(e)?e[n]:e[r.name],r)))):"address"===r.type?yield M(t,e):"tuple"===r.type?yield A(t,e,r.components):"array"===r.baseType?Array.isArray(e)?yield Promise.all(e.map((e=>A(t,e,r.arrayChildren)))):Promise.reject(w.makeError("invalid value for array",y.Yd.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e}))}function _(t,e,r){return b(this,void 0,void 0,(function*(){let n={};r.length===e.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=(0,g.DC)(r.pop())),w.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=(0,g.mE)({override:M(t.signer,n.from),signer:t.signer.getAddress()}).then((t=>b(this,void 0,void 0,(function*(){return(0,d.Kn)(t.signer)!==t.override&&w.throwError("Contract with a Signer cannot override from",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})))):n.from=t.signer.getAddress():n.from&&(n.from=M(t.provider,n.from));const i=yield(0,g.mE)({args:A(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:(0,g.mE)(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},a=i.overrides;if(null!=a.nonce&&(s.nonce=p.O$.from(a.nonce).toNumber()),null!=a.gasLimit&&(s.gasLimit=p.O$.from(a.gasLimit)),null!=a.gasPrice&&(s.gasPrice=p.O$.from(a.gasPrice)),null!=a.maxFeePerGas&&(s.maxFeePerGas=p.O$.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(s.maxPriorityFeePerGas=p.O$.from(a.maxPriorityFeePerGas)),null!=a.from&&(s.from=a.from),null!=a.type&&(s.type=a.type),null!=a.accessList&&(s.accessList=(0,v.z7)(a.accessList)),null==s.gasLimit&&null!=e.gas){let t=21e3;const r=(0,m.lE)(o);for(let e=0;enull!=n[t]));return u.length&&w.throwError(`cannot override ${u.map((t=>JSON.stringify(t))).join(",")}`,y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),s}))}function N(t,e){const r=e.wait.bind(e);e.wait=e=>r(e).then((e=>(e.events=e.logs.map((r=>{let n=(0,g.p$)(r),i=null;try{i=t.interface.parseLog(r)}catch(t){}return i&&(n.args=i.args,n.decode=(e,r)=>t.interface.decodeEventLog(i.eventFragment,e,r),n.event=i.name,n.eventSignature=i.signature),n.removeListener=()=>t.provider,n.getBlock=()=>t.provider.getBlock(e.blockHash),n.getTransaction=()=>t.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(e),n})),e)))}function S(t,e,r){const n=t.signer||t.provider;return function(...i){return b(this,void 0,void 0,(function*(){let o;if(i.length===e.inputs.length+1&&"object"==typeof i[i.length-1]){const t=(0,g.DC)(i.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,i.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const s=yield _(t,e,i),a=yield n.call(s,o);try{let n=t.interface.decodeFunctionResult(e,a);return r&&1===e.outputs.length&&(n=n[0]),n}catch(e){throw e.code===y.Yd.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=i,e.transaction=s),e}}))}}function T(t,e,r){return e.constant?S(t,e,r):function(t,e){return function(...r){return b(this,void 0,void 0,(function*(){t.signer||w.throwError("sending a transaction requires a signer",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const n=yield _(t,e,r),i=yield t.signer.sendTransaction(n);return N(t,i),i}))}}(t,e)}function k(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map((t=>Array.isArray(t)?t.join("|"):t)).join(":"):""):"*"}class R{constructor(t,e){(0,g.zG)(this,"tag",t),(0,g.zG)(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter((r=>!(!e&&r.listener===t&&(e=!0,1))))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((t=>t.listener))}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter((e=>{const r=t.slice();return setTimeout((()=>{e.listener.apply(this,r)}),0),!e.once})),e}prepareEvent(t){}getEmit(t){return[t]}}class x extends R{constructor(){super("error",null)}}class O extends R{constructor(t,e,r,n){const i={address:t};let o=e.getEventTopic(r);n?(o!==n[0]&&w.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[o],super(k(i),i),(0,g.zG)(this,"address",t),(0,g.zG)(this,"interface",e),(0,g.zG)(this,"fragment",r)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=(0,l.BR)(t.args);if(e.length)throw e[0].error;const r=(t.args||[]).slice();return r.push(t),r}}class I extends R{constructor(t,e){super("*",{address:t}),(0,g.zG)(this,"address",t),(0,g.zG)(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,r)=>this.interface.decodeEventLog(e.eventFragment,t,r),t.args=e.args}catch(t){}}}class C{constructor(t,e,r){w.checkNew(new.target,P),(0,g.zG)(this,"interface",(0,g.tu)(new.target,"getInterface")(e)),null==r?((0,g.zG)(this,"provider",null),(0,g.zG)(this,"signer",null)):f.E.isSigner(r)?((0,g.zG)(this,"provider",r.provider||null),(0,g.zG)(this,"signer",r)):c.zt.isProvider(r)?((0,g.zG)(this,"provider",r),(0,g.zG)(this,"signer",null)):w.throwArgumentError("invalid signer or provider","signerOrProvider",r),(0,g.zG)(this,"callStatic",{}),(0,g.zG)(this,"estimateGas",{}),(0,g.zG)(this,"functions",{}),(0,g.zG)(this,"populateTransaction",{}),(0,g.zG)(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach((e=>{const r=this.interface.events[e];(0,g.zG)(this.filters,e,((...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,t)}))),t[r.name]||(t[r.name]=[]),t[r.name].push(e)})),Object.keys(t).forEach((e=>{const r=t[e];1===r.length?(0,g.zG)(this.filters,e,this.filters[r[0]]):w.warn(`Duplicate definition of ${e} (${r.join(", ")})`)}))}if((0,g.zG)(this,"_runningEvents",{}),(0,g.zG)(this,"_wrappedEmits",{}),null==t&&w.throwArgumentError("invalid contract address or ENS name","addressOrName",t),(0,g.zG)(this,"address",t),this.provider)(0,g.zG)(this,"resolvedAddress",M(this.provider,t));else try{(0,g.zG)(this,"resolvedAddress",Promise.resolve((0,d.Kn)(t)))}catch(t){w.throwError("provider is required to use ENS name as contract address",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}const n={},i={};Object.keys(this.interface.functions).forEach((t=>{const e=this.interface.functions[t];if(i[t])w.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{i[t]=!0;{const r=e.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(t)}null==this[t]&&(0,g.zG)(this,t,T(this,e,!0)),null==this.functions[t]&&(0,g.zG)(this.functions,t,T(this,e,!1)),null==this.callStatic[t]&&(0,g.zG)(this.callStatic,t,S(this,e,!0)),null==this.populateTransaction[t]&&(0,g.zG)(this.populateTransaction,t,function(t,e){return function(...r){return _(t,e,r)}}(this,e)),null==this.estimateGas[t]&&(0,g.zG)(this.estimateGas,t,function(t,e){const r=t.signer||t.provider;return function(...n){return b(this,void 0,void 0,(function*(){r||w.throwError("estimate require a provider or signer",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield _(t,e,n);return yield r.estimateGas(i)}))}}(this,e))}})),Object.keys(n).forEach((t=>{const e=n[t];if(e.length>1)return;t=t.substring(1);const r=e[0];try{null==this[t]&&(0,g.zG)(this,t,this[r])}catch(t){}null==this.functions[t]&&(0,g.zG)(this.functions,t,this.functions[r]),null==this.callStatic[t]&&(0,g.zG)(this.callStatic,t,this.callStatic[r]),null==this.populateTransaction[t]&&(0,g.zG)(this.populateTransaction,t,this.populateTransaction[r]),null==this.estimateGas[t]&&(0,g.zG)(this.estimateGas,t,this.estimateGas[r])}))}static getContractAddress(t){return(0,d.CR)(t)}static getInterface(t){return h.vU.isInterface(t)?t:new h.vU(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,t).then((t=>("0x"===t&&w.throwError("contract not deployed",y.Yd.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(t){this.signer||w.throwError("sending a transactions require a signer",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=(0,g.DC)(t||{});return["from","to"].forEach((function(t){null!=e[t]&&w.throwError("cannot override "+t,y.Yd.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(e)))}connect(t){"string"==typeof t&&(t=new f.b(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&(0,g.zG)(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return h.Hk.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new x);if("event"===t)return this._normalizeRunningEvent(new R("event",null));if("*"===t)return this._normalizeRunningEvent(new I(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new O(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new O(this.address,this.interface,r,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new R(k(e),e))}return this._normalizeRunningEvent(new I(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,r){const n=(0,g.p$)(e);return n.removeListener=()=>{r&&(t.removeListener(r),this._checkRunningEvents(t))},n.getBlock=()=>this.provider.getBlock(e.blockHash),n.getTransaction=()=>this.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(n),n}_addEventListener(t,e,r){if(this.provider||w.throwError("events require a provider or a signer with a provider",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,r),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const r=r=>{let n=this._wrapEvent(t,r,e);if(null==n.decodeError)try{const e=t.getEmit(n);this.emit(t.filter,...e)}catch(t){n.decodeError=t.error}null!=t.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[t.tag]=r,null!=t.filter&&this.provider.on(t.filter,r)}}queryFilter(t,e,r){const n=this._getRunningEvent(t),i=(0,g.DC)(n.filter);return"string"==typeof e&&(0,m.A7)(e,32)?(null!=r&&w.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=e):(i.fromBlock=null!=e?e:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then((t=>t.map((t=>this._wrapEvent(n,t,null)))))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const r=this._getRunningEvent(t),n=r.run(e)>0;return this._checkRunningEvents(r),n}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce(((t,e)=>t+this._runningEvents[e].listenerCount()),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach((e=>{t.push(e)}));return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const r=this._getRunningEvent(t);return r.removeListener(e),this._checkRunningEvents(r),this}removeListener(t,e){return this.off(t,e)}}class P extends C{}class L{constructor(t,e,r){let n=null;n="string"==typeof e?e:(0,m._t)(e)?(0,m.Dv)(e):e&&"string"==typeof e.object?e.object:"!","0x"!==n.substring(0,2)&&(n="0x"+n),(!(0,m.A7)(n)||n.length%2)&&w.throwArgumentError("invalid bytecode","bytecode",e),r&&!f.E.isSigner(r)&&w.throwArgumentError("invalid signer","signer",r),(0,g.zG)(this,"bytecode",n),(0,g.zG)(this,"interface",(0,g.tu)(new.target,"getInterface")(t)),(0,g.zG)(this,"signer",r||null)}getDeployTransaction(...t){let e={};if(t.length===this.interface.deploy.inputs.length+1&&"object"==typeof t[t.length-1]){e=(0,g.DC)(t.pop());for(const t in e)if(!E[t])throw new Error("unknown transaction override "+t)}return["data","from","to"].forEach((t=>{null!=e[t]&&w.throwError("cannot override "+t,y.Yd.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.value&&(p.O$.from(e.value).isZero()||this.interface.deploy.payable||w.throwError("non-payable constructor cannot override value",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:e.value})),w.checkArgumentCount(t.length,this.interface.deploy.inputs.length," in Contract constructor"),e.data=(0,m.Dv)((0,m.zo)([this.bytecode,this.interface.encodeDeploy(t)])),e}deploy(...t){return b(this,void 0,void 0,(function*(){let e={};t.length===this.interface.deploy.inputs.length+1&&(e=t.pop()),w.checkArgumentCount(t.length,this.interface.deploy.inputs.length," in Contract constructor");const r=yield A(this.signer,t,this.interface.deploy.inputs);r.push(e);const n=this.getDeployTransaction(...r),i=yield this.signer.sendTransaction(n),o=(0,g.tu)(this.constructor,"getContractAddress")(i),s=(0,g.tu)(this.constructor,"getContract")(o,this.interface,this.signer);return N(s,i),(0,g.zG)(s,"deployTransaction",i),s}))}attach(t){return this.constructor.getContract(t,this.interface,this.signer)}connect(t){return new this.constructor(this.interface,this.bytecode,t)}static fromSolidity(t,e){null==t&&w.throwError("missing compiler output",y.Yd.errors.MISSING_ARGUMENT,{argument:"compilerOutput"}),"string"==typeof t&&(t=JSON.parse(t));const r=t.abi;let n=null;return t.bytecode?n=t.bytecode:t.evm&&t.evm.bytecode&&(n=t.evm.bytecode),new this(r,n,e)}static getInterface(t){return P.getInterface(t)}static getContractAddress(t){return(0,d.CR)(t)}static getContract(t,e,r){return new P(t,e,r)}}var U=r(3550),B=r.n(U);let D=!1,F=!1;const G={debug:1,default:2,info:2,warning:3,error:4,off:5};let j=G.default,q=null;const z=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var K,H;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(K||(K={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(H||(H={}));const $="0123456789abcdef";class V{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==G[r]&&this.throwArgumentError("invalid log level name","logLevel",t),j>G[r]||console.log.apply(console,e)}debug(...t){this._log(V.levels.DEBUG,t)}info(...t){this._log(V.levels.INFO,t)}warn(...t){this._log(V.levels.WARNING,t)}makeError(t,e,r){if(F)return this.makeError("censored error",e,{});e||(e=V.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=$[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case H.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case H.CALL_EXCEPTION:case H.INSUFFICIENT_FUNDS:case H.MISSING_NEW:case H.NONCE_EXPIRED:case H.REPLACEMENT_UNDERPRICED:case H.TRANSACTION_REPLACED:case H.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,V.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),z&&this.throwError("platform missing String.prototype.normalize",V.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:z})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,V.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,V.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,V.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",V.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",V.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",V.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return q||(q=new V("logger/5.7.0")),q}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",V.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),D){if(!t)return;this.globalLogger().throwError("error censorship permanent",V.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}F=!!t,D=!!e}static setLogLevel(t){const e=G[t.toLowerCase()];null!=e?j=e:V.globalLogger().warn("invalid log level - "+t)}static from(t){return new V(t)}}V.errors=H,V.levels=K;const W=new V("bytes/5.7.0");function Y(t){return!!t.toHexString}function J(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return J(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function X(t){return"number"==typeof t&&t==t&&t%1==0}function Z(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!X(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Q(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const tt="0123456789abcdef";function et(t,e){if(e||(e={}),"number"==typeof t){W.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=tt[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Y(t))return t.toHexString();if(Q(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":W.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Z(t)){let e="0x";for(let r=0;r>4]+tt[15&n]}return e}return W.throwArgumentError("invalid hexlify value","value",t)}function rt(t,e){for("string"!=typeof t?t=et(t):Q(t)||W.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&W.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}const nt="bignumber/5.5.0";var it=B().BN;const ot=new V(nt),st={},at=9007199254740991;let ut=!1;class lt{constructor(t,e){ot.checkNew(new.target,lt),t!==st&&ot.throwError("cannot call constructor directly; use BigNumber.from",V.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return ct(ft(this).fromTwos(t))}toTwos(t){return ct(ft(this).toTwos(t))}abs(){return"-"===this._hex[0]?lt.from(this._hex.substring(1)):this}add(t){return ct(ft(this).add(ft(t)))}sub(t){return ct(ft(this).sub(ft(t)))}div(t){return lt.from(t).isZero()&&dt("division by zero","div"),ct(ft(this).div(ft(t)))}mul(t){return ct(ft(this).mul(ft(t)))}mod(t){const e=ft(t);return e.isNeg()&&dt("cannot modulo negative values","mod"),ct(ft(this).umod(e))}pow(t){const e=ft(t);return e.isNeg()&&dt("cannot raise to negative values","pow"),ct(ft(this).pow(e))}and(t){const e=ft(t);return(this.isNegative()||e.isNeg())&&dt("cannot 'and' negative values","and"),ct(ft(this).and(e))}or(t){const e=ft(t);return(this.isNegative()||e.isNeg())&&dt("cannot 'or' negative values","or"),ct(ft(this).or(e))}xor(t){const e=ft(t);return(this.isNegative()||e.isNeg())&&dt("cannot 'xor' negative values","xor"),ct(ft(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&dt("cannot mask negative values","mask"),ct(ft(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&dt("cannot shift negative values","shl"),ct(ft(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&dt("cannot shift negative values","shr"),ct(ft(this).shrn(t))}eq(t){return ft(this).eq(ft(t))}lt(t){return ft(this).lt(ft(t))}lte(t){return ft(this).lte(ft(t))}gt(t){return ft(this).gt(ft(t))}gte(t){return ft(this).gte(ft(t))}isNegative(){return"-"===this._hex[0]}isZero(){return ft(this).isZero()}toNumber(){try{return ft(this).toNumber()}catch(t){dt("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return ot.throwError("this platform does not support BigInt",V.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?ut||(ut=!0,ot.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?ot.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",V.errors.UNEXPECTED_ARGUMENT,{}):ot.throwError("BigNumber.toString does not accept parameters",V.errors.UNEXPECTED_ARGUMENT,{})),ft(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof lt)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new lt(st,ht(t)):t.match(/^-?[0-9]+$/)?new lt(st,ht(new it(t))):ot.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&dt("underflow","BigNumber.from",t),(t>=at||t<=-at)&&dt("overflow","BigNumber.from",t),lt.from(String(t));const e=t;if("bigint"==typeof e)return lt.from(e.toString());if(Z(e))return lt.from(et(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return lt.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Q(t)||"-"===t[0]&&Q(t.substring(1))))return lt.from(t)}return ot.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function ht(t){if("string"!=typeof t)return ht(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&ot.throwArgumentError("invalid hex","value",t),"0x00"===(t=ht(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function ct(t){return lt.from(ht(t))}function ft(t){const e=lt.from(t).toHexString();return"-"===e[0]?new it("-"+e.substring(3),16):new it(e.substring(2),16)}function dt(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),ot.throwError(t,V.errors.NUMERIC_FAULT,n)}const pt=new V(nt),mt={},gt=lt.from(0),vt=lt.from(-1);function yt(t,e,r,n){const i={fault:e,operation:r};return void 0!==n&&(i.value=n),pt.throwError(t,V.errors.NUMERIC_FAULT,i)}let bt="0";for(;bt.length<256;)bt+=bt;function wt(t){if("number"!=typeof t)try{t=lt.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+bt.substring(0,t):pt.throwArgumentError("invalid decimal size","decimals",t)}function Et(t,e){null==e&&(e=0);const r=wt(e),n=(t=lt.from(t)).lt(gt);n&&(t=t.mul(vt));let i=t.mod(r).toString();for(;i.length2&&pt.throwArgumentError("too many decimal points","value",t);let o=i[0],s=i[1];for(o||(o="0"),s||(s="0");"0"===s[s.length-1];)s=s.substring(0,s.length-1);for(s.length>r.length-1&&yt("fractional component exceeds decimals","underflow","parseFixed"),""===s&&(s="0");s.lengthnull==t[e]?n:(typeof t[e]!==r&&pt.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&pt.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&pt.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new At(mt,e,r,n)}}class _t{constructor(t,e,r,n){pt.checkNew(new.target,_t),t!==mt&&pt.throwError("cannot use FixedNumber constructor; use FixedNumber.from",V.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=e,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&pt.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=Mt(this._value,this.format.decimals),r=Mt(t._value,t.format.decimals);return _t.fromValue(e.add(r),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=Mt(this._value,this.format.decimals),r=Mt(t._value,t.format.decimals);return _t.fromValue(e.sub(r),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=Mt(this._value,this.format.decimals),r=Mt(t._value,t.format.decimals);return _t.fromValue(e.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=Mt(this._value,this.format.decimals),r=Mt(t._value,t.format.decimals);return _t.fromValue(e.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=_t.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(e=e.subUnsafe(Nt.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=_t.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(e=e.addUnsafe(Nt.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&pt.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const r=_t.from("1"+bt.substring(0,t),this.format),n=St.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){return null==t?this._hex:(t%8&&pt.throwArgumentError("invalid byte width","width",t),rt(lt.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8))}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return _t.fromString(this._value,t)}static fromValue(t,e,r){return null!=r||null==e||function(t){return null!=t&&(lt.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||Q(t)||"bigint"==typeof t||Z(t))}(e)||(r=e,e=null),null==e&&(e=0),null==r&&(r="fixed"),_t.fromString(Et(t,e),At.from(r))}static fromString(t,e){null==e&&(e="fixed");const r=At.from(e),n=Mt(t,r.decimals);!r.signed&&n.lt(gt)&&yt("unsigned value cannot be negative","overflow","value",t);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=rt(i,r.width/8));const o=Et(n,r.decimals);return new _t(mt,i,o,r)}static fromBytes(t,e){null==e&&(e="fixed");const r=At.from(e);if(function(t,e){if(e||(e={}),"number"==typeof t){W.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),J(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Y(t)&&(t=t.toHexString()),Q(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":W.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;tr.width/8)throw new Error("overflow");let n=lt.from(t);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=Et(n,r.decimals);return new _t(mt,i,o,r)}static from(t,e){if("string"==typeof t)return _t.fromString(t,e);if(Z(t))return _t.fromBytes(t,e);try{return _t.fromValue(t,0,e)}catch(t){if(t.code!==V.errors.INVALID_ARGUMENT)throw t}return pt.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const Nt=_t.from(1),St=_t.from("0.5");let Tt=!1,kt=!1;const Rt={debug:1,default:2,info:2,warning:3,error:4,off:5};let xt=Rt.default,Ot=null;const It=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Ct,Pt;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Ct||(Ct={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Pt||(Pt={}));const Lt="0123456789abcdef";class Ut{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Rt[r]&&this.throwArgumentError("invalid log level name","logLevel",t),xt>Rt[r]||console.log.apply(console,e)}debug(...t){this._log(Ut.levels.DEBUG,t)}info(...t){this._log(Ut.levels.INFO,t)}warn(...t){this._log(Ut.levels.WARNING,t)}makeError(t,e,r){if(kt)return this.makeError("censored error",e,{});e||(e=Ut.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Lt[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Pt.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Pt.CALL_EXCEPTION:case Pt.INSUFFICIENT_FUNDS:case Pt.MISSING_NEW:case Pt.NONCE_EXPIRED:case Pt.REPLACEMENT_UNDERPRICED:case Pt.TRANSACTION_REPLACED:case Pt.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Ut.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),It&&this.throwError("platform missing String.prototype.normalize",Ut.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:It})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Ut.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Ut.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,Ut.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Ut.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Ut.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Ut.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Ot||(Ot=new Ut("logger/5.7.0")),Ot}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Ut.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Tt){if(!t)return;this.globalLogger().throwError("error censorship permanent",Ut.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}kt=!!t,Tt=!!e}static setLogLevel(t){const e=Rt[t.toLowerCase()];null!=e?xt=e:Ut.globalLogger().warn("invalid log level - "+t)}static from(t){return new Ut(t)}}Ut.errors=Pt,Ut.levels=Ct;function Bt(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function Dt(t){return e=this,r=void 0,i=function*(){const e=Object.keys(t).map((e=>{const r=t[e];return Promise.resolve(r).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})},new((n=void 0)||(n=Promise))((function(t,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(t){t(r)}))).then(s,a)}u((i=i.apply(e,r||[])).next())}));var e,r,n,i}new Ut("properties/5.7.0");var Ft=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Gt=new Ut("abstract-signer/5.5.0"),jt=["accessList","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],qt=[Ut.errors.INSUFFICIENT_FUNDS,Ut.errors.NONCE_EXPIRED,Ut.errors.REPLACEMENT_UNDERPRICED];class zt{constructor(){Gt.checkAbstract(new.target,zt),Bt(this,"_isSigner",!0)}getBalance(t){return Ft(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return Ft(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return Ft(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const e=yield Dt(this.checkTransaction(t));return yield this.provider.estimateGas(e)}))}call(t,e){return Ft(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield Dt(this.checkTransaction(t));return yield this.provider.call(r,e)}))}sendTransaction(t){return Ft(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),r=yield this.signTransaction(e);return yield this.provider.sendTransaction(r)}))}getChainId(){return Ft(this,void 0,void 0,(function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return Ft(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return Ft(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return Ft(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===jt.indexOf(e)&&Gt.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=function(t){const e={};for(const r in t)e[r]=t[r];return e}(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then((e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&Gt.throwArgumentError("from address mismatch","transaction",t),e[0]))),e}populateTransaction(t){return Ft(this,void 0,void 0,(function*(){const e=yield Dt(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then((t=>Ft(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&Gt.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})))),e.to.catch((t=>{})));const r=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!r?0!==e.type&&1!==e.type||!r||Gt.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):Gt.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(r&&Gt.throwError("network does not support EIP-1559",Ut.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):Gt.throwError("failed to get consistent fee data",Ut.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch((t=>{if(qt.indexOf(t.code)>=0)throw t;return Gt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Ut.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})}))),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then((e=>(0!==e[1]&&e[0]!==e[1]&&Gt.throwArgumentError("chainId address mismatch","transaction",t),e[0]))),yield Dt(e)}))}_checkProvider(t){this.provider||Gt.throwError("missing provider",Ut.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class Kt extends zt{constructor(t,e){Gt.checkNew(new.target,Kt),super(),Bt(this,"address",t),Bt(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then((()=>{Gt.throwError(t,Ut.errors.UNSUPPORTED_OPERATION,{operation:e})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new Kt(this.address,t)}}var Ht=r(3684),$t=r(7827),Vt=r(6274),Wt=r(8197),Yt=r(4478),Jt=r(2768),Xt=r(1964),Zt=r(9380),Qt=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const te=new y.Yd("wallet/5.5.0");class ee extends f.E{constructor(t,e){if(te.checkNew(new.target,ee),super(),null!=(r=t)&&(0,m.A7)(r.privateKey,32)&&null!=r.address){const e=new Jt.Et(t.privateKey);if((0,g.zG)(this,"_signingKey",(()=>e)),(0,g.zG)(this,"address",(0,v.db)(this.publicKey)),this.address!==(0,d.Kn)(t.address)&&te.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(t){const e=t.mnemonic;return e&&e.phrase}(t)){const e=t.mnemonic;(0,g.zG)(this,"_mnemonic",(()=>({phrase:e.phrase,path:e.path||Vt.cD,locale:e.locale||"en"})));const r=this.mnemonic,n=Vt.m$.fromMnemonic(r.phrase,null,r.locale).derivePath(r.path);(0,v.db)(n.privateKey)!==this.address&&te.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else(0,g.zG)(this,"_mnemonic",(()=>null))}else{if(Jt.Et.isSigningKey(t))"secp256k1"!==t.curve&&te.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),(0,g.zG)(this,"_signingKey",(()=>t));else{"string"==typeof t&&t.match(/^[0-9a-f]*$/i)&&64===t.length&&(t="0x"+t);const e=new Jt.Et(t);(0,g.zG)(this,"_signingKey",(()=>e))}(0,g.zG)(this,"_mnemonic",(()=>null)),(0,g.zG)(this,"address",(0,v.db)(this.publicKey))}var r;e&&!c.zt.isProvider(e)&&te.throwArgumentError("invalid provider","provider",e),(0,g.zG)(this,"provider",e||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(t){return new ee(this,t)}signTransaction(t){return(0,g.mE)(t).then((e=>{null!=e.from&&((0,d.Kn)(e.from)!==this.address&&te.throwArgumentError("transaction from address mismatch","transaction.from",t.from),delete e.from);const r=this._signingKey().signDigest((0,Wt.w)((0,v.qC)(e)));return(0,v.qC)(e,r)}))}signMessage(t){return Qt(this,void 0,void 0,(function*(){return(0,m.gV)(this._signingKey().signDigest((0,Ht.r)(t)))}))}_signTypedData(t,e,r){return Qt(this,void 0,void 0,(function*(){const n=yield $t.E.resolveNames(t,e,r,(t=>(null==this.provider&&te.throwError("cannot resolve ENS names without a provider",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:t}),this.provider.resolveName(t))));return(0,m.gV)(this._signingKey().signDigest($t.E.hash(n.domain,e,n.value)))}))}encrypt(t,e,r){if("function"!=typeof e||r||(r=e,e={}),r&&"function"!=typeof r)throw new Error("invalid callback");return e||(e={}),(0,Xt.HI)(this,t,e,r)}static createRandom(t){let e=(0,Yt.O)(16);t||(t={}),t.extraEntropy&&(e=(0,m.lE)((0,m.p3)((0,Wt.w)((0,m.zo)([e,t.extraEntropy])),0,16)));const r=(0,Vt.JJ)(e,t.locale);return ee.fromMnemonic(r,t.path,t.locale)}static fromEncryptedJson(t,e,r){return(0,Zt.w)(t,e,r).then((t=>new ee(t)))}static fromEncryptedJsonSync(t,e){return new ee((0,Zt.qz)(t,e))}static fromMnemonic(t,e,r){return e||(e=Vt.cD),new ee(Vt.m$.fromMnemonic(t,null,r).derivePath(e))}}function re(t,e){return(0,v.RJ)((0,Ht.r)(t),e)}function ne(t,e,r,n){return(0,v.RJ)($t.E.hash(t,e,r),n)}const ie="0x0000000000000000000000000000000000000000";var oe=r(7328),se=r.n(oe);let ae=!1,ue=!1;const le={debug:1,default:2,info:2,warning:3,error:4,off:5};let he=le.default,ce=null;const fe=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var de,pe;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(de||(de={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(pe||(pe={}));const me="0123456789abcdef";class ge{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==le[r]&&this.throwArgumentError("invalid log level name","logLevel",t),he>le[r]||console.log.apply(console,e)}debug(...t){this._log(ge.levels.DEBUG,t)}info(...t){this._log(ge.levels.INFO,t)}warn(...t){this._log(ge.levels.WARNING,t)}makeError(t,e,r){if(ue)return this.makeError("censored error",e,{});e||(e=ge.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=me[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case pe.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case pe.CALL_EXCEPTION:case pe.INSUFFICIENT_FUNDS:case pe.MISSING_NEW:case pe.NONCE_EXPIRED:case pe.REPLACEMENT_UNDERPRICED:case pe.TRANSACTION_REPLACED:case pe.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,ge.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),fe&&this.throwError("platform missing String.prototype.normalize",ge.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:fe})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,ge.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,ge.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,ge.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",ge.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",ge.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",ge.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return ce||(ce=new ge("logger/5.7.0")),ce}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",ge.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ae){if(!t)return;this.globalLogger().throwError("error censorship permanent",ge.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ue=!!t,ae=!!e}static setLogLevel(t){const e=le[t.toLowerCase()];null!=e?he=e:ge.globalLogger().warn("invalid log level - "+t)}static from(t){return new ge(t)}}ge.errors=pe,ge.levels=de;const ve=new ge("bytes/5.7.0");function ye(t){return"number"==typeof t&&t==t&&t%1==0}function be(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!ye(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function we(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Ee="0123456789abcdef";var Me=se().BN;const Ae=new ge("bignumber/5.7.0"),_e={};let Ne=!1;class Se{constructor(t,e){t!==_e&&Ae.throwError("cannot call constructor directly; use BigNumber.from",ge.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return ke(Re(this).fromTwos(t))}toTwos(t){return ke(Re(this).toTwos(t))}abs(){return"-"===this._hex[0]?Se.from(this._hex.substring(1)):this}add(t){return ke(Re(this).add(Re(t)))}sub(t){return ke(Re(this).sub(Re(t)))}div(t){return Se.from(t).isZero()&&xe("division-by-zero","div"),ke(Re(this).div(Re(t)))}mul(t){return ke(Re(this).mul(Re(t)))}mod(t){const e=Re(t);return e.isNeg()&&xe("division-by-zero","mod"),ke(Re(this).umod(e))}pow(t){const e=Re(t);return e.isNeg()&&xe("negative-power","pow"),ke(Re(this).pow(e))}and(t){const e=Re(t);return(this.isNegative()||e.isNeg())&&xe("unbound-bitwise-result","and"),ke(Re(this).and(e))}or(t){const e=Re(t);return(this.isNegative()||e.isNeg())&&xe("unbound-bitwise-result","or"),ke(Re(this).or(e))}xor(t){const e=Re(t);return(this.isNegative()||e.isNeg())&&xe("unbound-bitwise-result","xor"),ke(Re(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&xe("negative-width","mask"),ke(Re(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&xe("negative-width","shl"),ke(Re(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&xe("negative-width","shr"),ke(Re(this).shrn(t))}eq(t){return Re(this).eq(Re(t))}lt(t){return Re(this).lt(Re(t))}lte(t){return Re(this).lte(Re(t))}gt(t){return Re(this).gt(Re(t))}gte(t){return Re(this).gte(Re(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Re(this).isZero()}toNumber(){try{return Re(this).toNumber()}catch(t){xe("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Ae.throwError("this platform does not support BigInt",ge.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Ne||(Ne=!0,Ae.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ae.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ge.errors.UNEXPECTED_ARGUMENT,{}):Ae.throwError("BigNumber.toString does not accept parameters",ge.errors.UNEXPECTED_ARGUMENT,{})),Re(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Se)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Se(_e,Te(t)):t.match(/^-?[0-9]+$/)?new Se(_e,Te(new Me(t))):Ae.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&xe("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&xe("overflow","BigNumber.from",t),Se.from(String(t));const e=t;if("bigint"==typeof e)return Se.from(e.toString());if(be(e))return Se.from(function(t,e){if(e||(e={}),"number"==typeof t){ve.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Ee[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t))return t.toHexString();if(we(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":ve.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(be(t)){let e="0x";for(let r=0;r>4]+Ee[15&n]}return e}return ve.throwArgumentError("invalid hexlify value","value",t)}(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Se.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(we(t)||"-"===t[0]&&we(t.substring(1))))return Se.from(t)}return Ae.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Te(t){if("string"!=typeof t)return Te(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Ae.throwArgumentError("invalid hex","value",t),"0x00"===(t=Te(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function ke(t){return Se.from(Te(t))}function Re(t){const e=Se.from(t).toHexString();return"-"===e[0]?new Me("-"+e.substring(3),16):new Me(e.substring(2),16)}function xe(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),Ae.throwError(t,ge.errors.NUMERIC_FAULT,n)}const Oe=Se.from(-1),Ie=Se.from(0),Ce=Se.from(1),Pe=Se.from(2),Le=Se.from("1000000000000000000"),Ue=Se.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Be=Se.from("-0x8000000000000000000000000000000000000000000000000000000000000000"),De=Se.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Fe="0x0000000000000000000000000000000000000000000000000000000000000000",Ge="Ξ";var je=r(9861),qe=r(7727),ze=r(7218),Ke=r(8339),He=r(3951),$e=r(4242),Ve=r(8341),We=r(2882),Ye=r.n(We);const Je="providers/5.5.2";var Xe=r(9279);const Ze=new y.Yd(Je);class Qe{constructor(){Ze.checkNew(new.target,Qe),this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),r=this.bigNumber.bind(this),n=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),s=this.hex.bind(this),a=this.number.bind(this),u=this.type.bind(this);return t.transaction={hash:o,type:u,accessList:Qe.allowNull(this.accessList.bind(this),null),blockHash:Qe.allowNull(o,null),blockNumber:Qe.allowNull(a,null),transactionIndex:Qe.allowNull(a,null),confirmations:Qe.allowNull(a,null),from:e,gasPrice:Qe.allowNull(r),maxPriorityFeePerGas:Qe.allowNull(r),maxFeePerGas:Qe.allowNull(r),gasLimit:r,to:Qe.allowNull(e,null),value:r,nonce:a,data:i,r:Qe.allowNull(this.uint256),s:Qe.allowNull(this.uint256),v:Qe.allowNull(a),creates:Qe.allowNull(e,null),raw:Qe.allowNull(i)},t.transactionRequest={from:Qe.allowNull(e),nonce:Qe.allowNull(a),gasLimit:Qe.allowNull(r),gasPrice:Qe.allowNull(r),maxPriorityFeePerGas:Qe.allowNull(r),maxFeePerGas:Qe.allowNull(r),to:Qe.allowNull(e),value:Qe.allowNull(r),data:Qe.allowNull((t=>this.data(t,!0))),type:Qe.allowNull(a),accessList:Qe.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:o,address:e,topics:Qe.arrayOf(o),data:i,logIndex:a,blockHash:o},t.receipt={to:Qe.allowNull(this.address,null),from:Qe.allowNull(this.address,null),contractAddress:Qe.allowNull(e,null),transactionIndex:a,root:Qe.allowNull(s),gasUsed:r,logsBloom:Qe.allowNull(i),blockHash:o,transactionHash:o,logs:Qe.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Qe.allowNull(a,null),cumulativeGasUsed:r,effectiveGasPrice:Qe.allowNull(r),status:Qe.allowNull(a),type:u},t.block={hash:o,parentHash:o,number:a,timestamp:a,nonce:Qe.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:e,extraData:i,transactions:Qe.allowNull(Qe.arrayOf(o)),baseFeePerGas:Qe.allowNull(r)},t.blockWithTransactions=(0,g.DC)(t.block),t.blockWithTransactions.transactions=Qe.allowNull(Qe.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:Qe.allowNull(n,void 0),toBlock:Qe.allowNull(n,void 0),blockHash:Qe.allowNull(o,void 0),address:Qe.allowNull(e,void 0),topics:Qe.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:Qe.allowNull(a),blockHash:Qe.allowNull(o),transactionIndex:a,removed:Qe.allowNull(this.boolean.bind(this)),address:e,data:Qe.allowFalsish(i,"0x"),topics:Qe.arrayOf(o),transactionHash:o,logIndex:a},t}accessList(t){return(0,v.z7)(t||[])}number(t){return"0x"===t?0:p.O$.from(t).toNumber()}type(t){return"0x"===t||null==t?0:p.O$.from(t).toNumber()}bigNumber(t){return p.O$.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),(0,m.A7)(t))?t.toLowerCase():Ze.throwArgumentError("invalid hash","value",t)}data(t,e){const r=this.hex(t,e);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+t);return r}address(t){return(0,d.Kn)(t)}callAddress(t){if(!(0,m.A7)(t,32))return null;const e=(0,d.Kn)((0,m.p3)(t,12));return e===Xe.d?null:e}contractAddress(t){return(0,d.CR)(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";if("latest"===t||"pending"===t)return t;if("number"==typeof t||(0,m.A7)(t))return(0,m.$P)(t);throw new Error("invalid blockTag")}hash(t,e){const r=this.hex(t,e);return 32!==(0,m.E1)(r)?Ze.throwArgumentError("invalid hash","value",t):r}difficulty(t){if(null==t)return null;const e=p.O$.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!(0,m.A7)(t))throw new Error("invalid uint256");return(0,m.$m)(t,32)}_block(t,e){null!=t.author&&null==t.miner&&(t.miner=t.author);const r=null!=t._difficulty?t._difficulty:t.difficulty,n=Qe.check(e,t);return n._difficulty=null==r?null:p.O$.from(r),n}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return Qe.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&p.O$.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1!==t.type&&2!==t.type||null!=t.accessList||(t.accessList=[]);const e=Qe.check(this.formats.transaction,t);if(null!=t.chainId){let r=t.chainId;(0,m.A7)(r)&&(r=p.O$.from(r).toNumber()),e.chainId=r}else{let r=t.networkId;null==r&&null==e.v&&(r=t.chainId),(0,m.A7)(r)&&(r=p.O$.from(r).toNumber()),"number"!=typeof r&&null!=e.v&&(r=(e.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),e.chainId=r}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return(0,v.Qc)(t)}receiptLog(t){return Qe.check(this.formats.receiptLog,t)}receipt(t){const e=Qe.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=p.O$.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&&Ze.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):Ze.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&&Ze.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map((t=>this.topics(t))):null!=t?this.hash(t,!0):null}filter(t){return Qe.check(this.formats.filter,t)}filterLog(t){return Qe.check(this.formats.filterLog,t)}static check(t,e){const r={};for(const n in t)try{const i=t[n](e[n]);void 0!==i&&(r[n]=i)}catch(t){throw t.checkKey=n,t.checkValue=e[n],t}return r}static allowNull(t,e){return function(r){return null==r?e:t(r)}}static allowFalsish(t,e){return function(r){return r?t(r):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const r=[];return e.forEach((function(e){r.push(t(e))})),r}}}function tr(t){return t&&"function"==typeof t.isCommunityResource}function er(t){return tr(t)&&t.isCommunityResource()}let rr=!1;function nr(){rr||(rr=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var ir=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const or=new y.Yd(Je);function sr(t){return null==t?"null":(32!==(0,m.E1)(t)&&or.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function ar(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map((t=>{if(Array.isArray(t)){const e={};t.forEach((t=>{e[sr(t)]=!0}));const r=Object.keys(e);return r.sort(),r.join("|")}return sr(t)})).join("&")}function ur(t){if("string"==typeof t){if(t=t.toLowerCase(),32===(0,m.E1)(t))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+ar(t);if(c.Sg.isForkEvent(t))throw or.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+ar(t.topics||[])}throw new Error("invalid event - "+t)}function lr(){return(new Date).getTime()}function hr(t){return new Promise((e=>{setTimeout(e,t)}))}const cr=["block","network","pending","poll"];class fr{constructor(t,e,r){(0,g.zG)(this,"tag",t),(0,g.zG)(this,"listener",e),(0,g.zG)(this,"once",r)}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],r=""===(n=t[2])?[]:n.split(/&/g).map((t=>{if(""===t)return[];const e=t.split("|").map((t=>"null"===t?null:t));return 1===e.length?e[0]:e}));var n;const i={};return r.length>0&&(i.topics=r),e&&"*"!==e&&(i.address=e),i}pollable(){return this.tag.indexOf(":")>=0||cr.indexOf(this.tag)>=0}}const dr={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function pr(t){return(0,m.$m)(p.O$.from(t).toHexString(),32)}function mr(t){return qe.eU.encode((0,m.zo)([t,(0,m.p3)((0,He.JQ)((0,He.JQ)(t)),0,4)]))}const gr=new RegExp("^(ipfs)://(.*)$","i"),vr=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),gr,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function yr(t){try{return(0,$e.ZN)(br(t))}catch(t){}return null}function br(t){if("0x"===t)return null;const e=p.O$.from((0,m.p3)(t,0,32)).toNumber(),r=p.O$.from((0,m.p3)(t,e,e+32)).toNumber();return(0,m.p3)(t,e+32,e+32+r)}function wr(t){return`https://gateway.ipfs.io/ipfs/${t.substring(7)}`}class Er{constructor(t,e,r,n){(0,g.zG)(this,"provider",t),(0,g.zG)(this,"name",r),(0,g.zG)(this,"address",t.formatter.address(e)),(0,g.zG)(this,"_resolvedAddress",n)}_fetchBytes(t,e){return ir(this,void 0,void 0,(function*(){const r={to:this.address,data:(0,m.xs)([t,(0,Ke.VM)(this.name),e||"0x"])};try{return br(yield this.provider.call(r))}catch(t){return t.code,y.Yd.errors.CALL_EXCEPTION,null}}))}_getAddress(t,e){const r=dr[String(t)];if(null==r&&or.throwError(`unsupported coin type: ${t}`,y.Yd.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===r.ilk)return this.provider.formatter.address(e);const n=(0,m.lE)(e);if(null!=r.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return mr((0,m.zo)([[r.p2pkh],"0x"+t[2]]))}}if(null!=r.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return mr((0,m.zo)([[r.p2sh],"0x"+t[2]]))}}if(null!=r.prefix){const t=n[1];let e=n[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&n.length===2+t&&t>=1&&t<=75){const t=Ye().toWords(n.slice(2));return t.unshift(e),Ye().encode(r.prefix,t)}}return null}getAddress(t){return ir(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t)try{const t={to:this.address,data:"0x3b3b57de"+(0,Ke.VM)(this.name).substring(2)},e=yield this.provider.call(t);return"0x"===e||e===ze.R?null:this.provider.formatter.callAddress(e)}catch(t){if(t.code===y.Yd.errors.CALL_EXCEPTION)return null;throw t}const e=yield this._fetchBytes("0xf1cb7e06",pr(t));if(null==e||"0x"===e)return null;const r=this._getAddress(t,e);return null==r&&or.throwError("invalid or unsupported coin data",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),r}))}getAvatar(){return ir(this,void 0,void 0,(function*(){const t=[{type:"name",content:this.name}];try{const e=yield this.getText("avatar");if(null==e)return null;for(let r=0;r{})),this._ready().catch((t=>{}));else{const e=(0,g.tu)(new.target,"getNetwork")(t);e?((0,g.zG)(this,"_network",e),this.emit("network",e,null)):or.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ir(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||or.throwError("no network detected",y.Yd.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:(0,g.zG)(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return(0,Ve.$l)((()=>this._ready().then((t=>t),(t=>{if(t.code!==y.Yd.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))))}static getFormatter(){return null==Mr&&(Mr=new Qe),Mr}static getNetwork(t){return(0,je.H)(null==t?"homestead":t)}_getInternalBlockNumber(t){return ir(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const r=yield e;if(lr()-r.respTime<=t)return r.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=lr(),r=(0,g.mE)({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((t=>null),(t=>t))}).then((({blockNumber:t,networkError:n})=>{if(n)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),n;const i=lr();return(t=p.O$.from(t).toNumber()){this._internalBlockNumber===r&&(this._internalBlockNumber=null)})),(yield r).blockNumber}))}poll(){return ir(this,void 0,void 0,(function*(){const t=Ar++,e=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(r),this.emit("poll",t,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)or.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",or.makeError("network block skew detected",y.Yd.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let t=this._emitted.block+1;t<=r;t++)this.emit("block",t);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach((t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&r-e>12&&delete this._emitted[t]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach((t=>{switch(t.type){case"tx":{const r=t.hash;let n=this.getTransactionReceipt(r).then((t=>t&&null!=t.blockNumber?(this._emitted["t:"+r]=t.blockNumber,this.emit(r,t),null):null)).catch((t=>{this.emit("error",t)}));e.push(n);break}case"filter":{const n=t.filter;n.fromBlock=this._lastBlockNumber+1,n.toBlock=r;const i=this.getLogs(n).then((t=>{0!==t.length&&t.forEach((t=>{this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(n,t)}))})).catch((t=>{this.emit("error",t)}));e.push(i);break}}})),this._lastBlockNumber=r,Promise.all(e).then((()=>{this.emit("didPoll",t)})).catch((t=>{this.emit("error",t)}))}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return ir(this,void 0,void 0,(function*(){return or.throwError("provider does not support network detection",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return ir(this,void 0,void 0,(function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",e,t),yield hr(0),this._network;const r=or.makeError("underlying network changed",y.Yd.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",r),r}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((t=>{this._setFastBlockNumber(t)}),(t=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const t=lr();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&tthis._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,r){return ir(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==e?1:e,r||0,null)}))}_waitForTransaction(t,e,r,n){return ir(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(t);return(i?i.confirmations:0)>=e?i:new Promise(((i,o)=>{const s=[];let a=!1;const u=function(){return!!a||(a=!0,s.forEach((t=>{t()})),!1)},l=t=>{t.confirmations{this.removeListener(t,l)})),n){let r=n.startBlock,i=null;const l=s=>ir(this,void 0,void 0,(function*(){a||(yield hr(1e3),this.getTransactionCount(n.from).then((h=>ir(this,void 0,void 0,(function*(){if(!a){if(h<=n.nonce)r=s;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==i&&(i=r-3,i{a||this.once("block",l)})))}));if(a)return;this.once("block",l),s.push((()=>{this.removeListener("block",l)}))}if("number"==typeof r&&r>0){const t=setTimeout((()=>{u()||o(or.makeError("timeout exceeded",y.Yd.errors.TIMEOUT,{timeout:r}))}),r);t.unref&&t.unref(),s.push((()=>{clearTimeout(t)}))}}))}))}getBlockNumber(){return ir(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return p.O$.from(t)}catch(e){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}}))}getBalance(t,e){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,g.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getBalance",r);try{return p.O$.from(n)}catch(t){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"getBalance",params:r,result:n,error:t})}}))}getTransactionCount(t,e){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,g.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getTransactionCount",r);try{return p.O$.from(n).toNumber()}catch(t){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:n,error:t})}}))}getCode(t,e){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,g.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getCode",r);try{return(0,m.Dv)(n)}catch(t){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"getCode",params:r,result:n,error:t})}}))}getStorageAt(t,e,r){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield(0,g.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(r),position:Promise.resolve(e).then((t=>(0,m.$P)(t)))}),i=yield this.perform("getStorageAt",n);try{return(0,m.Dv)(i)}catch(t){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:i,error:t})}}))}_wrapTransaction(t,e,r){if(null!=e&&32!==(0,m.E1)(e))throw new Error("invalid response - sendTransaction");const n=t;return null!=e&&t.hash!==e&&or.throwError("Transaction hash mismatch from Provider.sendTransaction.",y.Yd.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),n.wait=(e,n)=>ir(this,void 0,void 0,(function*(){let i;null==e&&(e=1),null==n&&(n=0),0!==e&&null!=r&&(i={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:r});const o=yield this._waitForTransaction(t.hash,e,n,i);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&&or.throwError("transaction failed",y.Yd.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),n}sendTransaction(t){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then((t=>(0,m.Dv)(t))),r=this.formatter.transaction(t);null==r.confirmations&&(r.confirmations=0);const n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(r,t,n)}catch(t){throw t.transaction=r,t.transactionHash=r.hash,t}}))}_getTransactionRequest(t){return ir(this,void 0,void 0,(function*(){const e=yield t,r={};return["from","to"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?this._getAddress(t):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?p.O$.from(t):null)))})),["type"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>null!=t?t:null)))})),e.accessList&&(r.accessList=this.formatter.accessList(e.accessList)),["data"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?(0,m.Dv)(t):null)))})),this.formatter.transactionRequest(yield(0,g.mE)(r))}))}_getFilter(t){return ir(this,void 0,void 0,(function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach((r=>{null!=t[r]&&(e[r]=t[r])})),["fromBlock","toBlock"].forEach((r=>{null!=t[r]&&(e[r]=this._getBlockTag(t[r]))})),this.formatter.filter(yield(0,g.mE)(e))}))}call(t,e){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,g.mE)({transaction:this._getTransactionRequest(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("call",r);try{return(0,m.Dv)(n)}catch(t){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"call",params:r,result:n,error:t})}}))}estimateGas(t){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield(0,g.mE)({transaction:this._getTransactionRequest(t)}),r=yield this.perform("estimateGas",e);try{return p.O$.from(r)}catch(t){return or.throwError("bad result from backend",y.Yd.errors.SERVER_ERROR,{method:"estimateGas",params:e,result:r,error:t})}}))}_getAddress(t){return ir(this,void 0,void 0,(function*(){"string"!=typeof(t=yield t)&&or.throwArgumentError("invalid address or ENS name","name",t);const e=yield this.resolveName(t);return null==e&&or.throwError("ENS name not configured",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(t)})`}),e}))}_getBlock(t,e){return ir(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;let r=-128;const n={includeTransactions:!!e};if((0,m.A7)(t,32))n.blockHash=t;else try{n.blockTag=yield this._getBlockTag(t),(0,m.A7)(n.blockTag)&&(r=parseInt(n.blockTag.substring(2),16))}catch(e){or.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",t)}return(0,Ve.$l)((()=>ir(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",n);if(null==t)return null!=n.blockHash&&null==this._emitted["b:"+n.blockHash]||null!=n.blockTag&&r>this._emitted.block?null:void 0;if(e){let e=null;for(let r=0;rthis._wrapTransaction(t))),r}return this.formatter.block(t)}))),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return ir(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return(0,Ve.$l)((()=>ir(this,void 0,void 0,(function*(){const r=yield this.perform("getTransaction",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;const n=this.formatter.transactionResponse(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return this._wrapTransaction(n)}))),{oncePoll:this})}))}getTransactionReceipt(t){return ir(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return(0,Ve.$l)((()=>ir(this,void 0,void 0,(function*(){const r=yield this.perform("getTransactionReceipt",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;if(null==r.blockHash)return;const n=this.formatter.receipt(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return n}))),{oncePoll:this})}))}getLogs(t){return ir(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield(0,g.mE)({filter:this._getFilter(t)}),r=yield this.perform("getLogs",e);return r.forEach((t=>{null==t.removed&&(t.removed=!1)})),Qe.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return ir(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return ir(this,void 0,void 0,(function*(){if("number"==typeof(t=yield t)&&t<0){t%1&&or.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)}))}getResolver(t){return ir(this,void 0,void 0,(function*(){try{const e=yield this._getResolver(t);return null==e?null:new Er(this,e,t)}catch(t){if(t.code===y.Yd.errors.CALL_EXCEPTION)return null;throw t}}))}_getResolver(t){return ir(this,void 0,void 0,(function*(){const e=yield this.getNetwork();e.ensAddress||or.throwError("network does not support ENS",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"ENS",network:e.name});const r={to:e.ensAddress,data:"0x0178b8bf"+(0,Ke.VM)(t).substring(2)};try{return this.formatter.callAddress(yield this.call(r))}catch(t){if(t.code===y.Yd.errors.CALL_EXCEPTION)return null;throw t}}))}resolveName(t){return ir(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if((0,m.A7)(t))throw e}"string"!=typeof t&&or.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null}))}lookupAddress(t){return ir(this,void 0,void 0,(function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(e);if(!r)return null;let n=(0,m.lE)(yield this.call({to:r,data:"0x691f3431"+(0,Ke.VM)(e).substring(2)}));if(n.length<32||!p.O$.from(n.slice(0,32)).eq(32))return null;if(n=n.slice(32),n.length<32)return null;const i=p.O$.from(n.slice(0,32)).toNumber();if(n=n.slice(32),i>n.length)return null;const o=(0,$e.ZN)(n.slice(0,i));return(yield this.resolveName(o))!=t?null:o}))}getAvatar(t){return ir(this,void 0,void 0,(function*(){let e=null;if((0,m.A7)(t)){const r=this.formatter.address(t),n=r.substring(2).toLowerCase()+".addr.reverse",i=yield this._getResolver(n);if(!i)return null;e=new Er(this,i,"_",r)}else if(e=yield this.getResolver(t),!e)return null;const r=yield e.getAvatar();return null==r?null:r.url}))}perform(t,e){return or.throwError(t+" not implemented",y.Yd.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_stopEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_addEventListener(t,e,r){const n=new fr(ur(t),e,r);return this._events.push(n),this._startEvent(n),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let r=!1,n=[],i=ur(t);return this._events=this._events.filter((t=>t.tag!==i||(setTimeout((()=>{t.listener.apply(this,e)}),0),r=!0,!t.once||(n.push(t),!1)))),n.forEach((t=>{this._stopEvent(t)})),r}listenerCount(t){if(!t)return this._events.length;let e=ur(t);return this._events.filter((t=>t.tag===e)).length}listeners(t){if(null==t)return this._events.map((t=>t.listener));let e=ur(t);return this._events.filter((t=>t.tag===e)).map((t=>t.listener))}off(t,e){if(null==e)return this.removeAllListeners(t);const r=[];let n=!1,i=ur(t);return this._events=this._events.filter((t=>t.tag!==i||t.listener!=e||!!n||(n=!0,r.push(t),!1))),r.forEach((t=>{this._stopEvent(t)})),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const r=ur(t);this._events=this._events.filter((t=>t.tag!==r||(e.push(t),!1)))}return e.forEach((t=>{this._stopEvent(t)})),this}}var Nr=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Sr=new y.Yd(Je),Tr=["call","estimateGas"];function kr(t,e,r){if("call"===t&&e.code===y.Yd.errors.SERVER_ERROR){const t=e.error;if(t&&t.message.match("reverted")&&(0,m.A7)(t.data))return t.data;Sr.throwError("missing revert data in call exception",y.Yd.errors.CALL_EXCEPTION,{error:e,data:"0x"})}let n=e.message;e.code===y.Yd.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?n=e.error.message:"string"==typeof e.body?n=e.body:"string"==typeof e.responseText&&(n=e.responseText),n=(n||"").toLowerCase();const i=r.transaction||r.signedTransaction;throw n.match(/insufficient funds|base fee exceeds gas limit/)&&Sr.throwError("insufficient funds for intrinsic transaction cost",y.Yd.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:i}),n.match(/nonce too low/)&&Sr.throwError("nonce has already been used",y.Yd.errors.NONCE_EXPIRED,{error:e,method:t,transaction:i}),n.match(/replacement transaction underpriced/)&&Sr.throwError("replacement fee too low",y.Yd.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:i}),n.match(/only replay-protected/)&&Sr.throwError("legacy pre-eip-155 transactions not supported",y.Yd.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:i}),Tr.indexOf(t)>=0&&n.match(/gas required exceeds allowance|always failing transaction|execution reverted/)&&Sr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",y.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:i}),e}function Rr(t){return new Promise((function(e){setTimeout(e,t)}))}function xr(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function Or(t){return t?t.toLowerCase():t}const Ir={};class Cr extends f.E{constructor(t,e,r){if(Sr.checkNew(new.target,Cr),super(),t!==Ir)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");(0,g.zG)(this,"provider",e),null==r&&(r=0),"string"==typeof r?((0,g.zG)(this,"_address",this.provider.formatter.address(r)),(0,g.zG)(this,"_index",null)):"number"==typeof r?((0,g.zG)(this,"_index",r),(0,g.zG)(this,"_address",null)):Sr.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(t){return Sr.throwError("cannot alter JSON-RPC Signer connection",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Pr(Ir,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((t=>(t.length<=this._index&&Sr.throwError("unknown account #"+this._index,y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index]))))}sendUncheckedTransaction(t){t=(0,g.DC)(t);const e=this.getAddress().then((t=>(t&&(t=t.toLowerCase()),t)));if(null==t.gasLimit){const r=(0,g.DC)(t);r.from=e,t.gasLimit=this.provider.estimateGas(r)}return null!=t.to&&(t.to=Promise.resolve(t.to).then((t=>Nr(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.provider.resolveName(t);return null==e&&Sr.throwArgumentError("provided ENS name resolves to null","tx.to",t),e}))))),(0,g.mE)({tx:(0,g.mE)(t),sender:e}).then((({tx:e,sender:r})=>{null!=e.from?e.from.toLowerCase()!==r&&Sr.throwArgumentError("from address mismatch","transaction",t):e.from=r;const n=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[n]).then((t=>t),(t=>kr("sendTransaction",t,n)))}))}signTransaction(t){return Sr.throwError("signing transactions is unsupported",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return Nr(this,void 0,void 0,(function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(t);try{return yield(0,Ve.$l)((()=>Nr(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(r);if(null!==t)return this.provider._wrapTransaction(t,r,e)}))),{oncePoll:this.provider})}catch(t){throw t.transactionHash=r,t}}))}signMessage(t){return Nr(this,void 0,void 0,(function*(){const e="string"==typeof t?(0,$e.Y0)(t):t,r=yield this.getAddress();return yield this.provider.send("personal_sign",[(0,m.Dv)(e),r.toLowerCase()])}))}_legacySignMessage(t){return Nr(this,void 0,void 0,(function*(){const e="string"==typeof t?(0,$e.Y0)(t):t,r=yield this.getAddress();return yield this.provider.send("eth_sign",[r.toLowerCase(),(0,m.Dv)(e)])}))}_signTypedData(t,e,r){return Nr(this,void 0,void 0,(function*(){const n=yield $t.E.resolveNames(t,e,r,(t=>this.provider.resolveName(t))),i=yield this.getAddress();return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify($t.E.getPayload(n.domain,e,n.value))])}))}unlock(t){return Nr(this,void 0,void 0,(function*(){const e=this.provider,r=yield this.getAddress();return e.send("personal_unlockAccount",[r.toLowerCase(),t,null])}))}}class Pr extends Cr{sendTransaction(t){return this.sendUncheckedTransaction(t).then((t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)})))}}const Lr={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Ur extends _r{constructor(t,e){Sr.checkNew(new.target,Ur);let r=e;null==r&&(r=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then((e=>{t(e)}),(t=>{e(t)}))}),0)}))),super(r),t||(t=(0,g.tu)(this.constructor,"defaultUrl")()),"string"==typeof t?(0,g.zG)(this,"connection",Object.freeze({url:t})):(0,g.zG)(this,"connection",Object.freeze((0,g.DC)(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Nr(this,void 0,void 0,(function*(){yield Rr(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=(0,g.tu)(this.constructor,"getNetwork");try{return e(p.O$.from(t).toNumber())}catch(e){return Sr.throwError("could not detect network",y.Yd.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return Sr.throwError("could not detect network",y.Yd.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new Cr(Ir,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((t=>t.map((t=>this.formatter.address(t)))))}send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:(0,g.p$)(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(n&&this._cache[t])return this._cache[t];const i=(0,Ve.rd)(this.connection,JSON.stringify(r),xr).then((t=>(this.emit("debug",{action:"response",request:r,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",error:t,request:r,provider:this}),t}));return n&&(this._cache[t]=i,setTimeout((()=>{this._cache[t]=null}),0)),i}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[Or(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[Or(e.address),e.blockTag]];case"getCode":return["eth_getCode",[Or(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[Or(e.address),e.position,e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[(0,g.tu)(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[(0,g.tu)(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=Or(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return Nr(this,void 0,void 0,(function*(){if("call"===t||"estimateGas"===t){const t=e.transaction;if(t&&null!=t.type&&p.O$.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((e=(0,g.DC)(e)).transaction=(0,g.DC)(t),delete e.transaction.type)}}const r=this.prepareRequest(t,e);null==r&&Sr.throwError(t+" not implemented",y.Yd.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(r[0],r[1])}catch(r){return kr(t,r,e)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then((function(r){return function n(){t.send("eth_getFilterChanges",[r]).then((function(r){if(t._pendingFilter!=e)return null;let n=Promise.resolve();return r.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",n=n.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),n.then((function(){return Rr(1e3)}))})).then((function(){if(t._pendingFilter==e)return setTimeout((function(){n()}),0),null;t.send("eth_uninstallFilter",[r])})).catch((t=>{}))}(),r})).catch((t=>{}))}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const r=(0,g.DC)(Lr);if(e)for(const t in e)e[t]&&(r[t]=!0);(0,g.uj)(t,r);const n={};return["gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(e){if(null==t[e])return;const r=(0,m.$P)(t[e]);"gasLimit"===e&&(e="gas"),n[e]=r})),["from","to","data"].forEach((function(e){null!=t[e]&&(n[e]=(0,m.Dv)(t[e]))})),t.accessList&&(n.accessList=(0,v.z7)(t.accessList)),n}}let Br=null;try{if(Br=WebSocket,null==Br)throw new Error("inject please")}catch(t){const e=new y.Yd(Je);Br=function(){e.throwError("WebSockets not supported in this environment",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var Dr=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Fr=new y.Yd(Je);let Gr=1;class jr extends Ur{constructor(t,e){"any"===e&&Fr.throwError("WebSocketProvider does not support 'any' network yet",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),super(t,e),this._pollingInterval=-1,this._wsReady=!1,(0,g.zG)(this,"_websocket",new Br(this.connection.url)),(0,g.zG)(this,"_requests",{}),(0,g.zG)(this,"_subs",{}),(0,g.zG)(this,"_subIds",{}),(0,g.zG)(this,"_detectNetwork",super.detectNetwork()),this._websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach((t=>{this._websocket.send(this._requests[t].payload)}))},this._websocket.onmessage=t=>{const e=t.data,r=JSON.parse(e);if(null!=r.id){const t=String(r.id),n=this._requests[t];if(delete this._requests[t],void 0!==r.result)n.callback(null,r.result),this.emit("debug",{action:"response",request:JSON.parse(n.payload),response:r.result,provider:this});else{let t=null;r.error?(t=new Error(r.error.message||"unknown error"),(0,g.zG)(t,"code",r.error.code||null),(0,g.zG)(t,"response",e)):t=new Error("unknown error"),n.callback(t,void 0),this.emit("debug",{action:"response",error:t,request:JSON.parse(n.payload),provider:this})}}else if("eth_subscription"===r.method){const t=this._subs[r.params.subscription];t&&t.processFunc(r.params.result)}else console.warn("this should not happen")};const r=setInterval((()=>{this.emit("poll")}),1e3);r.unref&&r.unref()}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(t){Fr.throwError("cannot reset events block on WebSocketProvider",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(t){Fr.throwError("cannot set polling interval on WebSocketProvider",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return Dr(this,void 0,void 0,(function*(){return null}))}set polling(t){t&&Fr.throwError("cannot set polling on WebSocketProvider",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(t,e){const r=Gr++;return new Promise(((n,i)=>{const o=JSON.stringify({method:t,params:e,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(o),provider:this}),this._requests[String(r)]={callback:function(t,e){return t?i(t):n(e)},payload:o},this._wsReady&&this._websocket.send(o)}))}static defaultUrl(){return"ws://localhost:8546"}_subscribe(t,e,r){return Dr(this,void 0,void 0,(function*(){let n=this._subIds[t];null==n&&(n=Promise.all(e).then((t=>this.send("eth_subscribe",t))),this._subIds[t]=n);const i=yield n;this._subs[i]={tag:t,processFunc:r}}))}_startEvent(t){switch(t.type){case"block":this._subscribe("block",["newHeads"],(t=>{const e=p.O$.from(t.number).toNumber();this._emitted.block=e,this.emit("block",e)}));break;case"pending":this._subscribe("pending",["newPendingTransactions"],(t=>{this.emit("pending",t)}));break;case"filter":this._subscribe(t.tag,["logs",this._getFilter(t.filter)],(e=>{null==e.removed&&(e.removed=!1),this.emit(t.filter,this.formatter.filterLog(e))}));break;case"tx":{const e=t=>{const e=t.hash;this.getTransactionReceipt(e).then((t=>{t&&this.emit(e,t)}))};e(t),this._subscribe("tx",["newHeads"],(t=>{this._events.filter((t=>"tx"===t.type)).forEach(e)}));break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",t)}}_stopEvent(t){let e=t.tag;if("tx"===t.type){if(this._events.filter((t=>"tx"===t.type)).length)return;e="tx"}else if(this.listenerCount(t.event))return;const r=this._subIds[e];r&&(delete this._subIds[e],r.then((t=>{this._subs[t]&&(delete this._subs[t],this.send("eth_unsubscribe",[t]))})))}destroy(){return Dr(this,void 0,void 0,(function*(){this._websocket.readyState===Br.CONNECTING&&(yield new Promise((t=>{this._websocket.onopen=function(){t(!0)},this._websocket.onerror=function(){t(!1)}}))),this._websocket.close(1e3)}))}}const qr=new y.Yd(Je);class zr extends Ur{detectNetwork(){const t=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return e=this,r=void 0,i=function*(){let e=this.network;return null==e&&(e=yield t.detectNetwork.call(this),e||qr.throwError("no network detected",y.Yd.errors.UNKNOWN_ERROR,{}),null==this._network&&((0,g.zG)(this,"_network",e),this.emit("network",e,null))),e},new((n=void 0)||(n=Promise))((function(t,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(t){t(r)}))).then(s,a)}u((i=i.apply(e,r||[])).next())}));var e,r,n,i}}class Kr extends zr{constructor(t,e){qr.checkAbstract(new.target,Kr),t=(0,g.tu)(new.target,"getNetwork")(t),e=(0,g.tu)(new.target,"getApiKey")(e),super((0,g.tu)(new.target,"getUrl")(t,e),t),"string"==typeof e?(0,g.zG)(this,"apiKey",e):null!=e&&Object.keys(e).forEach((t=>{(0,g.zG)(this,t,e[t])}))}_startPending(){qr.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(t){return qr.throwError("API provider does not support signing",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(t){return t}static getUrl(t,e){return qr.throwError("not implemented; sub-classes must override getUrl",y.Yd.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const Hr=new y.Yd(Je),$r="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class Vr extends jr{constructor(t,e){const r=new Wr(t,e);super(r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi."),r.network),(0,g.zG)(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===$r}}class Wr extends Kr{static getWebSocketProvider(t,e){return new Vr(t,e)}static getApiKey(t){return null==t?$r:(t&&"string"!=typeof t&&Hr.throwArgumentError("invalid apiKey","apiKey",t),t)}static getUrl(t,e){let r=null;switch(t.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"ropsten":r="eth-ropsten.alchemyapi.io/v2/";break;case"rinkeby":r="eth-rinkeby.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.alchemyapi.io/v2/";break;case"kovan":r="eth-kovan.alchemyapi.io/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-rinkeby":r="arb-rinkeby.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-kovan":r="opt-kovan.g.alchemy.com/v2/";break;default:Hr.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+e,throttleCallback:(t,r)=>(e===$r&&nr(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===$r}}const Yr=new y.Yd(Je);class Jr extends Kr{static getApiKey(t){return null!=t&&Yr.throwArgumentError("apiKey not supported for cloudflare","apiKey",t),null}static getUrl(t,e){let r=null;return"homestead"===t.name?r="https://cloudflare-eth.com/":Yr.throwArgumentError("unsupported network","network",arguments[0]),r}perform(t,e){const r=Object.create(null,{perform:{get:()=>super.perform}});return n=this,i=void 0,s=function*(){return"getBlockNumber"===t?(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number:r.perform.call(this,t,e)},new((o=void 0)||(o=Promise))((function(t,e){function r(t){try{u(s.next(t))}catch(t){e(t)}}function a(t){try{u(s.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(r,a)}u((s=s.apply(n,i||[])).next())}));var n,i,o,s}}var Xr=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Zr=new y.Yd(Je);function Qr(t){const e={};for(let r in t){if(null==t[r])continue;let n=t[r];"type"===r&&0===n||(n={type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?(0,m.$P)((0,m.Dv)(n)):"accessList"===r?"["+(0,v.z7)(n).map((t=>`{address:"${t.address}",storageKeys:["${t.storageKeys.join('","')}"]}`)).join(",")+"]":(0,m.Dv)(n),e[r]=n)}return e}function tn(t){if(0==t.status&&("No records found"===t.message||"No transactions found"===t.message))return t.result;if(1!=t.status||"OK"!=t.message){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function en(t){if(t&&0==t.status&&"NOTOK"==t.message&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if("2.0"!=t.jsonrpc){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function rn(t){if("pending"===t)throw new Error("pending not supported");return"latest"===t?t:parseInt(t.substring(2),16)}const nn="9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB";function on(t,e,r){if("call"===t&&e.code===y.Yd.errors.SERVER_ERROR){const t=e.error;if(t&&(t.message.match(/reverted/i)||t.message.match(/VM execution error/i))){let r=t.data;if(r&&(r="0x"+r.replace(/^.*0x/i,"")),(0,m.A7)(r))return r;Zr.throwError("missing revert data in call exception",y.Yd.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===y.Yd.errors.SERVER_ERROR&&(e.error&&"string"==typeof e.error.message?n=e.error.message:"string"==typeof e.body?n=e.body:"string"==typeof e.responseText&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&Zr.throwError("insufficient funds for intrinsic transaction cost",y.Yd.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&Zr.throwError("nonce has already been used",y.Yd.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&Zr.throwError("replacement fee too low",y.Yd.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&Zr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",y.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class sn extends _r{constructor(t,e){Zr.checkNew(new.target,sn),super(t),(0,g.zG)(this,"baseUrl",this.getBaseUrl()),(0,g.zG)(this,"apiKey",e||nn)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"ropsten":return"https://api-ropsten.etherscan.io";case"rinkeby":return"https://api-rinkeby.etherscan.io";case"kovan":return"https://api-kovan.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io"}return Zr.throwArgumentError("unsupported network","network",name)}getUrl(t,e){const r=Object.keys(e).reduce(((t,r)=>{const n=e[r];return null!=n&&(t+=`&${r}=${n}`),t}),""),n=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${t}${r}${n}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(t,e){return e.module=t,e.apikey=this.apiKey,e}fetch(t,e,r){return Xr(this,void 0,void 0,(function*(){const n=r?this.getPostUrl():this.getUrl(t,e),i=r?this.getPostData(t,e):null,o="proxy"===t?en:tn;this.emit("debug",{action:"request",request:n,provider:this});const s={url:n,throttleSlotInterval:1e3,throttleCallback:(t,e)=>(this.isCommunityResource()&&nr(),Promise.resolve(!0))};let a=null;i&&(s.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(i).map((t=>`${t}=${i[t]}`)).join("&"));const u=yield(0,Ve.rd)(s,a,o||en);return this.emit("debug",{action:"response",request:n,response:(0,g.p$)(u),provider:this}),u}))}detectNetwork(){return Xr(this,void 0,void 0,(function*(){return this.network}))}perform(t,e){const r=Object.create(null,{perform:{get:()=>super.perform}});return Xr(this,void 0,void 0,(function*(){switch(t){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:e.address,tag:e.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:e.address,tag:e.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:e.address,tag:e.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:e.address,position:e.position,tag:e.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:e.signedTransaction},!0).catch((t=>on("sendTransaction",t,e.signedTransaction)));case"getBlock":if(e.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:e.blockTag,boolean:e.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:e.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:e.transactionHash});case"call":{if("latest"!==e.blockTag)throw new Error("EtherscanProvider does not support blockTag for call");const t=Qr(e.transaction);t.module="proxy",t.action="eth_call";try{return yield this.fetch("proxy",t,!0)}catch(t){return on("call",t,e.transaction)}}case"estimateGas":{const t=Qr(e.transaction);t.module="proxy",t.action="eth_estimateGas";try{return yield this.fetch("proxy",t,!0)}catch(t){return on("estimateGas",t,e.transaction)}}case"getLogs":{const t={action:"getLogs"};if(e.filter.fromBlock&&(t.fromBlock=rn(e.filter.fromBlock)),e.filter.toBlock&&(t.toBlock=rn(e.filter.toBlock)),e.filter.address&&(t.address=e.filter.address),e.filter.topics&&e.filter.topics.length>0&&(e.filter.topics.length>1&&Zr.throwError("unsupported topic count",y.Yd.errors.UNSUPPORTED_OPERATION,{topics:e.filter.topics}),1===e.filter.topics.length)){const r=e.filter.topics[0];"string"==typeof r&&66===r.length||Zr.throwError("unsupported topic format",y.Yd.errors.UNSUPPORTED_OPERATION,{topic0:r}),t.topic0=r}const r=yield this.fetch("logs",t);let n={};for(let t=0;t{["contractAddress","to"].forEach((function(e){""==t[e]&&delete t[e]})),null==t.creates&&null!=t.contractAddress&&(t.creates=t.contractAddress);const e=this.formatter.transactionResponse(t);return t.timeStamp&&(e.timestamp=parseInt(t.timeStamp)),e}))}))}isCommunityResource(){return this.apiKey===nn}}var an=r(2472),un=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const ln=new y.Yd(Je);function hn(){return(new Date).getTime()}function cn(t){let e=null;for(let r=0;re?null:(n+i)/2}function dn(t){if(null===t)return"null";if("number"==typeof t||"boolean"==typeof t)return JSON.stringify(t);if("string"==typeof t)return t;if(p.O$.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map((t=>dn(t))));if("object"==typeof t){const e=Object.keys(t);return e.sort(),"{"+e.map((e=>{let r=t[e];return r="function"==typeof r?"[function]":dn(r),JSON.stringify(e)+":"+r})).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let pn=1;function mn(t){let e=null,r=null,n=new Promise((n=>{e=function(){r&&(clearTimeout(r),r=null),n()},r=setTimeout(e,t)}));return{cancel:e,getPromise:function(){return n},wait:t=>(n=n.then(t),n)}}const gn=[y.Yd.errors.CALL_EXCEPTION,y.Yd.errors.INSUFFICIENT_FUNDS,y.Yd.errors.NONCE_EXPIRED,y.Yd.errors.REPLACEMENT_UNDERPRICED,y.Yd.errors.UNPREDICTABLE_GAS_LIMIT],vn=["address","args","errorArgs","errorSignature","method","transaction"];function yn(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function bn(t,e){return un(this,void 0,void 0,(function*(){const r=t.provider;return null!=r.blockNumber&&r.blockNumber>=e||-1===e?r:(0,Ve.$l)((()=>new Promise(((n,i)=>{setTimeout((function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)}),0)}))),{oncePoll:r})}))}function wn(t,e,r,n){return un(this,void 0,void 0,(function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&(0,m.A7)(n.blockTag)&&(i=yield bn(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&(0,m.A7)(n.blockTag)&&(i=yield bn(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&(0,m.A7)(n.blockTag)&&(i=yield bn(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&(0,m.A7)(n.blockTag)&&(i=yield bn(t,e)),i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let r=n.filter;return(r.fromBlock&&(0,m.A7)(r.fromBlock)||r.toBlock&&(0,m.A7)(r.toBlock))&&(i=yield bn(t,e)),i.getLogs(r)}}return ln.throwError("unknown method error",y.Yd.errors.UNKNOWN_ERROR,{method:r,params:n})}))}class En extends _r{constructor(t,e){ln.checkNew(new.target,En),0===t.length&&ln.throwArgumentError("missing providers","providers",t);const r=t.map(((t,e)=>{if(c.zt.isProvider(t)){const e=er(t)?2e3:750,r=1;return Object.freeze({provider:t,weight:1,stallTimeout:e,priority:r})}const r=(0,g.DC)(t);null==r.priority&&(r.priority=1),null==r.stallTimeout&&(r.stallTimeout=er(t)?2e3:750),null==r.weight&&(r.weight=1);const n=r.weight;return(n%1||n>512||n<1)&&ln.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${e}].weight`,n),Object.freeze(r)})),n=r.reduce(((t,e)=>t+e.weight),0);null==e?e=n/2:e>n&&ln.throwArgumentError("quorum will always fail; larger than total weight","quorum",e);let i=cn(r.map((t=>t.provider.network)));null==i&&(i=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then(t,e)}),0)}))),super(i),(0,g.zG)(this,"providerConfigs",Object.freeze(r)),(0,g.zG)(this,"quorum",e),this._highestBlockNumber=-1}detectNetwork(){return un(this,void 0,void 0,(function*(){return cn(yield Promise.all(this.providerConfigs.map((t=>t.provider.getNetwork()))))}))}perform(t,e){return un(this,void 0,void 0,(function*(){if("sendTransaction"===t){const t=yield Promise.all(this.providerConfigs.map((t=>t.provider.sendTransaction(e.signedTransaction).then((t=>t.hash),(t=>t)))));for(let e=0;et.result));let n=fn(e.map((t=>t.result)),2);if(null!=n)return n=Math.ceil(n),r.indexOf(n+1)>=0&&n++,n>=t._highestBlockNumber&&(t._highestBlockNumber=n),t._highestBlockNumber};case"getGasPrice":return function(t){const e=t.map((t=>t.result));return e.sort(),e[Math.floor(e.length/2)]};case"getEtherPrice":return function(t){return fn(t.map((t=>t.result)))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(t){return null==t?null:((t=(0,g.DC)(t)).confirmations=-1,dn(t))};break;case"getBlock":n=r.includeTransactions?function(t){return null==t?null:((t=(0,g.DC)(t)).transactions=t.transactions.map((t=>((t=(0,g.DC)(t)).confirmations=-1,t))),dn(t))}:function(t){return null==t?null:dn(t)};break;default:throw new Error("unknown method: "+e)}return function(t,e){return function(r){const n={};r.forEach((e=>{const r=t(e.result);n[r]||(n[r]={count:0,result:e.result}),n[r].count++}));const i=Object.keys(n);for(let t=0;t=e)return r.result}}}(n,t.quorum)}(this,t,e),n=(0,an.y)(this.providerConfigs.map(g.DC));n.sort(((t,e)=>t.priority-e.priority));const i=this._highestBlockNumber;let o=0,s=!0;for(;;){const a=hn();let u=n.filter((t=>t.runner&&a-t.startt+e.weight),0);for(;u{r.staller=null})),r.runner=wn(r,i,t,e).then((n=>{r.done=!0,r.result=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:yn(r,hn()),request:{method:t,params:(0,g.p$)(e)},provider:this})}),(n=>{r.done=!0,r.error=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:yn(r,hn()),request:{method:t,params:(0,g.p$)(e)},provider:this})})),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:yn(r,null),request:{method:t,params:(0,g.p$)(e)},provider:this}),u+=r.weight}const l=[];n.forEach((t=>{!t.done&&t.runner&&(l.push(t.runner),t.staller&&l.push(t.staller.getPromise()))})),l.length&&(yield Promise.race(l));const h=n.filter((t=>t.done&&null==t.error));if(h.length>=this.quorum){const t=r(h);if(void 0!==t)return n.forEach((t=>{t.staller&&t.staller.cancel(),t.cancelled=!0})),t;s||(yield mn(100).getPromise()),s=!1}const c=n.reduce(((t,e)=>{if(!e.done||null==e.error)return t;const r=e.error.code;return gn.indexOf(r)>=0&&(t[r]||(t[r]={error:e.error,weight:0}),t[r].weight+=e.weight),t}),{});if(Object.keys(c).forEach((t=>{const e=c[t];if(e.weight{t.staller&&t.staller.cancel(),t.cancelled=!0}));const r=e.error,i={};vn.forEach((t=>{null!=r[t]&&(i[t]=r[t])})),ln.throwError(r.reason||r.message,t,i)})),0===n.filter((t=>!t.done)).length)break}return n.forEach((t=>{t.staller&&t.staller.cancel(),t.cancelled=!0})),ln.throwError("failed to meet quorum",y.Yd.errors.SERVER_ERROR,{method:t,params:e,results:n.map((t=>yn(t))),provider:this})}))}}const Mn=null,An=new y.Yd(Je),_n="84842078b09946638c03157f83405213";class Nn extends jr{constructor(t,e){const r=new Sn(t,e),n=r.connection;n.password&&An.throwError("INFURA WebSocket project secrets unsupported",y.Yd.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"}),super(n.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/"),t),(0,g.zG)(this,"apiKey",r.projectId),(0,g.zG)(this,"projectId",r.projectId),(0,g.zG)(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===_n}}class Sn extends Kr{static getWebSocketProvider(t,e){return new Nn(t,e)}static getApiKey(t){const e={apiKey:_n,projectId:_n,projectSecret:null};return null==t||("string"==typeof t?e.projectId=t:null!=t.projectSecret?(An.assertArgument("string"==typeof t.projectId,"projectSecret requires a projectId","projectId",t.projectId),An.assertArgument("string"==typeof t.projectSecret,"invalid projectSecret","projectSecret","[REDACTED]"),e.projectId=t.projectId,e.projectSecret=t.projectSecret):t.projectId&&(e.projectId=t.projectId),e.apiKey=e.projectId),e}static getUrl(t,e){let r=null;switch(t?t.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"ropsten":r="ropsten.infura.io";break;case"rinkeby":r="rinkeby.infura.io";break;case"kovan":r="kovan.infura.io";break;case"goerli":r="goerli.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-kovan":r="optimism-kovan.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-rinkeby":r="arbitrum-rinkeby.infura.io";break;default:An.throwError("unsupported network",y.Yd.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const n={allowGzip:!0,url:"https://"+r+"/v3/"+e.projectId,throttleCallback:(t,r)=>(e.projectId===_n&&nr(),Promise.resolve(!0))};return null!=e.projectSecret&&(n.user="",n.password=e.projectSecret),n}isCommunityResource(){return this.projectId===_n}}class Tn extends Ur{send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const n={request:r,resolve:null,reject:null},i=new Promise(((t,e)=>{n.resolve=t,n.reject=e}));return this._pendingBatch.push(n),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const e=t.map((t=>t.request));return this.emit("debug",{action:"requestBatch",request:(0,g.p$)(e),provider:this}),(0,Ve.rd)(this.connection,JSON.stringify(e)).then((r=>{this.emit("debug",{action:"response",request:e,response:r,provider:this}),t.forEach(((t,e)=>{const n=r[e];if(n.error){const e=new Error(n.error.message);e.code=n.error.code,e.data=n.error.data,t.reject(e)}else t.resolve(n.result)}))}),(r=>{this.emit("debug",{action:"response",error:r,request:e,provider:this}),t.forEach((t=>{t.reject(r)}))}))}),10)),i}}const kn=new y.Yd(Je);class Rn extends Kr{static getApiKey(t){return t&&"string"!=typeof t&&kn.throwArgumentError("invalid apiKey","apiKey",t),t||"ETHERS_JS_SHARED"}static getUrl(t,e){kn.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(t.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:kn.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+e}}const xn=new y.Yd(Je),On={homestead:"6004bcd10040261633ade990",ropsten:"6004bd4d0040261633ade991",rinkeby:"6004bda20040261633ade994",goerli:"6004bd860040261633ade992"};class In extends Kr{constructor(t,e){if(null==e){const r=(0,g.tu)(new.target,"getNetwork")(t);if(r){const t=On[r.name];t&&(e={applicationId:t,loadBalancer:!0})}null==e&&xn.throwError("unsupported network",y.Yd.errors.INVALID_ARGUMENT,{argument:"network",value:t})}super(t,e)}static getApiKey(t){null==t&&xn.throwArgumentError("PocketProvider.getApiKey does not support null apiKey","apiKey",t);const e={applicationId:null,loadBalancer:!1,applicationSecretKey:null};return"string"==typeof t?e.applicationId=t:null!=t.applicationSecretKey?(xn.assertArgument("string"==typeof t.applicationId,"applicationSecretKey requires an applicationId","applicationId",t.applicationId),xn.assertArgument("string"==typeof t.applicationSecretKey,"invalid applicationSecretKey","applicationSecretKey","[REDACTED]"),e.applicationId=t.applicationId,e.applicationSecretKey=t.applicationSecretKey,e.loadBalancer=!!t.loadBalancer):t.applicationId?(xn.assertArgument("string"==typeof t.applicationId,"apiKey.applicationId must be a string","apiKey.applicationId",t.applicationId),e.applicationId=t.applicationId,e.loadBalancer=!!t.loadBalancer):xn.throwArgumentError("unsupported PocketProvider apiKey","apiKey",t),e}static getUrl(t,e){let r=null;switch(t?t.name:"unknown"){case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"goerli":r="eth-goerli.gateway.pokt.network";break;default:xn.throwError("unsupported network",y.Yd.errors.INVALID_ARGUMENT,{argument:"network",value:t})}let n=null;n=e.loadBalancer?`https://${r}/v1/lb/${e.applicationId}`:`https://${r}/v1/${e.applicationId}`;const i={url:n,headers:{}};return null!=e.applicationSecretKey&&(i.user="",i.password=e.applicationSecretKey),i}isCommunityResource(){return this.applicationId===On[this.network.name]}}const Cn=new y.Yd(Je);let Pn=1;function Ln(t,e){const r="Web3LegacyFetcher";return function(t,n){const i={method:t,params:n,id:Pn++,jsonrpc:"2.0"};return new Promise(((t,n)=>{this.emit("debug",{action:"request",fetcher:r,request:(0,g.p$)(i),provider:this}),e(i,((e,o)=>{if(e)return this.emit("debug",{action:"response",fetcher:r,error:e,request:i,provider:this}),n(e);if(this.emit("debug",{action:"response",fetcher:r,request:i,response:o,provider:this}),o.error){const t=new Error(o.error.message);return t.code=o.error.code,t.data=o.error.data,n(t)}t(o.result)}))}))}}class Un extends Ur{constructor(t,e){Cn.checkNew(new.target,Un),null==t&&Cn.throwArgumentError("missing provider","provider",t);let r=null,n=null,i=null;"function"==typeof t?(r="unknown:",n=t):(r=t.host||t.path||"",!r&&t.isMetaMask&&(r="metamask"),i=t,t.request?(""===r&&(r="eip-1193:"),n=function(t){return function(e,r){null==r&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:(0,g.p$)(n),provider:this}),t.request(n).then((t=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:t,provider:this}),t}))}}(t)):t.sendAsync?n=Ln(0,t.sendAsync.bind(t)):t.send?n=Ln(0,t.send.bind(t)):Cn.throwArgumentError("unsupported provider","provider",t),r||(r="unknown:")),super(r,e),(0,g.zG)(this,"jsonRpcFetchFunc",n),(0,g.zG)(this,"provider",i)}send(t,e){return this.jsonRpcFetchFunc(t,e)}}const Bn=new y.Yd(Je);function Dn(t,e){if(null==t&&(t="homestead"),"string"==typeof t){const e=t.match(/^(ws|http)s?:/i);if(e)switch(e[1]){case"http":return new Ur(t);case"ws":return new jr(t);default:Bn.throwArgumentError("unsupported URL scheme","network",t)}}const r=(0,je.H)(t);return r&&r._defaultProvider||Bn.throwError("unsupported getDefaultProvider network",y.Yd.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:En,AlchemyProvider:Wr,CloudflareProvider:Jr,EtherscanProvider:sn,InfuraProvider:Sn,JsonRpcProvider:Ur,NodesmithProvider:Rn,PocketProvider:In,Web3Provider:Un,IpcProvider:Mn},e)}var Fn=r(1094),Gn=r.n(Fn);let jn=!1,qn=!1;const zn={debug:1,default:2,info:2,warning:3,error:4,off:5};let Kn=zn.default,Hn=null;const $n=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Vn,Wn;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Vn||(Vn={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Wn||(Wn={}));const Yn="0123456789abcdef";class Jn{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==zn[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Kn>zn[r]||console.log.apply(console,e)}debug(...t){this._log(Jn.levels.DEBUG,t)}info(...t){this._log(Jn.levels.INFO,t)}warn(...t){this._log(Jn.levels.WARNING,t)}makeError(t,e,r){if(qn)return this.makeError("censored error",e,{});e||(e=Jn.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Yn[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Wn.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Wn.CALL_EXCEPTION:case Wn.INSUFFICIENT_FUNDS:case Wn.MISSING_NEW:case Wn.NONCE_EXPIRED:case Wn.REPLACEMENT_UNDERPRICED:case Wn.TRANSACTION_REPLACED:case Wn.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Jn.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),$n&&this.throwError("platform missing String.prototype.normalize",Jn.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:$n})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Jn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Jn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,Jn.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Jn.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Jn.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Jn.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Hn||(Hn=new Jn("logger/5.7.0")),Hn}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Jn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),jn){if(!t)return;this.globalLogger().throwError("error censorship permanent",Jn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}qn=!!t,jn=!!e}static setLogLevel(t){const e=zn[t.toLowerCase()];null!=e?Kn=e:Jn.globalLogger().warn("invalid log level - "+t)}static from(t){return new Jn(t)}}Jn.errors=Wn,Jn.levels=Vn;const Xn=new Jn("bytes/5.7.0");function Zn(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Zn(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Qn(t){return"number"==typeof t&&t==t&&t%1==0}function ti(t,e){if(e||(e={}),"number"==typeof t){Xn.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Zn(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Xn.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?Zn(new Uint8Array(t)):Xn.throwArgumentError("invalid arrayify value","value",t)}const ei=new Jn("strings/5.7.0");var ri,ni;function ii(t,e,r,n,i){if(t===ni.BAD_PREFIX||t===ni.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n>6==2;n++)t++;return t}return t===ni.OVERRUN?r.length-e-1:0}function oi(t){return e=function(t,e=ri.current){e!=ri.current&&(ei.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return ti(r)}(t),"0x"+Gn().keccak_256(ti(e));var e}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(ri||(ri={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(ni||(ni={})),Object.freeze({error:function(t,e,r,n,i){return ei.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:ii,replace:function(t,e,r,n,i){return t===ni.OVERLONG?(n.push(i),0):(n.push(65533),ii(t,e,r))}}),new Jn("properties/5.7.0");const si=new Jn("wordlists/5.5.0");class ai{constructor(t){si.checkAbstract(new.target,ai),function(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}(this,"locale",t)}split(t){return t.toLowerCase().split(/ +/g)}join(t){return t.join(" ")}static check(t){const e=[];for(let r=0;r<2048;r++){const n=t.getWord(r);if(r!==t.getWordIndex(n))return"0x";e.push(n)}return oi(e.join("\n")+"\n")}static register(t,e){e||(e=t.locale)}}let ui=null;function li(t){if(null==ui&&(ui="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==ai.check(t)))throw ui=null,new Error("BIP39 Wordlist for en (English) FAILED")}const hi=new class extends ai{constructor(){super("en")}getWord(t){return li(this),ui[t]}getWordIndex(t){return li(this),ui.indexOf(t)}};ai.register(hi);const ci={en:hi};let fi=!1,di=!1;const pi={debug:1,default:2,info:2,warning:3,error:4,off:5};let mi=pi.default,gi=null;const vi=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var yi,bi;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(yi||(yi={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(bi||(bi={}));const wi="0123456789abcdef";class Ei{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==pi[r]&&this.throwArgumentError("invalid log level name","logLevel",t),mi>pi[r]||console.log.apply(console,e)}debug(...t){this._log(Ei.levels.DEBUG,t)}info(...t){this._log(Ei.levels.INFO,t)}warn(...t){this._log(Ei.levels.WARNING,t)}makeError(t,e,r){if(di)return this.makeError("censored error",e,{});e||(e=Ei.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=wi[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case bi.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case bi.CALL_EXCEPTION:case bi.INSUFFICIENT_FUNDS:case bi.MISSING_NEW:case bi.NONCE_EXPIRED:case bi.REPLACEMENT_UNDERPRICED:case bi.TRANSACTION_REPLACED:case bi.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Ei.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),vi&&this.throwError("platform missing String.prototype.normalize",Ei.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:vi})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Ei.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Ei.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,Ei.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Ei.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Ei.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Ei.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return gi||(gi=new Ei("logger/5.7.0")),gi}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Ei.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),fi){if(!t)return;this.globalLogger().throwError("error censorship permanent",Ei.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}di=!!t,fi=!!e}static setLogLevel(t){const e=pi[t.toLowerCase()];null!=e?mi=e:Ei.globalLogger().warn("invalid log level - "+t)}static from(t){return new Ei(t)}}Ei.errors=bi,Ei.levels=yi;const Mi=new Ei("bytes/5.7.0");function Ai(t){return!!t.toHexString}function _i(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return _i(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Ni(t){return"number"==typeof t&&t==t&&t%1==0}function Si(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Ni(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Ti(t,e){if(e||(e={}),"number"==typeof t){Mi.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),_i(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Ai(t)&&(t=t.toHexString()),Ri(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Mi.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;tTi(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),_i(n)}function Ri(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const xi="0123456789abcdef";function Oi(t,e){if(e||(e={}),"number"==typeof t){Mi.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=xi[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Ai(t))return t.toHexString();if(Ri(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":Mi.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Si(t)){let e="0x";for(let r=0;r>4]+xi[15&n]}return e}return Mi.throwArgumentError("invalid hexlify value","value",t)}function Ii(t,e){for("string"!=typeof t?t=Oi(t):Ri(t)||Mi.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Mi.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}const Ci=new Ei("properties/5.7.0");function Pi(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function Li(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}const Ui={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Bi(t){if(null==t||Ui[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rFi(t))));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&Pi(e,r,Fi(n))}return e}return Ci.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Fi(t){return Di(t)}class Gi{constructor(t){for(const e in t)this[e]=Fi(t[e])}}const ji="abi/5.5.0";var qi=r(8020),zi=r.n(qi)().BN;const Ki=new Ei("bignumber/5.7.0"),Hi={};let $i=!1;class Vi{constructor(t,e){t!==Hi&&Ki.throwError("cannot call constructor directly; use BigNumber.from",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Yi(Ji(this).fromTwos(t))}toTwos(t){return Yi(Ji(this).toTwos(t))}abs(){return"-"===this._hex[0]?Vi.from(this._hex.substring(1)):this}add(t){return Yi(Ji(this).add(Ji(t)))}sub(t){return Yi(Ji(this).sub(Ji(t)))}div(t){return Vi.from(t).isZero()&&Xi("division-by-zero","div"),Yi(Ji(this).div(Ji(t)))}mul(t){return Yi(Ji(this).mul(Ji(t)))}mod(t){const e=Ji(t);return e.isNeg()&&Xi("division-by-zero","mod"),Yi(Ji(this).umod(e))}pow(t){const e=Ji(t);return e.isNeg()&&Xi("negative-power","pow"),Yi(Ji(this).pow(e))}and(t){const e=Ji(t);return(this.isNegative()||e.isNeg())&&Xi("unbound-bitwise-result","and"),Yi(Ji(this).and(e))}or(t){const e=Ji(t);return(this.isNegative()||e.isNeg())&&Xi("unbound-bitwise-result","or"),Yi(Ji(this).or(e))}xor(t){const e=Ji(t);return(this.isNegative()||e.isNeg())&&Xi("unbound-bitwise-result","xor"),Yi(Ji(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Xi("negative-width","mask"),Yi(Ji(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Xi("negative-width","shl"),Yi(Ji(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Xi("negative-width","shr"),Yi(Ji(this).shrn(t))}eq(t){return Ji(this).eq(Ji(t))}lt(t){return Ji(this).lt(Ji(t))}lte(t){return Ji(this).lte(Ji(t))}gt(t){return Ji(this).gt(Ji(t))}gte(t){return Ji(this).gte(Ji(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Ji(this).isZero()}toNumber(){try{return Ji(this).toNumber()}catch(t){Xi("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Ki.throwError("this platform does not support BigInt",Ei.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?$i||($i=!0,Ki.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ki.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ei.errors.UNEXPECTED_ARGUMENT,{}):Ki.throwError("BigNumber.toString does not accept parameters",Ei.errors.UNEXPECTED_ARGUMENT,{})),Ji(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Vi)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Vi(Hi,Wi(t)):t.match(/^-?[0-9]+$/)?new Vi(Hi,Wi(new zi(t))):Ki.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Xi("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&Xi("overflow","BigNumber.from",t),Vi.from(String(t));const e=t;if("bigint"==typeof e)return Vi.from(e.toString());if(Si(e))return Vi.from(Oi(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Vi.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Ri(t)||"-"===t[0]&&Ri(t.substring(1))))return Vi.from(t)}return Ki.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Wi(t){if("string"!=typeof t)return Wi(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Ki.throwArgumentError("invalid hex","value",t),"0x00"===(t=Wi(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Yi(t){return Vi.from(Wi(t))}function Ji(t){const e=Vi.from(t).toHexString();return"-"===e[0]?new zi("-"+e.substring(3),16):new zi(e.substring(2),16)}function Xi(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),Ki.throwError(t,Ei.errors.NUMERIC_FAULT,n)}const Zi=new Ei(ji);function Qi(t){const e=[],r=function(t,n){if(Array.isArray(n))for(let i in n){const o=t.slice();o.push(i);try{r(o,n[i])}catch(t){e.push({path:o,error:t})}}};return r([],t),e}class to{constructor(t,e,r,n){this.name=t,this.type=e,this.localName=r,this.dynamic=n}_throwError(t,e){Zi.throwArgumentError(t,this.localName,e)}}class eo{constructor(t){Pi(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return function(t){let e="0x";return t.forEach((t=>{e+=Oi(t).substring(2)})),e}(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(ki(t._data))}writeBytes(t){let e=Ti(t);const r=e.length%this.wordSize;return r&&(e=ki([e,this._padding.slice(r)])),this._writeData(e)}_getValue(t){let e=Ti(Vi.from(t));return e.length>this.wordSize&&Zi.throwError("value out-of-bounds",Ei.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=ki([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class ro{constructor(t,e,r,n){Pi(this,"_data",Ti(t)),Pi(this,"wordSize",e||32),Pi(this,"_coerceFunc",r),Pi(this,"allowLoose",n),this._offset=0}get data(){return Oi(this._data)}get consumed(){return this._offset}static coerce(t,e){let r=t.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):ro.coerce(t,e)}_peekBytes(t,e,r){let n=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?n=e:Zi.throwError("data out-of-bounds",Ei.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(t){return new ro(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let r=this._peekBytes(0,t,!!e);return this._offset+=r.length,r.slice(0,t)}readValue(){return Vi.from(this.readBytes(this.wordSize))}}function no(t){return"0x"+Gn().keccak_256(Ti(t))}const io=new Ei("address/5.7.0");function oo(t){Ri(t,20)||io.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=Ti(no(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const so={};for(let t=0;t<10;t++)so[String(t)]=String(t);for(let t=0;t<26;t++)so[String.fromCharCode(65+t)]=String(10+t);const ao=Math.floor((uo=9007199254740991,Math.log10?Math.log10(uo):Math.log(uo)/Math.LN10));var uo;function lo(t){let e=null;if("string"!=typeof t&&io.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=oo(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&io.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>so[t])).join("");for(;e.length>=ao;){let t=e.substring(0,ao);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&io.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new zi(r,36).toString(16);e.length<40;)e="0"+e;e=oo("0x"+e)}else io.throwArgumentError("invalid address","address",t);var r;return e}class ho extends to{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=lo(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return lo(Ii(t.readValue().toHexString(),20))}}class co extends to{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const fo=new Ei(ji);function po(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let t={};n=e.map((e=>{const n=e.localName;return n||fo.throwError("cannot encode object for signature with missing names",Ei.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]&&fo.throwError("cannot encode object for signature with duplicate names",Ei.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]=!0,r[n]}))}else fo.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&fo.throwArgumentError("types/value length mismatch","tuple",r);let i=new eo(t.wordSize),o=new eo(t.wordSize),s=[];e.forEach(((t,e)=>{let r=n[e];if(t.dynamic){let e=o.length;t.encode(o,r);let n=i.writeUpdatableValue();s.push((t=>{n(t+e)}))}else t.encode(i,r)})),s.forEach((t=>{t(i.length)}));let a=t.appendWriter(i);return a+=t.appendWriter(o),a}function mo(t,e){let r=[],n=t.subReader(0);e.forEach((e=>{let i=null;if(e.dynamic){let r=t.readValue(),o=n.subReader(r.toNumber());try{i=e.decode(o)}catch(t){if(t.code===Ei.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(t.code===Ei.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}null!=i&&r.push(i)}));const i=e.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});e.forEach(((t,e)=>{let n=t.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const o=r[e];o instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}}):r[n]=o}));for(let t=0;t{throw e}})}return Object.freeze(r)}class go extends to{constructor(t,e,r){super("array",t.type+"["+(e>=0?e:"")+"]",r,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let r=0;rt._data.length&&fo.throwError("insufficient data length",Ei.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let r=[];for(let t=0;t>6==2;n++)t++;return t}return t===Ro.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(ko||(ko={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Ro||(Ro={}));const Oo=Object.freeze({error:function(t,e,r,n,i){return To.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:xo,replace:function(t,e,r,n,i){return t===Ro.OVERLONG?(n.push(i),0):(n.push(65533),xo(t,e,r))}});function Io(t,e=ko.current){e!=ko.current&&(To.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return Ti(r)}function Co(t,e){return function(t,e){null==e&&(e=Oo.error),t=Ti(t);const r=[];let n=0;for(;n>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?Ro.UNEXPECTED_CONTINUE:Ro.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e(Ro.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i1114111?n+=e(Ro.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e(Ro.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e(Ro.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}class Po extends yo{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,Io(e))}decode(t){return Co(super.decode(t))}}class Lo extends to{constructor(t,e){let r=!1;const n=[];t.forEach((t=>{t.dynamic&&(r=!0),n.push(t.type)})),super("tuple","tuple("+n.join(",")+")",e,r),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});return this.coders.forEach(((r,n)=>{let i=r.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[n]))})),Object.freeze(t)}encode(t,e){return po(t,this.coders,e)}decode(t){return t.coerce(this.name,mo(t,this.coders))}}const Uo=new Ei(ji),Bo={};let Do={calldata:!0,memory:!0,storage:!0},Fo={calldata:!0,memory:!0};function Go(t,e){if("bytes"===t||"string"===t){if(Do[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&Fo[e])return!0;return(Do[e]||"payable"===e)&&Uo.throwArgumentError("invalid modifier","name",e),!1}function jo(t,e){for(let r in e)Pi(t,r,e[r])}const qo=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),zo=new RegExp(/^(.*)\[([0-9]*)\]$/);class Ko{constructor(t,e){t!==Bo&&Uo.throwError("use fromString",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),jo(this,e);let r=this.type.match(zo);jo(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Ko.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=qo.sighash),qo[t]||Uo.throwArgumentError("invalid format type","format",t),t===qo.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==qo.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===qo.full?", ":",")+")"):e+=this.type,t!==qo.sighash&&(!0===this.indexed&&(e+=" indexed"),t===qo.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?Ko.fromString(t,e):Ko.fromObject(t)}static fromObject(t){return Ko.isParamType(t)?t:new Ko(Bo,{name:t.name||null,type:es(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(Ko.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function n(e){Uo.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function i(t){let r={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(r.indexed=!1),r}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},s=o;for(let r=0;rKo.fromString(t,e)))}class $o{constructor(t,e){t!==Bo&&Uo.throwError("use a static from method",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),jo(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return $o.isFragment(t)?t:"string"==typeof t?$o.fromString(t):$o.fromObject(t)}static fromObject(t){if($o.isFragment(t))return t;switch(t.type){case"function":return Zo.fromObject(t);case"event":return Vo.fromObject(t);case"constructor":return Xo.fromObject(t);case"error":return ts.fromObject(t);case"fallback":case"receive":return null}return Uo.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Vo.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?Zo.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Xo.fromString(t.trim()):"error"===t.split(" ")[0]?ts.fromString(t.substring(5).trim()):Uo.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class Vo extends $o{format(t){if(t||(t=qo.sighash),qo[t]||Uo.throwArgumentError("invalid format type","format",t),t===qo.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==qo.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===qo.full?", ":",")+") ",t!==qo.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?Vo.fromString(t):Vo.fromObject(t)}static fromObject(t){if(Vo.isEventFragment(t))return t;"event"!==t.type&&Uo.throwArgumentError("invalid event object","value",t);const e={name:ns(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Ko.fromObject):[],type:"event"};return new Vo(Bo,e)}static fromString(t){let e=t.match(is);e||Uo.throwArgumentError("invalid event string","value",t);let r=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":r=!0;break;case"":break;default:Uo.warn("unknown modifier: "+t)}})),Vo.fromObject({name:e[1].trim(),anonymous:r,inputs:Ho(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function Wo(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&Uo.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Uo.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=Vi.from(r[1]),r[0]):t}function Yo(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function Jo(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&Uo.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&Uo.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||Uo.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Uo.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&Uo.throwArgumentError("unable to determine stateMutability","value",t),e}class Xo extends $o{format(t){if(t||(t=qo.sighash),qo[t]||Uo.throwArgumentError("invalid format type","format",t),t===qo.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===qo.sighash&&Uo.throwError("cannot format a constructor for sighash",Ei.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===qo.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Xo.fromString(t):Xo.fromObject(t)}static fromObject(t){if(Xo.isConstructorFragment(t))return t;"constructor"!==t.type&&Uo.throwArgumentError("invalid constructor object","value",t);let e=Jo(t);e.constant&&Uo.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Ko.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?Vi.from(t.gas):null};return new Xo(Bo,r)}static fromString(t){let e={type:"constructor"},r=(t=Wo(t,e)).match(is);return r&&"constructor"===r[1].trim()||Uo.throwArgumentError("invalid constructor string","value",t),e.inputs=Ho(r[2].trim(),!1),Yo(r[3].trim(),e),Xo.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class Zo extends Xo{format(t){if(t||(t=qo.sighash),qo[t]||Uo.throwArgumentError("invalid format type","format",t),t===qo.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==qo.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===qo.full?", ":",")+") ",t!==qo.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?Zo.fromString(t):Zo.fromObject(t)}static fromObject(t){if(Zo.isFunctionFragment(t))return t;"function"!==t.type&&Uo.throwArgumentError("invalid function object","value",t);let e=Jo(t);const r={type:t.type,name:ns(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(Ko.fromObject):[],outputs:t.outputs?t.outputs.map(Ko.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?Vi.from(t.gas):null};return new Zo(Bo,r)}static fromString(t){let e={type:"function"},r=(t=Wo(t,e)).split(" returns ");r.length>2&&Uo.throwArgumentError("invalid function string","value",t);let n=r[0].match(is);if(n||Uo.throwArgumentError("invalid function signature","value",t),e.name=n[1].trim(),e.name&&ns(e.name),e.inputs=Ho(n[2],!1),Yo(n[3].trim(),e),r.length>1){let n=r[1].match(is);""==n[1].trim()&&""==n[3].trim()||Uo.throwArgumentError("unexpected tokens","value",t),e.outputs=Ho(n[2],!1)}else e.outputs=[];return Zo.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function Qo(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||Uo.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ts extends $o{format(t){if(t||(t=qo.sighash),qo[t]||Uo.throwArgumentError("invalid format type","format",t),t===qo.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==qo.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===qo.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?ts.fromString(t):ts.fromObject(t)}static fromObject(t){if(ts.isErrorFragment(t))return t;"error"!==t.type&&Uo.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:ns(t.name),inputs:t.inputs?t.inputs.map(Ko.fromObject):[]};return Qo(new ts(Bo,e))}static fromString(t){let e={type:"error"},r=t.match(is);return r||Uo.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&ns(e.name),e.inputs=Ho(r[2],!1),Qo(ts.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function es(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const rs=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function ns(t){return t&&t.match(rs)||Uo.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const is=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"),os=new Ei(ji),ss=new RegExp(/^bytes([0-9]*)$/),as=new RegExp(/^(u?int)([0-9]*)$/);class us{constructor(t){os.checkNew(new.target,us),Pi(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new ho(t.name);case"bool":return new vo(t.name);case"string":return new Po(t.name);case"bytes":return new bo(t.name);case"array":return new go(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new Lo((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new Eo(t.name)}let e=t.type.match(as);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&os.throwArgumentError("invalid "+e[1]+" bit length","param",t),new So(r/8,"int"===e[1],t.name)}if(e=t.type.match(ss),e){let r=parseInt(e[1]);return(0===r||r>32)&&os.throwArgumentError("invalid bytes length","param",t),new wo(r,t.name)}return os.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new ro(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new eo(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(Ko.from(t))));return new Lo(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&os.throwError("types/values length mismatch",Ei.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map((t=>this._getCoder(Ko.from(t)))),n=new Lo(r,"_"),i=this._getWriter();return n.encode(i,e),i.data}decode(t,e,r){const n=t.map((t=>this._getCoder(Ko.from(t))));return new Lo(n,"_").decode(this._getReader(Ti(e),r))}}const ls=new us;function hs(t){return no(Io(t))}const cs=new Ei(ji);class fs extends Gi{}class ds extends Gi{}class ps extends Gi{}class ms extends Gi{static isIndexed(t){return!(!t||!t._isIndexed)}}const gs={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function vs(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class ys{constructor(t){cs.checkNew(new.target,ys);let e=[];e="string"==typeof t?JSON.parse(t):t,Pi(this,"fragments",e.map((t=>$o.from(t))).filter((t=>null!=t))),Pi(this,"_abiCoder",Li(new.target,"getAbiCoder")()),Pi(this,"functions",{}),Pi(this,"errors",{}),Pi(this,"events",{}),Pi(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void cs.warn("duplicate definition - constructor"):void Pi(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let r=t.format();e[r]?cs.warn("duplicate definition - "+r):e[r]=t})),this.deploy||Pi(this,"deploy",Xo.from({payable:!1,type:"constructor"})),Pi(this,"_isInterface",!0)}format(t){t||(t=qo.full),t===qo.sighash&&cs.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===qo.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return ls}static getAddress(t){return lo(t)}static getSighash(t){return r=0,4,"string"!=typeof(e=hs(t.format()))?e=Oi(e):(!Ri(e)||e.length%2)&&Mi.throwArgumentError("invalid hexData","value",e),r=2+2*r,"0x"+e.substring(r,10);var e,r}static getEventTopic(t){return hs(t.format())}getFunction(t){if(Ri(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];cs.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===r.length?cs.throwArgumentError("no matching function","name",e):r.length>1&&cs.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const e=this.functions[Zo.fromString(t).format()];return e||cs.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(Ri(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];cs.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===r.length?cs.throwArgumentError("no matching event","name",e):r.length>1&&cs.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const e=this.events[Vo.fromString(t).format()];return e||cs.throwArgumentError("no matching event","signature",t),e}getError(t){if(Ri(t)){const e=Li(this.constructor,"getSighash");for(const r in this.errors)if(t===e(this.errors[r]))return this.errors[r];cs.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===r.length?cs.throwArgumentError("no matching error","name",e):r.length>1&&cs.throwArgumentError("multiple matching errors","name",e),this.errors[r[0]]}const e=this.errors[Zo.fromString(t).format()];return e||cs.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return Li(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),Li(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const r=Ti(e);return Oi(r.slice(0,4))!==this.getSighash(t)&&cs.throwArgumentError(`data signature does not match error ${t.name}.`,"data",Oi(r)),this._decodeParams(t.inputs,r.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),Oi(ki([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const r=Ti(e);return Oi(r.slice(0,4))!==this.getSighash(t)&&cs.throwArgumentError(`data signature does not match function ${t.name}.`,"data",Oi(r)),this._decodeParams(t.inputs,r.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),Oi(ki([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let r=Ti(e),n=null,i=null,o=null,s=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,r)}catch(t){}break;case 4:{const t=Oi(r.slice(0,4)),e=gs[t];if(e)i=this._abiCoder.decode(e.inputs,r.slice(4)),o=e.name,s=e.signature,e.reason&&(n=i[0]);else try{const e=this.getError(t);i=this._abiCoder.decode(e.inputs,r.slice(4)),o=e.name,s=e.format()}catch(t){console.log(t)}break}}return cs.throwError("call revert exception",Ei.errors.CALL_EXCEPTION,{method:t.format(),errorArgs:i,errorName:o,errorSignature:s,reason:n})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),Oi(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&cs.throwError("too many arguments for "+t.format(),Ei.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let r=[];t.anonymous||r.push(this.getEventTopic(t));const n=(t,e)=>"string"===t.type?hs(e):"bytes"===t.type?no(Oi(e)):("address"===t.type&&this._abiCoder.encode(["address"],[e]),Ii(Oi(e),32));for(e.forEach(((e,i)=>{let o=t.inputs[i];o.indexed?null==e?r.push(null):"array"===o.baseType||"tuple"===o.baseType?cs.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?r.push(e.map((t=>n(o,t)))):r.push(n(o,e)):null!=e&&cs.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const r=[],n=[],i=[];return t.anonymous||r.push(this.getEventTopic(t)),e.length!==t.inputs.length&&cs.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const s=e[o];if(t.indexed)if("string"===t.type)r.push(hs(s));else if("bytes"===t.type)r.push(no(s));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([t.type],[s]))}else n.push(t),i.push(s)})),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(t,e,r){if("string"==typeof t&&(t=this.getEvent(t)),null!=r&&!t.anonymous){let e=this.getEventTopic(t);Ri(r[0],32)&&r[0].toLowerCase()===e||cs.throwError("fragment/topic mismatch",Ei.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:r[0]}),r=r.slice(1)}let n=[],i=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(n.push(Ko.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(n.push(t),o.push(!1)):(i.push(t),o.push(!1))}));let s=null!=r?this._abiCoder.decode(n,ki(r)):null,a=this._abiCoder.decode(i,e,!0),u=[],l=0,h=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==s)u[e]=new ms({_isIndexed:!0,hash:null});else if(o[e])u[e]=new ms({_isIndexed:!0,hash:s[h++]});else try{u[e]=s[h++]}catch(t){u[e]=t}else try{u[e]=a[l++]}catch(t){u[e]=t}if(t.name&&null==u[t.name]){const r=u[e];r instanceof Error?Object.defineProperty(u,t.name,{enumerable:!0,get:()=>{throw vs(`property ${JSON.stringify(t.name)}`,r)}}):u[t.name]=r}}));for(let t=0;t{throw vs(`index ${t}`,e)}})}return Object.freeze(u)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new ds({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:Vi.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new fs({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=Oi(t);let r=this.getError(e.substring(0,10).toLowerCase());return r?new ps({args:this._abiCoder.decode(r.inputs,"0x"+e.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(t){return!(!t||!t._isInterface)}}let bs=!1,ws=!1;const Es={debug:1,default:2,info:2,warning:3,error:4,off:5};let Ms=Es.default,As=null;const _s=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Ns,Ss;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Ns||(Ns={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Ss||(Ss={}));const Ts="0123456789abcdef";class ks{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Es[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Ms>Es[r]||console.log.apply(console,e)}debug(...t){this._log(ks.levels.DEBUG,t)}info(...t){this._log(ks.levels.INFO,t)}warn(...t){this._log(ks.levels.WARNING,t)}makeError(t,e,r){if(ws)return this.makeError("censored error",e,{});e||(e=ks.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Ts[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Ss.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Ss.CALL_EXCEPTION:case Ss.INSUFFICIENT_FUNDS:case Ss.MISSING_NEW:case Ss.NONCE_EXPIRED:case Ss.REPLACEMENT_UNDERPRICED:case Ss.TRANSACTION_REPLACED:case Ss.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,ks.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),_s&&this.throwError("platform missing String.prototype.normalize",ks.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_s})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,ks.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,ks.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,ks.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",ks.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",ks.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",ks.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return As||(As=new ks("logger/5.7.0")),As}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",ks.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),bs){if(!t)return;this.globalLogger().throwError("error censorship permanent",ks.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ws=!!t,bs=!!e}static setLogLevel(t){const e=Es[t.toLowerCase()];null!=e?Ms=e:ks.globalLogger().warn("invalid log level - "+t)}static from(t){return new ks(t)}}ks.errors=Ss,ks.levels=Ns;const Rs=new ks("bytes/5.7.0");function xs(t){return!!t.toHexString}function Os(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Os(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Is(t){return"number"==typeof t&&t==t&&t%1==0}function Cs(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Is(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Ps(t,e){if(e||(e={}),"number"==typeof t){Rs.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Os(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),xs(t)&&(t=t.toHexString()),Ls(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Rs.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t>4]+Us[15&n]}return e}return Rs.throwArgumentError("invalid hexlify value","value",t)}function Ds(t){if("string"!=typeof t)t=Bs(t);else if(!Ls(t)||t.length%2)return null;return(t.length-2)/2}function Fs(t,e,r){return"string"!=typeof t?t=Bs(t):(!Ls(t)||t.length%2)&&Rs.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}var Gs=r(5205),js=r.n(Gs)().BN;const qs=new ks("bignumber/5.7.0"),zs={};let Ks=!1;class Hs{constructor(t,e){t!==zs&&qs.throwError("cannot call constructor directly; use BigNumber.from",ks.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Vs(Ws(this).fromTwos(t))}toTwos(t){return Vs(Ws(this).toTwos(t))}abs(){return"-"===this._hex[0]?Hs.from(this._hex.substring(1)):this}add(t){return Vs(Ws(this).add(Ws(t)))}sub(t){return Vs(Ws(this).sub(Ws(t)))}div(t){return Hs.from(t).isZero()&&Ys("division-by-zero","div"),Vs(Ws(this).div(Ws(t)))}mul(t){return Vs(Ws(this).mul(Ws(t)))}mod(t){const e=Ws(t);return e.isNeg()&&Ys("division-by-zero","mod"),Vs(Ws(this).umod(e))}pow(t){const e=Ws(t);return e.isNeg()&&Ys("negative-power","pow"),Vs(Ws(this).pow(e))}and(t){const e=Ws(t);return(this.isNegative()||e.isNeg())&&Ys("unbound-bitwise-result","and"),Vs(Ws(this).and(e))}or(t){const e=Ws(t);return(this.isNegative()||e.isNeg())&&Ys("unbound-bitwise-result","or"),Vs(Ws(this).or(e))}xor(t){const e=Ws(t);return(this.isNegative()||e.isNeg())&&Ys("unbound-bitwise-result","xor"),Vs(Ws(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Ys("negative-width","mask"),Vs(Ws(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Ys("negative-width","shl"),Vs(Ws(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Ys("negative-width","shr"),Vs(Ws(this).shrn(t))}eq(t){return Ws(this).eq(Ws(t))}lt(t){return Ws(this).lt(Ws(t))}lte(t){return Ws(this).lte(Ws(t))}gt(t){return Ws(this).gt(Ws(t))}gte(t){return Ws(this).gte(Ws(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Ws(this).isZero()}toNumber(){try{return Ws(this).toNumber()}catch(t){Ys("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return qs.throwError("this platform does not support BigInt",ks.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Ks||(Ks=!0,qs.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?qs.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ks.errors.UNEXPECTED_ARGUMENT,{}):qs.throwError("BigNumber.toString does not accept parameters",ks.errors.UNEXPECTED_ARGUMENT,{})),Ws(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Hs)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Hs(zs,$s(t)):t.match(/^-?[0-9]+$/)?new Hs(zs,$s(new js(t))):qs.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Ys("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&Ys("overflow","BigNumber.from",t),Hs.from(String(t));const e=t;if("bigint"==typeof e)return Hs.from(e.toString());if(Cs(e))return Hs.from(Bs(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Hs.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Ls(t)||"-"===t[0]&&Ls(t.substring(1))))return Hs.from(t)}return qs.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function $s(t){if("string"!=typeof t)return $s(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&qs.throwArgumentError("invalid hex","value",t),"0x00"===(t=$s(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Vs(t){return Hs.from($s(t))}function Ws(t){const e=Hs.from(t).toHexString();return"-"===e[0]?new js("-"+e.substring(3),16):new js(e.substring(2),16)}function Ys(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),qs.throwError(t,ks.errors.NUMERIC_FAULT,n)}function Js(t){return"0x"+Gn().keccak_256(Ps(t))}const Xs=new ks("rlp/5.7.0");function Zs(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function Qs(t){if(Array.isArray(t)){let e=[];if(t.forEach((function(t){e=e.concat(Qs(t))})),e.length<=55)return e.unshift(192+e.length),e;const r=Zs(e.length);return r.unshift(247+r.length),r.concat(e)}var e;Ls(e=t)&&!(e.length%2)||Cs(e)||Xs.throwArgumentError("RLP object must be BytesLike","object",t);const r=Array.prototype.slice.call(Ps(t));if(1===r.length&&r[0]<=127)return r;if(r.length<=55)return r.unshift(128+r.length),r;const n=Zs(r.length);return n.unshift(183+n.length),n.concat(r)}const ta=new ks("address/5.5.0");function ea(t){Ls(t,20)||ta.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=Ps(Js(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const ra={};for(let t=0;t<10;t++)ra[String(t)]=String(t);for(let t=0;t<26;t++)ra[String.fromCharCode(65+t)]=String(10+t);const na=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function ia(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>ra[t])).join("");for(;e.length>=na;){let t=e.substring(0,na);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function oa(t){let e=null;if("string"!=typeof t&&ta.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=ea(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&ta.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==ia(t)&&ta.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new js(r,36).toString(16);e.length<40;)e="0"+e;e=ea("0x"+e)}else ta.throwArgumentError("invalid address","address",t);var r;return e}function sa(t){try{return oa(t),!0}catch(t){}return!1}function aa(t){let e=(r=oa(t).substring(2),new js(r,16).toString(36)).toUpperCase();for(var r;e.length<30;)e="0"+e;return"XE"+ia("XE00"+e)+e}function ua(t){let e=null;try{e=oa(t.from)}catch(e){ta.throwArgumentError("missing from address","transaction",t)}return oa(Fs(Js(Bs(Qs([e,function(t){let e=Ps(t);if(0===e.length)return e;let r=0;for(;rPs(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),Os(n)}(["0xff",oa(t),e,r])),12))}let ha=!1,ca=!1;const fa={debug:1,default:2,info:2,warning:3,error:4,off:5};let da=fa.default,pa=null;const ma=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var ga,va;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(ga||(ga={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(va||(va={}));const ya="0123456789abcdef";class ba{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==fa[r]&&this.throwArgumentError("invalid log level name","logLevel",t),da>fa[r]||console.log.apply(console,e)}debug(...t){this._log(ba.levels.DEBUG,t)}info(...t){this._log(ba.levels.INFO,t)}warn(...t){this._log(ba.levels.WARNING,t)}makeError(t,e,r){if(ca)return this.makeError("censored error",e,{});e||(e=ba.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=ya[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case va.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case va.CALL_EXCEPTION:case va.INSUFFICIENT_FUNDS:case va.MISSING_NEW:case va.NONCE_EXPIRED:case va.REPLACEMENT_UNDERPRICED:case va.TRANSACTION_REPLACED:case va.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,ba.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),ma&&this.throwError("platform missing String.prototype.normalize",ba.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ma})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,ba.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,ba.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,ba.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",ba.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",ba.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",ba.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return pa||(pa=new ba("logger/5.7.0")),pa}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",ba.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ha){if(!t)return;this.globalLogger().throwError("error censorship permanent",ba.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ca=!!t,ha=!!e}static setLogLevel(t){const e=fa[t.toLowerCase()];null!=e?da=e:ba.globalLogger().warn("invalid log level - "+t)}static from(t){return new ba(t)}}ba.errors=va,ba.levels=ga;const wa=new ba("bytes/5.7.0");function Ea(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ea(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Ma(t){return"number"==typeof t&&t==t&&t%1==0}function Aa(t,e){if(e||(e={}),"number"==typeof t){wa.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Ea(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":wa.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?Ea(new Uint8Array(t)):wa.throwArgumentError("invalid arrayify value","value",t)}function _a(t){t=atob(t);const e=[];for(let r=0;r{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Ia,Ca;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Ia||(Ia={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Ca||(Ca={}));const Pa="0123456789abcdef";class La{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==ka[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Ra>ka[r]||console.log.apply(console,e)}debug(...t){this._log(La.levels.DEBUG,t)}info(...t){this._log(La.levels.INFO,t)}warn(...t){this._log(La.levels.WARNING,t)}makeError(t,e,r){if(Ta)return this.makeError("censored error",e,{});e||(e=La.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Pa[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Ca.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Ca.CALL_EXCEPTION:case Ca.INSUFFICIENT_FUNDS:case Ca.MISSING_NEW:case Ca.NONCE_EXPIRED:case Ca.REPLACEMENT_UNDERPRICED:case Ca.TRANSACTION_REPLACED:case Ca.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,La.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Oa&&this.throwError("platform missing String.prototype.normalize",La.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Oa})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,La.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,La.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,La.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",La.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",La.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",La.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return xa||(xa=new La("logger/5.7.0")),xa}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",La.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Sa){if(!t)return;this.globalLogger().throwError("error censorship permanent",La.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Ta=!!t,Sa=!!e}static setLogLevel(t){const e=ka[t.toLowerCase()];null!=e?Ra=e:La.globalLogger().warn("invalid log level - "+t)}static from(t){return new La(t)}}La.errors=Ca,La.levels=Ia;const Ua=new La("bytes/5.7.0");function Ba(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ba(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Da(t){return"number"==typeof t&&t==t&&t%1==0}function Fa(t,e){if(e||(e={}),"number"==typeof t){Ua.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Ba(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Ua.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?Ba(new Uint8Array(t)):Ua.throwArgumentError("invalid arrayify value","value",t)}function Ga(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new La("properties/5.7.0");class ja{constructor(t){Ga(this,"alphabet",t),Ga(this,"base",t.length),Ga(this,"_alphabetMap",{}),Ga(this,"_leader",t.charAt(0));for(let e=0;e0;)r.push(n%this.base),n=n/this.base|0}let n="";for(let t=0;0===e[t]&&t=0;--t)n+=this.alphabet[r[t]];return n}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let r=0;r>=8;for(;i>0;)e.push(255&i),i>>=8}for(let r=0;t[r]===this._leader&&r{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Ya,Ja;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Ya||(Ya={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Ja||(Ja={}));const Xa="0123456789abcdef";class Za{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Ha[r]&&this.throwArgumentError("invalid log level name","logLevel",t),$a>Ha[r]||console.log.apply(console,e)}debug(...t){this._log(Za.levels.DEBUG,t)}info(...t){this._log(Za.levels.INFO,t)}warn(...t){this._log(Za.levels.WARNING,t)}makeError(t,e,r){if(Ka)return this.makeError("censored error",e,{});e||(e=Za.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Xa[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Ja.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Ja.CALL_EXCEPTION:case Ja.INSUFFICIENT_FUNDS:case Ja.MISSING_NEW:case Ja.NONCE_EXPIRED:case Ja.REPLACEMENT_UNDERPRICED:case Ja.TRANSACTION_REPLACED:case Ja.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Za.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Wa&&this.throwError("platform missing String.prototype.normalize",Za.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Wa})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Za.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Za.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,Za.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Za.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Za.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Za.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Va||(Va=new Za("logger/5.7.0")),Va}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Za.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),za){if(!t)return;this.globalLogger().throwError("error censorship permanent",Za.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Ka=!!t,za=!!e}static setLogLevel(t){const e=Ha[t.toLowerCase()];null!=e?$a=e:Za.globalLogger().warn("invalid log level - "+t)}static from(t){return new Za(t)}}Za.errors=Ja,Za.levels=Ya;const Qa=new Za("bytes/5.5.0");function tu(t){return!!t.toHexString}function eu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return eu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function ru(t){return lu(t)&&!(t.length%2)||iu(t)}function nu(t){return"number"==typeof t&&t==t&&t%1==0}function iu(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!nu(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function ou(t,e){if(e||(e={}),"number"==typeof t){Qa.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),eu(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),tu(t)&&(t=t.toHexString()),lu(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":Qa.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;tou(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),eu(n)}function au(t){let e=ou(t);if(0===e.length)return e;let r=0;for(;re&&Qa.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),eu(r)}function lu(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const hu="0123456789abcdef";function cu(t,e){if(e||(e={}),"number"==typeof t){Qa.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=hu[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),tu(t))return t.toHexString();if(lu(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":Qa.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(iu(t)){let e="0x";for(let r=0;r>4]+hu[15&n]}return e}return Qa.throwArgumentError("invalid hexlify value","value",t)}function fu(t){if("string"!=typeof t)t=cu(t);else if(!lu(t)||t.length%2)return null;return(t.length-2)/2}function du(t,e,r){return"string"!=typeof t?t=cu(t):(!lu(t)||t.length%2)&&Qa.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function pu(t){let e="0x";return t.forEach((t=>{e+=cu(t).substring(2)})),e}function mu(t){const e=gu(cu(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function gu(t){"string"!=typeof t&&(t=cu(t)),lu(t)||Qa.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&Qa.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function yu(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(ru(t)){const r=ou(t);65!==r.length&&Qa.throwArgumentError("invalid signature string; must be 65 bytes","signature",t),e.r=cu(r.slice(0,32)),e.s=cu(r.slice(32,64)),e.v=r[64],e.v<27&&(0===e.v||1===e.v?e.v+=27:Qa.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=cu(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=uu(ou(e._vs),32);e._vs=cu(r);const n=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=n:e.recoveryParam!==n&&Qa.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const i=cu(r);null==e.s?e.s=i:e.s!==i&&Qa.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?Qa.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&Qa.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&lu(e.r)?e.r=vu(e.r,32):Qa.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&lu(e.s)?e.s=vu(e.s,32):Qa.throwArgumentError("signature missing or invalid s","signature",t);const r=ou(e.s);r[0]>=128&&Qa.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=cu(r);e._vs&&(lu(e._vs)||Qa.throwArgumentError("signature invalid _vs","signature",t),e._vs=vu(e._vs,32)),null==e._vs?e._vs=n:e._vs!==n&&Qa.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e}function bu(t){return cu(su([(t=yu(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}let wu=!1,Eu=!1;const Mu={debug:1,default:2,info:2,warning:3,error:4,off:5};let Au=Mu.default,_u=null;const Nu=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Su,Tu;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Su||(Su={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Tu||(Tu={}));const ku="0123456789abcdef";class Ru{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Mu[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Au>Mu[r]||console.log.apply(console,e)}debug(...t){this._log(Ru.levels.DEBUG,t)}info(...t){this._log(Ru.levels.INFO,t)}warn(...t){this._log(Ru.levels.WARNING,t)}makeError(t,e,r){if(Eu)return this.makeError("censored error",e,{});e||(e=Ru.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=ku[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Tu.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Tu.CALL_EXCEPTION:case Tu.INSUFFICIENT_FUNDS:case Tu.MISSING_NEW:case Tu.NONCE_EXPIRED:case Tu.REPLACEMENT_UNDERPRICED:case Tu.TRANSACTION_REPLACED:case Tu.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Ru.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Nu&&this.throwError("platform missing String.prototype.normalize",Ru.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Nu})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Ru.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Ru.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,Ru.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Ru.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Ru.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Ru.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return _u||(_u=new Ru("logger/5.7.0")),_u}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Ru.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),wu){if(!t)return;this.globalLogger().throwError("error censorship permanent",Ru.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Eu=!!t,wu=!!e}static setLogLevel(t){const e=Mu[t.toLowerCase()];null!=e?Au=e:Ru.globalLogger().warn("invalid log level - "+t)}static from(t){return new Ru(t)}}Ru.errors=Tu,Ru.levels=Su;const xu=new Ru("bytes/5.7.0");function Ou(t){return!!t.toHexString}function Iu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Iu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Cu(t){return"number"==typeof t&&t==t&&t%1==0}function Pu(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Cu(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Lu(t,e){if(e||(e={}),"number"==typeof t){xu.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Iu(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Ou(t)&&(t=t.toHexString()),Bu(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":xu.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;tLu(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),Iu(n)}function Bu(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Du="0123456789abcdef";function Fu(t,e){if(e||(e={}),"number"==typeof t){xu.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Du[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Ou(t))return t.toHexString();if(Bu(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":xu.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Pu(t)){let e="0x";for(let r=0;r>4]+Du[15&n]}return e}return xu.throwArgumentError("invalid hexlify value","value",t)}function Gu(t){let e="0x";return t.forEach((t=>{e+=Fu(t).substring(2)})),e}function ju(t,e){for("string"!=typeof t?t=Fu(t):Bu(t)||xu.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&xu.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function qu(t){return"0x"+Gn().keccak_256(Lu(t))}const zu=new Ru("strings/5.7.0");var Ku,Hu;function $u(t,e,r,n,i){if(t===Hu.BAD_PREFIX||t===Hu.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n>6==2;n++)t++;return t}return t===Hu.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Ku||(Ku={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Hu||(Hu={}));const Vu=Object.freeze({error:function(t,e,r,n,i){return zu.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:$u,replace:function(t,e,r,n,i){return t===Hu.OVERLONG?(n.push(i),0):(n.push(65533),$u(t,e,r))}});function Wu(t,e=Ku.current){e!=Ku.current&&(zu.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return Lu(r)}function Yu(t){return t.map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function Ju(t,e=Ku.current){return function(t,e){null==e&&(e=Vu.error),t=Lu(t);const r=[];let n=0;for(;n>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?Hu.UNEXPECTED_CONTINUE:Hu.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e(Hu.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i1114111?n+=e(Hu.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e(Hu.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e(Hu.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}(Wu(t,e))}const Xu="Ethereum Signed Message:\n";function Zu(t){return"string"==typeof t&&(t=Wu(t)),qu(Uu([Wu(Xu),Wu(String(t.length)),t]))}function Qu(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,n={};return t.split(",").forEach((t=>{let i=t.split(":");r+=parseInt(i[0],16),n[r]=e(i[1])})),n}function tl(t){let e=0;return t.split(",").map((t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:n,h:e}}))}function el(t,e){let r=0;for(let n=0;n=r&&t<=r+i.h&&(t-r)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(t-r))continue;return i}}return null}const rl=tl("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),nl="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((t=>parseInt(t,16))),il=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],ol=Qu("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),sl=Qu("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),al=Qu("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r{if(nl.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=el(t,il);if(e)return[t+e.s];let r=ol[t];if(r)return r;let n=sl[t];return n?[t+n[0]]:al[t]||null}(t);return e||[t]})),e=r.reduce(((t,e)=>(e.forEach((e=>{t.push(e)})),t)),[]),e=Ju(Yu(e),Ku.NFKC),e.forEach((t=>{if(el(t,ul))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),e.forEach((t=>{if(el(t,rl))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=Yu(e);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");return n}const hl="hash/5.5.0",cl=new Ru(hl),fl=new Uint8Array(32);fl.fill(0);const dl=new RegExp("^((.*)\\.)?([^.]+)$");function pl(t){try{const e=t.split(".");for(let t=0;t0&&(10===arguments[0]?El||(El=!0,bl.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?bl.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ru.errors.UNEXPECTED_ARGUMENT,{}):bl.throwError("BigNumber.toString does not accept parameters",Ru.errors.UNEXPECTED_ARGUMENT,{})),Nl(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Ml)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Ml(wl,Al(t)):t.match(/^-?[0-9]+$/)?new Ml(wl,Al(new yl(t))):bl.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Sl("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&Sl("overflow","BigNumber.from",t),Ml.from(String(t));const e=t;if("bigint"==typeof e)return Ml.from(e.toString());if(Pu(e))return Ml.from(Fu(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Ml.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Bu(t)||"-"===t[0]&&Bu(t.substring(1))))return Ml.from(t)}return bl.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Al(t){if("string"!=typeof t)return Al(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&bl.throwArgumentError("invalid hex","value",t),"0x00"===(t=Al(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function _l(t){return Ml.from(Al(t))}function Nl(t){const e=Ml.from(t).toHexString();return"-"===e[0]?new yl("-"+e.substring(3),16):new yl(e.substring(2),16)}function Sl(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),bl.throwError(t,Ru.errors.NUMERIC_FAULT,n)}const Tl=new Ru("address/5.7.0");function kl(t){Bu(t,20)||Tl.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=Lu(qu(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Rl={};for(let t=0;t<10;t++)Rl[String(t)]=String(t);for(let t=0;t<26;t++)Rl[String.fromCharCode(65+t)]=String(10+t);const xl=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Ol(t){let e=null;if("string"!=typeof t&&Tl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=kl(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Tl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Rl[t])).join("");for(;e.length>=xl;){let t=e.substring(0,xl);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&Tl.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new yl(r,36).toString(16);e.length<40;)e="0"+e;e=kl("0x"+e)}else Tl.throwArgumentError("invalid address","address",t);var r;return e}const Il=new Ru("properties/5.7.0");function Cl(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function Pl(t){const e={};for(const r in t)e[r]=t[r];return e}const Ll={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Ul(t){if(null==t||Ll[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rDl(t))));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&Cl(e,r,Dl(n))}return e}return Il.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Dl(t){return Bl(t)}const Fl=new Ru(hl),Gl=new Uint8Array(32);Gl.fill(0);const jl=Ml.from(-1),ql=Ml.from(0),zl=Ml.from(1),Kl=Ml.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Hl=ju(zl.toHexString(),32),$l=ju(ql.toHexString(),32),Vl={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Wl=["name","version","chainId","verifyingContract","salt"];function Yl(t){return function(e){return"string"!=typeof e&&Fl.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Jl={name:Yl("name"),version:Yl("version"),chainId:function(t){try{return Ml.from(t).toString()}catch(t){}return Fl.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return Ol(t).toLowerCase()}catch(t){}return Fl.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=Lu(t);if(32!==e.length)throw new Error("bad length");return Fu(e)}catch(t){}return Fl.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function Xl(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],n=parseInt(e[2]||"256");(n%8!=0||n>256||e[2]&&e[2]!==String(n))&&Fl.throwArgumentError("invalid numeric width","type",t);const i=Kl.mask(r?n-1:n),o=r?i.add(zl).mul(jl):ql;return function(e){const r=Ml.from(e);return(r.lt(o)||r.gt(i))&&Fl.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),ju(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&Fl.throwArgumentError("invalid bytes width","type",t),function(e){return Lu(e).length!==r&&Fl.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=Lu(t),r=e.length%32;return r?Gu([e,Gl.slice(r)]):Fu(e)}(e)}}}switch(t){case"address":return function(t){return ju(Ol(t),32)};case"bool":return function(t){return t?Hl:$l};case"bytes":return function(t){return qu(t)};case"string":return function(t){return gl(t)}}return null}function Zl(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class Ql{constructor(t){Cl(this,"types",Object.freeze(Dl(t))),Cl(this,"_encoderCache",{}),Cl(this,"_types",{});const e={},r={},n={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],n[t]={}}));for(const n in t){const i={};t[n].forEach((o=>{i[o.name]&&Fl.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",t),i[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&Fl.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t),Xl(s)||(r[s]||Fl.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const i=Object.keys(r).filter((t=>0===r[t].length));0===i.length?Fl.throwArgumentError("missing primary type","types",t):i.length>1&&Fl.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),Cl(this,"primaryType",i[0]),function i(o,s){s[o]&&Fl.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(i(t,s),Object.keys(s).forEach((e=>{n[e][t]=!0})))})),delete s[o]}(this.primaryType,{});for(const e in n){const r=Object.keys(n[e]);r.sort(),this._types[e]=Zl(e,t[e])+r.map((e=>Zl(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=Xl(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),n=parseInt(e[3]);return e=>{n>=0&&e.length!==n&&Fl.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(qu)),qu(Gu(i))}}const r=this.types[t];if(r){const e=gl(this._types[t]);return t=>{const n=r.map((({name:e,type:r})=>{const n=this.getEncoder(r)(t[e]);return this._types[r]?qu(n):n}));return n.unshift(e),Gu(n)}}return Fl.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||Fl.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return qu(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(Xl(t))return r(t,e);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=parseInt(n[3]);return i>=0&&e.length!==i&&Fl.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const i=this.types[t];return i?i.reduce(((t,{name:n,type:i})=>(t[n]=this._visit(i,e[n],r),t)),{}):Fl.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new Ql(t)}static getPrimaryType(t){return Ql.from(t).primaryType}static hashStruct(t,e,r){return Ql.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=Vl[r];n||Fl.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>Wl.indexOf(t.name)-Wl.indexOf(e.name))),Ql.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return Gu(["0x1901",Ql.hashDomain(t),Ql.from(e).hash(r)])}static hash(t,e,r){return qu(Ql.encode(t,e,r))}static resolveNames(t,e,r,n){return i=this,o=void 0,a=function*(){t=Pl(t);const i={};t.verifyingContract&&!Bu(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=Ql.from(e);o.visit(r,((t,e)=>("address"!==t||Bu(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:r}},new((s=void 0)||(s=Promise))((function(t,e){function r(t){try{u(a.next(t))}catch(t){e(t)}}function n(t){try{u(a.throw(t))}catch(t){e(t)}}function u(e){var i;e.done?t(e.value):(i=e.value,i instanceof s?i:new s((function(t){t(i)}))).then(r,n)}u((a=a.apply(i,o||[])).next())}));var i,o,s,a}static getPayload(t,e,r){Ql.hashDomain(t);const n={},i=[];Wl.forEach((e=>{const r=t[e];null!=r&&(n[e]=Jl[e](r),i.push({name:e,type:Vl[e]}))}));const o=Ql.from(e),s=Pl(e);return s.EIP712Domain?Fl.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=i,o.encode(r),{types:s,domain:n,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return Fu(Lu(e));if(t.match(/^u?int/))return Ml.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&Fl.throwArgumentError("invalid string","value",e),e}return Fl.throwArgumentError("unsupported type","type",t)}))}}}let th=!1,eh=!1;const rh={debug:1,default:2,info:2,warning:3,error:4,off:5};let nh=rh.default,ih=null;const oh=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var sh,ah;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(sh||(sh={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(ah||(ah={}));const uh="0123456789abcdef";class lh{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==rh[r]&&this.throwArgumentError("invalid log level name","logLevel",t),nh>rh[r]||console.log.apply(console,e)}debug(...t){this._log(lh.levels.DEBUG,t)}info(...t){this._log(lh.levels.INFO,t)}warn(...t){this._log(lh.levels.WARNING,t)}makeError(t,e,r){if(eh)return this.makeError("censored error",e,{});e||(e=lh.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=uh[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case ah.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case ah.CALL_EXCEPTION:case ah.INSUFFICIENT_FUNDS:case ah.MISSING_NEW:case ah.NONCE_EXPIRED:case ah.REPLACEMENT_UNDERPRICED:case ah.TRANSACTION_REPLACED:case ah.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,lh.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),oh&&this.throwError("platform missing String.prototype.normalize",lh.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:oh})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,lh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,lh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,lh.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",lh.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",lh.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",lh.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return ih||(ih=new lh("logger/5.7.0")),ih}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",lh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),th){if(!t)return;this.globalLogger().throwError("error censorship permanent",lh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}eh=!!t,th=!!e}static setLogLevel(t){const e=rh[t.toLowerCase()];null!=e?nh=e:lh.globalLogger().warn("invalid log level - "+t)}static from(t){return new lh(t)}}lh.errors=ah,lh.levels=sh;const hh=new lh("bytes/5.7.0");function ch(t){return!!t.toHexString}function fh(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return fh(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function dh(t){return"number"==typeof t&&t==t&&t%1==0}function ph(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!dh(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function mh(t,e){if(e||(e={}),"number"==typeof t){hh.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),fh(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),ch(t)&&(t=t.toHexString()),vh(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":hh.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;tmh(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),fh(n)}function vh(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const yh="0123456789abcdef";function bh(t,e){if(e||(e={}),"number"==typeof t){hh.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=yh[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),ch(t))return t.toHexString();if(vh(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":hh.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(ph(t)){let e="0x";for(let r=0;r>4]+yh[15&n]}return e}return hh.throwArgumentError("invalid hexlify value","value",t)}function wh(t,e,r){return"string"!=typeof t?t=bh(t):(!vh(t)||t.length%2)&&hh.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Eh(t,e){for("string"!=typeof t?t=bh(t):vh(t)||hh.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&hh.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Mh(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new lh("properties/5.7.0");class Ah{constructor(t){Mh(this,"alphabet",t),Mh(this,"base",t.length),Mh(this,"_alphabetMap",{}),Mh(this,"_leader",t.charAt(0));for(let e=0;e0;)r.push(n%this.base),n=n/this.base|0}let n="";for(let t=0;0===e[t]&&t=0;--t)n+=this.alphabet[r[t]];return n}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let r=0;r>=8;for(;i>0;)e.push(255&i),i>>=8}for(let r=0;t[r]===this._leader&&r0&&(10===arguments[0]?xh||(xh=!0,kh.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?kh.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",lh.errors.UNEXPECTED_ARGUMENT,{}):kh.throwError("BigNumber.toString does not accept parameters",lh.errors.UNEXPECTED_ARGUMENT,{})),Ph(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Oh)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Oh(Rh,Ih(t)):t.match(/^-?[0-9]+$/)?new Oh(Rh,Ih(new Th(t))):kh.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Lh("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&Lh("overflow","BigNumber.from",t),Oh.from(String(t));const e=t;if("bigint"==typeof e)return Oh.from(e.toString());if(ph(e))return Oh.from(bh(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Oh.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(vh(t)||"-"===t[0]&&vh(t.substring(1))))return Oh.from(t)}return kh.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Ih(t){if("string"!=typeof t)return Ih(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&kh.throwArgumentError("invalid hex","value",t),"0x00"===(t=Ih(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Ch(t){return Oh.from(Ih(t))}function Ph(t){const e=Oh.from(t).toHexString();return"-"===e[0]?new Th("-"+e.substring(3),16):new Th(e.substring(2),16)}function Lh(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),kh.throwError(t,lh.errors.NUMERIC_FAULT,n)}const Uh=new lh("strings/5.7.0");var Bh,Dh;function Fh(t,e,r,n,i){if(t===Dh.BAD_PREFIX||t===Dh.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n>6==2;n++)t++;return t}return t===Dh.OVERRUN?r.length-e-1:0}function Gh(t,e=Bh.current){e!=Bh.current&&(Uh.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return mh(r)}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Bh||(Bh={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Dh||(Dh={})),Object.freeze({error:function(t,e,r,n,i){return Uh.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:Fh,replace:function(t,e,r,n,i){return t===Dh.OVERLONG?(n.push(i),0):(n.push(65533),Fh(t,e,r))}});var jh,qh=r(3715),zh=r.n(qh);!function(t){t.sha256="sha256",t.sha512="sha512"}(jh||(jh={}));const Kh=new lh("sha2/5.7.0");function Hh(t){return"0x"+zh().sha256().update(mh(t)).digest("hex")}function $h(t,e,r){return jh[t]||Kh.throwError("unsupported algorithm "+t,lh.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),"0x"+zh().hmac(zh()[t],mh(e)).update(mh(r)).digest("hex")}function Vh(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},t(r,r.exports),r.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self&&self;var Wh=Yh;function Yh(t,e){if(!t)throw new Error(e||"Assertion failed")}Yh.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Jh=Vh((function(t,e){var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}})),Xh=Vh((function(t,e){var r=e;r.assert=Wh,r.toArray=Jh.toArray,r.zero2=Jh.zero2,r.toHex=Jh.toHex,r.encode=Jh.encode,r.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,l=e.andln(3)+o&3;3===u&&(u=-1),3===l&&(l=-1),s=0==(1&u)?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==l?u:-u,r[0].push(s),a=0==(1&l)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==u?l:-l,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new(Sh())(t,"hex","le")}})),Zh=Xh.getNAF,Qh=Xh.getJSF,tc=Xh.assert;function ec(t,e){this.type=t,this.p=new(Sh())(e.p,16),this.red=e.prime?Sh().red(e.prime):Sh().mont(this.p),this.zero=new(Sh())(0).toRed(this.red),this.one=new(Sh())(1).toRed(this.red),this.two=new(Sh())(2).toRed(this.red),this.n=e.n&&new(Sh())(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var rc=ec;function nc(t,e){this.curve=t,this.type=e,this.precomputed=null}ec.prototype.point=function(){throw new Error("Not implemented")},ec.prototype.validate=function(){throw new Error("Not implemented")},ec.prototype._fixedNafMul=function(t,e){tc(t.precomputed);var r=t._getDoubles(),n=Zh(e,1,this._bitLength),i=(1<=o;u--)s=(s<<1)+n[u];a.push(s)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),c=i;c>0;c--){for(o=0;o=0;a--){for(var u=0;a>=0&&0===o[a];a--)u++;if(a>=0&&u++,s=s.dblp(u),a<0)break;var l=o[a];tc(0!==l),s="affine"===t.type?l>0?s.mixedAdd(i[l-1>>1]):s.mixedAdd(i[-l-1>>1].neg()):l>0?s.add(i[l-1>>1]):s.add(i[-l-1>>1].neg())}return"affine"===t.type?s.toP():s},ec.prototype._wnafMulAdd=function(t,e,r,n,i){var o,s,a,u=this._wnafT1,l=this._wnafT2,h=this._wnafT3,c=0;for(o=0;o=1;o-=2){var d=o-1,p=o;if(1===u[d]&&1===u[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=Qh(r[d],r[p]);for(c=Math.max(v[0].length,c),h[d]=new Array(c),h[p]=new Array(c),s=0;s=0;o--){for(var M=0;o>=0;){var A=!0;for(s=0;s=0&&M++,w=w.dblp(M),o<0)break;for(s=0;s0?a=l[s][_-1>>1]:_<0&&(a=l[s][-_-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},nc.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=e,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},sc.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),l=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(l).neg()}},sc.prototype.pointFromX=function(t,e){(t=new(Sh())(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},sc.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},sc.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},uc.prototype.isInfinity=function(){return this.inf},uc.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},uc.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},uc.prototype.getX=function(){return this.x.fromRed()},uc.prototype.getY=function(){return this.y.fromRed()},uc.prototype.mul=function(t){return t=new(Sh())(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},uc.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},uc.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},uc.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},uc.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},uc.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},ic(lc,rc.BasePoint),sc.prototype.jpoint=function(t,e,r){return new lc(this,t,e,r)},lc.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},lc.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},lc.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),h=l.redMul(a),c=n.redMul(l),f=u.redSqr().redIAdd(h).redISub(c).redISub(c),d=u.redMul(c.redISub(f)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(f,d,p)},lc.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),h=r.redMul(u),c=a.redSqr().redIAdd(l).redISub(h).redISub(h),f=a.redMul(h.redISub(c)).redISub(i.redMul(l)),d=this.z.redMul(s);return this.curve.jpoint(c,f,d)},lc.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},lc.prototype.inspect=function(){return this.isInfinity()?"":""},lc.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var hc=Vh((function(t,e){var r=e;r.base=rc,r.short=ac,r.mont=null,r.edwards=null})),cc=Vh((function(t,e){var r,n=e,i=Xh.assert;function o(t){"short"===t.type?this.curve=new hc.short(t):"edwards"===t.type?this.curve=new hc.edwards(t):this.curve=new hc.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:zh().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:zh().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:zh().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:zh().sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:zh().sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zh().sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zh().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){r=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:zh().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function fc(t){if(!(this instanceof fc))return new fc(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Jh.toArray(t.entropy,t.entropyEnc||"hex"),r=Jh.toArray(t.nonce,t.nonceEnc||"hex"),n=Jh.toArray(t.pers,t.persEnc||"hex");Wh(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var dc=fc;fc.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},fc.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=Jh.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var vc=Xh.assert;function yc(t,e){if(t instanceof yc)return t;this._importDER(t,e)||(vc(t.r&&t.s,"Signature without r or s"),this.r=new(Sh())(t.r,16),this.s=new(Sh())(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var bc=yc;function wc(){this.place=0}function Ec(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return!(i<=127)&&(e.place=s,i)}function Mc(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}yc.prototype._importDER=function(t,e){t=Xh.toArray(t,e);var r=new wc;if(48!==t[r.place++])return!1;var n=Ec(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var i=Ec(t,r);if(!1===i)return!1;var o=t.slice(r.place,i+r.place);if(r.place+=i,2!==t[r.place++])return!1;var s=Ec(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new(Sh())(o),this.s=new(Sh())(a),this.recoveryParam=null,!0},yc.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=Mc(e),r=Mc(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];Ac(n,e.length),(n=n.concat(e)).push(2),Ac(n,r.length);var i=n.concat(r),o=[48];return Ac(o,i.length),o=o.concat(i),Xh.encode(o,t)};var _c=function(){throw new Error("unsupported")},Nc=Xh.assert;function Sc(t){if(!(this instanceof Sc))return new Sc(t);"string"==typeof t&&(Nc(Object.prototype.hasOwnProperty.call(cc,t),"Unknown curve "+t),t=cc[t]),t instanceof cc.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Tc=Sc;Sc.prototype.keyPair=function(t){return new gc(this,t)},Sc.prototype.keyFromPrivate=function(t,e){return gc.fromPrivate(this,t,e)},Sc.prototype.keyFromPublic=function(t,e){return gc.fromPublic(this,t,e)},Sc.prototype.genKeyPair=function(t){t||(t={});for(var e=new dc({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||_c(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new(Sh())(2));;){var i=new(Sh())(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Sc.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Sc.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new(Sh())(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),s=t.toArray("be",i),a=new dc({hash:this.hash,entropy:o,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new(Sh())(1)),l=0;;l++){var h=n.k?n.k(l):new(Sh())(a.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(u)>=0)){var c=this.g.mul(h);if(!c.isInfinity()){var f=c.getX(),d=f.umod(this.n);if(0!==d.cmpn(0)){var p=h.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(c.getY().isOdd()?1:0)|(0!==f.cmp(d)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new bc({r:d,s:p,recoveryParam:m})}}}}}},Sc.prototype.verify=function(t,e,r,n){t=this._truncateToN(new(Sh())(t,16)),r=this.keyFromPublic(r,n);var i=(e=new bc(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,a=o.invm(this.n),u=a.mul(t).umod(this.n),l=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},Sc.prototype.recoverPubKey=function(t,e,r,n){Nc((3&r)===r,"The recovery param is more than two bits"),e=new bc(e,n);var i=this.n,o=new(Sh())(t),s=e.r,a=e.s,u=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var h=e.r.invm(i),c=i.sub(o).mul(h).umod(i),f=a.mul(h).umod(i);return this.g.mulAdd(c,s,f)},Sc.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new bc(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var kc=Vh((function(t,e){var r=e;r.version="6.5.4",r.utils=Xh,r.rand=function(){throw new Error("unsupported")},r.curve=hc,r.curves=cc,r.ec=Tc,r.eddsa=null})).ec;const Rc=new lh("signing-key/5.7.0");let xc=null;function Oc(){return xc||(xc=new kc("secp256k1")),xc}class Ic{constructor(t){Mh(this,"curve","secp256k1"),Mh(this,"privateKey",bh(t)),32!==function(t){if("string"!=typeof t)t=bh(t);else if(!vh(t)||t.length%2)return null;return(t.length-2)/2}(this.privateKey)&&Rc.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=Oc().keyFromPrivate(mh(this.privateKey));Mh(this,"publicKey","0x"+e.getPublic(!1,"hex")),Mh(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Mh(this,"_isSigningKey",!0)}_addPoint(t){const e=Oc().keyFromPublic(mh(this.publicKey)),r=Oc().keyFromPublic(mh(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=Oc().keyFromPrivate(mh(this.privateKey)),r=mh(t);32!==r.length&&Rc.throwArgumentError("bad digest length","digest",t);const n=e.sign(r,{canonical:!0});return function(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(vh(r=t)&&!(r.length%2)||ph(r)){let r=mh(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=bh(r.slice(0,32)),e.s=bh(r.slice(32,64))):65===r.length?(e.r=bh(r.slice(0,32)),e.s=bh(r.slice(32,64)),e.v=r[64]):hh.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:hh.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=bh(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=mh(t)).length>e&&hh.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),fh(r)}(mh(e._vs),32);e._vs=bh(r);const n=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=n:e.recoveryParam!==n&&hh.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const i=bh(r);null==e.s?e.s=i:e.s!==i&&hh.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?hh.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&hh.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&vh(e.r)?e.r=Eh(e.r,32):hh.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&vh(e.s)?e.s=Eh(e.s,32):hh.throwArgumentError("signature missing or invalid s","signature",t);const r=mh(e.s);r[0]>=128&&hh.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=bh(r);e._vs&&(vh(e._vs)||hh.throwArgumentError("signature invalid _vs","signature",t),e._vs=Eh(e._vs,32)),null==e._vs?e._vs=n:e._vs!==n&&hh.throwArgumentError("signature _vs mismatch v and s","signature",t)}var r;return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}({recoveryParam:n.recoveryParam,r:Eh("0x"+n.r.toString(16),32),s:Eh("0x"+n.s.toString(16),32)})}computeSharedSecret(t){const e=Oc().keyFromPrivate(mh(this.privateKey)),r=Oc().keyFromPublic(mh(Cc(t)));return Eh("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function Cc(t,e){const r=mh(t);if(32===r.length){const t=new Ic(r);return e?"0x"+Oc().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?bh(r):"0x"+Oc().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+Oc().keyFromPublic(r).getPublic(!0,"hex"):bh(r):Rc.throwArgumentError("invalid public or private key","key","[REDACTED]")}function Pc(t){return"0x"+Gn().keccak_256(mh(t))}const Lc=new lh("address/5.7.0");function Uc(t){vh(t,20)||Lc.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=mh(Pc(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Bc={};for(let t=0;t<10;t++)Bc[String(t)]=String(t);for(let t=0;t<26;t++)Bc[String.fromCharCode(65+t)]=String(10+t);const Dc=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Fc(t){let e=null;if("string"!=typeof t&&Lc.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Uc(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Lc.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Bc[t])).join("");for(;e.length>=Dc;){let t=e.substring(0,Dc);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&Lc.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Th(r,36).toString(16);e.length<40;)e="0"+e;e=Uc("0x"+e)}else Lc.throwArgumentError("invalid address","address",t);var r;return e}var Gc;new lh("transactions/5.7.0"),function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(Gc||(Gc={}));const jc=new lh("wordlists/5.7.0");class qc{constructor(t){jc.checkAbstract(new.target,qc),Mh(this,"locale",t)}split(t){return t.toLowerCase().split(/ +/g)}join(t){return t.join(" ")}static check(t){const e=[];for(let r=0;r<2048;r++){const n=t.getWord(r);if(r!==t.getWordIndex(n))return"0x";e.push(n)}return Pc(Gh(e.join("\n")+"\n"))}static register(t,e){e||(e=t.locale)}}let zc=null;function Kc(t){if(null==zc&&(zc="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==qc.check(t)))throw zc=null,new Error("BIP39 Wordlist for en (English) FAILED")}const Hc=new class extends qc{constructor(){super("en")}getWord(t){return Kc(this),zc[t]}getWordIndex(t){return Kc(this),zc.indexOf(t)}};qc.register(Hc);const $c={en:Hc},Vc=new lh("hdnode/5.5.0"),Wc=Oh.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Yc=Gh("Bitcoin seed"),Jc=2147483648;function Xc(t){return(1<=256)throw new Error("Depth too large!");return Qc(gh([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",bh(this.depth),this.parentFingerprint,Eh(bh(this.index),4),this.chainCode,null!=this.privateKey?gh(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new nf(ef,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(t){if(t>4294967295)throw new Error("invalid index - "+String(t));let e=this.path;e&&(e+="/"+(t&~Jc));const r=new Uint8Array(37);if(t&Jc){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(mh(this.privateKey),1),e&&(e+="'")}else r.set(mh(this.publicKey));for(let e=24;e>=0;e-=8)r[33+(e>>3)]=t>>24-e&255;const n=mh($h(jh.sha512,this.chainCode,r)),i=n.slice(0,32),o=n.slice(32);let s=null,a=null;this.privateKey?s=Zc(Oh.from(i).add(this.privateKey).mod(Wc)):a=new Ic(bh(i))._addPoint(this.publicKey);let u=e;const l=this.mnemonic;return l&&(u=Object.freeze({phrase:l.phrase,path:e,locale:l.locale||"en"})),new nf(ef,s,a,this.fingerprint,Zc(o),t,this.depth+1,u)}derivePath(t){const e=t.split("/");if(0===e.length||"m"===e[0]&&0!==this.depth)throw new Error("invalid path - "+t);"m"===e[0]&&e.shift();let r=this;for(let t=0;t=Jc)throw new Error("invalid path index - "+n);r=r._derive(Jc+t)}else{if(!n.match(/^[0-9]+$/))throw new Error("invalid path component - "+n);{const t=parseInt(n);if(t>=Jc)throw new Error("invalid path index - "+n);r=r._derive(t)}}}return r}static _fromSeed(t,e){const r=mh(t);if(r.length<16||r.length>64)throw new Error("invalid seed");const n=mh($h(jh.sha512,Yc,r));return new nf(ef,Zc(n.slice(0,32)),null,"0x00000000",Zc(n.slice(32)),0,0,e)}static fromMnemonic(t,e,r){return t=af(sf(t,r=tf(r)),r),nf._fromSeed(of(t,e),{phrase:t,path:"m",locale:r.locale})}static fromSeed(t){return nf._fromSeed(t,null)}static fromExtendedKey(t){const e=_h.decode(t);82===e.length&&Qc(e.slice(0,78))===t||Vc.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const r=e[4],n=bh(e.slice(5,9)),i=parseInt(bh(e.slice(9,13)).substring(2),16),o=bh(e.slice(13,45)),s=e.slice(45,78);switch(bh(e.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new nf(ef,null,bh(s),n,o,i,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new nf(ef,bh(s.slice(1)),null,n,o,i,r,null)}return Vc.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function of(t,e){e||(e="");const r=Gh("mnemonic"+e,Bh.NFKD);return function(t,e,r,n,i){let o;t=mh(t),e=mh(e);let s=1;const a=new Uint8Array(64),u=new Uint8Array(e.length+4);let l,h;u.set(e);for(let r=1;r<=s;r++){u[e.length]=r>>24&255,u[e.length+1]=r>>16&255,u[e.length+2]=r>>8&255,u[e.length+3]=255&r;let n=mh($h(i,t,u));o||(o=n.length,h=new Uint8Array(o),s=Math.ceil(64/o),l=64-(s-1)*o),h.set(n);for(let e=1;e<2048;e++){n=mh($h(i,t,n));for(let t=0;t>3]|=1<<7-i%8),i++}const o=32*r.length/3,s=Xc(r.length/3);if((mh(Hh(n.slice(0,o/8)))[0]&s)!=(n[n.length-1]&s))throw new Error("invalid checksum");return bh(n.slice(0,o/8))}function af(t,e){if(e=tf(e),(t=mh(t)).length%4!=0||t.length<16||t.length>32)throw new Error("invalid entropy");const r=[0];let n=11;for(let e=0;e8?(r[r.length-1]<<=8,r[r.length-1]|=t[e],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=t[e]>>8-n,r.push(t[e]&(1<<8-n)-1),n+=3);const i=t.length/4,o=mh(Hh(t))[0]&Xc(i);return r[r.length-1]<<=i,r[r.length-1]|=o>>8-i,e.join(r.map((t=>e.getWord(t))))}function uf(t,e){try{return sf(t,e),!0}catch(t){}return!1}function lf(t){return("number"!=typeof t||t<0||t>=Jc||t%1)&&Vc.throwArgumentError("invalid account index","index",t),`m/44'/60'/${t}'/0/0`}let hf=!1,cf=!1;const ff={debug:1,default:2,info:2,warning:3,error:4,off:5};let df=ff.default,pf=null;const mf=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var gf,vf;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(gf||(gf={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(vf||(vf={}));const yf="0123456789abcdef";class bf{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==ff[r]&&this.throwArgumentError("invalid log level name","logLevel",t),df>ff[r]||console.log.apply(console,e)}debug(...t){this._log(bf.levels.DEBUG,t)}info(...t){this._log(bf.levels.INFO,t)}warn(...t){this._log(bf.levels.WARNING,t)}makeError(t,e,r){if(cf)return this.makeError("censored error",e,{});e||(e=bf.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=yf[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case vf.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case vf.CALL_EXCEPTION:case vf.INSUFFICIENT_FUNDS:case vf.MISSING_NEW:case vf.NONCE_EXPIRED:case vf.REPLACEMENT_UNDERPRICED:case vf.TRANSACTION_REPLACED:case vf.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,bf.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),mf&&this.throwError("platform missing String.prototype.normalize",bf.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:mf})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,bf.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,bf.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,bf.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",bf.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",bf.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",bf.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return pf||(pf=new bf("logger/5.7.0")),pf}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",bf.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),hf){if(!t)return;this.globalLogger().throwError("error censorship permanent",bf.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}cf=!!t,hf=!!e}static setLogLevel(t){const e=ff[t.toLowerCase()];null!=e?df=e:bf.globalLogger().warn("invalid log level - "+t)}static from(t){return new bf(t)}}bf.errors=vf,bf.levels=gf;const wf=new bf("bytes/5.7.0");function Ef(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ef(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Mf(t){return"number"==typeof t&&t==t&&t%1==0}function Af(t,e){if(e||(e={}),"number"==typeof t){wf.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Ef(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),_f(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":wf.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?Ef(new Uint8Array(t)):wf.throwArgumentError("invalid arrayify value","value",t)}function _f(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var Nf=r(557),Sf=r.n(Nf)().BN;new bf("bignumber/5.7.0");const Tf=new bf("address/5.7.0");function kf(t){_f(t,20)||Tf.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=Af((i=r,"0x"+Gn().keccak_256(Af(i))));var i;for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Rf={};for(let t=0;t<10;t++)Rf[String(t)]=String(t);for(let t=0;t<26;t++)Rf[String.fromCharCode(65+t)]=String(10+t);const xf=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Of(t){let e=null;if("string"!=typeof t&&Tf.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=kf(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Tf.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Rf[t])).join("");for(;e.length>=xf;){let t=e.substring(0,xf);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&Tf.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Sf(r,36).toString(16);e.length<40;)e="0"+e;e=kf("0x"+e)}else Tf.throwArgumentError("invalid address","address",t);var r;return e}function If(t){if(function(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return e.encseed&&e.ethaddr}(t))try{return Of(JSON.parse(t).ethaddr)}catch(t){return null}if(function(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return!(!e.version||parseInt(e.version)!==e.version||3!==parseInt(e.version))}(t))try{return Of(JSON.parse(t).address)}catch(t){return null}return null}let Cf=!1,Pf=!1;const Lf={debug:1,default:2,info:2,warning:3,error:4,off:5};let Uf=Lf.default,Bf=null;const Df=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Ff,Gf;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Ff||(Ff={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Gf||(Gf={}));const jf="0123456789abcdef";class qf{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Lf[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Uf>Lf[r]||console.log.apply(console,e)}debug(...t){this._log(qf.levels.DEBUG,t)}info(...t){this._log(qf.levels.INFO,t)}warn(...t){this._log(qf.levels.WARNING,t)}makeError(t,e,r){if(Pf)return this.makeError("censored error",e,{});e||(e=qf.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=jf[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Gf.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Gf.CALL_EXCEPTION:case Gf.INSUFFICIENT_FUNDS:case Gf.MISSING_NEW:case Gf.NONCE_EXPIRED:case Gf.REPLACEMENT_UNDERPRICED:case Gf.TRANSACTION_REPLACED:case Gf.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,qf.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Df&&this.throwError("platform missing String.prototype.normalize",qf.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Df})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,qf.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,qf.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,qf.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",qf.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",qf.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",qf.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Bf||(Bf=new qf("logger/5.7.0")),Bf}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",qf.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Cf){if(!t)return;this.globalLogger().throwError("error censorship permanent",qf.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Pf=!!t,Cf=!!e}static setLogLevel(t){const e=Lf[t.toLowerCase()];null!=e?Uf=e:qf.globalLogger().warn("invalid log level - "+t)}static from(t){return new qf(t)}}qf.errors=Gf,qf.levels=Ff;const zf=new qf("bytes/5.7.0");function Kf(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Kf(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Hf(t){return"number"==typeof t&&t==t&&t%1==0}function $f(t,e){if(e||(e={}),"number"==typeof t){zf.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Kf(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":zf.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?Kf(new Uint8Array(t)):zf.throwArgumentError("invalid arrayify value","value",t)}function Vf(t){return"0x"+Gn().keccak_256($f(t))}let Wf=!1,Yf=!1;const Jf={debug:1,default:2,info:2,warning:3,error:4,off:5};let Xf=Jf.default,Zf=null;const Qf=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var td,ed;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(td||(td={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(ed||(ed={}));const rd="0123456789abcdef";class nd{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Jf[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Xf>Jf[r]||console.log.apply(console,e)}debug(...t){this._log(nd.levels.DEBUG,t)}info(...t){this._log(nd.levels.INFO,t)}warn(...t){this._log(nd.levels.WARNING,t)}makeError(t,e,r){if(Yf)return this.makeError("censored error",e,{});e||(e=nd.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=rd[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;n.length&&(t+=" ("+n.join(", ")+")");const o=new Error(t);return o.reason=i,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,nd.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Qf&&this.throwError("platform missing String.prototype.normalize",nd.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Qf})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,nd.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,nd.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,nd.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",nd.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",nd.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",nd.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Zf||(Zf=new nd("logger/5.5.0")),Zf}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",nd.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Wf){if(!t)return;this.globalLogger().throwError("error censorship permanent",nd.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Yf=!!t,Wf=!!e}static setLogLevel(t){const e=Jf[t.toLowerCase()];null!=e?Xf=e:nd.globalLogger().warn("invalid log level - "+t)}static from(t){return new nd(t)}}nd.errors=ed,nd.levels=td;let id=!1,od=!1;const sd={debug:1,default:2,info:2,warning:3,error:4,off:5};let ad=sd.default,ud=null;const ld=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var hd,cd;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(hd||(hd={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(cd||(cd={}));const fd="0123456789abcdef";class dd{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==sd[r]&&this.throwArgumentError("invalid log level name","logLevel",t),ad>sd[r]||console.log.apply(console,e)}debug(...t){this._log(dd.levels.DEBUG,t)}info(...t){this._log(dd.levels.INFO,t)}warn(...t){this._log(dd.levels.WARNING,t)}makeError(t,e,r){if(od)return this.makeError("censored error",e,{});e||(e=dd.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=fd[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case cd.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case cd.CALL_EXCEPTION:case cd.INSUFFICIENT_FUNDS:case cd.MISSING_NEW:case cd.NONCE_EXPIRED:case cd.REPLACEMENT_UNDERPRICED:case cd.TRANSACTION_REPLACED:case cd.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,dd.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),ld&&this.throwError("platform missing String.prototype.normalize",dd.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ld})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,dd.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,dd.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,dd.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",dd.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",dd.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",dd.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return ud||(ud=new dd("logger/5.7.0")),ud}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",dd.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),id){if(!t)return;this.globalLogger().throwError("error censorship permanent",dd.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}od=!!t,id=!!e}static setLogLevel(t){const e=sd[t.toLowerCase()];null!=e?ad=e:dd.globalLogger().warn("invalid log level - "+t)}static from(t){return new dd(t)}}dd.errors=cd,dd.levels=hd;const pd=new dd("bytes/5.7.0");function md(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return md(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function gd(t){return"number"==typeof t&&t==t&&t%1==0}function vd(t,e){if(e||(e={}),"number"==typeof t){pd.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),md(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":pd.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?md(new Uint8Array(t)):pd.throwArgumentError("invalid arrayify value","value",t)}var yd;!function(t){t.sha256="sha256",t.sha512="sha512"}(yd||(yd={}));const bd=new dd("sha2/5.5.0");function wd(t){return"0x"+zh().ripemd160().update(vd(t)).digest("hex")}function Ed(t){return"0x"+zh().sha256().update(vd(t)).digest("hex")}function Md(t){return"0x"+zh().sha512().update(vd(t)).digest("hex")}function Ad(t,e,r){return yd[t]||bd.throwError("unsupported algorithm "+t,dd.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),"0x"+zh().hmac(zh()[t],vd(e)).update(vd(r)).digest("hex")}const _d=new RegExp("^bytes([0-9]+)$"),Nd=new RegExp("^(u?int)([0-9]*)$"),Sd=new RegExp("^(.*)\\[([0-9]*)\\]$"),Td="0000000000000000000000000000000000000000000000000000000000000000",kd=new y.Yd("solidity/5.5.0");function Rd(t,e,r){switch(t){case"address":return r?(0,m.Bu)(e,32):(0,m.lE)(e);case"string":return(0,$e.Y0)(e);case"bytes":return(0,m.lE)(e);case"bool":return e=e?"0x01":"0x00",r?(0,m.Bu)(e,32):(0,m.lE)(e)}let n=t.match(Nd);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!=0||0===i||i>256)&&kd.throwArgumentError("invalid number type","type",t),r&&(i=256),e=p.O$.from(e).toTwos(i),(0,m.Bu)(e,i/8)}if(n=t.match(_d),n){const i=parseInt(n[1]);return(String(i)!==n[1]||0===i||i>32)&&kd.throwArgumentError("invalid bytes type","type",t),(0,m.lE)(e).byteLength!==i&&kd.throwArgumentError(`invalid value for ${t}`,"value",e),r?(0,m.lE)((e+Td).substring(0,66)):e}if(n=t.match(Sd),n&&Array.isArray(e)){const r=n[1];parseInt(n[2]||String(e.length))!=e.length&&kd.throwArgumentError(`invalid array length for ${t}`,"value",e);const i=[];return e.forEach((function(t){i.push(Rd(r,t,!0))})),(0,m.zo)(i)}return kd.throwArgumentError("invalid type","type",t)}function xd(t,e){t.length!=e.length&&kd.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach((function(t,n){r.push(Rd(t,e[n]))})),(0,m.Dv)((0,m.zo)(r))}function Od(t,e){return(0,Wt.w)(xd(t,e))}function Id(t,e){return(0,He.JQ)(xd(t,e))}let Cd=!1,Pd=!1;const Ld={debug:1,default:2,info:2,warning:3,error:4,off:5};let Ud=Ld.default,Bd=null;const Dd=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Fd,Gd;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Fd||(Fd={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Gd||(Gd={}));const jd="0123456789abcdef";class qd{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Ld[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Ud>Ld[r]||console.log.apply(console,e)}debug(...t){this._log(qd.levels.DEBUG,t)}info(...t){this._log(qd.levels.INFO,t)}warn(...t){this._log(qd.levels.WARNING,t)}makeError(t,e,r){if(Pd)return this.makeError("censored error",e,{});e||(e=qd.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=jd[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Gd.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Gd.CALL_EXCEPTION:case Gd.INSUFFICIENT_FUNDS:case Gd.MISSING_NEW:case Gd.NONCE_EXPIRED:case Gd.REPLACEMENT_UNDERPRICED:case Gd.TRANSACTION_REPLACED:case Gd.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,qd.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Dd&&this.throwError("platform missing String.prototype.normalize",qd.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Dd})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,qd.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,qd.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,qd.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",qd.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",qd.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",qd.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Bd||(Bd=new qd("logger/5.7.0")),Bd}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",qd.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Cd){if(!t)return;this.globalLogger().throwError("error censorship permanent",qd.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Pd=!!t,Cd=!!e}static setLogLevel(t){const e=Ld[t.toLowerCase()];null!=e?Ud=e:qd.globalLogger().warn("invalid log level - "+t)}static from(t){return new qd(t)}}qd.errors=Gd,qd.levels=Fd;const zd=new qd("bytes/5.7.0");function Kd(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Kd(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Hd(t){return"number"==typeof t&&t==t&&t%1==0}function $d(t,e){if(e||(e={}),"number"==typeof t){zd.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Kd(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":zd.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t=256)return!1}return!0}(t)?Kd(new Uint8Array(t)):zd.throwArgumentError("invalid arrayify value","value",t)}const Vd=new qd("random/5.5.1"),Wd=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("unable to locate global object")}();let Yd=Wd.crypto||Wd.msCrypto;function Jd(t){(t<=0||t>1024||t%1||t!=t)&&Vd.throwArgumentError("invalid length","length",t);const e=new Uint8Array(t);return Yd.getRandomValues(e),$d(e)}function Xd(t){for(let e=(t=t.slice()).length-1;e>0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}Yd&&Yd.getRandomValues||(Vd.warn("WARNING: Missing strong random number source"),Yd={getRandomValues:function(t){return Vd.throwError("no secure random source avaialble",qd.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});let Zd=!1,Qd=!1;const tp={debug:1,default:2,info:2,warning:3,error:4,off:5};let ep=tp.default,rp=null;const np=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var ip,op;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(ip||(ip={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(op||(op={}));const sp="0123456789abcdef";class ap{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==tp[r]&&this.throwArgumentError("invalid log level name","logLevel",t),ep>tp[r]||console.log.apply(console,e)}debug(...t){this._log(ap.levels.DEBUG,t)}info(...t){this._log(ap.levels.INFO,t)}warn(...t){this._log(ap.levels.WARNING,t)}makeError(t,e,r){if(Qd)return this.makeError("censored error",e,{});e||(e=ap.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=sp[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case op.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case op.CALL_EXCEPTION:case op.INSUFFICIENT_FUNDS:case op.MISSING_NEW:case op.NONCE_EXPIRED:case op.REPLACEMENT_UNDERPRICED:case op.TRANSACTION_REPLACED:case op.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,ap.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),np&&this.throwError("platform missing String.prototype.normalize",ap.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:np})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,ap.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,ap.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,ap.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",ap.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",ap.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",ap.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return rp||(rp=new ap("logger/5.7.0")),rp}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",ap.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Zd){if(!t)return;this.globalLogger().throwError("error censorship permanent",ap.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Qd=!!t,Zd=!!e}static setLogLevel(t){const e=tp[t.toLowerCase()];null!=e?ep=e:ap.globalLogger().warn("invalid log level - "+t)}static from(t){return new ap(t)}}ap.errors=op,ap.levels=ip;var up=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const lp=new ap("properties/5.5.0");function hp(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function cp(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function fp(t){return up(this,void 0,void 0,(function*(){const e=Object.keys(t).map((e=>{const r=t[e];return Promise.resolve(r).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}))}function dp(t,e){t&&"object"==typeof t||lp.throwArgumentError("invalid object","object",t),Object.keys(t).forEach((r=>{e[r]||lp.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)}))}function pp(t){const e={};for(const r in t)e[r]=t[r];return e}const mp={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function gp(t){if(null==t||mp[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;ryp(t))));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&hp(e,r,yp(n))}return e}return lp.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function yp(t){return vp(t)}let bp=!1,wp=!1;const Ep={debug:1,default:2,info:2,warning:3,error:4,off:5};let Mp=Ep.default,Ap=null;const _p=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Np,Sp;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Np||(Np={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Sp||(Sp={}));const Tp="0123456789abcdef";class kp{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Ep[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Mp>Ep[r]||console.log.apply(console,e)}debug(...t){this._log(kp.levels.DEBUG,t)}info(...t){this._log(kp.levels.INFO,t)}warn(...t){this._log(kp.levels.WARNING,t)}makeError(t,e,r){if(wp)return this.makeError("censored error",e,{});e||(e=kp.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Tp[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Sp.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Sp.CALL_EXCEPTION:case Sp.INSUFFICIENT_FUNDS:case Sp.MISSING_NEW:case Sp.NONCE_EXPIRED:case Sp.REPLACEMENT_UNDERPRICED:case Sp.TRANSACTION_REPLACED:case Sp.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,kp.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),_p&&this.throwError("platform missing String.prototype.normalize",kp.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_p})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,kp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,kp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,kp.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",kp.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",kp.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",kp.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Ap||(Ap=new kp("logger/5.7.0")),Ap}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",kp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),bp){if(!t)return;this.globalLogger().throwError("error censorship permanent",kp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}wp=!!t,bp=!!e}static setLogLevel(t){const e=Ep[t.toLowerCase()];null!=e?Mp=e:kp.globalLogger().warn("invalid log level - "+t)}static from(t){return new kp(t)}}kp.errors=Sp,kp.levels=Np;const Rp=new kp("bytes/5.7.0");function xp(t){return!!t.toHexString}function Op(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Op(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Ip(t){return"number"==typeof t&&t==t&&t%1==0}function Cp(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Ip(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Pp(t,e){if(e||(e={}),"number"==typeof t){Rp.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Op(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),xp(t)&&(t=t.toHexString()),Lp(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Rp.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t>4]+Up[15&n]}return e}return Rp.throwArgumentError("invalid hexlify value","value",t)}const Dp=new kp("rlp/5.5.0");function Fp(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function Gp(t,e,r){let n=0;for(let i=0;ie+1+n&&Dp.throwError("child data too short",kp.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function Kp(t,e){if(0===t.length&&Dp.throwError("data too short",kp.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&Dp.throwError("data short segment too short",kp.errors.BUFFER_OVERRUN,{});const n=Gp(t,e+1,r);return e+1+r+n>t.length&&Dp.throwError("data long segment too short",kp.errors.BUFFER_OVERRUN,{}),zp(t,e,e+1+r,r+n)}if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&Dp.throwError("data array too short",kp.errors.BUFFER_OVERRUN,{}),zp(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&Dp.throwError("data array too short",kp.errors.BUFFER_OVERRUN,{});const n=Gp(t,e+1,r);return e+1+r+n>t.length&&Dp.throwError("data array too short",kp.errors.BUFFER_OVERRUN,{}),{consumed:1+r+n,result:Bp(t.slice(e+1+r,e+1+r+n))}}if(t[e]>=128){const r=t[e]-128;return e+1+r>t.length&&Dp.throwError("data too short",kp.errors.BUFFER_OVERRUN,{}),{consumed:1+r,result:Bp(t.slice(e+1,e+1+r))}}return{consumed:1,result:Bp(t[e])}}function Hp(t){const e=Pp(t),r=Kp(e,0);return r.consumed!==e.length&&Dp.throwArgumentError("invalid rlp data","data",t),r.result}function $p(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},t(r,r.exports),r.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self&&self;var Vp=Wp;function Wp(t,e){if(!t)throw new Error(e||"Assertion failed")}Wp.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Yp=$p((function(t,e){var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}})),Jp=$p((function(t,e){var r=e;r.assert=Vp,r.toArray=Yp.toArray,r.zero2=Yp.zero2,r.toHex=Yp.toHex,r.encode=Yp.encode,r.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,l=e.andln(3)+o&3;3===u&&(u=-1),3===l&&(l=-1),s=0==(1&u)?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==l?u:-u,r[0].push(s),a=0==(1&l)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==u?l:-l,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new(B())(t,"hex","le")}})),Xp=Jp.getNAF,Zp=Jp.getJSF,Qp=Jp.assert;function tm(t,e){this.type=t,this.p=new(B())(e.p,16),this.red=e.prime?B().red(e.prime):B().mont(this.p),this.zero=new(B())(0).toRed(this.red),this.one=new(B())(1).toRed(this.red),this.two=new(B())(2).toRed(this.red),this.n=e.n&&new(B())(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var em=tm;function rm(t,e){this.curve=t,this.type=e,this.precomputed=null}tm.prototype.point=function(){throw new Error("Not implemented")},tm.prototype.validate=function(){throw new Error("Not implemented")},tm.prototype._fixedNafMul=function(t,e){Qp(t.precomputed);var r=t._getDoubles(),n=Xp(e,1,this._bitLength),i=(1<=o;u--)s=(s<<1)+n[u];a.push(s)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),c=i;c>0;c--){for(o=0;o=0;a--){for(var u=0;a>=0&&0===o[a];a--)u++;if(a>=0&&u++,s=s.dblp(u),a<0)break;var l=o[a];Qp(0!==l),s="affine"===t.type?l>0?s.mixedAdd(i[l-1>>1]):s.mixedAdd(i[-l-1>>1].neg()):l>0?s.add(i[l-1>>1]):s.add(i[-l-1>>1].neg())}return"affine"===t.type?s.toP():s},tm.prototype._wnafMulAdd=function(t,e,r,n,i){var o,s,a,u=this._wnafT1,l=this._wnafT2,h=this._wnafT3,c=0;for(o=0;o=1;o-=2){var d=o-1,p=o;if(1===u[d]&&1===u[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=Zp(r[d],r[p]);for(c=Math.max(v[0].length,c),h[d]=new Array(c),h[p]=new Array(c),s=0;s=0;o--){for(var M=0;o>=0;){var A=!0;for(s=0;s=0&&M++,w=w.dblp(M),o<0)break;for(s=0;s0?a=l[s][_-1>>1]:_<0&&(a=l[s][-_-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},rm.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=e,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},om.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),l=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(l).neg()}},om.prototype.pointFromX=function(t,e){(t=new(B())(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},om.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},om.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},am.prototype.isInfinity=function(){return this.inf},am.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},am.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},am.prototype.getX=function(){return this.x.fromRed()},am.prototype.getY=function(){return this.y.fromRed()},am.prototype.mul=function(t){return t=new(B())(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},am.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},am.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},am.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},am.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},am.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},nm(um,em.BasePoint),om.prototype.jpoint=function(t,e,r){return new um(this,t,e,r)},um.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},um.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},um.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),h=l.redMul(a),c=n.redMul(l),f=u.redSqr().redIAdd(h).redISub(c).redISub(c),d=u.redMul(c.redISub(f)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(f,d,p)},um.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),h=r.redMul(u),c=a.redSqr().redIAdd(l).redISub(h).redISub(h),f=a.redMul(h.redISub(c)).redISub(i.redMul(l)),d=this.z.redMul(s);return this.curve.jpoint(c,f,d)},um.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},um.prototype.inspect=function(){return this.isInfinity()?"":""},um.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var lm=$p((function(t,e){var r=e;r.base=em,r.short=sm,r.mont=null,r.edwards=null})),hm=$p((function(t,e){var r,n=e,i=Jp.assert;function o(t){"short"===t.type?this.curve=new lm.short(t):"edwards"===t.type?this.curve=new lm.edwards(t):this.curve=new lm.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:zh().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:zh().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:zh().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:zh().sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:zh().sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zh().sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zh().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){r=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:zh().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function cm(t){if(!(this instanceof cm))return new cm(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Yp.toArray(t.entropy,t.entropyEnc||"hex"),r=Yp.toArray(t.nonce,t.nonceEnc||"hex"),n=Yp.toArray(t.pers,t.persEnc||"hex");Vp(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var fm=cm;cm.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},cm.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=Yp.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var gm=Jp.assert;function vm(t,e){if(t instanceof vm)return t;this._importDER(t,e)||(gm(t.r&&t.s,"Signature without r or s"),this.r=new(B())(t.r,16),this.s=new(B())(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var ym=vm;function bm(){this.place=0}function wm(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return!(i<=127)&&(e.place=s,i)}function Em(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}vm.prototype._importDER=function(t,e){t=Jp.toArray(t,e);var r=new bm;if(48!==t[r.place++])return!1;var n=wm(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var i=wm(t,r);if(!1===i)return!1;var o=t.slice(r.place,i+r.place);if(r.place+=i,2!==t[r.place++])return!1;var s=wm(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new(B())(o),this.s=new(B())(a),this.recoveryParam=null,!0},vm.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=Em(e),r=Em(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];Mm(n,e.length),(n=n.concat(e)).push(2),Mm(n,r.length);var i=n.concat(r),o=[48];return Mm(o,i.length),o=o.concat(i),Jp.encode(o,t)};var Am=function(){throw new Error("unsupported")},_m=Jp.assert;function Nm(t){if(!(this instanceof Nm))return new Nm(t);"string"==typeof t&&(_m(Object.prototype.hasOwnProperty.call(hm,t),"Unknown curve "+t),t=hm[t]),t instanceof hm.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Sm=Nm;Nm.prototype.keyPair=function(t){return new mm(this,t)},Nm.prototype.keyFromPrivate=function(t,e){return mm.fromPrivate(this,t,e)},Nm.prototype.keyFromPublic=function(t,e){return mm.fromPublic(this,t,e)},Nm.prototype.genKeyPair=function(t){t||(t={});for(var e=new fm({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||Am(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new(B())(2));;){var i=new(B())(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Nm.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Nm.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new(B())(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),s=t.toArray("be",i),a=new fm({hash:this.hash,entropy:o,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new(B())(1)),l=0;;l++){var h=n.k?n.k(l):new(B())(a.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(u)>=0)){var c=this.g.mul(h);if(!c.isInfinity()){var f=c.getX(),d=f.umod(this.n);if(0!==d.cmpn(0)){var p=h.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(c.getY().isOdd()?1:0)|(0!==f.cmp(d)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new ym({r:d,s:p,recoveryParam:m})}}}}}},Nm.prototype.verify=function(t,e,r,n){t=this._truncateToN(new(B())(t,16)),r=this.keyFromPublic(r,n);var i=(e=new ym(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,a=o.invm(this.n),u=a.mul(t).umod(this.n),l=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},Nm.prototype.recoverPubKey=function(t,e,r,n){_m((3&r)===r,"The recovery param is more than two bits"),e=new ym(e,n);var i=this.n,o=new(B())(t),s=e.r,a=e.s,u=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var h=e.r.invm(i),c=i.sub(o).mul(h).umod(i),f=a.mul(h).umod(i);return this.g.mulAdd(c,s,f)},Nm.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new ym(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Tm=$p((function(t,e){var r=e;r.version="6.5.4",r.utils=Jp,r.rand=function(){throw new Error("unsupported")},r.curve=lm,r.curves=hm,r.ec=Sm,r.eddsa=null})).ec;let km=!1,Rm=!1;const xm={debug:1,default:2,info:2,warning:3,error:4,off:5};let Om=xm.default,Im=null;const Cm=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Pm,Lm;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Pm||(Pm={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Lm||(Lm={}));const Um="0123456789abcdef";class Bm{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==xm[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Om>xm[r]||console.log.apply(console,e)}debug(...t){this._log(Bm.levels.DEBUG,t)}info(...t){this._log(Bm.levels.INFO,t)}warn(...t){this._log(Bm.levels.WARNING,t)}makeError(t,e,r){if(Rm)return this.makeError("censored error",e,{});e||(e=Bm.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=Um[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Lm.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Lm.CALL_EXCEPTION:case Lm.INSUFFICIENT_FUNDS:case Lm.MISSING_NEW:case Lm.NONCE_EXPIRED:case Lm.REPLACEMENT_UNDERPRICED:case Lm.TRANSACTION_REPLACED:case Lm.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Bm.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Cm&&this.throwError("platform missing String.prototype.normalize",Bm.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Cm})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Bm.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Bm.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,Bm.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Bm.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Bm.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Bm.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Im||(Im=new Bm("logger/5.7.0")),Im}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Bm.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),km){if(!t)return;this.globalLogger().throwError("error censorship permanent",Bm.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Rm=!!t,km=!!e}static setLogLevel(t){const e=xm[t.toLowerCase()];null!=e?Om=e:Bm.globalLogger().warn("invalid log level - "+t)}static from(t){return new Bm(t)}}Bm.errors=Lm,Bm.levels=Pm;const Dm=new Bm("bytes/5.7.0");function Fm(t){return!!t.toHexString}function Gm(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Gm(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function jm(t){return"number"==typeof t&&t==t&&t%1==0}function qm(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!jm(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function zm(t,e){if(e||(e={}),"number"==typeof t){Dm.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Gm(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Fm(t)&&(t=t.toHexString()),Km(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Dm.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t>4]+Hm[15&n]}return e}return Dm.throwArgumentError("invalid hexlify value","value",t)}function Vm(t,e){for("string"!=typeof t?t=$m(t):Km(t)||Dm.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Dm.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Wm(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Km(r=t)&&!(r.length%2)||qm(r)){let r=zm(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=$m(r.slice(0,32)),e.s=$m(r.slice(32,64))):65===r.length?(e.r=$m(r.slice(0,32)),e.s=$m(r.slice(32,64)),e.v=r[64]):Dm.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:Dm.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=$m(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=zm(t)).length>e&&Dm.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Gm(r)}(zm(e._vs),32);e._vs=$m(r);const n=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=n:e.recoveryParam!==n&&Dm.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const i=$m(r);null==e.s?e.s=i:e.s!==i&&Dm.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?Dm.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&Dm.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&Km(e.r)?e.r=Vm(e.r,32):Dm.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&Km(e.s)?e.s=Vm(e.s,32):Dm.throwArgumentError("signature missing or invalid s","signature",t);const r=zm(e.s);r[0]>=128&&Dm.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=$m(r);e._vs&&(Km(e._vs)||Dm.throwArgumentError("signature invalid _vs","signature",t),e._vs=Vm(e._vs,32)),null==e._vs?e._vs=n:e._vs!==n&&Dm.throwArgumentError("signature _vs mismatch v and s","signature",t)}var r;return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Ym(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new Bm("properties/5.7.0");const Jm=new Bm("signing-key/5.5.0");let Xm=null;function Zm(){return Xm||(Xm=new Tm("secp256k1")),Xm}class Qm{constructor(t){Ym(this,"curve","secp256k1"),Ym(this,"privateKey",$m(t));const e=Zm().keyFromPrivate(zm(this.privateKey));Ym(this,"publicKey","0x"+e.getPublic(!1,"hex")),Ym(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Ym(this,"_isSigningKey",!0)}_addPoint(t){const e=Zm().keyFromPublic(zm(this.publicKey)),r=Zm().keyFromPublic(zm(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=Zm().keyFromPrivate(zm(this.privateKey)),r=zm(t);32!==r.length&&Jm.throwArgumentError("bad digest length","digest",t);const n=e.sign(r,{canonical:!0});return Wm({recoveryParam:n.recoveryParam,r:Vm("0x"+n.r.toString(16),32),s:Vm("0x"+n.s.toString(16),32)})}computeSharedSecret(t){const e=Zm().keyFromPrivate(zm(this.privateKey)),r=Zm().keyFromPublic(zm(eg(t)));return Vm("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function tg(t,e){const r=Wm(e),n={r:zm(r.r),s:zm(r.s)};return"0x"+Zm().recoverPubKey(zm(t),n,r.recoveryParam).encode("hex",!1)}function eg(t,e){const r=zm(t);if(32===r.length){const t=new Qm(r);return e?"0x"+Zm().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?$m(r):"0x"+Zm().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+Zm().keyFromPublic(r).getPublic(!0,"hex"):$m(r):Jm.throwArgumentError("invalid public or private key","key","[REDACTED]")}let rg=!1,ng=!1;const ig={debug:1,default:2,info:2,warning:3,error:4,off:5};let og=ig.default,sg=null;const ag=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var ug,lg;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(ug||(ug={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(lg||(lg={}));const hg="0123456789abcdef";class cg{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==ig[r]&&this.throwArgumentError("invalid log level name","logLevel",t),og>ig[r]||console.log.apply(console,e)}debug(...t){this._log(cg.levels.DEBUG,t)}info(...t){this._log(cg.levels.INFO,t)}warn(...t){this._log(cg.levels.WARNING,t)}makeError(t,e,r){if(ng)return this.makeError("censored error",e,{});e||(e=cg.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=hg[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case lg.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case lg.CALL_EXCEPTION:case lg.INSUFFICIENT_FUNDS:case lg.MISSING_NEW:case lg.NONCE_EXPIRED:case lg.REPLACEMENT_UNDERPRICED:case lg.TRANSACTION_REPLACED:case lg.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,cg.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),ag&&this.throwError("platform missing String.prototype.normalize",cg.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ag})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,cg.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,cg.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,cg.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",cg.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",cg.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",cg.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return sg||(sg=new cg("logger/5.7.0")),sg}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",cg.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),rg){if(!t)return;this.globalLogger().throwError("error censorship permanent",cg.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ng=!!t,rg=!!e}static setLogLevel(t){const e=ig[t.toLowerCase()];null!=e?og=e:cg.globalLogger().warn("invalid log level - "+t)}static from(t){return new cg(t)}}cg.errors=lg,cg.levels=ug;const fg=new cg("bytes/5.7.0");function dg(t){return!!t.toHexString}function pg(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return pg(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function mg(t){return"number"==typeof t&&t==t&&t%1==0}function gg(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!mg(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function vg(t,e){if(e||(e={}),"number"==typeof t){fg.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),pg(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),dg(t)&&(t=t.toHexString()),yg(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":fg.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t>6==2;n++)t++;return t}return t===Mg.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Eg||(Eg={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Mg||(Mg={}));const _g=Object.freeze({error:function(t,e,r,n,i){return wg.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:Ag,replace:function(t,e,r,n,i){return t===Mg.OVERLONG?(n.push(i),0):(n.push(65533),Ag(t,e,r))}});function Ng(t,e){null==e&&(e=_g.error),t=vg(t);const r=[];let n=0;for(;n>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?Mg.UNEXPECTED_CONTINUE:Mg.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e(Mg.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i1114111?n+=e(Mg.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e(Mg.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e(Mg.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}function Sg(t,e=Eg.current){e!=Eg.current&&(wg.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return vg(r)}function Tg(t){const e="0000"+t.toString(16);return"\\u"+e.substring(e.length-4)}function kg(t,e){return'"'+Ng(t,e).map((t=>{if(t<256){switch(t){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(t>=32&&t<127)return String.fromCharCode(t)}return t<=65535?Tg(t):Tg(55296+((t-=65536)>>10&1023))+Tg(56320+(1023&t))})).join("")+'"'}function Rg(t){return t.map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function xg(t,e){return Rg(Ng(t,e))}function Og(t,e=Eg.current){return Ng(Sg(t,e))}function Ig(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,n={};return t.split(",").forEach((t=>{let i=t.split(":");r+=parseInt(i[0],16),n[r]=e(i[1])})),n}function Cg(t){let e=0;return t.split(",").map((t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:n,h:e}}))}function Pg(t,e){let r=0;for(let n=0;n=r&&t<=r+i.h&&(t-r)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(t-r))continue;return i}}return null}const Lg=Cg("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),Ug="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((t=>parseInt(t,16))),Bg=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],Dg=Ig("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Fg=Ig("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Gg=Ig("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r{if(Ug.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=Pg(t,Bg);if(e)return[t+e.s];let r=Dg[t];if(r)return r;let n=Fg[t];return n?[t+n[0]]:Gg[t]||null}(t);return e||[t]})),e=r.reduce(((t,e)=>(e.forEach((e=>{t.push(e)})),t)),[]),e=Og(Rg(e),Eg.NFKC),e.forEach((t=>{if(Pg(t,jg))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),e.forEach((t=>{if(Pg(t,Lg))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=Rg(e);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");if(n.length>63)throw new Error("too long");return n}const zg="0x0000000000000000000000000000000000000000000000000000000000000000";function Kg(t){const e=Sg(t);if(e.length>31)throw new Error("bytes32 string must be less than 32 bytes");return function(t,e){if(e||(e={}),"number"==typeof t){fg.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=bg[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),dg(t))return t.toHexString();if(yg(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":fg.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(gg(t)){let e="0x";for(let r=0;r>4]+bg[15&n]}return e}return fg.throwArgumentError("invalid hexlify value","value",t)}(function(t){const e=t.map((t=>vg(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),pg(n)}([e,zg]).slice(0,32))}function Hg(t){const e=vg(t);if(32!==e.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==e[31])throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;0===e[r-1];)r--;return xg(e.slice(0,r))}let $g=!1,Vg=!1;const Wg={debug:1,default:2,info:2,warning:3,error:4,off:5};let Yg=Wg.default,Jg=null;const Xg=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Zg,Qg;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Zg||(Zg={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Qg||(Qg={}));const tv="0123456789abcdef";class ev{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Wg[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Yg>Wg[r]||console.log.apply(console,e)}debug(...t){this._log(ev.levels.DEBUG,t)}info(...t){this._log(ev.levels.INFO,t)}warn(...t){this._log(ev.levels.WARNING,t)}makeError(t,e,r){if(Vg)return this.makeError("censored error",e,{});e||(e=ev.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=tv[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case Qg.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Qg.CALL_EXCEPTION:case Qg.INSUFFICIENT_FUNDS:case Qg.MISSING_NEW:case Qg.NONCE_EXPIRED:case Qg.REPLACEMENT_UNDERPRICED:case Qg.TRANSACTION_REPLACED:case Qg.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,ev.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),Xg&&this.throwError("platform missing String.prototype.normalize",ev.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Xg})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,ev.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,ev.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,ev.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",ev.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",ev.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",ev.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Jg||(Jg=new ev("logger/5.7.0")),Jg}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",ev.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),$g){if(!t)return;this.globalLogger().throwError("error censorship permanent",ev.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Vg=!!t,$g=!!e}static setLogLevel(t){const e=Wg[t.toLowerCase()];null!=e?Yg=e:ev.globalLogger().warn("invalid log level - "+t)}static from(t){return new ev(t)}}ev.errors=Qg,ev.levels=Zg;const rv=new ev("bytes/5.7.0");function nv(t){return!!t.toHexString}function iv(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return iv(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function ov(t){return hv(t)&&!(t.length%2)||av(t)}function sv(t){return"number"==typeof t&&t==t&&t%1==0}function av(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!sv(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function uv(t,e){if(e||(e={}),"number"==typeof t){rv.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),iv(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),nv(t)&&(t=t.toHexString()),hv(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":rv.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t>4]+cv[15&n]}return e}return rv.throwArgumentError("invalid hexlify value","value",t)}function dv(t){if("string"!=typeof t)t=fv(t);else if(!hv(t)||t.length%2)return null;return(t.length-2)/2}function pv(t,e,r){return"string"!=typeof t?t=fv(t):(!hv(t)||t.length%2)&&rv.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function mv(t){let e="0x";return t.forEach((t=>{e+=fv(t).substring(2)})),e}function gv(t,e){for("string"!=typeof t?t=fv(t):hv(t)||rv.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&rv.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function vv(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(ov(t)){let r=uv(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=fv(r.slice(0,32)),e.s=fv(r.slice(32,64))):65===r.length?(e.r=fv(r.slice(0,32)),e.s=fv(r.slice(32,64)),e.v=r[64]):rv.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:rv.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=fv(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=uv(t)).length>e&&rv.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),iv(r)}(uv(e._vs),32);e._vs=fv(r);const n=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=n:e.recoveryParam!==n&&rv.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const i=fv(r);null==e.s?e.s=i:e.s!==i&&rv.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?rv.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&rv.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&hv(e.r)?e.r=gv(e.r,32):rv.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&hv(e.s)?e.s=gv(e.s,32):rv.throwArgumentError("signature missing or invalid s","signature",t);const r=uv(e.s);r[0]>=128&&rv.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=fv(r);e._vs&&(hv(e._vs)||rv.throwArgumentError("signature invalid _vs","signature",t),e._vs=gv(e._vs,32)),null==e._vs?e._vs=n:e._vs!==n&&rv.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}var yv=r(4336),bv=r.n(yv),wv=bv().BN;const Ev=new ev("bignumber/5.7.0"),Mv={};let Av=!1;class _v{constructor(t,e){t!==Mv&&Ev.throwError("cannot call constructor directly; use BigNumber.from",ev.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Sv(Tv(this).fromTwos(t))}toTwos(t){return Sv(Tv(this).toTwos(t))}abs(){return"-"===this._hex[0]?_v.from(this._hex.substring(1)):this}add(t){return Sv(Tv(this).add(Tv(t)))}sub(t){return Sv(Tv(this).sub(Tv(t)))}div(t){return _v.from(t).isZero()&&kv("division-by-zero","div"),Sv(Tv(this).div(Tv(t)))}mul(t){return Sv(Tv(this).mul(Tv(t)))}mod(t){const e=Tv(t);return e.isNeg()&&kv("division-by-zero","mod"),Sv(Tv(this).umod(e))}pow(t){const e=Tv(t);return e.isNeg()&&kv("negative-power","pow"),Sv(Tv(this).pow(e))}and(t){const e=Tv(t);return(this.isNegative()||e.isNeg())&&kv("unbound-bitwise-result","and"),Sv(Tv(this).and(e))}or(t){const e=Tv(t);return(this.isNegative()||e.isNeg())&&kv("unbound-bitwise-result","or"),Sv(Tv(this).or(e))}xor(t){const e=Tv(t);return(this.isNegative()||e.isNeg())&&kv("unbound-bitwise-result","xor"),Sv(Tv(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&kv("negative-width","mask"),Sv(Tv(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&kv("negative-width","shl"),Sv(Tv(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&kv("negative-width","shr"),Sv(Tv(this).shrn(t))}eq(t){return Tv(this).eq(Tv(t))}lt(t){return Tv(this).lt(Tv(t))}lte(t){return Tv(this).lte(Tv(t))}gt(t){return Tv(this).gt(Tv(t))}gte(t){return Tv(this).gte(Tv(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Tv(this).isZero()}toNumber(){try{return Tv(this).toNumber()}catch(t){kv("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Ev.throwError("this platform does not support BigInt",ev.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Av||(Av=!0,Ev.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ev.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ev.errors.UNEXPECTED_ARGUMENT,{}):Ev.throwError("BigNumber.toString does not accept parameters",ev.errors.UNEXPECTED_ARGUMENT,{})),Tv(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof _v)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new _v(Mv,Nv(t)):t.match(/^-?[0-9]+$/)?new _v(Mv,Nv(new wv(t))):Ev.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&kv("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&kv("overflow","BigNumber.from",t),_v.from(String(t));const e=t;if("bigint"==typeof e)return _v.from(e.toString());if(av(e))return _v.from(fv(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return _v.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(hv(t)||"-"===t[0]&&hv(t.substring(1))))return _v.from(t)}return Ev.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Nv(t){if("string"!=typeof t)return Nv(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Ev.throwArgumentError("invalid hex","value",t),"0x00"===(t=Nv(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Sv(t){return _v.from(Nv(t))}function Tv(t){const e=_v.from(t).toHexString();return"-"===e[0]?new wv("-"+e.substring(3),16):new wv(e.substring(2),16)}function kv(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),Ev.throwError(t,ev.errors.NUMERIC_FAULT,n)}function Rv(t){return"0x"+Gn().keccak_256(uv(t))}const xv=new ev("address/5.7.0");function Ov(t){hv(t,20)||xv.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=uv(Rv(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Iv={};for(let t=0;t<10;t++)Iv[String(t)]=String(t);for(let t=0;t<26;t++)Iv[String.fromCharCode(65+t)]=String(10+t);const Cv=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Pv(t){let e=null;if("string"!=typeof t&&xv.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Ov(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&xv.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Iv[t])).join("");for(;e.length>=Cv;){let t=e.substring(0,Cv);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&xv.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new wv(r,36).toString(16);e.length<40;)e="0"+e;e=Ov("0x"+e)}else xv.throwArgumentError("invalid address","address",t);var r;return e}const Lv=_v.from(0),Uv=new ev("properties/5.7.0");function Bv(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}const Dv=new ev("rlp/5.7.0");function Fv(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function Gv(t,e,r){let n=0;for(let i=0;ie+1+n&&Dv.throwError("child data too short",ev.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function Kv(t,e){if(0===t.length&&Dv.throwError("data too short",ev.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&Dv.throwError("data short segment too short",ev.errors.BUFFER_OVERRUN,{});const n=Gv(t,e+1,r);return e+1+r+n>t.length&&Dv.throwError("data long segment too short",ev.errors.BUFFER_OVERRUN,{}),zv(t,e,e+1+r,r+n)}if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&Dv.throwError("data array too short",ev.errors.BUFFER_OVERRUN,{}),zv(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&Dv.throwError("data array too short",ev.errors.BUFFER_OVERRUN,{});const n=Gv(t,e+1,r);return e+1+r+n>t.length&&Dv.throwError("data array too short",ev.errors.BUFFER_OVERRUN,{}),{consumed:1+r+n,result:fv(t.slice(e+1+r,e+1+r+n))}}if(t[e]>=128){const r=t[e]-128;return e+1+r>t.length&&Dv.throwError("data too short",ev.errors.BUFFER_OVERRUN,{}),{consumed:1+r,result:fv(t.slice(e+1,e+1+r))}}return{consumed:1,result:fv(t[e])}}function Hv(t){const e=uv(t),r=Kv(e,0);return r.consumed!==e.length&&Dv.throwArgumentError("invalid rlp data","data",t),r.result}function $v(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},t(r,r.exports),r.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self&&self;var Vv=Wv;function Wv(t,e){if(!t)throw new Error(e||"Assertion failed")}Wv.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Yv=$v((function(t,e){var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}})),Jv=$v((function(t,e){var r=e;r.assert=Vv,r.toArray=Yv.toArray,r.zero2=Yv.zero2,r.toHex=Yv.toHex,r.encode=Yv.encode,r.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,l=e.andln(3)+o&3;3===u&&(u=-1),3===l&&(l=-1),s=0==(1&u)?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==l?u:-u,r[0].push(s),a=0==(1&l)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==u?l:-l,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new(bv())(t,"hex","le")}})),Xv=Jv.getNAF,Zv=Jv.getJSF,Qv=Jv.assert;function ty(t,e){this.type=t,this.p=new(bv())(e.p,16),this.red=e.prime?bv().red(e.prime):bv().mont(this.p),this.zero=new(bv())(0).toRed(this.red),this.one=new(bv())(1).toRed(this.red),this.two=new(bv())(2).toRed(this.red),this.n=e.n&&new(bv())(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var ey=ty;function ry(t,e){this.curve=t,this.type=e,this.precomputed=null}ty.prototype.point=function(){throw new Error("Not implemented")},ty.prototype.validate=function(){throw new Error("Not implemented")},ty.prototype._fixedNafMul=function(t,e){Qv(t.precomputed);var r=t._getDoubles(),n=Xv(e,1,this._bitLength),i=(1<=o;u--)s=(s<<1)+n[u];a.push(s)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),c=i;c>0;c--){for(o=0;o=0;a--){for(var u=0;a>=0&&0===o[a];a--)u++;if(a>=0&&u++,s=s.dblp(u),a<0)break;var l=o[a];Qv(0!==l),s="affine"===t.type?l>0?s.mixedAdd(i[l-1>>1]):s.mixedAdd(i[-l-1>>1].neg()):l>0?s.add(i[l-1>>1]):s.add(i[-l-1>>1].neg())}return"affine"===t.type?s.toP():s},ty.prototype._wnafMulAdd=function(t,e,r,n,i){var o,s,a,u=this._wnafT1,l=this._wnafT2,h=this._wnafT3,c=0;for(o=0;o=1;o-=2){var d=o-1,p=o;if(1===u[d]&&1===u[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=Zv(r[d],r[p]);for(c=Math.max(v[0].length,c),h[d]=new Array(c),h[p]=new Array(c),s=0;s=0;o--){for(var M=0;o>=0;){var A=!0;for(s=0;s=0&&M++,w=w.dblp(M),o<0)break;for(s=0;s0?a=l[s][_-1>>1]:_<0&&(a=l[s][-_-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},ry.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=e,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},oy.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),l=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(l).neg()}},oy.prototype.pointFromX=function(t,e){(t=new(bv())(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},oy.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},oy.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},ay.prototype.isInfinity=function(){return this.inf},ay.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},ay.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},ay.prototype.getX=function(){return this.x.fromRed()},ay.prototype.getY=function(){return this.y.fromRed()},ay.prototype.mul=function(t){return t=new(bv())(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},ay.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},ay.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},ay.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},ay.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},ay.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},ny(uy,ey.BasePoint),oy.prototype.jpoint=function(t,e,r){return new uy(this,t,e,r)},uy.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},uy.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},uy.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),h=l.redMul(a),c=n.redMul(l),f=u.redSqr().redIAdd(h).redISub(c).redISub(c),d=u.redMul(c.redISub(f)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(f,d,p)},uy.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),h=r.redMul(u),c=a.redSqr().redIAdd(l).redISub(h).redISub(h),f=a.redMul(h.redISub(c)).redISub(i.redMul(l)),d=this.z.redMul(s);return this.curve.jpoint(c,f,d)},uy.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},uy.prototype.inspect=function(){return this.isInfinity()?"":""},uy.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var ly=$v((function(t,e){var r=e;r.base=ey,r.short=sy,r.mont=null,r.edwards=null})),hy=$v((function(t,e){var r,n=e,i=Jv.assert;function o(t){"short"===t.type?this.curve=new ly.short(t):"edwards"===t.type?this.curve=new ly.edwards(t):this.curve=new ly.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:zh().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:zh().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:zh().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:zh().sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:zh().sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zh().sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zh().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){r=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:zh().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function cy(t){if(!(this instanceof cy))return new cy(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Yv.toArray(t.entropy,t.entropyEnc||"hex"),r=Yv.toArray(t.nonce,t.nonceEnc||"hex"),n=Yv.toArray(t.pers,t.persEnc||"hex");Vv(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var fy=cy;cy.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},cy.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=Yv.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var gy=Jv.assert;function vy(t,e){if(t instanceof vy)return t;this._importDER(t,e)||(gy(t.r&&t.s,"Signature without r or s"),this.r=new(bv())(t.r,16),this.s=new(bv())(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var yy=vy;function by(){this.place=0}function wy(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return!(i<=127)&&(e.place=s,i)}function Ey(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}vy.prototype._importDER=function(t,e){t=Jv.toArray(t,e);var r=new by;if(48!==t[r.place++])return!1;var n=wy(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var i=wy(t,r);if(!1===i)return!1;var o=t.slice(r.place,i+r.place);if(r.place+=i,2!==t[r.place++])return!1;var s=wy(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new(bv())(o),this.s=new(bv())(a),this.recoveryParam=null,!0},vy.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=Ey(e),r=Ey(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];My(n,e.length),(n=n.concat(e)).push(2),My(n,r.length);var i=n.concat(r),o=[48];return My(o,i.length),o=o.concat(i),Jv.encode(o,t)};var Ay=function(){throw new Error("unsupported")},_y=Jv.assert;function Ny(t){if(!(this instanceof Ny))return new Ny(t);"string"==typeof t&&(_y(Object.prototype.hasOwnProperty.call(hy,t),"Unknown curve "+t),t=hy[t]),t instanceof hy.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Sy=Ny;Ny.prototype.keyPair=function(t){return new my(this,t)},Ny.prototype.keyFromPrivate=function(t,e){return my.fromPrivate(this,t,e)},Ny.prototype.keyFromPublic=function(t,e){return my.fromPublic(this,t,e)},Ny.prototype.genKeyPair=function(t){t||(t={});for(var e=new fy({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||Ay(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new(bv())(2));;){var i=new(bv())(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Ny.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Ny.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new(bv())(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),s=t.toArray("be",i),a=new fy({hash:this.hash,entropy:o,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new(bv())(1)),l=0;;l++){var h=n.k?n.k(l):new(bv())(a.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(u)>=0)){var c=this.g.mul(h);if(!c.isInfinity()){var f=c.getX(),d=f.umod(this.n);if(0!==d.cmpn(0)){var p=h.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(c.getY().isOdd()?1:0)|(0!==f.cmp(d)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new yy({r:d,s:p,recoveryParam:m})}}}}}},Ny.prototype.verify=function(t,e,r,n){t=this._truncateToN(new(bv())(t,16)),r=this.keyFromPublic(r,n);var i=(e=new yy(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,a=o.invm(this.n),u=a.mul(t).umod(this.n),l=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},Ny.prototype.recoverPubKey=function(t,e,r,n){_y((3&r)===r,"The recovery param is more than two bits"),e=new yy(e,n);var i=this.n,o=new(bv())(t),s=e.r,a=e.s,u=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var h=e.r.invm(i),c=i.sub(o).mul(h).umod(i),f=a.mul(h).umod(i);return this.g.mulAdd(c,s,f)},Ny.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new yy(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Ty=$v((function(t,e){var r=e;r.version="6.5.4",r.utils=Jv,r.rand=function(){throw new Error("unsupported")},r.curve=ly,r.curves=hy,r.ec=Sy,r.eddsa=null})).ec;const ky=new ev("signing-key/5.7.0");let Ry=null;function xy(){return Ry||(Ry=new Ty("secp256k1")),Ry}class Oy{constructor(t){Bv(this,"curve","secp256k1"),Bv(this,"privateKey",fv(t)),32!==dv(this.privateKey)&&ky.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=xy().keyFromPrivate(uv(this.privateKey));Bv(this,"publicKey","0x"+e.getPublic(!1,"hex")),Bv(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Bv(this,"_isSigningKey",!0)}_addPoint(t){const e=xy().keyFromPublic(uv(this.publicKey)),r=xy().keyFromPublic(uv(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=xy().keyFromPrivate(uv(this.privateKey)),r=uv(t);32!==r.length&&ky.throwArgumentError("bad digest length","digest",t);const n=e.sign(r,{canonical:!0});return vv({recoveryParam:n.recoveryParam,r:gv("0x"+n.r.toString(16),32),s:gv("0x"+n.s.toString(16),32)})}computeSharedSecret(t){const e=xy().keyFromPrivate(uv(this.privateKey)),r=xy().keyFromPublic(uv(Iy(t)));return gv("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function Iy(t,e){const r=uv(t);if(32===r.length){const t=new Oy(r);return e?"0x"+xy().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?fv(r):"0x"+xy().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+xy().keyFromPublic(r).getPublic(!0,"hex"):fv(r):ky.throwArgumentError("invalid public or private key","key","[REDACTED]")}const Cy=new ev("transactions/5.5.0");var Py;function Ly(t){return"0x"===t?null:Pv(t)}function Uy(t){return"0x"===t?Lv:_v.from(t)}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(Py||(Py={}));const By=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],Dy={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function Fy(t){return Pv(pv(Rv(pv(Iy(t),1)),12))}function Gy(t,e){return Fy(function(t,e){const r=vv(e),n={r:uv(r.r),s:uv(r.s)};return"0x"+xy().recoverPubKey(uv(t),n,r.recoveryParam).encode("hex",!1)}(uv(t),e))}function jy(t,e){const r=lv(_v.from(t).toHexString());return r.length>32&&Cy.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function qy(t,e){return{address:Pv(t),storageKeys:(e||[]).map(((e,r)=>(32!==dv(e)&&Cy.throwArgumentError("invalid access list storageKey",`accessList[${t}:${r}]`,e),e.toLowerCase())))}}function zy(t){if(Array.isArray(t))return t.map(((t,e)=>Array.isArray(t)?(t.length>2&&Cy.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),qy(t[0],t[1])):qy(t.address,t.storageKeys)));const e=Object.keys(t).map((e=>{const r=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return qy(e,Object.keys(r).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function Ky(t){return zy(t).map((t=>[t.address,t.storageKeys]))}function Hy(t,e){if(null!=t.gasPrice){const e=_v.from(t.gasPrice),r=_v.from(t.maxFeePerGas||0);e.eq(r)||Cy.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:r})}const r=[jy(t.chainId||0,"chainId"),jy(t.nonce||0,"nonce"),jy(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),jy(t.maxFeePerGas||0,"maxFeePerGas"),jy(t.gasLimit||0,"gasLimit"),null!=t.to?Pv(t.to):"0x",jy(t.value||0,"value"),t.data||"0x",Ky(t.accessList||[])];if(e){const t=vv(e);r.push(jy(t.recoveryParam,"recoveryParam")),r.push(lv(t.r)),r.push(lv(t.s))}return mv(["0x02",qv(r)])}function $y(t,e){const r=[jy(t.chainId||0,"chainId"),jy(t.nonce||0,"nonce"),jy(t.gasPrice||0,"gasPrice"),jy(t.gasLimit||0,"gasLimit"),null!=t.to?Pv(t.to):"0x",jy(t.value||0,"value"),t.data||"0x",Ky(t.accessList||[])];if(e){const t=vv(e);r.push(jy(t.recoveryParam,"recoveryParam")),r.push(lv(t.r)),r.push(lv(t.s))}return mv(["0x01",qv(r)])}function Vy(t,e){if(null==t.type||0===t.type)return null!=t.accessList&&Cy.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",t),function(t,e){var r,n;n=Dy,(r=t)&&"object"==typeof r||Uv.throwArgumentError("invalid object","object",r),Object.keys(r).forEach((t=>{n[t]||Uv.throwArgumentError("invalid object key - "+t,"transaction:"+t,r)}));const i=[];By.forEach((function(e){let r=t[e.name]||[];const n={};e.numeric&&(n.hexPad="left"),r=uv(fv(r,n)),e.length&&r.length!==e.length&&r.length>0&&Cy.throwArgumentError("invalid length for "+e.name,"transaction:"+e.name,r),e.maxLength&&(r=lv(r),r.length>e.maxLength&&Cy.throwArgumentError("invalid length for "+e.name,"transaction:"+e.name,r)),i.push(fv(r))}));let o=0;if(null!=t.chainId?(o=t.chainId,"number"!=typeof o&&Cy.throwArgumentError("invalid transaction.chainId","transaction",t)):e&&!ov(e)&&e.v>28&&(o=Math.floor((e.v-35)/2)),0!==o&&(i.push(fv(o)),i.push("0x"),i.push("0x")),!e)return qv(i);const s=vv(e);let a=27+s.recoveryParam;return 0!==o?(i.pop(),i.pop(),i.pop(),a+=2*o+8,s.v>28&&s.v!==a&&Cy.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e)):s.v!==a&&Cy.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e),i.push(fv(a)),i.push(lv(uv(s.r))),i.push(lv(uv(s.s))),qv(i)}(t,e);switch(t.type){case 1:return $y(t,e);case 2:return Hy(t,e)}return Cy.throwError(`unsupported transaction type: ${t.type}`,ev.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:t.type})}function Wy(t,e,r){try{const r=Uy(e[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");t.v=r}catch(t){Cy.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=gv(e[1],32),t.s=gv(e[2],32);try{const e=Rv(r(t));t.from=Gy(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){console.log(t)}}function Yy(t){const e=uv(t);if(e[0]>127)return function(t){const e=Hv(t);9!==e.length&&6!==e.length&&Cy.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:Uy(e[0]).toNumber(),gasPrice:Uy(e[1]),gasLimit:Uy(e[2]),to:Ly(e[3]),value:Uy(e[4]),data:e[5],chainId:0};if(6===e.length)return r;try{r.v=_v.from(e[6]).toNumber()}catch(t){return console.log(t),r}if(r.r=gv(e[7],32),r.s=gv(e[8],32),_v.from(r.r).isZero()&&_v.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);0!==r.chainId&&(i.push(fv(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const o=Rv(qv(i));try{r.from=Gy(o,{r:fv(r.r),s:fv(r.s),recoveryParam:n})}catch(t){console.log(t)}r.hash=Rv(t)}return r.type=null,r}(e);switch(e[0]){case 1:return function(t){const e=Hv(t.slice(1));8!==e.length&&11!==e.length&&Cy.throwArgumentError("invalid component count for transaction type: 1","payload",fv(t));const r={type:1,chainId:Uy(e[0]).toNumber(),nonce:Uy(e[1]).toNumber(),gasPrice:Uy(e[2]),gasLimit:Uy(e[3]),to:Ly(e[4]),value:Uy(e[5]),data:e[6],accessList:zy(e[7])};return 8===e.length||(r.hash=Rv(t),Wy(r,e.slice(8),$y)),r}(e);case 2:return function(t){const e=Hv(t.slice(1));9!==e.length&&12!==e.length&&Cy.throwArgumentError("invalid component count for transaction type: 2","payload",fv(t));const r=Uy(e[2]),n=Uy(e[3]),i={type:2,chainId:Uy(e[0]).toNumber(),nonce:Uy(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:Uy(e[4]),to:Ly(e[5]),value:Uy(e[6]),data:e[7],accessList:zy(e[8])};return 9===e.length||(i.hash=Rv(t),Wy(i,e.slice(9),Hy)),i}(e)}return Cy.throwError(`unsupported transaction type: ${e[0]}`,ev.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}var Jy=r(335);const Xy=new y.Yd("units/5.5.0"),Zy=["wei","kwei","mwei","gwei","szabo","finney","ether"];function Qy(t){const e=String(t).split(".");(e.length>2||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||"."===t||"-."===t)&&Xy.throwArgumentError("invalid value","value",t);let r=e[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0");let i="";for(2===e.length&&(i="."+(e[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);const o=[];for(;r.length;){if(r.length<=3){o.unshift(r);break}{const t=r.length-3;o.unshift(r.substring(t)),r=r.substring(0,t)}}return n+o.join(",")+i}function tb(t,e){if("string"==typeof e){const t=Zy.indexOf(e);-1!==t&&(e=3*t)}return(0,Jy.S5)(t,null!=e?e:18)}function eb(t,e){if("string"!=typeof t&&Xy.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=Zy.indexOf(e);-1!==t&&(e=3*t)}return(0,Jy.Ox)(t,null!=e?e:18)}function rb(t){return tb(t,18)}function nb(t){return eb(t,18)}let ib=!1,ob=!1;const sb={debug:1,default:2,info:2,warning:3,error:4,off:5};let ab=sb.default,ub=null;const lb=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var hb,cb;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(hb||(hb={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(cb||(cb={}));const fb="0123456789abcdef";class db{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==sb[r]&&this.throwArgumentError("invalid log level name","logLevel",t),ab>sb[r]||console.log.apply(console,e)}debug(...t){this._log(db.levels.DEBUG,t)}info(...t){this._log(db.levels.INFO,t)}warn(...t){this._log(db.levels.WARNING,t)}makeError(t,e,r){if(ob)return this.makeError("censored error",e,{});e||(e=db.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t>4],r+=fb[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case cb.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case cb.CALL_EXCEPTION:case cb.INSUFFICIENT_FUNDS:case cb.MISSING_NEW:case cb.NONCE_EXPIRED:case cb.REPLACEMENT_UNDERPRICED:case cb.TRANSACTION_REPLACED:case cb.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,db.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),lb&&this.throwError("platform missing String.prototype.normalize",db.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:lb})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,db.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,db.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",te&&this.throwError("too many arguments"+r,db.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",db.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",db.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",db.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return ub||(ub=new db("logger/5.7.0")),ub}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",db.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ib){if(!t)return;this.globalLogger().throwError("error censorship permanent",db.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ob=!!t,ib=!!e}static setLogLevel(t){const e=sb[t.toLowerCase()];null!=e?ab=e:db.globalLogger().warn("invalid log level - "+t)}static from(t){return new db(t)}}db.errors=cb,db.levels=hb;const pb=new db("bytes/5.7.0");function mb(t){return!!t.toHexString}function gb(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return gb(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function vb(t){return"number"==typeof t&&t==t&&t%1==0}function yb(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!vb(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bb(t,e){if(e||(e={}),"number"==typeof t){pb.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),gb(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),mb(t)&&(t=t.toHexString()),wb(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":pb.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t>6==2;n++)t++;return t}return t===Tb.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Sb||(Sb={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Tb||(Tb={}));const Rb=Object.freeze({error:function(t,e,r,n,i){return Nb.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:kb,replace:function(t,e,r,n,i){return t===Tb.OVERLONG?(n.push(i),0):(n.push(65533),kb(t,e,r))}});function xb(t,e=Sb.current){e!=Sb.current&&(Nb.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return bb(r)}function Ob(t,e){return function(t,e){null==e&&(e=Rb.error),t=bb(t);const r=[];let n=0;for(;n>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?Tb.UNEXPECTED_CONTINUE:Tb.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e(Tb.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i1114111?n+=e(Tb.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e(Tb.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e(Tb.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}var Ib=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};function Cb(t,e){return Ib(this,void 0,void 0,(function*(){null==e&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};!0!==e.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client");const n=yield fetch(t,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach(((t,e)=>{o[e.toLowerCase()]=t})):n.headers.keys().forEach((t=>{o[t.toLowerCase()]=n.headers.get(t)})),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:bb(new Uint8Array(i))}}))}var Pb=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Lb=new db("web/5.5.1");function Ub(t){return new Promise((e=>{setTimeout(e,t)}))}function Bb(t,e){if(null==t)return null;if("string"==typeof t)return t;if(function(t){return wb(t)&&!(t.length%2)||yb(t)}(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return Ob(t)}catch(t){}return function(t,e){if(e||(e={}),"number"==typeof t){pb.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Eb[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),mb(t))return t.toHexString();if(wb(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":pb.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(yb(t)){let e="0x";for(let r=0;r>4]+Eb[15&n]}return e}return pb.throwArgumentError("invalid hexlify value","value",t)}(t)}return t}function Db(t,e,r){const n="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;Lb.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const i="object"==typeof t?t.throttleCallback:null,o="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;Lb.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s={};let a=null;const u={method:"GET"};let l=!1,h=12e4;if("string"==typeof t)a=t;else if("object"==typeof t){if(null!=t&&null!=t.url||Lb.throwArgumentError("missing URL","connection.url",t),a=t.url,"number"==typeof t.timeout&&t.timeout>0&&(h=t.timeout),t.headers)for(const e in t.headers)s[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(l=!0);if(u.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==a.substring(0,6)&&!0!==t.allowInsecureAuthentication&&Lb.throwError("basic authentication requires a secure https url",db.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;s.authorization={key:"Authorization",value:"Basic "+Ab(xb(e))}}}const c=new RegExp("^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$","i"),f=a?a.match(c):null;if(f)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":f[1]},body:Mb(f[2])};let e=t.body;return r&&(e=r(t.body,t)),Promise.resolve(e)}catch(t){Lb.throwError("processing response error",db.errors.SERVER_ERROR,{body:Bb(f[1],f[2]),error:t,requestBody:null,requestMethod:"GET",url:a})}e&&(u.method="POST",u.body=e,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(e.length)}));const d={};Object.keys(s).forEach((t=>{const e=s[t];d[e.key]=e.value})),u.headers=d;const p=function(){let t=null;return{promise:new Promise((function(e,r){h&&(t=setTimeout((()=>{null!=t&&(t=null,r(Lb.makeError("timeout",db.errors.TIMEOUT,{requestBody:Bb(u.body,d["content-type"]),requestMethod:u.method,timeout:h,url:a})))}),h))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),m=function(){return Pb(this,void 0,void 0,(function*(){for(let t=0;t=300)&&(p.cancel(),Lb.throwError("bad response",db.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:Bb(s,e.headers?e.headers["content-type"]:null),requestBody:Bb(u.body,d["content-type"]),requestMethod:u.method,url:a})),r)try{const t=yield r(s,e);return p.cancel(),t}catch(r){if(r.throttleRetry&&t"content-type"===t.toLowerCase())).length||(r.headers=_b(r.headers),r.headers["content-type"]="application/json"):r.headers={"content-type":"application/json"},t=r}return Db(t,n,((t,e)=>{let n=null;if(null!=t)try{n=JSON.parse(Ob(t))}catch(e){Lb.throwError("invalid JSON",db.errors.SERVER_ERROR,{body:t,error:e})}return r&&(n=r(n,e)),n}))}function Gb(t,e){return e||(e={}),null==(e=_b(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,n){let i=null,o=!1;const s=()=>!o&&(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout((()=>{s()&&n(new Error("timeout"))}),e.timeout));const a=e.retryLimit;let u=0;!function i(){return t().then((function(t){if(void 0!==t)s()&&r(t);else if(e.oncePoll)e.oncePoll.once("poll",i);else if(e.onceBlock)e.onceBlock.once("block",i);else if(!o){if(u++,u>a)return void(s()&&n(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,u)));te.ceiling&&(t=e.ceiling),setTimeout(i,t)}return null}),(function(t){s()&&n(t)}))}()}))}const jb="ethers/5.5.3",qb=new nd(jb);try{const t=window;null==t._ethers&&(t._ethers=u)}catch(t){}},8020:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(9649).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},5205:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(7801).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},7328:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(6658).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},5336:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(6042).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},9578:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(4801).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},557:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(8067).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},4336:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(991).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function l(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,f=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=f;d++){var p=l-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?m+r:f[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,b=0|s[3],w=8191&b,E=b>>>13,M=0|s[4],A=8191&M,_=M>>>13,N=0|s[5],S=8191&N,T=N>>>13,k=0|s[6],R=8191&k,x=k>>>13,O=0|s[7],I=8191&O,C=O>>>13,P=0|s[8],L=8191&P,U=P>>>13,B=0|s[9],D=8191&B,F=B>>>13,G=0|a[0],j=8191&G,q=G>>>13,z=0|a[1],K=8191&z,H=z>>>13,$=0|a[2],V=8191&$,W=$>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Z=0|a[4],Q=8191&Z,tt=Z>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,lt=at>>>13,ht=0|a[8],ct=8191&ht,ft=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(l+(n=Math.imul(c,j))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(f,j)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,j),i=(i=Math.imul(p,q))+Math.imul(m,j)|0,o=Math.imul(m,q);var vt=(l+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,K)|0))<<13)|0;l=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,j),i=(i=Math.imul(v,q))+Math.imul(y,j)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,H)|0;var yt=(l+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,j),i=(i=Math.imul(w,q))+Math.imul(E,j)|0,o=Math.imul(E,q),n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var bt=(l+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,j),i=(i=Math.imul(A,q))+Math.imul(_,j)|0,o=Math.imul(_,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var wt=(l+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,j),i=(i=Math.imul(S,q))+Math.imul(T,j)|0,o=Math.imul(T,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var Et=(l+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;l=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,j),i=(i=Math.imul(R,q))+Math.imul(x,j)|0,o=Math.imul(x,q),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(l+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;l=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,j),i=(i=Math.imul(I,q))+Math.imul(C,j)|0,o=Math.imul(C,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(l+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(f,ut)|0))<<13)|0;l=((o=o+Math.imul(f,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,q))+Math.imul(U,j)|0,o=Math.imul(U,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,lt)|0;var _t=(l+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;l=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,j),i=(i=Math.imul(D,q))+Math.imul(F,j)|0,o=Math.imul(F,q),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,lt)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Nt=(l+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;l=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,H))+Math.imul(F,K)|0,o=Math.imul(F,H),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,lt)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ft)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,W))+Math.imul(F,V)|0,o=Math.imul(F,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,ft)|0;var Tt=(l+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;l=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,X))+Math.imul(F,J)|0,o=Math.imul(F,X),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var kt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Rt=(l+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(_,pt)|0))<<13)|0;l=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,lt)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,ft)|0;var xt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,lt)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ot=(l+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,lt))+Math.imul(F,ut)|0,o=Math.imul(F,lt),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(U,ct)|0,o=o+Math.imul(U,ft)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;l=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ct),i=(i=Math.imul(D,ft))+Math.imul(F,ct)|0,o=Math.imul(F,ft);var Ct=(l+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(U,pt)|0))<<13)|0;l=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Pt=(l+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(F,pt)|0))<<13)|0;return l=((o=Math.imul(F,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=bt,u[4]=wt,u[5]=Et,u[6]=Mt,u[7]=At,u[8]=_t,u[9]=Nt,u[10]=St,u[11]=Tt,u[12]=kt,u[13]=Rt,u[14]=xt,u[15]=Ot,u[16]=It,u[17]=Ct,u[18]=Pt,0!==l&&(u[19]=l,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?v(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,l=0;l=0&&(0!==h||l>=i);l--){var c=0|this.words[l];this.words[l]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var l=0;l=0;c--){var f=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,h=1;0==(e.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new A;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=e.words[n],h=u-1;h>=0;h--){var c=l>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,S),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},3413:(t,e,r)=>{"use strict";r.r(e),r.d(e,{Accordion:()=>u,Carousel:()=>y,Collapse:()=>d,Dial:()=>ve,Dismiss:()=>A,Drawer:()=>Yt,Dropdown:()=>Bt,Modal:()=>zt,Popover:()=>fe,Tabs:()=>te,Tooltip:()=>se,initAccordions:()=>a,initCarousels:()=>v,initCollapses:()=>f,initDials:()=>ge,initDismisses:()=>M,initDrawers:()=>Wt,initDropdowns:()=>Ut,initFlowbite:()=>ye,initModals:()=>qt,initPopovers:()=>ce,initTabs:()=>Qt,initTooltips:()=>oe});const n=function(){function t(t,e){void 0===e&&(e=[]),this._eventType=t,this._eventFunctions=e}return t.prototype.init=function(){var t=this;this._eventFunctions.forEach((function(e){"undefined"!=typeof window&&window.addEventListener(t._eventType,e)}))},t}();var i=function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r0&&x(n.width)/t.offsetWidth||1,o=t.offsetHeight>0&&x(n.height)/t.offsetHeight||1);var s=(N(t)?_(t):window).visualViewport,a=!I()&&r,u=(n.left+(a&&s?s.offsetLeft:0))/i,l=(n.top+(a&&s?s.offsetTop:0))/o,h=n.width/i,c=n.height/o;return{width:h,height:c,top:l,right:u+h,bottom:l+c,left:u,x:u,y:l}}function P(t){var e=_(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function L(t){return t?(t.nodeName||"").toLowerCase():null}function U(t){return((N(t)?t.ownerDocument:t.document)||window.document).documentElement}function B(t){return C(U(t)).left+P(t).scrollLeft}function D(t){return _(t).getComputedStyle(t)}function F(t){var e=D(t),r=e.overflow,n=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(r+i+n)}function G(t,e,r){void 0===r&&(r=!1);var n,i,o=S(e),s=S(e)&&function(t){var e=t.getBoundingClientRect(),r=x(e.width)/t.offsetWidth||1,n=x(e.height)/t.offsetHeight||1;return 1!==r||1!==n}(e),a=U(e),u=C(t,s,r),l={scrollLeft:0,scrollTop:0},h={x:0,y:0};return(o||!o&&!r)&&(("body"!==L(e)||F(a))&&(l=(n=e)!==_(n)&&S(n)?{scrollLeft:(i=n).scrollLeft,scrollTop:i.scrollTop}:P(n)),S(e)?((h=C(e,!0)).x+=e.clientLeft,h.y+=e.clientTop):a&&(h.x=B(a))),{x:u.left+l.scrollLeft-h.x,y:u.top+l.scrollTop-h.y,width:u.width,height:u.height}}function j(t){var e=C(t),r=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-r)<=1&&(r=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:r,height:n}}function q(t){return"html"===L(t)?t:t.assignedSlot||t.parentNode||(T(t)?t.host:null)||U(t)}function z(t){return["html","body","#document"].indexOf(L(t))>=0?t.ownerDocument.body:S(t)&&F(t)?t:z(q(t))}function K(t,e){var r;void 0===e&&(e=[]);var n=z(t),i=n===(null==(r=t.ownerDocument)?void 0:r.body),o=_(n),s=i?[o].concat(o.visualViewport||[],F(n)?n:[]):n,a=e.concat(s);return i?a:a.concat(K(q(s)))}function H(t){return["table","td","th"].indexOf(L(t))>=0}function $(t){return S(t)&&"fixed"!==D(t).position?t.offsetParent:null}function V(t){for(var e=_(t),r=$(t);r&&H(r)&&"static"===D(r).position;)r=$(r);return r&&("html"===L(r)||"body"===L(r)&&"static"===D(r).position)?e:r||function(t){var e=/firefox/i.test(O());if(/Trident/i.test(O())&&S(t)&&"fixed"===D(t).position)return null;var r=q(t);for(T(r)&&(r=r.host);S(r)&&["html","body"].indexOf(L(r))<0;){var n=D(r);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return r;r=r.parentNode}return null}(t)||e}var W="top",Y="bottom",J="right",X="left",Z="auto",Q=[W,Y,J,X],tt="start",et="end",rt="viewport",nt="popper",it=Q.reduce((function(t,e){return t.concat([e+"-"+tt,e+"-"+et])}),[]),ot=[].concat(Q,[Z]).reduce((function(t,e){return t.concat([e,e+"-"+tt,e+"-"+et])}),[]),st=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function at(t){var e=new Map,r=new Set,n=[];function i(t){r.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!r.has(t)){var n=e.get(t);n&&i(n)}})),n.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){r.has(t.name)||i(t)})),n}var ut={placement:"bottom",modifiers:[],strategy:"absolute"};function lt(){for(var t=arguments.length,e=new Array(t),r=0;r=0?"x":"y"}function mt(t){var e,r=t.reference,n=t.element,i=t.placement,o=i?ft(i):null,s=i?dt(i):null,a=r.x+r.width/2-n.width/2,u=r.y+r.height/2-n.height/2;switch(o){case W:e={x:a,y:r.y-n.height};break;case Y:e={x:a,y:r.y+r.height};break;case J:e={x:r.x+r.width,y:u};break;case X:e={x:r.x-n.width,y:u};break;default:e={x:r.x,y:r.y}}var l=o?pt(o):null;if(null!=l){var h="y"===l?"height":"width";switch(s){case tt:e[l]=e[l]-(r[h]/2-n[h]/2);break;case et:e[l]=e[l]+(r[h]/2-n[h]/2)}}return e}var gt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function vt(t){var e,r=t.popper,n=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,a=t.position,u=t.gpuAcceleration,l=t.adaptive,h=t.roundOffsets,c=t.isFixed,f=s.x,d=void 0===f?0:f,p=s.y,m=void 0===p?0:p,g="function"==typeof h?h({x:d,y:m}):{x:d,y:m};d=g.x,m=g.y;var v=s.hasOwnProperty("x"),y=s.hasOwnProperty("y"),b=X,w=W,E=window;if(l){var M=V(r),A="clientHeight",N="clientWidth";M===_(r)&&"static"!==D(M=U(r)).position&&"absolute"===a&&(A="scrollHeight",N="scrollWidth"),(i===W||(i===X||i===J)&&o===et)&&(w=Y,m-=(c&&M===E&&E.visualViewport?E.visualViewport.height:M[A])-n.height,m*=u?1:-1),i!==X&&(i!==W&&i!==Y||o!==et)||(b=J,d-=(c&&M===E&&E.visualViewport?E.visualViewport.width:M[N])-n.width,d*=u?1:-1)}var S,T=Object.assign({position:a},l&>),k=!0===h?function(t,e){var r=t.x,n=t.y,i=e.devicePixelRatio||1;return{x:x(r*i)/i||0,y:x(n*i)/i||0}}({x:d,y:m},_(r)):{x:d,y:m};return d=k.x,m=k.y,u?Object.assign({},T,((S={})[w]=y?"0":"",S[b]=v?"0":"",S.transform=(E.devicePixelRatio||1)<=1?"translate("+d+"px, "+m+"px)":"translate3d("+d+"px, "+m+"px, 0)",S)):Object.assign({},T,((e={})[w]=y?m+"px":"",e[b]=v?d+"px":"",e.transform="",e))}var yt={left:"right",right:"left",bottom:"top",top:"bottom"};function bt(t){return t.replace(/left|right|bottom|top/g,(function(t){return yt[t]}))}var wt={start:"end",end:"start"};function Et(t){return t.replace(/start|end/g,(function(t){return wt[t]}))}function Mt(t,e){var r=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(r&&T(r)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function At(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function _t(t,e,r){return e===rt?At(function(t,e){var r=_(t),n=U(t),i=r.visualViewport,o=n.clientWidth,s=n.clientHeight,a=0,u=0;if(i){o=i.width,s=i.height;var l=I();(l||!l&&"fixed"===e)&&(a=i.offsetLeft,u=i.offsetTop)}return{width:o,height:s,x:a+B(t),y:u}}(t,r)):N(e)?function(t,e){var r=C(t,!1,"fixed"===e);return r.top=r.top+t.clientTop,r.left=r.left+t.clientLeft,r.bottom=r.top+t.clientHeight,r.right=r.left+t.clientWidth,r.width=t.clientWidth,r.height=t.clientHeight,r.x=r.left,r.y=r.top,r}(e,r):At(function(t){var e,r=U(t),n=P(t),i=null==(e=t.ownerDocument)?void 0:e.body,o=k(r.scrollWidth,r.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=k(r.scrollHeight,r.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-n.scrollLeft+B(t),u=-n.scrollTop;return"rtl"===D(i||r).direction&&(a+=k(r.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:u}}(U(t)))}function Nt(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function St(t,e){return e.reduce((function(e,r){return e[r]=t,e}),{})}function Tt(t,e){void 0===e&&(e={});var r=e,n=r.placement,i=void 0===n?t.placement:n,o=r.strategy,s=void 0===o?t.strategy:o,a=r.boundary,u=void 0===a?"clippingParents":a,l=r.rootBoundary,h=void 0===l?rt:l,c=r.elementContext,f=void 0===c?nt:c,d=r.altBoundary,p=void 0!==d&&d,m=r.padding,g=void 0===m?0:m,v=Nt("number"!=typeof g?g:St(g,Q)),y=f===nt?"reference":nt,b=t.rects.popper,w=t.elements[p?y:f],E=function(t,e,r,n){var i="clippingParents"===e?function(t){var e=K(q(t)),r=["absolute","fixed"].indexOf(D(t).position)>=0&&S(t)?V(t):t;return N(r)?e.filter((function(t){return N(t)&&Mt(t,r)&&"body"!==L(t)})):[]}(t):[].concat(e),o=[].concat(i,[r]),s=o[0],a=o.reduce((function(e,r){var i=_t(t,r,n);return e.top=k(i.top,e.top),e.right=R(i.right,e.right),e.bottom=R(i.bottom,e.bottom),e.left=k(i.left,e.left),e}),_t(t,s,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(N(w)?w:w.contextElement||U(t.elements.popper),u,h,s),M=C(t.elements.reference),A=mt({reference:M,element:b,strategy:"absolute",placement:i}),_=At(Object.assign({},b,A)),T=f===nt?_:M,x={top:E.top-T.top+v.top,bottom:T.bottom-E.bottom+v.bottom,left:E.left-T.left+v.left,right:T.right-E.right+v.right},O=t.modifiersData.offset;if(f===nt&&O){var I=O[i];Object.keys(x).forEach((function(t){var e=[J,Y].indexOf(t)>=0?1:-1,r=[W,Y].indexOf(t)>=0?"y":"x";x[t]+=I[r]*e}))}return x}function kt(t,e,r){return k(t,R(e,r))}function Rt(t,e,r){return void 0===r&&(r={x:0,y:0}),{top:t.top-e.height-r.y,right:t.right-e.width+r.x,bottom:t.bottom-e.height+r.y,left:t.left-e.width-r.x}}function xt(t){return[W,J,Y,X].some((function(e){return t[e]>=0}))}var Ot=ht({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,r=t.instance,n=t.options,i=n.scroll,o=void 0===i||i,s=n.resize,a=void 0===s||s,u=_(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&l.forEach((function(t){t.addEventListener("scroll",r.update,ct)})),a&&u.addEventListener("resize",r.update,ct),function(){o&&l.forEach((function(t){t.removeEventListener("scroll",r.update,ct)})),a&&u.removeEventListener("resize",r.update,ct)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,r=t.name;e.modifiersData[r]=mt({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,r=t.options,n=r.gpuAcceleration,i=void 0===n||n,o=r.adaptive,s=void 0===o||o,a=r.roundOffsets,u=void 0===a||a,l={placement:ft(e.placement),variation:dt(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,vt(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:u})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,vt(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var r=e.styles[t]||{},n=e.attributes[t]||{},i=e.elements[t];S(i)&&L(i)&&(Object.assign(i.style,r),Object.keys(n).forEach((function(t){var e=n[t];!1===e?i.removeAttribute(t):i.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,r={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,r.popper),e.styles=r,e.elements.arrow&&Object.assign(e.elements.arrow.style,r.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],i=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:r[t]).reduce((function(t,e){return t[e]="",t}),{});S(n)&&L(n)&&(Object.assign(n.style,o),Object.keys(i).forEach((function(t){n.removeAttribute(t)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,r=t.options,n=t.name,i=r.offset,o=void 0===i?[0,0]:i,s=ot.reduce((function(t,r){return t[r]=function(t,e,r){var n=ft(t),i=[X,W].indexOf(n)>=0?-1:1,o="function"==typeof r?r(Object.assign({},e,{placement:t})):r,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[X,J].indexOf(n)>=0?{x:a,y:s}:{x:s,y:a}}(r,e.rects,o),t}),{}),a=s[e.placement],u=a.x,l=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=u,e.modifiersData.popperOffsets.y+=l),e.modifiersData[n]=s}},{name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,r=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var i=r.mainAxis,o=void 0===i||i,s=r.altAxis,a=void 0===s||s,u=r.fallbackPlacements,l=r.padding,h=r.boundary,c=r.rootBoundary,f=r.altBoundary,d=r.flipVariations,p=void 0===d||d,m=r.allowedAutoPlacements,g=e.options.placement,v=ft(g),y=u||(v!==g&&p?function(t){if(ft(t)===Z)return[];var e=bt(t);return[Et(t),e,Et(e)]}(g):[bt(g)]),b=[g].concat(y).reduce((function(t,r){return t.concat(ft(r)===Z?function(t,e){void 0===e&&(e={});var r=e,n=r.placement,i=r.boundary,o=r.rootBoundary,s=r.padding,a=r.flipVariations,u=r.allowedAutoPlacements,l=void 0===u?ot:u,h=dt(n),c=h?a?it:it.filter((function(t){return dt(t)===h})):Q,f=c.filter((function(t){return l.indexOf(t)>=0}));0===f.length&&(f=c);var d=f.reduce((function(e,r){return e[r]=Tt(t,{placement:r,boundary:i,rootBoundary:o,padding:s})[ft(r)],e}),{});return Object.keys(d).sort((function(t,e){return d[t]-d[e]}))}(e,{placement:r,boundary:h,rootBoundary:c,padding:l,flipVariations:p,allowedAutoPlacements:m}):r)}),[]),w=e.rects.reference,E=e.rects.popper,M=new Map,A=!0,_=b[0],N=0;N=0,x=R?"width":"height",O=Tt(e,{placement:S,boundary:h,rootBoundary:c,altBoundary:f,padding:l}),I=R?k?J:X:k?Y:W;w[x]>E[x]&&(I=bt(I));var C=bt(I),P=[];if(o&&P.push(O[T]<=0),a&&P.push(O[I]<=0,O[C]<=0),P.every((function(t){return t}))){_=S,A=!1;break}M.set(S,P)}if(A)for(var L=function(t){var e=b.find((function(e){var r=M.get(e);if(r)return r.slice(0,t).every((function(t){return t}))}));if(e)return _=e,"break"},U=p?3:1;U>0&&"break"!==L(U);U--);e.placement!==_&&(e.modifiersData[n]._skip=!0,e.placement=_,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,r=t.options,n=t.name,i=r.mainAxis,o=void 0===i||i,s=r.altAxis,a=void 0!==s&&s,u=r.boundary,l=r.rootBoundary,h=r.altBoundary,c=r.padding,f=r.tether,d=void 0===f||f,p=r.tetherOffset,m=void 0===p?0:p,g=Tt(e,{boundary:u,rootBoundary:l,padding:c,altBoundary:h}),v=ft(e.placement),y=dt(e.placement),b=!y,w=pt(v),E="x"===w?"y":"x",M=e.modifiersData.popperOffsets,A=e.rects.reference,_=e.rects.popper,N="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,S="number"==typeof N?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),T=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,x={x:0,y:0};if(M){if(o){var O,I="y"===w?W:X,C="y"===w?Y:J,P="y"===w?"height":"width",L=M[w],U=L+g[I],B=L-g[C],D=d?-_[P]/2:0,F=y===tt?A[P]:_[P],G=y===tt?-_[P]:-A[P],q=e.elements.arrow,z=d&&q?j(q):{width:0,height:0},K=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},H=K[I],$=K[C],Z=kt(0,A[P],z[P]),Q=b?A[P]/2-D-Z-H-S.mainAxis:F-Z-H-S.mainAxis,et=b?-A[P]/2+D+Z+$+S.mainAxis:G+Z+$+S.mainAxis,rt=e.elements.arrow&&V(e.elements.arrow),nt=rt?"y"===w?rt.clientTop||0:rt.clientLeft||0:0,it=null!=(O=null==T?void 0:T[w])?O:0,ot=L+et-it,st=kt(d?R(U,L+Q-it-nt):U,L,d?k(B,ot):B);M[w]=st,x[w]=st-L}if(a){var at,ut="x"===w?W:X,lt="x"===w?Y:J,ht=M[E],ct="y"===E?"height":"width",mt=ht+g[ut],gt=ht-g[lt],vt=-1!==[W,X].indexOf(v),yt=null!=(at=null==T?void 0:T[E])?at:0,bt=vt?mt:ht-A[ct]-_[ct]-yt+S.altAxis,wt=vt?ht+A[ct]+_[ct]-yt-S.altAxis:gt,Et=d&&vt?function(t,e,r){var n=kt(t,e,r);return n>r?r:n}(bt,ht,wt):kt(d?bt:mt,ht,d?wt:gt);M[E]=Et,x[E]=Et-ht}e.modifiersData[n]=x}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,r=t.state,n=t.name,i=t.options,o=r.elements.arrow,s=r.modifiersData.popperOffsets,a=ft(r.placement),u=pt(a),l=[X,J].indexOf(a)>=0?"height":"width";if(o&&s){var h=function(t,e){return Nt("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:St(t,Q))}(i.padding,r),c=j(o),f="y"===u?W:X,d="y"===u?Y:J,p=r.rects.reference[l]+r.rects.reference[u]-s[u]-r.rects.popper[l],m=s[u]-r.rects.reference[u],g=V(o),v=g?"y"===u?g.clientHeight||0:g.clientWidth||0:0,y=p/2-m/2,b=h[f],w=v-c[l]-h[d],E=v/2-c[l]/2+y,M=kt(b,E,w),A=u;r.modifiersData[n]=((e={})[A]=M,e.centerOffset=M-E,e)}},effect:function(t){var e=t.state,r=t.options.element,n=void 0===r?"[data-popper-arrow]":r;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&Mt(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,r=t.name,n=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=Tt(e,{elementContext:"reference"}),a=Tt(e,{altBoundary:!0}),u=Rt(s,n),l=Rt(a,i,o),h=xt(u),c=xt(l);e.modifiersData[r]={referenceClippingOffsets:u,popperEscapeOffsets:l,isReferenceHidden:h,hasPopperEscaped:c},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":c})}}]}),It=function(){return It=Object.assign||function(t){for(var e,r=1,n=arguments.length;r{var n=e;n.utils=r(6436),n.common=r(5772),n.sha=r(9041),n.ripemd=r(2949),n.hmac=r(2344),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},5772:(t,e,r)=>{"use strict";var n=r(6436),i=r(9746);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=o,o.prototype.update=function(t,e){if(t=n.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o{"use strict";var n=r(6436),i=r(9746);function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(e,r))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e{"use strict";var n=r(6436),i=r(5772),o=n.rotl32,s=n.sum32,a=n.sum32_3,u=n.sum32_4,l=i.BlockHash;function h(){if(!(this instanceof h))return new h;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function c(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function f(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function d(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}n.inherits(h,l),e.ripemd160=h,h.blockSize=512,h.outSize=160,h.hmacStrength=192,h.padLength=64,h.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],l=this.h[3],h=this.h[4],y=r,b=n,w=i,E=l,M=h,A=0;A<80;A++){var _=s(o(u(r,c(A,n,i,l),t[p[A]+e],f(A)),g[A]),h);r=h,h=l,l=o(i,10),i=n,n=_,_=s(o(u(y,c(79-A,b,w,E),t[m[A]+e],d(A)),v[A]),M),y=M,M=E,E=o(w,10),w=b,b=_}_=a(this.h[1],i,E),this.h[1]=a(this.h[2],l,M),this.h[2]=a(this.h[3],h,y),this.h[3]=a(this.h[4],r,b),this.h[4]=a(this.h[0],n,w),this.h[0]=_},h.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],m=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],v=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},9041:(t,e,r)=>{"use strict";e.sha1=r(4761),e.sha224=r(799),e.sha256=r(9344),e.sha384=r(772),e.sha512=r(5900)},4761:(t,e,r)=>{"use strict";var n=r(6436),i=r(5772),o=r(7038),s=n.rotl32,a=n.sum32,u=n.sum32_5,l=o.ft_1,h=i.BlockHash,c=[1518500249,1859775393,2400959708,3395469782];function f(){if(!(this instanceof f))return new f;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(f,h),t.exports=f,f.blockSize=512,f.outSize=160,f.hmacStrength=80,f.padLength=64,f.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n{"use strict";var n=r(6436),i=r(9344);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},9344:(t,e,r)=>{"use strict";var n=r(6436),i=r(5772),o=r(7038),s=r(9746),a=n.sum32,u=n.sum32_4,l=n.sum32_5,h=o.ch32,c=o.maj32,f=o.s0_256,d=o.s1_256,p=o.g0_256,m=o.g1_256,g=i.BlockHash,v=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function y(){if(!(this instanceof y))return new y;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=v,this.W=new Array(64)}n.inherits(y,g),t.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n{"use strict";var n=r(6436),i=r(5900);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},5900:(t,e,r)=>{"use strict";var n=r(6436),i=r(5772),o=r(9746),s=n.rotr64_hi,a=n.rotr64_lo,u=n.shr64_hi,l=n.shr64_lo,h=n.sum64,c=n.sum64_hi,f=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,m=n.sum64_5_hi,g=n.sum64_5_lo,v=i.BlockHash,y=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function b(){if(!(this instanceof b))return new b;v.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function w(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function E(t,e,r,n,i,o){var s=e&n^~e&o;return s<0&&(s+=4294967296),s}function M(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function A(t,e,r,n,i,o){var s=e&n^e&o^n&o;return s<0&&(s+=4294967296),s}function _(t,e){var r=s(t,e,28)^s(e,t,2)^s(e,t,7);return r<0&&(r+=4294967296),r}function N(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function S(t,e){var r=a(t,e,14)^a(t,e,18)^a(e,t,9);return r<0&&(r+=4294967296),r}function T(t,e){var r=s(t,e,1)^s(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function k(t,e){var r=a(t,e,1)^a(t,e,8)^l(t,e,7);return r<0&&(r+=4294967296),r}function R(t,e){var r=a(t,e,19)^a(e,t,29)^l(t,e,6);return r<0&&(r+=4294967296),r}n.inherits(b,v),t.exports=b,b.blockSize=1024,b.outSize=512,b.hmacStrength=192,b.padLength=128,b.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n{"use strict";var n=r(6436).rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function s(t,e,r){return t^e^r}e.ft_1=function(t,e,r,n){return 0===t?i(e,r,n):1===t||3===t?s(e,r,n):2===t?o(e,r,n):void 0},e.ch32=i,e.maj32=o,e.p32=s,e.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},e.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},e.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},e.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},6436:(t,e,r)=>{"use strict";var n=r(9746),i=r(5717);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,r[n++]=63&s|128):o(t,i)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i>>0}return s},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,s,a){var u=0,l=e;return u+=(l=l+n>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,s,a,u,l){var h=0,c=e;return h+=(c=c+n>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,n,i,o,s,a,u,l){return e+n+o+a+l>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},5717:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},1094:(t,e,r)=>{var n;!function(){"use strict";var i="input is invalid type",o="object"==typeof window,s=o?window:{};s.JS_SHA3_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!s.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?s=r.g:a&&(s=self);var u=!s.JS_SHA3_NO_COMMON_JS&&t.exports,l=r.amdO,h=!s.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,c="0123456789abcdef".split(""),f=[4,1024,262144,67108864],d=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],m=[224,256,384,512],g=[128,256],v=["hex","buffer","arrayBuffer","array","digest"],y={128:168,256:136};!s.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!h||!s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var b=function(t,e,r){return function(n){return new P(t,e,t).update(n)[r]()}},w=function(t,e,r){return function(n,i){return new P(t,e,i).update(n)[r]()}},E=function(t,e,r){return function(e,n,i,o){return S["cshake"+t].update(e,n,i,o)[r]()}},M=function(t,e,r){return function(e,n,i,o){return S["kmac"+t].update(e,n,i,o)[r]()}},A=function(t,e,r,n){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function L(t,e,r){P.call(this,t,e,r)}P.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(i);if(null===t)throw new Error(i);if(h&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||h&&ArrayBuffer.isView(t)))throw new Error(i);e=!0}for(var n,o,s=this.blocks,a=this.byteCount,u=t.length,l=this.blockCount,c=0,f=this.s;c>2]|=t[c]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(s[n>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=a){for(this.start=n-a,this.block=s[l],n=0;n>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),this.update(i),i.length},P.prototype.encodeString=function(t){var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(i);if(null===t)throw new Error(i);if(h&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||h&&ArrayBuffer.isView(t)))throw new Error(i);e=!0}var n=0,o=t.length;if(e)n=o;else for(var s=0;s=57344?n+=3:(a=65536+((1023&a)<<10|1023&t.charCodeAt(++s)),n+=4)}return n+=this.encode(8*n),this.update(t),n},P.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e>4&15]+c[15&t]+c[t>>12&15]+c[t>>8&15]+c[t>>20&15]+c[t>>16&15]+c[t>>28&15]+c[t>>24&15];s%e==0&&(U(r),o=0)}return i&&(t=r[o],a+=c[t>>4&15]+c[15&t],i>1&&(a+=c[t>>12&15]+c[t>>8&15]),i>2&&(a+=c[t>>20&15]+c[t>>16&15])),a},P.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(t);s>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;a%r==0&&U(n)}return o&&(t=a<<2,e=n[s],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},L.prototype=new P,L.prototype.finalize=function(){return this.encode(this.outputBits,!0),P.prototype.finalize.call(this)};var U=function(t){var e,r,n,i,o,s,a,u,l,h,c,f,d,m,g,v,y,b,w,E,M,A,_,N,S,T,k,R,x,O,I,C,P,L,U,B,D,F,G,j,q,z,K,H,$,V,W,Y,J,X,Z,Q,tt,et,rt,nt,it,ot,st,at,ut,lt,ht;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],l=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),r=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|l>>>31),r=o^(l<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(h<<1|c>>>31),r=a^(c<<1|h>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(f<<1|d>>>31),r=l^(d<<1|f>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=h^(i<<1|o>>>31),r=c^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,m=t[0],g=t[1],V=t[11]<<4|t[10]>>>28,W=t[10]<<4|t[11]>>>28,R=t[20]<<3|t[21]>>>29,x=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,L=t[2]<<1|t[3]>>>31,U=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,y=t[12]<<12|t[13]>>>20,Y=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,O=t[33]<<13|t[32]>>>19,I=t[32]<<13|t[33]>>>19,lt=t[42]<<2|t[43]>>>30,ht=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,B=t[14]<<6|t[15]>>>26,D=t[15]<<6|t[14]>>>26,b=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Z=t[35]<<15|t[34]>>>17,C=t[45]<<29|t[44]>>>3,P=t[44]<<29|t[45]>>>3,N=t[6]<<28|t[7]>>>4,S=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,F=t[26]<<25|t[27]>>>7,G=t[27]<<25|t[26]>>>7,E=t[36]<<21|t[37]>>>11,M=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,H=t[8]<<27|t[9]>>>5,$=t[9]<<27|t[8]>>>5,T=t[18]<<20|t[19]>>>12,k=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,j=t[38]<<8|t[39]>>>24,q=t[39]<<8|t[38]>>>24,A=t[48]<<14|t[49]>>>18,_=t[49]<<14|t[48]>>>18,t[0]=m^~v&b,t[1]=g^~y&w,t[10]=N^~T&R,t[11]=S^~k&x,t[20]=L^~B&F,t[21]=U^~D&G,t[30]=H^~V&Y,t[31]=$^~W&J,t[40]=et^~nt&ot,t[41]=rt^~it&st,t[2]=v^~b&E,t[3]=y^~w&M,t[12]=T^~R&O,t[13]=k^~x&I,t[22]=B^~F&j,t[23]=D^~G&q,t[32]=V^~Y&X,t[33]=W^~J&Z,t[42]=nt^~ot&at,t[43]=it^~st&ut,t[4]=b^~E&A,t[5]=w^~M&_,t[14]=R^~O&C,t[15]=x^~I&P,t[24]=F^~j&z,t[25]=G^~q&K,t[34]=Y^~X&Q,t[35]=J^~Z&tt,t[44]=ot^~at<,t[45]=st^~ut&ht,t[6]=E^~A&m,t[7]=M^~_&g,t[16]=O^~C&N,t[17]=I^~P&S,t[26]=j^~z&L,t[27]=q^~K&U,t[36]=X^~Q&H,t[37]=Z^~tt&$,t[46]=at^~lt&et,t[47]=ut^~ht&rt,t[8]=A^~m&v,t[9]=_^~g&y,t[18]=C^~N&T,t[19]=P^~S&k,t[28]=z^~L&B,t[29]=K^~U&D,t[38]=Q^~H&V,t[39]=tt^~$&W,t[48]=lt^~et&nt,t[49]=ht^~rt&it,t[0]^=p[n],t[1]^=p[n+1]};if(u)t.exports=S;else{for(k=0;k{function e(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=e,e.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},7635:function(t){"use strict";!function(e){const r=2147483647;function n(t){const e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);let r=1779033703,n=3144134277,i=1013904242,o=2773480762,s=1359893119,a=2600822924,u=528734635,l=1541459225;const h=new Uint32Array(64);function c(t){let c=0,f=t.length;for(;f>=64;){let d,p,m,g,v,y=r,b=n,w=i,E=o,M=s,A=a,_=u,N=l;for(p=0;p<16;p++)m=c+4*p,h[p]=(255&t[m])<<24|(255&t[m+1])<<16|(255&t[m+2])<<8|255&t[m+3];for(p=16;p<64;p++)d=h[p-2],g=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,d=h[p-15],v=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3,h[p]=(g+h[p-7]|0)+(v+h[p-16]|0)|0;for(p=0;p<64;p++)g=(((M>>>6|M<<26)^(M>>>11|M<<21)^(M>>>25|M<<7))+(M&A^~M&_)|0)+(N+(e[p]+h[p]|0)|0)|0,v=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&b^y&w^b&w)|0,N=_,_=A,A=M,M=E+g|0,E=w,w=b,b=y,y=g+v|0;r=r+y|0,n=n+b|0,i=i+w|0,o=o+E|0,s=s+M|0,a=a+A|0,u=u+_|0,l=l+N|0,c+=64,f-=64}}c(t);let f,d=t.length%64,p=t.length/536870912|0,m=t.length<<3,g=d<56?56:120,v=t.slice(t.length-d,t.length);for(v.push(128),f=d+1;f>>24&255),v.push(p>>>16&255),v.push(p>>>8&255),v.push(p>>>0&255),v.push(m>>>24&255),v.push(m>>>16&255),v.push(m>>>8&255),v.push(m>>>0&255),c(v),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255,l>>>24&255,l>>>16&255,l>>>8&255,l>>>0&255]}function i(t,e,r){t=t.length<=64?t:n(t);const i=64+e.length+4,o=new Array(i),s=new Array(64);let a,u=[];for(a=0;a<64;a++)o[a]=54;for(a=0;a=i-4;t--){if(o[t]++,o[t]<=255)return;o[t]=0}}for(;r>=32;)l(),u=u.concat(n(s.concat(n(o)))),r-=32;return r>0&&(l(),u=u.concat(n(s.concat(n(o))).slice(0,r))),u}function o(t,e,r,n,i){let o;for(l(t,16*(2*r-1),i,0,16),o=0;o<2*r;o++)u(t,16*o,i,16),a(i,n),l(i,0,t,e+16*o,16);for(o=0;o>>32-e}function a(t,e){l(t,0,e,0,16);for(let t=8;t>0;t-=2)e[4]^=s(e[0]+e[12],7),e[8]^=s(e[4]+e[0],9),e[12]^=s(e[8]+e[4],13),e[0]^=s(e[12]+e[8],18),e[9]^=s(e[5]+e[1],7),e[13]^=s(e[9]+e[5],9),e[1]^=s(e[13]+e[9],13),e[5]^=s(e[1]+e[13],18),e[14]^=s(e[10]+e[6],7),e[2]^=s(e[14]+e[10],9),e[6]^=s(e[2]+e[14],13),e[10]^=s(e[6]+e[2],18),e[3]^=s(e[15]+e[11],7),e[7]^=s(e[3]+e[15],9),e[11]^=s(e[7]+e[3],13),e[15]^=s(e[11]+e[7],18),e[1]^=s(e[0]+e[3],7),e[2]^=s(e[1]+e[0],9),e[3]^=s(e[2]+e[1],13),e[0]^=s(e[3]+e[2],18),e[6]^=s(e[5]+e[4],7),e[7]^=s(e[6]+e[5],9),e[4]^=s(e[7]+e[6],13),e[5]^=s(e[4]+e[7],18),e[11]^=s(e[10]+e[9],7),e[8]^=s(e[11]+e[10],9),e[9]^=s(e[8]+e[11],13),e[10]^=s(e[9]+e[8],18),e[12]^=s(e[15]+e[14],7),e[13]^=s(e[12]+e[15],9),e[14]^=s(e[13]+e[12],13),e[15]^=s(e[14]+e[13],18);for(let r=0;r<16;++r)t[r]+=e[r]}function u(t,e,r,n){for(let i=0;i=256)return!1}return!0}function c(t,e){if("number"!=typeof t||t%1)throw new Error("invalid "+e);return t}function f(t,e,n,s,a,f,d){if(n=c(n,"N"),s=c(s,"r"),a=c(a,"p"),f=c(f,"dkLen"),0===n||0!=(n&n-1))throw new Error("N must be power of 2");if(n>r/128/s)throw new Error("N too large");if(s>r/128/a)throw new Error("r too large");if(!h(t))throw new Error("password must be an array or buffer");if(t=Array.prototype.slice.call(t),!h(e))throw new Error("salt must be an array or buffer");e=Array.prototype.slice.call(e);let p=i(t,e,128*a*s);const m=new Uint32Array(32*a*s);for(let t=0;tR&&(e=R);for(let t=0;tR&&(e=R);for(let t=0;t>0&255),p.push(m[t]>>8&255),p.push(m[t]>>16&255),p.push(m[t]>>24&255);const r=i(t,p,f);return d&&d(null,1,r),r}d&&x(O)};if(!d)for(;;){const t=O();if(null!=t)return t}O()}const d={scrypt:function(t,e,r,n,i,o,s){return new Promise((function(a,u){let l=0;s&&s(0),f(t,e,r,n,i,o,(function(t,e,r){if(t)u(t);else if(r)s&&1!==l&&s(1),a(new Uint8Array(r));else if(s&&e!==l)return l=e,s(e)}))}))},syncScrypt:function(t,e,r,n,i,o){return new Uint8Array(f(t,e,r,n,i,o))}};t.exports=d}()},2156:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ParsedMessage=void 0;const i=n(r(5528)),o=n(r(8737));e.ParsedMessage=class{constructor(t){const e=new i.default('\nsign-in-with-ethereum =\n domain %s" wants you to sign in with your Ethereum account:" LF\n address LF\n LF\n [ statement LF ]\n LF\n %s"URI: " URI LF\n %s"Version: " version LF\n %s"Chain ID: " chain-id LF\n %s"Nonce: " nonce LF\n %s"Issued At: " issued-at\n [ LF %s"Expiration Time: " expiration-time ]\n [ LF %s"Not Before: " not-before ]\n [ LF %s"Request ID: " request-id ]\n [ LF %s"Resources:"\n resources ]\n\ndomain = authority\n\naddress = "0x" 40*40HEXDIG\n ; Must also conform to captilization\n ; checksum encoding specified in EIP-55\n ; where applicable (EOAs).\n\nstatement = *( reserved / unreserved / " " )\n ; The purpose is to exclude LF (line breaks).\n\nversion = "1"\n\nnonce = 8*( ALPHA / DIGIT )\n\nissued-at = date-time\nexpiration-time = date-time\nnot-before = date-time\n\nrequest-id = *pchar\n\nchain-id = 1*DIGIT\n ; See EIP-155 for valid CHAIN_IDs.\n\nresources = *( LF resource )\n\nresource = "- " URI\n\n; ------------------------------------------------------------------------------\n; RFC 3986\n\nURI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]\n\nhier-part = "//" authority path-abempty\n / path-absolute\n / path-rootless\n / path-empty\n\nscheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )\n\nauthority = [ userinfo "@" ] host [ ":" port ]\nuserinfo = *( unreserved / pct-encoded / sub-delims / ":" )\nhost = IP-literal / IPv4address / reg-name\nport = *DIGIT\n\nIP-literal = "[" ( IPv6address / IPvFuture ) "]"\n\nIPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )\n\nIPv6address = 6( h16 ":" ) ls32\n / "::" 5( h16 ":" ) ls32\n / [ h16 ] "::" 4( h16 ":" ) ls32\n / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32\n / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32\n / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32\n / [ *4( h16 ":" ) h16 ] "::" ls32\n / [ *5( h16 ":" ) h16 ] "::" h16\n / [ *6( h16 ":" ) h16 ] "::"\n\nh16 = 1*4HEXDIG\nls32 = ( h16 ":" h16 ) / IPv4address\nIPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet\ndec-octet = DIGIT ; 0-9\n / %x31-39 DIGIT ; 10-99\n / "1" 2DIGIT ; 100-199\n / "2" %x30-34 DIGIT ; 200-249\n / "25" %x30-35 ; 250-255\n\nreg-name = *( unreserved / pct-encoded / sub-delims )\n\npath-abempty = *( "/" segment )\npath-absolute = "/" [ segment-nz *( "/" segment ) ]\npath-rootless = segment-nz *( "/" segment )\npath-empty = 0pchar\n\nsegment = *pchar\nsegment-nz = 1*pchar\n\npchar = unreserved / pct-encoded / sub-delims / ":" / "@"\n\nquery = *( pchar / "/" / "?" )\n\nfragment = *( pchar / "/" / "?" )\n\npct-encoded = "%" HEXDIG HEXDIG\n\nunreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"\nreserved = gen-delims / sub-delims\ngen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"\nsub-delims = "!" / "$" / "&" / "\'" / "(" / ")"\n / "*" / "+" / "," / ";" / "="\n\n; ------------------------------------------------------------------------------\n; RFC 3339\n\ndate-fullyear = 4DIGIT\ndate-month = 2DIGIT ; 01-12\ndate-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on\n ; month/year\ntime-hour = 2DIGIT ; 00-23\ntime-minute = 2DIGIT ; 00-59\ntime-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second\n ; rules\ntime-secfrac = "." 1*DIGIT\ntime-numoffset = ("+" / "-") time-hour ":" time-minute\ntime-offset = "Z" / time-numoffset\n\npartial-time = time-hour ":" time-minute ":" time-second\n [time-secfrac]\nfull-date = date-fullyear "-" date-month "-" date-mday\nfull-time = partial-time time-offset\n\ndate-time = full-date "T" full-time\n\n; ------------------------------------------------------------------------------\n; RFC 5234\n\nALPHA = %x41-5A / %x61-7A ; A-Z / a-z\nLF = %x0A\n ; linefeed\nDIGIT = %x30-39\n ; 0-9\nHEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n');if(e.generate(),e.errors.length)throw console.error(e.errorsToAscii()),console.error(e.linesToAscii()),console.log(e.displayAttributeErrors()),new Error("ABNF grammar has errors");const r=e.toObject(),n=new o.default.parser;n.ast=new o.default.ast;const s=o.default.ids;n.ast.callbacks.domain=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.domain=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks.address=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.address=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks.statement=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.statement=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks.uri=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.uri||(i.uri=o.default.utils.charsToString(e,r,n))),a},n.ast.callbacks.version=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.version=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks["chain-id"]=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.chainId=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks.nonce=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.nonce=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks["issued-at"]=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.issuedAt=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks["expiration-time"]=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.expirationTime=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks["not-before"]=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.notBefore=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks["request-id"]=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.requestId=o.default.utils.charsToString(e,r,n)),a},n.ast.callbacks.resources=function(t,e,r,n,i){const a=s.SEM_OK;return t===s.SEM_PRE&&(i.resources=o.default.utils.charsToString(e,r,n).slice(3).split("\n- ")),a};const a=n.parse(r,"sign-in-with-ethereum",t);if(!a.success)throw new Error(`Invalid message: ${JSON.stringify(a)}`);const u={};n.ast.translate(u);for(const[t,e]of Object.entries(u))this[t]=e}}},7956:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.generateNonce=e.checkContractWalletSignature=e.SiweMessage=e.SignatureType=e.ErrorTypes=void 0;const i=r(1416),o=r(9954),s=r(2156),a=r(3270);var u;!function(t){t.INVALID_SIGNATURE="Invalid signature.",t.EXPIRED_MESSAGE="Expired message.",t.MALFORMED_SESSION="Malformed session."}(u=e.ErrorTypes||(e.ErrorTypes={})),(e.SignatureType||(e.SignatureType={})).PERSONAL_SIGNATURE="Personal signature";class l{constructor(t){if("string"==typeof t){const e=new s.ParsedMessage(t);this.domain=e.domain,this.address=e.address,this.statement=e.statement,this.uri=e.uri,this.version=e.version,this.nonce=e.nonce,this.issuedAt=e.issuedAt,this.expirationTime=e.expirationTime,this.notBefore=e.notBefore,this.requestId=e.requestId,this.chainId=e.chainId,this.resources=e.resources}else Object.assign(this,t)}regexFromMessage(t){return new a.ParsedMessage(t).match}toMessage(){const t=`${this.domain} wants you to sign in with your Ethereum account:`,r=`URI: ${this.uri}`;let n=[t,this.address].join("\n");const i=`Version: ${this.version}`;this.nonce||(this.nonce=(0,e.generateNonce)());const o=[r,i,"Chain ID: "+this.chainId||0,`Nonce: ${this.nonce}`];if(this.issuedAt&&Date.parse(this.issuedAt),this.issuedAt=this.issuedAt?this.issuedAt:(new Date).toISOString(),o.push(`Issued At: ${this.issuedAt}`),this.expirationTime){const t=`Expiration Time: ${this.expirationTime}`;o.push(t)}this.notBefore&&o.push(`Not Before: ${this.notBefore}`),this.requestId&&o.push(`Request ID: ${this.requestId}`),this.resources&&o.push(["Resources:",...this.resources.map((t=>`- ${t}`))].join("\n"));let s=o.join("\n");return this.statement&&(n=[n,this.statement].join("\n\n")),[n,s].join("\n\n")}signMessage(){return console&&console.warn&&console.warn("signMessage method is deprecated, use prepareMessage instead."),this.prepareMessage()}prepareMessage(){let t;return this.version,t=this.toMessage(),t}validate(t=this.signature,r){return n(this,void 0,void 0,(function*(){return new Promise(((i,s)=>n(this,void 0,void 0,(function*(){const n=this.prepareMessage();try{let s=[];if(n||s.push("`message`"),t||s.push("`signature`"),this.address||s.push("`address`"),s.length>0)throw new Error(`${u.MALFORMED_SESSION} missing: ${s.join(", ")}.`);const a=o.ethers.utils.verifyMessage(n,t);if(a!==this.address)try{if(!(yield(0,e.checkContractWalletSignature)(this,r)))throw new Error(`${u.INVALID_SIGNATURE}: ${a} !== ${this.address}`)}catch(t){throw t}const h=new l(n);if(h.expirationTime){const t=new Date(h.expirationTime).getTime();if(isNaN(t))throw new Error(`${u.MALFORMED_SESSION} invalid expiration date.`);if((new Date).getTime()>=t)throw new Error(u.EXPIRED_MESSAGE)}i(h)}catch(t){s(t)}}))))}))}}e.SiweMessage=l,e.checkContractWalletSignature=(t,e)=>n(void 0,void 0,void 0,(function*(){if(!e)return!1;const r=["function isValidSignature(bytes32 _message, bytes _signature) public view returns (bool)"];try{const n=new o.Contract(t.address,r,e),i=o.utils.hashMessage(t.signMessage());return yield n.isValidSignature(i,t.signature)}catch(t){throw t}})),e.generateNonce=()=>(0,i.randomStringForEntropy)(96)},3270:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ParsedMessage=void 0;const r="(([^:?#]+):)?(([^?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))",n="([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(.[0-9]+)?(([Zz])|([+|-]([01][0-9]|2[0-3]):[0-5][0-9]))",i=`^(?([^?#]*)) wants you to sign in with your Ethereum account:\\n(?
0x[a-zA-Z0-9]{40})\\n\\n((?[^\\n]+)\\n)?\\nURI: (?${r}?)\\nVersion: (?1)\\nChain ID: (?[0-9]+)\\nNonce: (?[a-zA-Z0-9]{8,})\\nIssued At: (?${n})(\\nExpiration Time: (?${n}))?(\\nNot Before: (?${n}))?(\\nRequest ID: (?[-._~!$&'()*+,;=:@%a-zA-Z0-9]*))?(\\nResources:(?(\\n- ${r}?)+))?$`;e.ParsedMessage=class{constructor(t){var e,r,n,o,s,a,u,l,h,c,f,d,p;let m=new RegExp(i,"g").exec(t);if(!m)throw new Error("Message did not match the regular expression.");this.match=m,this.domain=null===(e=null==m?void 0:m.groups)||void 0===e?void 0:e.domain,this.address=null===(r=null==m?void 0:m.groups)||void 0===r?void 0:r.address,this.statement=null===(n=null==m?void 0:m.groups)||void 0===n?void 0:n.statement,this.uri=null===(o=null==m?void 0:m.groups)||void 0===o?void 0:o.uri,this.version=null===(s=null==m?void 0:m.groups)||void 0===s?void 0:s.version,this.nonce=null===(a=null==m?void 0:m.groups)||void 0===a?void 0:a.nonce,this.chainId=null===(u=null==m?void 0:m.groups)||void 0===u?void 0:u.chainId,this.issuedAt=null===(l=null==m?void 0:m.groups)||void 0===l?void 0:l.issuedAt,this.expirationTime=null===(h=null==m?void 0:m.groups)||void 0===h?void 0:h.expirationTime,this.notBefore=null===(c=null==m?void 0:m.groups)||void 0===c?void 0:c.notBefore,this.requestId=null===(f=null==m?void 0:m.groups)||void 0===f?void 0:f.requestId,this.resources=null===(p=null===(d=null==m?void 0:m.groups)||void 0===d?void 0:d.resources)||void 0===p?void 0:p.split("\n- ").slice(1)}}},7544:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(7956),e)},9954:(t,e,r)=>{"use strict";r.r(e),r.d(e,{BaseContract:()=>I,BigNumber:()=>d.O$,Contract:()=>C,ContractFactory:()=>P,FixedNumber:()=>L.xs,Signer:()=>c.E,VoidSigner:()=>c.b,Wallet:()=>$,Wordlist:()=>nr.D,constants:()=>n,errors:()=>v.jK,ethers:()=>a,getDefaultProvider:()=>er,logger:()=>Gr,providers:()=>i,utils:()=>s,version:()=>Fr,wordlists:()=>rr.E});var n={};r.r(n),r.d(n,{AddressZero:()=>Y.d,EtherSymbol:()=>Z,HashZero:()=>X.R,MaxInt256:()=>J.PS,MaxUint256:()=>J.Bz,MinInt256:()=>J.$B,NegativeOne:()=>J.tL,One:()=>J.fh,Two:()=>J.Py,WeiPerEther:()=>J.Ce,Zero:()=>J._Y});var i={};r.r(i),r.d(i,{AlchemyProvider:()=>le,AlchemyWebSocketProvider:()=>ue,AnkrProvider:()=>de,BaseProvider:()=>Dt,CloudflareProvider:()=>me,EtherscanProvider:()=>Ae,FallbackProvider:()=>De,Formatter:()=>ht,InfuraProvider:()=>ze,InfuraWebSocketProvider:()=>qe,IpcProvider:()=>Fe,JsonRpcBatchProvider:()=>Ke,JsonRpcProvider:()=>Xt,JsonRpcSigner:()=>Wt,NodesmithProvider:()=>$e,PocketProvider:()=>Ye,Provider:()=>h.zt,Resolver:()=>Lt,StaticJsonRpcProvider:()=>ie,UrlJsonRpcProvider:()=>oe,Web3Provider:()=>Qe,WebSocketProvider:()=>re,getDefaultProvider:()=>er,getNetwork:()=>Q.H,isCommunityResourcable:()=>ct,isCommunityResource:()=>ft,showThrottleMessage:()=>pt});var o={};r.r(o),r.d(o,{decode:()=>tt.J,encode:()=>tt.c});var s={};r.r(s),r.d(s,{AbiCoder:()=>ir.R,ConstructorFragment:()=>or.Xg,ErrorFragment:()=>or.IC,EventFragment:()=>or.QV,FormatTypes:()=>or.pc,Fragment:()=>or.HY,FunctionFragment:()=>or.YW,HDNode:()=>D.m$,Indexed:()=>l.Hk,Interface:()=>l.vU,LogDescription:()=>l.CC,Logger:()=>v.Yd,ParamType:()=>or._R,RLP:()=>vr,SigningKey:()=>j.Et,SupportedAlgorithm:()=>Dr.p,TransactionDescription:()=>l.vk,TransactionTypes:()=>g.em,UnicodeNormalizationForm:()=>it.Uj,Utf8ErrorFuncs:()=>it.te,Utf8ErrorReason:()=>it.Uw,_TypedDataEncoder:()=>B.E,_fetchData:()=>ot.MY,_toEscapedUtf8String:()=>it.U$,accessListify:()=>g.z7,arrayify:()=>p.lE,base58:()=>et.eU,base64:()=>o,checkProperties:()=>m.uj,checkResultErrors:()=>u.BR,commify:()=>Cr,computeAddress:()=>g.db,computeHmac:()=>nt.Gy,computePublicKey:()=>j.VW,concat:()=>p.zo,deepCopy:()=>m.p$,defaultAbiCoder:()=>ir.$,defaultPath:()=>D.cD,defineReadOnly:()=>m.zG,dnsEncode:()=>rt.Kn,entropyToMnemonic:()=>D.JJ,fetchJson:()=>ot.rd,formatBytes32String:()=>Rr,formatEther:()=>Ur,formatUnits:()=>Pr,getAccountPath:()=>D.ny,getAddress:()=>f.Kn,getContractAddress:()=>f.CR,getCreate2Address:()=>f.hB,getIcapAddress:()=>f.vU,getJsonWalletAddress:()=>ar.Rb,getStatic:()=>m.tu,hashMessage:()=>U.r,hexConcat:()=>p.xs,hexDataLength:()=>p.E1,hexDataSlice:()=>p.p3,hexStripZeros:()=>p.Ou,hexValue:()=>p.$P,hexZeroPad:()=>p.$m,hexlify:()=>p.Dv,id:()=>sr.id,isAddress:()=>f.UJ,isBytes:()=>p._t,isBytesLike:()=>p.Zq,isHexString:()=>p.A7,isValidMnemonic:()=>D.xh,isValidName:()=>rt.r1,joinSignature:()=>p.gV,keccak256:()=>F.w,mnemonicToEntropy:()=>D.oy,mnemonicToSeed:()=>D.OI,namehash:()=>rt.VM,nameprep:()=>kr,parseBytes32String:()=>xr,parseEther:()=>Br,parseTransaction:()=>g.Qc,parseUnits:()=>Lr,poll:()=>ot.$l,randomBytes:()=>G.O,recoverAddress:()=>g.RJ,recoverPublicKey:()=>j.LO,resolveProperties:()=>m.mE,ripemd160:()=>nt.bP,serializeTransaction:()=>g.qC,sha256:()=>nt.JQ,sha512:()=>nt.o,shallowCopy:()=>m.DC,shuffled:()=>_e.y,solidityKeccak256:()=>mr,solidityPack:()=>pr,soliditySha256:()=>gr,splitSignature:()=>p.N,stripZeros:()=>p.G1,toUtf8Bytes:()=>it.Y0,toUtf8CodePoints:()=>it.XL,toUtf8String:()=>it.ZN,verifyMessage:()=>V,verifyTypedData:()=>W,zeroPad:()=>p.Bu});var a={};r.r(a),r.d(a,{BaseContract:()=>I,BigNumber:()=>d.O$,Contract:()=>C,ContractFactory:()=>P,FixedNumber:()=>L.xs,Signer:()=>c.E,VoidSigner:()=>c.b,Wallet:()=>$,Wordlist:()=>nr.D,constants:()=>n,errors:()=>v.jK,getDefaultProvider:()=>er,logger:()=>Gr,providers:()=>i,utils:()=>s,version:()=>Fr,wordlists:()=>rr.E});var u=r(1184),l=r(8198),h=r(4353),c=r(8171),f=r(4594),d=r(2593),p=r(3286),m=r(3587),g=r(4377),v=r(711),y=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const b=new v.Yd("contracts/5.7.0"),w={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0,ccipReadEnabled:!0};function E(t,e){return y(this,void 0,void 0,(function*(){const r=yield e;"string"!=typeof r&&b.throwArgumentError("invalid address or ENS name","name",r);try{return(0,f.Kn)(r)}catch(t){}t||b.throwError("a provider or signer is needed to resolve ENS names",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return null==n&&b.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n}))}function M(t,e,r){return y(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,n)=>M(t,Array.isArray(e)?e[n]:e[r.name],r)))):"address"===r.type?yield E(t,e):"tuple"===r.type?yield M(t,e,r.components):"array"===r.baseType?Array.isArray(e)?yield Promise.all(e.map((e=>M(t,e,r.arrayChildren)))):Promise.reject(b.makeError("invalid value for array",v.Yd.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e}))}function A(t,e,r){return y(this,void 0,void 0,(function*(){let n={};r.length===e.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=(0,m.DC)(r.pop())),b.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=(0,m.mE)({override:E(t.signer,n.from),signer:t.signer.getAddress()}).then((t=>y(this,void 0,void 0,(function*(){return(0,f.Kn)(t.signer)!==t.override&&b.throwError("Contract with a Signer cannot override from",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})))):n.from=t.signer.getAddress():n.from&&(n.from=E(t.provider,n.from));const i=yield(0,m.mE)({args:M(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:(0,m.mE)(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},a=i.overrides;if(null!=a.nonce&&(s.nonce=d.O$.from(a.nonce).toNumber()),null!=a.gasLimit&&(s.gasLimit=d.O$.from(a.gasLimit)),null!=a.gasPrice&&(s.gasPrice=d.O$.from(a.gasPrice)),null!=a.maxFeePerGas&&(s.maxFeePerGas=d.O$.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(s.maxPriorityFeePerGas=d.O$.from(a.maxPriorityFeePerGas)),null!=a.from&&(s.from=a.from),null!=a.type&&(s.type=a.type),null!=a.accessList&&(s.accessList=(0,g.z7)(a.accessList)),null==s.gasLimit&&null!=e.gas){let t=21e3;const r=(0,p.lE)(o);for(let e=0;enull!=n[t]));return u.length&&b.throwError(`cannot override ${u.map((t=>JSON.stringify(t))).join(",")}`,v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),s}))}function _(t,e){const r=e.wait.bind(e);e.wait=e=>r(e).then((e=>(e.events=e.logs.map((r=>{let n=(0,m.p$)(r),i=null;try{i=t.interface.parseLog(r)}catch(t){}return i&&(n.args=i.args,n.decode=(e,r)=>t.interface.decodeEventLog(i.eventFragment,e,r),n.event=i.name,n.eventSignature=i.signature),n.removeListener=()=>t.provider,n.getBlock=()=>t.provider.getBlock(e.blockHash),n.getTransaction=()=>t.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(e),n})),e)))}function N(t,e,r){const n=t.signer||t.provider;return function(...i){return y(this,void 0,void 0,(function*(){let o;if(i.length===e.inputs.length+1&&"object"==typeof i[i.length-1]){const t=(0,m.DC)(i.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,i.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const s=yield A(t,e,i),a=yield n.call(s,o);try{let n=t.interface.decodeFunctionResult(e,a);return r&&1===e.outputs.length&&(n=n[0]),n}catch(e){throw e.code===v.Yd.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=i,e.transaction=s),e}}))}}function S(t,e,r){return e.constant?N(t,e,r):function(t,e){return function(...r){return y(this,void 0,void 0,(function*(){t.signer||b.throwError("sending a transaction requires a signer",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const n=yield A(t,e,r),i=yield t.signer.sendTransaction(n);return _(t,i),i}))}}(t,e)}function T(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map((t=>Array.isArray(t)?t.join("|"):t)).join(":"):""):"*"}class k{constructor(t,e){(0,m.zG)(this,"tag",t),(0,m.zG)(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter((r=>!(!e&&r.listener===t&&(e=!0,1))))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((t=>t.listener))}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter((e=>{const r=t.slice();return setTimeout((()=>{e.listener.apply(this,r)}),0),!e.once})),e}prepareEvent(t){}getEmit(t){return[t]}}class R extends k{constructor(){super("error",null)}}class x extends k{constructor(t,e,r,n){const i={address:t};let o=e.getEventTopic(r);n?(o!==n[0]&&b.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[o],super(T(i),i),(0,m.zG)(this,"address",t),(0,m.zG)(this,"interface",e),(0,m.zG)(this,"fragment",r)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=(0,u.BR)(t.args);if(e.length)throw e[0].error;const r=(t.args||[]).slice();return r.push(t),r}}class O extends k{constructor(t,e){super("*",{address:t}),(0,m.zG)(this,"address",t),(0,m.zG)(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,r)=>this.interface.decodeEventLog(e.eventFragment,t,r),t.args=e.args}catch(t){}}}class I{constructor(t,e,r){(0,m.zG)(this,"interface",(0,m.tu)(new.target,"getInterface")(e)),null==r?((0,m.zG)(this,"provider",null),(0,m.zG)(this,"signer",null)):c.E.isSigner(r)?((0,m.zG)(this,"provider",r.provider||null),(0,m.zG)(this,"signer",r)):h.zt.isProvider(r)?((0,m.zG)(this,"provider",r),(0,m.zG)(this,"signer",null)):b.throwArgumentError("invalid signer or provider","signerOrProvider",r),(0,m.zG)(this,"callStatic",{}),(0,m.zG)(this,"estimateGas",{}),(0,m.zG)(this,"functions",{}),(0,m.zG)(this,"populateTransaction",{}),(0,m.zG)(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach((e=>{const r=this.interface.events[e];(0,m.zG)(this.filters,e,((...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,t)}))),t[r.name]||(t[r.name]=[]),t[r.name].push(e)})),Object.keys(t).forEach((e=>{const r=t[e];1===r.length?(0,m.zG)(this.filters,e,this.filters[r[0]]):b.warn(`Duplicate definition of ${e} (${r.join(", ")})`)}))}if((0,m.zG)(this,"_runningEvents",{}),(0,m.zG)(this,"_wrappedEmits",{}),null==t&&b.throwArgumentError("invalid contract address or ENS name","addressOrName",t),(0,m.zG)(this,"address",t),this.provider)(0,m.zG)(this,"resolvedAddress",E(this.provider,t));else try{(0,m.zG)(this,"resolvedAddress",Promise.resolve((0,f.Kn)(t)))}catch(t){b.throwError("provider is required to use ENS name as contract address",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((t=>{}));const n={},i={};Object.keys(this.interface.functions).forEach((t=>{const e=this.interface.functions[t];if(i[t])b.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{i[t]=!0;{const r=e.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(t)}null==this[t]&&(0,m.zG)(this,t,S(this,e,!0)),null==this.functions[t]&&(0,m.zG)(this.functions,t,S(this,e,!1)),null==this.callStatic[t]&&(0,m.zG)(this.callStatic,t,N(this,e,!0)),null==this.populateTransaction[t]&&(0,m.zG)(this.populateTransaction,t,function(t,e){return function(...r){return A(t,e,r)}}(this,e)),null==this.estimateGas[t]&&(0,m.zG)(this.estimateGas,t,function(t,e){const r=t.signer||t.provider;return function(...n){return y(this,void 0,void 0,(function*(){r||b.throwError("estimate require a provider or signer",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield A(t,e,n);return yield r.estimateGas(i)}))}}(this,e))}})),Object.keys(n).forEach((t=>{const e=n[t];if(e.length>1)return;t=t.substring(1);const r=e[0];try{null==this[t]&&(0,m.zG)(this,t,this[r])}catch(t){}null==this.functions[t]&&(0,m.zG)(this.functions,t,this.functions[r]),null==this.callStatic[t]&&(0,m.zG)(this.callStatic,t,this.callStatic[r]),null==this.populateTransaction[t]&&(0,m.zG)(this.populateTransaction,t,this.populateTransaction[r]),null==this.estimateGas[t]&&(0,m.zG)(this.estimateGas,t,this.estimateGas[r])}))}static getContractAddress(t){return(0,f.CR)(t)}static getInterface(t){return l.vU.isInterface(t)?t:new l.vU(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,t).then((t=>("0x"===t&&b.throwError("contract not deployed",v.Yd.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(t){this.signer||b.throwError("sending a transactions require a signer",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=(0,m.DC)(t||{});return["from","to"].forEach((function(t){null!=e[t]&&b.throwError("cannot override "+t,v.Yd.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(e)))}connect(t){"string"==typeof t&&(t=new c.b(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&(0,m.zG)(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return l.Hk.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new R);if("event"===t)return this._normalizeRunningEvent(new k("event",null));if("*"===t)return this._normalizeRunningEvent(new O(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new x(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new x(this.address,this.interface,r,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new k(T(e),e))}return this._normalizeRunningEvent(new O(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,r){const n=(0,m.p$)(e);return n.removeListener=()=>{r&&(t.removeListener(r),this._checkRunningEvents(t))},n.getBlock=()=>this.provider.getBlock(e.blockHash),n.getTransaction=()=>this.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(n),n}_addEventListener(t,e,r){if(this.provider||b.throwError("events require a provider or a signer with a provider",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,r),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const r=r=>{let n=this._wrapEvent(t,r,e);if(null==n.decodeError)try{const e=t.getEmit(n);this.emit(t.filter,...e)}catch(t){n.decodeError=t.error}null!=t.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[t.tag]=r,null!=t.filter&&this.provider.on(t.filter,r)}}queryFilter(t,e,r){const n=this._getRunningEvent(t),i=(0,m.DC)(n.filter);return"string"==typeof e&&(0,p.A7)(e,32)?(null!=r&&b.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=e):(i.fromBlock=null!=e?e:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then((t=>t.map((t=>this._wrapEvent(n,t,null)))))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const r=this._getRunningEvent(t),n=r.run(e)>0;return this._checkRunningEvents(r),n}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce(((t,e)=>t+this._runningEvents[e].listenerCount()),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach((e=>{t.push(e)}));return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const r=this._getRunningEvent(t);return r.removeListener(e),this._checkRunningEvents(r),this}removeListener(t,e){return this.off(t,e)}}class C extends I{}class P{constructor(t,e,r){let n=null;n="string"==typeof e?e:(0,p._t)(e)?(0,p.Dv)(e):e&&"string"==typeof e.object?e.object:"!","0x"!==n.substring(0,2)&&(n="0x"+n),(!(0,p.A7)(n)||n.length%2)&&b.throwArgumentError("invalid bytecode","bytecode",e),r&&!c.E.isSigner(r)&&b.throwArgumentError("invalid signer","signer",r),(0,m.zG)(this,"bytecode",n),(0,m.zG)(this,"interface",(0,m.tu)(new.target,"getInterface")(t)),(0,m.zG)(this,"signer",r||null)}getDeployTransaction(...t){let e={};if(t.length===this.interface.deploy.inputs.length+1&&"object"==typeof t[t.length-1]){e=(0,m.DC)(t.pop());for(const t in e)if(!w[t])throw new Error("unknown transaction override "+t)}return["data","from","to"].forEach((t=>{null!=e[t]&&b.throwError("cannot override "+t,v.Yd.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.value&&(d.O$.from(e.value).isZero()||this.interface.deploy.payable||b.throwError("non-payable constructor cannot override value",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:e.value})),b.checkArgumentCount(t.length,this.interface.deploy.inputs.length," in Contract constructor"),e.data=(0,p.Dv)((0,p.zo)([this.bytecode,this.interface.encodeDeploy(t)])),e}deploy(...t){return y(this,void 0,void 0,(function*(){let e={};t.length===this.interface.deploy.inputs.length+1&&(e=t.pop()),b.checkArgumentCount(t.length,this.interface.deploy.inputs.length," in Contract constructor");const r=yield M(this.signer,t,this.interface.deploy.inputs);r.push(e);const n=this.getDeployTransaction(...r),i=yield this.signer.sendTransaction(n),o=(0,m.tu)(this.constructor,"getContractAddress")(i),s=(0,m.tu)(this.constructor,"getContract")(o,this.interface,this.signer);return _(s,i),(0,m.zG)(s,"deployTransaction",i),s}))}attach(t){return this.constructor.getContract(t,this.interface,this.signer)}connect(t){return new this.constructor(this.interface,this.bytecode,t)}static fromSolidity(t,e){null==t&&b.throwError("missing compiler output",v.Yd.errors.MISSING_ARGUMENT,{argument:"compilerOutput"}),"string"==typeof t&&(t=JSON.parse(t));const r=t.abi;let n=null;return t.bytecode?n=t.bytecode:t.evm&&t.evm.bytecode&&(n=t.evm.bytecode),new this(r,n,e)}static getInterface(t){return C.getInterface(t)}static getContractAddress(t){return(0,f.CR)(t)}static getContract(t,e,r){return new C(t,e,r)}}var L=r(335),U=r(3684),B=r(7827),D=r(6274),F=r(8197),G=r(4478),j=r(2768),q=r(1964),z=r(9380),K=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const H=new v.Yd("wallet/5.7.0");class $ extends c.E{constructor(t,e){if(super(),null!=(r=t)&&(0,p.A7)(r.privateKey,32)&&null!=r.address){const e=new j.Et(t.privateKey);if((0,m.zG)(this,"_signingKey",(()=>e)),(0,m.zG)(this,"address",(0,g.db)(this.publicKey)),this.address!==(0,f.Kn)(t.address)&&H.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(t){const e=t.mnemonic;return e&&e.phrase}(t)){const e=t.mnemonic;(0,m.zG)(this,"_mnemonic",(()=>({phrase:e.phrase,path:e.path||D.cD,locale:e.locale||"en"})));const r=this.mnemonic,n=D.m$.fromMnemonic(r.phrase,null,r.locale).derivePath(r.path);(0,g.db)(n.privateKey)!==this.address&&H.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else(0,m.zG)(this,"_mnemonic",(()=>null))}else{if(j.Et.isSigningKey(t))"secp256k1"!==t.curve&&H.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),(0,m.zG)(this,"_signingKey",(()=>t));else{"string"==typeof t&&t.match(/^[0-9a-f]*$/i)&&64===t.length&&(t="0x"+t);const e=new j.Et(t);(0,m.zG)(this,"_signingKey",(()=>e))}(0,m.zG)(this,"_mnemonic",(()=>null)),(0,m.zG)(this,"address",(0,g.db)(this.publicKey))}var r;e&&!h.zt.isProvider(e)&&H.throwArgumentError("invalid provider","provider",e),(0,m.zG)(this,"provider",e||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(t){return new $(this,t)}signTransaction(t){return(0,m.mE)(t).then((e=>{null!=e.from&&((0,f.Kn)(e.from)!==this.address&&H.throwArgumentError("transaction from address mismatch","transaction.from",t.from),delete e.from);const r=this._signingKey().signDigest((0,F.w)((0,g.qC)(e)));return(0,g.qC)(e,r)}))}signMessage(t){return K(this,void 0,void 0,(function*(){return(0,p.gV)(this._signingKey().signDigest((0,U.r)(t)))}))}_signTypedData(t,e,r){return K(this,void 0,void 0,(function*(){const n=yield B.E.resolveNames(t,e,r,(t=>(null==this.provider&&H.throwError("cannot resolve ENS names without a provider",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:t}),this.provider.resolveName(t))));return(0,p.gV)(this._signingKey().signDigest(B.E.hash(n.domain,e,n.value)))}))}encrypt(t,e,r){if("function"!=typeof e||r||(r=e,e={}),r&&"function"!=typeof r)throw new Error("invalid callback");return e||(e={}),(0,q.HI)(this,t,e,r)}static createRandom(t){let e=(0,G.O)(16);t||(t={}),t.extraEntropy&&(e=(0,p.lE)((0,p.p3)((0,F.w)((0,p.zo)([e,t.extraEntropy])),0,16)));const r=(0,D.JJ)(e,t.locale);return $.fromMnemonic(r,t.path,t.locale)}static fromEncryptedJson(t,e,r){return(0,z.w)(t,e,r).then((t=>new $(t)))}static fromEncryptedJsonSync(t,e){return new $((0,z.qz)(t,e))}static fromMnemonic(t,e,r){return e||(e=D.cD),new $(D.m$.fromMnemonic(t,null,r).derivePath(e))}}function V(t,e){return(0,g.RJ)((0,U.r)(t),e)}function W(t,e,r,n){return(0,g.RJ)(B.E.hash(t,e,r),n)}var Y=r(9279),J=r(1046),X=r(7218);const Z="Ξ";var Q=r(9861),tt=r(9567),et=r(7727),rt=r(8339),nt=r(3951),it=r(4242),ot=r(8341),st=r(2882),at=r.n(st);const ut="providers/5.7.2",lt=new v.Yd(ut);class ht{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),r=this.bigNumber.bind(this),n=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),s=this.hex.bind(this),a=this.number.bind(this),u=this.type.bind(this);return t.transaction={hash:o,type:u,accessList:ht.allowNull(this.accessList.bind(this),null),blockHash:ht.allowNull(o,null),blockNumber:ht.allowNull(a,null),transactionIndex:ht.allowNull(a,null),confirmations:ht.allowNull(a,null),from:e,gasPrice:ht.allowNull(r),maxPriorityFeePerGas:ht.allowNull(r),maxFeePerGas:ht.allowNull(r),gasLimit:r,to:ht.allowNull(e,null),value:r,nonce:a,data:i,r:ht.allowNull(this.uint256),s:ht.allowNull(this.uint256),v:ht.allowNull(a),creates:ht.allowNull(e,null),raw:ht.allowNull(i)},t.transactionRequest={from:ht.allowNull(e),nonce:ht.allowNull(a),gasLimit:ht.allowNull(r),gasPrice:ht.allowNull(r),maxPriorityFeePerGas:ht.allowNull(r),maxFeePerGas:ht.allowNull(r),to:ht.allowNull(e),value:ht.allowNull(r),data:ht.allowNull((t=>this.data(t,!0))),type:ht.allowNull(a),accessList:ht.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:o,address:e,topics:ht.arrayOf(o),data:i,logIndex:a,blockHash:o},t.receipt={to:ht.allowNull(this.address,null),from:ht.allowNull(this.address,null),contractAddress:ht.allowNull(e,null),transactionIndex:a,root:ht.allowNull(s),gasUsed:r,logsBloom:ht.allowNull(i),blockHash:o,transactionHash:o,logs:ht.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:ht.allowNull(a,null),cumulativeGasUsed:r,effectiveGasPrice:ht.allowNull(r),status:ht.allowNull(a),type:u},t.block={hash:ht.allowNull(o),parentHash:o,number:a,timestamp:a,nonce:ht.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:ht.allowNull(e),extraData:i,transactions:ht.allowNull(ht.arrayOf(o)),baseFeePerGas:ht.allowNull(r)},t.blockWithTransactions=(0,m.DC)(t.block),t.blockWithTransactions.transactions=ht.allowNull(ht.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:ht.allowNull(n,void 0),toBlock:ht.allowNull(n,void 0),blockHash:ht.allowNull(o,void 0),address:ht.allowNull(e,void 0),topics:ht.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:ht.allowNull(a),blockHash:ht.allowNull(o),transactionIndex:a,removed:ht.allowNull(this.boolean.bind(this)),address:e,data:ht.allowFalsish(i,"0x"),topics:ht.arrayOf(o),transactionHash:o,logIndex:a},t}accessList(t){return(0,g.z7)(t||[])}number(t){return"0x"===t?0:d.O$.from(t).toNumber()}type(t){return"0x"===t||null==t?0:d.O$.from(t).toNumber()}bigNumber(t){return d.O$.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),(0,p.A7)(t))?t.toLowerCase():lt.throwArgumentError("invalid hash","value",t)}data(t,e){const r=this.hex(t,e);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+t);return r}address(t){return(0,f.Kn)(t)}callAddress(t){if(!(0,p.A7)(t,32))return null;const e=(0,f.Kn)((0,p.p3)(t,12));return e===Y.d?null:e}contractAddress(t){return(0,f.CR)(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";switch(t){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return t}if("number"==typeof t||(0,p.A7)(t))return(0,p.$P)(t);throw new Error("invalid blockTag")}hash(t,e){const r=this.hex(t,e);return 32!==(0,p.E1)(r)?lt.throwArgumentError("invalid hash","value",t):r}difficulty(t){if(null==t)return null;const e=d.O$.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!(0,p.A7)(t))throw new Error("invalid uint256");return(0,p.$m)(t,32)}_block(t,e){null!=t.author&&null==t.miner&&(t.miner=t.author);const r=null!=t._difficulty?t._difficulty:t.difficulty,n=ht.check(e,t);return n._difficulty=null==r?null:d.O$.from(r),n}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return ht.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&d.O$.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1!==t.type&&2!==t.type||null!=t.accessList||(t.accessList=[]);const e=ht.check(this.formats.transaction,t);if(null!=t.chainId){let r=t.chainId;(0,p.A7)(r)&&(r=d.O$.from(r).toNumber()),e.chainId=r}else{let r=t.networkId;null==r&&null==e.v&&(r=t.chainId),(0,p.A7)(r)&&(r=d.O$.from(r).toNumber()),"number"!=typeof r&&null!=e.v&&(r=(e.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),e.chainId=r}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return(0,g.Qc)(t)}receiptLog(t){return ht.check(this.formats.receiptLog,t)}receipt(t){const e=ht.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=d.O$.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&<.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):lt.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&<.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map((t=>this.topics(t))):null!=t?this.hash(t,!0):null}filter(t){return ht.check(this.formats.filter,t)}filterLog(t){return ht.check(this.formats.filterLog,t)}static check(t,e){const r={};for(const n in t)try{const i=t[n](e[n]);void 0!==i&&(r[n]=i)}catch(t){throw t.checkKey=n,t.checkValue=e[n],t}return r}static allowNull(t,e){return function(r){return null==r?e:t(r)}}static allowFalsish(t,e){return function(r){return r?t(r):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const r=[];return e.forEach((function(e){r.push(t(e))})),r}}}function ct(t){return t&&"function"==typeof t.isCommunityResource}function ft(t){return ct(t)&&t.isCommunityResource()}let dt=!1;function pt(){dt||(dt=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var mt=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const gt=new v.Yd(ut);function vt(t){return null==t?"null":(32!==(0,p.E1)(t)&>.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function yt(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map((t=>{if(Array.isArray(t)){const e={};t.forEach((t=>{e[vt(t)]=!0}));const r=Object.keys(e);return r.sort(),r.join("|")}return vt(t)})).join("&")}function bt(t){if("string"==typeof t){if(t=t.toLowerCase(),32===(0,p.E1)(t))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+yt(t);if(h.Sg.isForkEvent(t))throw gt.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+yt(t.topics||[])}throw new Error("invalid event - "+t)}function wt(){return(new Date).getTime()}function Et(t){return new Promise((e=>{setTimeout(e,t)}))}const Mt=["block","network","pending","poll"];class At{constructor(t,e,r){(0,m.zG)(this,"tag",t),(0,m.zG)(this,"listener",e),(0,m.zG)(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],r=""===(n=t[2])?[]:n.split(/&/g).map((t=>{if(""===t)return[];const e=t.split("|").map((t=>"null"===t?null:t));return 1===e.length?e[0]:e}));var n;const i={};return r.length>0&&(i.topics=r),e&&"*"!==e&&(i.address=e),i}pollable(){return this.tag.indexOf(":")>=0||Mt.indexOf(this.tag)>=0}}const _t={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Nt(t){return(0,p.$m)(d.O$.from(t).toHexString(),32)}function St(t){return et.eU.encode((0,p.zo)([t,(0,p.p3)((0,nt.JQ)((0,nt.JQ)(t)),0,4)]))}const Tt=new RegExp("^(ipfs)://(.*)$","i"),kt=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Tt,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Rt(t,e){try{return(0,it.ZN)(xt(t,e))}catch(t){}return null}function xt(t,e){if("0x"===t)return null;const r=d.O$.from((0,p.p3)(t,e,e+32)).toNumber(),n=d.O$.from((0,p.p3)(t,r,r+32)).toNumber();return(0,p.p3)(t,r+32,r+32+n)}function Ot(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):gt.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function It(t){const e=(0,p.lE)(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function Ct(t){if(t.length%32==0)return t;const e=new Uint8Array(32*Math.ceil(t.length/32));return e.set(t),e}function Pt(t){const e=[];let r=0;for(let n=0;nd.O$.from(t).eq(1))).catch((t=>{if(t.code===v.Yd.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t}))),this._supportsEip2544}_fetch(t,e){return mt(this,void 0,void 0,(function*(){const r={to:this.address,ccipReadEnabled:!0,data:(0,p.xs)([t,(0,rt.VM)(this.name),e||"0x"])};let n=!1;(yield this.supportsWildcard())&&(n=!0,r.data=(0,p.xs)(["0x9061b923",Pt([(0,rt.Kn)(this.name),r.data])]));try{let t=yield this.provider.call(r);return(0,p.lE)(t).length%32==4&>.throwError("resolver threw error",v.Yd.errors.CALL_EXCEPTION,{transaction:r,data:t}),n&&(t=xt(t,0)),t}catch(t){if(t.code===v.Yd.errors.CALL_EXCEPTION)return null;throw t}}))}_fetchBytes(t,e){return mt(this,void 0,void 0,(function*(){const r=yield this._fetch(t,e);return null!=r?xt(r,0):null}))}_getAddress(t,e){const r=_t[String(t)];if(null==r&>.throwError(`unsupported coin type: ${t}`,v.Yd.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===r.ilk)return this.provider.formatter.address(e);const n=(0,p.lE)(e);if(null!=r.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return St((0,p.zo)([[r.p2pkh],"0x"+t[2]]))}}if(null!=r.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return St((0,p.zo)([[r.p2sh],"0x"+t[2]]))}}if(null!=r.prefix){const t=n[1];let e=n[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&n.length===2+t&&t>=1&&t<=75){const t=at().toWords(n.slice(2));return t.unshift(e),at().encode(r.prefix,t)}}return null}getAddress(t){return mt(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t)try{const t=yield this._fetch("0x3b3b57de");return"0x"===t||t===X.R?null:this.provider.formatter.callAddress(t)}catch(t){if(t.code===v.Yd.errors.CALL_EXCEPTION)return null;throw t}const e=yield this._fetchBytes("0xf1cb7e06",Nt(t));if(null==e||"0x"===e)return null;const r=this._getAddress(t,e);return null==r&>.throwError("invalid or unsupported coin data",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),r}))}getAvatar(){return mt(this,void 0,void 0,(function*(){const t=[{type:"name",content:this.name}];try{const e=yield this.getText("avatar");if(null==e)return null;for(let r=0;rt[e]))}return gt.throwError("invalid or unsupported content hash data",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})}))}getText(t){return mt(this,void 0,void 0,(function*(){let e=(0,it.Y0)(t);e=(0,p.zo)([Nt(64),Nt(e.length),e]),e.length%32!=0&&(e=(0,p.zo)([e,(0,p.$m)("0x",32-t.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",(0,p.Dv)(e));return null==r||"0x"===r?null:(0,it.ZN)(r)}))}}let Ut=null,Bt=1;class Dt extends h.zt{constructor(t){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),(0,m.zG)(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch((t=>{})),this._ready().catch((t=>{}));else{const e=(0,m.tu)(new.target,"getNetwork")(t);e?((0,m.zG)(this,"_network",e),this.emit("network",e,null)):gt.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return mt(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||gt.throwError("no network detected",v.Yd.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:(0,m.zG)(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return(0,ot.$l)((()=>this._ready().then((t=>t),(t=>{if(t.code!==v.Yd.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))))}static getFormatter(){return null==Ut&&(Ut=new ht),Ut}static getNetwork(t){return(0,Q.H)(null==t?"homestead":t)}ccipReadFetch(t,e,r){return mt(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===r.length)return null;const n=t.to.toLowerCase(),i=e.toLowerCase(),o=[];for(let t=0;t=0?null:JSON.stringify({data:i,sender:n}),u=yield(0,ot.rd)({url:s,errorPassThrough:!0},a,((t,e)=>(t.status=e.statusCode,t)));if(u.data)return u.data;const l=u.message||"unknown error";if(u.status>=400&&u.status<500)return gt.throwError(`response not found during CCIP fetch: ${l}`,v.Yd.errors.SERVER_ERROR,{url:e,errorMessage:l});o.push(l)}return gt.throwError(`error encountered during CCIP fetch: ${o.map((t=>JSON.stringify(t))).join(", ")}`,v.Yd.errors.SERVER_ERROR,{urls:r,errorMessages:o})}))}_getInternalBlockNumber(t){return mt(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const r=yield e;if(wt()-r.respTime<=t)return r.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=wt(),r=(0,m.mE)({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((t=>null),(t=>t))}).then((({blockNumber:t,networkError:n})=>{if(n)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),n;const i=wt();return(t=d.O$.from(t).toNumber()){this._internalBlockNumber===r&&(this._internalBlockNumber=null)})),(yield r).blockNumber}))}poll(){return mt(this,void 0,void 0,(function*(){const t=Bt++,e=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(r),this.emit("poll",t,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)gt.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",gt.makeError("network block skew detected",v.Yd.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let t=this._emitted.block+1;t<=r;t++)this.emit("block",t);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach((t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&r-e>12&&delete this._emitted[t]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach((t=>{switch(t.type){case"tx":{const r=t.hash;let n=this.getTransactionReceipt(r).then((t=>t&&null!=t.blockNumber?(this._emitted["t:"+r]=t.blockNumber,this.emit(r,t),null):null)).catch((t=>{this.emit("error",t)}));e.push(n);break}case"filter":if(!t._inflight){t._inflight=!0,-2===t._lastBlockNumber&&(t._lastBlockNumber=r-1);const n=t.filter;n.fromBlock=t._lastBlockNumber+1,n.toBlock=r;const i=n.toBlock-this._maxFilterBlockRange;i>n.fromBlock&&(n.fromBlock=i),n.fromBlock<0&&(n.fromBlock=0);const o=this.getLogs(n).then((e=>{t._inflight=!1,0!==e.length&&e.forEach((e=>{e.blockNumber>t._lastBlockNumber&&(t._lastBlockNumber=e.blockNumber),this._emitted["b:"+e.blockHash]=e.blockNumber,this._emitted["t:"+e.transactionHash]=e.blockNumber,this.emit(n,e)}))})).catch((e=>{this.emit("error",e),t._inflight=!1}));e.push(o)}}})),this._lastBlockNumber=r,Promise.all(e).then((()=>{this.emit("didPoll",t)})).catch((t=>{this.emit("error",t)}))}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return mt(this,void 0,void 0,(function*(){return gt.throwError("provider does not support network detection",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return mt(this,void 0,void 0,(function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",e,t),yield Et(0),this._network;const r=gt.makeError("underlying network changed",v.Yd.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",r),r}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((t=>{this._setFastBlockNumber(t)}),(t=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const t=wt();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&tthis._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,r){return mt(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==e?1:e,r||0,null)}))}_waitForTransaction(t,e,r,n){return mt(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(t);return(i?i.confirmations:0)>=e?i:new Promise(((i,o)=>{const s=[];let a=!1;const u=function(){return!!a||(a=!0,s.forEach((t=>{t()})),!1)},l=t=>{t.confirmations{this.removeListener(t,l)})),n){let r=n.startBlock,i=null;const l=s=>mt(this,void 0,void 0,(function*(){a||(yield Et(1e3),this.getTransactionCount(n.from).then((h=>mt(this,void 0,void 0,(function*(){if(!a){if(h<=n.nonce)r=s;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==i&&(i=r-3,i{a||this.once("block",l)})))}));if(a)return;this.once("block",l),s.push((()=>{this.removeListener("block",l)}))}if("number"==typeof r&&r>0){const t=setTimeout((()=>{u()||o(gt.makeError("timeout exceeded",v.Yd.errors.TIMEOUT,{timeout:r}))}),r);t.unref&&t.unref(),s.push((()=>{clearTimeout(t)}))}}))}))}getBlockNumber(){return mt(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return d.O$.from(t)}catch(e){return gt.throwError("bad result from backend",v.Yd.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}}))}getBalance(t,e){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,m.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getBalance",r);try{return d.O$.from(n)}catch(t){return gt.throwError("bad result from backend",v.Yd.errors.SERVER_ERROR,{method:"getBalance",params:r,result:n,error:t})}}))}getTransactionCount(t,e){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,m.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getTransactionCount",r);try{return d.O$.from(n).toNumber()}catch(t){return gt.throwError("bad result from backend",v.Yd.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:n,error:t})}}))}getCode(t,e){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,m.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getCode",r);try{return(0,p.Dv)(n)}catch(t){return gt.throwError("bad result from backend",v.Yd.errors.SERVER_ERROR,{method:"getCode",params:r,result:n,error:t})}}))}getStorageAt(t,e,r){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield(0,m.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(r),position:Promise.resolve(e).then((t=>(0,p.$P)(t)))}),i=yield this.perform("getStorageAt",n);try{return(0,p.Dv)(i)}catch(t){return gt.throwError("bad result from backend",v.Yd.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:i,error:t})}}))}_wrapTransaction(t,e,r){if(null!=e&&32!==(0,p.E1)(e))throw new Error("invalid response - sendTransaction");const n=t;return null!=e&&t.hash!==e&>.throwError("Transaction hash mismatch from Provider.sendTransaction.",v.Yd.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),n.wait=(e,n)=>mt(this,void 0,void 0,(function*(){let i;null==e&&(e=1),null==n&&(n=0),0!==e&&null!=r&&(i={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:r});const o=yield this._waitForTransaction(t.hash,e,n,i);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&>.throwError("transaction failed",v.Yd.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),n}sendTransaction(t){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then((t=>(0,p.Dv)(t))),r=this.formatter.transaction(t);null==r.confirmations&&(r.confirmations=0);const n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(r,t,n)}catch(t){throw t.transaction=r,t.transactionHash=r.hash,t}}))}_getTransactionRequest(t){return mt(this,void 0,void 0,(function*(){const e=yield t,r={};return["from","to"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?this._getAddress(t):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?d.O$.from(t):null)))})),["type"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>null!=t?t:null)))})),e.accessList&&(r.accessList=this.formatter.accessList(e.accessList)),["data"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?(0,p.Dv)(t):null)))})),this.formatter.transactionRequest(yield(0,m.mE)(r))}))}_getFilter(t){return mt(this,void 0,void 0,(function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach((r=>{null!=t[r]&&(e[r]=t[r])})),["fromBlock","toBlock"].forEach((r=>{null!=t[r]&&(e[r]=this._getBlockTag(t[r]))})),this.formatter.filter(yield(0,m.mE)(e))}))}_call(t,e,r){return mt(this,void 0,void 0,(function*(){r>=10&>.throwError("CCIP read exceeded maximum redirections",v.Yd.errors.SERVER_ERROR,{redirects:r,transaction:t});const n=t.to,i=yield this.perform("call",{transaction:t,blockTag:e});if(r>=0&&"latest"===e&&null!=n&&"0x556f1830"===i.substring(0,10)&&(0,p.E1)(i)%32==4)try{const o=(0,p.p3)(i,4),s=(0,p.p3)(o,0,32);d.O$.from(s).eq(n)||gt.throwError("CCIP Read sender did not match",v.Yd.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i});const a=[],u=d.O$.from((0,p.p3)(o,32,64)).toNumber(),l=d.O$.from((0,p.p3)(o,u,u+32)).toNumber(),h=(0,p.p3)(o,u+32);for(let e=0;emt(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",n);if(null==t)return null!=n.blockHash&&null==this._emitted["b:"+n.blockHash]||null!=n.blockTag&&r>this._emitted.block?null:void 0;if(e){let e=null;for(let r=0;rthis._wrapTransaction(t))),r}return this.formatter.block(t)}))),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return mt(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return(0,ot.$l)((()=>mt(this,void 0,void 0,(function*(){const r=yield this.perform("getTransaction",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;const n=this.formatter.transactionResponse(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return this._wrapTransaction(n)}))),{oncePoll:this})}))}getTransactionReceipt(t){return mt(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return(0,ot.$l)((()=>mt(this,void 0,void 0,(function*(){const r=yield this.perform("getTransactionReceipt",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;if(null==r.blockHash)return;const n=this.formatter.receipt(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return n}))),{oncePoll:this})}))}getLogs(t){return mt(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield(0,m.mE)({filter:this._getFilter(t)}),r=yield this.perform("getLogs",e);return r.forEach((t=>{null==t.removed&&(t.removed=!1)})),ht.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return mt(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return mt(this,void 0,void 0,(function*(){if("number"==typeof(t=yield t)&&t<0){t%1&>.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)}))}getResolver(t){return mt(this,void 0,void 0,(function*(){let e=t;for(;;){if(""===e||"."===e)return null;if("eth"!==t&&"eth"===e)return null;const r=yield this._getResolver(e,"getResolver");if(null!=r){const n=new Lt(this,r,t);return e===t||(yield n.supportsWildcard())?n:null}e=e.split(".").slice(1).join(".")}}))}_getResolver(t,e){return mt(this,void 0,void 0,(function*(){null==e&&(e="ENS");const r=yield this.getNetwork();r.ensAddress||gt.throwError("network does not support ENS",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:e,network:r.name});try{const e=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+(0,rt.VM)(t).substring(2)});return this.formatter.callAddress(e)}catch(t){}return null}))}resolveName(t){return mt(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if((0,p.A7)(t))throw e}"string"!=typeof t&>.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null}))}lookupAddress(t){return mt(this,void 0,void 0,(function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(e,"lookupAddress");if(null==r)return null;const n=Rt(yield this.call({to:r,data:"0x691f3431"+(0,rt.VM)(e).substring(2)}),0);return(yield this.resolveName(n))!=t?null:n}))}getAvatar(t){return mt(this,void 0,void 0,(function*(){let e=null;if((0,p.A7)(t)){const r=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"getAvatar");if(!n)return null;e=new Lt(this,n,r);try{const t=yield e.getAvatar();if(t)return t.url}catch(t){if(t.code!==v.Yd.errors.CALL_EXCEPTION)throw t}try{const t=Rt(yield this.call({to:n,data:"0x691f3431"+(0,rt.VM)(r).substring(2)}),0);e=yield this.getResolver(t)}catch(t){if(t.code!==v.Yd.errors.CALL_EXCEPTION)throw t;return null}}else if(e=yield this.getResolver(t),!e)return null;const r=yield e.getAvatar();return null==r?null:r.url}))}perform(t,e){return gt.throwError(t+" not implemented",v.Yd.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_stopEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_addEventListener(t,e,r){const n=new At(bt(t),e,r);return this._events.push(n),this._startEvent(n),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let r=!1,n=[],i=bt(t);return this._events=this._events.filter((t=>t.tag!==i||(setTimeout((()=>{t.listener.apply(this,e)}),0),r=!0,!t.once||(n.push(t),!1)))),n.forEach((t=>{this._stopEvent(t)})),r}listenerCount(t){if(!t)return this._events.length;let e=bt(t);return this._events.filter((t=>t.tag===e)).length}listeners(t){if(null==t)return this._events.map((t=>t.listener));let e=bt(t);return this._events.filter((t=>t.tag===e)).map((t=>t.listener))}off(t,e){if(null==e)return this.removeAllListeners(t);const r=[];let n=!1,i=bt(t);return this._events=this._events.filter((t=>t.tag!==i||t.listener!=e||!!n||(n=!0,r.push(t),!1))),r.forEach((t=>{this._stopEvent(t)})),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const r=bt(t);this._events=this._events.filter((t=>t.tag!==r||(e.push(t),!1)))}return e.forEach((t=>{this._stopEvent(t)})),this}}var Ft=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Gt=new v.Yd(ut),jt=["call","estimateGas"];function qt(t,e){if(null==t)return null;if("string"==typeof t.message&&t.message.match("reverted")){const r=(0,p.A7)(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if("object"==typeof t){for(const r in t){const n=qt(t[r],e);if(n)return n}return null}if("string"==typeof t)try{return qt(JSON.parse(t),e)}catch(t){}return null}function zt(t,e,r){const n=r.transaction||r.signedTransaction;if("call"===t){const t=qt(e,!0);if(t)return t.data;Gt.throwError("missing revert data in call exception; Transaction reverted without a reason string",v.Yd.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if("estimateGas"===t){let r=qt(e.body,!1);null==r&&(r=qt(e,!1)),r&&Gt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",v.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{reason:r.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===v.Yd.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?i=e.error.message:"string"==typeof e.body?i=e.body:"string"==typeof e.responseText&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&Gt.throwError("insufficient funds for intrinsic transaction cost",v.Yd.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&Gt.throwError("nonce has already been used",v.Yd.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&Gt.throwError("replacement fee too low",v.Yd.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&Gt.throwError("legacy pre-eip-155 transactions not supported",v.Yd.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),jt.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&Gt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",v.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Kt(t){return new Promise((function(e){setTimeout(e,t)}))}function Ht(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function $t(t){return t?t.toLowerCase():t}const Vt={};class Wt extends c.E{constructor(t,e,r){if(super(),t!==Vt)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");(0,m.zG)(this,"provider",e),null==r&&(r=0),"string"==typeof r?((0,m.zG)(this,"_address",this.provider.formatter.address(r)),(0,m.zG)(this,"_index",null)):"number"==typeof r?((0,m.zG)(this,"_index",r),(0,m.zG)(this,"_address",null)):Gt.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(t){return Gt.throwError("cannot alter JSON-RPC Signer connection",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Yt(Vt,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((t=>(t.length<=this._index&&Gt.throwError("unknown account #"+this._index,v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index]))))}sendUncheckedTransaction(t){t=(0,m.DC)(t);const e=this.getAddress().then((t=>(t&&(t=t.toLowerCase()),t)));if(null==t.gasLimit){const r=(0,m.DC)(t);r.from=e,t.gasLimit=this.provider.estimateGas(r)}return null!=t.to&&(t.to=Promise.resolve(t.to).then((t=>Ft(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.provider.resolveName(t);return null==e&&Gt.throwArgumentError("provided ENS name resolves to null","tx.to",t),e}))))),(0,m.mE)({tx:(0,m.mE)(t),sender:e}).then((({tx:e,sender:r})=>{null!=e.from?e.from.toLowerCase()!==r&&Gt.throwArgumentError("from address mismatch","transaction",t):e.from=r;const n=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[n]).then((t=>t),(t=>("string"==typeof t.message&&t.message.match(/user denied/i)&&Gt.throwError("user rejected transaction",v.Yd.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:e}),zt("sendTransaction",t,n))))}))}signTransaction(t){return Gt.throwError("signing transactions is unsupported",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return Ft(this,void 0,void 0,(function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(t);try{return yield(0,ot.$l)((()=>Ft(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(r);if(null!==t)return this.provider._wrapTransaction(t,r,e)}))),{oncePoll:this.provider})}catch(t){throw t.transactionHash=r,t}}))}signMessage(t){return Ft(this,void 0,void 0,(function*(){const e="string"==typeof t?(0,it.Y0)(t):t,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[(0,p.Dv)(e),r.toLowerCase()])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&Gt.throwError("user rejected signing",v.Yd.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:t}),e}}))}_legacySignMessage(t){return Ft(this,void 0,void 0,(function*(){const e="string"==typeof t?(0,it.Y0)(t):t,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),(0,p.Dv)(e)])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&Gt.throwError("user rejected signing",v.Yd.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:t}),e}}))}_signTypedData(t,e,r){return Ft(this,void 0,void 0,(function*(){const n=yield B.E.resolveNames(t,e,r,(t=>this.provider.resolveName(t))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(B.E.getPayload(n.domain,e,n.value))])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&Gt.throwError("user rejected signing",v.Yd.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:n.domain,types:e,value:n.value}}),t}}))}unlock(t){return Ft(this,void 0,void 0,(function*(){const e=this.provider,r=yield this.getAddress();return e.send("personal_unlockAccount",[r.toLowerCase(),t,null])}))}}class Yt extends Wt{sendTransaction(t){return this.sendUncheckedTransaction(t).then((t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)})))}}const Jt={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Xt extends Dt{constructor(t,e){let r=e;null==r&&(r=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then((e=>{t(e)}),(t=>{e(t)}))}),0)}))),super(r),t||(t=(0,m.tu)(this.constructor,"defaultUrl")()),"string"==typeof t?(0,m.zG)(this,"connection",Object.freeze({url:t})):(0,m.zG)(this,"connection",Object.freeze((0,m.DC)(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Ft(this,void 0,void 0,(function*(){yield Kt(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=(0,m.tu)(this.constructor,"getNetwork");try{return e(d.O$.from(t).toNumber())}catch(e){return Gt.throwError("could not detect network",v.Yd.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return Gt.throwError("could not detect network",v.Yd.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new Wt(Vt,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((t=>t.map((t=>this.formatter.address(t)))))}send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:(0,m.p$)(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(n&&this._cache[t])return this._cache[t];const i=(0,ot.rd)(this.connection,JSON.stringify(r),Ht).then((t=>(this.emit("debug",{action:"response",request:r,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",error:t,request:r,provider:this}),t}));return n&&(this._cache[t]=i,setTimeout((()=>{this._cache[t]=null}),0)),i}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[$t(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[$t(e.address),e.blockTag]];case"getCode":return["eth_getCode",[$t(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[$t(e.address),(0,p.$m)(e.position,32),e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[(0,m.tu)(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[(0,m.tu)(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=$t(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return Ft(this,void 0,void 0,(function*(){if("call"===t||"estimateGas"===t){const t=e.transaction;if(t&&null!=t.type&&d.O$.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((e=(0,m.DC)(e)).transaction=(0,m.DC)(t),delete e.transaction.type)}}const r=this.prepareRequest(t,e);null==r&&Gt.throwError(t+" not implemented",v.Yd.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(r[0],r[1])}catch(r){return zt(t,r,e)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then((function(r){return function n(){t.send("eth_getFilterChanges",[r]).then((function(r){if(t._pendingFilter!=e)return null;let n=Promise.resolve();return r.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",n=n.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),n.then((function(){return Kt(1e3)}))})).then((function(){if(t._pendingFilter==e)return setTimeout((function(){n()}),0),null;t.send("eth_uninstallFilter",[r])})).catch((t=>{}))}(),r})).catch((t=>{}))}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const r=(0,m.DC)(Jt);if(e)for(const t in e)e[t]&&(r[t]=!0);(0,m.uj)(t,r);const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(e){if(null==t[e])return;const r=(0,p.$P)(d.O$.from(t[e]));"gasLimit"===e&&(e="gas"),n[e]=r})),["from","to","data"].forEach((function(e){null!=t[e]&&(n[e]=(0,p.Dv)(t[e]))})),t.accessList&&(n.accessList=(0,g.z7)(t.accessList)),n}}let Zt=null;try{if(Zt=WebSocket,null==Zt)throw new Error("inject please")}catch(t){const e=new v.Yd(ut);Zt=function(){e.throwError("WebSockets not supported in this environment",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var Qt=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const te=new v.Yd(ut);let ee=1;class re extends Xt{constructor(t,e){"any"===e&&te.throwError("WebSocketProvider does not support 'any' network yet",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),super("string"==typeof t?t:"_websocket",e),this._pollingInterval=-1,this._wsReady=!1,"string"==typeof t?(0,m.zG)(this,"_websocket",new Zt(this.connection.url)):(0,m.zG)(this,"_websocket",t),(0,m.zG)(this,"_requests",{}),(0,m.zG)(this,"_subs",{}),(0,m.zG)(this,"_subIds",{}),(0,m.zG)(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach((t=>{this.websocket.send(this._requests[t].payload)}))},this.websocket.onmessage=t=>{const e=t.data,r=JSON.parse(e);if(null!=r.id){const t=String(r.id),n=this._requests[t];if(delete this._requests[t],void 0!==r.result)n.callback(null,r.result),this.emit("debug",{action:"response",request:JSON.parse(n.payload),response:r.result,provider:this});else{let t=null;r.error?(t=new Error(r.error.message||"unknown error"),(0,m.zG)(t,"code",r.error.code||null),(0,m.zG)(t,"response",e)):t=new Error("unknown error"),n.callback(t,void 0),this.emit("debug",{action:"response",error:t,request:JSON.parse(n.payload),provider:this})}}else if("eth_subscription"===r.method){const t=this._subs[r.params.subscription];t&&t.processFunc(r.params.result)}else console.warn("this should not happen")};const r=setInterval((()=>{this.emit("poll")}),1e3);r.unref&&r.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(t){te.throwError("cannot reset events block on WebSocketProvider",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(t){te.throwError("cannot set polling interval on WebSocketProvider",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return Qt(this,void 0,void 0,(function*(){return null}))}set polling(t){t&&te.throwError("cannot set polling on WebSocketProvider",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(t,e){const r=ee++;return new Promise(((n,i)=>{const o=JSON.stringify({method:t,params:e,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(o),provider:this}),this._requests[String(r)]={callback:function(t,e){return t?i(t):n(e)},payload:o},this._wsReady&&this.websocket.send(o)}))}static defaultUrl(){return"ws://localhost:8546"}_subscribe(t,e,r){return Qt(this,void 0,void 0,(function*(){let n=this._subIds[t];null==n&&(n=Promise.all(e).then((t=>this.send("eth_subscribe",t))),this._subIds[t]=n);const i=yield n;this._subs[i]={tag:t,processFunc:r}}))}_startEvent(t){switch(t.type){case"block":this._subscribe("block",["newHeads"],(t=>{const e=d.O$.from(t.number).toNumber();this._emitted.block=e,this.emit("block",e)}));break;case"pending":this._subscribe("pending",["newPendingTransactions"],(t=>{this.emit("pending",t)}));break;case"filter":this._subscribe(t.tag,["logs",this._getFilter(t.filter)],(e=>{null==e.removed&&(e.removed=!1),this.emit(t.filter,this.formatter.filterLog(e))}));break;case"tx":{const e=t=>{const e=t.hash;this.getTransactionReceipt(e).then((t=>{t&&this.emit(e,t)}))};e(t),this._subscribe("tx",["newHeads"],(t=>{this._events.filter((t=>"tx"===t.type)).forEach(e)}));break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",t)}}_stopEvent(t){let e=t.tag;if("tx"===t.type){if(this._events.filter((t=>"tx"===t.type)).length)return;e="tx"}else if(this.listenerCount(t.event))return;const r=this._subIds[e];r&&(delete this._subIds[e],r.then((t=>{this._subs[t]&&(delete this._subs[t],this.send("eth_unsubscribe",[t]))})))}destroy(){return Qt(this,void 0,void 0,(function*(){this.websocket.readyState===Zt.CONNECTING&&(yield new Promise((t=>{this.websocket.onopen=function(){t(!0)},this.websocket.onerror=function(){t(!1)}}))),this.websocket.close(1e3)}))}}const ne=new v.Yd(ut);class ie extends Xt{detectNetwork(){const t=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return e=this,r=void 0,i=function*(){let e=this.network;return null==e&&(e=yield t.detectNetwork.call(this),e||ne.throwError("no network detected",v.Yd.errors.UNKNOWN_ERROR,{}),null==this._network&&((0,m.zG)(this,"_network",e),this.emit("network",e,null))),e},new((n=void 0)||(n=Promise))((function(t,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(t){t(r)}))).then(s,a)}u((i=i.apply(e,r||[])).next())}));var e,r,n,i}}class oe extends ie{constructor(t,e){ne.checkAbstract(new.target,oe),t=(0,m.tu)(new.target,"getNetwork")(t),e=(0,m.tu)(new.target,"getApiKey")(e),super((0,m.tu)(new.target,"getUrl")(t,e),t),"string"==typeof e?(0,m.zG)(this,"apiKey",e):null!=e&&Object.keys(e).forEach((t=>{(0,m.zG)(this,t,e[t])}))}_startPending(){ne.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(t){return ne.throwError("API provider does not support signing",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(t){return t}static getUrl(t,e){return ne.throwError("not implemented; sub-classes must override getUrl",v.Yd.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const se=new v.Yd(ut),ae="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class ue extends re{constructor(t,e){const r=new le(t,e);super(r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi."),r.network),(0,m.zG)(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===ae}}class le extends oe{static getWebSocketProvider(t,e){return new ue(t,e)}static getApiKey(t){return null==t?ae:(t&&"string"!=typeof t&&se.throwArgumentError("invalid apiKey","apiKey",t),t)}static getUrl(t,e){let r=null;switch(t.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.g.alchemy.com/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":r="arb-goerli.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":r="opt-goerli.g.alchemy.com/v2/";break;default:se.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+e,throttleCallback:(t,r)=>(e===ae&&pt(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===ae}}const he=new v.Yd(ut),ce="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function fe(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return he.throwArgumentError("unsupported network","name",t)}class de extends oe{isCommunityResource(){return this.apiKey===ce}static getApiKey(t){return null==t?ce:t}static getUrl(t,e){null==e&&(e=ce);const r={allowGzip:!0,url:"https://"+fe(t.name)+e,throttleCallback:(t,r)=>(e.apiKey===ce&&pt(),Promise.resolve(!0))};return null!=e.projectSecret&&(r.user="",r.password=e.projectSecret),r}}const pe=new v.Yd(ut);class me extends oe{static getApiKey(t){return null!=t&&pe.throwArgumentError("apiKey not supported for cloudflare","apiKey",t),null}static getUrl(t,e){let r=null;return"homestead"===t.name?r="https://cloudflare-eth.com/":pe.throwArgumentError("unsupported network","network",arguments[0]),r}perform(t,e){const r=Object.create(null,{perform:{get:()=>super.perform}});return n=this,i=void 0,s=function*(){return"getBlockNumber"===t?(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number:r.perform.call(this,t,e)},new((o=void 0)||(o=Promise))((function(t,e){function r(t){try{u(s.next(t))}catch(t){e(t)}}function a(t){try{u(s.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(r,a)}u((s=s.apply(n,i||[])).next())}));var n,i,o,s}}var ge=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const ve=new v.Yd(ut);function ye(t){const e={};for(let r in t){if(null==t[r])continue;let n=t[r];"type"===r&&0===n||(n={type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?(0,p.$P)((0,p.Dv)(n)):"accessList"===r?"["+(0,g.z7)(n).map((t=>`{address:"${t.address}",storageKeys:["${t.storageKeys.join('","')}"]}`)).join(",")+"]":(0,p.Dv)(n),e[r]=n)}return e}function be(t){if(0==t.status&&("No records found"===t.message||"No transactions found"===t.message))return t.result;if(1!=t.status||"string"!=typeof t.message||!t.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function we(t){if(t&&0==t.status&&"NOTOK"==t.message&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if("2.0"!=t.jsonrpc){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function Ee(t){if("pending"===t)throw new Error("pending not supported");return"latest"===t?t:parseInt(t.substring(2),16)}function Me(t,e,r){if("call"===t&&e.code===v.Yd.errors.SERVER_ERROR){const t=e.error;if(t&&(t.message.match(/reverted/i)||t.message.match(/VM execution error/i))){let r=t.data;if(r&&(r="0x"+r.replace(/^.*0x/i,"")),(0,p.A7)(r))return r;ve.throwError("missing revert data in call exception",v.Yd.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===v.Yd.errors.SERVER_ERROR&&(e.error&&"string"==typeof e.error.message?n=e.error.message:"string"==typeof e.body?n=e.body:"string"==typeof e.responseText&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&ve.throwError("insufficient funds for intrinsic transaction cost",v.Yd.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ve.throwError("nonce has already been used",v.Yd.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&ve.throwError("replacement fee too low",v.Yd.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&ve.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",v.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class Ae extends Dt{constructor(t,e){super(t),(0,m.zG)(this,"baseUrl",this.getBaseUrl()),(0,m.zG)(this,"apiKey",e||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return ve.throwArgumentError("unsupported network","network",this.network.name)}getUrl(t,e){const r=Object.keys(e).reduce(((t,r)=>{const n=e[r];return null!=n&&(t+=`&${r}=${n}`),t}),""),n=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${t}${r}${n}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(t,e){return e.module=t,e.apikey=this.apiKey,e}fetch(t,e,r){return ge(this,void 0,void 0,(function*(){const n=r?this.getPostUrl():this.getUrl(t,e),i=r?this.getPostData(t,e):null,o="proxy"===t?we:be;this.emit("debug",{action:"request",request:n,provider:this});const s={url:n,throttleSlotInterval:1e3,throttleCallback:(t,e)=>(this.isCommunityResource()&&pt(),Promise.resolve(!0))};let a=null;i&&(s.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(i).map((t=>`${t}=${i[t]}`)).join("&"));const u=yield(0,ot.rd)(s,a,o||we);return this.emit("debug",{action:"response",request:n,response:(0,m.p$)(u),provider:this}),u}))}detectNetwork(){return ge(this,void 0,void 0,(function*(){return this.network}))}perform(t,e){const r=Object.create(null,{perform:{get:()=>super.perform}});return ge(this,void 0,void 0,(function*(){switch(t){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:e.address,tag:e.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:e.address,tag:e.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:e.address,tag:e.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:e.address,position:e.position,tag:e.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:e.signedTransaction},!0).catch((t=>Me("sendTransaction",t,e.signedTransaction)));case"getBlock":if(e.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:e.blockTag,boolean:e.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:e.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:e.transactionHash});case"call":{if("latest"!==e.blockTag)throw new Error("EtherscanProvider does not support blockTag for call");const t=ye(e.transaction);t.module="proxy",t.action="eth_call";try{return yield this.fetch("proxy",t,!0)}catch(t){return Me("call",t,e.transaction)}}case"estimateGas":{const t=ye(e.transaction);t.module="proxy",t.action="eth_estimateGas";try{return yield this.fetch("proxy",t,!0)}catch(t){return Me("estimateGas",t,e.transaction)}}case"getLogs":{const t={action:"getLogs"};if(e.filter.fromBlock&&(t.fromBlock=Ee(e.filter.fromBlock)),e.filter.toBlock&&(t.toBlock=Ee(e.filter.toBlock)),e.filter.address&&(t.address=e.filter.address),e.filter.topics&&e.filter.topics.length>0&&(e.filter.topics.length>1&&ve.throwError("unsupported topic count",v.Yd.errors.UNSUPPORTED_OPERATION,{topics:e.filter.topics}),1===e.filter.topics.length)){const r=e.filter.topics[0];"string"==typeof r&&66===r.length||ve.throwError("unsupported topic format",v.Yd.errors.UNSUPPORTED_OPERATION,{topic0:r}),t.topic0=r}const r=yield this.fetch("logs",t);let n={};for(let t=0;t{["contractAddress","to"].forEach((function(e){""==t[e]&&delete t[e]})),null==t.creates&&null!=t.contractAddress&&(t.creates=t.contractAddress);const e=this.formatter.transactionResponse(t);return t.timeStamp&&(e.timestamp=parseInt(t.timeStamp)),e}))}))}isCommunityResource(){return null==this.apiKey}}var _e=r(2472),Ne=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};const Se=new v.Yd(ut);function Te(){return(new Date).getTime()}function ke(t){let e=null;for(let r=0;re?null:(n+i)/2}function xe(t){if(null===t)return"null";if("number"==typeof t||"boolean"==typeof t)return JSON.stringify(t);if("string"==typeof t)return t;if(d.O$.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map((t=>xe(t))));if("object"==typeof t){const e=Object.keys(t);return e.sort(),"{"+e.map((e=>{let r=t[e];return r="function"==typeof r?"[function]":xe(r),JSON.stringify(e)+":"+r})).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let Oe=1;function Ie(t){let e=null,r=null,n=new Promise((n=>{e=function(){r&&(clearTimeout(r),r=null),n()},r=setTimeout(e,t)}));return{cancel:e,getPromise:function(){return n},wait:t=>(n=n.then(t),n)}}const Ce=[v.Yd.errors.CALL_EXCEPTION,v.Yd.errors.INSUFFICIENT_FUNDS,v.Yd.errors.NONCE_EXPIRED,v.Yd.errors.REPLACEMENT_UNDERPRICED,v.Yd.errors.UNPREDICTABLE_GAS_LIMIT],Pe=["address","args","errorArgs","errorSignature","method","transaction"];function Le(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function Ue(t,e){return Ne(this,void 0,void 0,(function*(){const r=t.provider;return null!=r.blockNumber&&r.blockNumber>=e||-1===e?r:(0,ot.$l)((()=>new Promise(((n,i)=>{setTimeout((function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)}),0)}))),{oncePoll:r})}))}function Be(t,e,r,n){return Ne(this,void 0,void 0,(function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&(0,p.A7)(n.blockTag)&&(i=yield Ue(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&(0,p.A7)(n.blockTag)&&(i=yield Ue(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&(0,p.A7)(n.blockTag)&&(i=yield Ue(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&(0,p.A7)(n.blockTag)&&(i=yield Ue(t,e)),"call"===r&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let r=n.filter;return(r.fromBlock&&(0,p.A7)(r.fromBlock)||r.toBlock&&(0,p.A7)(r.toBlock))&&(i=yield Ue(t,e)),i.getLogs(r)}}return Se.throwError("unknown method error",v.Yd.errors.UNKNOWN_ERROR,{method:r,params:n})}))}class De extends Dt{constructor(t,e){0===t.length&&Se.throwArgumentError("missing providers","providers",t);const r=t.map(((t,e)=>{if(h.zt.isProvider(t)){const e=ft(t)?2e3:750,r=1;return Object.freeze({provider:t,weight:1,stallTimeout:e,priority:r})}const r=(0,m.DC)(t);null==r.priority&&(r.priority=1),null==r.stallTimeout&&(r.stallTimeout=ft(t)?2e3:750),null==r.weight&&(r.weight=1);const n=r.weight;return(n%1||n>512||n<1)&&Se.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${e}].weight`,n),Object.freeze(r)})),n=r.reduce(((t,e)=>t+e.weight),0);null==e?e=n/2:e>n&&Se.throwArgumentError("quorum will always fail; larger than total weight","quorum",e);let i=ke(r.map((t=>t.provider.network)));null==i&&(i=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then(t,e)}),0)}))),super(i),(0,m.zG)(this,"providerConfigs",Object.freeze(r)),(0,m.zG)(this,"quorum",e),this._highestBlockNumber=-1}detectNetwork(){return Ne(this,void 0,void 0,(function*(){return ke(yield Promise.all(this.providerConfigs.map((t=>t.provider.getNetwork()))))}))}perform(t,e){return Ne(this,void 0,void 0,(function*(){if("sendTransaction"===t){const t=yield Promise.all(this.providerConfigs.map((t=>t.provider.sendTransaction(e.signedTransaction).then((t=>t.hash),(t=>t)))));for(let e=0;et.result));let n=Re(e.map((t=>t.result)),2);if(null!=n)return n=Math.ceil(n),r.indexOf(n+1)>=0&&n++,n>=t._highestBlockNumber&&(t._highestBlockNumber=n),t._highestBlockNumber};case"getGasPrice":return function(t){const e=t.map((t=>t.result));return e.sort(),e[Math.floor(e.length/2)]};case"getEtherPrice":return function(t){return Re(t.map((t=>t.result)))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(t){return null==t?null:((t=(0,m.DC)(t)).confirmations=-1,xe(t))};break;case"getBlock":n=r.includeTransactions?function(t){return null==t?null:((t=(0,m.DC)(t)).transactions=t.transactions.map((t=>((t=(0,m.DC)(t)).confirmations=-1,t))),xe(t))}:function(t){return null==t?null:xe(t)};break;default:throw new Error("unknown method: "+e)}return function(t,e){return function(r){const n={};r.forEach((e=>{const r=t(e.result);n[r]||(n[r]={count:0,result:e.result}),n[r].count++}));const i=Object.keys(n);for(let t=0;t=e)return r.result}}}(n,t.quorum)}(this,t,e),n=(0,_e.y)(this.providerConfigs.map(m.DC));n.sort(((t,e)=>t.priority-e.priority));const i=this._highestBlockNumber;let o=0,s=!0;for(;;){const a=Te();let u=n.filter((t=>t.runner&&a-t.startt+e.weight),0);for(;u{r.staller=null})),r.runner=Be(r,i,t,e).then((n=>{r.done=!0,r.result=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:Le(r,Te()),request:{method:t,params:(0,m.p$)(e)},provider:this})}),(n=>{r.done=!0,r.error=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:Le(r,Te()),request:{method:t,params:(0,m.p$)(e)},provider:this})})),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:Le(r,null),request:{method:t,params:(0,m.p$)(e)},provider:this}),u+=r.weight}const l=[];n.forEach((t=>{!t.done&&t.runner&&(l.push(t.runner),t.staller&&l.push(t.staller.getPromise()))})),l.length&&(yield Promise.race(l));const h=n.filter((t=>t.done&&null==t.error));if(h.length>=this.quorum){const t=r(h);if(void 0!==t)return n.forEach((t=>{t.staller&&t.staller.cancel(),t.cancelled=!0})),t;s||(yield Ie(100).getPromise()),s=!1}const c=n.reduce(((t,e)=>{if(!e.done||null==e.error)return t;const r=e.error.code;return Ce.indexOf(r)>=0&&(t[r]||(t[r]={error:e.error,weight:0}),t[r].weight+=e.weight),t}),{});if(Object.keys(c).forEach((t=>{const e=c[t];if(e.weight{t.staller&&t.staller.cancel(),t.cancelled=!0}));const r=e.error,i={};Pe.forEach((t=>{null!=r[t]&&(i[t]=r[t])})),Se.throwError(r.reason||r.message,t,i)})),0===n.filter((t=>!t.done)).length)break}return n.forEach((t=>{t.staller&&t.staller.cancel(),t.cancelled=!0})),Se.throwError("failed to meet quorum",v.Yd.errors.SERVER_ERROR,{method:t,params:e,results:n.map((t=>Le(t))),provider:this})}))}}const Fe=null,Ge=new v.Yd(ut),je="84842078b09946638c03157f83405213";class qe extends re{constructor(t,e){const r=new ze(t,e),n=r.connection;n.password&&Ge.throwError("INFURA WebSocket project secrets unsupported",v.Yd.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"}),super(n.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/"),t),(0,m.zG)(this,"apiKey",r.projectId),(0,m.zG)(this,"projectId",r.projectId),(0,m.zG)(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===je}}class ze extends oe{static getWebSocketProvider(t,e){return new qe(t,e)}static getApiKey(t){const e={apiKey:je,projectId:je,projectSecret:null};return null==t||("string"==typeof t?e.projectId=t:null!=t.projectSecret?(Ge.assertArgument("string"==typeof t.projectId,"projectSecret requires a projectId","projectId",t.projectId),Ge.assertArgument("string"==typeof t.projectSecret,"invalid projectSecret","projectSecret","[REDACTED]"),e.projectId=t.projectId,e.projectSecret=t.projectSecret):t.projectId&&(e.projectId=t.projectId),e.apiKey=e.projectId),e}static getUrl(t,e){let r=null;switch(t?t.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"goerli":r="goerli.infura.io";break;case"sepolia":r="sepolia.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-goerli":r="optimism-goerli.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":r="arbitrum-goerli.infura.io";break;default:Ge.throwError("unsupported network",v.Yd.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const n={allowGzip:!0,url:"https://"+r+"/v3/"+e.projectId,throttleCallback:(t,r)=>(e.projectId===je&&pt(),Promise.resolve(!0))};return null!=e.projectSecret&&(n.user="",n.password=e.projectSecret),n}isCommunityResource(){return this.projectId===je}}class Ke extends Xt{send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const n={request:r,resolve:null,reject:null},i=new Promise(((t,e)=>{n.resolve=t,n.reject=e}));return this._pendingBatch.push(n),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const e=t.map((t=>t.request));return this.emit("debug",{action:"requestBatch",request:(0,m.p$)(e),provider:this}),(0,ot.rd)(this.connection,JSON.stringify(e)).then((r=>{this.emit("debug",{action:"response",request:e,response:r,provider:this}),t.forEach(((t,e)=>{const n=r[e];if(n.error){const e=new Error(n.error.message);e.code=n.error.code,e.data=n.error.data,t.reject(e)}else t.resolve(n.result)}))}),(r=>{this.emit("debug",{action:"response",error:r,request:e,provider:this}),t.forEach((t=>{t.reject(r)}))}))}),10)),i}}const He=new v.Yd(ut);class $e extends oe{static getApiKey(t){return t&&"string"!=typeof t&&He.throwArgumentError("invalid apiKey","apiKey",t),t||"ETHERS_JS_SHARED"}static getUrl(t,e){He.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(t.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:He.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+e}}const Ve=new v.Yd(ut),We="62e1ad51b37b8e00394bda3b";class Ye extends oe{static getApiKey(t){const e={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return null==t?e.applicationId=We:"string"==typeof t?e.applicationId=t:null!=t.applicationSecretKey?(e.applicationId=t.applicationId,e.applicationSecretKey=t.applicationSecretKey):t.applicationId?e.applicationId=t.applicationId:Ve.throwArgumentError("unsupported PocketProvider apiKey","apiKey",t),e}static getUrl(t,e){let r=null;switch(t?t.name:"unknown"){case"goerli":r="eth-goerli.gateway.pokt.network";break;case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"kovan":r="poa-kovan.gateway.pokt.network";break;case"matic":r="poly-mainnet.gateway.pokt.network";break;case"maticmum":r="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;default:Ve.throwError("unsupported network",v.Yd.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const n={headers:{},url:`https://${r}/v1/lb/${e.applicationId}`};return null!=e.applicationSecretKey&&(n.user="",n.password=e.applicationSecretKey),n}isCommunityResource(){return this.applicationId===We}}const Je=new v.Yd(ut);let Xe=1;function Ze(t,e){const r="Web3LegacyFetcher";return function(t,n){const i={method:t,params:n,id:Xe++,jsonrpc:"2.0"};return new Promise(((t,n)=>{this.emit("debug",{action:"request",fetcher:r,request:(0,m.p$)(i),provider:this}),e(i,((e,o)=>{if(e)return this.emit("debug",{action:"response",fetcher:r,error:e,request:i,provider:this}),n(e);if(this.emit("debug",{action:"response",fetcher:r,request:i,response:o,provider:this}),o.error){const t=new Error(o.error.message);return t.code=o.error.code,t.data=o.error.data,n(t)}t(o.result)}))}))}}class Qe extends Xt{constructor(t,e){null==t&&Je.throwArgumentError("missing provider","provider",t);let r=null,n=null,i=null;"function"==typeof t?(r="unknown:",n=t):(r=t.host||t.path||"",!r&&t.isMetaMask&&(r="metamask"),i=t,t.request?(""===r&&(r="eip-1193:"),n=function(t){return function(e,r){null==r&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:(0,m.p$)(n),provider:this}),t.request(n).then((t=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:t,provider:this}),t}))}}(t)):t.sendAsync?n=Ze(0,t.sendAsync.bind(t)):t.send?n=Ze(0,t.send.bind(t)):Je.throwArgumentError("unsupported provider","provider",t),r||(r="unknown:")),super(r,e),(0,m.zG)(this,"jsonRpcFetchFunc",n),(0,m.zG)(this,"provider",i)}send(t,e){return this.jsonRpcFetchFunc(t,e)}}const tr=new v.Yd(ut);function er(t,e){if(null==t&&(t="homestead"),"string"==typeof t){const e=t.match(/^(ws|http)s?:/i);if(e)switch(e[1].toLowerCase()){case"http":case"https":return new Xt(t);case"ws":case"wss":return new re(t);default:tr.throwArgumentError("unsupported URL scheme","network",t)}}const r=(0,Q.H)(t);return r&&r._defaultProvider||tr.throwError("unsupported getDefaultProvider network",v.Yd.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:De,AlchemyProvider:le,AnkrProvider:de,CloudflareProvider:me,EtherscanProvider:Ae,InfuraProvider:ze,JsonRpcProvider:Xt,NodesmithProvider:$e,PocketProvider:Ye,Web3Provider:Qe,IpcProvider:Fe},e)}var rr=r(9855),nr=r(8659),ir=r(2734),or=r(1388),sr=r(2046),ar=r(7949);const ur=new RegExp("^bytes([0-9]+)$"),lr=new RegExp("^(u?int)([0-9]*)$"),hr=new RegExp("^(.*)\\[([0-9]*)\\]$"),cr="0000000000000000000000000000000000000000000000000000000000000000",fr=new v.Yd("solidity/5.7.0");function dr(t,e,r){switch(t){case"address":return r?(0,p.Bu)(e,32):(0,p.lE)(e);case"string":return(0,it.Y0)(e);case"bytes":return(0,p.lE)(e);case"bool":return e=e?"0x01":"0x00",r?(0,p.Bu)(e,32):(0,p.lE)(e)}let n=t.match(lr);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!=0||0===i||i>256)&&fr.throwArgumentError("invalid number type","type",t),r&&(i=256),e=d.O$.from(e).toTwos(i),(0,p.Bu)(e,i/8)}if(n=t.match(ur),n){const i=parseInt(n[1]);return(String(i)!==n[1]||0===i||i>32)&&fr.throwArgumentError("invalid bytes type","type",t),(0,p.lE)(e).byteLength!==i&&fr.throwArgumentError(`invalid value for ${t}`,"value",e),r?(0,p.lE)((e+cr).substring(0,66)):e}if(n=t.match(hr),n&&Array.isArray(e)){const r=n[1];parseInt(n[2]||String(e.length))!=e.length&&fr.throwArgumentError(`invalid array length for ${t}`,"value",e);const i=[];return e.forEach((function(t){i.push(dr(r,t,!0))})),(0,p.zo)(i)}return fr.throwArgumentError("invalid type","type",t)}function pr(t,e){t.length!=e.length&&fr.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach((function(t,n){r.push(dr(t,e[n]))})),(0,p.Dv)((0,p.zo)(r))}function mr(t,e){return(0,F.w)(pr(t,e))}function gr(t,e){return(0,nt.JQ)(pr(t,e))}var vr=r(1843);function yr(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,n={};return t.split(",").forEach((t=>{let i=t.split(":");r+=parseInt(i[0],16),n[r]=e(i[1])})),n}function br(t){let e=0;return t.split(",").map((t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:n,h:e}}))}function wr(t,e){let r=0;for(let n=0;n=r&&t<=r+i.h&&(t-r)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(t-r))continue;return i}}return null}const Er=br("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),Mr="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((t=>parseInt(t,16))),Ar=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],_r=yr("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Nr=yr("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Sr=yr("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r{if(Mr.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=wr(t,Ar);if(e)return[t+e.s];let r=_r[t];if(r)return r;let n=Nr[t];return n?[t+n[0]]:Sr[t]||null}(t);return e||[t]})),e=r.reduce(((t,e)=>(e.forEach((e=>{t.push(e)})),t)),[]),e=(0,it.XL)((0,it.uu)(e),it.Uj.NFKC),e.forEach((t=>{if(wr(t,Tr))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),e.forEach((t=>{if(wr(t,Er))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=(0,it.uu)(e);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");return n}function Rr(t){const e=(0,it.Y0)(t);if(e.length>31)throw new Error("bytes32 string must be less than 32 bytes");return(0,p.Dv)((0,p.zo)([e,X.R]).slice(0,32))}function xr(t){const e=(0,p.lE)(t);if(32!==e.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==e[31])throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;0===e[r-1];)r--;return(0,it.ZN)(e.slice(0,r))}const Or=new v.Yd("units/5.7.0"),Ir=["wei","kwei","mwei","gwei","szabo","finney","ether"];function Cr(t){const e=String(t).split(".");(e.length>2||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||"."===t||"-."===t)&&Or.throwArgumentError("invalid value","value",t);let r=e[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0");let i="";for(2===e.length&&(i="."+(e[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);const o=[];for(;r.length;){if(r.length<=3){o.unshift(r);break}{const t=r.length-3;o.unshift(r.substring(t)),r=r.substring(0,t)}}return n+o.join(",")+i}function Pr(t,e){if("string"==typeof e){const t=Ir.indexOf(e);-1!==t&&(e=3*t)}return(0,L.S5)(t,null!=e?e:18)}function Lr(t,e){if("string"!=typeof t&&Or.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=Ir.indexOf(e);-1!==t&&(e=3*t)}return(0,L.Ox)(t,null!=e?e:18)}function Ur(t){return Pr(t,18)}function Br(t){return Lr(t,18)}var Dr=r(1261);const Fr="ethers/5.7.2",Gr=new v.Yd(Fr);try{const t=window;null==t._ethers&&(t._ethers=a)}catch(t){}},4376:function(t,e){"use strict";var r=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initBooks=void 0;var n=r(3413),i=document.querySelector("#add-book-modal"),o={placement:"bottom-right",closable:!0,onHide:function(){console.log("modal is hidden")},onShow:function(){console.log("user id: ")},onToggle:function(){console.log("modal has been toggled")}},s=new n.Modal(i,o);e.initBooks=function(){var t=document.querySelector("#modalAddCloseButton");t&&t.addEventListener("click",(function(){s.hide()}))}},8891:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initComments=void 0,e.initComments=function(){var t=document.querySelectorAll("#delete_comment_btn"),e=document.querySelector("#comment_id");t&&e&&t.forEach((function(t){return t.addEventListener("click",(function(){var r=t.getAttribute("data-comment-id");e.value=r}))}));var r=document.querySelectorAll("#edit_comment_btn"),n=document.querySelector("#edit_comment_id"),i=document.querySelector("#edit_comment_text");r&&n&&i&&r.forEach((function(t){return t.addEventListener("click",(function(){var e=t.getAttribute("data-edit-comment-id"),r=t.getAttribute("data-edit-comment-text");n.value=e,i.value=r}))}))}},7086:function(t,e){"use strict";var r=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initQuill=void 0;var n=r(5389);e.initQuill=function(){var t=[["bold","italic","underline"],[{list:"ordered"},{list:"bullet"}],[{header:[1,2,3,4,5,6,!1]}],[{indent:"-1"},{indent:"+1"}],["clean"]];document.querySelectorAll(".quill-editor").forEach((function(e){var r=e.id;r?new n("#"+r,{theme:"snow",modules:{toolbar:t}}):console.error("Please set attribute id to element with class .quill-editor")}))}},8147:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initQuillValueToInput=void 0,e.initQuillValueToInput=function(){document.querySelectorAll(".quill-editor").forEach((function(t){var e=t.id;e?t.addEventListener("DOMSubtreeModified",(function(){!function(t){var e=document.querySelector("#".concat(t,"-input"));if(e){var r=document.querySelector("#"+t).innerHTML;e.value=r}}(e)})):console.error("Please set attribute id to element with class .quill-editor")}))}},5132:function(t,e){"use strict";var r=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initTheme=void 0,e.initTheme=function(){var t=document.querySelectorAll("#theme-toggle-dark-icon"),e=document.querySelectorAll("#theme-toggle-light-icon");"dark"===localStorage.getItem("color-theme")||!("color-theme"in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?e.forEach((function(t){t.classList.remove("hidden")})):t.forEach((function(t){t.classList.remove("hidden")})),document.querySelectorAll("#theme-toggle").forEach((function(r){r.addEventListener("click",(function(){t.forEach((function(t){t.classList.toggle("hidden")})),e.forEach((function(t){t.classList.toggle("hidden")})),localStorage.getItem("color-theme")?"light"===localStorage.getItem("color-theme")?(document.documentElement.classList.add("dark"),localStorage.setItem("color-theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("color-theme","light")):document.documentElement.classList.contains("dark")?(document.documentElement.classList.remove("dark"),localStorage.setItem("color-theme","light")):(document.documentElement.classList.add("dark"),localStorage.setItem("color-theme","dark"))}))}))}},4970:function(t,e){"use strict";var r=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0?e.classList.add("text-green-500"):l<0&&e.classList.add("text-red-500"),h=u.current_user_vote,o(h),[2]}}))}))}(t,e,s)}))}))}))}},2548:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]1)return e.map((function(e){return t(e)}));var n=e[0];if("string"!=typeof n.blotName&&"string"!=typeof n.attrName)throw new o("Invalid definition");if("abstract"===n.blotName)throw new o("Cannot register abstract class");return h[n.blotName||n.attrName]=n,"string"==typeof n.keyName?a[n.keyName]=n:(null!=n.className&&(u[n.className]=n),null!=n.tagName&&(Array.isArray(n.tagName)?n.tagName=n.tagName.map((function(t){return t.toUpperCase()})):n.tagName=n.tagName.toUpperCase(),(Array.isArray(n.tagName)?n.tagName:[n.tagName]).forEach((function(t){null!=l[t]&&null!=n.className||(l[t]=n)})))),n}},function(t,e,r){var n=r(51),i=r(11),o=r(3),s=r(20),a=String.fromCharCode(0),u=function(t){Array.isArray(t)?this.ops=t:null!=t&&Array.isArray(t.ops)?this.ops=t.ops:this.ops=[]};u.prototype.insert=function(t,e){var r={};return 0===t.length?this:(r.insert=t,null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(r.attributes=e),this.push(r))},u.prototype.delete=function(t){return t<=0?this:this.push({delete:t})},u.prototype.retain=function(t,e){if(t<=0)return this;var r={retain:t};return null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(r.attributes=e),this.push(r)},u.prototype.push=function(t){var e=this.ops.length,r=this.ops[e-1];if(t=o(!0,{},t),"object"==typeof r){if("number"==typeof t.delete&&"number"==typeof r.delete)return this.ops[e-1]={delete:r.delete+t.delete},this;if("number"==typeof r.delete&&null!=t.insert&&(e-=1,"object"!=typeof(r=this.ops[e-1])))return this.ops.unshift(t),this;if(i(t.attributes,r.attributes)){if("string"==typeof t.insert&&"string"==typeof r.insert)return this.ops[e-1]={insert:r.insert+t.insert},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this;if("number"==typeof t.retain&&"number"==typeof r.retain)return this.ops[e-1]={retain:r.retain+t.retain},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this}}return e===this.ops.length?this.ops.push(t):this.ops.splice(e,0,t),this},u.prototype.chop=function(){var t=this.ops[this.ops.length-1];return t&&t.retain&&!t.attributes&&this.ops.pop(),this},u.prototype.filter=function(t){return this.ops.filter(t)},u.prototype.forEach=function(t){this.ops.forEach(t)},u.prototype.map=function(t){return this.ops.map(t)},u.prototype.partition=function(t){var e=[],r=[];return this.forEach((function(n){(t(n)?e:r).push(n)})),[e,r]},u.prototype.reduce=function(t,e){return this.ops.reduce(t,e)},u.prototype.changeLength=function(){return this.reduce((function(t,e){return e.insert?t+s.length(e):e.delete?t-e.delete:t}),0)},u.prototype.length=function(){return this.reduce((function(t,e){return t+s.length(e)}),0)},u.prototype.slice=function(t,e){t=t||0,"number"!=typeof e&&(e=1/0);for(var r=[],n=s.iterator(this.ops),i=0;i0&&(e.push(t.ops[0]),e.ops=e.ops.concat(t.ops.slice(1))),e},u.prototype.diff=function(t,e){if(this.ops===t.ops)return new u;var r=[this,t].map((function(e){return e.map((function(r){if(null!=r.insert)return"string"==typeof r.insert?r.insert:a;throw new Error("diff() called "+(e===t?"on":"with")+" non-document")})).join("")})),o=new u,l=n(r[0],r[1],e),h=s.iterator(this.ops),c=s.iterator(t.ops);return l.forEach((function(t){for(var e=t[1].length;e>0;){var r=0;switch(t[0]){case n.INSERT:r=Math.min(c.peekLength(),e),o.push(c.next(r));break;case n.DELETE:r=Math.min(e,h.peekLength()),h.next(r),o.delete(r);break;case n.EQUAL:r=Math.min(h.peekLength(),c.peekLength(),e);var a=h.next(r),u=c.next(r);i(a.insert,u.insert)?o.retain(r,s.attributes.diff(a.attributes,u.attributes)):o.push(u).delete(r)}e-=r}})),o.chop()},u.prototype.eachLine=function(t,e){e=e||"\n";for(var r=s.iterator(this.ops),n=new u,i=0;r.hasNext();){if("insert"!==r.peekType())return;var o=r.peek(),a=s.length(o)-r.peekLength(),l="string"==typeof o.insert?o.insert.indexOf(e,a)-a:-1;if(l<0)n.push(r.next());else if(l>0)n.push(r.next(l));else{if(!1===t(n,r.next(1).attributes||{},i))return;i+=1,n=new u}}n.length()>0&&t(n,{},i)},u.prototype.transform=function(t,e){if(e=!!e,"number"==typeof t)return this.transformPosition(t,e);for(var r=s.iterator(this.ops),n=s.iterator(t.ops),i=new u;r.hasNext()||n.hasNext();)if("insert"!==r.peekType()||!e&&"insert"===n.peekType())if("insert"===n.peekType())i.push(n.next());else{var o=Math.min(r.peekLength(),n.peekLength()),a=r.next(o),l=n.next(o);if(a.delete)continue;l.delete?i.push(l):i.retain(o,s.attributes.transform(a.attributes,l.attributes,e))}else i.retain(s.length(r.next()));return i.chop()},u.prototype.transformPosition=function(t,e){e=!!e;for(var r=s.iterator(this.ops),n=0;r.hasNext()&&n<=t;){var i=r.peekLength(),o=r.peekType();r.next(),"delete"!==o?("insert"===o&&(n0&&(t1&&void 0!==arguments[1]&&arguments[1];if(r&&(0===t||t>=this.length()-1)){var n=this.clone();return 0===t?(this.parent.insertBefore(n,this),this):(this.parent.insertBefore(n,this.next),n)}var o=i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"split",this).call(this,t,r);return this.cache={},o}}]),e}(a.default.Block);function v(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return null==t?e:("function"==typeof t.formats&&(e=(0,o.default)(e,t.formats())),null==t.parent||"scroll"==t.parent.blotName||t.parent.statics.scope!==t.statics.scope?e:v(t.parent,e))}g.blotName="block",g.tagName="P",g.defaultChild="break",g.allowedChildren=[l.default,a.default.Embed,h.default],e.bubbleFormats=v,e.BlockEmbed=m,e.default=g},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.overload=e.expandConfig=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=w(e,n),this.container=this.options.container,null==this.container)return y.error("Invalid Quill container",e);this.options.debug&&t.debug(this.options.debug);var i=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new u.default,this.scroll=h.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new a.default(this.scroll),this.selection=new f.default(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.theme.init(),this.emitter.on(u.default.events.EDITOR_CHANGE,(function(t){t===u.default.events.TEXT_CHANGE&&r.root.classList.toggle("ql-blank",r.editor.isBlank())})),this.emitter.on(u.default.events.SCROLL_UPDATE,(function(t,e){var n=r.selection.lastRange,i=n&&0===n.length?n.index:void 0;E.call(r,(function(){return r.editor.update(null,e,i)}),t)}));var o=this.clipboard.convert("
"+i+"


");this.setContents(o),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return o(t,null,[{key:"debug",value:function(t){!0===t&&(t="log"),p.default.level(t)}},{key:"find",value:function(t){return t.__quill||h.default.find(t)}},{key:"import",value:function(t){return null==this.imports[t]&&y.error("Cannot import "+t+". Are you sure it was registered?"),this.imports[t]}},{key:"register",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof t){var i=t.attrName||t.blotName;"string"==typeof i?this.register("formats/"+i,t,e):Object.keys(t).forEach((function(n){r.register(n,t[n],e)}))}else null==this.imports[t]||n||y.warn("Overwriting "+t+" with",e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&"abstract"!==e.blotName?h.default.register(e):t.startsWith("modules")&&"function"==typeof e.register&&e.register()}}]),o(t,[{key:"addContainer",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof t){var r=t;(t=document.createElement("div")).classList.add(r)}return this.container.insertBefore(t,e),t}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(t,e,r){var n=this,o=M(t,e,r),s=i(o,4);return t=s[0],e=s[1],r=s[3],E.call(this,(function(){return n.editor.deleteText(t,e)}),r,t,-1*e)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(t),this.container.classList.toggle("ql-disabled",!t)}},{key:"focus",value:function(){var t=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=t,this.scrollIntoView()}},{key:"format",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u.default.sources.API;return E.call(this,(function(){var n=r.getSelection(!0),i=new s.default;if(null==n)return i;if(h.default.query(t,h.default.Scope.BLOCK))i=r.editor.formatLine(n.index,n.length,v({},t,e));else{if(0===n.length)return r.selection.format(t,e),i;i=r.editor.formatText(n.index,n.length,v({},t,e))}return r.setSelection(n,u.default.sources.SILENT),i}),n)}},{key:"formatLine",value:function(t,e,r,n,o){var s,a=this,u=M(t,e,r,n,o),l=i(u,4);return t=l[0],e=l[1],s=l[2],o=l[3],E.call(this,(function(){return a.editor.formatLine(t,e,s)}),o,t,0)}},{key:"formatText",value:function(t,e,r,n,o){var s,a=this,u=M(t,e,r,n,o),l=i(u,4);return t=l[0],e=l[1],s=l[2],o=l[3],E.call(this,(function(){return a.editor.formatText(t,e,s)}),o,t,0)}},{key:"getBounds",value:function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;e="number"==typeof t?this.selection.getBounds(t,r):this.selection.getBounds(t.index,t.length);var n=this.container.getBoundingClientRect();return{bottom:e.bottom-n.top,height:e.height,left:e.left-n.left,right:e.right-n.left,top:e.top-n.top,width:e.width}}},{key:"getContents",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-t,r=M(t,e),n=i(r,2);return t=n[0],e=n[1],this.editor.getContents(t,e)}},{key:"getFormat",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof t?this.editor.getFormat(t,e):this.editor.getFormat(t.index,t.length)}},{key:"getIndex",value:function(t){return t.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(t){return this.scroll.leaf(t)}},{key:"getLine",value:function(t){return this.scroll.line(t)}},{key:"getLines",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof t?this.scroll.lines(t.index,t.length):this.scroll.lines(t,e)}},{key:"getModule",value:function(t){return this.theme.modules[t]}},{key:"getSelection",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-t,r=M(t,e),n=i(r,2);return t=n[0],e=n[1],this.editor.getText(t,e)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(e,r,n){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.sources.API;return E.call(this,(function(){return i.editor.insertEmbed(e,r,n)}),o,e)}},{key:"insertText",value:function(t,e,r,n,o){var s,a=this,u=M(t,0,r,n,o),l=i(u,4);return t=l[0],s=l[2],o=l[3],E.call(this,(function(){return a.editor.insertText(t,e,s)}),o,t,e.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(t,e,r){this.clipboard.dangerouslyPasteHTML(t,e,r)}},{key:"removeFormat",value:function(t,e,r){var n=this,o=M(t,e,r),s=i(o,4);return t=s[0],e=s[1],r=s[3],E.call(this,(function(){return n.editor.removeFormat(t,e)}),r,t)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.default.sources.API;return E.call(this,(function(){t=new s.default(t);var r=e.getLength(),n=e.editor.deleteText(0,r),i=e.editor.applyDelta(t),o=i.ops[i.ops.length-1];return null!=o&&"string"==typeof o.insert&&"\n"===o.insert[o.insert.length-1]&&(e.editor.deleteText(e.getLength()-1,1),i.delete(1)),n.compose(i)}),r)}},{key:"setSelection",value:function(e,r,n){if(null==e)this.selection.setRange(null,r||t.sources.API);else{var o=M(e,r,n),s=i(o,4);e=s[0],r=s[1],n=s[3],this.selection.setRange(new c.Range(e,r),n),n!==u.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.default.sources.API,r=(new s.default).insert(t);return this.setContents(r,e)}},{key:"update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.default.sources.USER,e=this.scroll.update(t);return this.selection.update(t),e}},{key:"updateContents",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.default.sources.API;return E.call(this,(function(){return t=new s.default(t),e.editor.applyDelta(t,r)}),r,!0)}}]),t}();function w(t,e){if((e=(0,d.default)(!0,{container:t,modules:{clipboard:!0,keyboard:!0,history:!0}},e)).theme&&e.theme!==b.DEFAULTS.theme){if(e.theme=b.import("themes/"+e.theme),null==e.theme)throw new Error("Invalid theme "+e.theme+". Did you register it?")}else e.theme=m.default;var r=(0,d.default)(!0,{},e.theme.DEFAULTS);[r,e].forEach((function(t){t.modules=t.modules||{},Object.keys(t.modules).forEach((function(e){!0===t.modules[e]&&(t.modules[e]={})}))}));var n=Object.keys(r.modules).concat(Object.keys(e.modules)).reduce((function(t,e){var r=b.import("modules/"+e);return null==r?y.error("Cannot load "+e+" module. Are you sure you registered it?"):t[e]=r.DEFAULTS||{},t}),{});return null!=e.modules&&e.modules.toolbar&&e.modules.toolbar.constructor!==Object&&(e.modules.toolbar={container:e.modules.toolbar}),e=(0,d.default)(!0,{},b.DEFAULTS,{modules:n},r,e),["bounds","container","scrollingContainer"].forEach((function(t){"string"==typeof e[t]&&(e[t]=document.querySelector(e[t]))})),e.modules=Object.keys(e.modules).reduce((function(t,r){return e.modules[r]&&(t[r]=e.modules[r]),t}),{}),e}function E(t,e,r,n){if(this.options.strict&&!this.isEnabled()&&e===u.default.sources.USER)return new s.default;var i=null==r?null:this.getSelection(),o=this.editor.delta,a=t();if(null!=i&&(!0===r&&(r=i.index),null==n?i=A(i,a,e):0!==n&&(i=A(i,r,n,e)),this.setSelection(i,u.default.sources.SILENT)),a.length()>0){var l,h,c=[u.default.events.TEXT_CHANGE,a,o,e];(l=this.emitter).emit.apply(l,[u.default.events.EDITOR_CHANGE].concat(c)),e!==u.default.sources.SILENT&&(h=this.emitter).emit.apply(h,c)}return a}function M(t,e,r,i,o){var s={};return"number"==typeof t.index&&"number"==typeof t.length?"number"!=typeof e?(o=i,i=r,r=e,e=t.length,t=t.index):(e=t.length,t=t.index):"number"!=typeof e&&(o=i,i=r,r=e,e=0),"object"===(void 0===r?"undefined":n(r))?(s=r,o=i):"string"==typeof r&&(null!=i?s[r]=i:o=r),[t,e,s,o=o||u.default.sources.API]}function A(t,e,r,n){if(null==t)return null;var o=void 0,a=void 0;if(e instanceof s.default){var l=[t.index,t.index+t.length].map((function(t){return e.transformPosition(t,n!==u.default.sources.USER)})),h=i(l,2);o=h[0],a=h[1]}else{var f=[t.index,t.index+t.length].map((function(t){return t=0?t+r:Math.max(e,t+r)})),d=i(f,2);o=d[0],a=d[1]}return new c.Range(o,a-o)}b.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},b.events=u.default.events,b.sources=u.default.sources,b.version="1.3.6",b.imports={delta:s.default,parchment:h.default,"core/module":l.default,"core/theme":m.default},e.expandConfig=w,e.overload=M,e.default=b},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var r=0;r0){var r=this.parent.isolate(this.offset(),this.length());this.moveChildren(r),r.wrap(this)}}}],[{key:"compare",value:function(t,r){var n=e.order.indexOf(t),i=e.order.indexOf(r);return n>=0||i>=0?n-i:t===r?0:t1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.quill=e,this.options=r};n.DEFAULTS={},e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=["error","warn","log","info"],i="warn";function o(t){if(n.indexOf(t)<=n.indexOf(i)){for(var e,r=arguments.length,o=Array(r>1?r-1:0),s=1;s=0;l--)if(c[l]!=f[l])return!1;for(l=c.length-1;l>=0;l--)if(h=c[l],!s(t[h],e[h],r))return!1;return typeof t==typeof e}(t,e,r))};function a(t){return null==t}function u(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length||"function"!=typeof t.copy||"function"!=typeof t.slice||t.length>0&&"number"!=typeof t[0])}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(1),i=function(){function t(t,e,r){void 0===r&&(r={}),this.attrName=t,this.keyName=e;var i=n.Scope.TYPE&n.Scope.ATTRIBUTE;null!=r.scope?this.scope=r.scope&n.Scope.LEVEL|i:this.scope=n.Scope.ATTRIBUTE,null!=r.whitelist&&(this.whitelist=r.whitelist)}return t.keys=function(t){return[].map.call(t.attributes,(function(t){return t.name}))},t.prototype.add=function(t,e){return!!this.canAdd(t,e)&&(t.setAttribute(this.keyName,e),!0)},t.prototype.canAdd=function(t,e){return null!=n.query(t,n.Scope.BLOT&(this.scope|n.Scope.TYPE))&&(null==this.whitelist||("string"==typeof e?this.whitelist.indexOf(e.replace(/["']/g,""))>-1:this.whitelist.indexOf(e)>-1))},t.prototype.remove=function(t){t.removeAttribute(this.keyName)},t.prototype.value=function(t){var e=t.getAttribute(this.keyName);return this.canAdd(t,e)&&e?e:""},t}();e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.Code=void 0;var n=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function t(t,e){for(var r=0;r=t+r)){var s=this.newlineIndex(t,!0)+1,u=o-s+1,l=this.isolate(s,u),h=l.next;l.format(n,i),h instanceof e&&h.formatAt(0,t-s+r-u,n,i)}}}},{key:"insertAt",value:function(t,e,r){if(null==r){var i=this.descendant(h.default,t),o=n(i,2),s=o[0],a=o[1];s.insertAt(a,e)}}},{key:"length",value:function(){var t=this.domNode.textContent.length;return this.domNode.textContent.endsWith("\n")?t:t+1}},{key:"newlineIndex",value:function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return this.domNode.textContent.slice(0,t).lastIndexOf("\n");var e=this.domNode.textContent.slice(t).indexOf("\n");return e>-1?t+e:-1}},{key:"optimize",value:function(t){this.domNode.textContent.endsWith("\n")||this.appendChild(a.default.create("text","\n")),o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t);var r=this.next;null!=r&&r.prev===this&&r.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===r.statics.formats(r.domNode)&&(r.optimize(t),r.moveChildren(this),r.remove())}},{key:"replace",value:function(t){o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"replace",this).call(this,t),[].slice.call(this.domNode.querySelectorAll("*")).forEach((function(t){var e=a.default.find(t);null==e?t.parentNode.removeChild(t):e instanceof a.default.Embed?e.remove():e.unwrap()}))}}],[{key:"create",value:function(t){var r=o(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return r.setAttribute("spellcheck",!1),r}},{key:"formats",value:function(){return!0}}]),e}(u.default);g.blotName="code-block",g.tagName="PRE",g.TAB=" ",e.Code=m,e.default=g},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function t(t,e){for(var r=0;r=o&&!d.endsWith("\n")&&(r=!0),e.scroll.insertAt(t,d);var p=e.scroll.line(t),m=i(p,2),v=m[0],y=m[1],b=(0,g.default)({},(0,c.bubbleFormats)(v));if(v instanceof f.default){var w=v.descendant(u.default.Leaf,y),E=i(w,1)[0];b=(0,g.default)(b,(0,c.bubbleFormats)(E))}h=a.default.attributes.diff(b,h)||{}}else if("object"===n(s.insert)){var M=Object.keys(s.insert)[0];if(null==M)return t;e.scroll.insertAt(t,M,s.insert[M])}o+=l}return Object.keys(h).forEach((function(r){e.scroll.formatAt(t,l,r,h[r])})),t+l}),0),t.reduce((function(t,r){return"number"==typeof r.delete?(e.scroll.deleteAt(t,r.delete),t):t+(r.retain||r.insert.length||1)}),0),this.scroll.batchEnd(),this.update(t)}},{key:"deleteText",value:function(t,e){return this.scroll.deleteAt(t,e),this.update((new s.default).retain(t).delete(e))}},{key:"formatLine",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.scroll.update(),Object.keys(n).forEach((function(i){if(null==r.scroll.whitelist||r.scroll.whitelist[i]){var o=r.scroll.lines(t,Math.max(e,1)),s=e;o.forEach((function(e){var o=e.length();if(e instanceof l.default){var a=t-e.offset(r.scroll),u=e.newlineIndex(a+s)-a+1;e.formatAt(a,u,i,n[i])}else e.format(i,n[i]);s-=o}))}})),this.scroll.optimize(),this.update((new s.default).retain(t).retain(e,(0,p.default)(n)))}},{key:"formatText",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(n).forEach((function(i){r.scroll.formatAt(t,e,i,n[i])})),this.update((new s.default).retain(t).retain(e,(0,p.default)(n)))}},{key:"getContents",value:function(t,e){return this.delta.slice(t,t+e)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce((function(t,e){return t.concat(e.delta())}),new s.default)}},{key:"getFormat",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],n=[];0===e?this.scroll.path(t).forEach((function(t){var e=i(t,1)[0];e instanceof f.default?r.push(e):e instanceof u.default.Leaf&&n.push(e)})):(r=this.scroll.lines(t,e),n=this.scroll.descendants(u.default.Leaf,t,e));var o=[r,n].map((function(t){if(0===t.length)return{};for(var e=(0,c.bubbleFormats)(t.shift());Object.keys(e).length>0;){var r=t.shift();if(null==r)return e;e=w((0,c.bubbleFormats)(r),e)}return e}));return g.default.apply(g.default,o)}},{key:"getText",value:function(t,e){return this.getContents(t,e).filter((function(t){return"string"==typeof t.insert})).map((function(t){return t.insert})).join("")}},{key:"insertEmbed",value:function(t,e,r){return this.scroll.insertAt(t,e,r),this.update((new s.default).retain(t).insert(function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}({},e,r)))}},{key:"insertText",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(t,e),Object.keys(n).forEach((function(i){r.scroll.formatAt(t,e.length,i,n[i])})),this.update((new s.default).retain(t).insert(e,(0,p.default)(n)))}},{key:"isBlank",value:function(){if(0==this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;var t=this.scroll.children.head;return t.statics.blotName===f.default.blotName&&!(t.children.length>1)&&t.children.head instanceof d.default}},{key:"removeFormat",value:function(t,e){var r=this.getText(t,e),n=this.scroll.line(t+e),o=i(n,2),a=o[0],u=o[1],h=0,c=new s.default;null!=a&&(h=a instanceof l.default?a.newlineIndex(u)-u+1:a.length()-u,c=a.delta().slice(u,u+h-1).insert("\n"));var f=this.getContents(t,e+h).diff((new s.default).insert(r).concat(c)),d=(new s.default).retain(t).concat(f);return this.applyDelta(d)}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=this.delta;if(1===e.length&&"characterData"===e[0].type&&e[0].target.data.match(y)&&u.default.find(e[0].target)){var i=u.default.find(e[0].target),o=(0,c.bubbleFormats)(i),a=i.offset(this.scroll),l=e[0].oldValue.replace(h.default.CONTENTS,""),f=(new s.default).insert(l),d=(new s.default).insert(i.value());t=(new s.default).retain(a).concat(f.diff(d,r)).reduce((function(t,e){return e.insert?t.insert(e.insert,o):t.push(e)}),new s.default),this.delta=n.compose(t)}else this.delta=this.getDelta(),t&&(0,m.default)(n.compose(t),this.delta)||(t=n.diff(this.delta,r));return t}}]),t}();function w(t,e){return Object.keys(e).reduce((function(r,n){return null==t[n]||(e[n]===t[n]?r[n]=e[n]:Array.isArray(e[n])?e[n].indexOf(t[n])<0&&(r[n]=e[n].concat([t[n]])):r[n]=[e[n],t[n]]),r}),{})}e.default=b},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.Range=void 0;var n=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:0;c(this,t),this.index=e,this.length=r},p=function(){function t(e,r){var n=this;c(this,t),this.emitter=r,this.scroll=e,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=o.default.create("cursor",this),this.lastRange=this.savedRange=new d(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,(function(){n.mouseDown||setTimeout(n.update.bind(n,u.default.sources.USER),1)})),this.emitter.on(u.default.events.EDITOR_CHANGE,(function(t,e){t===u.default.events.TEXT_CHANGE&&e.length()>0&&n.update(u.default.sources.SILENT)})),this.emitter.on(u.default.events.SCROLL_BEFORE_UPDATE,(function(){if(n.hasFocus()){var t=n.getNativeRange();null!=t&&t.start.node!==n.cursor.textNode&&n.emitter.once(u.default.events.SCROLL_UPDATE,(function(){try{n.setNativeRange(t.start.node,t.start.offset,t.end.node,t.end.offset)}catch(t){}}))}})),this.emitter.on(u.default.events.SCROLL_OPTIMIZE,(function(t,e){if(e.range){var r=e.range,i=r.startNode,o=r.startOffset,s=r.endNode,a=r.endOffset;n.setNativeRange(i,o,s,a)}})),this.update(u.default.sources.SILENT)}return i(t,[{key:"handleComposition",value:function(){var t=this;this.root.addEventListener("compositionstart",(function(){t.composing=!0})),this.root.addEventListener("compositionend",(function(){if(t.composing=!1,t.cursor.parent){var e=t.cursor.restore();if(!e)return;setTimeout((function(){t.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)}),1)}}))}},{key:"handleDragging",value:function(){var t=this;this.emitter.listenDOM("mousedown",document.body,(function(){t.mouseDown=!0})),this.emitter.listenDOM("mouseup",document.body,(function(){t.mouseDown=!1,t.update(u.default.sources.USER)}))}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(t,e){if(null==this.scroll.whitelist||this.scroll.whitelist[t]){this.scroll.update();var r=this.getNativeRange();if(null!=r&&r.native.collapsed&&!o.default.query(t,o.default.Scope.BLOCK)){if(r.start.node!==this.cursor.textNode){var n=o.default.find(r.start.node,!1);if(null==n)return;if(n instanceof o.default.Leaf){var i=n.split(r.start.offset);n.parent.insertBefore(this.cursor,i)}else n.insertBefore(this.cursor,r.start.node);this.cursor.attach()}this.cursor.format(t,e),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}}},{key:"getBounds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.scroll.length();t=Math.min(t,r-1),e=Math.min(t+e,r-1)-t;var i=void 0,o=this.scroll.leaf(t),s=n(o,2),a=s[0],u=s[1];if(null==a)return null;var l=a.position(u,!0),h=n(l,2);i=h[0],u=h[1];var c=document.createRange();if(e>0){c.setStart(i,u);var f=this.scroll.leaf(t+e),d=n(f,2);if(a=d[0],u=d[1],null==a)return null;var p=a.position(u,!0),m=n(p,2);return i=m[0],u=m[1],c.setEnd(i,u),c.getBoundingClientRect()}var g="left",v=void 0;return i instanceof Text?(u0&&(g="right")),{bottom:v.top+v.height,height:v.height,left:v[g],right:v[g],top:v.top,width:0}}},{key:"getNativeRange",value:function(){var t=document.getSelection();if(null==t||t.rangeCount<=0)return null;var e=t.getRangeAt(0);if(null==e)return null;var r=this.normalizeNative(e);return f.info("getNativeRange",r),r}},{key:"getRange",value:function(){var t=this.getNativeRange();return null==t?[null,null]:[this.normalizedToRange(t),t]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(t){var e=this,r=[[t.start.node,t.start.offset]];t.native.collapsed||r.push([t.end.node,t.end.offset]);var i=r.map((function(t){var r=n(t,2),i=r[0],s=r[1],a=o.default.find(i,!0),u=a.offset(e.scroll);return 0===s?u:a instanceof o.default.Container?u+a.length():u+a.index(i,s)})),s=Math.min(Math.max.apply(Math,h(i)),this.scroll.length()-1),a=Math.min.apply(Math,[s].concat(h(i)));return new d(a,s-a)}},{key:"normalizeNative",value:function(t){if(!m(this.root,t.startContainer)||!t.collapsed&&!m(this.root,t.endContainer))return null;var e={start:{node:t.startContainer,offset:t.startOffset},end:{node:t.endContainer,offset:t.endOffset},native:t};return[e.start,e.end].forEach((function(t){for(var e=t.node,r=t.offset;!(e instanceof Text)&&e.childNodes.length>0;)if(e.childNodes.length>r)e=e.childNodes[r],r=0;else{if(e.childNodes.length!==r)break;r=(e=e.lastChild)instanceof Text?e.data.length:e.childNodes.length+1}t.node=e,t.offset=r})),e}},{key:"rangeToNative",value:function(t){var e=this,r=t.collapsed?[t.index]:[t.index,t.index+t.length],i=[],o=this.scroll.length();return r.forEach((function(t,r){t=Math.min(o-1,t);var s,a=e.scroll.leaf(t),u=n(a,2),l=u[0],h=u[1],c=l.position(h,0!==r),f=n(c,2);s=f[0],h=f[1],i.push(s,h)})),i.length<2&&(i=i.concat(i)),i}},{key:"scrollIntoView",value:function(t){var e=this.lastRange;if(null!=e){var r=this.getBounds(e.index,e.length);if(null!=r){var i=this.scroll.length()-1,o=this.scroll.line(Math.min(e.index,i)),s=n(o,1)[0],a=s;if(e.length>0){var u=this.scroll.line(Math.min(e.index+e.length,i));a=n(u,1)[0]}if(null!=s&&null!=a){var l=t.getBoundingClientRect();r.topl.bottom&&(t.scrollTop+=r.bottom-l.bottom)}}}}},{key:"setNativeRange",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(f.info("setNativeRange",t,e,r,n),null==t||null!=this.root.parentNode&&null!=t.parentNode&&null!=r.parentNode){var o=document.getSelection();if(null!=o)if(null!=t){this.hasFocus()||this.root.focus();var s=(this.getNativeRange()||{}).native;if(null==s||i||t!==s.startContainer||e!==s.startOffset||r!==s.endContainer||n!==s.endOffset){"BR"==t.tagName&&(e=[].indexOf.call(t.parentNode.childNodes,t),t=t.parentNode),"BR"==r.tagName&&(n=[].indexOf.call(r.parentNode.childNodes,r),r=r.parentNode);var a=document.createRange();a.setStart(t,e),a.setEnd(r,n),o.removeAllRanges(),o.addRange(a)}}else o.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u.default.sources.API;if("string"==typeof e&&(r=e,e=!1),f.info("setRange",t),null!=t){var n=this.rangeToNative(t);this.setNativeRange.apply(this,h(n).concat([e]))}else this.setNativeRange(null);this.update(r)}},{key:"update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.default.sources.USER,e=this.lastRange,r=this.getRange(),i=n(r,2),o=i[0],l=i[1];if(this.lastRange=o,null!=this.lastRange&&(this.savedRange=this.lastRange),!(0,a.default)(e,this.lastRange)){var h;!this.composing&&null!=l&&l.native.collapsed&&l.start.node!==this.cursor.textNode&&this.cursor.restore();var c,f=[u.default.events.SELECTION_CHANGE,(0,s.default)(this.lastRange),(0,s.default)(e),t];(h=this.emitter).emit.apply(h,[u.default.events.EDITOR_CHANGE].concat(f)),t!==u.default.sources.SILENT&&(c=this.emitter).emit.apply(c,f)}}}]),t}();function m(t,e){try{e.parentNode}catch(t){return!1}return e instanceof Text&&(e=e.parentNode),t.contains(e)}e.Range=d,e.default=p},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,i=function(){function t(t,e){for(var r=0;r0&&(r+=1),[this.parent.domNode,r]},e.prototype.value=function(){return(t={})[this.statics.blotName]=this.statics.value(this.domNode)||!0,t;var t},e.scope=s.Scope.INLINE_BLOT,e}(o.default);e.default=a},function(t,e,r){var n=r(11),i=r(3),o={attributes:{compose:function(t,e,r){"object"!=typeof t&&(t={}),"object"!=typeof e&&(e={});var n=i(!0,{},e);for(var o in r||(n=Object.keys(n).reduce((function(t,e){return null!=n[e]&&(t[e]=n[e]),t}),{})),t)void 0!==t[o]&&void 0===e[o]&&(n[o]=t[o]);return Object.keys(n).length>0?n:void 0},diff:function(t,e){"object"!=typeof t&&(t={}),"object"!=typeof e&&(e={});var r=Object.keys(t).concat(Object.keys(e)).reduce((function(r,i){return n(t[i],e[i])||(r[i]=void 0===e[i]?null:e[i]),r}),{});return Object.keys(r).length>0?r:void 0},transform:function(t,e,r){if("object"!=typeof t)return e;if("object"==typeof e){if(!r)return e;var n=Object.keys(e).reduce((function(r,n){return void 0===t[n]&&(r[n]=e[n]),r}),{});return Object.keys(n).length>0?n:void 0}}},iterator:function(t){return new s(t)},length:function(t){return"number"==typeof t.delete?t.delete:"number"==typeof t.retain?t.retain:"string"==typeof t.insert?t.insert.length:1}};function s(t){this.ops=t,this.index=0,this.offset=0}s.prototype.hasNext=function(){return this.peekLength()<1/0},s.prototype.next=function(t){t||(t=1/0);var e=this.ops[this.index];if(e){var r=this.offset,n=o.length(e);if(t>=n-r?(t=n-r,this.index+=1,this.offset=0):this.offset+=t,"number"==typeof e.delete)return{delete:t};var i={};return e.attributes&&(i.attributes=e.attributes),"number"==typeof e.retain?i.retain=t:"string"==typeof e.insert?i.insert=e.insert.substr(r,t):i.insert=e.insert,i}return{retain:1/0}},s.prototype.peek=function(){return this.ops[this.index]},s.prototype.peekLength=function(){return this.ops[this.index]?o.length(this.ops[this.index])-this.offset:1/0},s.prototype.peekType=function(){return this.ops[this.index]?"number"==typeof this.ops[this.index].delete?"delete":"number"==typeof this.ops[this.index].retain?"retain":"insert":"retain"},t.exports=o},function(t,e){var r=function(){"use strict";function t(t,e){return null!=e&&t instanceof e}var e,r,n;try{e=Map}catch(t){e=function(){}}try{r=Set}catch(t){r=function(){}}try{n=Promise}catch(t){n=function(){}}function i(o,a,u,l,h){"object"==typeof a&&(u=a.depth,l=a.prototype,h=a.includeNonEnumerable,a=a.circular);var c=[],f=[],d="undefined"!=typeof Buffer;return void 0===a&&(a=!0),void 0===u&&(u=1/0),function o(u,p){if(null===u)return null;if(0===p)return u;var m,g;if("object"!=typeof u)return u;if(t(u,e))m=new e;else if(t(u,r))m=new r;else if(t(u,n))m=new n((function(t,e){u.then((function(e){t(o(e,p-1))}),(function(t){e(o(t,p-1))}))}));else if(i.__isArray(u))m=[];else if(i.__isRegExp(u))m=new RegExp(u.source,s(u)),u.lastIndex&&(m.lastIndex=u.lastIndex);else if(i.__isDate(u))m=new Date(u.getTime());else{if(d&&Buffer.isBuffer(u))return m=new Buffer(u.length),u.copy(m),m;t(u,Error)?m=Object.create(u):void 0===l?(g=Object.getPrototypeOf(u),m=Object.create(g)):(m=Object.create(l),g=l)}if(a){var v=c.indexOf(u);if(-1!=v)return f[v];c.push(u),f.push(m)}for(var y in t(u,e)&&u.forEach((function(t,e){var r=o(e,p-1),n=o(t,p-1);m.set(r,n)})),t(u,r)&&u.forEach((function(t){var e=o(t,p-1);m.add(e)})),u){var b;g&&(b=Object.getOwnPropertyDescriptor(g,y)),b&&null==b.set||(m[y]=o(u[y],p-1))}if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(u);for(y=0;y0){if(a instanceof u.BlockEmbed||d instanceof u.BlockEmbed)return void this.optimize();if(a instanceof c.default){var p=a.newlineIndex(a.length(),!0);if(p>-1&&(a=a.split(p+1))===d)return void this.optimize()}else if(d instanceof c.default){var m=d.newlineIndex(0);m>-1&&d.split(m+1)}var g=d.children.head instanceof h.default?null:d.children.head;a.moveChildren(d,g),a.remove()}this.optimize()}},{key:"enable",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",t)}},{key:"formatAt",value:function(t,r,n,i){(null==this.whitelist||this.whitelist[n])&&(o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"formatAt",this).call(this,t,r,n,i),this.optimize())}},{key:"insertAt",value:function(t,r,n){if(null==n||null==this.whitelist||this.whitelist[r]){if(t>=this.length())if(null==n||null==s.default.query(r,s.default.Scope.BLOCK)){var i=s.default.create(this.statics.defaultChild);this.appendChild(i),null==n&&r.endsWith("\n")&&(r=r.slice(0,-1)),i.insertAt(0,r,n)}else{var a=s.default.create(r,n);this.appendChild(a)}else o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertAt",this).call(this,t,r,n);this.optimize()}}},{key:"insertBefore",value:function(t,r){if(t.statics.scope===s.default.Scope.INLINE_BLOT){var n=s.default.create(this.statics.defaultChild);n.appendChild(t),t=n}o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertBefore",this).call(this,t,r)}},{key:"leaf",value:function(t){return this.path(t).pop()||[null,-1]}},{key:"line",value:function(t){return t===this.length()?this.line(t-1):this.descendant(p,t)}},{key:"lines",value:function(){return function t(e,r,n){var i=[],o=n;return e.children.forEachAt(r,n,(function(e,r,n){p(e)?i.push(e):e instanceof s.default.Container&&(i=i.concat(t(e,r,o))),o-=n})),i}(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE)}},{key:"optimize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!0!==this.batch&&(o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t,r),t.length>0&&this.emitter.emit(a.default.events.SCROLL_OPTIMIZE,t,r))}},{key:"path",value:function(t){return o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"path",this).call(this,t).slice(1)}},{key:"update",value:function(t){if(!0!==this.batch){var r=a.default.sources.USER;"string"==typeof t&&(r=t),Array.isArray(t)||(t=this.observer.takeRecords()),t.length>0&&this.emitter.emit(a.default.events.SCROLL_BEFORE_UPDATE,r,t),o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"update",this).call(this,t.concat([])),t.length>0&&this.emitter.emit(a.default.events.SCROLL_UPDATE,r,t)}}}]),e}(s.default.Scroll);m.blotName="scroll",m.className="ql-editor",m.tagName="DIV",m.defaultChild="block",m.allowedChildren=[l.default,u.BlockEmbed,f.default],e.default=m},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SHORTKEY=e.default=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=T(t);if(null==n||null==n.key)return v.warn("Attempted to add invalid keyboard binding",n);"function"==typeof e&&(e={handler:e}),"function"==typeof r&&(r={handler:r}),n=(0,u.default)(n,e,r),this.bindings[n.key]=this.bindings[n.key]||[],this.bindings[n.key].push(n)}},{key:"listen",value:function(){var t=this;this.quill.root.addEventListener("keydown",(function(r){if(!r.defaultPrevented){var o=r.which||r.keyCode,s=(t.bindings[o]||[]).filter((function(t){return e.match(r,t)}));if(0!==s.length){var u=t.quill.getSelection();if(null!=u&&t.quill.hasFocus()){var l=t.quill.getLine(u.index),h=i(l,2),f=h[0],d=h[1],p=t.quill.getLeaf(u.index),m=i(p,2),g=m[0],v=m[1],y=0===u.length?[g,v]:t.quill.getLeaf(u.index+u.length),b=i(y,2),w=b[0],E=b[1],M=g instanceof c.default.Text?g.value().slice(0,v):"",A=w instanceof c.default.Text?w.value().slice(E):"",_={collapsed:0===u.length,empty:0===u.length&&f.length()<=1,format:t.quill.getFormat(u),offset:d,prefix:M,suffix:A};s.some((function(e){if(null!=e.collapsed&&e.collapsed!==_.collapsed)return!1;if(null!=e.empty&&e.empty!==_.empty)return!1;if(null!=e.offset&&e.offset!==_.offset)return!1;if(Array.isArray(e.format)){if(e.format.every((function(t){return null==_.format[t]})))return!1}else if("object"===n(e.format)&&!Object.keys(e.format).every((function(t){return!0===e.format[t]?null!=_.format[t]:!1===e.format[t]?null==_.format[t]:(0,a.default)(e.format[t],_.format[t])})))return!1;return!(null!=e.prefix&&!e.prefix.test(_.prefix)||null!=e.suffix&&!e.suffix.test(_.suffix)||!0===e.handler.call(t,u,_))}))&&r.preventDefault()}}}}))}}]),e}(p.default);function w(t,e){var r,n=t===b.keys.LEFT?"prefix":"suffix";return g(r={key:t,shiftKey:e,altKey:null},n,/^$/),g(r,"handler",(function(r){var n=r.index;t===b.keys.RIGHT&&(n+=r.length+1);var o=this.quill.getLeaf(n);return!(i(o,1)[0]instanceof c.default.Embed&&(t===b.keys.LEFT?e?this.quill.setSelection(r.index-1,r.length+1,f.default.sources.USER):this.quill.setSelection(r.index-1,f.default.sources.USER):e?this.quill.setSelection(r.index,r.length+1,f.default.sources.USER):this.quill.setSelection(r.index+r.length+1,f.default.sources.USER),1))})),r}function E(t,e){if(!(0===t.index||this.quill.getLength()<=1)){var r=this.quill.getLine(t.index),n=i(r,1)[0],o={};if(0===e.offset){var s=this.quill.getLine(t.index-1),a=i(s,1)[0];if(null!=a&&a.length()>1){var u=n.formats(),l=this.quill.getFormat(t.index-1,1);o=h.default.attributes.diff(u,l)||{}}}var c=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(e.prefix)?2:1;this.quill.deleteText(t.index-c,c,f.default.sources.USER),Object.keys(o).length>0&&this.quill.formatLine(t.index-c,c,o,f.default.sources.USER),this.quill.focus()}}function M(t,e){var r=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(!(t.index>=this.quill.getLength()-r)){var n={},o=0,s=this.quill.getLine(t.index),a=i(s,1)[0];if(e.offset>=a.length()-1){var u=this.quill.getLine(t.index+1),l=i(u,1)[0];if(l){var c=a.formats(),d=this.quill.getFormat(t.index,1);n=h.default.attributes.diff(c,d)||{},o=l.length()}}this.quill.deleteText(t.index,r,f.default.sources.USER),Object.keys(n).length>0&&this.quill.formatLine(t.index+o-1,r,n,f.default.sources.USER)}}function A(t){var e=this.quill.getLines(t),r={};if(e.length>1){var n=e[0].formats(),i=e[e.length-1].formats();r=h.default.attributes.diff(i,n)||{}}this.quill.deleteText(t,f.default.sources.USER),Object.keys(r).length>0&&this.quill.formatLine(t.index,1,r,f.default.sources.USER),this.quill.setSelection(t.index,f.default.sources.SILENT),this.quill.focus()}function _(t,e){var r=this;t.length>0&&this.quill.scroll.deleteAt(t.index,t.length);var n=Object.keys(e.format).reduce((function(t,r){return c.default.query(r,c.default.Scope.BLOCK)&&!Array.isArray(e.format[r])&&(t[r]=e.format[r]),t}),{});this.quill.insertText(t.index,"\n",n,f.default.sources.USER),this.quill.setSelection(t.index+1,f.default.sources.SILENT),this.quill.focus(),Object.keys(e.format).forEach((function(t){null==n[t]&&(Array.isArray(e.format[t])||"link"!==t&&r.quill.format(t,e.format[t],f.default.sources.USER))}))}function N(t){return{key:b.keys.TAB,shiftKey:!t,format:{"code-block":!0},handler:function(e){var r=c.default.query("code-block"),n=e.index,o=e.length,s=this.quill.scroll.descendant(r,n),a=i(s,2),u=a[0],l=a[1];if(null!=u){var h=this.quill.getIndex(u),d=u.newlineIndex(l,!0)+1,p=u.newlineIndex(h+l+o),m=u.domNode.textContent.slice(d,p).split("\n");l=0,m.forEach((function(e,i){t?(u.insertAt(d+l,r.TAB),l+=r.TAB.length,0===i?n+=r.TAB.length:o+=r.TAB.length):e.startsWith(r.TAB)&&(u.deleteAt(d+l,r.TAB.length),l-=r.TAB.length,0===i?n-=r.TAB.length:o-=r.TAB.length),l+=e.length+1})),this.quill.update(f.default.sources.USER),this.quill.setSelection(n,o,f.default.sources.SILENT)}}}}function S(t){return{key:t[0].toUpperCase(),shortKey:!0,handler:function(e,r){this.quill.format(t,!r.format[t],f.default.sources.USER)}}}function T(t){if("string"==typeof t||"number"==typeof t)return T({key:t});if("object"===(void 0===t?"undefined":n(t))&&(t=(0,s.default)(t,!1)),"string"==typeof t.key)if(null!=b.keys[t.key.toUpperCase()])t.key=b.keys[t.key.toUpperCase()];else{if(1!==t.key.length)return null;t.key=t.key.toUpperCase().charCodeAt(0)}return t.shortKey&&(t[y]=t.shortKey,delete t.shortKey),t}b.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},b.DEFAULTS={bindings:{bold:S("bold"),italic:S("italic"),underline:S("underline"),indent:{key:b.keys.TAB,format:["blockquote","indent","list"],handler:function(t,e){if(e.collapsed&&0!==e.offset)return!0;this.quill.format("indent","+1",f.default.sources.USER)}},outdent:{key:b.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(t,e){if(e.collapsed&&0!==e.offset)return!0;this.quill.format("indent","-1",f.default.sources.USER)}},"outdent backspace":{key:b.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(t,e){null!=e.format.indent?this.quill.format("indent","-1",f.default.sources.USER):null!=e.format.list&&this.quill.format("list",!1,f.default.sources.USER)}},"indent code-block":N(!0),"outdent code-block":N(!1),"remove tab":{key:b.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(t){this.quill.deleteText(t.index-1,1,f.default.sources.USER)}},tab:{key:b.keys.TAB,handler:function(t){this.quill.history.cutoff();var e=(new l.default).retain(t.index).delete(t.length).insert("\t");this.quill.updateContents(e,f.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index+1,f.default.sources.SILENT)}},"list empty enter":{key:b.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(t,e){this.quill.format("list",!1,f.default.sources.USER),e.format.indent&&this.quill.format("indent",!1,f.default.sources.USER)}},"checklist enter":{key:b.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(t){var e=this.quill.getLine(t.index),r=i(e,2),n=r[0],o=r[1],s=(0,u.default)({},n.formats(),{list:"checked"}),a=(new l.default).retain(t.index).insert("\n",s).retain(n.length()-o-1).retain(1,{list:"unchecked"});this.quill.updateContents(a,f.default.sources.USER),this.quill.setSelection(t.index+1,f.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:b.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(t,e){var r=this.quill.getLine(t.index),n=i(r,2),o=n[0],s=n[1],a=(new l.default).retain(t.index).insert("\n",e.format).retain(o.length()-s-1).retain(1,{header:null});this.quill.updateContents(a,f.default.sources.USER),this.quill.setSelection(t.index+1,f.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(t,e){var r=e.prefix.length,n=this.quill.getLine(t.index),o=i(n,2),s=o[0],a=o[1];if(a>r)return!0;var u=void 0;switch(e.prefix.trim()){case"[]":case"[ ]":u="unchecked";break;case"[x]":u="checked";break;case"-":case"*":u="bullet";break;default:u="ordered"}this.quill.insertText(t.index," ",f.default.sources.USER),this.quill.history.cutoff();var h=(new l.default).retain(t.index-a).delete(r+1).retain(s.length()-2-a).retain(1,{list:u});this.quill.updateContents(h,f.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index-r,f.default.sources.SILENT)}},"code exit":{key:b.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(t){var e=this.quill.getLine(t.index),r=i(e,2),n=r[0],o=r[1],s=(new l.default).retain(t.index+n.length()-o-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(s,f.default.sources.USER)}},"embed left":w(b.keys.LEFT,!1),"embed left shift":w(b.keys.LEFT,!0),"embed right":w(b.keys.RIGHT,!1),"embed right shift":w(b.keys.RIGHT,!0)}},e.default=b,e.SHORTKEY=y},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0},i=function(){function t(t,e){for(var r=0;r-1}s.blotName="link",s.tagName="A",s.SANITIZED_URL="about:blank",s.PROTOCOL_WHITELIST=["http","https","mailto","tel"],e.default=s,e.sanitize=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]&&arguments[1],r=this.container.querySelector(".ql-selected");if(t!==r&&(null!=r&&r.classList.remove("ql-selected"),null!=t&&(t.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(t.parentNode.children,t),t.hasAttribute("data-value")?this.label.setAttribute("data-value",t.getAttribute("data-value")):this.label.removeAttribute("data-value"),t.hasAttribute("data-label")?this.label.setAttribute("data-label",t.getAttribute("data-label")):this.label.removeAttribute("data-label"),e))){if("function"==typeof Event)this.select.dispatchEvent(new Event("change"));else if("object"===("undefined"==typeof Event?"undefined":n(Event))){var i=document.createEvent("Event");i.initEvent("change",!0,!0),this.select.dispatchEvent(i)}this.close()}}},{key:"update",value:function(){var t=void 0;if(this.select.selectedIndex>-1){var e=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];t=this.select.options[this.select.selectedIndex],this.selectItem(e)}else this.selectItem(null);var r=null!=t&&t!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",r)}}]),t}();e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=v(r(0)),i=v(r(5)),o=r(4),s=v(o),a=v(r(16)),u=v(r(25)),l=v(r(24)),h=v(r(35)),c=v(r(6)),f=v(r(22)),d=v(r(7)),p=v(r(55)),m=v(r(42)),g=v(r(23));function v(t){return t&&t.__esModule?t:{default:t}}i.default.register({"blots/block":s.default,"blots/block/embed":o.BlockEmbed,"blots/break":a.default,"blots/container":u.default,"blots/cursor":l.default,"blots/embed":h.default,"blots/inline":c.default,"blots/scroll":f.default,"blots/text":d.default,"modules/clipboard":p.default,"modules/history":m.default,"modules/keyboard":g.default}),n.default.register(s.default,a.default,l.default,c.default,f.default,d.default),e.default=i.default},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(1),i=function(){function t(t){this.domNode=t,this.domNode[n.DATA_KEY]={blot:this}}return Object.defineProperty(t.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),t.create=function(t){if(null==this.tagName)throw new n.ParchmentError("Blot definition missing tagName");var e;return Array.isArray(this.tagName)?("string"==typeof t&&(t=t.toUpperCase(),parseInt(t).toString()===t&&(t=parseInt(t))),e="number"==typeof t?document.createElement(this.tagName[t-1]):this.tagName.indexOf(t)>-1?document.createElement(t):document.createElement(this.tagName[0])):e=document.createElement(this.tagName),this.className&&e.classList.add(this.className),e},t.prototype.attach=function(){null!=this.parent&&(this.scroll=this.parent.scroll)},t.prototype.clone=function(){var t=this.domNode.cloneNode(!1);return n.create(t)},t.prototype.detach=function(){null!=this.parent&&this.parent.removeChild(this),delete this.domNode[n.DATA_KEY]},t.prototype.deleteAt=function(t,e){this.isolate(t,e).remove()},t.prototype.formatAt=function(t,e,r,i){var o=this.isolate(t,e);if(null!=n.query(r,n.Scope.BLOT)&&i)o.wrap(r,i);else if(null!=n.query(r,n.Scope.ATTRIBUTE)){var s=n.create(this.statics.scope);o.wrap(s),s.format(r,i)}},t.prototype.insertAt=function(t,e,r){var i=null==r?n.create("text",e):n.create(e,r),o=this.split(t);this.parent.insertBefore(i,o)},t.prototype.insertInto=function(t,e){void 0===e&&(e=null),null!=this.parent&&this.parent.children.remove(this);var r=null;t.children.insertBefore(this,e),null!=e&&(r=e.domNode),this.domNode.parentNode==t.domNode&&this.domNode.nextSibling==r||t.domNode.insertBefore(this.domNode,r),this.parent=t,this.attach()},t.prototype.isolate=function(t,e){var r=this.split(t);return r.split(e),r},t.prototype.length=function(){return 1},t.prototype.offset=function(t){return void 0===t&&(t=this.parent),null==this.parent||this==t?0:this.parent.children.offset(this)+this.parent.offset(t)},t.prototype.optimize=function(t){null!=this.domNode[n.DATA_KEY]&&delete this.domNode[n.DATA_KEY].mutations},t.prototype.remove=function(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},t.prototype.replace=function(t){null!=t.parent&&(t.parent.insertBefore(this,t.next),t.remove())},t.prototype.replaceWith=function(t,e){var r="string"==typeof t?n.create(t,e):t;return r.replace(this),r},t.prototype.split=function(t,e){return 0===t?this:this.next},t.prototype.update=function(t,e){},t.prototype.wrap=function(t,e){var r="string"==typeof t?n.create(t,e):t;return null!=this.parent&&this.parent.insertBefore(r,this.next),r.appendChild(this),r},t.blotName="abstract",t}();e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(12),i=r(32),o=r(33),s=r(1),a=function(){function t(t){this.attributes={},this.domNode=t,this.build()}return t.prototype.attribute=function(t,e){e?t.add(this.domNode,e)&&(null!=t.value(this.domNode)?this.attributes[t.attrName]=t:delete this.attributes[t.attrName]):(t.remove(this.domNode),delete this.attributes[t.attrName])},t.prototype.build=function(){var t=this;this.attributes={};var e=n.default.keys(this.domNode),r=i.default.keys(this.domNode),a=o.default.keys(this.domNode);e.concat(r).concat(a).forEach((function(e){var r=s.query(e,s.Scope.ATTRIBUTE);r instanceof n.default&&(t.attributes[r.attrName]=r)}))},t.prototype.copy=function(t){var e=this;Object.keys(this.attributes).forEach((function(r){var n=e.attributes[r].value(e.domNode);t.format(r,n)}))},t.prototype.move=function(t){var e=this;this.copy(t),Object.keys(this.attributes).forEach((function(t){e.attributes[t].remove(e.domNode)})),this.attributes={}},t.prototype.values=function(){var t=this;return Object.keys(this.attributes).reduce((function(e,r){return e[r]=t.attributes[r].value(t.domNode),e}),{})},t}();e.default=a},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function o(t,e){return(t.getAttribute("class")||"").split(/\s+/).filter((function(t){return 0===t.indexOf(e+"-")}))}Object.defineProperty(e,"__esModule",{value:!0});var s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.keys=function(t){return(t.getAttribute("class")||"").split(/\s+/).map((function(t){return t.split("-").slice(0,-1).join("-")}))},e.prototype.add=function(t,e){return!!this.canAdd(t,e)&&(this.remove(t),t.classList.add(this.keyName+"-"+e),!0)},e.prototype.remove=function(t){o(t,this.keyName).forEach((function(e){t.classList.remove(e)})),0===t.classList.length&&t.removeAttribute("class")},e.prototype.value=function(t){var e=(o(t,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(t,e)?e:""},e}(r(12).default);e.default=s},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function o(t){var e=t.split("-"),r=e.slice(1).map((function(t){return t[0].toUpperCase()+t.slice(1)})).join("");return e[0]+r}Object.defineProperty(e,"__esModule",{value:!0});var s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.keys=function(t){return(t.getAttribute("style")||"").split(";").map((function(t){return t.split(":")[0].trim()}))},e.prototype.add=function(t,e){return!!this.canAdd(t,e)&&(t.style[o(this.keyName)]=e,!0)},e.prototype.remove=function(t){t.style[o(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")},e.prototype.value=function(t){var e=t.style[o(this.keyName)];return this.canAdd(t,e)?e:""},e}(r(12).default);e.default=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var r=0;rn&&this.stack.undo.length>0){var i=this.stack.undo.pop();r=r.compose(i.undo),t=i.redo.compose(t)}else this.lastRecorded=n;this.stack.undo.push({redo:t,undo:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(t){this.stack.undo.forEach((function(e){e.undo=t.transform(e.undo,!0),e.redo=t.transform(e.redo,!0)})),this.stack.redo.forEach((function(e){e.undo=t.transform(e.undo,!0),e.redo=t.transform(e.redo,!0)}))}},{key:"undo",value:function(){this.change("undo","redo")}}]),e}(s(r(9)).default);function u(t){var e=t.reduce((function(t,e){return t+(e.delete||0)}),0),r=t.length()-e;return function(t){var e=t.ops[t.ops.length-1];return null!=e&&(null!=e.insert?"string"==typeof e.insert&&e.insert.endsWith("\n"):null!=e.attributes&&Object.keys(e.attributes).some((function(t){return null!=i.default.query(t,i.default.Scope.BLOCK)})))}(t)&&(r-=1),r}a.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1},e.default=a,e.getLastChangeIndex=u},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.BaseTooltip=void 0;var n=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"link",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null!=e?this.textbox.value=e:t!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+t)||""),this.root.setAttribute("data-mode",t)}},{key:"restoreFocus",value:function(){var t=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=t}},{key:"save",value:function(){var t,e,r=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":var n=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",r,a.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",r,a.default.sources.USER)),this.quill.root.scrollTop=n;break;case"video":r=(e=(t=r).match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/))?(e[1]||"https")+"://www.youtube.com/embed/"+e[2]+"?showinfo=0":(e=t.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(e[1]||"https")+"://player.vimeo.com/video/"+e[2]+"/":t;case"formula":if(!r)break;var i=this.quill.getSelection(!0);if(null!=i){var o=i.index+i.length;this.quill.insertEmbed(o,this.root.getAttribute("data-mode"),r,a.default.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(o+1," ",a.default.sources.USER),this.quill.setSelection(o+2,a.default.sources.USER)}}this.textbox.value="",this.hide()}}]),e}(d.default);function N(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.forEach((function(e){var n=document.createElement("option");e===r?n.setAttribute("selected","selected"):n.setAttribute("value",e),t.appendChild(n)}))}e.BaseTooltip=_,e.default=A},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){this.head=this.tail=null,this.length=0}return t.prototype.append=function(){for(var t=[],e=0;e1&&this.append.apply(this,t.slice(1))},t.prototype.contains=function(t){for(var e,r=this.iterator();e=r();)if(e===t)return!0;return!1},t.prototype.insertBefore=function(t,e){t&&(t.next=e,null!=e?(t.prev=e.prev,null!=e.prev&&(e.prev.next=t),e.prev=t,e===this.head&&(this.head=t)):null!=this.tail?(this.tail.next=t,t.prev=this.tail,this.tail=t):(t.prev=null,this.head=this.tail=t),this.length+=1)},t.prototype.offset=function(t){for(var e=0,r=this.head;null!=r;){if(r===t)return e;e+=r.length(),r=r.next}return-1},t.prototype.remove=function(t){this.contains(t)&&(null!=t.prev&&(t.prev.next=t.next),null!=t.next&&(t.next.prev=t.prev),t===this.head&&(this.head=t.next),t===this.tail&&(this.tail=t.prev),this.length-=1)},t.prototype.iterator=function(t){return void 0===t&&(t=this.head),function(){var e=t;return null!=t&&(t=t.next),e}},t.prototype.find=function(t,e){void 0===e&&(e=!1);for(var r,n=this.iterator();r=n();){var i=r.length();if(ts?r(n,t-s,Math.min(e,s+u-t)):r(n,0,Math.min(u,t+e-s)),s+=u}},t.prototype.map=function(t){return this.reduce((function(e,r){return e.push(t(r)),e}),[])},t.prototype.reduce=function(t,e){for(var r,n=this.iterator();r=n();)e=t(e,r);return e},t}();e.default=n},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=r(17),s=r(1),a={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},u=function(t){function e(e){var r=t.call(this,e)||this;return r.scroll=r,r.observer=new MutationObserver((function(t){r.update(t)})),r.observer.observe(r.domNode,a),r.attach(),r}return i(e,t),e.prototype.detach=function(){t.prototype.detach.call(this),this.observer.disconnect()},e.prototype.deleteAt=function(e,r){this.update(),0===e&&r===this.length()?this.children.forEach((function(t){t.remove()})):t.prototype.deleteAt.call(this,e,r)},e.prototype.formatAt=function(e,r,n,i){this.update(),t.prototype.formatAt.call(this,e,r,n,i)},e.prototype.insertAt=function(e,r,n){this.update(),t.prototype.insertAt.call(this,e,r,n)},e.prototype.optimize=function(e,r){var n=this;void 0===e&&(e=[]),void 0===r&&(r={}),t.prototype.optimize.call(this,r);for(var i=[].slice.call(this.observer.takeRecords());i.length>0;)e.push(i.pop());for(var a=function(t,e){void 0===e&&(e=!0),null!=t&&t!==n&&null!=t.domNode.parentNode&&(null==t.domNode[s.DATA_KEY].mutations&&(t.domNode[s.DATA_KEY].mutations=[]),e&&a(t.parent))},u=function(t){null!=t.domNode[s.DATA_KEY]&&null!=t.domNode[s.DATA_KEY].mutations&&(t instanceof o.default&&t.children.forEach(u),t.optimize(r))},l=e,h=0;l.length>0;h+=1){if(h>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(l.forEach((function(t){var e=s.find(t.target,!0);null!=e&&(e.domNode===t.target&&("childList"===t.type?(a(s.find(t.previousSibling,!1)),[].forEach.call(t.addedNodes,(function(t){var e=s.find(t,!1);a(e,!1),e instanceof o.default&&e.children.forEach((function(t){a(t,!1)}))}))):"attributes"===t.type&&a(e.prev)),a(e))})),this.children.forEach(u),i=(l=[].slice.call(this.observer.takeRecords())).slice();i.length>0;)e.push(i.pop())}},e.prototype.update=function(e,r){var n=this;void 0===r&&(r={}),(e=e||this.observer.takeRecords()).map((function(t){var e=s.find(t.target,!0);return null==e?null:null==e.domNode[s.DATA_KEY].mutations?(e.domNode[s.DATA_KEY].mutations=[t],e):(e.domNode[s.DATA_KEY].mutations.push(t),null)})).forEach((function(t){null!=t&&t!==n&&null!=t.domNode[s.DATA_KEY]&&t.update(t.domNode[s.DATA_KEY].mutations||[],r)})),null!=this.domNode[s.DATA_KEY].mutations&&t.prototype.update.call(this,this.domNode[s.DATA_KEY].mutations,r),this.optimize(e,r)},e.blotName="scroll",e.defaultChild="block",e.scope=s.Scope.BLOCK_BLOT,e.tagName="DIV",e}(o.default);e.default=u},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=r(18),s=r(1),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.formats=function(r){if(r.tagName!==e.tagName)return t.formats.call(this,r)},e.prototype.format=function(r,n){var i=this;r!==this.statics.blotName||n?t.prototype.format.call(this,r,n):(this.children.forEach((function(t){t instanceof o.default||(t=t.wrap(e.blotName,!0)),i.attributes.copy(t)})),this.unwrap())},e.prototype.formatAt=function(e,r,n,i){null!=this.formats()[n]||s.query(n,s.Scope.ATTRIBUTE)?this.isolate(e,r).format(n,i):t.prototype.formatAt.call(this,e,r,n,i)},e.prototype.optimize=function(r){t.prototype.optimize.call(this,r);var n=this.formats();if(0===Object.keys(n).length)return this.unwrap();var i=this.next;i instanceof e&&i.prev===this&&function(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t)if(t[r]!==e[r])return!1;return!0}(n,i.formats())&&(i.moveChildren(this),i.remove())},e.blotName="inline",e.scope=s.Scope.INLINE_BLOT,e.tagName="SPAN",e}(o.default);e.default=a},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=r(18),s=r(1),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.formats=function(r){var n=s.query(e.blotName).tagName;if(r.tagName!==n)return t.formats.call(this,r)},e.prototype.format=function(r,n){null!=s.query(r,s.Scope.BLOCK)&&(r!==this.statics.blotName||n?t.prototype.format.call(this,r,n):this.replaceWith(e.blotName))},e.prototype.formatAt=function(e,r,n,i){null!=s.query(n,s.Scope.BLOCK)?this.format(n,i):t.prototype.formatAt.call(this,e,r,n,i)},e.prototype.insertAt=function(e,r,n){if(null==n||null!=s.query(r,s.Scope.INLINE))t.prototype.insertAt.call(this,e,r,n);else{var i=this.split(e),o=s.create(r,n);i.parent.insertBefore(o,i)}},e.prototype.update=function(e,r){navigator.userAgent.match(/Trident/)?this.build():t.prototype.update.call(this,e,r)},e.blotName="block",e.scope=s.Scope.BLOCK_BLOT,e.tagName="P",e}(o.default);e.default=a},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.formats=function(t){},e.prototype.format=function(e,r){t.prototype.formatAt.call(this,0,this.length(),e,r)},e.prototype.formatAt=function(e,r,n,i){0===e&&r===this.length()?this.format(n,i):t.prototype.formatAt.call(this,e,r,n,i)},e.prototype.formats=function(){return this.statics.formats(this.domNode)},e}(r(19).default);e.default=o},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=r(19),s=r(1),a=function(t){function e(e){var r=t.call(this,e)||this;return r.text=r.statics.value(r.domNode),r}return i(e,t),e.create=function(t){return document.createTextNode(t)},e.value=function(t){var e=t.data;return e.normalize&&(e=e.normalize()),e},e.prototype.deleteAt=function(t,e){this.domNode.data=this.text=this.text.slice(0,t)+this.text.slice(t+e)},e.prototype.index=function(t,e){return this.domNode===t?e:-1},e.prototype.insertAt=function(e,r,n){null==n?(this.text=this.text.slice(0,e)+r+this.text.slice(e),this.domNode.data=this.text):t.prototype.insertAt.call(this,e,r,n)},e.prototype.length=function(){return this.text.length},e.prototype.optimize=function(r){t.prototype.optimize.call(this,r),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof e&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},e.prototype.position=function(t,e){return void 0===e&&(e=!1),[this.domNode,t]},e.prototype.split=function(t,e){if(void 0===e&&(e=!1),!e){if(0===t)return this;if(t===this.length())return this.next}var r=s.create(this.domNode.splitText(t));return this.parent.insertBefore(r,this.next),this.text=this.statics.value(this.domNode),r},e.prototype.update=function(t,e){var r=this;t.some((function(t){return"characterData"===t.type&&t.target===r.domNode}))&&(this.text=this.statics.value(this.domNode))},e.prototype.value=function(){return this.text},e.blotName="text",e.scope=s.Scope.INLINE_BLOT,e}(o.default);e.default=a},function(t,e,r){"use strict";var n=document.createElement("div");if(n.classList.toggle("test-class",!1),n.classList.contains("test-class")){var i=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return arguments.length>1&&!this.contains(t)==!e?e:i.call(this,t)}}String.prototype.startsWith||(String.prototype.startsWith=function(t,e){return e=e||0,this.substr(e,t.length)===t}),String.prototype.endsWith||(String.prototype.endsWith=function(t,e){var r=this.toString();("number"!=typeof e||!isFinite(e)||Math.floor(e)!==e||e>r.length)&&(e=r.length),e-=t.length;var n=r.indexOf(t,e);return-1!==n&&n===e}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,r=Object(this),n=r.length>>>0,i=arguments[1],o=0;oe.length?t:e,c=t.length>e.length?e:t,f=h.indexOf(c);if(-1!=f)return l=[[n,h.substring(0,f)],[i,c],[n,h.substring(f+c.length)]],t.length>e.length&&(l[0][0]=l[2][0]=r),l;if(1==c.length)return[[r,t],[n,e]];var d=function(t,e){var r=t.length>e.length?t:e,n=t.length>e.length?e:t;if(r.length<4||2*n.length=t.length?[n,i,o,s,c]:null}var o,s,l,h,c,f=i(r,n,Math.ceil(r.length/4)),d=i(r,n,Math.ceil(r.length/2));return f||d?(o=d?f&&f[4].length>d[4].length?f:d:f,t.length>e.length?(s=o[0],l=o[1],h=o[2],c=o[3]):(h=o[0],c=o[1],s=o[2],l=o[3]),[s,l,h,c,o[4]]):null}(t,e);if(d){var p=d[0],m=d[1],g=d[2],v=d[3],y=d[4],b=o(p,g),w=o(m,v);return b.concat([[i,y]],w)}return function(t,e){for(var i=t.length,o=e.length,a=Math.ceil((i+o)/2),u=a,l=2*a,h=new Array(l),c=new Array(l),f=0;fi)g+=2;else if(M>o)m+=2;else if(p&&(N=u+d-w)>=0&&N=(_=i-c[N]))return s(t,e,T,M)}for(var A=-b+v;A<=b-y;A+=2){for(var _,N=u+A,S=(_=A==-b||A!=b&&c[N-1]i)y+=2;else if(S>o)v+=2;else if(!p){var T;if((E=u+d-A)>=0&&E=(_=i-_)))return s(t,e,T,M)}}}return[[r,t],[n,e]]}(t,e)}(t=t.substring(0,t.length-f),e=e.substring(0,e.length-f));return d&&m.unshift([i,d]),p&&m.push([i,p]),l(m),null!=h&&(m=function(t,e){var n=function(t,e){if(0===e)return[i,t];for(var n=0,o=0;o0&&o.splice(s+2,0,[u[0],l]),c(o,s,3)}return t}(m,h)),function(t){for(var e=!1,o=function(t){return t.charCodeAt(0)>=56320&&t.charCodeAt(0)<=57343},s=2;s=55296&&a.charCodeAt(a.length-1)<=56319)&&t[s-1][0]===r&&o(t[s-1][1])&&t[s][0]===n&&o(t[s][1])&&(e=!0,t[s-1][1]=t[s-2][1].slice(-1)+t[s-1][1],t[s][1]=t[s-2][1].slice(-1)+t[s][1],t[s-2][1]=t[s-2][1].slice(0,-1));var a;if(!e)return t;var u=[];for(s=0;s0&&u.push(t[s]);return u}(m)}function s(t,e,r,n){var i=t.substring(0,r),s=e.substring(0,n),a=t.substring(r),u=e.substring(n),l=o(i,s),h=o(a,u);return l.concat(h)}function a(t,e){if(!t||!e||t.charAt(0)!=e.charAt(0))return 0;for(var r=0,n=Math.min(t.length,e.length),i=n,o=0;r1?(0!==s&&0!==h&&(0!==(e=a(f,c))&&(o-s-h>0&&t[o-s-h-1][0]==i?t[o-s-h-1][1]+=f.substring(0,e):(t.splice(0,0,[i,f.substring(0,e)]),o++),f=f.substring(e),c=c.substring(e)),0!==(e=u(f,c))&&(t[o][1]=f.substring(f.length-e)+t[o][1],f=f.substring(0,f.length-e),c=c.substring(0,c.length-e))),0===s?t.splice(o-h,s+h,[n,f]):0===h?t.splice(o-s,s+h,[r,c]):t.splice(o-s-h,s+h,[r,c],[n,f]),o=o-s-h+(s?1:0)+(h?1:0)+1):0!==o&&t[o-1][0]==i?(t[o-1][1]+=t[o][1],t.splice(o,1)):o++,h=0,s=0,c="",f=""}""===t[t.length-1][1]&&t.pop();var d=!1;for(o=1;o=0&&n>=e-1;n--)if(n+1=700)&&(r.bold=!0),Object.keys(r).length>0&&(e=T(e,r)),parseFloat(n.textIndent||0)>0&&(e=(new a.default).insert("\t").concat(e)),e}],["li",function(t,e){var r=u.default.query(t);if(null==r||"list-item"!==r.blotName||!R(e,"\n"))return e;for(var n=-1,i=t.parentNode;!i.classList.contains("ql-clipboard");)"list"===(u.default.query(i)||{}).blotName&&(n+=1),i=i.parentNode;return n<=0?e:e.compose((new a.default).retain(e.length()-1).retain(1,{indent:n}))}],["b",I.bind(I,"bold")],["i",I.bind(I,"italic")],["style",function(){return new a.default}]],_=[f.AlignAttribute,g.DirectionAttribute].reduce((function(t,e){return t[e.keyName]=e,t}),{}),N=[f.AlignStyle,d.BackgroundStyle,m.ColorStyle,g.DirectionStyle,v.FontStyle,y.SizeStyle].reduce((function(t,e){return t[e.keyName]=e,t}),{}),S=function(t){function e(t,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return n.quill.root.addEventListener("paste",n.onPaste.bind(n)),n.container=n.quill.addContainer("ql-clipboard"),n.container.setAttribute("contenteditable",!0),n.container.setAttribute("tabindex",-1),n.matchers=[],A.concat(n.options.matchers).forEach((function(t){var e=i(t,2),o=e[0],s=e[1];(r.matchVisual||s!==U)&&n.addMatcher(o,s)})),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),o(e,[{key:"addMatcher",value:function(t,e){this.matchers.push([t,e])}},{key:"convert",value:function(t){if("string"==typeof t)return this.container.innerHTML=t.replace(/\>\r?\n +\<"),this.convert();var e=this.quill.getFormat(this.quill.selection.savedRange.index);if(e[p.default.blotName]){var r=this.container.innerText;return this.container.innerHTML="",(new a.default).insert(r,w({},p.default.blotName,e[p.default.blotName]))}var n=this.prepareMatching(),o=i(n,2),s=o[0],u=o[1],l=O(this.container,s,u);return R(l,"\n")&&null==l.ops[l.ops.length-1].attributes&&(l=l.compose((new a.default).retain(l.length()-1).delete(1))),E.log("convert",this.container.innerHTML,l),this.container.innerHTML="",l}},{key:"dangerouslyPasteHTML",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default.sources.API;if("string"==typeof t)this.quill.setContents(this.convert(t),e),this.quill.setSelection(0,l.default.sources.SILENT);else{var n=this.convert(e);this.quill.updateContents((new a.default).retain(t).concat(n),r),this.quill.setSelection(t+n.length(),l.default.sources.SILENT)}}},{key:"onPaste",value:function(t){var e=this;if(!t.defaultPrevented&&this.quill.isEnabled()){var r=this.quill.getSelection(),n=(new a.default).retain(r.index),i=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(l.default.sources.SILENT),setTimeout((function(){n=n.concat(e.convert()).delete(r.length),e.quill.updateContents(n,l.default.sources.USER),e.quill.setSelection(n.length()-r.length,l.default.sources.SILENT),e.quill.scrollingContainer.scrollTop=i,e.quill.focus()}),1)}}},{key:"prepareMatching",value:function(){var t=this,e=[],r=[];return this.matchers.forEach((function(n){var o=i(n,2),s=o[0],a=o[1];switch(s){case Node.TEXT_NODE:r.push(a);break;case Node.ELEMENT_NODE:e.push(a);break;default:[].forEach.call(t.container.querySelectorAll(s),(function(t){t[M]=t[M]||[],t[M].push(a)}))}})),[e,r]}}]),e}(c.default);function T(t,e,r){return"object"===(void 0===e?"undefined":n(e))?Object.keys(e).reduce((function(t,r){return T(t,r,e[r])}),t):t.reduce((function(t,n){return n.attributes&&n.attributes[e]?t.push(n):t.insert(n.insert,(0,s.default)({},w({},e,r),n.attributes))}),new a.default)}function k(t){if(t.nodeType!==Node.ELEMENT_NODE)return{};var e="__ql-computed-style";return t[e]||(t[e]=window.getComputedStyle(t))}function R(t,e){for(var r="",n=t.ops.length-1;n>=0&&r.length-1}function O(t,e,r){return t.nodeType===t.TEXT_NODE?r.reduce((function(e,r){return r(t,e)}),new a.default):t.nodeType===t.ELEMENT_NODE?[].reduce.call(t.childNodes||[],(function(n,i){var o=O(i,e,r);return i.nodeType===t.ELEMENT_NODE&&(o=e.reduce((function(t,e){return e(i,t)}),o),o=(i[M]||[]).reduce((function(t,e){return e(i,t)}),o)),n.concat(o)}),new a.default):new a.default}function I(t,e,r){return T(r,t,!0)}function C(t,e){var r=u.default.Attributor.Attribute.keys(t),n=u.default.Attributor.Class.keys(t),i=u.default.Attributor.Style.keys(t),o={};return r.concat(n).concat(i).forEach((function(e){var r=u.default.query(e,u.default.Scope.ATTRIBUTE);null!=r&&(o[r.attrName]=r.value(t),o[r.attrName])||(null==(r=_[e])||r.attrName!==e&&r.keyName!==e||(o[r.attrName]=r.value(t)||void 0),null==(r=N[e])||r.attrName!==e&&r.keyName!==e||(r=N[e],o[r.attrName]=r.value(t)||void 0))})),Object.keys(o).length>0&&(e=T(e,o)),e}function P(t,e){var r=u.default.query(t);if(null==r)return e;if(r.prototype instanceof u.default.Embed){var n={},i=r.value(t);null!=i&&(n[r.blotName]=i,e=(new a.default).insert(n,r.formats(t)))}else"function"==typeof r.formats&&(e=T(e,r.blotName,r.formats(t)));return e}function L(t,e){return R(e,"\n")||(x(t)||e.length()>0&&t.nextSibling&&x(t.nextSibling))&&e.insert("\n"),e}function U(t,e){if(x(t)&&null!=t.nextElementSibling&&!R(e,"\n\n")){var r=t.offsetHeight+parseFloat(k(t).marginTop)+parseFloat(k(t).marginBottom);t.nextElementSibling.offsetTop>t.offsetTop+1.5*r&&e.insert("\n")}return e}function B(t,e){var r=t.data;if("O:P"===t.parentNode.tagName)return e.insert(r.trim());if(0===r.trim().length&&t.parentNode.classList.contains("ql-clipboard"))return e;if(!k(t.parentNode).whiteSpace.startsWith("pre")){var n=function(t,e){return(e=e.replace(/[^\u00a0]/g,"")).length<1&&t?" ":e};r=(r=r.replace(/\r\n/g," ").replace(/\n/g," ")).replace(/\s\s+/g,n.bind(n,!0)),(null==t.previousSibling&&x(t.parentNode)||null!=t.previousSibling&&x(t.previousSibling))&&(r=r.replace(/^\s+/,n.bind(n,!1))),(null==t.nextSibling&&x(t.parentNode)||null!=t.nextSibling&&x(t.nextSibling))&&(r=r.replace(/\s+$/,n.bind(n,!1)))}return e.insert(r)}S.DEFAULTS={matchers:[],matchVisual:!0},e.default=S,e.matchAttributor=C,e.matchBlot=P,e.matchNewline=L,e.matchSpacing=U,e.matchText=B},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,i=function(){function t(t,e){for(var r=0;r '},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,i=function(){function t(t,e){for(var r=0;rn.right&&(o=n.right-i.right,this.root.style.left=e+o+"px"),i.leftn.bottom){var s=i.bottom-i.top,a=t.bottom-t.top+s;this.root.style.top=r-a+"px",this.root.classList.add("ql-flip")}return o}},{key:"show",value:function(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}]),t}();e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0},i=function(){function t(t,e){for(var r=0;r','','',''].join(""),e.default=v},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=L(r(29)),i=r(36),o=r(38),s=r(64),a=L(r(65)),u=L(r(66)),l=r(67),h=L(l),c=r(37),f=r(26),d=r(39),p=r(40),m=L(r(56)),g=L(r(68)),v=L(r(27)),y=L(r(69)),b=L(r(70)),w=L(r(71)),E=L(r(72)),M=L(r(73)),A=r(13),_=L(A),N=L(r(74)),S=L(r(75)),T=L(r(57)),k=L(r(41)),R=L(r(28)),x=L(r(59)),O=L(r(60)),I=L(r(61)),C=L(r(108)),P=L(r(62));function L(t){return t&&t.__esModule?t:{default:t}}n.default.register({"attributors/attribute/direction":o.DirectionAttribute,"attributors/class/align":i.AlignClass,"attributors/class/background":c.BackgroundClass,"attributors/class/color":f.ColorClass,"attributors/class/direction":o.DirectionClass,"attributors/class/font":d.FontClass,"attributors/class/size":p.SizeClass,"attributors/style/align":i.AlignStyle,"attributors/style/background":c.BackgroundStyle,"attributors/style/color":f.ColorStyle,"attributors/style/direction":o.DirectionStyle,"attributors/style/font":d.FontStyle,"attributors/style/size":p.SizeStyle},!0),n.default.register({"formats/align":i.AlignClass,"formats/direction":o.DirectionClass,"formats/indent":s.IndentClass,"formats/background":c.BackgroundStyle,"formats/color":f.ColorStyle,"formats/font":d.FontClass,"formats/size":p.SizeClass,"formats/blockquote":a.default,"formats/code-block":_.default,"formats/header":u.default,"formats/list":h.default,"formats/bold":m.default,"formats/code":A.Code,"formats/italic":g.default,"formats/link":v.default,"formats/script":y.default,"formats/strike":b.default,"formats/underline":w.default,"formats/image":E.default,"formats/video":M.default,"formats/list/item":l.ListItem,"modules/formula":N.default,"modules/syntax":S.default,"modules/toolbar":T.default,"themes/bubble":C.default,"themes/snow":P.default,"ui/icons":k.default,"ui/picker":R.default,"ui/icon-picker":O.default,"ui/color-picker":x.default,"ui/tooltip":I.default},!0),e.default=n.default},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IndentClass=void 0;var n,i=function(){function t(t,e){for(var r=0;r0&&this.children.tail.format(t,e)}},{key:"formats",value:function(){return t={},e=this.statics.blotName,r=this.statics.formats(this.domNode),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t;var t,e,r}},{key:"insertBefore",value:function(t,r){if(t instanceof f)i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertBefore",this).call(this,t,r);else{var n=null==r?this.length():r.offset(this),o=this.split(n);o.parent.insertBefore(t,o)}}},{key:"optimize",value:function(t){i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t);var r=this.next;null!=r&&r.prev===this&&r.statics.blotName===this.statics.blotName&&r.domNode.tagName===this.domNode.tagName&&r.domNode.getAttribute("data-checked")===this.domNode.getAttribute("data-checked")&&(r.moveChildren(this),r.remove())}},{key:"replace",value:function(t){if(t.statics.blotName!==this.statics.blotName){var r=o.default.create(this.statics.defaultChild);t.moveChildren(r),this.appendChild(r)}i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"replace",this).call(this,t)}}]),e}(a.default);d.blotName="list",d.scope=o.default.Scope.BLOCK_BLOT,d.tagName=["OL","UL"],d.defaultChild="list-item",d.allowedChildren=[f],e.ListItem=f,e.default=d},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,i=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(((n=r(56))&&n.__esModule?n:{default:n}).default);i.blotName="italic",i.tagName=["EM","I"],e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,i=function(){function t(t,e){for(var r=0;r-1?r?this.domNode.setAttribute(t,r):this.domNode.removeAttribute(t):o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"format",this).call(this,t,r)}}],[{key:"create",value:function(t){var r=o(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return"string"==typeof t&&r.setAttribute("src",this.sanitize(t)),r}},{key:"formats",value:function(t){return u.reduce((function(e,r){return t.hasAttribute(r)&&(e[r]=t.getAttribute(r)),e}),{})}},{key:"match",value:function(t){return/\.(jpe?g|gif|png)$/.test(t)||/^data:image\/.+;base64/.test(t)}},{key:"sanitize",value:function(t){return(0,a.sanitize)(t,["http","https","data"])?t:"//:0"}},{key:"value",value:function(t){return t.getAttribute("src")}}]),e}(s.default.Embed);l.blotName="image",l.tagName="IMG",e.default=l},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,i=function(){function t(t,e){for(var r=0;r-1?r?this.domNode.setAttribute(t,r):this.domNode.removeAttribute(t):o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"format",this).call(this,t,r)}}],[{key:"create",value:function(t){var r=o(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return r.setAttribute("frameborder","0"),r.setAttribute("allowfullscreen",!0),r.setAttribute("src",this.sanitize(t)),r}},{key:"formats",value:function(t){return u.reduce((function(e,r){return t.hasAttribute(r)&&(e[r]=t.getAttribute(r)),e}),{})}},{key:"sanitize",value:function(t){return a.default.sanitize(t)}},{key:"value",value:function(t){return t.getAttribute("src")}}]),e}(s.BlockEmbed);l.blotName="video",l.className="ql-video",l.tagName="IFRAME",e.default=l},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.FormulaBlot=void 0;var n=function(){function t(t,e){for(var r=0;r0||null==this.cachedText)&&(this.domNode.innerHTML=t(e),this.domNode.normalize(),this.attach()),this.cachedText=e)}}]),e}(u(r(13)).default);f.className="ql-syntax";var d=new o.default.Attributor.Class("token","hljs",{scope:o.default.Scope.INLINE}),p=function(t){function e(t,r){l(this,e);var n=h(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));if("function"!=typeof n.options.highlight)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");var i=null;return n.quill.on(s.default.events.SCROLL_OPTIMIZE,(function(){clearTimeout(i),i=setTimeout((function(){n.highlight(),i=null}),n.options.interval)})),n.highlight(),n}return c(e,t),n(e,null,[{key:"register",value:function(){s.default.register(d,!0),s.default.register(f,!0)}}]),n(e,[{key:"highlight",value:function(){var t=this;if(!this.quill.selection.composing){this.quill.update(s.default.sources.USER);var e=this.quill.getSelection();this.quill.scroll.descendants(f).forEach((function(e){e.highlight(t.options.highlight)})),this.quill.update(s.default.sources.SILENT),null!=e&&this.quill.setSelection(e,s.default.sources.SILENT)}}}]),e}(a.default);p.DEFAULTS={highlight:null==window.hljs?null:function(t){return window.hljs.highlightAuto(t).value},interval:1e3},e.CodeBlock=f,e.CodeToken=d,e.default=p},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.BubbleTooltip=void 0;var n=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0},i=function(){function t(t,e){for(var r=0;r0&&i===s.default.sources.USER){n.show(),n.root.style.left="0px",n.root.style.width="",n.root.style.width=n.root.offsetWidth+"px";var o=n.quill.getLines(e.index,e.length);if(1===o.length)n.position(n.quill.getBounds(e));else{var a=o[o.length-1],u=n.quill.getIndex(a),h=Math.min(a.length()-1,e.index+e.length-u),c=n.quill.getBounds(new l.Range(u,h));n.position(c)}}else document.activeElement!==n.textbox&&n.quill.hasFocus()&&n.hide()})),n}return p(e,t),i(e,[{key:"listen",value:function(){var t=this;n(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"listen",this).call(this),this.root.querySelector(".ql-close").addEventListener("click",(function(){t.root.classList.remove("ql-editing")})),this.quill.on(s.default.events.SCROLL_OPTIMIZE,(function(){setTimeout((function(){if(!t.root.classList.contains("ql-hidden")){var e=t.quill.getSelection();null!=e&&t.position(t.quill.getBounds(e))}}),1)}))}},{key:"cancel",value:function(){this.show()}},{key:"position",value:function(t){var r=n(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"position",this).call(this,t),i=this.root.querySelector(".ql-tooltip-arrow");if(i.style.marginLeft="",0===r)return r;i.style.marginLeft=-1*r-i.offsetWidth/2+"px"}}]),e}(a.BaseTooltip);v.TEMPLATE=['','
','','',"
"].join(""),e.BubbleTooltip=v,e.default=g},function(t,e,r){t.exports=r(63)}]).default},t.exports=e()},8677:()=>{},2808:()=>{},5883:()=>{},6601:()=>{},9649:()=>{},7801:()=>{},6658:()=>{},6042:()=>{},4801:()=>{},8067:()=>{},991:()=>{}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.amdO={},r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{"use strict";var t=r(7319),e=r(7086),n=r(2548),i=r(1974),o=r(8147),s=r(8891),a=r(4970),u=r(9446),l=r(4376),h=r(5132);(0,t.initBooks)(),(0,e.initContributors)(),(0,i.initQuill)(),(0,o.initQuillValueToInput)(),(0,n.initWallet)(),(0,s.initComments)(),(0,a.initVote)(),(0,u.initTheme)(),(0,l.initApprove)(),(0,h.initStar)()})()})(); \ No newline at end of file diff --git a/app/templates/book/index.html b/app/templates/book/index.html index e4884ae..78a70f1 100644 --- a/app/templates/book/index.html +++ b/app/templates/book/index.html @@ -29,9 +29,9 @@

{% endif %}
- - -

{{ book.stars|length }}

+ + +

{{ book.stars|length }}

diff --git a/app/templates/book/stat.html b/app/templates/book/stat.html index 687ccfc..8fc923a 100644 --- a/app/templates/book/stat.html +++ b/app/templates/book/stat.html @@ -38,8 +38,15 @@ - {% for star in book.stars %} - + {% for user in book.stars %} + + + + {% endfor %}
Username Address
{{star.user.username}} {{star.user.wallet_id}}
+ {{user.username}} + + {{user.wallet_id}} +
diff --git a/app/templates/home/index.html b/app/templates/home/index.html index 8b2df55..bccd63d 100644 --- a/app/templates/home/index.html +++ b/app/templates/home/index.html @@ -108,9 +108,9 @@

Last updated on {{book.versions[-1].updated_at.strftime('%B %d, %Y')}}

{% endif %}
- - -

{{ book.stars|length }}

+ + + {{ book.stars|length }} diff --git a/app/views/__init__.py b/app/views/__init__.py index 63e3ecc..5fffcb1 100644 --- a/app/views/__init__.py +++ b/app/views/__init__.py @@ -7,3 +7,4 @@ from .home import bp as home_blueprint from .section import bp as section_blueprint from .vote import bp as vote_blueprint from .approve import bp as approve_blueprint +from .star import bp as star_blueprint diff --git a/app/views/book.py b/app/views/book.py index cd13157..4dd512e 100644 --- a/app/views/book.py +++ b/app/views/book.py @@ -154,8 +154,7 @@ def statistic_view(book_id: int): log(log.WARNING, "Book with id [%s] not found", book_id) flash("Book not found", "danger") return redirect(url_for("book.my_library")) - else: - return render_template("book/stat.html", book=book) + return render_template("book/stat.html", book=book) @bp.route("///subcollections", methods=["GET"]) diff --git a/app/views/star.py b/app/views/star.py new file mode 100644 index 0000000..d399cf5 --- /dev/null +++ b/app/views/star.py @@ -0,0 +1,47 @@ +from flask import ( + Blueprint, + jsonify, +) +from flask_login import login_required, current_user + +from app import models as m, db +from app.logger import log + +bp = Blueprint("star", __name__, url_prefix="/star") + + +@bp.route( + "/", + methods=["POST"], +) +@login_required +def star_book(book_id: int): + book: m.Book = db.session.get(m.Book, book_id) + if not book: + log(log.WARNING, "Book with id [%s] not found", book_id) + return jsonify({"message": "Book not found"}), 404 + + book_star: m.BookStar = m.BookStar.query.filter_by( + user_id=current_user.id, book_id=book_id + ).first() + current_user_star = True + if book_star: + current_user_star = False + db.session.delete(book_star) + db.session.commit() + else: + book_star = m.BookStar(user_id=current_user.id, book_id=book_id) + log( + log.INFO, + "User [%s]. Add book [%s] star", + current_user, + book, + ) + book_star.save() + + return jsonify( + { + "stars_count": len(book.stars), + "current_user_star": current_user_star, + } + ) diff --git a/src/main.ts b/src/main.ts index 7c1e08d..228f0b9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -7,6 +7,7 @@ import {initComments} from './comment'; import {initVote} from './vote'; import {initTheme} from './theme'; import {initApprove} from './approve'; +import {initStar} from './star'; initBooks(); initContributors(); @@ -17,3 +18,4 @@ initComments(); initVote(); initTheme(); initApprove(); +initStar(); diff --git a/src/star.ts b/src/star.ts new file mode 100644 index 0000000..7662ae3 --- /dev/null +++ b/src/star.ts @@ -0,0 +1,38 @@ +const starClickEventListener = async (btn: Element, totalStars: Element) => { + const bookId = btn.getAttribute('data-book-id'); + + const requestUrl = '/star/' + bookId; + const response = await fetch(requestUrl, { + method: 'POST', + credentials: 'include', + headers: { + 'Content-Type': 'application/json', + }, + }); + + const json = await response.json(); + const currentUserStar = json.current_user_star; + const starsCount = json.stars_count; + + totalStars.innerHTML = starsCount; + + btn.classList.remove('fill-yellow-300'); + if (currentUserStar) { + btn.classList.add('fill-yellow-300'); + } else { + btn.classList.remove('fill-yellow-300'); + } +}; + +export function initStar() { + const bookStarsBlocks = document.querySelectorAll('.book-star-block'); + + bookStarsBlocks.forEach(bookStarsBlock => { + const bookStarBtn = bookStarsBlock.querySelector('.star-btn'); + const totalStarsDiv = bookStarsBlock.querySelector('.total-stars'); + + bookStarBtn.addEventListener('click', () => { + starClickEventListener(bookStarBtn, totalStarsDiv); + }); + }); +} diff --git a/tests/test_star.py b/tests/test_star.py new file mode 100644 index 0000000..4fb89b4 --- /dev/null +++ b/tests/test_star.py @@ -0,0 +1,58 @@ +from flask import current_app as Response +from flask.testing import FlaskClient + +from app import models as m +from tests.utils import login + + +def test_star(client: FlaskClient): + _, user = login(client) + + response: Response = client.post( + "/star/999", + data=dict( + positive=True, + ), + follow_redirects=True, + ) + + assert response + assert response.status_code == 404 + assert response.json["message"] == "Book not found" + + book = m.Book( + label="Test Interpretation 1 Label", + user_id=user.id, + ).save() + + assert len(book.stars) == 0 + + response: Response = client.post( + f"/star/{book.id}", + follow_redirects=True, + ) + + assert response + assert response.status_code == 200 + json = response.json + assert json + assert "stars_count" in json + assert json["stars_count"] == 1 + assert "current_user_star" in json + assert json["current_user_star"] + assert len(book.stars) == 1 + + response: Response = client.post( + f"/star/{book.id}", + follow_redirects=True, + ) + + assert response + assert response.status_code == 200 + json = response.json + assert json + assert "stars_count" in json + assert json["stars_count"] == 0 + assert "current_user_star" in json + assert not json["current_user_star"] + assert len(book.stars) == 0